@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.
@@ -9016,9 +9016,9 @@ var WebrtcBase = class _WebrtcBase {
9016
9016
  const sections = answer.split("m=");
9017
9017
  for (let i = 0; i < sections.length; i++) {
9018
9018
  const section = sections[i];
9019
- if (section.startsWith("video")) {
9019
+ if (section && section.startsWith("video")) {
9020
9020
  sections[i] = WebrtcWhip.setVideoBitrate(WebrtcWhip.setCodec(section, videoCodec), videoBitrate);
9021
- } else if (section.startsWith("audio")) {
9021
+ } else if (section && section.startsWith("audio")) {
9022
9022
  sections[i] = WebrtcWhip.setAudioBitrate(WebrtcWhip.setCodec(section, audioCodec), audioBitrate, audioVoice);
9023
9023
  }
9024
9024
  }
@@ -9057,7 +9057,11 @@ var WebrtcBase = class _WebrtcBase {
9057
9057
  static setVideoBitrate(section, bitrate) {
9058
9058
  let lines = section.split("\r\n");
9059
9059
  for (let i = 0; i < lines.length; i++) {
9060
- if (lines[i].startsWith("c=")) {
9060
+ const line = lines[i];
9061
+ if (!line) {
9062
+ continue;
9063
+ }
9064
+ if (line.startsWith("c=")) {
9061
9065
  lines = [...lines.slice(0, i + 1), "b=TIAS:" + (bitrate * 1024).toString(), ...lines.slice(i + 1)];
9062
9066
  break;
9063
9067
  }
@@ -9068,8 +9072,12 @@ var WebrtcBase = class _WebrtcBase {
9068
9072
  let opusPayloadFormat = "";
9069
9073
  let lines = section.split("\r\n");
9070
9074
  for (let i = 0; i < lines.length; i++) {
9071
- if (lines[i].startsWith("a=rtpmap:") && lines[i].toLowerCase().includes("opus/")) {
9072
- opusPayloadFormat = lines[i].slice("a=rtpmap:".length).split(" ")[0];
9075
+ const line = lines[i];
9076
+ if (!line) {
9077
+ continue;
9078
+ }
9079
+ if (line.startsWith("a=rtpmap:") && line.toLowerCase().includes("opus/")) {
9080
+ opusPayloadFormat = line.slice("a=rtpmap:".length).split(" ")[0] || "";
9073
9081
  break;
9074
9082
  }
9075
9083
  }
@@ -9077,7 +9085,11 @@ var WebrtcBase = class _WebrtcBase {
9077
9085
  return section;
9078
9086
  }
9079
9087
  for (let i = 0; i < lines.length; i++) {
9080
- if (lines[i].startsWith("a=fmtp:" + opusPayloadFormat + " ")) {
9088
+ const line = lines[i];
9089
+ if (!line) {
9090
+ continue;
9091
+ }
9092
+ if (line.startsWith("a=fmtp:" + opusPayloadFormat + " ")) {
9081
9093
  if (voice) {
9082
9094
  lines[i] = "a=fmtp:" + opusPayloadFormat + " minptime=10;useinbandfec=1;maxaveragebitrate=" + ((bitrate ?? 0) * 1024).toString();
9083
9095
  } else {
@@ -9581,7 +9593,7 @@ var LoadMediaStreamJob = class extends AbstractJob {
9581
9593
  true,
9582
9594
  this._requestLogger
9583
9595
  );
9584
- whip.start().then((value) => {
9596
+ whip.start().then((_) => {
9585
9597
  this._requestLogger.debug("direct whip for ingressId=%s successful", whip.ingressId());
9586
9598
  }).catch((reason) => {
9587
9599
  this._controller.abort(reason);
@@ -9612,7 +9624,7 @@ var LoadMediaStreamJob = class extends AbstractJob {
9612
9624
  // shims/local_file.ts
9613
9625
  var resolvePath;
9614
9626
  if ("document" in globalThis && "implementation" in globalThis.document) {
9615
- resolvePath = async (source, logger) => {
9627
+ resolvePath = async (_source, _logger) => {
9616
9628
  throw new DOMException("resolving a path to a file is not supported in browser");
9617
9629
  };
9618
9630
  } else {
@@ -9634,7 +9646,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9634
9646
  yield chunk;
9635
9647
  }
9636
9648
  }
9637
- resolvePath = async (source, logger) => {
9649
+ resolvePath = async (source, _) => {
9638
9650
  const mime = require_mime_types();
9639
9651
  const filehandle = __require("fs/promises");
9640
9652
  const fd = await filehandle.open(source.path, "r");
@@ -9763,7 +9775,7 @@ var Semaphore = class {
9763
9775
  this.permits -= 1;
9764
9776
  return Promise.resolve(true);
9765
9777
  }
9766
- let resolver = (b) => void 0;
9778
+ let resolver = (_) => void 0;
9767
9779
  const promise = new Promise((r) => {
9768
9780
  resolver = r;
9769
9781
  });
@@ -9893,7 +9905,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9893
9905
  return session;
9894
9906
  };
9895
9907
  } else {
9896
- authenticateBrowserSession = (auth0, options) => {
9908
+ authenticateBrowserSession = (_auth0, _options) => {
9897
9909
  return Promise.reject("auth0 login not supported server-side");
9898
9910
  };
9899
9911
  }
@@ -9927,6 +9939,14 @@ var Endpoint = class {
9927
9939
  eyepopUrl() {
9928
9940
  if (this._options.eyepopUrl) {
9929
9941
  return this._options.eyepopUrl.replace(/\/+$/, "");
9942
+ } else {
9943
+ return "https://compute.eyepop.ai";
9944
+ }
9945
+ }
9946
+ // TODO: deprecated Web API endpoint needed for POP_ID support
9947
+ eyepopWebApiUrl() {
9948
+ if (this._options.eyepopUrl) {
9949
+ return this._options.eyepopUrl.replace(/\/+$/, "").replace(/compute\./, "web-api.");
9930
9950
  } else {
9931
9951
  return "https://api.eyepop.ai";
9932
9952
  }
@@ -9974,10 +9994,10 @@ var Endpoint = class {
9974
9994
  this._token = this._options.auth.session.accessToken;
9975
9995
  this._expire_token_time = this._options.auth.session.validUntil / 1e3;
9976
9996
  } else if (this._options.auth.oAuth2 !== void 0) {
9977
- } else if (this._options.auth.secretKey !== void 0) {
9997
+ } else if (this._options.auth.apiKey !== void 0) {
9978
9998
  } else if (this._options.auth.isLocal !== void 0) {
9979
9999
  } else {
9980
- return Promise.reject("option secretKey or environment variable EYEPOP_SECRET_KEY is required");
10000
+ return Promise.reject("option apiKey or environment variable EYEPOP_API_KEY is required");
9981
10001
  }
9982
10002
  if (this._options.platformSupport?.createHttpClient !== void 0) {
9983
10003
  this._client = await this._options.platformSupport.createHttpClient(this._requestLogger);
@@ -10009,7 +10029,7 @@ var Endpoint = class {
10009
10029
  validUntil: this._expire_token_time * 1e3
10010
10030
  };
10011
10031
  }
10012
- statusHandler401(statusCode) {
10032
+ statusHandler401(_statusCode) {
10013
10033
  this._token = null;
10014
10034
  this._expire_token_time = null;
10015
10035
  }
@@ -10072,15 +10092,12 @@ var Endpoint = class {
10072
10092
  const session = await authenticateBrowserSession(this._options.auth.oAuth2, this._options);
10073
10093
  this._token = session.accessToken;
10074
10094
  this._expire_token_time = session.validUntil / 1e3;
10075
- } else if (this._options.auth.secretKey !== void 0 && this._options.eyepopUrl) {
10076
- const secretKeyAuth = this._options.auth;
10077
- const body = { secret_key: secretKeyAuth.secretKey };
10078
- const headers = { "Content-Type": "application/json" };
10079
- const post_url = `${this.eyepopUrl()}/authentication/token`;
10095
+ } else if (this._options.auth.apiKey !== void 0 && this._options.eyepopUrl) {
10096
+ const headers = { "Authorization": `Bearer ${this._options.auth.apiKey}` };
10097
+ const post_url = `${this.eyepopUrl()}/v1/auth/authenticate`;
10080
10098
  const response = await this._client.fetch(post_url, {
10081
10099
  method: "POST",
10082
- headers,
10083
- body: JSON.stringify(body)
10100
+ headers
10084
10101
  });
10085
10102
  if (response.status != 200) {
10086
10103
  const message = await response.text();
@@ -10109,7 +10126,21 @@ var TransientPopId = /* @__PURE__ */ ((TransientPopId2) => {
10109
10126
  })(TransientPopId || {});
10110
10127
 
10111
10128
  // worker/worker_endpoint.ts
10112
- var WorkerEndpoint = class extends Endpoint {
10129
+ var SessionStatus = /* @__PURE__ */ ((SessionStatus2) => {
10130
+ SessionStatus2["UNKNOWN"] = "unknown";
10131
+ SessionStatus2["PENDING"] = "pending";
10132
+ SessionStatus2["RUNNING"] = "running";
10133
+ SessionStatus2["STOPPED"] = "stopped";
10134
+ SessionStatus2["FAILED"] = "failed";
10135
+ SessionStatus2["ERROR"] = "error";
10136
+ SessionStatus2["PIPELINE_CREATING"] = "pipeline_creating";
10137
+ SessionStatus2["PIPELINE_OK"] = "pipeline_ok";
10138
+ SessionStatus2["PIPELINE_CHECKING"] = "pipeline_checking";
10139
+ SessionStatus2["PIPELINE_ERROR"] = "pipeline_error";
10140
+ return SessionStatus2;
10141
+ })(SessionStatus || {});
10142
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
10143
+ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
10113
10144
  constructor(options) {
10114
10145
  super(options);
10115
10146
  this.setStatusRetryHandlers(/* @__PURE__ */ new Map([[404, (statusCode) => this.statusHandler404(statusCode)]]));
@@ -10138,7 +10169,7 @@ var WorkerEndpoint = class extends Endpoint {
10138
10169
  }
10139
10170
  return super.disconnect(wait);
10140
10171
  }
10141
- statusHandler404(statusCode) {
10172
+ statusHandler404(_) {
10142
10173
  this._pipelineId = null;
10143
10174
  this._baseUrl = null;
10144
10175
  }
@@ -10191,10 +10222,17 @@ var WorkerEndpoint = class extends Endpoint {
10191
10222
  });
10192
10223
  if (response.status != 204) {
10193
10224
  const message = await response.text();
10194
- return Promise.reject(`Unexpected status ${response.status}: ${message}`);
10225
+ throw new Error(`Unexpected status ${response.status}: ${message}`);
10195
10226
  }
10196
10227
  if (this._pipeline) {
10197
10228
  this._pipeline.pop = pop;
10229
+ } else {
10230
+ this._pipeline = {
10231
+ id: this._pipelineId || "unknown",
10232
+ state: "idle",
10233
+ startTime: (/* @__PURE__ */ new Date()).toString(),
10234
+ pop
10235
+ };
10198
10236
  }
10199
10237
  }
10200
10238
  _authenticationHeaders(session) {
@@ -10414,11 +10452,11 @@ var WorkerEndpoint = class extends Endpoint {
10414
10452
  throw e;
10415
10453
  }
10416
10454
  }
10417
- jobDone(job) {
10455
+ jobDone(_) {
10418
10456
  this._limit?.release();
10419
10457
  this.updateState();
10420
10458
  }
10421
- jobStatus(job, statusCode) {
10459
+ jobStatus(_, statusCode) {
10422
10460
  if (statusCode == 404) {
10423
10461
  this.statusHandler404(statusCode);
10424
10462
  } else if (statusCode == 401) {
@@ -10426,15 +10464,20 @@ var WorkerEndpoint = class extends Endpoint {
10426
10464
  }
10427
10465
  }
10428
10466
  async reconnect() {
10429
- if (!this._client) {
10430
- return Promise.reject("endpoint not initialized");
10431
- }
10432
- let config_url;
10433
10467
  if (this.options().popId == "transient" /* Transient */) {
10434
- config_url = `${this.eyepopUrl()}/workers/config`;
10468
+ await this.startComputeSession();
10469
+ this._pipelineId = await this.startTransientPipeline();
10435
10470
  } else {
10436
- config_url = `${this.eyepopUrl()}/pops/${this.options().popId}/config?auto_start=false`;
10471
+ await this.startWebApiSessionWithPopId();
10472
+ }
10473
+ this.updateState();
10474
+ return Promise.resolve(this);
10475
+ }
10476
+ async startWebApiSessionWithPopId() {
10477
+ if (!this._client) {
10478
+ throw new Error("endpoint not initialized");
10437
10479
  }
10480
+ const config_url = `${this.eyepopWebApiUrl()}/pops/${this.options().popId}/config?auto_start=false`;
10438
10481
  const headers = {
10439
10482
  Authorization: await this.authorizationHeader()
10440
10483
  };
@@ -10458,11 +10501,11 @@ var WorkerEndpoint = class extends Endpoint {
10458
10501
  } else {
10459
10502
  this.updateState("Error" /* Error */, message);
10460
10503
  }
10461
- return Promise.reject(`Unexpected status ${response.status}: ${message}`);
10504
+ throw new Error(`Unexpected status ${response.status}: ${message}`);
10462
10505
  }
10463
10506
  let config = await response.json();
10464
10507
  if (!config.base_url && this.options().autoStart) {
10465
- const auto_start_config_url = `${this.eyepopUrl()}/pops/${this.options().popId}/config?auto_start=true`;
10508
+ const auto_start_config_url = `${this.eyepopWebApiUrl()}/pops/${this.options().popId}/config?auto_start=true`;
10466
10509
  this._requestLogger.debug("pop was not running, trying to autostart with: %s", auto_start_config_url);
10467
10510
  const headers2 = {
10468
10511
  Authorization: await this.authorizationHeader()
@@ -10473,7 +10516,7 @@ var WorkerEndpoint = class extends Endpoint {
10473
10516
  if (response.status != 200) {
10474
10517
  this.updateState("Error" /* Error */);
10475
10518
  const message = await response.text();
10476
- return Promise.reject(`Unexpected status ${response.status}: ${message}`);
10519
+ throw new Error(`Unexpected status ${response.status}: ${message}`);
10477
10520
  }
10478
10521
  config = await response.json();
10479
10522
  }
@@ -10481,17 +10524,11 @@ var WorkerEndpoint = class extends Endpoint {
10481
10524
  this._baseUrl = baseUrl.toString();
10482
10525
  if (this._baseUrl) {
10483
10526
  this._baseUrl = this._baseUrl.replace(/\/+$/, "");
10484
- if (this.options().popId == "transient" /* Transient */) {
10485
- this._pipelineId = await this.startTransientPipeline();
10486
- this._popName = this.options().popId || null;
10487
- } else {
10488
- this._pipelineId = config.pipeline_id;
10489
- this._popName = config.name;
10490
- }
10527
+ this._pipelineId = config.pipeline_id;
10528
+ this._popName = config.name;
10491
10529
  if (!this._pipelineId || !this._baseUrl) {
10492
- return Promise.reject(`Pop not started`);
10530
+ throw new Error("Pop not started");
10493
10531
  }
10494
- this._baseUrl = this._baseUrl.replace(/\/+$/, "");
10495
10532
  const get_url = `${this._baseUrl}/pipelines/${this._pipelineId}`;
10496
10533
  const headers2 = {
10497
10534
  Authorization: await this.authorizationHeader()
@@ -10502,7 +10539,7 @@ var WorkerEndpoint = class extends Endpoint {
10502
10539
  });
10503
10540
  if (response2.status > 200) {
10504
10541
  const message = await response2.text();
10505
- return Promise.reject(`Unexpected status ${response2.status}: ${message}`);
10542
+ throw new Error(`Unexpected status ${response2.status}: ${message}`);
10506
10543
  }
10507
10544
  this._pipeline = await response2.json();
10508
10545
  if (this.options().stopJobs) {
@@ -10519,18 +10556,95 @@ var WorkerEndpoint = class extends Endpoint {
10519
10556
  });
10520
10557
  if (response3.status >= 300) {
10521
10558
  const message = await response3.text();
10522
- return Promise.reject(`Unexpected status ${response3.status}: ${message}`);
10559
+ throw new Error(`Unexpected status ${response3.status}: ${message}`);
10523
10560
  }
10524
10561
  }
10525
10562
  }
10526
- this.updateState();
10527
- return Promise.resolve(this);
10563
+ }
10564
+ async startComputeSession() {
10565
+ if (!this._client) {
10566
+ throw new Error("endpoint not initialized");
10567
+ }
10568
+ let session = null;
10569
+ const sessionsUrl = `${this.eyepopUrl()}/v1/sessions`;
10570
+ this._requestLogger.debug("fetching sessions from: %s", sessionsUrl);
10571
+ const headers = {
10572
+ Authorization: await this.authorizationHeader()
10573
+ };
10574
+ let response = await this._client.fetch(sessionsUrl, {
10575
+ headers
10576
+ });
10577
+ let sessions;
10578
+ if (response.status == 404) {
10579
+ sessions = [];
10580
+ } else if (response.status != 200) {
10581
+ this.updateState("Error" /* Error */);
10582
+ const message = await response.text();
10583
+ throw new Error(`Unexpected status ${response.status} fetching compute sessions: ${message}`);
10584
+ } else {
10585
+ const response_content = await response.json();
10586
+ sessions = response_content;
10587
+ }
10588
+ if (sessions.length > 0) {
10589
+ this._logger.debug(`User has ${sessions.length} sessions, inspecting for active session`);
10590
+ for (let s of sessions) {
10591
+ if (!_WorkerEndpoint.SESSION_DEAD.has(s.session_status)) {
10592
+ session = s;
10593
+ this._logger.debug(`Use active session ${s.session_uuid} with pipeline ${s.pipeline_uuid}`);
10594
+ break;
10595
+ }
10596
+ }
10597
+ }
10598
+ if (!session) {
10599
+ this._requestLogger.debug("creating a new session at: %s", sessionsUrl);
10600
+ response = await this._client.fetch(sessionsUrl, {
10601
+ headers,
10602
+ method: "POST"
10603
+ });
10604
+ if (response.status != 200) {
10605
+ this.updateState("Error" /* Error */);
10606
+ const message = await response.text();
10607
+ throw new Error(`Unexpected status ${response.status} creating a compute session: ${message}`);
10608
+ } else {
10609
+ sessions = await response.json();
10610
+ }
10611
+ if (sessions.length == 0) {
10612
+ throw new Error("Unexpected, no compute session after attempt to create one");
10613
+ }
10614
+ session = sessions[0] || null;
10615
+ }
10616
+ if (!session) {
10617
+ throw new Error("unexpected undefined session");
10618
+ }
10619
+ let isReady = false;
10620
+ const deadline = Date.now() + _WorkerEndpoint.WAIT_FOR_IS_READY;
10621
+ while (!isReady) {
10622
+ const health_url = `${session.session_endpoint}/health`;
10623
+ response = await this._client.fetch(health_url, {
10624
+ headers
10625
+ });
10626
+ if (response.status < 300) {
10627
+ isReady = true;
10628
+ } else if (Date.now() > deadline) {
10629
+ throw new Error(`Created session ${session.session_uuid} did not become healthy after ${_WorkerEndpoint.WAIT_FOR_IS_READY / 1e3} seconds`);
10630
+ } else {
10631
+ this._logger.debug(`session ${session.session_uuid} health check status ${response.status}, wait and poll for update`);
10632
+ await sleep(_WorkerEndpoint.CHECK_FOR_IS_READY_INTERVAL);
10633
+ }
10634
+ }
10635
+ this._baseUrl = session.session_endpoint;
10636
+ this._pipeline = null;
10637
+ if (session.pipeline_uuid) {
10638
+ this._pipelineId = session.pipeline_uuid;
10639
+ } else {
10640
+ this._pipelineId = null;
10641
+ }
10528
10642
  }
10529
10643
  async startTransientPipeline() {
10530
10644
  const client = this._client;
10531
10645
  const baseUrl = this._baseUrl;
10532
10646
  if (client == null || baseUrl == null) {
10533
- return Promise.reject("endpoint not initialized");
10647
+ throw new Error("endpoint not initialized");
10534
10648
  }
10535
10649
  let pop;
10536
10650
  if (this._pipeline && this._pipeline.pop) {
@@ -10563,12 +10677,22 @@ var WorkerEndpoint = class extends Endpoint {
10563
10677
  });
10564
10678
  if (response.status != 200) {
10565
10679
  const message = await response.text();
10566
- return Promise.reject(`Unexpected status ${response.status}: ${message}`);
10680
+ throw new Error(`Unexpected status ${response.status}: ${message}`);
10567
10681
  }
10568
10682
  const result = await response.json();
10569
10683
  return result["id"];
10570
10684
  }
10571
10685
  };
10686
+ _WorkerEndpoint.SESSION_DEAD = /* @__PURE__ */ new Set([
10687
+ "error" /* ERROR */,
10688
+ "failed" /* FAILED */,
10689
+ "stopped" /* STOPPED */,
10690
+ "pipeline_error" /* PIPELINE_ERROR */,
10691
+ "unknown" /* UNKNOWN */
10692
+ ]);
10693
+ _WorkerEndpoint.WAIT_FOR_IS_READY = 60 * 1e3;
10694
+ _WorkerEndpoint.CHECK_FOR_IS_READY_INTERVAL = 250;
10695
+ var WorkerEndpoint = _WorkerEndpoint;
10572
10696
 
10573
10697
  // shims/websockets.ts
10574
10698
  var createWebSocket;
@@ -10698,6 +10822,8 @@ var TranscodeMode = /* @__PURE__ */ ((TranscodeMode2) => {
10698
10822
  })(TranscodeMode || {});
10699
10823
  var ModelType = /* @__PURE__ */ ((ModelType2) => {
10700
10824
  ModelType2["epdet_b1"] = "epdet_b1";
10825
+ ModelType2["imported"] = "imported";
10826
+ ModelType2["vlm_ability"] = "vlm_ability";
10701
10827
  return ModelType2;
10702
10828
  })(ModelType || {});
10703
10829
  var ModelTask = /* @__PURE__ */ ((ModelTask2) => {
@@ -10801,6 +10927,11 @@ var EvaluationStatus = /* @__PURE__ */ ((EvaluationStatus2) => {
10801
10927
  EvaluationStatus2["failed"] = "failed";
10802
10928
  return EvaluationStatus2;
10803
10929
  })(EvaluationStatus || {});
10930
+ var VlmAbilityStatus = /* @__PURE__ */ ((VlmAbilityStatus2) => {
10931
+ VlmAbilityStatus2["draft"] = "draft";
10932
+ VlmAbilityStatus2["published"] = "published";
10933
+ return VlmAbilityStatus2;
10934
+ })(VlmAbilityStatus || {});
10804
10935
 
10805
10936
  // data/jobs.ts
10806
10937
  var InferAssetJob = class {
@@ -10996,9 +11127,8 @@ var DataEndpoint = class extends Endpoint {
10996
11127
  if (!this._client) {
10997
11128
  return Promise.reject("endpoint not initialized");
10998
11129
  }
10999
- this._logger.warn("AAA", this.vlmApiUrl);
11000
11130
  const accountUuidQuery = this._accountId ? `?account_uuid=${this._accountId}` : "";
11001
- const config_url = `${this.eyepopUrl()}/configs${accountUuidQuery}`;
11131
+ const config_url = `${this.eyepopUrl()}/v1/configs${accountUuidQuery}`;
11002
11132
  let headers = {
11003
11133
  Authorization: await this.authorizationHeader()
11004
11134
  };
@@ -11576,7 +11706,7 @@ var DataEndpoint = class extends Endpoint {
11576
11706
  throw e;
11577
11707
  }
11578
11708
  }
11579
- jobDone(job) {
11709
+ jobDone(_job) {
11580
11710
  this._limit?.release();
11581
11711
  }
11582
11712
  async dispatchChangeEvent(change_event) {
@@ -11596,6 +11726,7 @@ var DataEndpoint = class extends Endpoint {
11596
11726
  for (let handler of this._account_event_handlers) {
11597
11727
  await handler(change_event);
11598
11728
  }
11729
+ break;
11599
11730
  // dataset event types
11600
11731
  case "asset_added" /* asset_added */:
11601
11732
  case "asset_removed" /* asset_removed */:
@@ -11616,6 +11747,83 @@ var DataEndpoint = class extends Endpoint {
11616
11747
  break;
11617
11748
  }
11618
11749
  }
11750
+ // Vlm Ability Management
11751
+ async listVlmAbilityGroups() {
11752
+ return this.request(`/vlm_ability_groups?account_uuid=${this._accountId}`, {
11753
+ method: "GET"
11754
+ });
11755
+ }
11756
+ async createVlmAbilityGroup(create) {
11757
+ return this.request(`/vlm_ability_groups?account_uuid=${this._accountId}`, {
11758
+ method: "POST",
11759
+ body: JSON.stringify(create),
11760
+ headers: { "Content-Type": "application/json" }
11761
+ });
11762
+ }
11763
+ async getVlmAbilityGroup(vlm_ability_group_uuid) {
11764
+ return this.request(`/vlm_ability_groups/${vlm_ability_group_uuid}`, {
11765
+ method: "GET"
11766
+ });
11767
+ }
11768
+ async deleteVlmAbilityGroup(vlm_ability_group_uuid) {
11769
+ return this.request(`/vlm_ability_groups/${vlm_ability_group_uuid}`, {
11770
+ method: "DELETE"
11771
+ });
11772
+ }
11773
+ async updateVlmAbilityGroup(vlm_ability_group_uuid, update) {
11774
+ return this.request(`/vlm_ability_groups/${vlm_ability_group_uuid}`, {
11775
+ method: "PATCH",
11776
+ body: JSON.stringify(update),
11777
+ headers: { "Content-Type": "application/json" }
11778
+ });
11779
+ }
11780
+ async listVlmAbilities() {
11781
+ return this.request(`/vlm_abilities?account_uuid=${this._accountId}`, {
11782
+ method: "GET"
11783
+ });
11784
+ }
11785
+ async createVlmAbility(create, vlm_ability_group_uuid) {
11786
+ const groupQuery = vlm_ability_group_uuid ? `&vlm_ability_group_uuid=${vlm_ability_group_uuid}` : "";
11787
+ return this.request(`/vlm_abilities?account_uuid=${this._accountId}${groupQuery}`, {
11788
+ method: "POST",
11789
+ body: JSON.stringify(create),
11790
+ headers: { "Content-Type": "application/json" }
11791
+ });
11792
+ }
11793
+ async getVlmAbility(vlm_ability_uuid) {
11794
+ return this.request(`/vlm_abilities/${vlm_ability_uuid}`, {
11795
+ method: "GET"
11796
+ });
11797
+ }
11798
+ async deleteVlmAbility(vlm_ability_uuid) {
11799
+ return this.request(`/vlm_abilities/${vlm_ability_uuid}`, {
11800
+ method: "DELETE"
11801
+ });
11802
+ }
11803
+ async updateVlmAbility(vlm_ability_uuid, update) {
11804
+ return this.request(`/vlm_abilities/${vlm_ability_uuid}`, {
11805
+ method: "PATCH",
11806
+ body: JSON.stringify(update),
11807
+ headers: { "Content-Type": "application/json" }
11808
+ });
11809
+ }
11810
+ async publishVlmAbility(vlm_ability_uuid, alias_name, tag_name) {
11811
+ const alias_name_query = alias_name ? `alias_name=${encodeURIComponent(alias_name)}&` : "";
11812
+ const tag_name_query = tag_name ? `tag_name=${encodeURIComponent(tag_name)}&` : "";
11813
+ return this.request(`/vlm_abilities/${vlm_ability_uuid}/publish?${alias_name_query}${tag_name_query}`, {
11814
+ method: "POST"
11815
+ });
11816
+ }
11817
+ async addVlmAbilityAlias(vlm_ability_uuid, alias_name, tag_name) {
11818
+ return this.request(`/vlm_abilities/${vlm_ability_uuid}/alias/${encodeURIComponent(alias_name)}/tag/${tag_name ? encodeURIComponent(tag_name) : ""}`, {
11819
+ method: "POST"
11820
+ });
11821
+ }
11822
+ async removeVlmAbilityAlias(vlm_ability_uuid, alias_name, tag_name) {
11823
+ return this.request(`/vlm_abilities/${vlm_ability_uuid}/alias/${encodeURIComponent(alias_name)}/tag/${encodeURIComponent(tag_name)}`, {
11824
+ method: "DELETE"
11825
+ });
11826
+ }
11619
11827
  };
11620
11828
 
11621
11829
  // worker/webrtc_whep.ts
@@ -11680,7 +11888,7 @@ var WebrtcWhep = class extends WebrtcBase {
11680
11888
  return new Promise(async (resolve, reject) => {
11681
11889
  pc.ontrack = (evt) => {
11682
11890
  this._requestLogger.debug(`new track: ${evt.track.kind}`);
11683
- this._stream = evt.streams[0];
11891
+ this._stream = evt.streams[0] || null;
11684
11892
  resolve(this);
11685
11893
  };
11686
11894
  pc.oniceconnectionstatechange = () => {
@@ -11716,21 +11924,24 @@ var stringToBooleanSafe = (str) => {
11716
11924
  };
11717
11925
  var EyePop;
11718
11926
  ((EyePop2) => {
11719
- const envSecretKey = readEnv("EYEPOP_SECRET_KEY");
11720
- const defaultAuth = envSecretKey ? {
11721
- secretKey: envSecretKey
11927
+ const envApiKey = readEnv("EYEPOP_API_KEY");
11928
+ const defaultAuth = envApiKey ? {
11929
+ apiKey: envApiKey
11722
11930
  } : void 0;
11723
11931
  EyePop2.endpoint = workerEndpoint;
11724
11932
  function workerEndpoint(opts = {}) {
11725
11933
  if (opts.isLocalMode === void 0) {
11726
11934
  opts.isLocalMode = stringToBooleanSafe(readEnv("EYEPOP_LOCAL_MODE"));
11727
11935
  }
11728
- _fill_default_options(opts, opts.isLocalMode ? "http://127.0.0.1:8080" : void 0);
11936
+ if (opts.isLocalMode) {
11937
+ opts.eyepopUrl = "http://127.0.0.1:8080";
11938
+ }
11939
+ _fill_default_options(opts);
11729
11940
  if (opts.auth === void 0) {
11730
11941
  if (opts.isLocalMode) {
11731
11942
  opts.auth = { isLocal: true };
11732
11943
  } else {
11733
- throw new Error("auth option or EYEPOP_SECRET_KEY environment variable is required");
11944
+ throw new Error("auth option or EYEPOP_API_KEY environment variable is required");
11734
11945
  }
11735
11946
  }
11736
11947
  if (opts.popId === void 0) {
@@ -11757,7 +11968,7 @@ var EyePop;
11757
11968
  function dataEndpoint(opts = {}) {
11758
11969
  _fill_default_options(opts);
11759
11970
  if (opts.auth === void 0) {
11760
- throw new Error("auth option or EYEPOP_SECRET_KEY environment variable is required");
11971
+ throw new Error("auth option or EYEPOP_API_KEY environment variable is required");
11761
11972
  }
11762
11973
  if (opts.accountId === void 0) {
11763
11974
  opts.accountId = readEnv("EYEPOP_ACCOUNT_ID");
@@ -11772,20 +11983,23 @@ var EyePop;
11772
11983
  return new DataEndpoint(opts);
11773
11984
  }
11774
11985
  EyePop2.dataEndpoint = dataEndpoint;
11775
- function _fill_default_options(opts, default_eyepop_url = "https://api.eyepop.ai") {
11776
- if (opts.auth === void 0) {
11986
+ function _fill_default_options(opts) {
11987
+ if (!opts.auth) {
11777
11988
  opts.auth = defaultAuth;
11778
11989
  }
11779
- if (opts.eyepopUrl === void 0) {
11780
- opts.eyepopUrl = readEnv("EYEPOP_URL") || default_eyepop_url;
11990
+ if (!opts.eyepopUrl && opts.auth && opts.auth.session && opts.auth.session.eyepopUrl) {
11991
+ opts.eyepopUrl = opts.auth.session.eyepopUrl;
11781
11992
  }
11782
- if (opts.jobQueueLength === void 0) {
11783
- opts.jobQueueLength = 1024;
11993
+ if (!opts.eyepopUrl) {
11994
+ opts.eyepopUrl = readEnv("EYEPOP_URL");
11784
11995
  }
11785
- if (opts.auth !== void 0) {
11996
+ if (!opts.eyepopUrl) {
11997
+ opts.eyepopUrl = "https://compute.eyepop.ai";
11998
+ }
11999
+ if (opts.auth) {
11786
12000
  if (opts.auth.oAuth2 !== void 0) {
11787
12001
  if (typeof opts.auth.oAuth2 === "boolean") {
11788
- if (opts.eyepopUrl.startsWith("https://web-api.staging.eyepop.xyz")) {
12002
+ if (opts.eyepopUrl && opts.eyepopUrl.match(/https:(.*).staging.eyepop.xyz/i)) {
11789
12003
  opts.auth = {
11790
12004
  oAuth2: {
11791
12005
  domain: "dev-eyepop.us.auth0.com",
@@ -11806,11 +12020,9 @@ var EyePop;
11806
12020
  }
11807
12021
  }
11808
12022
  }
11809
- if (opts.auth.session !== void 0) {
11810
- if (opts.auth.session.eyepopUrl) {
11811
- opts.eyepopUrl = opts.auth.session.eyepopUrl;
11812
- }
11813
- }
12023
+ }
12024
+ if (!opts.jobQueueLength) {
12025
+ opts.jobQueueLength = 128;
11814
12026
  }
11815
12027
  }
11816
12028
  })(EyePop || (EyePop = {}));
@@ -11851,12 +12063,14 @@ export {
11851
12063
  PopComponentType,
11852
12064
  PredictionVersion,
11853
12065
  Semaphore,
12066
+ SessionStatus,
11854
12067
  Stream,
11855
12068
  TranscodeMode,
11856
12069
  TransientPopId,
11857
12070
  UploadJob,
11858
12071
  UserReview,
11859
12072
  VideoMode,
12073
+ VlmAbilityStatus,
11860
12074
  WebrtcBase,
11861
12075
  WebrtcWhep,
11862
12076
  WebrtcWhip,