@camstack/addon-provider-onvif 1.1.29 → 1.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.js CHANGED
@@ -7642,6 +7642,160 @@ var EncodeProfileSchema = object({
7642
7642
  */
7643
7643
  outputArgs: array(string()).optional()
7644
7644
  });
7645
+ var COCO_TO_MACRO = {
7646
+ mapping: {
7647
+ person: "person",
7648
+ bicycle: "vehicle",
7649
+ car: "vehicle",
7650
+ motorcycle: "vehicle",
7651
+ airplane: "vehicle",
7652
+ bus: "vehicle",
7653
+ train: "vehicle",
7654
+ truck: "vehicle",
7655
+ boat: "vehicle",
7656
+ bird: "animal",
7657
+ cat: "animal",
7658
+ dog: "animal",
7659
+ horse: "animal",
7660
+ sheep: "animal",
7661
+ cow: "animal",
7662
+ elephant: "animal",
7663
+ bear: "animal",
7664
+ zebra: "animal",
7665
+ giraffe: "animal",
7666
+ suitcase: "package",
7667
+ backpack: "package",
7668
+ handbag: "package"
7669
+ },
7670
+ preserveOriginal: false
7671
+ };
7672
+ var AUDIO_MACRO_LABELS = [
7673
+ {
7674
+ id: "speech",
7675
+ name: "Speech",
7676
+ icon: "🗣️"
7677
+ },
7678
+ {
7679
+ id: "scream",
7680
+ name: "Scream / Shout",
7681
+ icon: "😱"
7682
+ },
7683
+ {
7684
+ id: "crying",
7685
+ name: "Crying / Baby",
7686
+ icon: "😢"
7687
+ },
7688
+ {
7689
+ id: "laughter",
7690
+ name: "Laughter",
7691
+ icon: "😂"
7692
+ },
7693
+ {
7694
+ id: "music",
7695
+ name: "Music",
7696
+ icon: "🎵"
7697
+ },
7698
+ {
7699
+ id: "dog",
7700
+ name: "Dog",
7701
+ icon: "🐕"
7702
+ },
7703
+ {
7704
+ id: "cat",
7705
+ name: "Cat",
7706
+ icon: "🐈"
7707
+ },
7708
+ {
7709
+ id: "bird",
7710
+ name: "Bird",
7711
+ icon: "🐦"
7712
+ },
7713
+ {
7714
+ id: "animal",
7715
+ name: "Animal (other)",
7716
+ icon: "🐾"
7717
+ },
7718
+ {
7719
+ id: "alarm",
7720
+ name: "Alarm / Siren",
7721
+ icon: "🚨"
7722
+ },
7723
+ {
7724
+ id: "doorbell",
7725
+ name: "Doorbell / Knock",
7726
+ icon: "🔔"
7727
+ },
7728
+ {
7729
+ id: "glass_breaking",
7730
+ name: "Glass Breaking",
7731
+ icon: "💥"
7732
+ },
7733
+ {
7734
+ id: "gunshot",
7735
+ name: "Gunshot / Explosion",
7736
+ icon: "💣"
7737
+ },
7738
+ {
7739
+ id: "vehicle",
7740
+ name: "Vehicle",
7741
+ icon: "🚗"
7742
+ },
7743
+ {
7744
+ id: "siren",
7745
+ name: "Emergency Siren",
7746
+ icon: "🚑"
7747
+ },
7748
+ {
7749
+ id: "fire",
7750
+ name: "Fire / Smoke",
7751
+ icon: "🔥"
7752
+ },
7753
+ {
7754
+ id: "water",
7755
+ name: "Water",
7756
+ icon: "💧"
7757
+ },
7758
+ {
7759
+ id: "wind",
7760
+ name: "Wind / Weather",
7761
+ icon: "🌬️"
7762
+ },
7763
+ {
7764
+ id: "door",
7765
+ name: "Door",
7766
+ icon: "🚪"
7767
+ },
7768
+ {
7769
+ id: "footsteps",
7770
+ name: "Footsteps",
7771
+ icon: "👣"
7772
+ },
7773
+ {
7774
+ id: "crowd",
7775
+ name: "Crowd / Chatter",
7776
+ icon: "👥"
7777
+ },
7778
+ {
7779
+ id: "telephone",
7780
+ name: "Telephone",
7781
+ icon: "📞"
7782
+ },
7783
+ {
7784
+ id: "engine",
7785
+ name: "Engine / Motor",
7786
+ icon: "⚙️"
7787
+ },
7788
+ {
7789
+ id: "tools",
7790
+ name: "Tools / Construction",
7791
+ icon: "🔨"
7792
+ },
7793
+ {
7794
+ id: "silence",
7795
+ name: "Silence",
7796
+ icon: "🤫"
7797
+ }
7798
+ ];
7645
7799
  var YAMNET_TO_MACRO = {
7646
7800
  mapping: {
7647
7801
  Speech: "speech",
@@ -7908,6 +8062,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7908
8062
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7909
8063
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7910
8064
  /**
8065
+ * Unified event-kind taxonomy — THE single source of truth for
8066
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8067
+ * icon }`.
8068
+ *
8069
+ * This dictionary folds together what used to be scattered across four
8070
+ * copies:
8071
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8072
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8073
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8074
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8075
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8076
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8077
+ *
8078
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8079
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8080
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8081
+ * color or an icon: they read this dictionary (server descriptors carry the
8082
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8083
+ *
8084
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8085
+ */
8086
+ var TAXONOMY_COLORS = {
8087
+ motion: "#f59e0b",
8088
+ audio: "#06b6d4",
8089
+ person: "#22c55e",
8090
+ vehicle: "#3b82f6",
8091
+ animal: "#f97316",
8092
+ package: "#a855f7",
8093
+ sensor: "#8b5cf6",
8094
+ control: "#10b981",
8095
+ genericDetection: "#64748b"
8096
+ };
8097
+ var DETECTION_SUB_COLORS = {
8098
+ car: "#f59e0b",
8099
+ truck: "#d97706",
8100
+ bus: "#b45309",
8101
+ motorcycle: "#eab308",
8102
+ bicycle: "#ca8a04",
8103
+ airplane: "#60a5fa",
8104
+ boat: "#2563eb",
8105
+ train: "#1d4ed8",
8106
+ bird: "#14b8a6",
8107
+ dog: "#84cc16",
8108
+ cat: "#f97316",
8109
+ horse: "#a16207",
8110
+ sheep: "#a3a3a3",
8111
+ cow: "#78716c",
8112
+ elephant: "#6b7280",
8113
+ bear: "#7c2d12",
8114
+ zebra: "#404040",
8115
+ giraffe: "#d4a373"
8116
+ };
8117
+ function titleCase(id) {
8118
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8119
+ }
8120
+ var entries = /* @__PURE__ */ new Map();
8121
+ function macro(kind, category, color, iconId, label) {
8122
+ entries.set(kind, {
8123
+ kind,
8124
+ parentKind: null,
8125
+ level: "macro",
8126
+ category,
8127
+ color,
8128
+ iconId,
8129
+ labelKey: `eventKind.${kind}`,
8130
+ label
8131
+ });
8132
+ }
8133
+ function sub(kind, parentKind, category, color, iconId, label) {
8134
+ entries.set(kind, {
8135
+ kind,
8136
+ parentKind,
8137
+ level: "sub",
8138
+ category,
8139
+ color,
8140
+ iconId,
8141
+ labelKey: `eventKind.${kind}`,
8142
+ label
8143
+ });
8144
+ }
8145
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8146
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8147
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8148
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8149
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8150
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8151
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8152
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8153
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8154
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8155
+ if (entries.has(cocoClass)) continue;
8156
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8157
+ }
8158
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8159
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8160
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8161
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8162
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8163
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8164
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8165
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8166
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8167
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8168
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8169
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8170
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8171
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8172
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8173
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8174
+ sub("button", "control", "control", "#10b981", "button", "Button");
8175
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8176
+ for (const l of AUDIO_MACRO_LABELS) {
8177
+ const kind = `audio-${l.id}`;
8178
+ if (entries.has(kind)) continue;
8179
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8180
+ }
8181
+ /** The complete taxonomy dictionary, keyed by kind. */
8182
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8183
+ /**
7911
8184
  * Error types for the safe expression engine. Two distinct classes so callers
7912
8185
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7913
8186
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -16321,17 +16594,30 @@ var EventKindCategorySchema = _enum([
16321
16594
  "audio",
16322
16595
  "detection",
16323
16596
  "sensor",
16597
+ "control",
16324
16598
  "custom",
16325
16599
  "package"
16326
16600
  ]);
16601
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16602
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
16327
16603
  var EventKindDescriptorSchema = object({
16328
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16604
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16329
16605
  kind: string(),
16606
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16607
+ labelKey: string(),
16608
+ /** English fallback label (kept for clients that don't translate). */
16330
16609
  label: string(),
16331
16610
  /** Hex color for timeline/legend rendering. */
16332
16611
  color: string(),
16612
+ /** Dictionary id → lucide component on the UI side. */
16613
+ iconId: string(),
16614
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16333
16615
  icon: EventKindIconSchema,
16334
16616
  category: EventKindCategorySchema,
16617
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16618
+ parentKind: string().nullable(),
16619
+ /** Derived from `parentKind`, explicit for the client tree. */
16620
+ level: EventKindLevelSchema,
16335
16621
  /** Which cap + device contributes this kind. For built-ins the camera
16336
16622
  * itself; for sensor kinds the LINKED source device. */
16337
16623
  source: object({
@@ -16404,11 +16690,21 @@ var TrackAudioLabelSchema = object({
16404
16690
  firstAt: number(),
16405
16691
  lastAt: number()
16406
16692
  });
16693
+ /**
16694
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16695
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16696
+ * linked sensor/control state change (no positions; carries a snapshot). The
16697
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16698
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16699
+ */
16700
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16407
16701
  var TrackSchema = object({
16408
16702
  trackId: string(),
16409
16703
  deviceId: number(),
16410
16704
  className: string(),
16411
16705
  label: string().optional(),
16706
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16707
+ source: TrackSourceSchema.optional(),
16412
16708
  firstSeen: number(),
16413
16709
  lastSeen: number(),
16414
16710
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16785,6 +17081,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16785
17081
  eventId: string(),
16786
17082
  timestamp: number()
16787
17083
  });
17084
+ /**
17085
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
17086
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
17087
+ * caps into per-camera event-kind descriptors.
17088
+ *
17089
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
17090
+ * is NOT duplicated here — every entry is derived from the single
17091
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
17092
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
17093
+ * control cap means adding one line here (and a taxonomy entry); the anti-
17094
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
17095
+ * eventful cap is missing.
17096
+ */
17097
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
17098
+ var LEGACY_ICON = {
17099
+ motion: "motion",
17100
+ audio: "audio",
17101
+ person: "person",
17102
+ vehicle: "vehicle",
17103
+ animal: "animal",
17104
+ package: "package",
17105
+ door: "door",
17106
+ pir: "pir",
17107
+ smoke: "smoke",
17108
+ water: "water",
17109
+ button: "button",
17110
+ generic: "generic",
17111
+ gas: "smoke",
17112
+ vibration: "generic",
17113
+ tamper: "generic",
17114
+ presence: "person",
17115
+ lock: "generic",
17116
+ siren: "generic",
17117
+ switch: "generic",
17118
+ doorbell: "button"
17119
+ };
17120
+ function legacyIcon(iconId) {
17121
+ return LEGACY_ICON[iconId] ?? "generic";
17122
+ }
17123
+ /**
17124
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
17125
+ * The anti-drift guard cross-checks this against the eventful caps declared
17126
+ * in `packages/types/src/capabilities/*.cap.ts`.
17127
+ */
17128
+ var CAP_TO_KIND = {
17129
+ contact: "contact",
17130
+ motion: "motion-sensor",
17131
+ smoke: "smoke",
17132
+ flood: "flood",
17133
+ gas: "gas",
17134
+ "carbon-monoxide": "carbon-monoxide",
17135
+ vibration: "vibration",
17136
+ tamper: "tamper",
17137
+ presence: "presence",
17138
+ "enum-sensor": "enum-sensor",
17139
+ "event-emitter": "device-event",
17140
+ "lock-control": "lock",
17141
+ switch: "switch",
17142
+ button: "button",
17143
+ doorbell: "doorbell"
17144
+ };
17145
+ function buildDescriptor(capName, kind) {
17146
+ const t = EVENT_TAXONOMY[kind];
17147
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
17148
+ return {
17149
+ ...t,
17150
+ icon: legacyIcon(t.iconId)
17151
+ };
17152
+ }
17153
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16788
17154
  var CameraPipelineConfigSchema = object({
16789
17155
  engine: PipelineEngineChoiceSchema.optional(),
16790
17156
  steps: array(PipelineStepInputSchema).readonly(),
package/dist/addon.mjs CHANGED
@@ -7643,6 +7643,160 @@ var EncodeProfileSchema = object({
7643
7643
  */
7644
7644
  outputArgs: array(string()).optional()
7645
7645
  });
7646
+ var COCO_TO_MACRO = {
7647
+ mapping: {
7648
+ person: "person",
7649
+ bicycle: "vehicle",
7650
+ car: "vehicle",
7651
+ motorcycle: "vehicle",
7652
+ airplane: "vehicle",
7653
+ bus: "vehicle",
7654
+ train: "vehicle",
7655
+ truck: "vehicle",
7656
+ boat: "vehicle",
7657
+ bird: "animal",
7658
+ cat: "animal",
7659
+ dog: "animal",
7660
+ horse: "animal",
7661
+ sheep: "animal",
7662
+ cow: "animal",
7663
+ elephant: "animal",
7664
+ bear: "animal",
7665
+ zebra: "animal",
7666
+ giraffe: "animal",
7667
+ suitcase: "package",
7668
+ backpack: "package",
7669
+ handbag: "package"
7670
+ },
7671
+ preserveOriginal: false
7672
+ };
7673
+ var AUDIO_MACRO_LABELS = [
7674
+ {
7675
+ id: "speech",
7676
+ name: "Speech",
7677
+ icon: "🗣️"
7678
+ },
7679
+ {
7680
+ id: "scream",
7681
+ name: "Scream / Shout",
7682
+ icon: "😱"
7683
+ },
7684
+ {
7685
+ id: "crying",
7686
+ name: "Crying / Baby",
7687
+ icon: "😢"
7688
+ },
7689
+ {
7690
+ id: "laughter",
7691
+ name: "Laughter",
7692
+ icon: "😂"
7693
+ },
7694
+ {
7695
+ id: "music",
7696
+ name: "Music",
7697
+ icon: "🎵"
7698
+ },
7699
+ {
7700
+ id: "dog",
7701
+ name: "Dog",
7702
+ icon: "🐕"
7703
+ },
7704
+ {
7705
+ id: "cat",
7706
+ name: "Cat",
7707
+ icon: "🐈"
7708
+ },
7709
+ {
7710
+ id: "bird",
7711
+ name: "Bird",
7712
+ icon: "🐦"
7713
+ },
7714
+ {
7715
+ id: "animal",
7716
+ name: "Animal (other)",
7717
+ icon: "🐾"
7718
+ },
7719
+ {
7720
+ id: "alarm",
7721
+ name: "Alarm / Siren",
7722
+ icon: "🚨"
7723
+ },
7724
+ {
7725
+ id: "doorbell",
7726
+ name: "Doorbell / Knock",
7727
+ icon: "🔔"
7728
+ },
7729
+ {
7730
+ id: "glass_breaking",
7731
+ name: "Glass Breaking",
7732
+ icon: "💥"
7733
+ },
7734
+ {
7735
+ id: "gunshot",
7736
+ name: "Gunshot / Explosion",
7737
+ icon: "💣"
7738
+ },
7739
+ {
7740
+ id: "vehicle",
7741
+ name: "Vehicle",
7742
+ icon: "🚗"
7743
+ },
7744
+ {
7745
+ id: "siren",
7746
+ name: "Emergency Siren",
7747
+ icon: "🚑"
7748
+ },
7749
+ {
7750
+ id: "fire",
7751
+ name: "Fire / Smoke",
7752
+ icon: "🔥"
7753
+ },
7754
+ {
7755
+ id: "water",
7756
+ name: "Water",
7757
+ icon: "💧"
7758
+ },
7759
+ {
7760
+ id: "wind",
7761
+ name: "Wind / Weather",
7762
+ icon: "🌬️"
7763
+ },
7764
+ {
7765
+ id: "door",
7766
+ name: "Door",
7767
+ icon: "🚪"
7768
+ },
7769
+ {
7770
+ id: "footsteps",
7771
+ name: "Footsteps",
7772
+ icon: "👣"
7773
+ },
7774
+ {
7775
+ id: "crowd",
7776
+ name: "Crowd / Chatter",
7777
+ icon: "👥"
7778
+ },
7779
+ {
7780
+ id: "telephone",
7781
+ name: "Telephone",
7782
+ icon: "📞"
7783
+ },
7784
+ {
7785
+ id: "engine",
7786
+ name: "Engine / Motor",
7787
+ icon: "⚙️"
7788
+ },
7789
+ {
7790
+ id: "tools",
7791
+ name: "Tools / Construction",
7792
+ icon: "🔨"
7793
+ },
7794
+ {
7795
+ id: "silence",
7796
+ name: "Silence",
7797
+ icon: "🤫"
7798
+ }
7799
+ ];
7646
7800
  var YAMNET_TO_MACRO = {
7647
7801
  mapping: {
7648
7802
  Speech: "speech",
@@ -7909,6 +8063,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7909
8063
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7910
8064
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7911
8065
  /**
8066
+ * Unified event-kind taxonomy — THE single source of truth for
8067
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8068
+ * icon }`.
8069
+ *
8070
+ * This dictionary folds together what used to be scattered across four
8071
+ * copies:
8072
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8073
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8074
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8075
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8076
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8077
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8078
+ *
8079
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8080
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8081
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8082
+ * color or an icon: they read this dictionary (server descriptors carry the
8083
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8084
+ *
8085
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8086
+ */
8087
+ var TAXONOMY_COLORS = {
8088
+ motion: "#f59e0b",
8089
+ audio: "#06b6d4",
8090
+ person: "#22c55e",
8091
+ vehicle: "#3b82f6",
8092
+ animal: "#f97316",
8093
+ package: "#a855f7",
8094
+ sensor: "#8b5cf6",
8095
+ control: "#10b981",
8096
+ genericDetection: "#64748b"
8097
+ };
8098
+ var DETECTION_SUB_COLORS = {
8099
+ car: "#f59e0b",
8100
+ truck: "#d97706",
8101
+ bus: "#b45309",
8102
+ motorcycle: "#eab308",
8103
+ bicycle: "#ca8a04",
8104
+ airplane: "#60a5fa",
8105
+ boat: "#2563eb",
8106
+ train: "#1d4ed8",
8107
+ bird: "#14b8a6",
8108
+ dog: "#84cc16",
8109
+ cat: "#f97316",
8110
+ horse: "#a16207",
8111
+ sheep: "#a3a3a3",
8112
+ cow: "#78716c",
8113
+ elephant: "#6b7280",
8114
+ bear: "#7c2d12",
8115
+ zebra: "#404040",
8116
+ giraffe: "#d4a373"
8117
+ };
8118
+ function titleCase(id) {
8119
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8120
+ }
8121
+ var entries = /* @__PURE__ */ new Map();
8122
+ function macro(kind, category, color, iconId, label) {
8123
+ entries.set(kind, {
8124
+ kind,
8125
+ parentKind: null,
8126
+ level: "macro",
8127
+ category,
8128
+ color,
8129
+ iconId,
8130
+ labelKey: `eventKind.${kind}`,
8131
+ label
8132
+ });
8133
+ }
8134
+ function sub(kind, parentKind, category, color, iconId, label) {
8135
+ entries.set(kind, {
8136
+ kind,
8137
+ parentKind,
8138
+ level: "sub",
8139
+ category,
8140
+ color,
8141
+ iconId,
8142
+ labelKey: `eventKind.${kind}`,
8143
+ label
8144
+ });
8145
+ }
8146
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8147
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8148
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8149
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8150
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8151
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8152
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8153
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8154
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8155
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8156
+ if (entries.has(cocoClass)) continue;
8157
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8158
+ }
8159
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8160
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8161
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8162
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8163
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8164
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8165
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8166
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8167
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8168
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8169
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8170
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8171
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8172
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8173
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8174
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8175
+ sub("button", "control", "control", "#10b981", "button", "Button");
8176
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8177
+ for (const l of AUDIO_MACRO_LABELS) {
8178
+ const kind = `audio-${l.id}`;
8179
+ if (entries.has(kind)) continue;
8180
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8181
+ }
8182
+ /** The complete taxonomy dictionary, keyed by kind. */
8183
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8184
+ /**
7912
8185
  * Error types for the safe expression engine. Two distinct classes so callers
7913
8186
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7914
8187
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -16322,17 +16595,30 @@ var EventKindCategorySchema = _enum([
16322
16595
  "audio",
16323
16596
  "detection",
16324
16597
  "sensor",
16598
+ "control",
16325
16599
  "custom",
16326
16600
  "package"
16327
16601
  ]);
16602
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16603
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
16328
16604
  var EventKindDescriptorSchema = object({
16329
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16605
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16330
16606
  kind: string(),
16607
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16608
+ labelKey: string(),
16609
+ /** English fallback label (kept for clients that don't translate). */
16331
16610
  label: string(),
16332
16611
  /** Hex color for timeline/legend rendering. */
16333
16612
  color: string(),
16613
+ /** Dictionary id → lucide component on the UI side. */
16614
+ iconId: string(),
16615
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16334
16616
  icon: EventKindIconSchema,
16335
16617
  category: EventKindCategorySchema,
16618
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16619
+ parentKind: string().nullable(),
16620
+ /** Derived from `parentKind`, explicit for the client tree. */
16621
+ level: EventKindLevelSchema,
16336
16622
  /** Which cap + device contributes this kind. For built-ins the camera
16337
16623
  * itself; for sensor kinds the LINKED source device. */
16338
16624
  source: object({
@@ -16405,11 +16691,21 @@ var TrackAudioLabelSchema = object({
16405
16691
  firstAt: number(),
16406
16692
  lastAt: number()
16407
16693
  });
16694
+ /**
16695
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16696
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16697
+ * linked sensor/control state change (no positions; carries a snapshot). The
16698
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16699
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16700
+ */
16701
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16408
16702
  var TrackSchema = object({
16409
16703
  trackId: string(),
16410
16704
  deviceId: number(),
16411
16705
  className: string(),
16412
16706
  label: string().optional(),
16707
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16708
+ source: TrackSourceSchema.optional(),
16413
16709
  firstSeen: number(),
16414
16710
  lastSeen: number(),
16415
16711
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16786,6 +17082,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16786
17082
  eventId: string(),
16787
17083
  timestamp: number()
16788
17084
  });
17085
+ /**
17086
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
17087
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
17088
+ * caps into per-camera event-kind descriptors.
17089
+ *
17090
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
17091
+ * is NOT duplicated here — every entry is derived from the single
17092
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
17093
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
17094
+ * control cap means adding one line here (and a taxonomy entry); the anti-
17095
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
17096
+ * eventful cap is missing.
17097
+ */
17098
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
17099
+ var LEGACY_ICON = {
17100
+ motion: "motion",
17101
+ audio: "audio",
17102
+ person: "person",
17103
+ vehicle: "vehicle",
17104
+ animal: "animal",
17105
+ package: "package",
17106
+ door: "door",
17107
+ pir: "pir",
17108
+ smoke: "smoke",
17109
+ water: "water",
17110
+ button: "button",
17111
+ generic: "generic",
17112
+ gas: "smoke",
17113
+ vibration: "generic",
17114
+ tamper: "generic",
17115
+ presence: "person",
17116
+ lock: "generic",
17117
+ siren: "generic",
17118
+ switch: "generic",
17119
+ doorbell: "button"
17120
+ };
17121
+ function legacyIcon(iconId) {
17122
+ return LEGACY_ICON[iconId] ?? "generic";
17123
+ }
17124
+ /**
17125
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
17126
+ * The anti-drift guard cross-checks this against the eventful caps declared
17127
+ * in `packages/types/src/capabilities/*.cap.ts`.
17128
+ */
17129
+ var CAP_TO_KIND = {
17130
+ contact: "contact",
17131
+ motion: "motion-sensor",
17132
+ smoke: "smoke",
17133
+ flood: "flood",
17134
+ gas: "gas",
17135
+ "carbon-monoxide": "carbon-monoxide",
17136
+ vibration: "vibration",
17137
+ tamper: "tamper",
17138
+ presence: "presence",
17139
+ "enum-sensor": "enum-sensor",
17140
+ "event-emitter": "device-event",
17141
+ "lock-control": "lock",
17142
+ switch: "switch",
17143
+ button: "button",
17144
+ doorbell: "doorbell"
17145
+ };
17146
+ function buildDescriptor(capName, kind) {
17147
+ const t = EVENT_TAXONOMY[kind];
17148
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
17149
+ return {
17150
+ ...t,
17151
+ icon: legacyIcon(t.iconId)
17152
+ };
17153
+ }
17154
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16789
17155
  var CameraPipelineConfigSchema = object({
16790
17156
  engine: PipelineEngineChoiceSchema.optional(),
16791
17157
  steps: array(PipelineStepInputSchema).readonly(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-onvif",
3
- "version": "1.1.29",
3
+ "version": "1.1.30",
4
4
  "description": "ONVIF camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",