@camstack/addon-pipeline 0.1.10 → 0.1.12

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.
Files changed (46) hide show
  1. package/assets/icon.svg +6 -0
  2. package/dist/audio-analyzer/index.js +16 -16
  3. package/dist/audio-analyzer/index.mjs +1 -1
  4. package/dist/audio-codec-nodeav/index.js +7 -7
  5. package/dist/audio-codec-nodeav/index.mjs +1 -1
  6. package/dist/decoder-nodeav/index.js +12 -12
  7. package/dist/decoder-nodeav/index.mjs +1 -1
  8. package/dist/detection-pipeline/index.js +45 -45
  9. package/dist/detection-pipeline/index.js.map +1 -1
  10. package/dist/detection-pipeline/index.mjs +1 -1
  11. package/dist/index-BhOycEVH.js +13867 -0
  12. package/dist/index-BhOycEVH.js.map +1 -0
  13. package/dist/index-FxfFGsiL.mjs +13868 -0
  14. package/dist/index-FxfFGsiL.mjs.map +1 -0
  15. package/dist/motion-wasm/index.js +8 -8
  16. package/dist/motion-wasm/index.mjs +1 -1
  17. package/dist/pipeline-runner/index.js +76 -77
  18. package/dist/pipeline-runner/index.js.map +1 -1
  19. package/dist/pipeline-runner/index.mjs +50 -51
  20. package/dist/pipeline-runner/index.mjs.map +1 -1
  21. package/dist/stream-broker/@mf-types.zip +0 -0
  22. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-ChoHjdk6.mjs +17 -0
  23. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-BvJPhiY_.mjs +20 -0
  24. package/dist/stream-broker/_stub.js +1 -1
  25. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-BTj1RQPs.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-Czwg8GUO.mjs} +6 -6
  26. package/dist/stream-broker/{hostInit-wnZIaWA5.mjs → hostInit-fG6oFw4t.mjs} +6 -6
  27. package/dist/stream-broker/{index-DadYrR5H.mjs → index-BOmtakNy.mjs} +67 -44
  28. package/dist/stream-broker/{index-BQ_NNiX0.mjs → index-Bpv0NSqI.mjs} +5414 -5170
  29. package/dist/stream-broker/{index-Dwc0KrUN.mjs → index-l13fl8lu.mjs} +4249 -4164
  30. package/dist/stream-broker/index.js +521 -110
  31. package/dist/stream-broker/index.js.map +1 -1
  32. package/dist/stream-broker/index.mjs +426 -15
  33. package/dist/stream-broker/index.mjs.map +1 -1
  34. package/dist/stream-broker/remoteEntry.js +1 -1
  35. package/package.json +24 -9
  36. package/python/postprocessors/__pycache__/__init__.cpython-312.pyc +0 -0
  37. package/python/postprocessors/__pycache__/arcface.cpython-312.pyc +0 -0
  38. package/python/postprocessors/__pycache__/ctc.cpython-312.pyc +0 -0
  39. package/python/postprocessors/__pycache__/saliency.cpython-312.pyc +0 -0
  40. package/python/postprocessors/__pycache__/scrfd.cpython-312.pyc +0 -0
  41. package/python/postprocessors/__pycache__/softmax.cpython-312.pyc +0 -0
  42. package/python/postprocessors/__pycache__/yamnet.cpython-312.pyc +0 -0
  43. package/python/postprocessors/__pycache__/yolo.cpython-312.pyc +0 -0
  44. package/python/postprocessors/__pycache__/yolo_seg.cpython-312.pyc +0 -0
  45. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-ezH__dL2.mjs +0 -17
  46. package/dist/stream-broker/__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-ocGWYEqu.mjs +0 -20
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="#0ea5e9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2
+ <path d="M3 6a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>
3
+ <path d="M13 16a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2z"/>
4
+ <path d="M7 10v4"/>
5
+ <path d="M7 18h6"/>
6
+ </svg>
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  mod
23
23
  ));
24
24
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
25
- const types = require("@camstack/types");
25
+ const index = require("../index-BhOycEVH.js");
26
26
  const path = require("node:path");
27
27
  const fs = require("node:fs");
28
28
  const core = require("@camstack/core");
@@ -51,8 +51,8 @@ async function createAudioPipeline(modelsDir, logger, options) {
51
51
  }
52
52
  return new YamnetOnnxPipeline(modelsDir, logger);
53
53
  }
54
- const YAMNET_MODEL_URL = `${types.HF_BASE_URL}/audioClassification/yamnet/onnx/camstack-yamnet.onnx`;
55
- const YAMNET_LABELS_URL = `${types.HF_BASE_URL}/audioClassification/yamnet/camstack-yamnet-labels.json`;
54
+ const YAMNET_MODEL_URL = `${index.HF_BASE_URL}/audioClassification/yamnet/onnx/camstack-yamnet.onnx`;
55
+ const YAMNET_LABELS_URL = `${index.HF_BASE_URL}/audioClassification/yamnet/camstack-yamnet-labels.json`;
56
56
  class YamnetOnnxPipeline {
57
57
  constructor(modelsDir, logger) {
58
58
  this.modelsDir = modelsDir;
@@ -306,7 +306,7 @@ class AppleSoundAnalysisPipeline {
306
306
  return outputPath;
307
307
  } catch (err) {
308
308
  this.log.error("Swift compilation failed — install Xcode Command Line Tools", {
309
- meta: { error: types.errMsg(err) }
309
+ meta: { error: index.errMsg(err) }
310
310
  });
311
311
  return null;
312
312
  }
@@ -439,7 +439,7 @@ class AudioAnalyzerProvider {
439
439
  const suppressed = this.suppressedClassifyErrors;
440
440
  this.suppressedClassifyErrors = 0;
441
441
  this.lastClassifyErrorMs = now;
442
- const msg = types.errMsg(err);
442
+ const msg = index.errMsg(err);
443
443
  const stack = err instanceof Error ? err.stack : void 0;
444
444
  this.log.warn("Audio classification failed", {
445
445
  tags: chunk.deviceId !== void 0 ? { deviceId: chunk.deviceId } : void 0,
@@ -487,7 +487,7 @@ class AudioAnalyzerProvider {
487
487
  this.classifyCount++;
488
488
  const macroAccum = /* @__PURE__ */ new Map();
489
489
  for (const c of result.classifications) {
490
- const macro = types.mapAudioLabelToMacro(c.className);
490
+ const macro = index.mapAudioLabelToMacro(c.className);
491
491
  if (!macro) continue;
492
492
  const prev = macroAccum.get(macro);
493
493
  if (!prev || c.score > prev.score) {
@@ -511,12 +511,12 @@ class AudioAnalyzerProvider {
511
511
  return this.reprobeImpl();
512
512
  }
513
513
  }
514
- class AudioAnalyzerAddon extends types.BaseAddon {
514
+ class AudioAnalyzerAddon extends index.BaseAddon {
515
515
  id = "audio-analyzer";
516
516
  provider = null;
517
517
  pipeline = null;
518
518
  constructor() {
519
- super(types.DEFAULT_AUDIO_ANALYZER_CONFIG);
519
+ super(index.DEFAULT_AUDIO_ANALYZER_CONFIG);
520
520
  }
521
521
  globalSettingsSchema() {
522
522
  return {
@@ -555,8 +555,8 @@ class AudioAnalyzerAddon extends types.BaseAddon {
555
555
  type: "select",
556
556
  key: "audioBackend",
557
557
  label: "Audio backend",
558
- options: types.AUDIO_BACKEND_CHOICES.map((o) => ({ value: o.value, label: o.label })),
559
- default: types.DEFAULT_AUDIO_ANALYZER_CONFIG.audioBackend,
558
+ options: index.AUDIO_BACKEND_CHOICES.map((o) => ({ value: o.value, label: o.label })),
559
+ default: index.DEFAULT_AUDIO_ANALYZER_CONFIG.audioBackend,
560
560
  immediate: true,
561
561
  requiresRestart: true
562
562
  },
@@ -566,7 +566,7 @@ class AudioAnalyzerAddon extends types.BaseAddon {
566
566
  label: "Classification model",
567
567
  description: "Empty = auto (matches backend). Device-level settings can only inherit / enable / disable this step; model + class filters live here at the node level.",
568
568
  options: AUDIO_MODEL_OPTIONS.map((o) => ({ value: o.value, label: o.label })),
569
- default: types.DEFAULT_AUDIO_ANALYZER_CONFIG.selectedAudioModel,
569
+ default: index.DEFAULT_AUDIO_ANALYZER_CONFIG.selectedAudioModel,
570
570
  immediate: true,
571
571
  requiresRestart: true
572
572
  }
@@ -594,7 +594,7 @@ class AudioAnalyzerAddon extends types.BaseAddon {
594
594
  const ctx = this.ctxIfReady;
595
595
  const stored = ctx?.settings ? await ctx.settings.readAddonStore() ?? {} : {};
596
596
  const merged = overlay ? { ...stored, ...overlay } : stored;
597
- const operatorChoice = typeof merged.audioBackend === "string" ? merged.audioBackend : types.DEFAULT_AUDIO_ANALYZER_CONFIG.audioBackend;
597
+ const operatorChoice = typeof merged.audioBackend === "string" ? merged.audioBackend : index.DEFAULT_AUDIO_ANALYZER_CONFIG.audioBackend;
598
598
  const effectiveBackend = operatorChoice === "apple-soundanalysis" ? "apple-soundanalysis" : operatorChoice === "yamnet-onnx" ? "yamnet-onnx" : process.platform === "darwin" ? "apple-soundanalysis" : "yamnet-onnx";
599
599
  const filteredModels = AUDIO_MODEL_OPTIONS.filter(
600
600
  (o) => o.value === "" || o.value === effectiveBackend
@@ -615,7 +615,7 @@ class AudioAnalyzerAddon extends types.BaseAddon {
615
615
  })
616
616
  }))
617
617
  };
618
- return types.hydrateSchema(patched, raw);
618
+ return index.hydrateSchema(patched, raw);
619
619
  }
620
620
  /**
621
621
  * Re-run the platform probe and persist the detected backend into
@@ -683,9 +683,9 @@ class AudioAnalyzerAddon extends types.BaseAddon {
683
683
  () => this.reprobeAudioEngine()
684
684
  );
685
685
  return [
686
- { capability: types.audioAnalyzerCapability, provider: this.provider },
686
+ { capability: index.audioAnalyzerCapability, provider: this.provider },
687
687
  {
688
- capability: types.audioAnalysisCapability,
688
+ capability: index.audioAnalysisCapability,
689
689
  provider: this.provider,
690
690
  kind: "wrapper",
691
691
  defaultActive: true
@@ -710,7 +710,7 @@ class AudioAnalyzerAddon extends types.BaseAddon {
710
710
  }
711
711
  async getDeviceSettings(deviceId) {
712
712
  const raw = await this.ctx?.settings?.readDeviceStore(deviceId) ?? {};
713
- return types.hydrateSchema(this.buildDeviceSchema(), raw);
713
+ return index.hydrateSchema(this.buildDeviceSchema(), raw);
714
714
  }
715
715
  async updateDeviceSettings(deviceId, patch) {
716
716
  await this.ctx?.settings?.writeDeviceStore(deviceId, patch);
@@ -1,4 +1,4 @@
1
- import { errMsg, HF_BASE_URL, BaseAddon, DEFAULT_AUDIO_ANALYZER_CONFIG, AUDIO_BACKEND_CHOICES, hydrateSchema, audioAnalyzerCapability, audioAnalysisCapability, mapAudioLabelToMacro } from "@camstack/types";
1
+ import { e as errMsg, x as HF_BASE_URL, B as BaseAddon, y as DEFAULT_AUDIO_ANALYZER_CONFIG, z as AUDIO_BACKEND_CHOICES, m as hydrateSchema, F as audioAnalyzerCapability, G as audioAnalysisCapability, I as mapAudioLabelToMacro } from "../index-FxfFGsiL.mjs";
2
2
  import * as path from "node:path";
3
3
  import * as fs from "node:fs";
4
4
  import { downloadFile } from "@camstack/core";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const crypto = require("node:crypto");
4
- const types = require("@camstack/types");
4
+ const index = require("../index-BhOycEVH.js");
5
5
  const nodeAv = require("node-av");
6
6
  const CODEC_ID_BY_NAME = {
7
7
  aac: nodeAv.AV_CODEC_ID_AAC,
@@ -228,7 +228,7 @@ const REAPER_INTERVAL_MS = 5e3;
228
228
  const DEFAULT_GLOBAL_CONFIG = {
229
229
  defaultIdleMs: DEFAULT_IDLE_MS
230
230
  };
231
- class AudioCodecNodeAvAddon extends types.BaseAddon {
231
+ class AudioCodecNodeAvAddon extends index.BaseAddon {
232
232
  sessions = /* @__PURE__ */ new Map();
233
233
  reaperTimer = null;
234
234
  logger = null;
@@ -239,7 +239,7 @@ class AudioCodecNodeAvAddon extends types.BaseAddon {
239
239
  this.logger = this.ctx.logger;
240
240
  this.reaperTimer = setInterval(() => this.reapIdleSessions(), REAPER_INTERVAL_MS);
241
241
  if (typeof this.reaperTimer.unref === "function") this.reaperTimer.unref();
242
- return [{ capability: types.audioCodecCapability, provider: this }];
242
+ return [{ capability: index.audioCodecCapability, provider: this }];
243
243
  }
244
244
  async onShutdown() {
245
245
  if (this.reaperTimer) {
@@ -346,7 +346,7 @@ class AudioCodecNodeAvAddon extends types.BaseAddon {
346
346
  } catch (err) {
347
347
  this.logger?.error("audio-codec: decode runtime init failed", {
348
348
  tags: { sessionId: input.sessionId },
349
- meta: { codec: s.config.codec, error: types.errMsg(err) }
349
+ meta: { codec: s.config.codec, error: index.errMsg(err) }
350
350
  });
351
351
  return;
352
352
  }
@@ -359,7 +359,7 @@ class AudioCodecNodeAvAddon extends types.BaseAddon {
359
359
  } catch (err) {
360
360
  this.logger?.warn("audio-codec: decode frame failed", {
361
361
  tags: { sessionId: input.sessionId },
362
- meta: { codec: s.config.codec, error: types.errMsg(err) }
362
+ meta: { codec: s.config.codec, error: index.errMsg(err) }
363
363
  });
364
364
  }
365
365
  }
@@ -441,7 +441,7 @@ class AudioCodecNodeAvAddon extends types.BaseAddon {
441
441
  } catch (err) {
442
442
  this.logger?.warn("audio-codec: dispose failed during reap", {
443
443
  tags: { sessionId: id },
444
- meta: { error: types.errMsg(err) }
444
+ meta: { error: index.errMsg(err) }
445
445
  });
446
446
  }
447
447
  this.sessions.delete(id);
@@ -455,7 +455,7 @@ class AudioCodecNodeAvAddon extends types.BaseAddon {
455
455
  } catch (err) {
456
456
  this.logger?.warn("audio-codec: decode runtime close failed", {
457
457
  tags: { sessionId: s.sessionId },
458
- meta: { error: types.errMsg(err) }
458
+ meta: { error: index.errMsg(err) }
459
459
  });
460
460
  }
461
461
  s.runtime = null;
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { BaseAddon, audioCodecCapability, errMsg } from "@camstack/types";
2
+ import { B as BaseAddon, w as audioCodecCapability, e as errMsg } from "../index-FxfFGsiL.mjs";
3
3
  import { Codec, CodecContext, AV_SAMPLE_FMT_FLT, SoftwareResampleContext, Packet, Frame, AVERROR_EAGAIN, AVERROR_EOF, AV_CODEC_ID_PCM_MULAW, AV_CODEC_ID_PCM_ALAW, AV_CODEC_ID_OPUS, AV_CODEC_ID_AAC_LATM, AV_CODEC_ID_AAC, AV_CH_LAYOUT_MONO, AV_CHANNEL_ORDER_NATIVE, AV_CH_LAYOUT_STEREO, AV_SAMPLE_FMT_S16 } from "node-av";
4
4
  const CODEC_ID_BY_NAME = {
5
5
  aac: AV_CODEC_ID_AAC,
@@ -23,7 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  ));
24
24
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
25
25
  const crypto = require("node:crypto");
26
- const types = require("@camstack/types");
26
+ const index = require("../index-BhOycEVH.js");
27
27
  function backendToHwDeviceConst(backend, consts) {
28
28
  switch (backend) {
29
29
  case "videotoolbox":
@@ -261,7 +261,7 @@ class NodeAvDecoderSession {
261
261
  this.codecCtx.setHardwarePixelFormat(hwPixFmt);
262
262
  } catch (err) {
263
263
  this.logger.warn("node-av: hwaccel context attach failed — trying next", {
264
- meta: { backend, error: types.errMsg(err) }
264
+ meta: { backend, error: index.errMsg(err) }
265
265
  });
266
266
  device.free();
267
267
  continue;
@@ -375,7 +375,7 @@ class NodeAvDecoderSession {
375
375
  }
376
376
  });
377
377
  } catch (err) {
378
- this.logger.error("node-av init error", { meta: { error: types.errMsg(err) } });
378
+ this.logger.error("node-av init error", { meta: { error: index.errMsg(err) } });
379
379
  } finally {
380
380
  this.initializing = false;
381
381
  }
@@ -447,7 +447,7 @@ class NodeAvDecoderSession {
447
447
  meta: { srcWidth: srcW, srcHeight: srcH, outWidth, outHeight, format: fmtName }
448
448
  });
449
449
  } catch (err) {
450
- this.logger.error("Scaler init failed", { meta: { error: types.errMsg(err) } });
450
+ this.logger.error("Scaler init failed", { meta: { error: index.errMsg(err) } });
451
451
  } finally {
452
452
  localScaler?.[Symbol.dispose]?.();
453
453
  localDstFrame?.[Symbol.dispose]?.();
@@ -461,7 +461,7 @@ class NodeAvDecoderSession {
461
461
  this.initDecoder().then(() => {
462
462
  if (this.initialized) this.decodeRawData(packet.data, packet.pts ?? Date.now());
463
463
  }).catch((err) => {
464
- this.logger.error("node-av init failed", { meta: { error: types.errMsg(err) } });
464
+ this.logger.error("node-av init failed", { meta: { error: index.errMsg(err) } });
465
465
  });
466
466
  return;
467
467
  }
@@ -525,7 +525,7 @@ class NodeAvDecoderSession {
525
525
  this.dstFrame.makeWritable();
526
526
  this.scaler.scaleFrameSync(this.dstFrame, frame);
527
527
  } catch (err) {
528
- this.logger.warn("node-av scale error", { meta: { error: types.errMsg(err) } });
528
+ this.logger.warn("node-av scale error", { meta: { error: index.errMsg(err) } });
529
529
  return;
530
530
  }
531
531
  if (!this.firstFrameLogged) {
@@ -610,7 +610,7 @@ class NodeAvDecoderSession {
610
610
  if (this.destroyed) return;
611
611
  this.emitRawFrame(jpegBuf, "jpeg", decodeStart);
612
612
  }).catch((err) => {
613
- this.logger.warn("sharp jpeg encode error", { meta: { error: types.errMsg(err) } });
613
+ this.logger.warn("sharp jpeg encode error", { meta: { error: index.errMsg(err) } });
614
614
  }).finally(() => {
615
615
  this.jpegEncodeInFlight--;
616
616
  });
@@ -714,13 +714,13 @@ class NodeAvDecoderSession {
714
714
  }
715
715
  }
716
716
  const FRAME_BUFFER_CAPACITY = 32;
717
- class DecoderNodeAvAddon extends types.BaseAddon {
717
+ class DecoderNodeAvAddon extends index.BaseAddon {
718
718
  sessions = /* @__PURE__ */ new Map();
719
719
  frameBuffers = /* @__PURE__ */ new Map();
720
720
  unsubscribers = /* @__PURE__ */ new Map();
721
721
  sessionMeta = /* @__PURE__ */ new Map();
722
722
  constructor() {
723
- super(types.DEFAULT_DECODER_HWACCEL_CONFIG);
723
+ super(index.DEFAULT_DECODER_HWACCEL_CONFIG);
724
724
  }
725
725
  globalSettingsSchema() {
726
726
  return this.schema({
@@ -734,7 +734,7 @@ class DecoderNodeAvAddon extends types.BaseAddon {
734
734
  type: "select",
735
735
  key: "hwaccel",
736
736
  label: "Preferred backend",
737
- options: [...types.HWACCEL_OPTIONS],
737
+ options: [...index.HWACCEL_OPTIONS],
738
738
  default: "auto",
739
739
  immediate: true
740
740
  }),
@@ -762,7 +762,7 @@ class DecoderNodeAvAddon extends types.BaseAddon {
762
762
  });
763
763
  });
764
764
  }
765
- return [{ capability: types.decoderCapability, provider: this }];
765
+ return [{ capability: index.decoderCapability, provider: this }];
766
766
  }
767
767
  /**
768
768
  * Resolve the effective hwaccel backend for a new session. Reads
@@ -820,7 +820,7 @@ class DecoderNodeAvAddon extends types.BaseAddon {
820
820
  hwaccel,
821
821
  hwaccelResolver: this.ctx.kernel.hwaccel
822
822
  });
823
- const ringBuffer = new types.RingBuffer(FRAME_BUFFER_CAPACITY);
823
+ const ringBuffer = new index.RingBuffer(FRAME_BUFFER_CAPACITY);
824
824
  const unsub = session.onFrame((frame) => {
825
825
  const { format } = frame;
826
826
  if (format !== "jpeg" && format !== "rgb" && format !== "bgr" && format !== "yuv420" && format !== "gray") return;
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { errMsg, BaseAddon, DEFAULT_DECODER_HWACCEL_CONFIG, HWACCEL_OPTIONS, decoderCapability, RingBuffer } from "@camstack/types";
2
+ import { e as errMsg, B as BaseAddon, u as DEFAULT_DECODER_HWACCEL_CONFIG, H as HWACCEL_OPTIONS, v as decoderCapability, R as RingBuffer } from "../index-FxfFGsiL.mjs";
3
3
  function backendToHwDeviceConst(backend, consts) {
4
4
  switch (backend) {
5
5
  case "videotoolbox":
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  mod
23
23
  ));
24
24
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
25
- const types = require("@camstack/types");
25
+ const index = require("../index-BhOycEVH.js");
26
26
  const fs = require("node:fs");
27
27
  const path = require("node:path");
28
28
  const os = require("node:os");
@@ -437,40 +437,40 @@ class SharedInferencePool {
437
437
  // -------------------------------------------------------------------------
438
438
  // Model management — propagated to ALL workers (synchronous waterfall)
439
439
  // -------------------------------------------------------------------------
440
- async loadModel(index, config) {
440
+ async loadModel(index2, config) {
441
441
  const responses = await Promise.all(this.workers.map((w) => w.sendCommand({
442
442
  cmd: "load",
443
- index,
443
+ index: index2,
444
444
  config: serializeModelConfig(config)
445
445
  })));
446
446
  for (const resp of responses) {
447
447
  if (resp.status !== "ok") {
448
- throw new Error(`Failed to load model at index ${index}: ${resp.error ?? "unknown"}`);
448
+ throw new Error(`Failed to load model at index ${index2}: ${resp.error ?? "unknown"}`);
449
449
  }
450
450
  }
451
- if (index >= this.nextFreeIndex) {
452
- this.nextFreeIndex = index + 1;
451
+ if (index2 >= this.nextFreeIndex) {
452
+ this.nextFreeIndex = index2 + 1;
453
453
  }
454
454
  const maxLoadMs = Math.max(...responses.map((r) => r.loadMs ?? 0));
455
455
  return { loadMs: maxLoadMs };
456
456
  }
457
- async unloadModel(index) {
458
- const responses = await Promise.all(this.workers.map((w) => w.sendCommand({ cmd: "unload", index })));
457
+ async unloadModel(index2) {
458
+ const responses = await Promise.all(this.workers.map((w) => w.sendCommand({ cmd: "unload", index: index2 })));
459
459
  for (const resp of responses) {
460
460
  if (resp.status !== "ok") {
461
- throw new Error(`Failed to unload model at index ${index}: ${resp.error ?? "unknown"}`);
461
+ throw new Error(`Failed to unload model at index ${index2}: ${resp.error ?? "unknown"}`);
462
462
  }
463
463
  }
464
464
  }
465
- async replaceModel(index, config) {
465
+ async replaceModel(index2, config) {
466
466
  const responses = await Promise.all(this.workers.map((w) => w.sendCommand({
467
467
  cmd: "replace",
468
- index,
468
+ index: index2,
469
469
  config: serializeModelConfig(config)
470
470
  })));
471
471
  for (const resp of responses) {
472
472
  if (resp.status !== "ok") {
473
- throw new Error(`Failed to replace model at index ${index}: ${resp.error ?? "unknown"}`);
473
+ throw new Error(`Failed to replace model at index ${index2}: ${resp.error ?? "unknown"}`);
474
474
  }
475
475
  }
476
476
  const maxLoadMs = Math.max(...responses.map((r) => r.loadMs ?? 0));
@@ -710,12 +710,12 @@ class PipelineModelManager {
710
710
  meta: { step: stepId, modelId: evicted.modelId, poolIndex: evicted.poolIndex, cap: this.maxModelsPerStep }
711
711
  });
712
712
  }
713
- const index = this.pool.allocateIndex();
713
+ const index2 = this.pool.allocateIndex();
714
714
  const config = this.buildPoolConfig(stepId, modelId);
715
- this.log.info("Loading step variant", { meta: { step: stepId, modelId, poolIndex: index } });
716
- const { loadMs } = await this.pool.loadModel(index, config);
717
- this.log.info("Step variant loaded", { meta: { step: stepId, modelId, poolIndex: index, loadMs } });
718
- const entry = { stepId, modelId, poolIndex: index, lruTick: ++this.lruClock };
715
+ this.log.info("Loading step variant", { meta: { step: stepId, modelId, poolIndex: index2 } });
716
+ const { loadMs } = await this.pool.loadModel(index2, config);
717
+ this.log.info("Step variant loaded", { meta: { step: stepId, modelId, poolIndex: index2, loadMs } });
718
+ const entry = { stepId, modelId, poolIndex: index2, lruTick: ++this.lruClock };
719
719
  perStep.set(modelId, entry);
720
720
  return entry;
721
721
  }
@@ -801,8 +801,8 @@ class PipelineModelManager {
801
801
  }
802
802
  const HF_REPO = "camstack/camstack-models";
803
803
  const HF_SCRYPTED = "scrypted/plugin-models";
804
- const hf = (path2) => types.hfModelUrl(HF_REPO, path2);
805
- const hfScrypted = (path2) => types.hfModelUrl(HF_SCRYPTED, path2);
804
+ const hf = (path2) => index.hfModelUrl(HF_REPO, path2);
805
+ const hfScrypted = (path2) => index.hfModelUrl(HF_SCRYPTED, path2);
806
806
  const MLPACKAGE_FILES = [
807
807
  "Manifest.json",
808
808
  "Data/com.apple.CoreML/model.mlmodel",
@@ -1238,8 +1238,8 @@ class ObjectDetectionStep {
1238
1238
  models: [...OBJECT_DETECTION_MODELS],
1239
1239
  defaultModelId: "yolov9s",
1240
1240
  defaultConfidence: 0.5,
1241
- labels: types.COCO_80_LABELS.map((l) => l.id),
1242
- classMap: types.COCO_TO_MACRO
1241
+ labels: index.COCO_80_LABELS.map((l) => l.id),
1242
+ classMap: index.COCO_TO_MACRO
1243
1243
  };
1244
1244
  getConfigSchema() {
1245
1245
  return [
@@ -1331,7 +1331,7 @@ class AudioClassifierStep {
1331
1331
  key: "enabledAudioClasses",
1332
1332
  label: "Audio Classes",
1333
1333
  description: "Which audio macro classes to surface (empty = all).",
1334
- options: types.AUDIO_MACRO_LABELS.map((l) => ({ value: l.id, label: `${l.icon ?? ""} ${l.name}`.trim() })),
1334
+ options: index.AUDIO_MACRO_LABELS.map((l) => ({ value: l.id, label: `${l.icon ?? ""} ${l.name}`.trim() })),
1335
1335
  default: defaultClasses
1336
1336
  },
1337
1337
  {
@@ -1514,8 +1514,8 @@ const STEP_INSTANCE_SEGMENTATION = new PipelineStepBase({
1514
1514
  // Instance segmentation is expensive — default OFF.
1515
1515
  enabledByDefault: false,
1516
1516
  defaultConfidence: 0.25,
1517
- labels: types.COCO_80_LABELS.map((l) => l.id),
1518
- classMap: types.COCO_TO_MACRO,
1517
+ labels: index.COCO_80_LABELS.map((l) => l.id),
1518
+ classMap: index.COCO_TO_MACRO,
1519
1519
  group: "Segmentation"
1520
1520
  });
1521
1521
  const STEP_OBJECT_DETECTION_INSTANCE = new ObjectDetectionStep();
@@ -2889,7 +2889,7 @@ class PipelineExecutor {
2889
2889
  rootStepId: rootStep.stepId,
2890
2890
  parentClass: mutable.macroClass,
2891
2891
  parentScore: mutable.score,
2892
- error: types.errMsg(err)
2892
+ error: index.errMsg(err)
2893
2893
  }
2894
2894
  });
2895
2895
  }
@@ -2928,7 +2928,7 @@ class PipelineExecutor {
2928
2928
  try {
2929
2929
  engineOutput = await step.engine.infer(input);
2930
2930
  } catch (err) {
2931
- const errorMsg = types.errMsg(err);
2931
+ const errorMsg = index.errMsg(err);
2932
2932
  const errorOutput = { kind: "detections", detections: [] };
2933
2933
  if (traceBuilder.isActive) {
2934
2934
  traceBuilder.addStep({
@@ -3181,7 +3181,7 @@ function assembleBatchedFrameResult(raw, frame, modelId, deviceId, inferenceMs,
3181
3181
  function readStored(raw, guard) {
3182
3182
  if (!raw) return null;
3183
3183
  try {
3184
- const parsed = types.parseJsonUnknown(raw);
3184
+ const parsed = index.parseJsonUnknown(raw);
3185
3185
  return guard(parsed) ? parsed : null;
3186
3186
  } catch {
3187
3187
  return null;
@@ -3643,7 +3643,7 @@ class DetectionPipelineProvider {
3643
3643
  id: `model-download-${Date.now()}`,
3644
3644
  timestamp: /* @__PURE__ */ new Date(),
3645
3645
  source,
3646
- category: types.EventCategory.ModelDownloadProgress,
3646
+ category: index.EventCategory.ModelDownloadProgress,
3647
3647
  data: { modelId, progress, totalMB: formatEntry.sizeMB }
3648
3648
  });
3649
3649
  };
@@ -3667,7 +3667,7 @@ class DetectionPipelineProvider {
3667
3667
  emitProgress(100);
3668
3668
  return { filePath, sizeMB: formatEntry.sizeMB, durationMs };
3669
3669
  } catch (err) {
3670
- const msg = types.errMsg(err);
3670
+ const msg = index.errMsg(err);
3671
3671
  this.log.error("Model download failed", { meta: { error: msg, modelId, format } });
3672
3672
  emitProgress(-1);
3673
3673
  throw err;
@@ -3695,8 +3695,8 @@ class DetectionPipelineProvider {
3695
3695
  const sessionId = input.sessionId ?? `run-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
3696
3696
  const emit = (message, extra) => {
3697
3697
  onProgress?.(message);
3698
- this.eventBus?.emit(types.createEvent(
3699
- types.EventCategory.PipelineProgress,
3698
+ this.eventBus?.emit(index.createEvent(
3699
+ index.EventCategory.PipelineProgress,
3700
3700
  { type: "pipeline", id: "pipeline-test" },
3701
3701
  {
3702
3702
  nodeId,
@@ -3915,8 +3915,8 @@ class DetectionPipelineProvider {
3915
3915
  );
3916
3916
  if (isRuntime) {
3917
3917
  if (trace && this.eventBus) {
3918
- this.eventBus.emit(types.createEvent(
3919
- types.EventCategory.PipelineTrace,
3918
+ this.eventBus.emit(index.createEvent(
3919
+ index.EventCategory.PipelineTrace,
3920
3920
  { type: "device", id: trace.deviceId, nodeId: "hub" },
3921
3921
  trace
3922
3922
  ));
@@ -4163,7 +4163,7 @@ class DetectionPipelineProvider {
4163
4163
  this.log.info("Model downloaded successfully", { meta: { modelId: entry.id } });
4164
4164
  return;
4165
4165
  } catch (err) {
4166
- const msg = types.errMsg(err);
4166
+ const msg = index.errMsg(err);
4167
4167
  if (attempt < maxRetries) {
4168
4168
  const delayMs = 2e3 * Math.pow(2, attempt - 1);
4169
4169
  this.log.warn("Model download failed — retrying", { meta: { modelId: entry.id, attempt, maxRetries, error: msg, retryDelayMs: delayMs } });
@@ -4259,7 +4259,7 @@ class DetectionPipelineProvider {
4259
4259
  try {
4260
4260
  return await this.runPipelineBatchImpl(input);
4261
4261
  } catch (err) {
4262
- const msg = types.errMsg(err);
4262
+ const msg = index.errMsg(err);
4263
4263
  const stack = err instanceof Error ? err.stack : void 0;
4264
4264
  this.log.error("runPipelineBatch failed", { meta: { phase: "batch", error: msg, stack } });
4265
4265
  throw err;
@@ -4548,7 +4548,7 @@ class DetectionPipelineProvider {
4548
4548
  if (frameW === 0 || frameH === 0) return result;
4549
4549
  const firstLevel = result.detections.filter((d) => d.kind === "first-level");
4550
4550
  const details = result.detections.filter((d) => d.kind === "detail");
4551
- const { passed } = types.evaluateZoneRules(
4551
+ const { passed } = index.evaluateZoneRules(
4552
4552
  firstLevel,
4553
4553
  zones,
4554
4554
  rules,
@@ -4892,8 +4892,8 @@ class DetectionPipelineProvider {
4892
4892
  }
4893
4893
  async getAudioCapabilities() {
4894
4894
  const isMac = process.platform === "darwin";
4895
- const yamnetLabels = Object.keys(types.YAMNET_TO_MACRO.mapping).sort((a, b) => a.localeCompare(b));
4896
- const appleLabels = Object.keys(types.APPLE_SA_TO_MACRO.mapping).sort((a, b) => a.localeCompare(b));
4895
+ const yamnetLabels = Object.keys(index.YAMNET_TO_MACRO.mapping).sort((a, b) => a.localeCompare(b));
4896
+ const appleLabels = Object.keys(index.APPLE_SA_TO_MACRO.mapping).sort((a, b) => a.localeCompare(b));
4897
4897
  return {
4898
4898
  activeBackend: isMac ? "apple-soundanalysis" : "yamnet-onnx",
4899
4899
  availableBackends: [
@@ -4995,7 +4995,7 @@ class DetectionPipelineProvider {
4995
4995
  );
4996
4996
  return { success: true, frame };
4997
4997
  } catch (err) {
4998
- const msg = types.errMsg(err);
4998
+ const msg = index.errMsg(err);
4999
4999
  this.log.error("failed", { meta: { phase: "audio-test", error: msg } });
5000
5000
  return { success: false, error: msg };
5001
5001
  }
@@ -5267,7 +5267,7 @@ const POOL_BOUND_KEYS = [
5267
5267
  "intraOpThreads",
5268
5268
  "numWorkers"
5269
5269
  ];
5270
- class DetectionPipelineAddon extends types.BaseAddon {
5270
+ class DetectionPipelineAddon extends index.BaseAddon {
5271
5271
  provider = null;
5272
5272
  engineMetricsTimer = null;
5273
5273
  /** Snapshot-equality cache for engine-metrics emit. Most ticks
@@ -5506,7 +5506,7 @@ class DetectionPipelineAddon extends types.BaseAddon {
5506
5506
  })
5507
5507
  }))
5508
5508
  };
5509
- return types.hydrateSchema(patched, raw);
5509
+ return index.hydrateSchema(patched, raw);
5510
5510
  }
5511
5511
  /**
5512
5512
  * Ask the platform-probe cap which backends are actually installable
@@ -5619,9 +5619,9 @@ class DetectionPipelineAddon extends types.BaseAddon {
5619
5619
  );
5620
5620
  this.lastAppliedPoolConfig = this.snapshotPoolConfig();
5621
5621
  return [
5622
- { capability: types.pipelineExecutorCapability, provider: this.provider },
5622
+ { capability: index.pipelineExecutorCapability, provider: this.provider },
5623
5623
  {
5624
- capability: types.detectionPipelineCapability,
5624
+ capability: index.detectionPipelineCapability,
5625
5625
  provider: this.provider,
5626
5626
  kind: "wrapper",
5627
5627
  defaultActive: true
@@ -5646,8 +5646,8 @@ class DetectionPipelineAddon extends types.BaseAddon {
5646
5646
  const heartbeatDue = !prev || timestamp - prev.emittedAt >= ENGINE_METRICS_HEARTBEAT_MS;
5647
5647
  if (prev && prev.json === json && !heartbeatDue) return;
5648
5648
  this.lastEmittedEngineSnapshot = { json, emittedAt: timestamp };
5649
- eventBus.emit(types.createEvent(
5650
- types.EventCategory.PipelineEngineMetricsSnapshot,
5649
+ eventBus.emit(index.createEvent(
5650
+ index.EventCategory.PipelineEngineMetricsSnapshot,
5651
5651
  { type: "node", id: nodeId, nodeId },
5652
5652
  { nodeId, engines, timestamp }
5653
5653
  ));