@eyepop.ai/eyepop 3.8.1 → 3.10.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/README.md +21 -13
- package/dist/eyepop.index.d.mts +116 -12
- package/dist/eyepop.index.d.ts +116 -12
- package/dist/eyepop.index.js +289 -73
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +287 -73
- 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
|
@@ -8691,12 +8691,14 @@ __export(index_exports, {
|
|
|
8691
8691
|
PopComponentType: () => PopComponentType,
|
|
8692
8692
|
PredictionVersion: () => PredictionVersion,
|
|
8693
8693
|
Semaphore: () => Semaphore,
|
|
8694
|
+
SessionStatus: () => SessionStatus,
|
|
8694
8695
|
Stream: () => Stream,
|
|
8695
8696
|
TranscodeMode: () => TranscodeMode,
|
|
8696
8697
|
TransientPopId: () => TransientPopId,
|
|
8697
8698
|
UploadJob: () => UploadJob,
|
|
8698
8699
|
UserReview: () => UserReview,
|
|
8699
8700
|
VideoMode: () => VideoMode,
|
|
8701
|
+
VlmAbilityStatus: () => VlmAbilityStatus,
|
|
8700
8702
|
WebrtcBase: () => WebrtcBase,
|
|
8701
8703
|
WebrtcWhep: () => WebrtcWhep,
|
|
8702
8704
|
WebrtcWhip: () => WebrtcWhip,
|
|
@@ -9092,9 +9094,9 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9092
9094
|
const sections = answer.split("m=");
|
|
9093
9095
|
for (let i = 0; i < sections.length; i++) {
|
|
9094
9096
|
const section = sections[i];
|
|
9095
|
-
if (section.startsWith("video")) {
|
|
9097
|
+
if (section && section.startsWith("video")) {
|
|
9096
9098
|
sections[i] = WebrtcWhip.setVideoBitrate(WebrtcWhip.setCodec(section, videoCodec), videoBitrate);
|
|
9097
|
-
} else if (section.startsWith("audio")) {
|
|
9099
|
+
} else if (section && section.startsWith("audio")) {
|
|
9098
9100
|
sections[i] = WebrtcWhip.setAudioBitrate(WebrtcWhip.setCodec(section, audioCodec), audioBitrate, audioVoice);
|
|
9099
9101
|
}
|
|
9100
9102
|
}
|
|
@@ -9133,7 +9135,11 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9133
9135
|
static setVideoBitrate(section, bitrate) {
|
|
9134
9136
|
let lines = section.split("\r\n");
|
|
9135
9137
|
for (let i = 0; i < lines.length; i++) {
|
|
9136
|
-
|
|
9138
|
+
const line = lines[i];
|
|
9139
|
+
if (!line) {
|
|
9140
|
+
continue;
|
|
9141
|
+
}
|
|
9142
|
+
if (line.startsWith("c=")) {
|
|
9137
9143
|
lines = [...lines.slice(0, i + 1), "b=TIAS:" + (bitrate * 1024).toString(), ...lines.slice(i + 1)];
|
|
9138
9144
|
break;
|
|
9139
9145
|
}
|
|
@@ -9144,8 +9150,12 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9144
9150
|
let opusPayloadFormat = "";
|
|
9145
9151
|
let lines = section.split("\r\n");
|
|
9146
9152
|
for (let i = 0; i < lines.length; i++) {
|
|
9147
|
-
|
|
9148
|
-
|
|
9153
|
+
const line = lines[i];
|
|
9154
|
+
if (!line) {
|
|
9155
|
+
continue;
|
|
9156
|
+
}
|
|
9157
|
+
if (line.startsWith("a=rtpmap:") && line.toLowerCase().includes("opus/")) {
|
|
9158
|
+
opusPayloadFormat = line.slice("a=rtpmap:".length).split(" ")[0] || "";
|
|
9149
9159
|
break;
|
|
9150
9160
|
}
|
|
9151
9161
|
}
|
|
@@ -9153,7 +9163,11 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9153
9163
|
return section;
|
|
9154
9164
|
}
|
|
9155
9165
|
for (let i = 0; i < lines.length; i++) {
|
|
9156
|
-
|
|
9166
|
+
const line = lines[i];
|
|
9167
|
+
if (!line) {
|
|
9168
|
+
continue;
|
|
9169
|
+
}
|
|
9170
|
+
if (line.startsWith("a=fmtp:" + opusPayloadFormat + " ")) {
|
|
9157
9171
|
if (voice) {
|
|
9158
9172
|
lines[i] = "a=fmtp:" + opusPayloadFormat + " minptime=10;useinbandfec=1;maxaveragebitrate=" + ((bitrate ?? 0) * 1024).toString();
|
|
9159
9173
|
} else {
|
|
@@ -9657,7 +9671,7 @@ var LoadMediaStreamJob = class extends AbstractJob {
|
|
|
9657
9671
|
true,
|
|
9658
9672
|
this._requestLogger
|
|
9659
9673
|
);
|
|
9660
|
-
whip.start().then((
|
|
9674
|
+
whip.start().then((_) => {
|
|
9661
9675
|
this._requestLogger.debug("direct whip for ingressId=%s successful", whip.ingressId());
|
|
9662
9676
|
}).catch((reason) => {
|
|
9663
9677
|
this._controller.abort(reason);
|
|
@@ -9688,7 +9702,7 @@ var LoadMediaStreamJob = class extends AbstractJob {
|
|
|
9688
9702
|
// shims/local_file.ts
|
|
9689
9703
|
var resolvePath;
|
|
9690
9704
|
if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
9691
|
-
resolvePath = async (
|
|
9705
|
+
resolvePath = async (_source, _logger) => {
|
|
9692
9706
|
throw new DOMException("resolving a path to a file is not supported in browser");
|
|
9693
9707
|
};
|
|
9694
9708
|
} else {
|
|
@@ -9710,7 +9724,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9710
9724
|
yield chunk;
|
|
9711
9725
|
}
|
|
9712
9726
|
}
|
|
9713
|
-
resolvePath = async (source,
|
|
9727
|
+
resolvePath = async (source, _) => {
|
|
9714
9728
|
const mime = require_mime_types();
|
|
9715
9729
|
const filehandle = require("fs/promises");
|
|
9716
9730
|
const fd = await filehandle.open(source.path, "r");
|
|
@@ -9839,7 +9853,7 @@ var Semaphore = class {
|
|
|
9839
9853
|
this.permits -= 1;
|
|
9840
9854
|
return Promise.resolve(true);
|
|
9841
9855
|
}
|
|
9842
|
-
let resolver = (
|
|
9856
|
+
let resolver = (_) => void 0;
|
|
9843
9857
|
const promise = new Promise((r) => {
|
|
9844
9858
|
resolver = r;
|
|
9845
9859
|
});
|
|
@@ -9969,7 +9983,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9969
9983
|
return session;
|
|
9970
9984
|
};
|
|
9971
9985
|
} else {
|
|
9972
|
-
authenticateBrowserSession = (
|
|
9986
|
+
authenticateBrowserSession = (_auth0, _options) => {
|
|
9973
9987
|
return Promise.reject("auth0 login not supported server-side");
|
|
9974
9988
|
};
|
|
9975
9989
|
}
|
|
@@ -10003,6 +10017,14 @@ var Endpoint = class {
|
|
|
10003
10017
|
eyepopUrl() {
|
|
10004
10018
|
if (this._options.eyepopUrl) {
|
|
10005
10019
|
return this._options.eyepopUrl.replace(/\/+$/, "");
|
|
10020
|
+
} else {
|
|
10021
|
+
return "https://compute.eyepop.ai";
|
|
10022
|
+
}
|
|
10023
|
+
}
|
|
10024
|
+
// TODO: deprecated Web API endpoint needed for POP_ID support
|
|
10025
|
+
eyepopWebApiUrl() {
|
|
10026
|
+
if (this._options.eyepopUrl) {
|
|
10027
|
+
return this._options.eyepopUrl.replace(/\/+$/, "").replace(/compute\./, "web-api.");
|
|
10006
10028
|
} else {
|
|
10007
10029
|
return "https://api.eyepop.ai";
|
|
10008
10030
|
}
|
|
@@ -10050,10 +10072,10 @@ var Endpoint = class {
|
|
|
10050
10072
|
this._token = this._options.auth.session.accessToken;
|
|
10051
10073
|
this._expire_token_time = this._options.auth.session.validUntil / 1e3;
|
|
10052
10074
|
} else if (this._options.auth.oAuth2 !== void 0) {
|
|
10053
|
-
} else if (this._options.auth.
|
|
10075
|
+
} else if (this._options.auth.apiKey !== void 0) {
|
|
10054
10076
|
} else if (this._options.auth.isLocal !== void 0) {
|
|
10055
10077
|
} else {
|
|
10056
|
-
return Promise.reject("option
|
|
10078
|
+
return Promise.reject("option apiKey or environment variable EYEPOP_API_KEY is required");
|
|
10057
10079
|
}
|
|
10058
10080
|
if (this._options.platformSupport?.createHttpClient !== void 0) {
|
|
10059
10081
|
this._client = await this._options.platformSupport.createHttpClient(this._requestLogger);
|
|
@@ -10085,7 +10107,7 @@ var Endpoint = class {
|
|
|
10085
10107
|
validUntil: this._expire_token_time * 1e3
|
|
10086
10108
|
};
|
|
10087
10109
|
}
|
|
10088
|
-
statusHandler401(
|
|
10110
|
+
statusHandler401(_statusCode) {
|
|
10089
10111
|
this._token = null;
|
|
10090
10112
|
this._expire_token_time = null;
|
|
10091
10113
|
}
|
|
@@ -10148,15 +10170,12 @@ var Endpoint = class {
|
|
|
10148
10170
|
const session = await authenticateBrowserSession(this._options.auth.oAuth2, this._options);
|
|
10149
10171
|
this._token = session.accessToken;
|
|
10150
10172
|
this._expire_token_time = session.validUntil / 1e3;
|
|
10151
|
-
} else if (this._options.auth.
|
|
10152
|
-
const
|
|
10153
|
-
const
|
|
10154
|
-
const headers = { "Content-Type": "application/json" };
|
|
10155
|
-
const post_url = `${this.eyepopUrl()}/authentication/token`;
|
|
10173
|
+
} else if (this._options.auth.apiKey !== void 0 && this._options.eyepopUrl) {
|
|
10174
|
+
const headers = { "Authorization": `Bearer ${this._options.auth.apiKey}` };
|
|
10175
|
+
const post_url = `${this.eyepopUrl()}/v1/auth/authenticate`;
|
|
10156
10176
|
const response = await this._client.fetch(post_url, {
|
|
10157
10177
|
method: "POST",
|
|
10158
|
-
headers
|
|
10159
|
-
body: JSON.stringify(body)
|
|
10178
|
+
headers
|
|
10160
10179
|
});
|
|
10161
10180
|
if (response.status != 200) {
|
|
10162
10181
|
const message = await response.text();
|
|
@@ -10185,7 +10204,21 @@ var TransientPopId = /* @__PURE__ */ ((TransientPopId2) => {
|
|
|
10185
10204
|
})(TransientPopId || {});
|
|
10186
10205
|
|
|
10187
10206
|
// worker/worker_endpoint.ts
|
|
10188
|
-
var
|
|
10207
|
+
var SessionStatus = /* @__PURE__ */ ((SessionStatus2) => {
|
|
10208
|
+
SessionStatus2["UNKNOWN"] = "unknown";
|
|
10209
|
+
SessionStatus2["PENDING"] = "pending";
|
|
10210
|
+
SessionStatus2["RUNNING"] = "running";
|
|
10211
|
+
SessionStatus2["STOPPED"] = "stopped";
|
|
10212
|
+
SessionStatus2["FAILED"] = "failed";
|
|
10213
|
+
SessionStatus2["ERROR"] = "error";
|
|
10214
|
+
SessionStatus2["PIPELINE_CREATING"] = "pipeline_creating";
|
|
10215
|
+
SessionStatus2["PIPELINE_OK"] = "pipeline_ok";
|
|
10216
|
+
SessionStatus2["PIPELINE_CHECKING"] = "pipeline_checking";
|
|
10217
|
+
SessionStatus2["PIPELINE_ERROR"] = "pipeline_error";
|
|
10218
|
+
return SessionStatus2;
|
|
10219
|
+
})(SessionStatus || {});
|
|
10220
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
10221
|
+
var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
10189
10222
|
constructor(options) {
|
|
10190
10223
|
super(options);
|
|
10191
10224
|
this.setStatusRetryHandlers(/* @__PURE__ */ new Map([[404, (statusCode) => this.statusHandler404(statusCode)]]));
|
|
@@ -10214,7 +10247,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10214
10247
|
}
|
|
10215
10248
|
return super.disconnect(wait);
|
|
10216
10249
|
}
|
|
10217
|
-
statusHandler404(
|
|
10250
|
+
statusHandler404(_) {
|
|
10218
10251
|
this._pipelineId = null;
|
|
10219
10252
|
this._baseUrl = null;
|
|
10220
10253
|
}
|
|
@@ -10267,10 +10300,17 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10267
10300
|
});
|
|
10268
10301
|
if (response.status != 204) {
|
|
10269
10302
|
const message = await response.text();
|
|
10270
|
-
|
|
10303
|
+
throw new Error(`Unexpected status ${response.status}: ${message}`);
|
|
10271
10304
|
}
|
|
10272
10305
|
if (this._pipeline) {
|
|
10273
10306
|
this._pipeline.pop = pop;
|
|
10307
|
+
} else {
|
|
10308
|
+
this._pipeline = {
|
|
10309
|
+
id: this._pipelineId || "unknown",
|
|
10310
|
+
state: "idle",
|
|
10311
|
+
startTime: (/* @__PURE__ */ new Date()).toString(),
|
|
10312
|
+
pop
|
|
10313
|
+
};
|
|
10274
10314
|
}
|
|
10275
10315
|
}
|
|
10276
10316
|
_authenticationHeaders(session) {
|
|
@@ -10490,11 +10530,11 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10490
10530
|
throw e;
|
|
10491
10531
|
}
|
|
10492
10532
|
}
|
|
10493
|
-
jobDone(
|
|
10533
|
+
jobDone(_) {
|
|
10494
10534
|
this._limit?.release();
|
|
10495
10535
|
this.updateState();
|
|
10496
10536
|
}
|
|
10497
|
-
jobStatus(
|
|
10537
|
+
jobStatus(_, statusCode) {
|
|
10498
10538
|
if (statusCode == 404) {
|
|
10499
10539
|
this.statusHandler404(statusCode);
|
|
10500
10540
|
} else if (statusCode == 401) {
|
|
@@ -10502,15 +10542,20 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10502
10542
|
}
|
|
10503
10543
|
}
|
|
10504
10544
|
async reconnect() {
|
|
10505
|
-
if (!this._client) {
|
|
10506
|
-
return Promise.reject("endpoint not initialized");
|
|
10507
|
-
}
|
|
10508
|
-
let config_url;
|
|
10509
10545
|
if (this.options().popId == "transient" /* Transient */) {
|
|
10510
|
-
|
|
10546
|
+
await this.startComputeSession();
|
|
10547
|
+
this._pipelineId = await this.startTransientPipeline();
|
|
10511
10548
|
} else {
|
|
10512
|
-
|
|
10549
|
+
await this.startWebApiSessionWithPopId();
|
|
10550
|
+
}
|
|
10551
|
+
this.updateState();
|
|
10552
|
+
return Promise.resolve(this);
|
|
10553
|
+
}
|
|
10554
|
+
async startWebApiSessionWithPopId() {
|
|
10555
|
+
if (!this._client) {
|
|
10556
|
+
throw new Error("endpoint not initialized");
|
|
10513
10557
|
}
|
|
10558
|
+
const config_url = `${this.eyepopWebApiUrl()}/pops/${this.options().popId}/config?auto_start=false`;
|
|
10514
10559
|
const headers = {
|
|
10515
10560
|
Authorization: await this.authorizationHeader()
|
|
10516
10561
|
};
|
|
@@ -10534,11 +10579,11 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10534
10579
|
} else {
|
|
10535
10580
|
this.updateState("Error" /* Error */, message);
|
|
10536
10581
|
}
|
|
10537
|
-
|
|
10582
|
+
throw new Error(`Unexpected status ${response.status}: ${message}`);
|
|
10538
10583
|
}
|
|
10539
10584
|
let config = await response.json();
|
|
10540
10585
|
if (!config.base_url && this.options().autoStart) {
|
|
10541
|
-
const auto_start_config_url = `${this.
|
|
10586
|
+
const auto_start_config_url = `${this.eyepopWebApiUrl()}/pops/${this.options().popId}/config?auto_start=true`;
|
|
10542
10587
|
this._requestLogger.debug("pop was not running, trying to autostart with: %s", auto_start_config_url);
|
|
10543
10588
|
const headers2 = {
|
|
10544
10589
|
Authorization: await this.authorizationHeader()
|
|
@@ -10549,7 +10594,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10549
10594
|
if (response.status != 200) {
|
|
10550
10595
|
this.updateState("Error" /* Error */);
|
|
10551
10596
|
const message = await response.text();
|
|
10552
|
-
|
|
10597
|
+
throw new Error(`Unexpected status ${response.status}: ${message}`);
|
|
10553
10598
|
}
|
|
10554
10599
|
config = await response.json();
|
|
10555
10600
|
}
|
|
@@ -10557,17 +10602,11 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10557
10602
|
this._baseUrl = baseUrl.toString();
|
|
10558
10603
|
if (this._baseUrl) {
|
|
10559
10604
|
this._baseUrl = this._baseUrl.replace(/\/+$/, "");
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
this._popName = this.options().popId || null;
|
|
10563
|
-
} else {
|
|
10564
|
-
this._pipelineId = config.pipeline_id;
|
|
10565
|
-
this._popName = config.name;
|
|
10566
|
-
}
|
|
10605
|
+
this._pipelineId = config.pipeline_id;
|
|
10606
|
+
this._popName = config.name;
|
|
10567
10607
|
if (!this._pipelineId || !this._baseUrl) {
|
|
10568
|
-
|
|
10608
|
+
throw new Error("Pop not started");
|
|
10569
10609
|
}
|
|
10570
|
-
this._baseUrl = this._baseUrl.replace(/\/+$/, "");
|
|
10571
10610
|
const get_url = `${this._baseUrl}/pipelines/${this._pipelineId}`;
|
|
10572
10611
|
const headers2 = {
|
|
10573
10612
|
Authorization: await this.authorizationHeader()
|
|
@@ -10578,7 +10617,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10578
10617
|
});
|
|
10579
10618
|
if (response2.status > 200) {
|
|
10580
10619
|
const message = await response2.text();
|
|
10581
|
-
|
|
10620
|
+
throw new Error(`Unexpected status ${response2.status}: ${message}`);
|
|
10582
10621
|
}
|
|
10583
10622
|
this._pipeline = await response2.json();
|
|
10584
10623
|
if (this.options().stopJobs) {
|
|
@@ -10595,18 +10634,95 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10595
10634
|
});
|
|
10596
10635
|
if (response3.status >= 300) {
|
|
10597
10636
|
const message = await response3.text();
|
|
10598
|
-
|
|
10637
|
+
throw new Error(`Unexpected status ${response3.status}: ${message}`);
|
|
10599
10638
|
}
|
|
10600
10639
|
}
|
|
10601
10640
|
}
|
|
10602
|
-
|
|
10603
|
-
|
|
10641
|
+
}
|
|
10642
|
+
async startComputeSession() {
|
|
10643
|
+
if (!this._client) {
|
|
10644
|
+
throw new Error("endpoint not initialized");
|
|
10645
|
+
}
|
|
10646
|
+
let session = null;
|
|
10647
|
+
const sessionsUrl = `${this.eyepopUrl()}/v1/sessions`;
|
|
10648
|
+
this._requestLogger.debug("fetching sessions from: %s", sessionsUrl);
|
|
10649
|
+
const headers = {
|
|
10650
|
+
Authorization: await this.authorizationHeader()
|
|
10651
|
+
};
|
|
10652
|
+
let response = await this._client.fetch(sessionsUrl, {
|
|
10653
|
+
headers
|
|
10654
|
+
});
|
|
10655
|
+
let sessions;
|
|
10656
|
+
if (response.status == 404) {
|
|
10657
|
+
sessions = [];
|
|
10658
|
+
} else if (response.status != 200) {
|
|
10659
|
+
this.updateState("Error" /* Error */);
|
|
10660
|
+
const message = await response.text();
|
|
10661
|
+
throw new Error(`Unexpected status ${response.status} fetching compute sessions: ${message}`);
|
|
10662
|
+
} else {
|
|
10663
|
+
const response_content = await response.json();
|
|
10664
|
+
sessions = response_content;
|
|
10665
|
+
}
|
|
10666
|
+
if (sessions.length > 0) {
|
|
10667
|
+
this._logger.debug(`User has ${sessions.length} sessions, inspecting for active session`);
|
|
10668
|
+
for (let s of sessions) {
|
|
10669
|
+
if (!_WorkerEndpoint.SESSION_DEAD.has(s.session_status)) {
|
|
10670
|
+
session = s;
|
|
10671
|
+
this._logger.debug(`Use active session ${s.session_uuid} with pipeline ${s.pipeline_uuid}`);
|
|
10672
|
+
break;
|
|
10673
|
+
}
|
|
10674
|
+
}
|
|
10675
|
+
}
|
|
10676
|
+
if (!session) {
|
|
10677
|
+
this._requestLogger.debug("creating a new session at: %s", sessionsUrl);
|
|
10678
|
+
response = await this._client.fetch(sessionsUrl, {
|
|
10679
|
+
headers,
|
|
10680
|
+
method: "POST"
|
|
10681
|
+
});
|
|
10682
|
+
if (response.status != 200) {
|
|
10683
|
+
this.updateState("Error" /* Error */);
|
|
10684
|
+
const message = await response.text();
|
|
10685
|
+
throw new Error(`Unexpected status ${response.status} creating a compute session: ${message}`);
|
|
10686
|
+
} else {
|
|
10687
|
+
sessions = await response.json();
|
|
10688
|
+
}
|
|
10689
|
+
if (sessions.length == 0) {
|
|
10690
|
+
throw new Error("Unexpected, no compute session after attempt to create one");
|
|
10691
|
+
}
|
|
10692
|
+
session = sessions[0] || null;
|
|
10693
|
+
}
|
|
10694
|
+
if (!session) {
|
|
10695
|
+
throw new Error("unexpected undefined session");
|
|
10696
|
+
}
|
|
10697
|
+
let isReady = false;
|
|
10698
|
+
const deadline = Date.now() + _WorkerEndpoint.WAIT_FOR_IS_READY;
|
|
10699
|
+
while (!isReady) {
|
|
10700
|
+
const health_url = `${session.session_endpoint}/health`;
|
|
10701
|
+
response = await this._client.fetch(health_url, {
|
|
10702
|
+
headers
|
|
10703
|
+
});
|
|
10704
|
+
if (response.status < 300) {
|
|
10705
|
+
isReady = true;
|
|
10706
|
+
} else if (Date.now() > deadline) {
|
|
10707
|
+
throw new Error(`Created session ${session.session_uuid} did not become healthy after ${_WorkerEndpoint.WAIT_FOR_IS_READY / 1e3} seconds`);
|
|
10708
|
+
} else {
|
|
10709
|
+
this._logger.debug(`session ${session.session_uuid} health check status ${response.status}, wait and poll for update`);
|
|
10710
|
+
await sleep(_WorkerEndpoint.CHECK_FOR_IS_READY_INTERVAL);
|
|
10711
|
+
}
|
|
10712
|
+
}
|
|
10713
|
+
this._baseUrl = session.session_endpoint;
|
|
10714
|
+
this._pipeline = null;
|
|
10715
|
+
if (session.pipeline_uuid) {
|
|
10716
|
+
this._pipelineId = session.pipeline_uuid;
|
|
10717
|
+
} else {
|
|
10718
|
+
this._pipelineId = null;
|
|
10719
|
+
}
|
|
10604
10720
|
}
|
|
10605
10721
|
async startTransientPipeline() {
|
|
10606
10722
|
const client = this._client;
|
|
10607
10723
|
const baseUrl = this._baseUrl;
|
|
10608
10724
|
if (client == null || baseUrl == null) {
|
|
10609
|
-
|
|
10725
|
+
throw new Error("endpoint not initialized");
|
|
10610
10726
|
}
|
|
10611
10727
|
let pop;
|
|
10612
10728
|
if (this._pipeline && this._pipeline.pop) {
|
|
@@ -10639,12 +10755,22 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10639
10755
|
});
|
|
10640
10756
|
if (response.status != 200) {
|
|
10641
10757
|
const message = await response.text();
|
|
10642
|
-
|
|
10758
|
+
throw new Error(`Unexpected status ${response.status}: ${message}`);
|
|
10643
10759
|
}
|
|
10644
10760
|
const result = await response.json();
|
|
10645
10761
|
return result["id"];
|
|
10646
10762
|
}
|
|
10647
10763
|
};
|
|
10764
|
+
_WorkerEndpoint.SESSION_DEAD = /* @__PURE__ */ new Set([
|
|
10765
|
+
"error" /* ERROR */,
|
|
10766
|
+
"failed" /* FAILED */,
|
|
10767
|
+
"stopped" /* STOPPED */,
|
|
10768
|
+
"pipeline_error" /* PIPELINE_ERROR */,
|
|
10769
|
+
"unknown" /* UNKNOWN */
|
|
10770
|
+
]);
|
|
10771
|
+
_WorkerEndpoint.WAIT_FOR_IS_READY = 60 * 1e3;
|
|
10772
|
+
_WorkerEndpoint.CHECK_FOR_IS_READY_INTERVAL = 250;
|
|
10773
|
+
var WorkerEndpoint = _WorkerEndpoint;
|
|
10648
10774
|
|
|
10649
10775
|
// shims/websockets.ts
|
|
10650
10776
|
var createWebSocket;
|
|
@@ -10774,6 +10900,8 @@ var TranscodeMode = /* @__PURE__ */ ((TranscodeMode2) => {
|
|
|
10774
10900
|
})(TranscodeMode || {});
|
|
10775
10901
|
var ModelType = /* @__PURE__ */ ((ModelType2) => {
|
|
10776
10902
|
ModelType2["epdet_b1"] = "epdet_b1";
|
|
10903
|
+
ModelType2["imported"] = "imported";
|
|
10904
|
+
ModelType2["vlm_ability"] = "vlm_ability";
|
|
10777
10905
|
return ModelType2;
|
|
10778
10906
|
})(ModelType || {});
|
|
10779
10907
|
var ModelTask = /* @__PURE__ */ ((ModelTask2) => {
|
|
@@ -10877,6 +11005,11 @@ var EvaluationStatus = /* @__PURE__ */ ((EvaluationStatus2) => {
|
|
|
10877
11005
|
EvaluationStatus2["failed"] = "failed";
|
|
10878
11006
|
return EvaluationStatus2;
|
|
10879
11007
|
})(EvaluationStatus || {});
|
|
11008
|
+
var VlmAbilityStatus = /* @__PURE__ */ ((VlmAbilityStatus2) => {
|
|
11009
|
+
VlmAbilityStatus2["draft"] = "draft";
|
|
11010
|
+
VlmAbilityStatus2["published"] = "published";
|
|
11011
|
+
return VlmAbilityStatus2;
|
|
11012
|
+
})(VlmAbilityStatus || {});
|
|
10880
11013
|
|
|
10881
11014
|
// data/jobs.ts
|
|
10882
11015
|
var InferAssetJob = class {
|
|
@@ -11072,9 +11205,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11072
11205
|
if (!this._client) {
|
|
11073
11206
|
return Promise.reject("endpoint not initialized");
|
|
11074
11207
|
}
|
|
11075
|
-
this._logger.warn("AAA", this.vlmApiUrl);
|
|
11076
11208
|
const accountUuidQuery = this._accountId ? `?account_uuid=${this._accountId}` : "";
|
|
11077
|
-
const config_url = `${this.eyepopUrl()}/configs${accountUuidQuery}`;
|
|
11209
|
+
const config_url = `${this.eyepopUrl()}/v1/configs${accountUuidQuery}`;
|
|
11078
11210
|
let headers = {
|
|
11079
11211
|
Authorization: await this.authorizationHeader()
|
|
11080
11212
|
};
|
|
@@ -11652,7 +11784,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11652
11784
|
throw e;
|
|
11653
11785
|
}
|
|
11654
11786
|
}
|
|
11655
|
-
jobDone(
|
|
11787
|
+
jobDone(_job) {
|
|
11656
11788
|
this._limit?.release();
|
|
11657
11789
|
}
|
|
11658
11790
|
async dispatchChangeEvent(change_event) {
|
|
@@ -11672,6 +11804,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11672
11804
|
for (let handler of this._account_event_handlers) {
|
|
11673
11805
|
await handler(change_event);
|
|
11674
11806
|
}
|
|
11807
|
+
break;
|
|
11675
11808
|
// dataset event types
|
|
11676
11809
|
case "asset_added" /* asset_added */:
|
|
11677
11810
|
case "asset_removed" /* asset_removed */:
|
|
@@ -11692,6 +11825,83 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11692
11825
|
break;
|
|
11693
11826
|
}
|
|
11694
11827
|
}
|
|
11828
|
+
// Vlm Ability Management
|
|
11829
|
+
async listVlmAbilityGroups() {
|
|
11830
|
+
return this.request(`/vlm_ability_groups?account_uuid=${this._accountId}`, {
|
|
11831
|
+
method: "GET"
|
|
11832
|
+
});
|
|
11833
|
+
}
|
|
11834
|
+
async createVlmAbilityGroup(create) {
|
|
11835
|
+
return this.request(`/vlm_ability_groups?account_uuid=${this._accountId}`, {
|
|
11836
|
+
method: "POST",
|
|
11837
|
+
body: JSON.stringify(create),
|
|
11838
|
+
headers: { "Content-Type": "application/json" }
|
|
11839
|
+
});
|
|
11840
|
+
}
|
|
11841
|
+
async getVlmAbilityGroup(vlm_ability_group_uuid) {
|
|
11842
|
+
return this.request(`/vlm_ability_groups/${vlm_ability_group_uuid}`, {
|
|
11843
|
+
method: "GET"
|
|
11844
|
+
});
|
|
11845
|
+
}
|
|
11846
|
+
async deleteVlmAbilityGroup(vlm_ability_group_uuid) {
|
|
11847
|
+
return this.request(`/vlm_ability_groups/${vlm_ability_group_uuid}`, {
|
|
11848
|
+
method: "DELETE"
|
|
11849
|
+
});
|
|
11850
|
+
}
|
|
11851
|
+
async updateVlmAbilityGroup(vlm_ability_group_uuid, update) {
|
|
11852
|
+
return this.request(`/vlm_ability_groups/${vlm_ability_group_uuid}`, {
|
|
11853
|
+
method: "PATCH",
|
|
11854
|
+
body: JSON.stringify(update),
|
|
11855
|
+
headers: { "Content-Type": "application/json" }
|
|
11856
|
+
});
|
|
11857
|
+
}
|
|
11858
|
+
async listVlmAbilities() {
|
|
11859
|
+
return this.request(`/vlm_abilities?account_uuid=${this._accountId}`, {
|
|
11860
|
+
method: "GET"
|
|
11861
|
+
});
|
|
11862
|
+
}
|
|
11863
|
+
async createVlmAbility(create, vlm_ability_group_uuid) {
|
|
11864
|
+
const groupQuery = vlm_ability_group_uuid ? `&vlm_ability_group_uuid=${vlm_ability_group_uuid}` : "";
|
|
11865
|
+
return this.request(`/vlm_abilities?account_uuid=${this._accountId}${groupQuery}`, {
|
|
11866
|
+
method: "POST",
|
|
11867
|
+
body: JSON.stringify(create),
|
|
11868
|
+
headers: { "Content-Type": "application/json" }
|
|
11869
|
+
});
|
|
11870
|
+
}
|
|
11871
|
+
async getVlmAbility(vlm_ability_uuid) {
|
|
11872
|
+
return this.request(`/vlm_abilities/${vlm_ability_uuid}`, {
|
|
11873
|
+
method: "GET"
|
|
11874
|
+
});
|
|
11875
|
+
}
|
|
11876
|
+
async deleteVlmAbility(vlm_ability_uuid) {
|
|
11877
|
+
return this.request(`/vlm_abilities/${vlm_ability_uuid}`, {
|
|
11878
|
+
method: "DELETE"
|
|
11879
|
+
});
|
|
11880
|
+
}
|
|
11881
|
+
async updateVlmAbility(vlm_ability_uuid, update) {
|
|
11882
|
+
return this.request(`/vlm_abilities/${vlm_ability_uuid}`, {
|
|
11883
|
+
method: "PATCH",
|
|
11884
|
+
body: JSON.stringify(update),
|
|
11885
|
+
headers: { "Content-Type": "application/json" }
|
|
11886
|
+
});
|
|
11887
|
+
}
|
|
11888
|
+
async publishVlmAbility(vlm_ability_uuid, alias_name, tag_name) {
|
|
11889
|
+
const alias_name_query = alias_name ? `alias_name=${encodeURIComponent(alias_name)}&` : "";
|
|
11890
|
+
const tag_name_query = tag_name ? `tag_name=${encodeURIComponent(tag_name)}&` : "";
|
|
11891
|
+
return this.request(`/vlm_abilities/${vlm_ability_uuid}/publish?${alias_name_query}${tag_name_query}`, {
|
|
11892
|
+
method: "POST"
|
|
11893
|
+
});
|
|
11894
|
+
}
|
|
11895
|
+
async addVlmAbilityAlias(vlm_ability_uuid, alias_name, tag_name) {
|
|
11896
|
+
return this.request(`/vlm_abilities/${vlm_ability_uuid}/alias/${encodeURIComponent(alias_name)}/tag/${tag_name ? encodeURIComponent(tag_name) : ""}`, {
|
|
11897
|
+
method: "POST"
|
|
11898
|
+
});
|
|
11899
|
+
}
|
|
11900
|
+
async removeVlmAbilityAlias(vlm_ability_uuid, alias_name, tag_name) {
|
|
11901
|
+
return this.request(`/vlm_abilities/${vlm_ability_uuid}/alias/${encodeURIComponent(alias_name)}/tag/${encodeURIComponent(tag_name)}`, {
|
|
11902
|
+
method: "DELETE"
|
|
11903
|
+
});
|
|
11904
|
+
}
|
|
11695
11905
|
};
|
|
11696
11906
|
|
|
11697
11907
|
// worker/webrtc_whep.ts
|
|
@@ -11756,7 +11966,7 @@ var WebrtcWhep = class extends WebrtcBase {
|
|
|
11756
11966
|
return new Promise(async (resolve, reject) => {
|
|
11757
11967
|
pc.ontrack = (evt) => {
|
|
11758
11968
|
this._requestLogger.debug(`new track: ${evt.track.kind}`);
|
|
11759
|
-
this._stream = evt.streams[0];
|
|
11969
|
+
this._stream = evt.streams[0] || null;
|
|
11760
11970
|
resolve(this);
|
|
11761
11971
|
};
|
|
11762
11972
|
pc.oniceconnectionstatechange = () => {
|
|
@@ -11792,21 +12002,24 @@ var stringToBooleanSafe = (str) => {
|
|
|
11792
12002
|
};
|
|
11793
12003
|
var EyePop;
|
|
11794
12004
|
((EyePop2) => {
|
|
11795
|
-
const
|
|
11796
|
-
const defaultAuth =
|
|
11797
|
-
|
|
12005
|
+
const envApiKey = readEnv("EYEPOP_API_KEY");
|
|
12006
|
+
const defaultAuth = envApiKey ? {
|
|
12007
|
+
apiKey: envApiKey
|
|
11798
12008
|
} : void 0;
|
|
11799
12009
|
EyePop2.endpoint = workerEndpoint;
|
|
11800
12010
|
function workerEndpoint(opts = {}) {
|
|
11801
12011
|
if (opts.isLocalMode === void 0) {
|
|
11802
12012
|
opts.isLocalMode = stringToBooleanSafe(readEnv("EYEPOP_LOCAL_MODE"));
|
|
11803
12013
|
}
|
|
11804
|
-
|
|
12014
|
+
if (opts.isLocalMode) {
|
|
12015
|
+
opts.eyepopUrl = "http://127.0.0.1:8080";
|
|
12016
|
+
}
|
|
12017
|
+
_fill_default_options(opts);
|
|
11805
12018
|
if (opts.auth === void 0) {
|
|
11806
12019
|
if (opts.isLocalMode) {
|
|
11807
12020
|
opts.auth = { isLocal: true };
|
|
11808
12021
|
} else {
|
|
11809
|
-
throw new Error("auth option or
|
|
12022
|
+
throw new Error("auth option or EYEPOP_API_KEY environment variable is required");
|
|
11810
12023
|
}
|
|
11811
12024
|
}
|
|
11812
12025
|
if (opts.popId === void 0) {
|
|
@@ -11833,7 +12046,7 @@ var EyePop;
|
|
|
11833
12046
|
function dataEndpoint(opts = {}) {
|
|
11834
12047
|
_fill_default_options(opts);
|
|
11835
12048
|
if (opts.auth === void 0) {
|
|
11836
|
-
throw new Error("auth option or
|
|
12049
|
+
throw new Error("auth option or EYEPOP_API_KEY environment variable is required");
|
|
11837
12050
|
}
|
|
11838
12051
|
if (opts.accountId === void 0) {
|
|
11839
12052
|
opts.accountId = readEnv("EYEPOP_ACCOUNT_ID");
|
|
@@ -11848,20 +12061,23 @@ var EyePop;
|
|
|
11848
12061
|
return new DataEndpoint(opts);
|
|
11849
12062
|
}
|
|
11850
12063
|
EyePop2.dataEndpoint = dataEndpoint;
|
|
11851
|
-
function _fill_default_options(opts
|
|
11852
|
-
if (opts.auth
|
|
12064
|
+
function _fill_default_options(opts) {
|
|
12065
|
+
if (!opts.auth) {
|
|
11853
12066
|
opts.auth = defaultAuth;
|
|
11854
12067
|
}
|
|
11855
|
-
if (opts.eyepopUrl
|
|
11856
|
-
opts.eyepopUrl =
|
|
12068
|
+
if (!opts.eyepopUrl && opts.auth && opts.auth.session && opts.auth.session.eyepopUrl) {
|
|
12069
|
+
opts.eyepopUrl = opts.auth.session.eyepopUrl;
|
|
11857
12070
|
}
|
|
11858
|
-
if (opts.
|
|
11859
|
-
opts.
|
|
12071
|
+
if (!opts.eyepopUrl) {
|
|
12072
|
+
opts.eyepopUrl = readEnv("EYEPOP_URL");
|
|
11860
12073
|
}
|
|
11861
|
-
if (opts.
|
|
12074
|
+
if (!opts.eyepopUrl) {
|
|
12075
|
+
opts.eyepopUrl = "https://compute.eyepop.ai";
|
|
12076
|
+
}
|
|
12077
|
+
if (opts.auth) {
|
|
11862
12078
|
if (opts.auth.oAuth2 !== void 0) {
|
|
11863
12079
|
if (typeof opts.auth.oAuth2 === "boolean") {
|
|
11864
|
-
if (opts.eyepopUrl.
|
|
12080
|
+
if (opts.eyepopUrl && opts.eyepopUrl.match(/https:(.*).staging.eyepop.xyz/i)) {
|
|
11865
12081
|
opts.auth = {
|
|
11866
12082
|
oAuth2: {
|
|
11867
12083
|
domain: "dev-eyepop.us.auth0.com",
|
|
@@ -11882,11 +12098,9 @@ var EyePop;
|
|
|
11882
12098
|
}
|
|
11883
12099
|
}
|
|
11884
12100
|
}
|
|
11885
|
-
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
}
|
|
11889
|
-
}
|
|
12101
|
+
}
|
|
12102
|
+
if (!opts.jobQueueLength) {
|
|
12103
|
+
opts.jobQueueLength = 128;
|
|
11890
12104
|
}
|
|
11891
12105
|
}
|
|
11892
12106
|
})(EyePop || (EyePop = {}));
|
|
@@ -11928,12 +12142,14 @@ var index_default = EyePop;
|
|
|
11928
12142
|
PopComponentType,
|
|
11929
12143
|
PredictionVersion,
|
|
11930
12144
|
Semaphore,
|
|
12145
|
+
SessionStatus,
|
|
11931
12146
|
Stream,
|
|
11932
12147
|
TranscodeMode,
|
|
11933
12148
|
TransientPopId,
|
|
11934
12149
|
UploadJob,
|
|
11935
12150
|
UserReview,
|
|
11936
12151
|
VideoMode,
|
|
12152
|
+
VlmAbilityStatus,
|
|
11937
12153
|
WebrtcBase,
|
|
11938
12154
|
WebrtcWhep,
|
|
11939
12155
|
WebrtcWhip,
|