@eyepop.ai/eyepop 3.9.0 → 3.10.1
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 +33 -10
- package/dist/eyepop.index.d.ts +33 -10
- package/dist/eyepop.index.js +220 -72
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +219 -72
- 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,6 +8691,7 @@ __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,
|
|
@@ -9093,9 +9094,9 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9093
9094
|
const sections = answer.split("m=");
|
|
9094
9095
|
for (let i = 0; i < sections.length; i++) {
|
|
9095
9096
|
const section = sections[i];
|
|
9096
|
-
if (section.startsWith("video")) {
|
|
9097
|
+
if (section && section.startsWith("video")) {
|
|
9097
9098
|
sections[i] = WebrtcWhip.setVideoBitrate(WebrtcWhip.setCodec(section, videoCodec), videoBitrate);
|
|
9098
|
-
} else if (section.startsWith("audio")) {
|
|
9099
|
+
} else if (section && section.startsWith("audio")) {
|
|
9099
9100
|
sections[i] = WebrtcWhip.setAudioBitrate(WebrtcWhip.setCodec(section, audioCodec), audioBitrate, audioVoice);
|
|
9100
9101
|
}
|
|
9101
9102
|
}
|
|
@@ -9134,7 +9135,11 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9134
9135
|
static setVideoBitrate(section, bitrate) {
|
|
9135
9136
|
let lines = section.split("\r\n");
|
|
9136
9137
|
for (let i = 0; i < lines.length; i++) {
|
|
9137
|
-
|
|
9138
|
+
const line = lines[i];
|
|
9139
|
+
if (!line) {
|
|
9140
|
+
continue;
|
|
9141
|
+
}
|
|
9142
|
+
if (line.startsWith("c=")) {
|
|
9138
9143
|
lines = [...lines.slice(0, i + 1), "b=TIAS:" + (bitrate * 1024).toString(), ...lines.slice(i + 1)];
|
|
9139
9144
|
break;
|
|
9140
9145
|
}
|
|
@@ -9145,8 +9150,12 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9145
9150
|
let opusPayloadFormat = "";
|
|
9146
9151
|
let lines = section.split("\r\n");
|
|
9147
9152
|
for (let i = 0; i < lines.length; i++) {
|
|
9148
|
-
|
|
9149
|
-
|
|
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] || "";
|
|
9150
9159
|
break;
|
|
9151
9160
|
}
|
|
9152
9161
|
}
|
|
@@ -9154,7 +9163,11 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9154
9163
|
return section;
|
|
9155
9164
|
}
|
|
9156
9165
|
for (let i = 0; i < lines.length; i++) {
|
|
9157
|
-
|
|
9166
|
+
const line = lines[i];
|
|
9167
|
+
if (!line) {
|
|
9168
|
+
continue;
|
|
9169
|
+
}
|
|
9170
|
+
if (line.startsWith("a=fmtp:" + opusPayloadFormat + " ")) {
|
|
9158
9171
|
if (voice) {
|
|
9159
9172
|
lines[i] = "a=fmtp:" + opusPayloadFormat + " minptime=10;useinbandfec=1;maxaveragebitrate=" + ((bitrate ?? 0) * 1024).toString();
|
|
9160
9173
|
} else {
|
|
@@ -9658,7 +9671,7 @@ var LoadMediaStreamJob = class extends AbstractJob {
|
|
|
9658
9671
|
true,
|
|
9659
9672
|
this._requestLogger
|
|
9660
9673
|
);
|
|
9661
|
-
whip.start().then((
|
|
9674
|
+
whip.start().then((_) => {
|
|
9662
9675
|
this._requestLogger.debug("direct whip for ingressId=%s successful", whip.ingressId());
|
|
9663
9676
|
}).catch((reason) => {
|
|
9664
9677
|
this._controller.abort(reason);
|
|
@@ -9689,7 +9702,7 @@ var LoadMediaStreamJob = class extends AbstractJob {
|
|
|
9689
9702
|
// shims/local_file.ts
|
|
9690
9703
|
var resolvePath;
|
|
9691
9704
|
if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
9692
|
-
resolvePath = async (
|
|
9705
|
+
resolvePath = async (_source, _logger) => {
|
|
9693
9706
|
throw new DOMException("resolving a path to a file is not supported in browser");
|
|
9694
9707
|
};
|
|
9695
9708
|
} else {
|
|
@@ -9711,7 +9724,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9711
9724
|
yield chunk;
|
|
9712
9725
|
}
|
|
9713
9726
|
}
|
|
9714
|
-
resolvePath = async (source,
|
|
9727
|
+
resolvePath = async (source, _) => {
|
|
9715
9728
|
const mime = require_mime_types();
|
|
9716
9729
|
const filehandle = require("fs/promises");
|
|
9717
9730
|
const fd = await filehandle.open(source.path, "r");
|
|
@@ -9840,7 +9853,7 @@ var Semaphore = class {
|
|
|
9840
9853
|
this.permits -= 1;
|
|
9841
9854
|
return Promise.resolve(true);
|
|
9842
9855
|
}
|
|
9843
|
-
let resolver = (
|
|
9856
|
+
let resolver = (_) => void 0;
|
|
9844
9857
|
const promise = new Promise((r) => {
|
|
9845
9858
|
resolver = r;
|
|
9846
9859
|
});
|
|
@@ -9970,7 +9983,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9970
9983
|
return session;
|
|
9971
9984
|
};
|
|
9972
9985
|
} else {
|
|
9973
|
-
authenticateBrowserSession = (
|
|
9986
|
+
authenticateBrowserSession = (_auth0, _options) => {
|
|
9974
9987
|
return Promise.reject("auth0 login not supported server-side");
|
|
9975
9988
|
};
|
|
9976
9989
|
}
|
|
@@ -10004,6 +10017,14 @@ var Endpoint = class {
|
|
|
10004
10017
|
eyepopUrl() {
|
|
10005
10018
|
if (this._options.eyepopUrl) {
|
|
10006
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.");
|
|
10007
10028
|
} else {
|
|
10008
10029
|
return "https://api.eyepop.ai";
|
|
10009
10030
|
}
|
|
@@ -10051,10 +10072,10 @@ var Endpoint = class {
|
|
|
10051
10072
|
this._token = this._options.auth.session.accessToken;
|
|
10052
10073
|
this._expire_token_time = this._options.auth.session.validUntil / 1e3;
|
|
10053
10074
|
} else if (this._options.auth.oAuth2 !== void 0) {
|
|
10054
|
-
} else if (this._options.auth.
|
|
10075
|
+
} else if (this._options.auth.apiKey !== void 0) {
|
|
10055
10076
|
} else if (this._options.auth.isLocal !== void 0) {
|
|
10056
10077
|
} else {
|
|
10057
|
-
return Promise.reject("option
|
|
10078
|
+
return Promise.reject("option apiKey or environment variable EYEPOP_API_KEY is required");
|
|
10058
10079
|
}
|
|
10059
10080
|
if (this._options.platformSupport?.createHttpClient !== void 0) {
|
|
10060
10081
|
this._client = await this._options.platformSupport.createHttpClient(this._requestLogger);
|
|
@@ -10086,7 +10107,7 @@ var Endpoint = class {
|
|
|
10086
10107
|
validUntil: this._expire_token_time * 1e3
|
|
10087
10108
|
};
|
|
10088
10109
|
}
|
|
10089
|
-
statusHandler401(
|
|
10110
|
+
statusHandler401(_statusCode) {
|
|
10090
10111
|
this._token = null;
|
|
10091
10112
|
this._expire_token_time = null;
|
|
10092
10113
|
}
|
|
@@ -10149,15 +10170,12 @@ var Endpoint = class {
|
|
|
10149
10170
|
const session = await authenticateBrowserSession(this._options.auth.oAuth2, this._options);
|
|
10150
10171
|
this._token = session.accessToken;
|
|
10151
10172
|
this._expire_token_time = session.validUntil / 1e3;
|
|
10152
|
-
} else if (this._options.auth.
|
|
10153
|
-
const
|
|
10154
|
-
const
|
|
10155
|
-
const headers = { "Content-Type": "application/json" };
|
|
10156
|
-
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`;
|
|
10157
10176
|
const response = await this._client.fetch(post_url, {
|
|
10158
10177
|
method: "POST",
|
|
10159
|
-
headers
|
|
10160
|
-
body: JSON.stringify(body)
|
|
10178
|
+
headers
|
|
10161
10179
|
});
|
|
10162
10180
|
if (response.status != 200) {
|
|
10163
10181
|
const message = await response.text();
|
|
@@ -10186,7 +10204,21 @@ var TransientPopId = /* @__PURE__ */ ((TransientPopId2) => {
|
|
|
10186
10204
|
})(TransientPopId || {});
|
|
10187
10205
|
|
|
10188
10206
|
// worker/worker_endpoint.ts
|
|
10189
|
-
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 {
|
|
10190
10222
|
constructor(options) {
|
|
10191
10223
|
super(options);
|
|
10192
10224
|
this.setStatusRetryHandlers(/* @__PURE__ */ new Map([[404, (statusCode) => this.statusHandler404(statusCode)]]));
|
|
@@ -10215,7 +10247,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10215
10247
|
}
|
|
10216
10248
|
return super.disconnect(wait);
|
|
10217
10249
|
}
|
|
10218
|
-
statusHandler404(
|
|
10250
|
+
statusHandler404(_) {
|
|
10219
10251
|
this._pipelineId = null;
|
|
10220
10252
|
this._baseUrl = null;
|
|
10221
10253
|
}
|
|
@@ -10268,10 +10300,17 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10268
10300
|
});
|
|
10269
10301
|
if (response.status != 204) {
|
|
10270
10302
|
const message = await response.text();
|
|
10271
|
-
|
|
10303
|
+
throw new Error(`Unexpected status ${response.status}: ${message}`);
|
|
10272
10304
|
}
|
|
10273
10305
|
if (this._pipeline) {
|
|
10274
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
|
+
};
|
|
10275
10314
|
}
|
|
10276
10315
|
}
|
|
10277
10316
|
_authenticationHeaders(session) {
|
|
@@ -10491,11 +10530,11 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10491
10530
|
throw e;
|
|
10492
10531
|
}
|
|
10493
10532
|
}
|
|
10494
|
-
jobDone(
|
|
10533
|
+
jobDone(_) {
|
|
10495
10534
|
this._limit?.release();
|
|
10496
10535
|
this.updateState();
|
|
10497
10536
|
}
|
|
10498
|
-
jobStatus(
|
|
10537
|
+
jobStatus(_, statusCode) {
|
|
10499
10538
|
if (statusCode == 404) {
|
|
10500
10539
|
this.statusHandler404(statusCode);
|
|
10501
10540
|
} else if (statusCode == 401) {
|
|
@@ -10503,15 +10542,20 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10503
10542
|
}
|
|
10504
10543
|
}
|
|
10505
10544
|
async reconnect() {
|
|
10506
|
-
if (!this._client) {
|
|
10507
|
-
return Promise.reject("endpoint not initialized");
|
|
10508
|
-
}
|
|
10509
|
-
let config_url;
|
|
10510
10545
|
if (this.options().popId == "transient" /* Transient */) {
|
|
10511
|
-
|
|
10546
|
+
await this.startComputeSession();
|
|
10547
|
+
this._pipelineId = await this.startTransientPipeline();
|
|
10512
10548
|
} else {
|
|
10513
|
-
|
|
10549
|
+
await this.startWebApiSessionWithPopId();
|
|
10514
10550
|
}
|
|
10551
|
+
this.updateState();
|
|
10552
|
+
return Promise.resolve(this);
|
|
10553
|
+
}
|
|
10554
|
+
async startWebApiSessionWithPopId() {
|
|
10555
|
+
if (!this._client) {
|
|
10556
|
+
throw new Error("endpoint not initialized");
|
|
10557
|
+
}
|
|
10558
|
+
const config_url = `${this.eyepopWebApiUrl()}/pops/${this.options().popId}/config?auto_start=false`;
|
|
10515
10559
|
const headers = {
|
|
10516
10560
|
Authorization: await this.authorizationHeader()
|
|
10517
10561
|
};
|
|
@@ -10535,11 +10579,11 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10535
10579
|
} else {
|
|
10536
10580
|
this.updateState("Error" /* Error */, message);
|
|
10537
10581
|
}
|
|
10538
|
-
|
|
10582
|
+
throw new Error(`Unexpected status ${response.status}: ${message}`);
|
|
10539
10583
|
}
|
|
10540
10584
|
let config = await response.json();
|
|
10541
10585
|
if (!config.base_url && this.options().autoStart) {
|
|
10542
|
-
const auto_start_config_url = `${this.
|
|
10586
|
+
const auto_start_config_url = `${this.eyepopWebApiUrl()}/pops/${this.options().popId}/config?auto_start=true`;
|
|
10543
10587
|
this._requestLogger.debug("pop was not running, trying to autostart with: %s", auto_start_config_url);
|
|
10544
10588
|
const headers2 = {
|
|
10545
10589
|
Authorization: await this.authorizationHeader()
|
|
@@ -10550,7 +10594,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10550
10594
|
if (response.status != 200) {
|
|
10551
10595
|
this.updateState("Error" /* Error */);
|
|
10552
10596
|
const message = await response.text();
|
|
10553
|
-
|
|
10597
|
+
throw new Error(`Unexpected status ${response.status}: ${message}`);
|
|
10554
10598
|
}
|
|
10555
10599
|
config = await response.json();
|
|
10556
10600
|
}
|
|
@@ -10558,17 +10602,11 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10558
10602
|
this._baseUrl = baseUrl.toString();
|
|
10559
10603
|
if (this._baseUrl) {
|
|
10560
10604
|
this._baseUrl = this._baseUrl.replace(/\/+$/, "");
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
this._popName = this.options().popId || null;
|
|
10564
|
-
} else {
|
|
10565
|
-
this._pipelineId = config.pipeline_id;
|
|
10566
|
-
this._popName = config.name;
|
|
10567
|
-
}
|
|
10605
|
+
this._pipelineId = config.pipeline_id;
|
|
10606
|
+
this._popName = config.name;
|
|
10568
10607
|
if (!this._pipelineId || !this._baseUrl) {
|
|
10569
|
-
|
|
10608
|
+
throw new Error("Pop not started");
|
|
10570
10609
|
}
|
|
10571
|
-
this._baseUrl = this._baseUrl.replace(/\/+$/, "");
|
|
10572
10610
|
const get_url = `${this._baseUrl}/pipelines/${this._pipelineId}`;
|
|
10573
10611
|
const headers2 = {
|
|
10574
10612
|
Authorization: await this.authorizationHeader()
|
|
@@ -10579,7 +10617,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10579
10617
|
});
|
|
10580
10618
|
if (response2.status > 200) {
|
|
10581
10619
|
const message = await response2.text();
|
|
10582
|
-
|
|
10620
|
+
throw new Error(`Unexpected status ${response2.status}: ${message}`);
|
|
10583
10621
|
}
|
|
10584
10622
|
this._pipeline = await response2.json();
|
|
10585
10623
|
if (this.options().stopJobs) {
|
|
@@ -10596,18 +10634,95 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10596
10634
|
});
|
|
10597
10635
|
if (response3.status >= 300) {
|
|
10598
10636
|
const message = await response3.text();
|
|
10599
|
-
|
|
10637
|
+
throw new Error(`Unexpected status ${response3.status}: ${message}`);
|
|
10600
10638
|
}
|
|
10601
10639
|
}
|
|
10602
10640
|
}
|
|
10603
|
-
|
|
10604
|
-
|
|
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
|
+
}
|
|
10605
10720
|
}
|
|
10606
10721
|
async startTransientPipeline() {
|
|
10607
10722
|
const client = this._client;
|
|
10608
10723
|
const baseUrl = this._baseUrl;
|
|
10609
10724
|
if (client == null || baseUrl == null) {
|
|
10610
|
-
|
|
10725
|
+
throw new Error("endpoint not initialized");
|
|
10611
10726
|
}
|
|
10612
10727
|
let pop;
|
|
10613
10728
|
if (this._pipeline && this._pipeline.pop) {
|
|
@@ -10640,12 +10755,22 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10640
10755
|
});
|
|
10641
10756
|
if (response.status != 200) {
|
|
10642
10757
|
const message = await response.text();
|
|
10643
|
-
|
|
10758
|
+
throw new Error(`Unexpected status ${response.status}: ${message}`);
|
|
10644
10759
|
}
|
|
10645
10760
|
const result = await response.json();
|
|
10646
10761
|
return result["id"];
|
|
10647
10762
|
}
|
|
10648
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;
|
|
10649
10774
|
|
|
10650
10775
|
// shims/websockets.ts
|
|
10651
10776
|
var createWebSocket;
|
|
@@ -11081,7 +11206,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11081
11206
|
return Promise.reject("endpoint not initialized");
|
|
11082
11207
|
}
|
|
11083
11208
|
const accountUuidQuery = this._accountId ? `?account_uuid=${this._accountId}` : "";
|
|
11084
|
-
const config_url = `${this.eyepopUrl()}/configs${accountUuidQuery}`;
|
|
11209
|
+
const config_url = `${this.eyepopUrl()}/v1/configs${accountUuidQuery}`;
|
|
11085
11210
|
let headers = {
|
|
11086
11211
|
Authorization: await this.authorizationHeader()
|
|
11087
11212
|
};
|
|
@@ -11659,7 +11784,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11659
11784
|
throw e;
|
|
11660
11785
|
}
|
|
11661
11786
|
}
|
|
11662
|
-
jobDone(
|
|
11787
|
+
jobDone(_job) {
|
|
11663
11788
|
this._limit?.release();
|
|
11664
11789
|
}
|
|
11665
11790
|
async dispatchChangeEvent(change_event) {
|
|
@@ -11679,6 +11804,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11679
11804
|
for (let handler of this._account_event_handlers) {
|
|
11680
11805
|
await handler(change_event);
|
|
11681
11806
|
}
|
|
11807
|
+
break;
|
|
11682
11808
|
// dataset event types
|
|
11683
11809
|
case "asset_added" /* asset_added */:
|
|
11684
11810
|
case "asset_removed" /* asset_removed */:
|
|
@@ -11776,6 +11902,23 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11776
11902
|
method: "DELETE"
|
|
11777
11903
|
});
|
|
11778
11904
|
}
|
|
11905
|
+
async listVlmAbilityEvaluations(vlm_ability_uuid) {
|
|
11906
|
+
return this.request(`/vlm_abilities/${vlm_ability_uuid}/evaluations`, {
|
|
11907
|
+
method: "GET"
|
|
11908
|
+
});
|
|
11909
|
+
}
|
|
11910
|
+
async getVlmAbilityEvaluation(vlm_ability_uuid, source) {
|
|
11911
|
+
return this.request(`/vlm_abilities/${vlm_ability_uuid}/evaluations/${source}`, {
|
|
11912
|
+
method: "GET"
|
|
11913
|
+
});
|
|
11914
|
+
}
|
|
11915
|
+
async startVlmAbilityEvaluation(vlm_ability_uuid, evaluate_request) {
|
|
11916
|
+
return this.request(`/vlm_abilities/${vlm_ability_uuid}/evaluations`, {
|
|
11917
|
+
method: "POST",
|
|
11918
|
+
body: JSON.stringify(evaluate_request),
|
|
11919
|
+
headers: { "Content-Type": "application/json" }
|
|
11920
|
+
});
|
|
11921
|
+
}
|
|
11779
11922
|
};
|
|
11780
11923
|
|
|
11781
11924
|
// worker/webrtc_whep.ts
|
|
@@ -11840,7 +11983,7 @@ var WebrtcWhep = class extends WebrtcBase {
|
|
|
11840
11983
|
return new Promise(async (resolve, reject) => {
|
|
11841
11984
|
pc.ontrack = (evt) => {
|
|
11842
11985
|
this._requestLogger.debug(`new track: ${evt.track.kind}`);
|
|
11843
|
-
this._stream = evt.streams[0];
|
|
11986
|
+
this._stream = evt.streams[0] || null;
|
|
11844
11987
|
resolve(this);
|
|
11845
11988
|
};
|
|
11846
11989
|
pc.oniceconnectionstatechange = () => {
|
|
@@ -11876,21 +12019,24 @@ var stringToBooleanSafe = (str) => {
|
|
|
11876
12019
|
};
|
|
11877
12020
|
var EyePop;
|
|
11878
12021
|
((EyePop2) => {
|
|
11879
|
-
const
|
|
11880
|
-
const defaultAuth =
|
|
11881
|
-
|
|
12022
|
+
const envApiKey = readEnv("EYEPOP_API_KEY");
|
|
12023
|
+
const defaultAuth = envApiKey ? {
|
|
12024
|
+
apiKey: envApiKey
|
|
11882
12025
|
} : void 0;
|
|
11883
12026
|
EyePop2.endpoint = workerEndpoint;
|
|
11884
12027
|
function workerEndpoint(opts = {}) {
|
|
11885
12028
|
if (opts.isLocalMode === void 0) {
|
|
11886
12029
|
opts.isLocalMode = stringToBooleanSafe(readEnv("EYEPOP_LOCAL_MODE"));
|
|
11887
12030
|
}
|
|
11888
|
-
|
|
12031
|
+
if (opts.isLocalMode) {
|
|
12032
|
+
opts.eyepopUrl = "http://127.0.0.1:8080";
|
|
12033
|
+
}
|
|
12034
|
+
_fill_default_options(opts);
|
|
11889
12035
|
if (opts.auth === void 0) {
|
|
11890
12036
|
if (opts.isLocalMode) {
|
|
11891
12037
|
opts.auth = { isLocal: true };
|
|
11892
12038
|
} else {
|
|
11893
|
-
throw new Error("auth option or
|
|
12039
|
+
throw new Error("auth option or EYEPOP_API_KEY environment variable is required");
|
|
11894
12040
|
}
|
|
11895
12041
|
}
|
|
11896
12042
|
if (opts.popId === void 0) {
|
|
@@ -11917,7 +12063,7 @@ var EyePop;
|
|
|
11917
12063
|
function dataEndpoint(opts = {}) {
|
|
11918
12064
|
_fill_default_options(opts);
|
|
11919
12065
|
if (opts.auth === void 0) {
|
|
11920
|
-
throw new Error("auth option or
|
|
12066
|
+
throw new Error("auth option or EYEPOP_API_KEY environment variable is required");
|
|
11921
12067
|
}
|
|
11922
12068
|
if (opts.accountId === void 0) {
|
|
11923
12069
|
opts.accountId = readEnv("EYEPOP_ACCOUNT_ID");
|
|
@@ -11932,20 +12078,23 @@ var EyePop;
|
|
|
11932
12078
|
return new DataEndpoint(opts);
|
|
11933
12079
|
}
|
|
11934
12080
|
EyePop2.dataEndpoint = dataEndpoint;
|
|
11935
|
-
function _fill_default_options(opts
|
|
11936
|
-
if (opts.auth
|
|
12081
|
+
function _fill_default_options(opts) {
|
|
12082
|
+
if (!opts.auth) {
|
|
11937
12083
|
opts.auth = defaultAuth;
|
|
11938
12084
|
}
|
|
11939
|
-
if (opts.eyepopUrl
|
|
11940
|
-
opts.eyepopUrl =
|
|
12085
|
+
if (!opts.eyepopUrl && opts.auth && opts.auth.session && opts.auth.session.eyepopUrl) {
|
|
12086
|
+
opts.eyepopUrl = opts.auth.session.eyepopUrl;
|
|
11941
12087
|
}
|
|
11942
|
-
if (opts.
|
|
11943
|
-
opts.
|
|
12088
|
+
if (!opts.eyepopUrl) {
|
|
12089
|
+
opts.eyepopUrl = readEnv("EYEPOP_URL");
|
|
11944
12090
|
}
|
|
11945
|
-
if (opts.
|
|
12091
|
+
if (!opts.eyepopUrl) {
|
|
12092
|
+
opts.eyepopUrl = "https://compute.eyepop.ai";
|
|
12093
|
+
}
|
|
12094
|
+
if (opts.auth) {
|
|
11946
12095
|
if (opts.auth.oAuth2 !== void 0) {
|
|
11947
12096
|
if (typeof opts.auth.oAuth2 === "boolean") {
|
|
11948
|
-
if (opts.eyepopUrl.
|
|
12097
|
+
if (opts.eyepopUrl && opts.eyepopUrl.match(/https:(.*).staging.eyepop.xyz/i)) {
|
|
11949
12098
|
opts.auth = {
|
|
11950
12099
|
oAuth2: {
|
|
11951
12100
|
domain: "dev-eyepop.us.auth0.com",
|
|
@@ -11966,11 +12115,9 @@ var EyePop;
|
|
|
11966
12115
|
}
|
|
11967
12116
|
}
|
|
11968
12117
|
}
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
}
|
|
11973
|
-
}
|
|
12118
|
+
}
|
|
12119
|
+
if (!opts.jobQueueLength) {
|
|
12120
|
+
opts.jobQueueLength = 128;
|
|
11974
12121
|
}
|
|
11975
12122
|
}
|
|
11976
12123
|
})(EyePop || (EyePop = {}));
|
|
@@ -12012,6 +12159,7 @@ var index_default = EyePop;
|
|
|
12012
12159
|
PopComponentType,
|
|
12013
12160
|
PredictionVersion,
|
|
12014
12161
|
Semaphore,
|
|
12162
|
+
SessionStatus,
|
|
12015
12163
|
Stream,
|
|
12016
12164
|
TranscodeMode,
|
|
12017
12165
|
TransientPopId,
|