@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
@@ -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 DEFAULT_CONFIG$1 = {
@@ -118,13 +118,13 @@ function gateMotionRegions(regions, zones, rules, frameWidth, frameHeight) {
118
118
  if (frameWidth === 0 || frameHeight === 0) {
119
119
  return { passed: regions, excluded: [] };
120
120
  }
121
- return types.evaluateZoneRules(regions, zones, rules, (region) => ({
121
+ return index.evaluateZoneRules(regions, zones, rules, (region) => ({
122
122
  x: (region.bbox.x + region.bbox.w / 2) / frameWidth,
123
123
  y: (region.bbox.y + region.bbox.h / 2) / frameHeight
124
124
  }));
125
125
  }
126
126
  const DEFAULT_CONFIG = { threshold: 45, blurRadius: 1, dilateRadius: 4, minArea: 1500 };
127
- class MotionWasmAddon extends types.BaseAddon {
127
+ class MotionWasmAddon extends index.BaseAddon {
128
128
  detector = null;
129
129
  cameras = /* @__PURE__ */ new Map();
130
130
  deviceConfigCache = /* @__PURE__ */ new Map();
@@ -149,7 +149,7 @@ class MotionWasmAddon extends types.BaseAddon {
149
149
  await this.detector.load();
150
150
  this.ctx.logger.info("WASM motion detector loaded");
151
151
  return [{
152
- capability: types.motionDetectionCapability,
152
+ capability: index.motionDetectionCapability,
153
153
  provider: this,
154
154
  kind: "wrapper",
155
155
  defaultActive: true
@@ -309,7 +309,7 @@ class MotionWasmAddon extends types.BaseAddon {
309
309
  }
310
310
  if (!this.ctx?.settings) return DEFAULT_CONFIG;
311
311
  const raw = await this.ctx.settings.readDeviceStore(Number(cameraId));
312
- const hydrated = types.hydrateSchema(this.deviceSettingsSchema(), raw);
312
+ const hydrated = index.hydrateSchema(this.deviceSettingsSchema(), raw);
313
313
  const flat = {};
314
314
  for (const section of hydrated.sections) {
315
315
  for (const field of section.fields) {
@@ -421,7 +421,7 @@ class MotionWasmAddon extends types.BaseAddon {
421
421
  async getDeviceSettings(deviceId) {
422
422
  const ctx = this.ctxIfReady;
423
423
  const raw = await ctx?.settings?.readDeviceStore(deviceId) ?? {};
424
- return types.hydrateSchema(this.deviceSettingsSchema(), raw);
424
+ return index.hydrateSchema(this.deviceSettingsSchema(), raw);
425
425
  }
426
426
  async updateDeviceSettings(deviceId, patch) {
427
427
  await this.ctx.settings?.writeDeviceStore(deviceId, patch);
@@ -442,7 +442,7 @@ class MotionWasmAddon extends types.BaseAddon {
442
442
  ...schema,
443
443
  sections: schema.sections.map((s) => ({ ...s, tab: s.tab ?? "detection" }))
444
444
  };
445
- return types.hydrateSchema(withTab, raw);
445
+ return index.hydrateSchema(withTab, raw);
446
446
  }
447
447
  async getDeviceLiveContribution(_input) {
448
448
  return null;
@@ -464,7 +464,7 @@ class MotionWasmAddon extends types.BaseAddon {
464
464
  try {
465
465
  const dev = await api.deviceManager.getDevice.query({ deviceId });
466
466
  if (!dev) return true;
467
- return dev.type === types.DeviceType.Camera;
467
+ return dev.type === index.DeviceType.Camera;
468
468
  } catch {
469
469
  return true;
470
470
  }
@@ -1,4 +1,4 @@
1
- import { evaluateZoneRules, BaseAddon, motionDetectionCapability, hydrateSchema, DeviceType } from "@camstack/types";
1
+ import { i as evaluateZoneRules, B as BaseAddon, t as motionDetectionCapability, m as hydrateSchema, D as DeviceType } from "../index-FxfFGsiL.mjs";
2
2
  import { readFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  const DEFAULT_CONFIG$1 = {
@@ -22,8 +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");
26
- const zod = require("zod");
25
+ const index = require("../index-BhOycEVH.js");
27
26
  class FrameQueue {
28
27
  constructor(maxSize) {
29
28
  this.maxSize = maxSize;
@@ -586,78 +585,78 @@ class PipelineRunner {
586
585
  return null;
587
586
  }
588
587
  }
589
- const BenchEngineChoiceSchema = zod.z.object({
590
- runtime: zod.z.enum(["node", "python"]),
591
- backend: zod.z.string(),
592
- format: zod.z.enum(["onnx", "coreml", "openvino", "tflite", "pt"]),
593
- device: zod.z.string().optional()
588
+ const BenchEngineChoiceSchema = index.object({
589
+ runtime: index._enum(["node", "python"]),
590
+ backend: index.string(),
591
+ format: index._enum(["onnx", "coreml", "openvino", "tflite", "pt"]),
592
+ device: index.string().optional()
594
593
  });
595
- const BenchStepSchema = zod.z.lazy(() => zod.z.object({
596
- addonId: zod.z.string(),
597
- modelId: zod.z.string(),
598
- enabled: zod.z.boolean(),
599
- children: zod.z.array(BenchStepSchema).optional()
594
+ const BenchStepSchema = index.lazy(() => index.object({
595
+ addonId: index.string(),
596
+ modelId: index.string(),
597
+ enabled: index.boolean(),
598
+ children: index.array(BenchStepSchema).optional()
600
599
  }));
601
- const CacheBenchFrameInputSchema = zod.z.object({
602
- imageBase64: zod.z.string(),
603
- ttlSeconds: zod.z.number().int().positive().optional()
600
+ const CacheBenchFrameInputSchema = index.object({
601
+ imageBase64: index.string(),
602
+ ttlSeconds: index.number().int().positive().optional()
604
603
  });
605
- const CacheBenchFrameResultSchema = zod.z.object({
606
- frameId: zod.z.string(),
607
- width: zod.z.number(),
608
- height: zod.z.number(),
609
- expiresAt: zod.z.number()
604
+ const CacheBenchFrameResultSchema = index.object({
605
+ frameId: index.string(),
606
+ width: index.number(),
607
+ height: index.number(),
608
+ expiresAt: index.number()
610
609
  });
611
- const ReleaseBenchFrameInputSchema = zod.z.object({
612
- frameId: zod.z.string()
610
+ const ReleaseBenchFrameInputSchema = index.object({
611
+ frameId: index.string()
613
612
  });
614
- const ReleaseBenchFrameResultSchema = zod.z.object({
615
- released: zod.z.boolean()
613
+ const ReleaseBenchFrameResultSchema = index.object({
614
+ released: index.boolean()
616
615
  });
617
- const RunSyntheticBenchInputSchema = zod.z.object({
618
- frameId: zod.z.string(),
619
- steps: zod.z.array(BenchStepSchema).min(1),
620
- parallel: zod.z.number().int().min(1).max(32),
621
- iterations: zod.z.number().int().min(1).max(1e4),
622
- warmup: zod.z.number().int().min(0).max(100).optional(),
623
- sessionId: zod.z.string().optional(),
624
- simulatePipeline: zod.z.boolean().optional(),
616
+ const RunSyntheticBenchInputSchema = index.object({
617
+ frameId: index.string(),
618
+ steps: index.array(BenchStepSchema).min(1),
619
+ parallel: index.number().int().min(1).max(32),
620
+ iterations: index.number().int().min(1).max(1e4),
621
+ warmup: index.number().int().min(0).max(100).optional(),
622
+ sessionId: index.string().optional(),
623
+ simulatePipeline: index.boolean().optional(),
625
624
  engine: BenchEngineChoiceSchema.optional()
626
625
  });
627
- const TimingSplitSchema = zod.z.object({
628
- mean: zod.z.number(),
629
- p50: zod.z.number(),
630
- p95: zod.z.number(),
631
- p99: zod.z.number()
626
+ const TimingSplitSchema = index.object({
627
+ mean: index.number(),
628
+ p50: index.number(),
629
+ p95: index.number(),
630
+ p99: index.number()
632
631
  });
633
- const RunSyntheticBenchResultSchema = zod.z.object({
634
- runs: zod.z.number(),
635
- wallSec: zod.z.number(),
636
- fps: zod.z.number(),
637
- detectionsPerSec: zod.z.number(),
638
- avgDetections: zod.z.number(),
632
+ const RunSyntheticBenchResultSchema = index.object({
633
+ runs: index.number(),
634
+ wallSec: index.number(),
635
+ fps: index.number(),
636
+ detectionsPerSec: index.number(),
637
+ avgDetections: index.number(),
639
638
  callMs: TimingSplitSchema,
640
- inferMs: zod.z.number(),
641
- preprocessMs: zod.z.number(),
642
- predictMs: zod.z.number(),
643
- batchSizeMean: zod.z.number(),
644
- batchSizeMax: zod.z.number(),
645
- engine: zod.z.object({ runtime: zod.z.string(), backend: zod.z.string(), device: zod.z.string().optional() }).optional(),
646
- tuning: zod.z.object({ batchMode: zod.z.string(), windowMs: zod.z.number(), maxBatchSize: zod.z.number(), concurrency: zod.z.number() }).optional(),
647
- path: zod.z.string().optional()
639
+ inferMs: index.number(),
640
+ preprocessMs: index.number(),
641
+ predictMs: index.number(),
642
+ batchSizeMean: index.number(),
643
+ batchSizeMax: index.number(),
644
+ engine: index.object({ runtime: index.string(), backend: index.string(), device: index.string().optional() }).optional(),
645
+ tuning: index.object({ batchMode: index.string(), windowMs: index.number(), maxBatchSize: index.number(), concurrency: index.number() }).optional(),
646
+ path: index.string().optional()
648
647
  });
649
- const pipelineRunnerBenchActions = types.defineCustomActions({
650
- cacheBenchFrame: types.customAction(
648
+ const pipelineRunnerBenchActions = index.defineCustomActions({
649
+ cacheBenchFrame: index.customAction(
651
650
  CacheBenchFrameInputSchema,
652
651
  CacheBenchFrameResultSchema,
653
652
  { kind: "mutation" }
654
653
  ),
655
- releaseBenchFrame: types.customAction(
654
+ releaseBenchFrame: index.customAction(
656
655
  ReleaseBenchFrameInputSchema,
657
656
  ReleaseBenchFrameResultSchema,
658
657
  { kind: "mutation" }
659
658
  ),
660
- runSyntheticBench: types.customAction(
659
+ runSyntheticBench: index.customAction(
661
660
  RunSyntheticBenchInputSchema,
662
661
  RunSyntheticBenchResultSchema,
663
662
  { kind: "mutation" }
@@ -687,7 +686,7 @@ function toFrameInput(frame) {
687
686
  const STEP_LOG_INTERVAL_MS = 3e4;
688
687
  const METRICS_SNAPSHOT_INTERVAL_MS = 1e3;
689
688
  const METRICS_HEARTBEAT_MS = 3e4;
690
- class PipelineRunnerAddon extends types.BaseAddon {
689
+ class PipelineRunnerAddon extends index.BaseAddon {
691
690
  runner = null;
692
691
  attached = /* @__PURE__ */ new Map();
693
692
  nodeId = "unknown";
@@ -762,7 +761,7 @@ class PipelineRunnerAddon extends types.BaseAddon {
762
761
  );
763
762
  if (this.ctx.eventBus) {
764
763
  this.unsubMotionEvents = this.ctx.eventBus.subscribe(
765
- { category: types.EventCategory.MotionOnMotionChanged },
764
+ { category: index.EventCategory.MotionOnMotionChanged },
766
765
  (event) => {
767
766
  const data = event.data;
768
767
  const deviceId = data.deviceId;
@@ -785,7 +784,7 @@ class PipelineRunnerAddon extends types.BaseAddon {
785
784
  METRICS_SNAPSHOT_INTERVAL_MS
786
785
  );
787
786
  return {
788
- providers: [{ capability: types.pipelineRunnerCapability, provider: this }],
787
+ providers: [{ capability: index.pipelineRunnerCapability, provider: this }],
789
788
  customActions: pipelineRunnerBenchActions,
790
789
  actionHandlers: {
791
790
  cacheBenchFrame: async (input) => this.cacheBenchFrame(input),
@@ -957,7 +956,7 @@ class PipelineRunnerAddon extends types.BaseAddon {
957
956
  id: `bench-${n}`,
958
957
  timestamp: /* @__PURE__ */ new Date(),
959
958
  source: { type: "pipeline", id: "synthetic-bench" },
960
- category: types.EventCategory.PipelineProgress,
959
+ category: index.EventCategory.PipelineProgress,
961
960
  data: {
962
961
  nodeId: "hub",
963
962
  sessionId: sessionId2,
@@ -1053,7 +1052,7 @@ class PipelineRunnerAddon extends types.BaseAddon {
1053
1052
  id: `bench-${n}`,
1054
1053
  timestamp: /* @__PURE__ */ new Date(),
1055
1054
  source: { type: "pipeline", id: "synthetic-bench" },
1056
- category: types.EventCategory.PipelineProgress,
1055
+ category: index.EventCategory.PipelineProgress,
1057
1056
  data: {
1058
1057
  nodeId: "hub",
1059
1058
  sessionId,
@@ -1353,7 +1352,7 @@ class PipelineRunnerAddon extends types.BaseAddon {
1353
1352
  })().catch((err) => {
1354
1353
  this.ctx.logger.debug("motion cap-state write failed", {
1355
1354
  tags: { deviceId },
1356
- meta: { error: types.errMsg(err) }
1355
+ meta: { error: index.errMsg(err) }
1357
1356
  });
1358
1357
  });
1359
1358
  if (this.ctx.eventBus) {
@@ -1369,8 +1368,8 @@ class PipelineRunnerAddon extends types.BaseAddon {
1369
1368
  cooldownMs: meta.cooldownMs,
1370
1369
  timestamp: meta.timestamp
1371
1370
  };
1372
- this.ctx.eventBus.emit(types.createEvent(
1373
- types.EventCategory.DetectionPhaseTransition,
1371
+ this.ctx.eventBus.emit(index.createEvent(
1372
+ index.EventCategory.DetectionPhaseTransition,
1374
1373
  { type: "device", id: deviceId, addonId: this.ctx.id, deviceId, nodeId: this.nodeId },
1375
1374
  payload
1376
1375
  ));
@@ -1437,7 +1436,7 @@ class PipelineRunnerAddon extends types.BaseAddon {
1437
1436
  ...engine ? { engine } : {}
1438
1437
  });
1439
1438
  } catch (err) {
1440
- const msg = types.errMsg(err);
1439
+ const msg = index.errMsg(err);
1441
1440
  log.error("runInference failed", { meta: { error: msg } });
1442
1441
  return null;
1443
1442
  }
@@ -1461,8 +1460,8 @@ class PipelineRunnerAddon extends types.BaseAddon {
1461
1460
  if (detected !== prevDetected) {
1462
1461
  this.lastAnalyzerDetected.set(deviceId, detected);
1463
1462
  if (this.ctx.eventBus) {
1464
- this.ctx.eventBus.emit(types.createEvent(
1465
- types.EventCategory.MotionOnMotionChanged,
1463
+ this.ctx.eventBus.emit(index.createEvent(
1464
+ index.EventCategory.MotionOnMotionChanged,
1466
1465
  // EventSource wrapper kept symmetric with the onboard
1467
1466
  // emit (Reolink/ONVIF/etc.) so consumers grouping by
1468
1467
  // addonId / deviceId see consistent provenance. `nodeId`
@@ -1492,8 +1491,8 @@ class PipelineRunnerAddon extends types.BaseAddon {
1492
1491
  analysisMs: result.analysisMs
1493
1492
  };
1494
1493
  const analyzerSource = { type: "device", id: deviceId, addonId: this.ctx.id, deviceId, nodeId: this.nodeId };
1495
- this.ctx.eventBus.emit(types.createEvent(
1496
- types.EventCategory.MotionAnalysis,
1494
+ this.ctx.eventBus.emit(index.createEvent(
1495
+ index.EventCategory.MotionAnalysis,
1497
1496
  analyzerSource,
1498
1497
  motionPayload
1499
1498
  ));
@@ -1507,15 +1506,15 @@ class PipelineRunnerAddon extends types.BaseAddon {
1507
1506
  })),
1508
1507
  frameSize: { width: frame.width, height: frame.height }
1509
1508
  };
1510
- this.ctx.eventBus.emit(types.createEvent(
1511
- types.EventCategory.MotionZonesRaw,
1509
+ this.ctx.eventBus.emit(index.createEvent(
1510
+ index.EventCategory.MotionZonesRaw,
1512
1511
  analyzerSource,
1513
1512
  zonesPayload
1514
1513
  ));
1515
1514
  }
1516
1515
  runner.timingSampler.addMotionSample(deviceId, Date.now() - motionStart);
1517
1516
  } catch (error) {
1518
- const msg = types.errMsg(error);
1517
+ const msg = index.errMsg(error);
1519
1518
  log.error("runMotionAnalysis failed", { meta: { error: msg } });
1520
1519
  }
1521
1520
  }
@@ -1527,8 +1526,8 @@ class PipelineRunnerAddon extends types.BaseAddon {
1527
1526
  frame: result,
1528
1527
  nodeId: this.nodeId
1529
1528
  };
1530
- this.ctx.eventBus.emit(types.createEvent(
1531
- types.EventCategory.PipelineInferenceResult,
1529
+ this.ctx.eventBus.emit(index.createEvent(
1530
+ index.EventCategory.PipelineInferenceResult,
1532
1531
  { type: "device", id: deviceId, nodeId: this.nodeId },
1533
1532
  payload
1534
1533
  ));
@@ -1556,8 +1555,8 @@ class PipelineRunnerAddon extends types.BaseAddon {
1556
1555
  const heartbeatDue = !prev || timestamp - prev.emittedAt >= METRICS_HEARTBEAT_MS;
1557
1556
  if (prev && prev.json === json && !heartbeatDue) return;
1558
1557
  this.lastEmittedRunnerLoad = { json, emittedAt: timestamp };
1559
- ctx.eventBus.emit(types.createEvent(
1560
- types.EventCategory.PipelineRunnerLoadSnapshot,
1558
+ ctx.eventBus.emit(index.createEvent(
1559
+ index.EventCategory.PipelineRunnerLoadSnapshot,
1561
1560
  { type: "node", id: this.nodeId, nodeId: this.nodeId },
1562
1561
  { nodeId: this.nodeId, load, timestamp }
1563
1562
  ));
@@ -1572,8 +1571,8 @@ class PipelineRunnerAddon extends types.BaseAddon {
1572
1571
  const heartbeatDue = !prev || timestamp - prev.emittedAt >= METRICS_HEARTBEAT_MS;
1573
1572
  if (prev && prev.json === json && !heartbeatDue) continue;
1574
1573
  this.lastEmittedCameraMetrics.set(deviceId, { json, emittedAt: timestamp });
1575
- ctx.eventBus.emit(types.createEvent(
1576
- types.EventCategory.PipelineCameraMetricsSnapshot,
1574
+ ctx.eventBus.emit(index.createEvent(
1575
+ index.EventCategory.PipelineCameraMetricsSnapshot,
1577
1576
  { type: "device", id: deviceId, nodeId: this.nodeId },
1578
1577
  { deviceId, nodeId: this.nodeId, metrics, timestamp }
1579
1578
  ));