@eyepop.ai/eyepop 3.26.0-rc.2 → 3.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eyepop.index.d.mts +155 -6
- package/dist/eyepop.index.d.ts +155 -6
- package/dist/eyepop.index.js +297 -64
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +288 -64
- package/dist/eyepop.index.mjs.map +1 -1
- package/dist/eyepop.min.js +1 -1
- package/package.json +1 -1
package/dist/eyepop.index.js
CHANGED
|
@@ -8672,6 +8672,7 @@ __export(index_exports, {
|
|
|
8672
8672
|
ComputeApiError: () => ComputeApiError,
|
|
8673
8673
|
ContourType: () => ContourType,
|
|
8674
8674
|
DEFAULT_PREDICTION_VERSION: () => DEFAULT_PREDICTION_VERSION,
|
|
8675
|
+
DEFAULT_VLM_MODEL: () => DEFAULT_VLM_MODEL,
|
|
8675
8676
|
DataApiType: () => DataApiType,
|
|
8676
8677
|
DataEndpoint: () => DataEndpoint,
|
|
8677
8678
|
DepthMap: () => DepthMap,
|
|
@@ -8721,7 +8722,12 @@ __export(index_exports, {
|
|
|
8721
8722
|
UploadGroupJob: () => UploadGroupJob,
|
|
8722
8723
|
UploadJob: () => UploadJob,
|
|
8723
8724
|
UserReview: () => UserReview,
|
|
8725
|
+
VLM_MODEL_WORKER_RELEASES: () => VLM_MODEL_WORKER_RELEASES,
|
|
8724
8726
|
VideoMode: () => VideoMode,
|
|
8727
|
+
VlmAbilityModeError: () => VlmAbilityModeError,
|
|
8728
|
+
VlmAbilityModeErrorReason: () => VlmAbilityModeErrorReason,
|
|
8729
|
+
VlmAbilityModelError: () => VlmAbilityModelError,
|
|
8730
|
+
VlmAbilityModelErrorReason: () => VlmAbilityModelErrorReason,
|
|
8725
8731
|
VlmAbilityStatus: () => VlmAbilityStatus,
|
|
8726
8732
|
WebrtcBase: () => WebrtcBase,
|
|
8727
8733
|
WebrtcWhep: () => WebrtcWhep,
|
|
@@ -8739,10 +8745,13 @@ __export(index_exports, {
|
|
|
8739
8745
|
encodeMultipartFormData: () => encodeMultipartFormData,
|
|
8740
8746
|
getBaseUrl: () => getBaseUrl,
|
|
8741
8747
|
isSelectOperator: () => isSelectOperator,
|
|
8748
|
+
modelForWorkerRelease: () => modelForWorkerRelease,
|
|
8749
|
+
normalizeWorkerRelease: () => normalizeWorkerRelease,
|
|
8742
8750
|
popSelects: () => popSelects,
|
|
8743
8751
|
randomMultipartBoundary: () => randomMultipartBoundary,
|
|
8744
8752
|
readableStreamFromString: () => readableStreamFromString,
|
|
8745
8753
|
resolveAuth: () => resolveAuth,
|
|
8754
|
+
resolveWorkerRelease: () => resolveWorkerRelease,
|
|
8746
8755
|
validateCamera: () => validateCamera,
|
|
8747
8756
|
validatePop: () => validatePop
|
|
8748
8757
|
});
|
|
@@ -9044,14 +9053,25 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9044
9053
|
}
|
|
9045
9054
|
|
|
9046
9055
|
// endpoint.ts
|
|
9056
|
+
var ACCOUNT_CLAIM = "https://ident.eyepop.ai/account-uuid";
|
|
9057
|
+
var NOT_EXCHANGEABLE = ["API key or user login required", "API key authentication required for token refresh"];
|
|
9058
|
+
function carriesAccount(token) {
|
|
9059
|
+
try {
|
|
9060
|
+
const payload = (token.split(".")[1] ?? "").replace(/-/g, "+").replace(/_/g, "/");
|
|
9061
|
+
return Boolean(JSON.parse(atob(payload))?.[ACCOUNT_CLAIM]);
|
|
9062
|
+
} catch {
|
|
9063
|
+
return false;
|
|
9064
|
+
}
|
|
9065
|
+
}
|
|
9047
9066
|
var Endpoint = class {
|
|
9048
9067
|
constructor(options) {
|
|
9068
|
+
this._exchanging = null;
|
|
9049
9069
|
this._options = options;
|
|
9050
9070
|
this._token = null;
|
|
9051
9071
|
this._expire_token_time = null;
|
|
9052
9072
|
this._client = null;
|
|
9053
9073
|
this._statusRetryHandlers = /* @__PURE__ */ new Map();
|
|
9054
|
-
this._statusRetryHandlers.set(401, (statusCode) => this.statusHandler401(statusCode));
|
|
9074
|
+
this._statusRetryHandlers.set(401, (statusCode, failedToken) => this.statusHandler401(statusCode, failedToken));
|
|
9055
9075
|
this._limit = new Semaphore(this._options.jobQueueLength ?? 1024);
|
|
9056
9076
|
this._state = "Idle" /* Idle */;
|
|
9057
9077
|
this._message = null;
|
|
@@ -9067,7 +9087,7 @@ var Endpoint = class {
|
|
|
9067
9087
|
}
|
|
9068
9088
|
setStatusRetryHandlers(statusRetryHandlers = void 0) {
|
|
9069
9089
|
this._statusRetryHandlers = new Map(statusRetryHandlers);
|
|
9070
|
-
this._statusRetryHandlers.set(401, (statusCode) => this.statusHandler401(statusCode));
|
|
9090
|
+
this._statusRetryHandlers.set(401, (statusCode, failedToken) => this.statusHandler401(statusCode, failedToken));
|
|
9071
9091
|
}
|
|
9072
9092
|
eyepopUrl() {
|
|
9073
9093
|
if (this._options.eyepopUrl) {
|
|
@@ -9164,12 +9184,15 @@ var Endpoint = class {
|
|
|
9164
9184
|
validUntil: this._expire_token_time * 1e3
|
|
9165
9185
|
};
|
|
9166
9186
|
}
|
|
9167
|
-
statusHandler401(_statusCode) {
|
|
9168
|
-
this._token
|
|
9169
|
-
|
|
9187
|
+
statusHandler401(_statusCode, failedToken = this._token) {
|
|
9188
|
+
if (this._token === failedToken) {
|
|
9189
|
+
this._token = null;
|
|
9190
|
+
this._expire_token_time = null;
|
|
9191
|
+
}
|
|
9170
9192
|
}
|
|
9171
9193
|
async fetchWithRetry(fetcher, retries = 1) {
|
|
9172
9194
|
while (true) {
|
|
9195
|
+
const sentToken = this._token ?? void 0;
|
|
9173
9196
|
try {
|
|
9174
9197
|
const response = await fetcher();
|
|
9175
9198
|
if (response.ok) {
|
|
@@ -9177,7 +9200,7 @@ var Endpoint = class {
|
|
|
9177
9200
|
} else {
|
|
9178
9201
|
const handler = this._statusRetryHandlers.get(response.status);
|
|
9179
9202
|
if (handler != null) {
|
|
9180
|
-
handler(response.status);
|
|
9203
|
+
handler(response.status, sentToken);
|
|
9181
9204
|
if (retries--) {
|
|
9182
9205
|
this._requestLogger.info("received %d response, retry", response.status);
|
|
9183
9206
|
} else {
|
|
@@ -9211,54 +9234,75 @@ var Endpoint = class {
|
|
|
9211
9234
|
}
|
|
9212
9235
|
return `Bearer ${await this.currentAccessToken()}`;
|
|
9213
9236
|
}
|
|
9237
|
+
async exchange(client, credential, accountUuid) {
|
|
9238
|
+
const query = accountUuid ? `?account_uuid=${encodeURIComponent(accountUuid)}` : "";
|
|
9239
|
+
return await client.fetch(`${this.eyepopUrl()}/v1/auth/authenticate${query}`, {
|
|
9240
|
+
method: "POST",
|
|
9241
|
+
headers: { Authorization: `Bearer ${credential}` }
|
|
9242
|
+
});
|
|
9243
|
+
}
|
|
9244
|
+
async storeExchangedToken(response, now) {
|
|
9245
|
+
if (response.status != 200) {
|
|
9246
|
+
const message = await response.text();
|
|
9247
|
+
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
9248
|
+
}
|
|
9249
|
+
const token = await response.json();
|
|
9250
|
+
this._token = token.access_token;
|
|
9251
|
+
this._expire_token_time = now + token.expires_in - 60;
|
|
9252
|
+
}
|
|
9253
|
+
/**
|
|
9254
|
+
* A token that already carries an account, or that the compute API refuses to exchange
|
|
9255
|
+
* (see NOT_EXCHANGEABLE), is used as is. Any other refusal is raised.
|
|
9256
|
+
*/
|
|
9257
|
+
async exchangeLoginToken(client, loginToken, validUntil, now) {
|
|
9258
|
+
if (!carriesAccount(loginToken)) {
|
|
9259
|
+
const response = await this.exchange(client, loginToken, this._options.accountId);
|
|
9260
|
+
const refusal = response.status == 401 ? await response.clone().text() : "";
|
|
9261
|
+
if (!NOT_EXCHANGEABLE.some((message) => refusal.includes(message))) {
|
|
9262
|
+
await this.storeExchangedToken(response, now);
|
|
9263
|
+
return;
|
|
9264
|
+
}
|
|
9265
|
+
}
|
|
9266
|
+
this._token = loginToken;
|
|
9267
|
+
this._expire_token_time = validUntil;
|
|
9268
|
+
}
|
|
9214
9269
|
async currentAccessToken() {
|
|
9270
|
+
if (!this._token || this._expire_token_time < Date.now() / 1e3) {
|
|
9271
|
+
this._exchanging ?? (this._exchanging = this.authenticate().finally(() => this._exchanging = null));
|
|
9272
|
+
await this._exchanging;
|
|
9273
|
+
}
|
|
9274
|
+
this._logger.debug("using access token, valid for at least %d seconds", this._expire_token_time - Date.now() / 1e3);
|
|
9275
|
+
return this._token;
|
|
9276
|
+
}
|
|
9277
|
+
async authenticate() {
|
|
9215
9278
|
const now = Date.now() / 1e3;
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
} else if (this._options.eyepopUrl) {
|
|
9235
|
-
const credential = apiKeyCredential(auth);
|
|
9236
|
-
if (credential === void 0) {
|
|
9237
|
-
return Promise.reject("no valid auth option");
|
|
9238
|
-
}
|
|
9239
|
-
const headers = { Authorization: `Bearer ${credential}` };
|
|
9240
|
-
const post_url = `${this.eyepopUrl()}/v1/auth/authenticate`;
|
|
9241
|
-
const response = await this._client.fetch(post_url, {
|
|
9242
|
-
method: "POST",
|
|
9243
|
-
headers
|
|
9244
|
-
});
|
|
9245
|
-
if (response.status != 200) {
|
|
9246
|
-
const message = await response.text();
|
|
9247
|
-
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
9248
|
-
}
|
|
9249
|
-
const data = await response.json();
|
|
9250
|
-
const token = data;
|
|
9251
|
-
this._token = token.access_token;
|
|
9252
|
-
this._expire_token_time = now + token.expires_in - 60;
|
|
9253
|
-
} else {
|
|
9279
|
+
this.updateState("Authenticating" /* Authenticating */);
|
|
9280
|
+
try {
|
|
9281
|
+
const auth = resolveAuth(this._options);
|
|
9282
|
+
if (!this._client) {
|
|
9283
|
+
return Promise.reject("endpoint not connected");
|
|
9284
|
+
} else if (auth?.isLocal !== void 0) {
|
|
9285
|
+
this._token = "implicit";
|
|
9286
|
+
this._expire_token_time = Number.MAX_VALUE;
|
|
9287
|
+
} else if (auth?.session !== void 0) {
|
|
9288
|
+
return Promise.reject("temporary access token expired");
|
|
9289
|
+
} else if (auth?.oAuth2 !== void 0 && this._options.eyepopUrl) {
|
|
9290
|
+
const login = await authenticateBrowserSession(auth.oAuth2, this._options);
|
|
9291
|
+
await this.exchangeLoginToken(this._client, login.accessToken, login.validUntil / 1e3, now);
|
|
9292
|
+
} else if (accessTokenCredential(auth) !== void 0) {
|
|
9293
|
+
await this.exchangeLoginToken(this._client, accessTokenCredential(auth), Number.MAX_VALUE, now);
|
|
9294
|
+
} else if (this._options.eyepopUrl) {
|
|
9295
|
+
const credential = apiKeyCredential(auth);
|
|
9296
|
+
if (credential === void 0) {
|
|
9254
9297
|
return Promise.reject("no valid auth option");
|
|
9255
9298
|
}
|
|
9256
|
-
|
|
9257
|
-
|
|
9299
|
+
await this.storeExchangedToken(await this.exchange(this._client, credential), now);
|
|
9300
|
+
} else {
|
|
9301
|
+
return Promise.reject("no valid auth option");
|
|
9258
9302
|
}
|
|
9303
|
+
} finally {
|
|
9304
|
+
this.updateState();
|
|
9259
9305
|
}
|
|
9260
|
-
this._logger.debug("using access token, valid for at least %d seconds", this._expire_token_time - now);
|
|
9261
|
-
return this._token;
|
|
9262
9306
|
}
|
|
9263
9307
|
};
|
|
9264
9308
|
|
|
@@ -11808,10 +11852,22 @@ var PipelineJob = class {
|
|
|
11808
11852
|
this.openSource = null;
|
|
11809
11853
|
// Stops the job's source on the pipeline, once it was sent.
|
|
11810
11854
|
this.stopOnPipeline = null;
|
|
11855
|
+
this._milliComputeUnits = void 0;
|
|
11811
11856
|
}
|
|
11812
11857
|
get cancelled() {
|
|
11813
11858
|
return this._cancelled;
|
|
11814
11859
|
}
|
|
11860
|
+
/** The source's milli compute units: the latest total of its `usage` messages and its `end`. */
|
|
11861
|
+
get milliComputeUnits() {
|
|
11862
|
+
return this._milliComputeUnits;
|
|
11863
|
+
}
|
|
11864
|
+
/** Keep a usage's or an end's milliComputeUnits: each carries the source's total so far. */
|
|
11865
|
+
noteMilliComputeUnits(message) {
|
|
11866
|
+
const value = message["milliComputeUnits"];
|
|
11867
|
+
if (Number.isInteger(value) && value >= 0) {
|
|
11868
|
+
this._milliComputeUnits = value;
|
|
11869
|
+
}
|
|
11870
|
+
}
|
|
11815
11871
|
command(id) {
|
|
11816
11872
|
const command = { type: "setSource", id, ...this.source };
|
|
11817
11873
|
if (this.params.componentParams !== void 0) {
|
|
@@ -12389,7 +12445,11 @@ var PipelineBackend = class {
|
|
|
12389
12445
|
case "prediction":
|
|
12390
12446
|
job.predicted(message["prediction"]);
|
|
12391
12447
|
break;
|
|
12448
|
+
case "usage":
|
|
12449
|
+
job.noteMilliComputeUnits(message);
|
|
12450
|
+
break;
|
|
12392
12451
|
case "end":
|
|
12452
|
+
job.noteMilliComputeUnits(message);
|
|
12393
12453
|
if (message["reason"] === "eos") {
|
|
12394
12454
|
return null;
|
|
12395
12455
|
}
|
|
@@ -12947,12 +13007,18 @@ var VlmAbilityStatus = /* @__PURE__ */ ((VlmAbilityStatus2) => {
|
|
|
12947
13007
|
VlmAbilityStatus2["published"] = "published";
|
|
12948
13008
|
return VlmAbilityStatus2;
|
|
12949
13009
|
})(VlmAbilityStatus || {});
|
|
13010
|
+
var VLM_MODEL_WORKER_RELEASES = Object.freeze({
|
|
13011
|
+
qwen3: "qwen3_instruct",
|
|
13012
|
+
gpt_6_astra: "gpt-6-astra",
|
|
13013
|
+
gemini_4_argon: "gemini-4-argon"
|
|
13014
|
+
});
|
|
12950
13015
|
|
|
12951
13016
|
// data/jobs.ts
|
|
12952
13017
|
var InferAssetJob = class {
|
|
12953
13018
|
constructor(assetUrl, inferRequest, vlmFetch, requestLogger) {
|
|
12954
13019
|
this._response = null;
|
|
12955
13020
|
this._runInfo = null;
|
|
13021
|
+
this._milliComputeUnits = void 0;
|
|
12956
13022
|
this._controller = new AbortController();
|
|
12957
13023
|
this._vlmFetch = vlmFetch;
|
|
12958
13024
|
this._assetUrl = assetUrl;
|
|
@@ -12989,6 +13055,13 @@ var InferAssetJob = class {
|
|
|
12989
13055
|
}
|
|
12990
13056
|
return iterator();
|
|
12991
13057
|
}
|
|
13058
|
+
/**
|
|
13059
|
+
* The milli compute units vlm-server billed for the inference, 0 on a cache hit; undefined before it answered
|
|
13060
|
+
* or when it reported none.
|
|
13061
|
+
*/
|
|
13062
|
+
get milliComputeUnits() {
|
|
13063
|
+
return this._milliComputeUnits;
|
|
13064
|
+
}
|
|
12992
13065
|
start(done) {
|
|
12993
13066
|
this._response = new Promise(async (resolve, reject) => {
|
|
12994
13067
|
try {
|
|
@@ -13013,6 +13086,8 @@ var InferAssetJob = class {
|
|
|
13013
13086
|
const runInfo = response["run_info"];
|
|
13014
13087
|
if (predictions) {
|
|
13015
13088
|
this._runInfo = runInfo;
|
|
13089
|
+
const used = response["milli_compute_units"] ?? response["compute_units"];
|
|
13090
|
+
this._milliComputeUnits = typeof used === "number" ? used : void 0;
|
|
13016
13091
|
resolve(predictions);
|
|
13017
13092
|
break;
|
|
13018
13093
|
} else {
|
|
@@ -13129,6 +13204,151 @@ function omit_nulls(_, value) {
|
|
|
13129
13204
|
}
|
|
13130
13205
|
return value;
|
|
13131
13206
|
}
|
|
13207
|
+
var TASK_EXCLUDED_FIELDS = ["text_prompt", "transform_into", "response_schema"];
|
|
13208
|
+
var VlmAbilityModeErrorReason = /* @__PURE__ */ ((VlmAbilityModeErrorReason2) => {
|
|
13209
|
+
VlmAbilityModeErrorReason2["missing_mode"] = "missing_mode";
|
|
13210
|
+
VlmAbilityModeErrorReason2["unknown_task"] = "unknown_task";
|
|
13211
|
+
VlmAbilityModeErrorReason2["task_excludes_free_form"] = "task_excludes_free_form";
|
|
13212
|
+
VlmAbilityModeErrorReason2["task_without_prompts"] = "task_without_prompts";
|
|
13213
|
+
VlmAbilityModeErrorReason2["prompts_without_task"] = "prompts_without_task";
|
|
13214
|
+
VlmAbilityModeErrorReason2["empty_prompts"] = "empty_prompts";
|
|
13215
|
+
VlmAbilityModeErrorReason2["invalid_prompt"] = "invalid_prompt";
|
|
13216
|
+
return VlmAbilityModeErrorReason2;
|
|
13217
|
+
})(VlmAbilityModeErrorReason || {});
|
|
13218
|
+
var VlmAbilityModeError = class extends Error {
|
|
13219
|
+
constructor(reason, message, fields = []) {
|
|
13220
|
+
super(message);
|
|
13221
|
+
this.name = "VlmAbilityModeError";
|
|
13222
|
+
this.reason = reason;
|
|
13223
|
+
this.fields = fields;
|
|
13224
|
+
}
|
|
13225
|
+
};
|
|
13226
|
+
function isSet(value) {
|
|
13227
|
+
return value !== void 0 && value !== null;
|
|
13228
|
+
}
|
|
13229
|
+
function validateVlmAbilityMode(ability, partial) {
|
|
13230
|
+
const kind = partial ? "VLM ability update" : "VLM ability";
|
|
13231
|
+
const taskSet = isSet(ability.task);
|
|
13232
|
+
const promptsSet = isSet(ability.prompts);
|
|
13233
|
+
if (taskSet && !Object.values(AutoAnnotateTask).includes(ability.task)) {
|
|
13234
|
+
throw new VlmAbilityModeError("unknown_task" /* unknown_task */, `${kind}: unknown task '${String(ability.task)}', expected one of ${Object.values(AutoAnnotateTask).join(", ")}`, [
|
|
13235
|
+
"task"
|
|
13236
|
+
]);
|
|
13237
|
+
}
|
|
13238
|
+
if (taskSet || promptsSet) {
|
|
13239
|
+
const conflicting = TASK_EXCLUDED_FIELDS.filter((field) => isSet(ability[field]));
|
|
13240
|
+
if (conflicting.length > 0) {
|
|
13241
|
+
throw new VlmAbilityModeError(
|
|
13242
|
+
"task_excludes_free_form" /* task_excludes_free_form */,
|
|
13243
|
+
`${kind}: a task derives the prompt and output schema, so ${conflicting.join(", ")} must be unset with task and prompts`,
|
|
13244
|
+
[...conflicting]
|
|
13245
|
+
);
|
|
13246
|
+
}
|
|
13247
|
+
}
|
|
13248
|
+
if (promptsSet) {
|
|
13249
|
+
if (!Array.isArray(ability.prompts) || ability.prompts.length === 0) {
|
|
13250
|
+
throw new VlmAbilityModeError("empty_prompts" /* empty_prompts */, `${kind}: prompts must be a non-empty list of {label, prompt}`, ["prompts"]);
|
|
13251
|
+
}
|
|
13252
|
+
ability.prompts.forEach((entry, i) => {
|
|
13253
|
+
if (!entry || typeof entry.label !== "string" || entry.label.length === 0 || typeof entry.prompt !== "string" || entry.prompt.length === 0) {
|
|
13254
|
+
throw new VlmAbilityModeError("invalid_prompt" /* invalid_prompt */, `${kind}: prompts[${i}] needs a non-empty label and prompt`, [`prompts[${i}]`]);
|
|
13255
|
+
}
|
|
13256
|
+
});
|
|
13257
|
+
}
|
|
13258
|
+
if (partial) {
|
|
13259
|
+
return;
|
|
13260
|
+
}
|
|
13261
|
+
if (taskSet && !promptsSet) {
|
|
13262
|
+
throw new VlmAbilityModeError("task_without_prompts" /* task_without_prompts */, `${kind}: task '${ability.task}' requires a non-empty prompts list of {label, prompt}`, ["prompts"]);
|
|
13263
|
+
}
|
|
13264
|
+
if (!taskSet && promptsSet) {
|
|
13265
|
+
throw new VlmAbilityModeError("prompts_without_task" /* prompts_without_task */, `${kind}: prompts are only used with a task; set task, or use text_prompt for a free-form ability`, ["prompts"]);
|
|
13266
|
+
}
|
|
13267
|
+
if (!taskSet && !(typeof ability.text_prompt === "string" && ability.text_prompt.length > 0)) {
|
|
13268
|
+
throw new VlmAbilityModeError("missing_mode" /* missing_mode */, `${kind}: set either text_prompt (free-form) or task with non-empty prompts`, ["text_prompt", "task"]);
|
|
13269
|
+
}
|
|
13270
|
+
}
|
|
13271
|
+
var VlmAbilityModelErrorReason = /* @__PURE__ */ ((VlmAbilityModelErrorReason2) => {
|
|
13272
|
+
VlmAbilityModelErrorReason2["unknown_model"] = "unknown_model";
|
|
13273
|
+
VlmAbilityModelErrorReason2["unknown_worker_release"] = "unknown_worker_release";
|
|
13274
|
+
VlmAbilityModelErrorReason2["model_conflict"] = "model_conflict";
|
|
13275
|
+
return VlmAbilityModelErrorReason2;
|
|
13276
|
+
})(VlmAbilityModelErrorReason || {});
|
|
13277
|
+
var VlmAbilityModelError = class extends Error {
|
|
13278
|
+
constructor(reason, message, fields = []) {
|
|
13279
|
+
super(message);
|
|
13280
|
+
this.name = "VlmAbilityModelError";
|
|
13281
|
+
this.reason = reason;
|
|
13282
|
+
this.fields = fields;
|
|
13283
|
+
}
|
|
13284
|
+
};
|
|
13285
|
+
var VLM_MODELS = Object.keys(VLM_MODEL_WORKER_RELEASES);
|
|
13286
|
+
var DEFAULT_VLM_MODEL = "qwen3";
|
|
13287
|
+
function isVlmModel(value) {
|
|
13288
|
+
return typeof value === "string" && Object.prototype.hasOwnProperty.call(VLM_MODEL_WORKER_RELEASES, value);
|
|
13289
|
+
}
|
|
13290
|
+
function normalizeWorkerRelease(workerRelease) {
|
|
13291
|
+
return workerRelease.toLowerCase().replace(/_/g, "-");
|
|
13292
|
+
}
|
|
13293
|
+
function modelForWorkerRelease(workerRelease) {
|
|
13294
|
+
if (workerRelease === void 0 || workerRelease === null) {
|
|
13295
|
+
return DEFAULT_VLM_MODEL;
|
|
13296
|
+
}
|
|
13297
|
+
const normalized = normalizeWorkerRelease(workerRelease);
|
|
13298
|
+
return VLM_MODELS.find((model) => normalizeWorkerRelease(VLM_MODEL_WORKER_RELEASES[model]) === normalized) ?? null;
|
|
13299
|
+
}
|
|
13300
|
+
function checkModelAndWorkerRelease(model, workerRelease, prefix) {
|
|
13301
|
+
const modelSet = isSet(model);
|
|
13302
|
+
if (modelSet && !isVlmModel(model)) {
|
|
13303
|
+
throw new VlmAbilityModelError("unknown_model" /* unknown_model */, `${prefix}unknown model '${String(model)}'; set \`model\` to one of ${VLM_MODELS.join(", ")}`, ["model"]);
|
|
13304
|
+
}
|
|
13305
|
+
if (!isSet(workerRelease)) {
|
|
13306
|
+
return modelSet ? model : null;
|
|
13307
|
+
}
|
|
13308
|
+
const releaseModel = typeof workerRelease === "string" ? modelForWorkerRelease(workerRelease) : null;
|
|
13309
|
+
if (releaseModel === null) {
|
|
13310
|
+
throw new VlmAbilityModelError(
|
|
13311
|
+
"unknown_worker_release" /* unknown_worker_release */,
|
|
13312
|
+
`${prefix}unknown worker_release '${String(workerRelease)}'; worker_release is deprecated, set \`model\` to one of ${VLM_MODELS.join(", ")}`,
|
|
13313
|
+
["worker_release"]
|
|
13314
|
+
);
|
|
13315
|
+
}
|
|
13316
|
+
if (modelSet && releaseModel !== model) {
|
|
13317
|
+
throw new VlmAbilityModelError(
|
|
13318
|
+
"model_conflict" /* model_conflict */,
|
|
13319
|
+
`${prefix}worker_release '${String(workerRelease)}' runs model ${releaseModel}, not ${String(model)}; worker_release is deprecated, set only \`model\``,
|
|
13320
|
+
["model", "worker_release"]
|
|
13321
|
+
);
|
|
13322
|
+
}
|
|
13323
|
+
return releaseModel;
|
|
13324
|
+
}
|
|
13325
|
+
function resolveWorkerRelease(model, workerRelease) {
|
|
13326
|
+
return VLM_MODEL_WORKER_RELEASES[checkModelAndWorkerRelease(model, workerRelease, "") ?? DEFAULT_VLM_MODEL];
|
|
13327
|
+
}
|
|
13328
|
+
function withVlmModel(ability) {
|
|
13329
|
+
if (!ability || typeof ability !== "object") {
|
|
13330
|
+
return ability;
|
|
13331
|
+
}
|
|
13332
|
+
if (!("model" in ability)) {
|
|
13333
|
+
return { ...ability, model: modelForWorkerRelease(ability.worker_release) };
|
|
13334
|
+
}
|
|
13335
|
+
if (isSet(ability.model) && !isVlmModel(ability.model)) {
|
|
13336
|
+
return { ...ability, model: null };
|
|
13337
|
+
}
|
|
13338
|
+
return ability;
|
|
13339
|
+
}
|
|
13340
|
+
var warnedWorkerRelease = false;
|
|
13341
|
+
function prepareVlmAbilityModel(ability, partial) {
|
|
13342
|
+
if (isSet(ability.worker_release) && !warnedWorkerRelease) {
|
|
13343
|
+
warnedWorkerRelease = true;
|
|
13344
|
+
console.warn("worker_release is deprecated, set model to a VlmModel instead");
|
|
13345
|
+
}
|
|
13346
|
+
checkModelAndWorkerRelease(ability.model, ability.worker_release, partial ? "VLM ability update: " : "VLM ability: ");
|
|
13347
|
+
if (isSet(ability.model) && !isSet(ability.worker_release)) {
|
|
13348
|
+
return { ...ability, worker_release: VLM_MODEL_WORKER_RELEASES[ability.model] };
|
|
13349
|
+
}
|
|
13350
|
+
return ability;
|
|
13351
|
+
}
|
|
13132
13352
|
var DataEndpoint = class extends Endpoint {
|
|
13133
13353
|
constructor(options) {
|
|
13134
13354
|
super(options);
|
|
@@ -13917,20 +14137,22 @@ var DataEndpoint = class extends Endpoint {
|
|
|
13917
14137
|
async listVlmAbilities() {
|
|
13918
14138
|
return this.request(`/vlm_abilities?account_uuid=${this._accountId}`, {
|
|
13919
14139
|
method: "GET"
|
|
13920
|
-
});
|
|
14140
|
+
}).then((abilities) => Array.isArray(abilities) ? abilities.map(withVlmModel) : abilities);
|
|
13921
14141
|
}
|
|
13922
14142
|
async createVlmAbility(create, vlm_ability_group_uuid) {
|
|
14143
|
+
validateVlmAbilityMode(create, false);
|
|
14144
|
+
const body = prepareVlmAbilityModel(create, false);
|
|
13923
14145
|
const groupQuery = vlm_ability_group_uuid ? `&vlm_ability_group_uuid=${vlm_ability_group_uuid}` : "";
|
|
13924
14146
|
return this.request(`/vlm_abilities?account_uuid=${this._accountId}${groupQuery}`, {
|
|
13925
14147
|
method: "POST",
|
|
13926
|
-
body: JSON.stringify(
|
|
14148
|
+
body: JSON.stringify(body, omit_nulls),
|
|
13927
14149
|
headers: { "Content-Type": "application/json" }
|
|
13928
|
-
});
|
|
14150
|
+
}).then(withVlmModel);
|
|
13929
14151
|
}
|
|
13930
14152
|
async getVlmAbility(vlm_ability_uuid) {
|
|
13931
14153
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}`, {
|
|
13932
14154
|
method: "GET"
|
|
13933
|
-
});
|
|
14155
|
+
}).then(withVlmModel);
|
|
13934
14156
|
}
|
|
13935
14157
|
async deleteVlmAbility(vlm_ability_uuid) {
|
|
13936
14158
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}`, {
|
|
@@ -13938,11 +14160,13 @@ var DataEndpoint = class extends Endpoint {
|
|
|
13938
14160
|
});
|
|
13939
14161
|
}
|
|
13940
14162
|
async updateVlmAbility(vlm_ability_uuid, update) {
|
|
14163
|
+
validateVlmAbilityMode(update, true);
|
|
14164
|
+
const body = prepareVlmAbilityModel(update, true);
|
|
13941
14165
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}`, {
|
|
13942
14166
|
method: "PATCH",
|
|
13943
|
-
body: JSON.stringify(
|
|
14167
|
+
body: JSON.stringify(body),
|
|
13944
14168
|
headers: { "Content-Type": "application/json" }
|
|
13945
|
-
});
|
|
14169
|
+
}).then(withVlmModel);
|
|
13946
14170
|
}
|
|
13947
14171
|
async refineVlmAbility(vlm_ability_uuid, auto_prompt, auto_task) {
|
|
13948
14172
|
if (auto_prompt !== void 0) {
|
|
@@ -13950,13 +14174,13 @@ var DataEndpoint = class extends Endpoint {
|
|
|
13950
14174
|
method: "POST",
|
|
13951
14175
|
body: JSON.stringify(auto_prompt, omit_nulls),
|
|
13952
14176
|
headers: { "Content-Type": "application/json" }
|
|
13953
|
-
});
|
|
14177
|
+
}).then(withVlmModel);
|
|
13954
14178
|
} else if (auto_task !== void 0) {
|
|
13955
14179
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}/refine_task`, {
|
|
13956
14180
|
method: "POST",
|
|
13957
14181
|
body: JSON.stringify(auto_task, omit_nulls),
|
|
13958
14182
|
headers: { "Content-Type": "application/json" }
|
|
13959
|
-
});
|
|
14183
|
+
}).then(withVlmModel);
|
|
13960
14184
|
} else {
|
|
13961
14185
|
return Promise.reject("refine vlm ability requires auto_prompt or auto_config parameter");
|
|
13962
14186
|
}
|
|
@@ -13976,24 +14200,24 @@ var DataEndpoint = class extends Endpoint {
|
|
|
13976
14200
|
}
|
|
13977
14201
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}/clone?${params.toString()}`, {
|
|
13978
14202
|
method: "POST"
|
|
13979
|
-
});
|
|
14203
|
+
}).then(withVlmModel);
|
|
13980
14204
|
}
|
|
13981
14205
|
async publishVlmAbility(vlm_ability_uuid, alias_name, tag_name) {
|
|
13982
14206
|
const alias_name_query = alias_name ? `alias_name=${encodeURIComponent(alias_name)}&` : "";
|
|
13983
14207
|
const tag_name_query = tag_name ? `tag_name=${encodeURIComponent(tag_name)}&` : "";
|
|
13984
14208
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}/publish?${alias_name_query}${tag_name_query}`, {
|
|
13985
14209
|
method: "POST"
|
|
13986
|
-
});
|
|
14210
|
+
}).then(withVlmModel);
|
|
13987
14211
|
}
|
|
13988
14212
|
async addVlmAbilityAlias(vlm_ability_uuid, alias_name, tag_name) {
|
|
13989
14213
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}/alias/${encodeURIComponent(alias_name)}/tag/${tag_name ? encodeURIComponent(tag_name) : ""}`, {
|
|
13990
14214
|
method: "POST"
|
|
13991
|
-
});
|
|
14215
|
+
}).then(withVlmModel);
|
|
13992
14216
|
}
|
|
13993
14217
|
async removeVlmAbilityAlias(vlm_ability_uuid, alias_name, tag_name) {
|
|
13994
14218
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}/alias/${encodeURIComponent(alias_name)}/tag/${encodeURIComponent(tag_name)}`, {
|
|
13995
14219
|
method: "DELETE"
|
|
13996
|
-
});
|
|
14220
|
+
}).then(withVlmModel);
|
|
13997
14221
|
}
|
|
13998
14222
|
async listVlmAbilityEvaluations(vlm_ability_uuid) {
|
|
13999
14223
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}/evaluations`, {
|
|
@@ -14536,17 +14760,17 @@ var EyePop;
|
|
|
14536
14760
|
if (typeof auth.oAuth2 === "boolean") {
|
|
14537
14761
|
const oAuth2 = opts.eyepopUrl && opts.eyepopUrl.match(/https:(.*).staging.eyepop.xyz/i) ? {
|
|
14538
14762
|
oAuth2: {
|
|
14539
|
-
domain: "
|
|
14763
|
+
domain: "auth0.eyepop.xyz",
|
|
14540
14764
|
clientId: "jktx3YO2UnbkNPvr05PQWf26t1kNTJyg",
|
|
14541
14765
|
audience: "https://dev-app.eyepop.ai",
|
|
14542
|
-
scope: "
|
|
14766
|
+
scope: "access:inference-api access:datasets"
|
|
14543
14767
|
}
|
|
14544
14768
|
} : {
|
|
14545
14769
|
oAuth2: {
|
|
14546
|
-
domain: "eyepop.
|
|
14770
|
+
domain: "auth0.eyepop.ai",
|
|
14547
14771
|
clientId: "Lb9ubA9Hf3jlaqWLUx8XgA0zvotgViCl",
|
|
14548
14772
|
audience: "https://api.eyepop.ai",
|
|
14549
|
-
scope: "
|
|
14773
|
+
scope: "access:inference-api access:datasets"
|
|
14550
14774
|
}
|
|
14551
14775
|
};
|
|
14552
14776
|
if (opts.oAuth2 !== void 0) {
|
|
@@ -14581,6 +14805,7 @@ var index_default = EyePop;
|
|
|
14581
14805
|
ComputeApiError,
|
|
14582
14806
|
ContourType,
|
|
14583
14807
|
DEFAULT_PREDICTION_VERSION,
|
|
14808
|
+
DEFAULT_VLM_MODEL,
|
|
14584
14809
|
DataApiType,
|
|
14585
14810
|
DataEndpoint,
|
|
14586
14811
|
DepthMap,
|
|
@@ -14630,7 +14855,12 @@ var index_default = EyePop;
|
|
|
14630
14855
|
UploadGroupJob,
|
|
14631
14856
|
UploadJob,
|
|
14632
14857
|
UserReview,
|
|
14858
|
+
VLM_MODEL_WORKER_RELEASES,
|
|
14633
14859
|
VideoMode,
|
|
14860
|
+
VlmAbilityModeError,
|
|
14861
|
+
VlmAbilityModeErrorReason,
|
|
14862
|
+
VlmAbilityModelError,
|
|
14863
|
+
VlmAbilityModelErrorReason,
|
|
14634
14864
|
VlmAbilityStatus,
|
|
14635
14865
|
WebrtcBase,
|
|
14636
14866
|
WebrtcWhep,
|
|
@@ -14647,10 +14877,13 @@ var index_default = EyePop;
|
|
|
14647
14877
|
encodeMultipartFormData,
|
|
14648
14878
|
getBaseUrl,
|
|
14649
14879
|
isSelectOperator,
|
|
14880
|
+
modelForWorkerRelease,
|
|
14881
|
+
normalizeWorkerRelease,
|
|
14650
14882
|
popSelects,
|
|
14651
14883
|
randomMultipartBoundary,
|
|
14652
14884
|
readableStreamFromString,
|
|
14653
14885
|
resolveAuth,
|
|
14886
|
+
resolveWorkerRelease,
|
|
14654
14887
|
validateCamera,
|
|
14655
14888
|
validatePop
|
|
14656
14889
|
});
|