@eyepop.ai/eyepop 3.14.1 → 3.14.2

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.
@@ -125,399 +125,9 @@ interface PredictedKeyPoints {
125
125
  interface PredictedKeyPoint extends Point3d, PredictedClass {
126
126
  visible: boolean | undefined;
127
127
  }
128
-
129
- declare enum PredictionVersion {
130
- V1 = 1,
131
- V2 = 2
132
- }
133
- declare const DEFAULT_PREDICTION_VERSION: PredictionVersion;
134
- interface WorkerSession extends Session {
135
- readonly popId: string;
136
- readonly baseUrl: string | undefined;
137
- readonly pipelineId: string | undefined;
138
- authenticationHeaders(): any;
139
- }
140
- declare enum VideoMode {
141
- STREAM = "stream",
142
- BUFFER = "buffer"
143
- }
144
- interface FileSource {
145
- readonly file: File;
146
- readonly videoMode?: VideoMode | undefined;
147
- }
148
- interface StreamSource {
149
- readonly stream: ReadableStream<Uint8Array> | Blob | BufferSource;
150
- readonly mimeType: string;
151
- readonly size?: number | undefined;
152
- readonly videoMode?: VideoMode | undefined;
153
- }
154
- interface PathSource {
155
- readonly path: string;
156
- readonly mimeType?: string | undefined;
157
- readonly videoMode?: VideoMode | undefined;
158
- }
159
- interface MediaStreamSource {
160
- readonly mediaStream: MediaStream;
161
- }
162
- interface UrlSource {
163
- readonly url: string;
164
- }
165
- interface AssetUuidSource {
166
- readonly assetUuid: string;
167
- }
168
- type Source = FileSource | StreamSource | PathSource | UrlSource | AssetUuidSource | MediaStreamSource;
169
- interface ResultStream extends AsyncIterable<Prediction> {
170
- cancel(): void;
171
- }
172
- declare enum PopComponentType {
173
- FORWARD = "forward",
174
- INFERENCE = "inference",
175
- TRACING = "tracing",
176
- TRACKING = "tracking",
177
- CONTOUR_FINDER = "contour_finder",
178
- COMPONENT_FINDER = "component_finder"
179
- }
180
- declare enum ForwardOperatorType {
181
- FULL = "full",
182
- CROP = "crop",
183
- CROP_WITH_FULL_FALLBACK = "crop_with_full_fallback"
184
- }
185
- interface PopCrop {
186
- maxItems?: number;
187
- boxPadding?: number;
188
- orientationTargetAngle?: number;
189
- }
190
- interface PopForwardOperator {
191
- type: ForwardOperatorType;
192
- includeClasses?: string[];
193
- crop?: PopCrop;
194
- }
195
- interface PopForward {
196
- operator?: PopForwardOperator;
197
- targets: PopComponent[];
198
- }
199
- interface BaseComponent {
200
- type: PopComponentType;
201
- id?: number;
202
- forward?: PopForward;
203
- }
204
- interface ForwardComponent extends BaseComponent {
205
- }
206
- declare enum InferenceType {
207
- IMAGE_CLASSIFICATION = "image_classification",
208
- OBJECT_DETECTION = "object_detection",
209
- KEY_POINTS = "key_points",
210
- OCR = "ocr",
211
- MESH = "mesh",
212
- FEATURE_VECTOR = "feature_vector",
213
- SEMANTIC_SEGMENTATION = "semantic_segmentation",
214
- SEGMENTATION = "segmentation"
215
- }
216
- interface InferenceComponent extends BaseComponent {
217
- inferenceTypes?: InferenceType[];
218
- hidden?: boolean;
219
- modelUuid?: string;
220
- model?: string;
221
- abilityUuid?: string;
222
- ability?: string;
223
- categoryName?: string;
224
- confidenceThreshold?: number;
225
- topK?: number;
226
- topKClasses?: number;
227
- targetFps?: string;
228
- videoChunkLengthSeconds?: number;
229
- videoChunkOverlap?: number;
230
- params?: {
231
- [index: string]: any;
232
- };
233
- }
234
- declare enum MotionModel {
235
- RANDOM_WALK = "random_walk",
236
- CONSTANT_VELOCITY = "constant_velocity",
237
- CONSTANT_ACCELERATION = "constant_acceleration"
238
- }
239
- interface TrackingComponent extends BaseComponent {
240
- reidModelUuid?: string;
241
- reidModel?: string;
242
- maxAgeSeconds?: number;
243
- iouThreshold?: number;
244
- simThreshold?: number;
245
- agnostic?: boolean;
246
- processNoisePosition?: number;
247
- processNoiseVelocity?: number;
248
- processNoiseAcceleration?: number;
249
- processNoiseScale?: number;
250
- processNoiseAspectRatio?: number;
251
- measurementNoiseCx?: number;
252
- measurementNoiseCy?: number;
253
- measurementNoiseArea?: number;
254
- measurementNoiseAspectRatio?: number;
255
- motionModel?: MotionModel;
256
- downweightLowConfidenceDetections?: boolean;
257
- classBeta?: number;
258
- classGamma?: number;
259
- classHysteresis?: boolean;
260
- classHysteresisHighThreshold?: number;
261
- classHysteresisLowThreshold?: number;
262
- classHysteresisMinHoldFrames?: number;
263
- classHysteresisAllowedClasses?: string[];
264
- }
265
- declare enum ContourType {
266
- ALL_PIXELS = "all_pixels",
267
- POLYGON = "polygon",
268
- CONVEX_HULL = "convex_hull",
269
- HOUGH_CIRCLES = "hough_circles",
270
- CIRCLE = "circle",
271
- TRIANGLE = "triangle",
272
- RECTANGLE = "rectangle"
273
- }
274
- interface ContourFinderComponent extends BaseComponent {
275
- contourType: ContourType;
276
- areaThreshold?: number;
277
- }
278
- interface ComponentFinderComponent extends BaseComponent {
279
- dilate?: number;
280
- erode?: number;
281
- keepSource?: boolean;
282
- componentClassLabel?: string;
283
- }
284
- type PopComponent = ForwardComponent | InferenceComponent | TrackingComponent | ContourFinderComponent | ComponentFinderComponent;
285
- interface Pop {
286
- components: PopComponent[];
287
- postTransform?: string;
288
- }
289
- interface ComponentParams {
290
- componentId: number;
291
- values: {
292
- [index: string]: any;
293
- };
294
- }
295
-
296
- interface Auth0Options {
297
- domain: string;
298
- clientId: string;
299
- audience: string;
300
- scope: string;
301
- }
302
- interface ApiKeyAuth {
303
- /**
304
- * Authentication api key for server side execution.
305
- * Defaults to process.env['EYEPOP_API_KEY'].
306
- */
307
- apiKey: string;
308
- }
309
- interface SessionAuth {
310
- /**
311
- * Temporary authentication token for client side execution.
312
- */
313
- session: Session;
314
- }
315
- interface OAuth2Auth {
316
- /**
317
- * For development mode, authenticate with your dashboard.eyepop.ai account
318
- */
319
- oAuth2: true | Auth0Options;
320
- }
321
- interface LocalAuth {
322
- /**
323
- * Implicit auth w/o credentials to a local endpoint.
324
- */
325
- isLocal: true;
326
- }
327
- type Authentication = undefined | ApiKeyAuth | SessionAuth | OAuth2Auth | LocalAuth;
328
- interface HttpClient {
329
- fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
330
- close(): Promise<void>;
331
- isFullDuplex(): boolean;
332
- }
333
- interface PlatformSupport {
334
- createHttpClient?: (logger: Logger) => Promise<HttpClient>;
335
- resolvePath: (source: PathSource, logger: Logger) => Promise<StreamSource>;
336
- }
337
- interface Options {
338
- auth?: Authentication | undefined;
339
- /**
340
- * Override the default base URL for the API, e.g., "https://api.eyepop.ai/"
341
- *
342
- * Defaults to process.env['EYEPOP_URL'].
343
- */
344
- eyepopUrl?: string | undefined;
345
- jobQueueLength?: number;
346
- logger?: Logger | undefined;
347
- platformSupport?: PlatformSupport;
348
- }
349
-
350
- /** Semaphores are initialized with a number of permits that get aquired and released
351
- * over the lifecycle of the semaphore. These permits limit the number of simultaneous
352
- * executions of the code that the semaphore synchronizes. Functions can wait on a semaphore
353
- * and stop executing until a permit becomes available.
354
- *
355
- * Locks are a special case of semaphores that only allow one execution of a critical section.
356
- * If you need a lock, you can import the Lock class from this package.
357
- *
358
- * This Semaphore class is implemented with the help of promises that get returned
359
- * by functions that wait for permits to become available. This makes it possible
360
- * to use async/await to synchronize your code.
361
- */
362
- declare class Semaphore {
363
- private permits;
364
- private promiseResolverQueue;
365
- /**
366
- * Creates a semaphore.
367
- * @param permits The number of permits, i.e. strands of execution being allowed
368
- * to run in parallel.
369
- * This number can be initialized with a negative integer.
370
- */
371
- constructor(permits: number);
372
- /**
373
- * Returns the number of available permits.
374
- * @returns The number of available permits.
375
- */
376
- getPermits(): number;
377
- /**
378
- * Returns a promise used to wait for a permit to become available. This method should be awaited on.
379
- * @returns A promise that gets resolved when execution is allowed to proceed.
380
- */
381
- wait(): Promise<boolean>;
382
- /**
383
- * Alias for {@linkcode Semaphore.wait}.
384
- * @returns A promise that gets resolved when execution is allowed to proceed.
385
- */
386
- acquire(): Promise<boolean>;
387
- /**
388
- * Same as {@linkcode Semaphore.wait} except the promise returned gets resolved with false if no
389
- * permit becomes available in time.
390
- * @param milliseconds The time spent waiting before the wait is aborted. This is a lower bound,
391
- * you shouldn't rely on it being precise.
392
- * @returns A promise that gets resolved to true when execution is allowed to proceed or
393
- * false if the time given elapses before a permit becomes available.
394
- */
395
- waitFor(milliseconds: number): Promise<boolean>;
396
- /**
397
- * Synchronous function that tries to acquire a permit and returns true if successful, false otherwise.
398
- * @returns Whether a permit could be acquired.
399
- */
400
- tryAcquire(): boolean;
401
- /**
402
- * Acquires all permits that are currently available and returns the number of acquired permits.
403
- * @returns Number of acquired permits.
404
- */
405
- drainPermits(): number;
406
- /**
407
- * Increases the number of permits by one. If there are other functions waiting, one of them will
408
- * continue to execute in a future iteration of the event loop.
409
- */
410
- signal(): void;
411
- /**
412
- * Alias for {@linkcode Semaphore.signal}.
413
- */
414
- release(): void;
415
- /**
416
- * Schedules func to be called once a permit becomes available.
417
- * Returns a promise that resolves to the return value of func.
418
- * @typeparam T The return type of func.
419
- * @param func The function to be executed.
420
- * @return A promise that gets resolved with the return value of the function.
421
- */
422
- execute<T>(func: () => T | PromiseLike<T>): Promise<T>;
423
- }
424
-
425
- declare class Endpoint<T extends Endpoint<T>> {
426
- protected _options: Options;
427
- private _token;
428
- private _expire_token_time;
429
- protected _client: HttpClient | null;
430
- private _statusRetryHandlers;
431
- protected _limit: Semaphore;
432
- private _state;
433
- private _message;
434
- private _stateChangeHandler;
435
- protected _logger: Logger;
436
- protected readonly _requestLogger: Logger;
437
- constructor(options: Options);
438
- protected setStatusRetryHandlers(statusRetryHandlers?: Map<number, Function> | undefined): void;
439
- eyepopUrl(): string;
440
- eyepopWebApiUrl(): string;
441
- pendingJobs(): number;
442
- state(): EndpointState;
443
- lastMessage(): string | null;
444
- onStateChanged(handler: (fromState: EndpointState, toState: EndpointState) => void): T;
445
- protected updateState(newState?: EndpointState | undefined, message?: string | undefined): void;
446
- connect(): Promise<T>;
447
- disconnect(wait?: boolean): Promise<void>;
448
- session(): Promise<Session>;
449
- protected statusHandler401(_statusCode: number): void;
450
- protected fetchWithRetry(fetcher: () => Promise<Response>, retries?: number): Promise<Response>;
451
- protected reconnect(): Promise<T>;
452
- protected authorizationHeader(): Promise<string>;
453
- private currentAccessToken;
454
- }
455
-
456
- declare enum TransientPopId {
457
- Transient = "transient"
458
- }
459
- interface WorkerOptions extends Options {
460
- /**
461
- * TODO: deprecated, defaults to process.env['EYEPOP_POP_ID'].
462
- */
463
- popId?: string | TransientPopId | undefined;
464
- autoStart?: boolean;
465
- stopJobs?: boolean;
466
- isLocalMode?: boolean;
467
- }
468
-
469
- declare enum SessionStatus {
470
- UNKNOWN = "unknown",
471
- PENDING = "pending",
472
- RUNNING = "running",
473
- STOPPED = "stopped",
474
- FAILED = "failed",
475
- ERROR = "error",
476
- PIPELINE_CREATING = "pipeline_creating",
477
- PIPELINE_OK = "pipeline_ok",
478
- PIPELINE_CHECKING = "pipeline_checking",
479
- PIPELINE_ERROR = "pipeline_error"
480
- }
481
- declare class WorkerEndpoint extends Endpoint<WorkerEndpoint> {
482
- private _baseUrl;
483
- private _pipelineId;
484
- private _popName;
485
- private _pipeline;
486
- constructor(options: WorkerOptions);
487
- private options;
488
- disconnect(wait?: boolean): Promise<void>;
489
- protected statusHandler404(_: number): void;
490
- session(): Promise<WorkerSession>;
491
- popName(): string | null;
492
- pop(): Pop | null;
493
- changePop(pop: Pop): Promise<void>;
494
- private _authenticationHeaders;
495
- popId(): string | null;
496
- process(source: Source, params?: ComponentParams[]): Promise<ResultStream>;
497
- private uploadFile;
498
- private uploadStream;
499
- private uploadPath;
500
- private loadFrom;
501
- private loadFromAssetUuid;
502
- private loadMediaStream;
503
- private jobDone;
504
- private jobStatus;
505
- protected reconnect(): Promise<WorkerEndpoint>;
506
- private startWebApiSessionWithPopId;
507
- private static SESSION_DEAD;
508
- private static WAIT_FOR_IS_READY;
509
- private static CHECK_FOR_IS_READY_INTERVAL;
510
- private startComputeSession;
511
- private startTransientPipeline;
512
- }
513
-
514
- interface DataOptions extends Options {
515
- /**
516
- * Defaults to process.env['EYEPOP_ACCOUNT_ID'].
517
- */
518
- accountId?: string | undefined;
519
- disableWs?: boolean | undefined;
520
- useCookie?: boolean | undefined;
128
+ interface PredictedMotion {
129
+ begin_timestamp: number;
130
+ finished_timestamp: number | undefined;
521
131
  }
522
132
 
523
133
  declare enum DataApiType {
@@ -739,349 +349,777 @@ interface Asset {
739
349
  annotations: Annotation[];
740
350
  rois: Roi[];
741
351
  }
742
- declare enum ModelType {
743
- epdet_b1 = "epdet_b1",
744
- imported = "imported",
745
- vlm_ability = "vlm_ability"
352
+ declare enum ModelType {
353
+ epdet_b1 = "epdet_b1",
354
+ imported = "imported",
355
+ vlm_ability = "vlm_ability"
356
+ }
357
+ declare enum ModelTask {
358
+ object_detection = "object_detection",
359
+ image_classification = "image_classification",
360
+ keypoint_detection = "keypoint_detection"
361
+ }
362
+ declare enum ModelStatus {
363
+ error = "error",
364
+ draft = "draft",
365
+ requested = "requested",
366
+ in_progress = "in_progress",
367
+ available = "available",
368
+ published = "published"
369
+ }
370
+ interface ModelMetrics {
371
+ cpr?: number[][3];
372
+ }
373
+ declare enum ModelExportStatus {
374
+ in_progress = "in_progress",
375
+ finished = "finished",
376
+ error = "error"
377
+ }
378
+ declare enum ExportedBy {
379
+ eyepop = "eyepop",
380
+ qc_ai_hub = "qc_ai_hub"
381
+ }
382
+ declare enum ArtifactType {
383
+ eyepop_bundle = "eyepop_bundle",
384
+ weights_file = "weights_file"
385
+ }
386
+ interface QcAiHubExportParams {
387
+ device_name: string;
388
+ }
389
+ interface ModelExport {
390
+ format: ModelFormat;
391
+ exported_by: ExportedBy;
392
+ export_params?: QcAiHubExportParams;
393
+ status: ModelExportStatus;
394
+ status_message?: string;
395
+ }
396
+ interface Model {
397
+ uuid: string;
398
+ name: string;
399
+ description?: string;
400
+ external_id?: string;
401
+ pretrained_model_uuid?: string;
402
+ extra_params?: Map<string, any>;
403
+ task?: ModelTask;
404
+ classes?: string[];
405
+ type: ModelType;
406
+ status: ModelStatus;
407
+ status_message?: string;
408
+ metrics?: ModelMetrics;
409
+ account_uuid: string;
410
+ created_at: Date;
411
+ updated_at: Date;
412
+ dataset_uuid: string;
413
+ dataset_version: number;
414
+ exports?: ModelExport[];
415
+ }
416
+ interface ModelCreate {
417
+ name: string;
418
+ description: string;
419
+ external_id?: string;
420
+ pretrained_model_uuid?: string;
421
+ extra_params?: Map<string, any>;
422
+ task?: ModelTask;
423
+ classes?: string[];
424
+ }
425
+ interface ModelUpdate {
426
+ name: string;
427
+ description: string;
428
+ external_id?: string;
429
+ task?: ModelTask;
430
+ classes?: string[];
431
+ }
432
+ declare enum ModelTrainingStage {
433
+ waiting = "waiting",
434
+ scheduling = "scheduling",
435
+ preparing = "preparing",
436
+ training = "training",
437
+ exporting = "exporting"
438
+ }
439
+ interface ModelSample {
440
+ asset_uuid: string;
441
+ prediction: Prediction;
442
+ }
443
+ interface ModelTrainingProgress {
444
+ stage: ModelTrainingStage;
445
+ queue_length?: number;
446
+ started_at: Date;
447
+ finished_at?: Date;
448
+ metrics?: ModelMetrics;
449
+ samples?: ModelSample[];
450
+ remaining_seconds_min?: number;
451
+ remaining_seconds_max?: number;
452
+ }
453
+ declare enum ChangeType {
454
+ dataset_added = "dataset_added",
455
+ dataset_removed = "dataset_removed",
456
+ dataset_modified = "dataset_modified",
457
+ dataset_version_modified = "dataset_version_modified",
458
+ asset_added = "asset_added",
459
+ asset_removed = "asset_removed",
460
+ asset_status_modified = "asset_status_modified",
461
+ asset_annotation_modified = "asset_annotation_modified",
462
+ model_added = "model_added",
463
+ model_removed = "model_removed",
464
+ model_modified = "model_modified",
465
+ model_status_modified = "model_status_modified",
466
+ model_progress = "model_progress",
467
+ events_lost = "events_lost",
468
+ workflow_started = "workflow_started",
469
+ workflow_succeeded = "workflow_succeeded",
470
+ workflow_failed = "workflow_failed",
471
+ workflow_task_started = "workflow_task_started",
472
+ workflow_task_succeeded = "workflow_task_succeeded",
473
+ workflow_task_failed = "workflow_task_failed"
474
+ }
475
+ interface ChangeEvent {
476
+ change_type: ChangeType;
477
+ account_uuid: string;
478
+ dataset_uuid: string;
479
+ dataset_version?: number;
480
+ asset_uuid?: string;
481
+ mdl_uuid?: string;
482
+ message?: string;
483
+ workflow_task_name?: string;
484
+ }
485
+ type OnChangeEvent = (event: ChangeEvent) => Promise<void>;
486
+ interface CreateWorkflowConfig {
487
+ dataset_uuid?: string;
488
+ dataset_version?: number;
489
+ model_uuid?: string;
490
+ config?: Record<string, any>;
491
+ }
492
+ interface CreateWorkflow {
493
+ parameters?: CreateWorkflowConfig;
494
+ }
495
+ interface Workflow {
496
+ workflow_id: string;
497
+ }
498
+ interface ListWorkflowItemMetadataLabels {
499
+ account_uuid: string;
500
+ dataset_uuid?: string;
501
+ model_uuid?: string;
502
+ phase: WorkflowPhase;
503
+ }
504
+ interface ListWorkFlowItemMetadata {
505
+ workflow_id: string;
506
+ created_at: Date;
507
+ labels: ListWorkflowItemMetadataLabels;
508
+ }
509
+ interface ListWorkFlowItem {
510
+ metadata: ListWorkFlowItemMetadata;
511
+ }
512
+ declare enum WorkflowPhase {
513
+ unknown = "Unknown",
514
+ pending = "Pending",
515
+ running = "Running",
516
+ succeeded = "Succeeded",
517
+ failed = "Failed",
518
+ error = "Error"
519
+ }
520
+ declare enum ModelFormat {
521
+ TensorFlowLite = "TensorFlowLite",
522
+ TensorFlowGraphDef = "TensorFlowGraphDef",
523
+ ONNX = "ONNX",
524
+ TorchScript = "TorchScript",
525
+ TorchScriptCpu = "TorchScriptCpu",
526
+ TorchScriptCuda = "TorchScriptCuda",
527
+ PyTorch = "PyTorch",
528
+ ModelLess = "ModelLess"
529
+ }
530
+ declare enum ModelPrecisionType {
531
+ float32 = "float32",
532
+ float16 = "float16",
533
+ int32 = "int32",
534
+ int8 = "int8",
535
+ uint8 = "uint8"
536
+ }
537
+ declare enum AssetUrlType {
538
+ gcs = "gcs",
539
+ s3 = "s3",
540
+ https_signed = "https_signed"
541
+ }
542
+ interface DownloadResponse {
543
+ url: string;
544
+ url_type: AssetUrlType;
545
+ }
546
+ /** Experimental VLM API */
547
+ interface InferRuntimeConfig {
548
+ max_new_tokens?: number;
549
+ image_size?: number;
550
+ fps?: number;
551
+ max_frames?: number;
552
+ min_frames?: number;
553
+ max_aspect_ratio?: number;
554
+ context_length?: number;
555
+ roi?: Area;
556
+ }
557
+ interface TransformInto {
558
+ classes?: string[];
559
+ }
560
+ interface InferRequest {
561
+ worker_release?: string;
562
+ text_prompt?: string;
563
+ config: InferRuntimeConfig;
564
+ refresh?: boolean;
565
+ transform_into?: TransformInto;
566
+ }
567
+ interface EvaluateFilter {
568
+ partitions?: string[];
569
+ ground_truth_classes?: string[];
570
+ }
571
+ interface EvaluateConfig {
572
+ dataset_uuid: string;
573
+ filter?: EvaluateFilter;
574
+ video_chunk_length_ns?: number;
575
+ video_chunk_overlap?: number;
746
576
  }
747
- declare enum ModelTask {
748
- object_detection = "object_detection",
749
- image_classification = "image_classification",
750
- keypoint_detection = "keypoint_detection"
577
+ interface EvaluateRequest extends EvaluateConfig {
578
+ ability_uuid?: string;
579
+ infer?: InferRequest;
751
580
  }
752
- declare enum ModelStatus {
753
- error = "error",
754
- draft = "draft",
755
- requested = "requested",
756
- in_progress = "in_progress",
757
- available = "available",
758
- published = "published"
581
+ declare enum EvaluationStatus {
582
+ success = "success",
583
+ failed = "failed"
759
584
  }
760
- interface ModelMetrics {
761
- cpr?: number[][3];
585
+ interface EvaluateRunInfo {
586
+ num_images: number;
587
+ num_ground_truth_images: number;
588
+ num_videos: number;
589
+ num_ground_truth_videos: number;
590
+ total_tokens: number;
591
+ visual_tokens: number;
592
+ text_tokens: number;
593
+ output_tokens: number;
762
594
  }
763
- declare enum ModelExportStatus {
764
- in_progress = "in_progress",
765
- finished = "finished",
766
- error = "error"
595
+ interface EvaluateResponse {
596
+ dataset_uuid: string;
597
+ dataset_version: number;
598
+ status: EvaluationStatus;
599
+ status_message?: string;
600
+ source: string;
601
+ metrics?: Map<string, any>;
602
+ run_info: EvaluateRunInfo;
767
603
  }
768
- declare enum ExportedBy {
769
- eyepop = "eyepop",
770
- qc_ai_hub = "qc_ai_hub"
604
+ interface InferRunInfo {
605
+ fps?: number;
606
+ image_size?: number;
607
+ total_tokens?: number;
608
+ visual_tokens?: number;
609
+ text_tokens?: number;
610
+ output_tokens?: number;
611
+ aspect_ratio?: number;
771
612
  }
772
- declare enum ArtifactType {
773
- eyepop_bundle = "eyepop_bundle",
774
- weights_file = "weights_file"
613
+ interface AutoPromptConfig {
614
+ num_samples: number;
615
+ task_description?: string;
616
+ infer: InferRequest;
617
+ evaluate: EvaluateConfig;
775
618
  }
776
- interface QcAiHubExportParams {
777
- device_name: string;
619
+ declare enum VlmAbilityStatus {
620
+ in_progress = "in_progress",
621
+ draft = "draft",
622
+ published = "published"
778
623
  }
779
- interface ModelExport {
780
- format: ModelFormat;
781
- exported_by: ExportedBy;
782
- export_params?: QcAiHubExportParams;
783
- status: ModelExportStatus;
784
- status_message?: string;
624
+ interface AbilityAliasEntry {
625
+ alias: string;
626
+ tag: string;
785
627
  }
786
- interface Model {
787
- uuid: string;
628
+ interface VlmAbilityCreate {
788
629
  name: string;
630
+ description: string;
631
+ worker_release: string;
632
+ text_prompt: string;
633
+ transform_into: TransformInto;
634
+ config: InferRuntimeConfig;
635
+ is_public: boolean;
636
+ video_chunk_length_ns?: number;
637
+ video_chunk_overlap?: number;
638
+ }
639
+ interface VlmAbilityUpdate {
640
+ name?: string;
789
641
  description?: string;
790
- external_id?: string;
791
- pretrained_model_uuid?: string;
792
- extra_params?: Map<string, any>;
793
- task?: ModelTask;
794
- classes?: string[];
795
- type: ModelType;
796
- status: ModelStatus;
797
- status_message?: string;
798
- metrics?: ModelMetrics;
642
+ worker_release?: string;
643
+ text_prompt?: string;
644
+ transform_into?: TransformInto;
645
+ config?: InferRuntimeConfig;
646
+ is_public?: boolean;
647
+ video_chunk_length_ns?: number;
648
+ video_chunk_overlap?: number;
649
+ }
650
+ interface VlmAbility {
651
+ uuid: string;
652
+ created_at?: Date;
653
+ updated_at?: Date;
799
654
  account_uuid: string;
800
- created_at: Date;
801
- updated_at: Date;
802
- dataset_uuid: string;
803
- dataset_version: number;
804
- exports?: ModelExport[];
655
+ status: VlmAbilityStatus;
656
+ is_public: boolean;
657
+ name: string;
658
+ description: string;
659
+ vlm_ability_group_uuid?: string;
660
+ worker_release: string;
661
+ text_prompt: string;
662
+ transform_into: TransformInto;
663
+ config: InferRuntimeConfig;
664
+ video_chunk_length_ns?: number;
665
+ video_chunk_overlap?: number;
666
+ alias_entries?: AbilityAliasEntry[];
667
+ auto_prompt?: AutoPromptConfig;
805
668
  }
806
- interface ModelCreate {
669
+ interface VlmAbilityGroupCreate {
807
670
  name: string;
808
671
  description: string;
809
- external_id?: string;
810
- pretrained_model_uuid?: string;
811
- extra_params?: Map<string, any>;
812
- task?: ModelTask;
813
- classes?: string[];
672
+ auto_prompt?: AutoPromptConfig;
673
+ default_alias_name?: string;
674
+ default_dataset_uuid?: string;
814
675
  }
815
- interface ModelUpdate {
676
+ interface VlmAbilityGroupUpdate {
816
677
  name: string;
817
678
  description: string;
818
- external_id?: string;
819
- task?: ModelTask;
820
- classes?: string[];
679
+ default_alias_name?: string;
680
+ default_dataset_uuid?: string;
821
681
  }
822
- declare enum ModelTrainingStage {
823
- waiting = "waiting",
824
- scheduling = "scheduling",
825
- preparing = "preparing",
826
- training = "training",
827
- exporting = "exporting"
682
+ interface VlmAbilityGroup {
683
+ uuid: string;
684
+ created_at?: Date;
685
+ updated_at?: Date;
686
+ account_uuid: string;
687
+ name: string;
688
+ description: string;
689
+ default_alias_name?: string;
690
+ default_dataset_uuid?: string;
828
691
  }
829
- interface ModelSample {
830
- asset_uuid: string;
831
- prediction: Prediction;
692
+ interface AliasResolution {
693
+ alias: string;
694
+ model_uuid: string | null;
832
695
  }
833
- interface ModelTrainingProgress {
834
- stage: ModelTrainingStage;
835
- queue_length?: number;
836
- started_at: Date;
837
- finished_at?: Date;
838
- metrics?: ModelMetrics;
839
- samples?: ModelSample[];
840
- remaining_seconds_min?: number;
841
- remaining_seconds_max?: number;
696
+
697
+ declare enum PredictionVersion {
698
+ V1 = 1,
699
+ V2 = 2
842
700
  }
843
- declare enum ChangeType {
844
- dataset_added = "dataset_added",
845
- dataset_removed = "dataset_removed",
846
- dataset_modified = "dataset_modified",
847
- dataset_version_modified = "dataset_version_modified",
848
- asset_added = "asset_added",
849
- asset_removed = "asset_removed",
850
- asset_status_modified = "asset_status_modified",
851
- asset_annotation_modified = "asset_annotation_modified",
852
- model_added = "model_added",
853
- model_removed = "model_removed",
854
- model_modified = "model_modified",
855
- model_status_modified = "model_status_modified",
856
- model_progress = "model_progress",
857
- events_lost = "events_lost",
858
- workflow_started = "workflow_started",
859
- workflow_succeeded = "workflow_succeeded",
860
- workflow_failed = "workflow_failed",
861
- workflow_task_started = "workflow_task_started",
862
- workflow_task_succeeded = "workflow_task_succeeded",
863
- workflow_task_failed = "workflow_task_failed"
701
+ declare const DEFAULT_PREDICTION_VERSION: PredictionVersion;
702
+ interface WorkerSession extends Session {
703
+ readonly popId: string;
704
+ readonly baseUrl: string | undefined;
705
+ readonly pipelineId: string | undefined;
706
+ authenticationHeaders(): any;
707
+ }
708
+ declare enum VideoMode {
709
+ STREAM = "stream",
710
+ BUFFER = "buffer"
711
+ }
712
+ interface FileSource {
713
+ readonly file: File;
714
+ readonly videoMode?: VideoMode | undefined;
715
+ }
716
+ interface StreamSource {
717
+ readonly stream: ReadableStream<Uint8Array> | Blob | BufferSource;
718
+ readonly mimeType: string;
719
+ readonly size?: number | undefined;
720
+ readonly videoMode?: VideoMode | undefined;
721
+ }
722
+ interface PathSource {
723
+ readonly path: string;
724
+ readonly mimeType?: string | undefined;
725
+ readonly videoMode?: VideoMode | undefined;
726
+ }
727
+ interface MediaStreamSource {
728
+ readonly mediaStream: MediaStream;
729
+ }
730
+ interface UrlSource {
731
+ readonly url: string;
732
+ }
733
+ interface AssetUuidSource {
734
+ readonly assetUuid: string;
735
+ }
736
+ type Source = FileSource | StreamSource | PathSource | UrlSource | AssetUuidSource | MediaStreamSource;
737
+ interface ResultStream extends AsyncIterable<Prediction> {
738
+ cancel(): void;
739
+ }
740
+ declare enum PopComponentType {
741
+ FORWARD = "forward",
742
+ INFERENCE = "inference",
743
+ TRACING = "tracing",
744
+ TRACKING = "tracking",
745
+ CONTOUR_FINDER = "contour_finder",
746
+ COMPONENT_FINDER = "component_finder"
864
747
  }
865
- interface ChangeEvent {
866
- change_type: ChangeType;
867
- account_uuid: string;
868
- dataset_uuid: string;
869
- dataset_version?: number;
870
- asset_uuid?: string;
871
- mdl_uuid?: string;
872
- message?: string;
873
- workflow_task_name?: string;
748
+ declare enum ForwardOperatorType {
749
+ FULL = "full",
750
+ CROP = "crop",
751
+ CROP_WITH_FULL_FALLBACK = "crop_with_full_fallback"
874
752
  }
875
- type OnChangeEvent = (event: ChangeEvent) => Promise<void>;
876
- interface CreateWorkflowConfig {
877
- dataset_uuid?: string;
878
- dataset_version?: number;
879
- model_uuid?: string;
880
- config?: Record<string, any>;
753
+ interface PopCrop {
754
+ maxItems?: number;
755
+ boxPadding?: number;
756
+ orientationTargetAngle?: number;
881
757
  }
882
- interface CreateWorkflow {
883
- parameters?: CreateWorkflowConfig;
758
+ interface PopForwardOperator {
759
+ type: ForwardOperatorType;
760
+ includeClasses?: string[];
761
+ crop?: PopCrop;
884
762
  }
885
- interface Workflow {
886
- workflow_id: string;
763
+ interface PopForward {
764
+ operator?: PopForwardOperator;
765
+ targets: PopComponent[];
887
766
  }
888
- interface ListWorkflowItemMetadataLabels {
889
- account_uuid: string;
890
- dataset_uuid?: string;
891
- model_uuid?: string;
892
- phase: WorkflowPhase;
767
+ interface BaseComponent {
768
+ type: PopComponentType;
769
+ id?: number;
770
+ forward?: PopForward;
893
771
  }
894
- interface ListWorkFlowItemMetadata {
895
- workflow_id: string;
896
- created_at: Date;
897
- labels: ListWorkflowItemMetadataLabels;
772
+ interface ForwardComponent extends BaseComponent {
898
773
  }
899
- interface ListWorkFlowItem {
900
- metadata: ListWorkFlowItemMetadata;
774
+ declare enum InferenceType {
775
+ IMAGE_CLASSIFICATION = "image_classification",
776
+ OBJECT_DETECTION = "object_detection",
777
+ KEY_POINTS = "key_points",
778
+ OCR = "ocr",
779
+ MESH = "mesh",
780
+ FEATURE_VECTOR = "feature_vector",
781
+ SEMANTIC_SEGMENTATION = "semantic_segmentation",
782
+ SEGMENTATION = "segmentation"
901
783
  }
902
- declare enum WorkflowPhase {
903
- unknown = "Unknown",
904
- pending = "Pending",
905
- running = "Running",
906
- succeeded = "Succeeded",
907
- failed = "Failed",
908
- error = "Error"
784
+ interface InferenceComponent extends BaseComponent {
785
+ inferenceTypes?: InferenceType[];
786
+ hidden?: boolean;
787
+ modelUuid?: string;
788
+ model?: string;
789
+ abilityUuid?: string;
790
+ ability?: string;
791
+ categoryName?: string;
792
+ confidenceThreshold?: number;
793
+ topK?: number;
794
+ topKClasses?: number;
795
+ targetFps?: string;
796
+ videoChunkLengthSeconds?: number;
797
+ videoChunkOverlap?: number;
798
+ params?: {
799
+ [index: string]: any;
800
+ };
909
801
  }
910
- declare enum ModelFormat {
911
- TensorFlowLite = "TensorFlowLite",
912
- TensorFlowGraphDef = "TensorFlowGraphDef",
913
- ONNX = "ONNX",
914
- TorchScript = "TorchScript",
915
- TorchScriptCpu = "TorchScriptCpu",
916
- TorchScriptCuda = "TorchScriptCuda",
917
- PyTorch = "PyTorch",
918
- ModelLess = "ModelLess"
802
+ declare enum MotionModel {
803
+ RANDOM_WALK = "random_walk",
804
+ CONSTANT_VELOCITY = "constant_velocity",
805
+ CONSTANT_ACCELERATION = "constant_acceleration"
919
806
  }
920
- declare enum ModelPrecisionType {
921
- float32 = "float32",
922
- float16 = "float16",
923
- int32 = "int32",
924
- int8 = "int8",
925
- uint8 = "uint8"
807
+ interface TrackingComponent extends BaseComponent {
808
+ reidModelUuid?: string;
809
+ reidModel?: string;
810
+ maxAgeSeconds?: number;
811
+ iouThreshold?: number;
812
+ simThreshold?: number;
813
+ agnostic?: boolean;
814
+ processNoisePosition?: number;
815
+ processNoiseVelocity?: number;
816
+ processNoiseAcceleration?: number;
817
+ processNoiseScale?: number;
818
+ processNoiseAspectRatio?: number;
819
+ measurementNoiseCx?: number;
820
+ measurementNoiseCy?: number;
821
+ measurementNoiseArea?: number;
822
+ measurementNoiseAspectRatio?: number;
823
+ motionModel?: MotionModel;
824
+ downweightLowConfidenceDetections?: boolean;
825
+ classBeta?: number;
826
+ classGamma?: number;
827
+ classHysteresis?: boolean;
828
+ classHysteresisHighThreshold?: number;
829
+ classHysteresisLowThreshold?: number;
830
+ classHysteresisMinHoldFrames?: number;
831
+ classHysteresisAllowedClasses?: string[];
926
832
  }
927
- declare enum AssetUrlType {
928
- gcs = "gcs",
929
- s3 = "s3",
930
- https_signed = "https_signed"
833
+ declare enum ContourType {
834
+ ALL_PIXELS = "all_pixels",
835
+ POLYGON = "polygon",
836
+ CONVEX_HULL = "convex_hull",
837
+ HOUGH_CIRCLES = "hough_circles",
838
+ CIRCLE = "circle",
839
+ TRIANGLE = "triangle",
840
+ RECTANGLE = "rectangle"
931
841
  }
932
- interface DownloadResponse {
933
- url: string;
934
- url_type: AssetUrlType;
842
+ interface ContourFinderComponent extends BaseComponent {
843
+ contourType: ContourType;
844
+ areaThreshold?: number;
935
845
  }
936
- /** Experimental VLM API */
937
- interface InferRuntimeConfig {
938
- max_new_tokens?: number;
939
- image_size?: number;
940
- fps?: number;
941
- max_frames?: number;
942
- min_frames?: number;
943
- max_aspect_ratio?: number;
944
- context_length?: number;
945
- roi?: Area;
846
+ interface ComponentFinderComponent extends BaseComponent {
847
+ dilate?: number;
848
+ erode?: number;
849
+ keepSource?: boolean;
850
+ componentClassLabel?: string;
946
851
  }
947
- interface TransformInto {
948
- classes?: string[];
852
+ type PopComponent = ForwardComponent | InferenceComponent | TrackingComponent | ContourFinderComponent | ComponentFinderComponent;
853
+ interface Pop {
854
+ components: PopComponent[];
855
+ postTransform?: string;
949
856
  }
950
- interface InferRequest {
951
- worker_release?: string;
952
- text_prompt?: string;
953
- config: InferRuntimeConfig;
954
- refresh?: boolean;
955
- transform_into?: TransformInto;
857
+ interface MotionDetectConfig {
858
+ motionDetect: boolean;
859
+ motionSensitivity?: number;
860
+ motionThreshold?: number;
861
+ motionGap?: number;
862
+ motionGridX?: number;
863
+ motionGridY?: number;
956
864
  }
957
- interface EvaluateFilter {
958
- partitions?: string[];
959
- ground_truth_classes?: string[];
865
+ interface ComponentParams {
866
+ componentId: number;
867
+ values: {
868
+ [index: string]: any;
869
+ };
960
870
  }
961
- interface EvaluateConfig {
962
- dataset_uuid: string;
963
- filter?: EvaluateFilter;
964
- video_chunk_length_ns?: number;
965
- video_chunk_overlap?: number;
871
+ interface ProcessParams {
872
+ componentParams?: ComponentParams[] | undefined;
873
+ motionDetect?: MotionDetectConfig | undefined;
874
+ roi?: Area | undefined;
966
875
  }
967
- interface EvaluateRequest extends EvaluateConfig {
968
- ability_uuid?: string;
969
- infer?: InferRequest;
876
+ interface ProcessRequest extends ProcessParams {
877
+ source: Source;
970
878
  }
971
- declare enum EvaluationStatus {
972
- success = "success",
973
- failed = "failed"
879
+
880
+ interface Auth0Options {
881
+ domain: string;
882
+ clientId: string;
883
+ audience: string;
884
+ scope: string;
974
885
  }
975
- interface EvaluateRunInfo {
976
- num_images: number;
977
- num_ground_truth_images: number;
978
- num_videos: number;
979
- num_ground_truth_videos: number;
980
- total_tokens: number;
981
- visual_tokens: number;
982
- text_tokens: number;
983
- output_tokens: number;
886
+ interface ApiKeyAuth {
887
+ /**
888
+ * Authentication api key for server side execution.
889
+ * Defaults to process.env['EYEPOP_API_KEY'].
890
+ */
891
+ apiKey: string;
984
892
  }
985
- interface EvaluateResponse {
986
- dataset_uuid: string;
987
- dataset_version: number;
988
- status: EvaluationStatus;
989
- status_message?: string;
990
- source: string;
991
- metrics?: Map<string, any>;
992
- run_info: EvaluateRunInfo;
893
+ interface SessionAuth {
894
+ /**
895
+ * Temporary authentication token for client side execution.
896
+ */
897
+ session: Session;
993
898
  }
994
- interface InferRunInfo {
995
- fps?: number;
996
- image_size?: number;
997
- total_tokens?: number;
998
- visual_tokens?: number;
999
- text_tokens?: number;
1000
- output_tokens?: number;
1001
- aspect_ratio?: number;
899
+ interface OAuth2Auth {
900
+ /**
901
+ * For development mode, authenticate with your dashboard.eyepop.ai account
902
+ */
903
+ oAuth2: true | Auth0Options;
1002
904
  }
1003
- interface AutoPromptConfig {
1004
- num_samples: number;
1005
- task_description?: string;
1006
- infer: InferRequest;
1007
- evaluate: EvaluateConfig;
905
+ interface LocalAuth {
906
+ /**
907
+ * Implicit auth w/o credentials to a local endpoint.
908
+ */
909
+ isLocal: true;
1008
910
  }
1009
- declare enum VlmAbilityStatus {
1010
- in_progress = "in_progress",
1011
- draft = "draft",
1012
- published = "published"
911
+ type Authentication = undefined | ApiKeyAuth | SessionAuth | OAuth2Auth | LocalAuth;
912
+ interface HttpClient {
913
+ fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
914
+ close(): Promise<void>;
915
+ isFullDuplex(): boolean;
1013
916
  }
1014
- interface AbilityAliasEntry {
1015
- alias: string;
1016
- tag: string;
917
+ interface PlatformSupport {
918
+ createHttpClient?: (logger: Logger) => Promise<HttpClient>;
919
+ resolvePath: (source: PathSource, logger: Logger) => Promise<StreamSource>;
1017
920
  }
1018
- interface VlmAbilityCreate {
1019
- name: string;
1020
- description: string;
1021
- worker_release: string;
1022
- text_prompt: string;
1023
- transform_into: TransformInto;
1024
- config: InferRuntimeConfig;
1025
- is_public: boolean;
1026
- video_chunk_length_ns?: number;
1027
- video_chunk_overlap?: number;
921
+ interface Options {
922
+ auth?: Authentication | undefined;
923
+ /**
924
+ * Override the default base URL for the API, e.g., "https://api.eyepop.ai/"
925
+ *
926
+ * Defaults to process.env['EYEPOP_URL'].
927
+ */
928
+ eyepopUrl?: string | undefined;
929
+ jobQueueLength?: number;
930
+ logger?: Logger | undefined;
931
+ platformSupport?: PlatformSupport;
1028
932
  }
1029
- interface VlmAbilityUpdate {
1030
- name?: string;
1031
- description?: string;
1032
- worker_release?: string;
1033
- text_prompt?: string;
1034
- transform_into?: TransformInto;
1035
- config?: InferRuntimeConfig;
1036
- is_public?: boolean;
1037
- video_chunk_length_ns?: number;
1038
- video_chunk_overlap?: number;
933
+
934
+ /** Semaphores are initialized with a number of permits that get aquired and released
935
+ * over the lifecycle of the semaphore. These permits limit the number of simultaneous
936
+ * executions of the code that the semaphore synchronizes. Functions can wait on a semaphore
937
+ * and stop executing until a permit becomes available.
938
+ *
939
+ * Locks are a special case of semaphores that only allow one execution of a critical section.
940
+ * If you need a lock, you can import the Lock class from this package.
941
+ *
942
+ * This Semaphore class is implemented with the help of promises that get returned
943
+ * by functions that wait for permits to become available. This makes it possible
944
+ * to use async/await to synchronize your code.
945
+ */
946
+ declare class Semaphore {
947
+ private permits;
948
+ private promiseResolverQueue;
949
+ /**
950
+ * Creates a semaphore.
951
+ * @param permits The number of permits, i.e. strands of execution being allowed
952
+ * to run in parallel.
953
+ * This number can be initialized with a negative integer.
954
+ */
955
+ constructor(permits: number);
956
+ /**
957
+ * Returns the number of available permits.
958
+ * @returns The number of available permits.
959
+ */
960
+ getPermits(): number;
961
+ /**
962
+ * Returns a promise used to wait for a permit to become available. This method should be awaited on.
963
+ * @returns A promise that gets resolved when execution is allowed to proceed.
964
+ */
965
+ wait(): Promise<boolean>;
966
+ /**
967
+ * Alias for {@linkcode Semaphore.wait}.
968
+ * @returns A promise that gets resolved when execution is allowed to proceed.
969
+ */
970
+ acquire(): Promise<boolean>;
971
+ /**
972
+ * Same as {@linkcode Semaphore.wait} except the promise returned gets resolved with false if no
973
+ * permit becomes available in time.
974
+ * @param milliseconds The time spent waiting before the wait is aborted. This is a lower bound,
975
+ * you shouldn't rely on it being precise.
976
+ * @returns A promise that gets resolved to true when execution is allowed to proceed or
977
+ * false if the time given elapses before a permit becomes available.
978
+ */
979
+ waitFor(milliseconds: number): Promise<boolean>;
980
+ /**
981
+ * Synchronous function that tries to acquire a permit and returns true if successful, false otherwise.
982
+ * @returns Whether a permit could be acquired.
983
+ */
984
+ tryAcquire(): boolean;
985
+ /**
986
+ * Acquires all permits that are currently available and returns the number of acquired permits.
987
+ * @returns Number of acquired permits.
988
+ */
989
+ drainPermits(): number;
990
+ /**
991
+ * Increases the number of permits by one. If there are other functions waiting, one of them will
992
+ * continue to execute in a future iteration of the event loop.
993
+ */
994
+ signal(): void;
995
+ /**
996
+ * Alias for {@linkcode Semaphore.signal}.
997
+ */
998
+ release(): void;
999
+ /**
1000
+ * Schedules func to be called once a permit becomes available.
1001
+ * Returns a promise that resolves to the return value of func.
1002
+ * @typeparam T The return type of func.
1003
+ * @param func The function to be executed.
1004
+ * @return A promise that gets resolved with the return value of the function.
1005
+ */
1006
+ execute<T>(func: () => T | PromiseLike<T>): Promise<T>;
1039
1007
  }
1040
- interface VlmAbility {
1041
- uuid: string;
1042
- created_at?: Date;
1043
- updated_at?: Date;
1044
- account_uuid: string;
1045
- status: VlmAbilityStatus;
1046
- is_public: boolean;
1047
- name: string;
1048
- description: string;
1049
- vlm_ability_group_uuid?: string;
1050
- worker_release: string;
1051
- text_prompt: string;
1052
- transform_into: TransformInto;
1053
- config: InferRuntimeConfig;
1054
- video_chunk_length_ns?: number;
1055
- video_chunk_overlap?: number;
1056
- alias_entries?: AbilityAliasEntry[];
1057
- auto_prompt?: AutoPromptConfig;
1008
+
1009
+ declare class Endpoint<T extends Endpoint<T>> {
1010
+ protected _options: Options;
1011
+ private _token;
1012
+ private _expire_token_time;
1013
+ protected _client: HttpClient | null;
1014
+ private _statusRetryHandlers;
1015
+ protected _limit: Semaphore;
1016
+ private _state;
1017
+ private _message;
1018
+ private _stateChangeHandler;
1019
+ protected _logger: Logger;
1020
+ protected readonly _requestLogger: Logger;
1021
+ constructor(options: Options);
1022
+ protected setStatusRetryHandlers(statusRetryHandlers?: Map<number, Function> | undefined): void;
1023
+ eyepopUrl(): string;
1024
+ eyepopWebApiUrl(): string;
1025
+ pendingJobs(): number;
1026
+ state(): EndpointState;
1027
+ lastMessage(): string | null;
1028
+ onStateChanged(handler: (fromState: EndpointState, toState: EndpointState) => void): T;
1029
+ protected updateState(newState?: EndpointState | undefined, message?: string | undefined): void;
1030
+ connect(): Promise<T>;
1031
+ disconnect(wait?: boolean): Promise<void>;
1032
+ session(): Promise<Session>;
1033
+ protected statusHandler401(_statusCode: number): void;
1034
+ protected fetchWithRetry(fetcher: () => Promise<Response>, retries?: number): Promise<Response>;
1035
+ protected reconnect(): Promise<T>;
1036
+ protected authorizationHeader(): Promise<string>;
1037
+ private currentAccessToken;
1058
1038
  }
1059
- interface VlmAbilityGroupCreate {
1060
- name: string;
1061
- description: string;
1062
- auto_prompt?: AutoPromptConfig;
1063
- default_alias_name?: string;
1064
- default_dataset_uuid?: string;
1039
+
1040
+ declare enum TransientPopId {
1041
+ Transient = "transient"
1065
1042
  }
1066
- interface VlmAbilityGroupUpdate {
1067
- name: string;
1068
- description: string;
1069
- default_alias_name?: string;
1070
- default_dataset_uuid?: string;
1043
+ interface WorkerOptions extends Options {
1044
+ /**
1045
+ * TODO: deprecated, defaults to process.env['EYEPOP_POP_ID'].
1046
+ */
1047
+ popId?: string | TransientPopId | undefined;
1048
+ autoStart?: boolean;
1049
+ stopJobs?: boolean;
1050
+ isLocalMode?: boolean;
1071
1051
  }
1072
- interface VlmAbilityGroup {
1073
- uuid: string;
1074
- created_at?: Date;
1075
- updated_at?: Date;
1076
- account_uuid: string;
1077
- name: string;
1078
- description: string;
1079
- default_alias_name?: string;
1080
- default_dataset_uuid?: string;
1052
+
1053
+ declare enum SessionStatus {
1054
+ UNKNOWN = "unknown",
1055
+ PENDING = "pending",
1056
+ RUNNING = "running",
1057
+ STOPPED = "stopped",
1058
+ FAILED = "failed",
1059
+ ERROR = "error",
1060
+ PIPELINE_CREATING = "pipeline_creating",
1061
+ PIPELINE_OK = "pipeline_ok",
1062
+ PIPELINE_CHECKING = "pipeline_checking",
1063
+ PIPELINE_ERROR = "pipeline_error"
1081
1064
  }
1082
- interface AliasResolution {
1083
- alias: string;
1084
- model_uuid: string | null;
1065
+ declare class WorkerEndpoint extends Endpoint<WorkerEndpoint> {
1066
+ private _baseUrl;
1067
+ private _pipelineId;
1068
+ private _popName;
1069
+ private _pipeline;
1070
+ constructor(options: WorkerOptions);
1071
+ private options;
1072
+ disconnect(wait?: boolean): Promise<void>;
1073
+ protected statusHandler404(_: number): void;
1074
+ session(): Promise<WorkerSession>;
1075
+ popName(): string | null;
1076
+ pop(): Pop | null;
1077
+ changePop(pop: Pop): Promise<void>;
1078
+ private _authenticationHeaders;
1079
+ popId(): string | null;
1080
+ /**
1081
+ * V1 call to process media as a source with optional component params
1082
+ *
1083
+ * @deprecated use V2 call process() with named parameters
1084
+ * @param source
1085
+ * @param params
1086
+ */
1087
+ process(source: Source, params?: ComponentParams[]): Promise<ResultStream>;
1088
+ /**
1089
+ * V2 call to process media as a source with extensible named parameters
1090
+ *
1091
+ * @param source
1092
+ * @param componentParams
1093
+ * @param motionDetect
1094
+ * @param roi
1095
+ */
1096
+ process({ source, componentParams, motionDetect, roi }: ProcessRequest): Promise<ResultStream>;
1097
+ private processV1;
1098
+ private processV2;
1099
+ private uploadFile;
1100
+ private uploadStream;
1101
+ private uploadPath;
1102
+ private loadFrom;
1103
+ private loadFromAssetUuid;
1104
+ private loadMediaStream;
1105
+ private jobDone;
1106
+ private jobStatus;
1107
+ protected reconnect(): Promise<WorkerEndpoint>;
1108
+ private startWebApiSessionWithPopId;
1109
+ private static SESSION_DEAD;
1110
+ private static WAIT_FOR_IS_READY;
1111
+ private static CHECK_FOR_IS_READY_INTERVAL;
1112
+ private startComputeSession;
1113
+ private startTransientPipeline;
1114
+ }
1115
+
1116
+ interface DataOptions extends Options {
1117
+ /**
1118
+ * Defaults to process.env['EYEPOP_ACCOUNT_ID'].
1119
+ */
1120
+ accountId?: string | undefined;
1121
+ disableWs?: boolean | undefined;
1122
+ useCookie?: boolean | undefined;
1085
1123
  }
1086
1124
 
1087
1125
  type VlmFetch = (path: string, options: RequestInit) => Promise<any>;
@@ -1238,14 +1276,14 @@ declare function readableStreamFromString(s: string): ReadableStream<Uint8Array>
1238
1276
 
1239
1277
  declare class AbstractJob implements ResultStream {
1240
1278
  protected _getSession: () => Promise<WorkerSession>;
1241
- protected _params: ComponentParams[] | null;
1279
+ protected _params: ProcessParams;
1242
1280
  protected _responseStream: Promise<ReadableStream<Uint8Array>> | null;
1243
1281
  protected _controller: AbortController;
1244
1282
  protected _client: HttpClient;
1245
1283
  protected _requestLogger: Logger;
1246
1284
  protected _version: PredictionVersion;
1247
1285
  [Symbol.asyncIterator](): AsyncIterator<Prediction>;
1248
- protected constructor(params: ComponentParams[] | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger, version?: PredictionVersion);
1286
+ protected constructor(params: ProcessParams, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger, version?: PredictionVersion);
1249
1287
  protected startJob(): Promise<Response>;
1250
1288
  protected onEvent(event: StreamEvent): Promise<void>;
1251
1289
  static n: number;
@@ -1259,31 +1297,25 @@ declare class UploadJob extends AbstractJob {
1259
1297
  private readonly _needsFullDuplex;
1260
1298
  private readonly _videoMode;
1261
1299
  get [Symbol.toStringTag](): string;
1262
- constructor(stream: ReadableStream<Uint8Array> | Blob | BufferSource, mimeType: string, size: number | undefined, videoMode: VideoMode | undefined, params: ComponentParams[] | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
1300
+ constructor(stream: ReadableStream<Uint8Array> | Blob | BufferSource, mimeType: string, size: number | undefined, videoMode: VideoMode | undefined, params: ProcessParams, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
1263
1301
  protected onEvent(event: StreamEvent): Promise<void>;
1264
1302
  protected startJob(): Promise<Response>;
1265
1303
  }
1266
1304
  declare class LoadFromJob extends AbstractJob {
1267
1305
  private readonly _location;
1268
- constructor(location: string, params: ComponentParams[] | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
1306
+ constructor(location: string, params: ProcessParams, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
1269
1307
  get [Symbol.toStringTag](): string;
1270
1308
  protected startJob(): Promise<Response>;
1271
1309
  }
1272
1310
  declare class LoadFromAssetUuidJob extends AbstractJob {
1273
1311
  private readonly _assetUuid;
1274
- constructor(assetUuid: string, params: ComponentParams[] | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
1275
- get [Symbol.toStringTag](): string;
1276
- protected startJob(): Promise<Response>;
1277
- }
1278
- declare class LoadLiveIngressJob extends AbstractJob {
1279
- private readonly _ingressId;
1280
- constructor(ingressId: string, params: ComponentParams[] | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
1312
+ constructor(assetUuid: string, params: ProcessParams, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
1281
1313
  get [Symbol.toStringTag](): string;
1282
1314
  protected startJob(): Promise<Response>;
1283
1315
  }
1284
1316
  declare class LoadMediaStreamJob extends AbstractJob {
1285
1317
  private readonly _mediaStream;
1286
- constructor(mediaStream: MediaStream, params: ComponentParams[] | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
1318
+ constructor(mediaStream: MediaStream, params: ProcessParams, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
1287
1319
  get [Symbol.toStringTag](): string;
1288
1320
  protected startJob(): Promise<Response>;
1289
1321
  }
@@ -1352,4 +1384,4 @@ declare namespace EyePop {
1352
1384
  function dataEndpoint(opts?: DataOptions): DataEndpoint;
1353
1385
  }
1354
1386
 
1355
- export { type AbilityAliasEntry, AbstractJob, 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 BaseArea, type BaseComponent, type Box, type ChangeEvent, ChangeType, type ComponentFinderComponent, type ComponentParams, 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 DownloadResponse, Endpoint, EndpointState, type EvaluateConfig, type EvaluateFilter, type EvaluateRequest, type EvaluateResponse, type EvaluateRunInfo, EvaluationStatus, ExportedBy, EyePop, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferRequest, type InferRunInfo, type InferRuntimeConfig, type InferenceComponent, InferenceType, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, LoadFromAssetUuidJob, LoadFromJob, LoadLiveIngressJob, LoadMediaStreamJob, type LocalAuth, 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, MotionModel, type OAuth2Auth, type OnChangeEvent, type Options, type PathSource, type PlatformSupport, type Point2d, type Point3d, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopForward, type PopForwardOperator, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedObject, type PredictedText, type Prediction, PredictionVersion, type QcAiHubExportParams, type RectangleArea, type ResultStream, type Roi, Semaphore, type Session, type SessionAuth, SessionStatus, type Source, Stream, type StreamEvent, type StreamSource, type StreamTime, type TimeSpan, type TrackingComponent, TranscodeMode, type TransformInto, TransientPopId, UploadJob, type UrlSource, UserReview, VideoMode, type VlmAbility, type VlmAbilityCreate, type VlmAbilityGroup, type VlmAbilityGroupCreate, type VlmAbilityGroupUpdate, VlmAbilityStatus, type VlmAbilityUpdate, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, type Workflow, WorkflowPhase, EyePop as default, getBaseUrl, readableStreamFromString };
1387
+ export { type AbilityAliasEntry, AbstractJob, 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 BaseArea, type BaseComponent, type Box, type ChangeEvent, ChangeType, type ComponentFinderComponent, type ComponentParams, 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 DownloadResponse, Endpoint, EndpointState, type EvaluateConfig, type EvaluateFilter, type EvaluateRequest, type EvaluateResponse, type EvaluateRunInfo, EvaluationStatus, ExportedBy, EyePop, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferRequest, type InferRunInfo, type InferRuntimeConfig, type InferenceComponent, InferenceType, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, LoadFromAssetUuidJob, LoadFromJob, LoadMediaStreamJob, type LocalAuth, 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 OAuth2Auth, type OnChangeEvent, type Options, type PathSource, type PlatformSupport, type Point2d, type Point3d, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopForward, type PopForwardOperator, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedMotion, type PredictedObject, type PredictedText, type Prediction, PredictionVersion, type ProcessParams, type ProcessRequest, type QcAiHubExportParams, type RectangleArea, type ResultStream, type Roi, Semaphore, type Session, type SessionAuth, SessionStatus, type Source, Stream, type StreamEvent, type StreamSource, type StreamTime, type TimeSpan, type TrackingComponent, TranscodeMode, type TransformInto, TransientPopId, UploadJob, type UrlSource, UserReview, VideoMode, type VlmAbility, type VlmAbilityCreate, type VlmAbilityGroup, type VlmAbilityGroupCreate, type VlmAbilityGroupUpdate, VlmAbilityStatus, type VlmAbilityUpdate, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, type Workflow, WorkflowPhase, EyePop as default, getBaseUrl, readableStreamFromString };