@eyepop.ai/eyepop 1.18.0 → 2.0.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.
@@ -8831,25 +8831,6 @@ var VideoMode = /* @__PURE__ */ ((VideoMode2) => {
8831
8831
  VideoMode2["BUFFER"] = "buffer";
8832
8832
  return VideoMode2;
8833
8833
  })(VideoMode || {});
8834
- var ModelFormat = /* @__PURE__ */ ((ModelFormat2) => {
8835
- ModelFormat2["TensorFlowLite"] = "TensorFlowLite";
8836
- ModelFormat2["TensorFlowGraphDef"] = "TensorFlowGraphDef";
8837
- ModelFormat2["ONNX"] = "ONNX";
8838
- ModelFormat2["TorchScript"] = "TorchScript";
8839
- ModelFormat2["TorchScriptCpu"] = "TorchScriptCpu";
8840
- ModelFormat2["TorchScriptCuda"] = "TorchScriptCuda";
8841
- ModelFormat2["PyTorch"] = "PyTorch";
8842
- ModelFormat2["ModelLess"] = "ModelLess";
8843
- return ModelFormat2;
8844
- })(ModelFormat || {});
8845
- var ModelPrecisionType = /* @__PURE__ */ ((ModelPrecisionType2) => {
8846
- ModelPrecisionType2["float32"] = "float32";
8847
- ModelPrecisionType2["float16"] = "float16";
8848
- ModelPrecisionType2["int32"] = "int32";
8849
- ModelPrecisionType2["int8"] = "int8";
8850
- ModelPrecisionType2["uint8"] = "uint8";
8851
- return ModelPrecisionType2;
8852
- })(ModelPrecisionType || {});
8853
8834
  var PopComponentType = /* @__PURE__ */ ((PopComponentType2) => {
8854
8835
  PopComponentType2["FORWARD"] = "forward";
8855
8836
  PopComponentType2["INFERENCE"] = "inference";
@@ -9877,7 +9858,6 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9877
9858
  popId: workerOptions.popId,
9878
9859
  baseUrl: void 0,
9879
9860
  pipelineId: void 0,
9880
- sandboxId: void 0,
9881
9861
  authenticationHeaders: () => {
9882
9862
  return { Authorization: `Bearer ${accessToken}` };
9883
9863
  }
@@ -10117,15 +10097,6 @@ var WorkerEndpoint = class extends Endpoint {
10117
10097
  this._pipelineId = null;
10118
10098
  this._popName = null;
10119
10099
  this._pipeline = null;
10120
- this._sandboxId = null;
10121
- const sessionAuth = options.auth;
10122
- if (sessionAuth !== void 0 && sessionAuth.session !== void 0) {
10123
- const workerSession = sessionAuth.session;
10124
- if (workerSession.sandboxId) {
10125
- this._sandboxId = workerSession.sandboxId;
10126
- this.options().isSandbox = true;
10127
- }
10128
- }
10129
10100
  }
10130
10101
  options() {
10131
10102
  return this._options;
@@ -10145,21 +10116,6 @@ var WorkerEndpoint = class extends Endpoint {
10145
10116
  this._logger.info(`stopping pipeline failed, status ${response?.status}: ${message}`);
10146
10117
  }
10147
10118
  }
10148
- if (this._sandboxId && this._baseUrl) {
10149
- const sandboxUrl = `${this._baseUrl}/sandboxes/${this._sandboxId}`;
10150
- const headers = {
10151
- Authorization: await this.authorizationHeader()
10152
- };
10153
- let response = await this._client?.fetch(sandboxUrl, {
10154
- method: "DELETE",
10155
- headers
10156
- });
10157
- if (response?.status != 204) {
10158
- const message = await response?.text();
10159
- this._logger.info(`disconnecting sandbox failed, status ${response?.status}: ${message}`);
10160
- }
10161
- this._sandboxId = null;
10162
- }
10163
10119
  return super.disconnect(wait);
10164
10120
  }
10165
10121
  statusHandler404(statusCode) {
@@ -10181,7 +10137,6 @@ var WorkerEndpoint = class extends Endpoint {
10181
10137
  popId: this.options().popId,
10182
10138
  baseUrl: this._baseUrl,
10183
10139
  pipelineId: this._pipelineId,
10184
- sandboxId: this._sandboxId ?? void 0,
10185
10140
  authenticationHeaders: () => this._authenticationHeaders(session)
10186
10141
  };
10187
10142
  }
@@ -10225,94 +10180,6 @@ var WorkerEndpoint = class extends Endpoint {
10225
10180
  _authenticationHeaders(session) {
10226
10181
  return this._options.auth.isLocal !== void 0 ? {} : { Authorization: `Bearer ${session.accessToken}` };
10227
10182
  }
10228
- /**
10229
- * @deprecated use pop() instead
10230
- */
10231
- popComp() {
10232
- if (this._pipeline) {
10233
- return this._pipeline.inferPipeline ?? null;
10234
- } else {
10235
- return null;
10236
- }
10237
- }
10238
- /**
10239
- * @deprecated use changePop() instead
10240
- */
10241
- async changePopComp(popComp, modelRefs = []) {
10242
- const client = this._client;
10243
- const baseUrl = this._baseUrl;
10244
- if (!baseUrl || !client) {
10245
- return Promise.reject("endpoint not connected, use connect()");
10246
- }
10247
- const body = {
10248
- pipeline: popComp,
10249
- modelRefs
10250
- };
10251
- let response = await this.fetchWithRetry(async () => {
10252
- const session = await this.session();
10253
- let headers = {
10254
- ...this._authenticationHeaders(session),
10255
- "Content-Type": "application/json"
10256
- };
10257
- const patch_url = `${session.baseUrl}/pipelines/${session.pipelineId}/inferencePipeline`;
10258
- return client.fetch(patch_url, {
10259
- method: "PATCH",
10260
- body: JSON.stringify(body),
10261
- headers
10262
- });
10263
- });
10264
- if (response.status != 204) {
10265
- const message = await response.text();
10266
- return Promise.reject(`Unexpected status ${response.status}: ${message}`);
10267
- }
10268
- if (this._pipeline) {
10269
- this._pipeline.inferPipeline = popComp;
10270
- this._pipeline.modelRefs = modelRefs;
10271
- }
10272
- }
10273
- /**
10274
- * @deprecated use pop() instead
10275
- */
10276
- postTransform() {
10277
- if (this._pipeline) {
10278
- return this._pipeline.postTransform;
10279
- } else {
10280
- return null;
10281
- }
10282
- }
10283
- /**
10284
- * @deprecated use changePop() instead
10285
- */
10286
- async changePostTransform(postTransform) {
10287
- const client = this._client;
10288
- const baseUrl = this._baseUrl;
10289
- if (!baseUrl || !client) {
10290
- return Promise.reject("endpoint not connected, use connect()");
10291
- }
10292
- const body = {
10293
- transform: postTransform
10294
- };
10295
- let response = await this.fetchWithRetry(async () => {
10296
- const session = await this.session();
10297
- let headers = {
10298
- ...this._authenticationHeaders(session),
10299
- "Content-Type": "application/json"
10300
- };
10301
- const patch_url = `${session.baseUrl}/pipelines/${session.pipelineId}/postTransform`;
10302
- return client.fetch(patch_url, {
10303
- method: "PATCH",
10304
- body: JSON.stringify(body),
10305
- headers
10306
- });
10307
- });
10308
- if (response.status != 204) {
10309
- const message = await response.text();
10310
- return Promise.reject(`Unexpected status ${response.status}: ${message}`);
10311
- }
10312
- if (this._pipeline) {
10313
- this._pipeline.postTransform = postTransform;
10314
- }
10315
- }
10316
10183
  popId() {
10317
10184
  return this.options().popId || null;
10318
10185
  }
@@ -10594,24 +10461,6 @@ var WorkerEndpoint = class extends Endpoint {
10594
10461
  this._baseUrl = baseUrl.toString();
10595
10462
  if (this._baseUrl) {
10596
10463
  this._baseUrl = this._baseUrl.replace(/\/+$/, "");
10597
- if (this.options().isSandbox && this._sandboxId === null) {
10598
- const headers3 = {
10599
- Authorization: await this.authorizationHeader()
10600
- };
10601
- const createSandboxUrl = `${this._baseUrl}/sandboxes`;
10602
- const response3 = await this._client.fetch(createSandboxUrl, {
10603
- method: "POST",
10604
- headers: headers3
10605
- });
10606
- if (!response3.ok) {
10607
- const message = await response3.text();
10608
- return Promise.reject(`Unexpected status ${response3.status}: ${message}`);
10609
- }
10610
- const responseJson = await response3.json();
10611
- if (responseJson) {
10612
- this._sandboxId = responseJson;
10613
- }
10614
- }
10615
10464
  if (this.options().popId == "transient" /* Transient */) {
10616
10465
  this._pipelineId = await this.startTransientPipeline();
10617
10466
  this._popName = this.options().popId || null;
@@ -10660,7 +10509,6 @@ var WorkerEndpoint = class extends Endpoint {
10660
10509
  async startTransientPipeline() {
10661
10510
  const client = this._client;
10662
10511
  const baseUrl = this._baseUrl;
10663
- const sandboxId = this._sandboxId;
10664
10512
  if (client == null || baseUrl == null) {
10665
10513
  return Promise.reject("endpoint not initialized");
10666
10514
  }
@@ -10681,12 +10529,7 @@ var WorkerEndpoint = class extends Endpoint {
10681
10529
  logging: ["out_meta"],
10682
10530
  videoOutput: "no_output"
10683
10531
  };
10684
- let post_url;
10685
- if (sandboxId) {
10686
- post_url = `${baseUrl.replace(/\/+$/, "")}/pipelines?sandboxId=${sandboxId}`;
10687
- } else {
10688
- post_url = `${baseUrl.replace(/\/+$/, "")}/pipelines`;
10689
- }
10532
+ const post_url = `${baseUrl.replace(/\/+$/, "")}/pipelines`;
10690
10533
  let response = await this.fetchWithRetry(async () => {
10691
10534
  let headers = {
10692
10535
  "Content-Type": "application/json",
@@ -10705,148 +10548,6 @@ var WorkerEndpoint = class extends Endpoint {
10705
10548
  const result = await response.json();
10706
10549
  return result["id"];
10707
10550
  }
10708
- async manifest() {
10709
- this._logger.warn("getManifest for development use only");
10710
- const client = this._client;
10711
- const baseUrl = this._baseUrl;
10712
- if (!baseUrl || !client) {
10713
- return Promise.reject("endpoint not connected, use connect()");
10714
- }
10715
- let get_path;
10716
- if (this._sandboxId === null) {
10717
- get_path = `${baseUrl}/models/sources`;
10718
- } else {
10719
- get_path = `${baseUrl}/models/sources?sandboxId=${this._sandboxId}`;
10720
- }
10721
- let response = await this.fetchWithRetry(async () => {
10722
- const session = await this.session();
10723
- let headers = {
10724
- ...this._authenticationHeaders(session),
10725
- "Content-Type": "application/json"
10726
- };
10727
- return client.fetch(get_path, { headers });
10728
- });
10729
- if (!response.ok) {
10730
- const message = await response.text();
10731
- return Promise.reject(`Unexpected status ${response.status}: ${message}`);
10732
- }
10733
- return await response.json();
10734
- }
10735
- async models() {
10736
- this._logger.warn("listModels for development use only");
10737
- const client = this._client;
10738
- const baseUrl = this._baseUrl;
10739
- if (!baseUrl || !client) {
10740
- return Promise.reject("endpoint not connected, use connect()");
10741
- }
10742
- let get_path;
10743
- if (this._sandboxId === null) {
10744
- get_path = `${baseUrl}/models/instances`;
10745
- } else {
10746
- get_path = `${baseUrl}/models/instances?sandboxId=${this._sandboxId}`;
10747
- }
10748
- let response = await this.fetchWithRetry(async () => {
10749
- const session = await this.session();
10750
- let headers = {
10751
- ...this._authenticationHeaders(session),
10752
- "Content-Type": "application/json"
10753
- };
10754
- return client.fetch(get_path, { headers });
10755
- });
10756
- if (!response.ok) {
10757
- const message = await response.text();
10758
- return Promise.reject(`Unexpected status ${response.status}: ${message}`);
10759
- }
10760
- const result = await response.json();
10761
- return result;
10762
- }
10763
- async changeManifest(manifests) {
10764
- this._logger.warn("setManifest for development use only");
10765
- const client = this._client;
10766
- const baseUrl = this._baseUrl;
10767
- if (!baseUrl || !client) {
10768
- return Promise.reject("endpoint not connected, use connect()");
10769
- }
10770
- let put_url;
10771
- if (this._sandboxId === null) {
10772
- put_url = `${baseUrl}/models/sources`;
10773
- } else {
10774
- put_url = `${baseUrl}/models/sources?sandboxId=${this._sandboxId}`;
10775
- }
10776
- let response = await this.fetchWithRetry(async () => {
10777
- const session = await this.session();
10778
- let headers = {
10779
- ...this._authenticationHeaders(session),
10780
- "Content-Type": "application/json"
10781
- };
10782
- return client.fetch(put_url, {
10783
- method: "PUT",
10784
- body: JSON.stringify(manifests),
10785
- headers
10786
- });
10787
- });
10788
- if (!response.ok) {
10789
- const message = await response.text();
10790
- return Promise.reject(`Unexpected status ${response.status}: ${message}`);
10791
- }
10792
- }
10793
- async loadModel(model) {
10794
- this._logger.warn("loadModel for development use only");
10795
- const client = this._client;
10796
- const baseUrl = this._baseUrl;
10797
- if (!baseUrl || !client) {
10798
- return Promise.reject("endpoint not connected, use connect()");
10799
- }
10800
- let post_url;
10801
- if (this._sandboxId === null) {
10802
- post_url = `${baseUrl}/models/instances`;
10803
- } else {
10804
- post_url = `${baseUrl}/models/instances?sandboxId=${this._sandboxId}`;
10805
- }
10806
- let response = await this.fetchWithRetry(async () => {
10807
- const session = await this.session();
10808
- let headers = {
10809
- ...this._authenticationHeaders(session),
10810
- "Content-Type": "application/json"
10811
- };
10812
- return client.fetch(post_url, {
10813
- method: "POST",
10814
- body: JSON.stringify(model),
10815
- headers
10816
- });
10817
- });
10818
- if (!response.ok) {
10819
- const message = await response.text();
10820
- return Promise.reject(`Unexpected status ${response.status}: ${message}`);
10821
- }
10822
- return await response.json();
10823
- }
10824
- async unloadModel(modelId) {
10825
- this._logger.warn("purgeModel for development use only");
10826
- const client = this._client;
10827
- const baseUrl = this._baseUrl;
10828
- if (!baseUrl || !client) {
10829
- return Promise.reject("endpoint not connected, use connect()");
10830
- }
10831
- let delete_url;
10832
- if (this._sandboxId === null) {
10833
- delete_url = `${baseUrl}/models/instances/${modelId}`;
10834
- } else {
10835
- delete_url = `${baseUrl}/models/instances/${modelId}?sandboxId=${this._sandboxId}`;
10836
- }
10837
- let response = await this.fetchWithRetry(async () => {
10838
- const session = await this.session();
10839
- let headers = {
10840
- ...this._authenticationHeaders(session),
10841
- "Content-Type": "application/json"
10842
- };
10843
- return client.fetch(delete_url, { method: "DELETE", headers });
10844
- });
10845
- if (!response.ok) {
10846
- const message = await response.text();
10847
- return Promise.reject(`Unexpected status ${response.status}: ${message}`);
10848
- }
10849
- }
10850
10551
  };
10851
10552
 
10852
10553
  // shims/websockets.ts
@@ -11020,6 +10721,25 @@ var WorkflowPhase = /* @__PURE__ */ ((WorkflowPhase3) => {
11020
10721
  WorkflowPhase3["error"] = "Error";
11021
10722
  return WorkflowPhase3;
11022
10723
  })(WorkflowPhase || {});
10724
+ var ModelFormat = /* @__PURE__ */ ((ModelFormat3) => {
10725
+ ModelFormat3["TensorFlowLite"] = "TensorFlowLite";
10726
+ ModelFormat3["TensorFlowGraphDef"] = "TensorFlowGraphDef";
10727
+ ModelFormat3["ONNX"] = "ONNX";
10728
+ ModelFormat3["TorchScript"] = "TorchScript";
10729
+ ModelFormat3["TorchScriptCpu"] = "TorchScriptCpu";
10730
+ ModelFormat3["TorchScriptCuda"] = "TorchScriptCuda";
10731
+ ModelFormat3["PyTorch"] = "PyTorch";
10732
+ ModelFormat3["ModelLess"] = "ModelLess";
10733
+ return ModelFormat3;
10734
+ })(ModelFormat || {});
10735
+ var ModelPrecisionType = /* @__PURE__ */ ((ModelPrecisionType2) => {
10736
+ ModelPrecisionType2["float32"] = "float32";
10737
+ ModelPrecisionType2["float16"] = "float16";
10738
+ ModelPrecisionType2["int32"] = "int32";
10739
+ ModelPrecisionType2["int8"] = "int8";
10740
+ ModelPrecisionType2["uint8"] = "uint8";
10741
+ return ModelPrecisionType2;
10742
+ })(ModelPrecisionType || {});
11023
10743
 
11024
10744
  // data/data_endpoint.ts
11025
10745
  var WS_INITIAL_RECONNECT_DELAY = 1e3;