@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.mjs
CHANGED
|
@@ -8928,14 +8928,25 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
8928
8928
|
}
|
|
8929
8929
|
|
|
8930
8930
|
// endpoint.ts
|
|
8931
|
+
var ACCOUNT_CLAIM = "https://ident.eyepop.ai/account-uuid";
|
|
8932
|
+
var NOT_EXCHANGEABLE = ["API key or user login required", "API key authentication required for token refresh"];
|
|
8933
|
+
function carriesAccount(token) {
|
|
8934
|
+
try {
|
|
8935
|
+
const payload = (token.split(".")[1] ?? "").replace(/-/g, "+").replace(/_/g, "/");
|
|
8936
|
+
return Boolean(JSON.parse(atob(payload))?.[ACCOUNT_CLAIM]);
|
|
8937
|
+
} catch {
|
|
8938
|
+
return false;
|
|
8939
|
+
}
|
|
8940
|
+
}
|
|
8931
8941
|
var Endpoint = class {
|
|
8932
8942
|
constructor(options) {
|
|
8943
|
+
this._exchanging = null;
|
|
8933
8944
|
this._options = options;
|
|
8934
8945
|
this._token = null;
|
|
8935
8946
|
this._expire_token_time = null;
|
|
8936
8947
|
this._client = null;
|
|
8937
8948
|
this._statusRetryHandlers = /* @__PURE__ */ new Map();
|
|
8938
|
-
this._statusRetryHandlers.set(401, (statusCode) => this.statusHandler401(statusCode));
|
|
8949
|
+
this._statusRetryHandlers.set(401, (statusCode, failedToken) => this.statusHandler401(statusCode, failedToken));
|
|
8939
8950
|
this._limit = new Semaphore(this._options.jobQueueLength ?? 1024);
|
|
8940
8951
|
this._state = "Idle" /* Idle */;
|
|
8941
8952
|
this._message = null;
|
|
@@ -8951,7 +8962,7 @@ var Endpoint = class {
|
|
|
8951
8962
|
}
|
|
8952
8963
|
setStatusRetryHandlers(statusRetryHandlers = void 0) {
|
|
8953
8964
|
this._statusRetryHandlers = new Map(statusRetryHandlers);
|
|
8954
|
-
this._statusRetryHandlers.set(401, (statusCode) => this.statusHandler401(statusCode));
|
|
8965
|
+
this._statusRetryHandlers.set(401, (statusCode, failedToken) => this.statusHandler401(statusCode, failedToken));
|
|
8955
8966
|
}
|
|
8956
8967
|
eyepopUrl() {
|
|
8957
8968
|
if (this._options.eyepopUrl) {
|
|
@@ -9048,12 +9059,15 @@ var Endpoint = class {
|
|
|
9048
9059
|
validUntil: this._expire_token_time * 1e3
|
|
9049
9060
|
};
|
|
9050
9061
|
}
|
|
9051
|
-
statusHandler401(_statusCode) {
|
|
9052
|
-
this._token
|
|
9053
|
-
|
|
9062
|
+
statusHandler401(_statusCode, failedToken = this._token) {
|
|
9063
|
+
if (this._token === failedToken) {
|
|
9064
|
+
this._token = null;
|
|
9065
|
+
this._expire_token_time = null;
|
|
9066
|
+
}
|
|
9054
9067
|
}
|
|
9055
9068
|
async fetchWithRetry(fetcher, retries = 1) {
|
|
9056
9069
|
while (true) {
|
|
9070
|
+
const sentToken = this._token ?? void 0;
|
|
9057
9071
|
try {
|
|
9058
9072
|
const response = await fetcher();
|
|
9059
9073
|
if (response.ok) {
|
|
@@ -9061,7 +9075,7 @@ var Endpoint = class {
|
|
|
9061
9075
|
} else {
|
|
9062
9076
|
const handler = this._statusRetryHandlers.get(response.status);
|
|
9063
9077
|
if (handler != null) {
|
|
9064
|
-
handler(response.status);
|
|
9078
|
+
handler(response.status, sentToken);
|
|
9065
9079
|
if (retries--) {
|
|
9066
9080
|
this._requestLogger.info("received %d response, retry", response.status);
|
|
9067
9081
|
} else {
|
|
@@ -9095,54 +9109,75 @@ var Endpoint = class {
|
|
|
9095
9109
|
}
|
|
9096
9110
|
return `Bearer ${await this.currentAccessToken()}`;
|
|
9097
9111
|
}
|
|
9112
|
+
async exchange(client, credential, accountUuid) {
|
|
9113
|
+
const query = accountUuid ? `?account_uuid=${encodeURIComponent(accountUuid)}` : "";
|
|
9114
|
+
return await client.fetch(`${this.eyepopUrl()}/v1/auth/authenticate${query}`, {
|
|
9115
|
+
method: "POST",
|
|
9116
|
+
headers: { Authorization: `Bearer ${credential}` }
|
|
9117
|
+
});
|
|
9118
|
+
}
|
|
9119
|
+
async storeExchangedToken(response, now) {
|
|
9120
|
+
if (response.status != 200) {
|
|
9121
|
+
const message = await response.text();
|
|
9122
|
+
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
9123
|
+
}
|
|
9124
|
+
const token = await response.json();
|
|
9125
|
+
this._token = token.access_token;
|
|
9126
|
+
this._expire_token_time = now + token.expires_in - 60;
|
|
9127
|
+
}
|
|
9128
|
+
/**
|
|
9129
|
+
* A token that already carries an account, or that the compute API refuses to exchange
|
|
9130
|
+
* (see NOT_EXCHANGEABLE), is used as is. Any other refusal is raised.
|
|
9131
|
+
*/
|
|
9132
|
+
async exchangeLoginToken(client, loginToken, validUntil, now) {
|
|
9133
|
+
if (!carriesAccount(loginToken)) {
|
|
9134
|
+
const response = await this.exchange(client, loginToken, this._options.accountId);
|
|
9135
|
+
const refusal = response.status == 401 ? await response.clone().text() : "";
|
|
9136
|
+
if (!NOT_EXCHANGEABLE.some((message) => refusal.includes(message))) {
|
|
9137
|
+
await this.storeExchangedToken(response, now);
|
|
9138
|
+
return;
|
|
9139
|
+
}
|
|
9140
|
+
}
|
|
9141
|
+
this._token = loginToken;
|
|
9142
|
+
this._expire_token_time = validUntil;
|
|
9143
|
+
}
|
|
9098
9144
|
async currentAccessToken() {
|
|
9145
|
+
if (!this._token || this._expire_token_time < Date.now() / 1e3) {
|
|
9146
|
+
this._exchanging ?? (this._exchanging = this.authenticate().finally(() => this._exchanging = null));
|
|
9147
|
+
await this._exchanging;
|
|
9148
|
+
}
|
|
9149
|
+
this._logger.debug("using access token, valid for at least %d seconds", this._expire_token_time - Date.now() / 1e3);
|
|
9150
|
+
return this._token;
|
|
9151
|
+
}
|
|
9152
|
+
async authenticate() {
|
|
9099
9153
|
const now = Date.now() / 1e3;
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
|
-
} else if (this._options.eyepopUrl) {
|
|
9119
|
-
const credential = apiKeyCredential(auth);
|
|
9120
|
-
if (credential === void 0) {
|
|
9121
|
-
return Promise.reject("no valid auth option");
|
|
9122
|
-
}
|
|
9123
|
-
const headers = { Authorization: `Bearer ${credential}` };
|
|
9124
|
-
const post_url = `${this.eyepopUrl()}/v1/auth/authenticate`;
|
|
9125
|
-
const response = await this._client.fetch(post_url, {
|
|
9126
|
-
method: "POST",
|
|
9127
|
-
headers
|
|
9128
|
-
});
|
|
9129
|
-
if (response.status != 200) {
|
|
9130
|
-
const message = await response.text();
|
|
9131
|
-
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
9132
|
-
}
|
|
9133
|
-
const data = await response.json();
|
|
9134
|
-
const token = data;
|
|
9135
|
-
this._token = token.access_token;
|
|
9136
|
-
this._expire_token_time = now + token.expires_in - 60;
|
|
9137
|
-
} else {
|
|
9154
|
+
this.updateState("Authenticating" /* Authenticating */);
|
|
9155
|
+
try {
|
|
9156
|
+
const auth = resolveAuth(this._options);
|
|
9157
|
+
if (!this._client) {
|
|
9158
|
+
return Promise.reject("endpoint not connected");
|
|
9159
|
+
} else if (auth?.isLocal !== void 0) {
|
|
9160
|
+
this._token = "implicit";
|
|
9161
|
+
this._expire_token_time = Number.MAX_VALUE;
|
|
9162
|
+
} else if (auth?.session !== void 0) {
|
|
9163
|
+
return Promise.reject("temporary access token expired");
|
|
9164
|
+
} else if (auth?.oAuth2 !== void 0 && this._options.eyepopUrl) {
|
|
9165
|
+
const login = await authenticateBrowserSession(auth.oAuth2, this._options);
|
|
9166
|
+
await this.exchangeLoginToken(this._client, login.accessToken, login.validUntil / 1e3, now);
|
|
9167
|
+
} else if (accessTokenCredential(auth) !== void 0) {
|
|
9168
|
+
await this.exchangeLoginToken(this._client, accessTokenCredential(auth), Number.MAX_VALUE, now);
|
|
9169
|
+
} else if (this._options.eyepopUrl) {
|
|
9170
|
+
const credential = apiKeyCredential(auth);
|
|
9171
|
+
if (credential === void 0) {
|
|
9138
9172
|
return Promise.reject("no valid auth option");
|
|
9139
9173
|
}
|
|
9140
|
-
|
|
9141
|
-
|
|
9174
|
+
await this.storeExchangedToken(await this.exchange(this._client, credential), now);
|
|
9175
|
+
} else {
|
|
9176
|
+
return Promise.reject("no valid auth option");
|
|
9142
9177
|
}
|
|
9178
|
+
} finally {
|
|
9179
|
+
this.updateState();
|
|
9143
9180
|
}
|
|
9144
|
-
this._logger.debug("using access token, valid for at least %d seconds", this._expire_token_time - now);
|
|
9145
|
-
return this._token;
|
|
9146
9181
|
}
|
|
9147
9182
|
};
|
|
9148
9183
|
|
|
@@ -11692,10 +11727,22 @@ var PipelineJob = class {
|
|
|
11692
11727
|
this.openSource = null;
|
|
11693
11728
|
// Stops the job's source on the pipeline, once it was sent.
|
|
11694
11729
|
this.stopOnPipeline = null;
|
|
11730
|
+
this._milliComputeUnits = void 0;
|
|
11695
11731
|
}
|
|
11696
11732
|
get cancelled() {
|
|
11697
11733
|
return this._cancelled;
|
|
11698
11734
|
}
|
|
11735
|
+
/** The source's milli compute units: the latest total of its `usage` messages and its `end`. */
|
|
11736
|
+
get milliComputeUnits() {
|
|
11737
|
+
return this._milliComputeUnits;
|
|
11738
|
+
}
|
|
11739
|
+
/** Keep a usage's or an end's milliComputeUnits: each carries the source's total so far. */
|
|
11740
|
+
noteMilliComputeUnits(message) {
|
|
11741
|
+
const value = message["milliComputeUnits"];
|
|
11742
|
+
if (Number.isInteger(value) && value >= 0) {
|
|
11743
|
+
this._milliComputeUnits = value;
|
|
11744
|
+
}
|
|
11745
|
+
}
|
|
11699
11746
|
command(id) {
|
|
11700
11747
|
const command = { type: "setSource", id, ...this.source };
|
|
11701
11748
|
if (this.params.componentParams !== void 0) {
|
|
@@ -12273,7 +12320,11 @@ var PipelineBackend = class {
|
|
|
12273
12320
|
case "prediction":
|
|
12274
12321
|
job.predicted(message["prediction"]);
|
|
12275
12322
|
break;
|
|
12323
|
+
case "usage":
|
|
12324
|
+
job.noteMilliComputeUnits(message);
|
|
12325
|
+
break;
|
|
12276
12326
|
case "end":
|
|
12327
|
+
job.noteMilliComputeUnits(message);
|
|
12277
12328
|
if (message["reason"] === "eos") {
|
|
12278
12329
|
return null;
|
|
12279
12330
|
}
|
|
@@ -12831,12 +12882,18 @@ var VlmAbilityStatus = /* @__PURE__ */ ((VlmAbilityStatus2) => {
|
|
|
12831
12882
|
VlmAbilityStatus2["published"] = "published";
|
|
12832
12883
|
return VlmAbilityStatus2;
|
|
12833
12884
|
})(VlmAbilityStatus || {});
|
|
12885
|
+
var VLM_MODEL_WORKER_RELEASES = Object.freeze({
|
|
12886
|
+
qwen3: "qwen3_instruct",
|
|
12887
|
+
gpt_6_astra: "gpt-6-astra",
|
|
12888
|
+
gemini_4_argon: "gemini-4-argon"
|
|
12889
|
+
});
|
|
12834
12890
|
|
|
12835
12891
|
// data/jobs.ts
|
|
12836
12892
|
var InferAssetJob = class {
|
|
12837
12893
|
constructor(assetUrl, inferRequest, vlmFetch, requestLogger) {
|
|
12838
12894
|
this._response = null;
|
|
12839
12895
|
this._runInfo = null;
|
|
12896
|
+
this._milliComputeUnits = void 0;
|
|
12840
12897
|
this._controller = new AbortController();
|
|
12841
12898
|
this._vlmFetch = vlmFetch;
|
|
12842
12899
|
this._assetUrl = assetUrl;
|
|
@@ -12873,6 +12930,13 @@ var InferAssetJob = class {
|
|
|
12873
12930
|
}
|
|
12874
12931
|
return iterator();
|
|
12875
12932
|
}
|
|
12933
|
+
/**
|
|
12934
|
+
* The milli compute units vlm-server billed for the inference, 0 on a cache hit; undefined before it answered
|
|
12935
|
+
* or when it reported none.
|
|
12936
|
+
*/
|
|
12937
|
+
get milliComputeUnits() {
|
|
12938
|
+
return this._milliComputeUnits;
|
|
12939
|
+
}
|
|
12876
12940
|
start(done) {
|
|
12877
12941
|
this._response = new Promise(async (resolve, reject) => {
|
|
12878
12942
|
try {
|
|
@@ -12897,6 +12961,8 @@ var InferAssetJob = class {
|
|
|
12897
12961
|
const runInfo = response["run_info"];
|
|
12898
12962
|
if (predictions) {
|
|
12899
12963
|
this._runInfo = runInfo;
|
|
12964
|
+
const used = response["milli_compute_units"] ?? response["compute_units"];
|
|
12965
|
+
this._milliComputeUnits = typeof used === "number" ? used : void 0;
|
|
12900
12966
|
resolve(predictions);
|
|
12901
12967
|
break;
|
|
12902
12968
|
} else {
|
|
@@ -13013,6 +13079,151 @@ function omit_nulls(_, value) {
|
|
|
13013
13079
|
}
|
|
13014
13080
|
return value;
|
|
13015
13081
|
}
|
|
13082
|
+
var TASK_EXCLUDED_FIELDS = ["text_prompt", "transform_into", "response_schema"];
|
|
13083
|
+
var VlmAbilityModeErrorReason = /* @__PURE__ */ ((VlmAbilityModeErrorReason2) => {
|
|
13084
|
+
VlmAbilityModeErrorReason2["missing_mode"] = "missing_mode";
|
|
13085
|
+
VlmAbilityModeErrorReason2["unknown_task"] = "unknown_task";
|
|
13086
|
+
VlmAbilityModeErrorReason2["task_excludes_free_form"] = "task_excludes_free_form";
|
|
13087
|
+
VlmAbilityModeErrorReason2["task_without_prompts"] = "task_without_prompts";
|
|
13088
|
+
VlmAbilityModeErrorReason2["prompts_without_task"] = "prompts_without_task";
|
|
13089
|
+
VlmAbilityModeErrorReason2["empty_prompts"] = "empty_prompts";
|
|
13090
|
+
VlmAbilityModeErrorReason2["invalid_prompt"] = "invalid_prompt";
|
|
13091
|
+
return VlmAbilityModeErrorReason2;
|
|
13092
|
+
})(VlmAbilityModeErrorReason || {});
|
|
13093
|
+
var VlmAbilityModeError = class extends Error {
|
|
13094
|
+
constructor(reason, message, fields = []) {
|
|
13095
|
+
super(message);
|
|
13096
|
+
this.name = "VlmAbilityModeError";
|
|
13097
|
+
this.reason = reason;
|
|
13098
|
+
this.fields = fields;
|
|
13099
|
+
}
|
|
13100
|
+
};
|
|
13101
|
+
function isSet(value) {
|
|
13102
|
+
return value !== void 0 && value !== null;
|
|
13103
|
+
}
|
|
13104
|
+
function validateVlmAbilityMode(ability, partial) {
|
|
13105
|
+
const kind = partial ? "VLM ability update" : "VLM ability";
|
|
13106
|
+
const taskSet = isSet(ability.task);
|
|
13107
|
+
const promptsSet = isSet(ability.prompts);
|
|
13108
|
+
if (taskSet && !Object.values(AutoAnnotateTask).includes(ability.task)) {
|
|
13109
|
+
throw new VlmAbilityModeError("unknown_task" /* unknown_task */, `${kind}: unknown task '${String(ability.task)}', expected one of ${Object.values(AutoAnnotateTask).join(", ")}`, [
|
|
13110
|
+
"task"
|
|
13111
|
+
]);
|
|
13112
|
+
}
|
|
13113
|
+
if (taskSet || promptsSet) {
|
|
13114
|
+
const conflicting = TASK_EXCLUDED_FIELDS.filter((field) => isSet(ability[field]));
|
|
13115
|
+
if (conflicting.length > 0) {
|
|
13116
|
+
throw new VlmAbilityModeError(
|
|
13117
|
+
"task_excludes_free_form" /* task_excludes_free_form */,
|
|
13118
|
+
`${kind}: a task derives the prompt and output schema, so ${conflicting.join(", ")} must be unset with task and prompts`,
|
|
13119
|
+
[...conflicting]
|
|
13120
|
+
);
|
|
13121
|
+
}
|
|
13122
|
+
}
|
|
13123
|
+
if (promptsSet) {
|
|
13124
|
+
if (!Array.isArray(ability.prompts) || ability.prompts.length === 0) {
|
|
13125
|
+
throw new VlmAbilityModeError("empty_prompts" /* empty_prompts */, `${kind}: prompts must be a non-empty list of {label, prompt}`, ["prompts"]);
|
|
13126
|
+
}
|
|
13127
|
+
ability.prompts.forEach((entry, i) => {
|
|
13128
|
+
if (!entry || typeof entry.label !== "string" || entry.label.length === 0 || typeof entry.prompt !== "string" || entry.prompt.length === 0) {
|
|
13129
|
+
throw new VlmAbilityModeError("invalid_prompt" /* invalid_prompt */, `${kind}: prompts[${i}] needs a non-empty label and prompt`, [`prompts[${i}]`]);
|
|
13130
|
+
}
|
|
13131
|
+
});
|
|
13132
|
+
}
|
|
13133
|
+
if (partial) {
|
|
13134
|
+
return;
|
|
13135
|
+
}
|
|
13136
|
+
if (taskSet && !promptsSet) {
|
|
13137
|
+
throw new VlmAbilityModeError("task_without_prompts" /* task_without_prompts */, `${kind}: task '${ability.task}' requires a non-empty prompts list of {label, prompt}`, ["prompts"]);
|
|
13138
|
+
}
|
|
13139
|
+
if (!taskSet && promptsSet) {
|
|
13140
|
+
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"]);
|
|
13141
|
+
}
|
|
13142
|
+
if (!taskSet && !(typeof ability.text_prompt === "string" && ability.text_prompt.length > 0)) {
|
|
13143
|
+
throw new VlmAbilityModeError("missing_mode" /* missing_mode */, `${kind}: set either text_prompt (free-form) or task with non-empty prompts`, ["text_prompt", "task"]);
|
|
13144
|
+
}
|
|
13145
|
+
}
|
|
13146
|
+
var VlmAbilityModelErrorReason = /* @__PURE__ */ ((VlmAbilityModelErrorReason2) => {
|
|
13147
|
+
VlmAbilityModelErrorReason2["unknown_model"] = "unknown_model";
|
|
13148
|
+
VlmAbilityModelErrorReason2["unknown_worker_release"] = "unknown_worker_release";
|
|
13149
|
+
VlmAbilityModelErrorReason2["model_conflict"] = "model_conflict";
|
|
13150
|
+
return VlmAbilityModelErrorReason2;
|
|
13151
|
+
})(VlmAbilityModelErrorReason || {});
|
|
13152
|
+
var VlmAbilityModelError = class extends Error {
|
|
13153
|
+
constructor(reason, message, fields = []) {
|
|
13154
|
+
super(message);
|
|
13155
|
+
this.name = "VlmAbilityModelError";
|
|
13156
|
+
this.reason = reason;
|
|
13157
|
+
this.fields = fields;
|
|
13158
|
+
}
|
|
13159
|
+
};
|
|
13160
|
+
var VLM_MODELS = Object.keys(VLM_MODEL_WORKER_RELEASES);
|
|
13161
|
+
var DEFAULT_VLM_MODEL = "qwen3";
|
|
13162
|
+
function isVlmModel(value) {
|
|
13163
|
+
return typeof value === "string" && Object.prototype.hasOwnProperty.call(VLM_MODEL_WORKER_RELEASES, value);
|
|
13164
|
+
}
|
|
13165
|
+
function normalizeWorkerRelease(workerRelease) {
|
|
13166
|
+
return workerRelease.toLowerCase().replace(/_/g, "-");
|
|
13167
|
+
}
|
|
13168
|
+
function modelForWorkerRelease(workerRelease) {
|
|
13169
|
+
if (workerRelease === void 0 || workerRelease === null) {
|
|
13170
|
+
return DEFAULT_VLM_MODEL;
|
|
13171
|
+
}
|
|
13172
|
+
const normalized = normalizeWorkerRelease(workerRelease);
|
|
13173
|
+
return VLM_MODELS.find((model) => normalizeWorkerRelease(VLM_MODEL_WORKER_RELEASES[model]) === normalized) ?? null;
|
|
13174
|
+
}
|
|
13175
|
+
function checkModelAndWorkerRelease(model, workerRelease, prefix) {
|
|
13176
|
+
const modelSet = isSet(model);
|
|
13177
|
+
if (modelSet && !isVlmModel(model)) {
|
|
13178
|
+
throw new VlmAbilityModelError("unknown_model" /* unknown_model */, `${prefix}unknown model '${String(model)}'; set \`model\` to one of ${VLM_MODELS.join(", ")}`, ["model"]);
|
|
13179
|
+
}
|
|
13180
|
+
if (!isSet(workerRelease)) {
|
|
13181
|
+
return modelSet ? model : null;
|
|
13182
|
+
}
|
|
13183
|
+
const releaseModel = typeof workerRelease === "string" ? modelForWorkerRelease(workerRelease) : null;
|
|
13184
|
+
if (releaseModel === null) {
|
|
13185
|
+
throw new VlmAbilityModelError(
|
|
13186
|
+
"unknown_worker_release" /* unknown_worker_release */,
|
|
13187
|
+
`${prefix}unknown worker_release '${String(workerRelease)}'; worker_release is deprecated, set \`model\` to one of ${VLM_MODELS.join(", ")}`,
|
|
13188
|
+
["worker_release"]
|
|
13189
|
+
);
|
|
13190
|
+
}
|
|
13191
|
+
if (modelSet && releaseModel !== model) {
|
|
13192
|
+
throw new VlmAbilityModelError(
|
|
13193
|
+
"model_conflict" /* model_conflict */,
|
|
13194
|
+
`${prefix}worker_release '${String(workerRelease)}' runs model ${releaseModel}, not ${String(model)}; worker_release is deprecated, set only \`model\``,
|
|
13195
|
+
["model", "worker_release"]
|
|
13196
|
+
);
|
|
13197
|
+
}
|
|
13198
|
+
return releaseModel;
|
|
13199
|
+
}
|
|
13200
|
+
function resolveWorkerRelease(model, workerRelease) {
|
|
13201
|
+
return VLM_MODEL_WORKER_RELEASES[checkModelAndWorkerRelease(model, workerRelease, "") ?? DEFAULT_VLM_MODEL];
|
|
13202
|
+
}
|
|
13203
|
+
function withVlmModel(ability) {
|
|
13204
|
+
if (!ability || typeof ability !== "object") {
|
|
13205
|
+
return ability;
|
|
13206
|
+
}
|
|
13207
|
+
if (!("model" in ability)) {
|
|
13208
|
+
return { ...ability, model: modelForWorkerRelease(ability.worker_release) };
|
|
13209
|
+
}
|
|
13210
|
+
if (isSet(ability.model) && !isVlmModel(ability.model)) {
|
|
13211
|
+
return { ...ability, model: null };
|
|
13212
|
+
}
|
|
13213
|
+
return ability;
|
|
13214
|
+
}
|
|
13215
|
+
var warnedWorkerRelease = false;
|
|
13216
|
+
function prepareVlmAbilityModel(ability, partial) {
|
|
13217
|
+
if (isSet(ability.worker_release) && !warnedWorkerRelease) {
|
|
13218
|
+
warnedWorkerRelease = true;
|
|
13219
|
+
console.warn("worker_release is deprecated, set model to a VlmModel instead");
|
|
13220
|
+
}
|
|
13221
|
+
checkModelAndWorkerRelease(ability.model, ability.worker_release, partial ? "VLM ability update: " : "VLM ability: ");
|
|
13222
|
+
if (isSet(ability.model) && !isSet(ability.worker_release)) {
|
|
13223
|
+
return { ...ability, worker_release: VLM_MODEL_WORKER_RELEASES[ability.model] };
|
|
13224
|
+
}
|
|
13225
|
+
return ability;
|
|
13226
|
+
}
|
|
13016
13227
|
var DataEndpoint = class extends Endpoint {
|
|
13017
13228
|
constructor(options) {
|
|
13018
13229
|
super(options);
|
|
@@ -13801,20 +14012,22 @@ var DataEndpoint = class extends Endpoint {
|
|
|
13801
14012
|
async listVlmAbilities() {
|
|
13802
14013
|
return this.request(`/vlm_abilities?account_uuid=${this._accountId}`, {
|
|
13803
14014
|
method: "GET"
|
|
13804
|
-
});
|
|
14015
|
+
}).then((abilities) => Array.isArray(abilities) ? abilities.map(withVlmModel) : abilities);
|
|
13805
14016
|
}
|
|
13806
14017
|
async createVlmAbility(create, vlm_ability_group_uuid) {
|
|
14018
|
+
validateVlmAbilityMode(create, false);
|
|
14019
|
+
const body = prepareVlmAbilityModel(create, false);
|
|
13807
14020
|
const groupQuery = vlm_ability_group_uuid ? `&vlm_ability_group_uuid=${vlm_ability_group_uuid}` : "";
|
|
13808
14021
|
return this.request(`/vlm_abilities?account_uuid=${this._accountId}${groupQuery}`, {
|
|
13809
14022
|
method: "POST",
|
|
13810
|
-
body: JSON.stringify(
|
|
14023
|
+
body: JSON.stringify(body, omit_nulls),
|
|
13811
14024
|
headers: { "Content-Type": "application/json" }
|
|
13812
|
-
});
|
|
14025
|
+
}).then(withVlmModel);
|
|
13813
14026
|
}
|
|
13814
14027
|
async getVlmAbility(vlm_ability_uuid) {
|
|
13815
14028
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}`, {
|
|
13816
14029
|
method: "GET"
|
|
13817
|
-
});
|
|
14030
|
+
}).then(withVlmModel);
|
|
13818
14031
|
}
|
|
13819
14032
|
async deleteVlmAbility(vlm_ability_uuid) {
|
|
13820
14033
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}`, {
|
|
@@ -13822,11 +14035,13 @@ var DataEndpoint = class extends Endpoint {
|
|
|
13822
14035
|
});
|
|
13823
14036
|
}
|
|
13824
14037
|
async updateVlmAbility(vlm_ability_uuid, update) {
|
|
14038
|
+
validateVlmAbilityMode(update, true);
|
|
14039
|
+
const body = prepareVlmAbilityModel(update, true);
|
|
13825
14040
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}`, {
|
|
13826
14041
|
method: "PATCH",
|
|
13827
|
-
body: JSON.stringify(
|
|
14042
|
+
body: JSON.stringify(body),
|
|
13828
14043
|
headers: { "Content-Type": "application/json" }
|
|
13829
|
-
});
|
|
14044
|
+
}).then(withVlmModel);
|
|
13830
14045
|
}
|
|
13831
14046
|
async refineVlmAbility(vlm_ability_uuid, auto_prompt, auto_task) {
|
|
13832
14047
|
if (auto_prompt !== void 0) {
|
|
@@ -13834,13 +14049,13 @@ var DataEndpoint = class extends Endpoint {
|
|
|
13834
14049
|
method: "POST",
|
|
13835
14050
|
body: JSON.stringify(auto_prompt, omit_nulls),
|
|
13836
14051
|
headers: { "Content-Type": "application/json" }
|
|
13837
|
-
});
|
|
14052
|
+
}).then(withVlmModel);
|
|
13838
14053
|
} else if (auto_task !== void 0) {
|
|
13839
14054
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}/refine_task`, {
|
|
13840
14055
|
method: "POST",
|
|
13841
14056
|
body: JSON.stringify(auto_task, omit_nulls),
|
|
13842
14057
|
headers: { "Content-Type": "application/json" }
|
|
13843
|
-
});
|
|
14058
|
+
}).then(withVlmModel);
|
|
13844
14059
|
} else {
|
|
13845
14060
|
return Promise.reject("refine vlm ability requires auto_prompt or auto_config parameter");
|
|
13846
14061
|
}
|
|
@@ -13860,24 +14075,24 @@ var DataEndpoint = class extends Endpoint {
|
|
|
13860
14075
|
}
|
|
13861
14076
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}/clone?${params.toString()}`, {
|
|
13862
14077
|
method: "POST"
|
|
13863
|
-
});
|
|
14078
|
+
}).then(withVlmModel);
|
|
13864
14079
|
}
|
|
13865
14080
|
async publishVlmAbility(vlm_ability_uuid, alias_name, tag_name) {
|
|
13866
14081
|
const alias_name_query = alias_name ? `alias_name=${encodeURIComponent(alias_name)}&` : "";
|
|
13867
14082
|
const tag_name_query = tag_name ? `tag_name=${encodeURIComponent(tag_name)}&` : "";
|
|
13868
14083
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}/publish?${alias_name_query}${tag_name_query}`, {
|
|
13869
14084
|
method: "POST"
|
|
13870
|
-
});
|
|
14085
|
+
}).then(withVlmModel);
|
|
13871
14086
|
}
|
|
13872
14087
|
async addVlmAbilityAlias(vlm_ability_uuid, alias_name, tag_name) {
|
|
13873
14088
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}/alias/${encodeURIComponent(alias_name)}/tag/${tag_name ? encodeURIComponent(tag_name) : ""}`, {
|
|
13874
14089
|
method: "POST"
|
|
13875
|
-
});
|
|
14090
|
+
}).then(withVlmModel);
|
|
13876
14091
|
}
|
|
13877
14092
|
async removeVlmAbilityAlias(vlm_ability_uuid, alias_name, tag_name) {
|
|
13878
14093
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}/alias/${encodeURIComponent(alias_name)}/tag/${encodeURIComponent(tag_name)}`, {
|
|
13879
14094
|
method: "DELETE"
|
|
13880
|
-
});
|
|
14095
|
+
}).then(withVlmModel);
|
|
13881
14096
|
}
|
|
13882
14097
|
async listVlmAbilityEvaluations(vlm_ability_uuid) {
|
|
13883
14098
|
return this.request(`/vlm_abilities/${vlm_ability_uuid}/evaluations`, {
|
|
@@ -14420,17 +14635,17 @@ var EyePop;
|
|
|
14420
14635
|
if (typeof auth.oAuth2 === "boolean") {
|
|
14421
14636
|
const oAuth2 = opts.eyepopUrl && opts.eyepopUrl.match(/https:(.*).staging.eyepop.xyz/i) ? {
|
|
14422
14637
|
oAuth2: {
|
|
14423
|
-
domain: "
|
|
14638
|
+
domain: "auth0.eyepop.xyz",
|
|
14424
14639
|
clientId: "jktx3YO2UnbkNPvr05PQWf26t1kNTJyg",
|
|
14425
14640
|
audience: "https://dev-app.eyepop.ai",
|
|
14426
|
-
scope: "
|
|
14641
|
+
scope: "access:inference-api access:datasets"
|
|
14427
14642
|
}
|
|
14428
14643
|
} : {
|
|
14429
14644
|
oAuth2: {
|
|
14430
|
-
domain: "eyepop.
|
|
14645
|
+
domain: "auth0.eyepop.ai",
|
|
14431
14646
|
clientId: "Lb9ubA9Hf3jlaqWLUx8XgA0zvotgViCl",
|
|
14432
14647
|
audience: "https://api.eyepop.ai",
|
|
14433
|
-
scope: "
|
|
14648
|
+
scope: "access:inference-api access:datasets"
|
|
14434
14649
|
}
|
|
14435
14650
|
};
|
|
14436
14651
|
if (opts.oAuth2 !== void 0) {
|
|
@@ -14464,6 +14679,7 @@ export {
|
|
|
14464
14679
|
ComputeApiError,
|
|
14465
14680
|
ContourType,
|
|
14466
14681
|
DEFAULT_PREDICTION_VERSION,
|
|
14682
|
+
DEFAULT_VLM_MODEL,
|
|
14467
14683
|
DataApiType,
|
|
14468
14684
|
DataEndpoint,
|
|
14469
14685
|
DepthMap,
|
|
@@ -14513,7 +14729,12 @@ export {
|
|
|
14513
14729
|
UploadGroupJob,
|
|
14514
14730
|
UploadJob,
|
|
14515
14731
|
UserReview,
|
|
14732
|
+
VLM_MODEL_WORKER_RELEASES,
|
|
14516
14733
|
VideoMode,
|
|
14734
|
+
VlmAbilityModeError,
|
|
14735
|
+
VlmAbilityModeErrorReason,
|
|
14736
|
+
VlmAbilityModelError,
|
|
14737
|
+
VlmAbilityModelErrorReason,
|
|
14517
14738
|
VlmAbilityStatus,
|
|
14518
14739
|
WebrtcBase,
|
|
14519
14740
|
WebrtcWhep,
|
|
@@ -14531,10 +14752,13 @@ export {
|
|
|
14531
14752
|
encodeMultipartFormData,
|
|
14532
14753
|
getBaseUrl,
|
|
14533
14754
|
isSelectOperator,
|
|
14755
|
+
modelForWorkerRelease,
|
|
14756
|
+
normalizeWorkerRelease,
|
|
14534
14757
|
popSelects,
|
|
14535
14758
|
randomMultipartBoundary,
|
|
14536
14759
|
readableStreamFromString,
|
|
14537
14760
|
resolveAuth,
|
|
14761
|
+
resolveWorkerRelease,
|
|
14538
14762
|
validateCamera,
|
|
14539
14763
|
validatePop
|
|
14540
14764
|
};
|