@eyepop.ai/eyepop 3.25.3 → 3.25.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eyepop.index.d.mts +83 -9
- package/dist/eyepop.index.d.ts +83 -9
- package/dist/eyepop.index.js +213 -86
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +212 -86
- package/dist/eyepop.index.mjs.map +1 -1
- package/dist/eyepop.min.js +1 -1
- package/package.json +1 -1
package/dist/eyepop.index.d.mts
CHANGED
|
@@ -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[];
|
|
@@ -990,6 +1007,12 @@ interface AssetUuidSource {
|
|
|
990
1007
|
type Source = FileSource | StreamSource | PathSource | UrlSource | AssetUuidSource | MediaStreamSource;
|
|
991
1008
|
interface ResultStream extends AsyncIterable<Prediction> {
|
|
992
1009
|
cancel(): void;
|
|
1010
|
+
/**
|
|
1011
|
+
* What the stream's remote calls (a VLM ability's calls to vlm-server) used so far, in milli compute units:
|
|
1012
|
+
* a running total while it runs, its total once it ended. Undefined until reported, and where a backend does
|
|
1013
|
+
* not report it; a local model reports none. Informational: the called API bills its calls itself.
|
|
1014
|
+
*/
|
|
1015
|
+
readonly milliComputeUnits?: number | undefined;
|
|
993
1016
|
}
|
|
994
1017
|
declare enum PopComponentType {
|
|
995
1018
|
FORWARD = "forward",
|
|
@@ -1315,9 +1338,15 @@ interface Options {
|
|
|
1315
1338
|
*/
|
|
1316
1339
|
apiKey?: string | undefined;
|
|
1317
1340
|
/**
|
|
1318
|
-
* Bearer token accepted by the compute API
|
|
1341
|
+
* Bearer token accepted by the compute API: a login token, which the SDK exchanges at the
|
|
1342
|
+
* compute API, or an already exchanged token, which it uses as is.
|
|
1319
1343
|
*/
|
|
1320
1344
|
accessToken?: string | undefined;
|
|
1345
|
+
/**
|
|
1346
|
+
* The account a login token (`accessToken` or `oAuth2`) is exchanged for, sent to the compute API
|
|
1347
|
+
* as `account_uuid`. Needed when the user has no single account to pick.
|
|
1348
|
+
*/
|
|
1349
|
+
accountId?: string | undefined;
|
|
1321
1350
|
/**
|
|
1322
1351
|
* Temporary authentication token for client side execution.
|
|
1323
1352
|
*/
|
|
@@ -1415,6 +1444,7 @@ declare class Endpoint<T extends Endpoint<T>> {
|
|
|
1415
1444
|
protected _options: Options;
|
|
1416
1445
|
private _token;
|
|
1417
1446
|
private _expire_token_time;
|
|
1447
|
+
private _exchanging;
|
|
1418
1448
|
protected _client: HttpClient | null;
|
|
1419
1449
|
private _statusRetryHandlers;
|
|
1420
1450
|
protected _limit: Semaphore;
|
|
@@ -1435,11 +1465,19 @@ declare class Endpoint<T extends Endpoint<T>> {
|
|
|
1435
1465
|
connect(): Promise<T>;
|
|
1436
1466
|
disconnect(wait?: boolean): Promise<void>;
|
|
1437
1467
|
session(): Promise<Session>;
|
|
1438
|
-
protected statusHandler401(_statusCode: number): void;
|
|
1468
|
+
protected statusHandler401(_statusCode: number, failedToken?: string | null): void;
|
|
1439
1469
|
protected fetchWithRetry(fetcher: () => Promise<Response>, retries?: number): Promise<Response>;
|
|
1440
1470
|
protected reconnect(): Promise<T>;
|
|
1441
1471
|
protected authorizationHeader(): Promise<string>;
|
|
1472
|
+
private exchange;
|
|
1473
|
+
private storeExchangedToken;
|
|
1474
|
+
/**
|
|
1475
|
+
* A token that already carries an account, or that the compute API refuses as an exchanged
|
|
1476
|
+
* token ("API key or user login required"), is used as is. Any other refusal is raised.
|
|
1477
|
+
*/
|
|
1478
|
+
private exchangeLoginToken;
|
|
1442
1479
|
private currentAccessToken;
|
|
1480
|
+
private authenticate;
|
|
1443
1481
|
}
|
|
1444
1482
|
|
|
1445
1483
|
/**
|
|
@@ -1477,6 +1515,11 @@ interface WorkerOptions extends Options {
|
|
|
1477
1515
|
* Defaults to process.env['EYEPOP_PIPELINE_MODE'].
|
|
1478
1516
|
*/
|
|
1479
1517
|
isPipelineMode?: boolean;
|
|
1518
|
+
/**
|
|
1519
|
+
* In pipeline mode, the most sockets the endpoint opens. Each runs its own pipeline, which plays its
|
|
1520
|
+
* sources one after another; a new one opens only while every open one has a source. Defaults to 4.
|
|
1521
|
+
*/
|
|
1522
|
+
pipelineSockets?: number;
|
|
1480
1523
|
}
|
|
1481
1524
|
|
|
1482
1525
|
/**
|
|
@@ -1620,9 +1663,15 @@ declare class InferAssetJob implements ResultStream {
|
|
|
1620
1663
|
protected _inferRequest: InferRequest;
|
|
1621
1664
|
protected _response: Promise<Prediction[]> | null;
|
|
1622
1665
|
protected _runInfo: InferRunInfo | null;
|
|
1666
|
+
protected _milliComputeUnits: number | undefined;
|
|
1623
1667
|
protected _controller: AbortController;
|
|
1624
1668
|
protected _requestLogger: Logger;
|
|
1625
1669
|
[Symbol.asyncIterator](): AsyncIterator<Prediction>;
|
|
1670
|
+
/**
|
|
1671
|
+
* The milli compute units vlm-server billed for the inference, 0 on a cache hit; undefined before it answered
|
|
1672
|
+
* or when it reported none.
|
|
1673
|
+
*/
|
|
1674
|
+
get milliComputeUnits(): number | undefined;
|
|
1626
1675
|
constructor(assetUrl: string, inferRequest: InferRequest, vlmFetch: VlmFetch, requestLogger: Logger);
|
|
1627
1676
|
start(done: () => void): InferAssetJob;
|
|
1628
1677
|
cancel(): void;
|
|
@@ -2014,10 +2063,12 @@ declare const PIPELINE_PATH = "/api/v1/pipeline";
|
|
|
2014
2063
|
declare const SUBPROTOCOL = "eyepop.v1";
|
|
2015
2064
|
/** A socket may have this many open sources; one more is answered `queue_full`. */
|
|
2016
2065
|
declare const MAX_OPEN_SOURCES = 256;
|
|
2066
|
+
/** The most sockets an endpoint opens unless `pipelineSockets` says otherwise. */
|
|
2067
|
+
declare const PIPELINE_SOCKETS = 4;
|
|
2017
2068
|
/** Uploads up to this size go as one combined message, larger ones in chunks. */
|
|
2018
2069
|
declare const COMBINED_UPLOAD_MAX_BYTES: number;
|
|
2019
2070
|
/** Why pipeline mode refused its configuration. */
|
|
2020
|
-
type PipelineConfigurationProblem = 'session_options' | 'job_queue_length' | 'no_pipeline_api_url' | 'insecure_url';
|
|
2071
|
+
type PipelineConfigurationProblem = 'session_options' | 'job_queue_length' | 'pipeline_sockets' | 'no_pipeline_api_url' | 'insecure_url';
|
|
2021
2072
|
/** Pipeline mode cannot run as configured; `options` names the refused options for `session_options`. */
|
|
2022
2073
|
declare class PipelineConfigurationError extends Error {
|
|
2023
2074
|
readonly problem: PipelineConfigurationProblem;
|
|
@@ -2094,26 +2145,36 @@ declare class PipelineJob implements ResultStream {
|
|
|
2094
2145
|
readonly whenCancelled: Promise<void>;
|
|
2095
2146
|
openSource: OpenSource | null;
|
|
2096
2147
|
stopOnPipeline: (() => void) | null;
|
|
2148
|
+
private _milliComputeUnits;
|
|
2097
2149
|
constructor(source: Message, media: Media[], live: boolean, params: ProcessParams, mediaStream?: MediaStream | undefined);
|
|
2098
2150
|
get cancelled(): boolean;
|
|
2151
|
+
/** The source's milli compute units: the latest total of its `usage` messages and its `end`. */
|
|
2152
|
+
get milliComputeUnits(): number | undefined;
|
|
2153
|
+
/** Keep a usage's or an end's milliComputeUnits: each carries the source's total so far. */
|
|
2154
|
+
noteMilliComputeUnits(message: Message): void;
|
|
2099
2155
|
command(id: string): Message;
|
|
2100
2156
|
predicted(prediction: Prediction): void;
|
|
2101
2157
|
finish(error?: Error | null): void;
|
|
2102
2158
|
cancel(): void;
|
|
2103
2159
|
[Symbol.asyncIterator](): AsyncIterator<Prediction>;
|
|
2104
2160
|
}
|
|
2105
|
-
/**
|
|
2161
|
+
/**
|
|
2162
|
+
* Runs jobs on up to `pipelineSockets` sockets to the pipeline API; connecting opens the first. A
|
|
2163
|
+
* socket's pipeline plays its sources one after another, so a batch on one socket leaves the GPU
|
|
2164
|
+
* mostly idle. While every open socket has a source and fewer than `pipelineSockets` are open, the next
|
|
2165
|
+
* job opens another; each job goes on the socket that has room and the fewest open sources.
|
|
2166
|
+
*/
|
|
2106
2167
|
declare class PipelineBackend implements WorkerBackend {
|
|
2107
2168
|
private readonly ctx;
|
|
2108
2169
|
private _pipelineApiUrl;
|
|
2109
|
-
private
|
|
2170
|
+
private _sockets;
|
|
2110
2171
|
private _connecting;
|
|
2111
2172
|
private _sendChain;
|
|
2112
2173
|
private _disconnecting;
|
|
2113
2174
|
private _nextId;
|
|
2114
2175
|
private _currentPop;
|
|
2115
2176
|
private readonly _warned;
|
|
2116
|
-
private
|
|
2177
|
+
private _noExtraSocketUntil;
|
|
2117
2178
|
private _reconnects;
|
|
2118
2179
|
constructor(ctx: WorkerContext);
|
|
2119
2180
|
reconnect(): Promise<void>;
|
|
@@ -2122,8 +2183,17 @@ declare class PipelineBackend implements WorkerBackend {
|
|
|
2122
2183
|
popName(): string | null;
|
|
2123
2184
|
authorizationHeader(): Promise<string>;
|
|
2124
2185
|
private inOrder;
|
|
2125
|
-
|
|
2186
|
+
private openSockets;
|
|
2187
|
+
/** An open socket, or a new one with the last pop set on it. */
|
|
2126
2188
|
private ensureSocket;
|
|
2189
|
+
/**
|
|
2190
|
+
* The socket for the next job; the caller runs it in submission order. A live job goes on a socket
|
|
2191
|
+
* of its own, an idle one or a new one, which `pipelineSockets` does not count. Any other job skips
|
|
2192
|
+
* the sockets with a live source: a new one while every other socket has a source and fewer than
|
|
2193
|
+
* `pipelineSockets` are open, else the one with room and the fewest sources.
|
|
2194
|
+
*/
|
|
2195
|
+
private socketForJob;
|
|
2196
|
+
/** A new socket with the last pop set on it; `patient` waits through 503 with Retry-After. */
|
|
2127
2197
|
private openSocket;
|
|
2128
2198
|
private startHeartbeat;
|
|
2129
2199
|
private socketUrl;
|
|
@@ -2137,7 +2207,11 @@ declare class PipelineBackend implements WorkerBackend {
|
|
|
2137
2207
|
/** Send a command that is answered by `result` or `error` under its id. */
|
|
2138
2208
|
private command;
|
|
2139
2209
|
pop(): Pop | null;
|
|
2140
|
-
/**
|
|
2210
|
+
/**
|
|
2211
|
+
* Set the pop on every open socket's pipeline; a pop the first refuses rejects, and the last pop it
|
|
2212
|
+
* took stays. shortcut: a refusal from a later socket, which the first took, leaves the earlier ones
|
|
2213
|
+
* on the new pop; a refusal is the pop's own fault, so every socket answers it alike.
|
|
2214
|
+
*/
|
|
2141
2215
|
changePop(pop: Pop): Promise<void>;
|
|
2142
2216
|
private setPopOn;
|
|
2143
2217
|
submit(work: WorkerWork): Promise<ResultStream>;
|
|
@@ -2290,4 +2364,4 @@ declare namespace EyePop {
|
|
|
2290
2364
|
function dataEndpoint(opts?: DataOptions): DataEndpoint;
|
|
2291
2365
|
}
|
|
2292
2366
|
|
|
2293
|
-
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, 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 };
|
|
2367
|
+
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 };
|
package/dist/eyepop.index.d.ts
CHANGED
|
@@ -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[];
|
|
@@ -990,6 +1007,12 @@ interface AssetUuidSource {
|
|
|
990
1007
|
type Source = FileSource | StreamSource | PathSource | UrlSource | AssetUuidSource | MediaStreamSource;
|
|
991
1008
|
interface ResultStream extends AsyncIterable<Prediction> {
|
|
992
1009
|
cancel(): void;
|
|
1010
|
+
/**
|
|
1011
|
+
* What the stream's remote calls (a VLM ability's calls to vlm-server) used so far, in milli compute units:
|
|
1012
|
+
* a running total while it runs, its total once it ended. Undefined until reported, and where a backend does
|
|
1013
|
+
* not report it; a local model reports none. Informational: the called API bills its calls itself.
|
|
1014
|
+
*/
|
|
1015
|
+
readonly milliComputeUnits?: number | undefined;
|
|
993
1016
|
}
|
|
994
1017
|
declare enum PopComponentType {
|
|
995
1018
|
FORWARD = "forward",
|
|
@@ -1315,9 +1338,15 @@ interface Options {
|
|
|
1315
1338
|
*/
|
|
1316
1339
|
apiKey?: string | undefined;
|
|
1317
1340
|
/**
|
|
1318
|
-
* Bearer token accepted by the compute API
|
|
1341
|
+
* Bearer token accepted by the compute API: a login token, which the SDK exchanges at the
|
|
1342
|
+
* compute API, or an already exchanged token, which it uses as is.
|
|
1319
1343
|
*/
|
|
1320
1344
|
accessToken?: string | undefined;
|
|
1345
|
+
/**
|
|
1346
|
+
* The account a login token (`accessToken` or `oAuth2`) is exchanged for, sent to the compute API
|
|
1347
|
+
* as `account_uuid`. Needed when the user has no single account to pick.
|
|
1348
|
+
*/
|
|
1349
|
+
accountId?: string | undefined;
|
|
1321
1350
|
/**
|
|
1322
1351
|
* Temporary authentication token for client side execution.
|
|
1323
1352
|
*/
|
|
@@ -1415,6 +1444,7 @@ declare class Endpoint<T extends Endpoint<T>> {
|
|
|
1415
1444
|
protected _options: Options;
|
|
1416
1445
|
private _token;
|
|
1417
1446
|
private _expire_token_time;
|
|
1447
|
+
private _exchanging;
|
|
1418
1448
|
protected _client: HttpClient | null;
|
|
1419
1449
|
private _statusRetryHandlers;
|
|
1420
1450
|
protected _limit: Semaphore;
|
|
@@ -1435,11 +1465,19 @@ declare class Endpoint<T extends Endpoint<T>> {
|
|
|
1435
1465
|
connect(): Promise<T>;
|
|
1436
1466
|
disconnect(wait?: boolean): Promise<void>;
|
|
1437
1467
|
session(): Promise<Session>;
|
|
1438
|
-
protected statusHandler401(_statusCode: number): void;
|
|
1468
|
+
protected statusHandler401(_statusCode: number, failedToken?: string | null): void;
|
|
1439
1469
|
protected fetchWithRetry(fetcher: () => Promise<Response>, retries?: number): Promise<Response>;
|
|
1440
1470
|
protected reconnect(): Promise<T>;
|
|
1441
1471
|
protected authorizationHeader(): Promise<string>;
|
|
1472
|
+
private exchange;
|
|
1473
|
+
private storeExchangedToken;
|
|
1474
|
+
/**
|
|
1475
|
+
* A token that already carries an account, or that the compute API refuses as an exchanged
|
|
1476
|
+
* token ("API key or user login required"), is used as is. Any other refusal is raised.
|
|
1477
|
+
*/
|
|
1478
|
+
private exchangeLoginToken;
|
|
1442
1479
|
private currentAccessToken;
|
|
1480
|
+
private authenticate;
|
|
1443
1481
|
}
|
|
1444
1482
|
|
|
1445
1483
|
/**
|
|
@@ -1477,6 +1515,11 @@ interface WorkerOptions extends Options {
|
|
|
1477
1515
|
* Defaults to process.env['EYEPOP_PIPELINE_MODE'].
|
|
1478
1516
|
*/
|
|
1479
1517
|
isPipelineMode?: boolean;
|
|
1518
|
+
/**
|
|
1519
|
+
* In pipeline mode, the most sockets the endpoint opens. Each runs its own pipeline, which plays its
|
|
1520
|
+
* sources one after another; a new one opens only while every open one has a source. Defaults to 4.
|
|
1521
|
+
*/
|
|
1522
|
+
pipelineSockets?: number;
|
|
1480
1523
|
}
|
|
1481
1524
|
|
|
1482
1525
|
/**
|
|
@@ -1620,9 +1663,15 @@ declare class InferAssetJob implements ResultStream {
|
|
|
1620
1663
|
protected _inferRequest: InferRequest;
|
|
1621
1664
|
protected _response: Promise<Prediction[]> | null;
|
|
1622
1665
|
protected _runInfo: InferRunInfo | null;
|
|
1666
|
+
protected _milliComputeUnits: number | undefined;
|
|
1623
1667
|
protected _controller: AbortController;
|
|
1624
1668
|
protected _requestLogger: Logger;
|
|
1625
1669
|
[Symbol.asyncIterator](): AsyncIterator<Prediction>;
|
|
1670
|
+
/**
|
|
1671
|
+
* The milli compute units vlm-server billed for the inference, 0 on a cache hit; undefined before it answered
|
|
1672
|
+
* or when it reported none.
|
|
1673
|
+
*/
|
|
1674
|
+
get milliComputeUnits(): number | undefined;
|
|
1626
1675
|
constructor(assetUrl: string, inferRequest: InferRequest, vlmFetch: VlmFetch, requestLogger: Logger);
|
|
1627
1676
|
start(done: () => void): InferAssetJob;
|
|
1628
1677
|
cancel(): void;
|
|
@@ -2014,10 +2063,12 @@ declare const PIPELINE_PATH = "/api/v1/pipeline";
|
|
|
2014
2063
|
declare const SUBPROTOCOL = "eyepop.v1";
|
|
2015
2064
|
/** A socket may have this many open sources; one more is answered `queue_full`. */
|
|
2016
2065
|
declare const MAX_OPEN_SOURCES = 256;
|
|
2066
|
+
/** The most sockets an endpoint opens unless `pipelineSockets` says otherwise. */
|
|
2067
|
+
declare const PIPELINE_SOCKETS = 4;
|
|
2017
2068
|
/** Uploads up to this size go as one combined message, larger ones in chunks. */
|
|
2018
2069
|
declare const COMBINED_UPLOAD_MAX_BYTES: number;
|
|
2019
2070
|
/** Why pipeline mode refused its configuration. */
|
|
2020
|
-
type PipelineConfigurationProblem = 'session_options' | 'job_queue_length' | 'no_pipeline_api_url' | 'insecure_url';
|
|
2071
|
+
type PipelineConfigurationProblem = 'session_options' | 'job_queue_length' | 'pipeline_sockets' | 'no_pipeline_api_url' | 'insecure_url';
|
|
2021
2072
|
/** Pipeline mode cannot run as configured; `options` names the refused options for `session_options`. */
|
|
2022
2073
|
declare class PipelineConfigurationError extends Error {
|
|
2023
2074
|
readonly problem: PipelineConfigurationProblem;
|
|
@@ -2094,26 +2145,36 @@ declare class PipelineJob implements ResultStream {
|
|
|
2094
2145
|
readonly whenCancelled: Promise<void>;
|
|
2095
2146
|
openSource: OpenSource | null;
|
|
2096
2147
|
stopOnPipeline: (() => void) | null;
|
|
2148
|
+
private _milliComputeUnits;
|
|
2097
2149
|
constructor(source: Message, media: Media[], live: boolean, params: ProcessParams, mediaStream?: MediaStream | undefined);
|
|
2098
2150
|
get cancelled(): boolean;
|
|
2151
|
+
/** The source's milli compute units: the latest total of its `usage` messages and its `end`. */
|
|
2152
|
+
get milliComputeUnits(): number | undefined;
|
|
2153
|
+
/** Keep a usage's or an end's milliComputeUnits: each carries the source's total so far. */
|
|
2154
|
+
noteMilliComputeUnits(message: Message): void;
|
|
2099
2155
|
command(id: string): Message;
|
|
2100
2156
|
predicted(prediction: Prediction): void;
|
|
2101
2157
|
finish(error?: Error | null): void;
|
|
2102
2158
|
cancel(): void;
|
|
2103
2159
|
[Symbol.asyncIterator](): AsyncIterator<Prediction>;
|
|
2104
2160
|
}
|
|
2105
|
-
/**
|
|
2161
|
+
/**
|
|
2162
|
+
* Runs jobs on up to `pipelineSockets` sockets to the pipeline API; connecting opens the first. A
|
|
2163
|
+
* socket's pipeline plays its sources one after another, so a batch on one socket leaves the GPU
|
|
2164
|
+
* mostly idle. While every open socket has a source and fewer than `pipelineSockets` are open, the next
|
|
2165
|
+
* job opens another; each job goes on the socket that has room and the fewest open sources.
|
|
2166
|
+
*/
|
|
2106
2167
|
declare class PipelineBackend implements WorkerBackend {
|
|
2107
2168
|
private readonly ctx;
|
|
2108
2169
|
private _pipelineApiUrl;
|
|
2109
|
-
private
|
|
2170
|
+
private _sockets;
|
|
2110
2171
|
private _connecting;
|
|
2111
2172
|
private _sendChain;
|
|
2112
2173
|
private _disconnecting;
|
|
2113
2174
|
private _nextId;
|
|
2114
2175
|
private _currentPop;
|
|
2115
2176
|
private readonly _warned;
|
|
2116
|
-
private
|
|
2177
|
+
private _noExtraSocketUntil;
|
|
2117
2178
|
private _reconnects;
|
|
2118
2179
|
constructor(ctx: WorkerContext);
|
|
2119
2180
|
reconnect(): Promise<void>;
|
|
@@ -2122,8 +2183,17 @@ declare class PipelineBackend implements WorkerBackend {
|
|
|
2122
2183
|
popName(): string | null;
|
|
2123
2184
|
authorizationHeader(): Promise<string>;
|
|
2124
2185
|
private inOrder;
|
|
2125
|
-
|
|
2186
|
+
private openSockets;
|
|
2187
|
+
/** An open socket, or a new one with the last pop set on it. */
|
|
2126
2188
|
private ensureSocket;
|
|
2189
|
+
/**
|
|
2190
|
+
* The socket for the next job; the caller runs it in submission order. A live job goes on a socket
|
|
2191
|
+
* of its own, an idle one or a new one, which `pipelineSockets` does not count. Any other job skips
|
|
2192
|
+
* the sockets with a live source: a new one while every other socket has a source and fewer than
|
|
2193
|
+
* `pipelineSockets` are open, else the one with room and the fewest sources.
|
|
2194
|
+
*/
|
|
2195
|
+
private socketForJob;
|
|
2196
|
+
/** A new socket with the last pop set on it; `patient` waits through 503 with Retry-After. */
|
|
2127
2197
|
private openSocket;
|
|
2128
2198
|
private startHeartbeat;
|
|
2129
2199
|
private socketUrl;
|
|
@@ -2137,7 +2207,11 @@ declare class PipelineBackend implements WorkerBackend {
|
|
|
2137
2207
|
/** Send a command that is answered by `result` or `error` under its id. */
|
|
2138
2208
|
private command;
|
|
2139
2209
|
pop(): Pop | null;
|
|
2140
|
-
/**
|
|
2210
|
+
/**
|
|
2211
|
+
* Set the pop on every open socket's pipeline; a pop the first refuses rejects, and the last pop it
|
|
2212
|
+
* took stays. shortcut: a refusal from a later socket, which the first took, leaves the earlier ones
|
|
2213
|
+
* on the new pop; a refusal is the pop's own fault, so every socket answers it alike.
|
|
2214
|
+
*/
|
|
2141
2215
|
changePop(pop: Pop): Promise<void>;
|
|
2142
2216
|
private setPopOn;
|
|
2143
2217
|
submit(work: WorkerWork): Promise<ResultStream>;
|
|
@@ -2290,4 +2364,4 @@ declare namespace EyePop {
|
|
|
2290
2364
|
function dataEndpoint(opts?: DataOptions): DataEndpoint;
|
|
2291
2365
|
}
|
|
2292
2366
|
|
|
2293
|
-
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, 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 };
|
|
2367
|
+
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 };
|