@camstack/addon-matter-broker 0.1.24 → 0.1.25

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
@@ -7671,6 +7671,160 @@ var EncodeProfileSchema = object({
7671
7671
  */
7672
7672
  outputArgs: array(string$2()).optional()
7673
7673
  });
7674
+ var COCO_TO_MACRO = {
7675
+ mapping: {
7676
+ person: "person",
7677
+ bicycle: "vehicle",
7678
+ car: "vehicle",
7679
+ motorcycle: "vehicle",
7680
+ airplane: "vehicle",
7681
+ bus: "vehicle",
7682
+ train: "vehicle",
7683
+ truck: "vehicle",
7684
+ boat: "vehicle",
7685
+ bird: "animal",
7686
+ cat: "animal",
7687
+ dog: "animal",
7688
+ horse: "animal",
7689
+ sheep: "animal",
7690
+ cow: "animal",
7691
+ elephant: "animal",
7692
+ bear: "animal",
7693
+ zebra: "animal",
7694
+ giraffe: "animal",
7695
+ suitcase: "package",
7696
+ backpack: "package",
7697
+ handbag: "package"
7698
+ },
7699
+ preserveOriginal: false
7700
+ };
7701
+ var AUDIO_MACRO_LABELS = [
7702
+ {
7703
+ id: "speech",
7704
+ name: "Speech",
7705
+ icon: "🗣️"
7706
+ },
7707
+ {
7708
+ id: "scream",
7709
+ name: "Scream / Shout",
7710
+ icon: "😱"
7711
+ },
7712
+ {
7713
+ id: "crying",
7714
+ name: "Crying / Baby",
7715
+ icon: "😢"
7716
+ },
7717
+ {
7718
+ id: "laughter",
7719
+ name: "Laughter",
7720
+ icon: "😂"
7721
+ },
7722
+ {
7723
+ id: "music",
7724
+ name: "Music",
7725
+ icon: "🎵"
7726
+ },
7727
+ {
7728
+ id: "dog",
7729
+ name: "Dog",
7730
+ icon: "🐕"
7731
+ },
7732
+ {
7733
+ id: "cat",
7734
+ name: "Cat",
7735
+ icon: "🐈"
7736
+ },
7737
+ {
7738
+ id: "bird",
7739
+ name: "Bird",
7740
+ icon: "🐦"
7741
+ },
7742
+ {
7743
+ id: "animal",
7744
+ name: "Animal (other)",
7745
+ icon: "🐾"
7746
+ },
7747
+ {
7748
+ id: "alarm",
7749
+ name: "Alarm / Siren",
7750
+ icon: "🚨"
7751
+ },
7752
+ {
7753
+ id: "doorbell",
7754
+ name: "Doorbell / Knock",
7755
+ icon: "🔔"
7756
+ },
7757
+ {
7758
+ id: "glass_breaking",
7759
+ name: "Glass Breaking",
7760
+ icon: "💥"
7761
+ },
7762
+ {
7763
+ id: "gunshot",
7764
+ name: "Gunshot / Explosion",
7765
+ icon: "💣"
7766
+ },
7767
+ {
7768
+ id: "vehicle",
7769
+ name: "Vehicle",
7770
+ icon: "🚗"
7771
+ },
7772
+ {
7773
+ id: "siren",
7774
+ name: "Emergency Siren",
7775
+ icon: "🚑"
7776
+ },
7777
+ {
7778
+ id: "fire",
7779
+ name: "Fire / Smoke",
7780
+ icon: "🔥"
7781
+ },
7782
+ {
7783
+ id: "water",
7784
+ name: "Water",
7785
+ icon: "💧"
7786
+ },
7787
+ {
7788
+ id: "wind",
7789
+ name: "Wind / Weather",
7790
+ icon: "🌬️"
7791
+ },
7792
+ {
7793
+ id: "door",
7794
+ name: "Door",
7795
+ icon: "🚪"
7796
+ },
7797
+ {
7798
+ id: "footsteps",
7799
+ name: "Footsteps",
7800
+ icon: "👣"
7801
+ },
7802
+ {
7803
+ id: "crowd",
7804
+ name: "Crowd / Chatter",
7805
+ icon: "👥"
7806
+ },
7807
+ {
7808
+ id: "telephone",
7809
+ name: "Telephone",
7810
+ icon: "📞"
7811
+ },
7812
+ {
7813
+ id: "engine",
7814
+ name: "Engine / Motor",
7815
+ icon: "⚙️"
7816
+ },
7817
+ {
7818
+ id: "tools",
7819
+ name: "Tools / Construction",
7820
+ icon: "🔨"
7821
+ },
7822
+ {
7823
+ id: "silence",
7824
+ name: "Silence",
7825
+ icon: "🤫"
7826
+ }
7827
+ ];
7674
7828
  var YAMNET_TO_MACRO = {
7675
7829
  mapping: {
7676
7830
  Speech: "speech",
@@ -7937,6 +8091,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7937
8091
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7938
8092
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7939
8093
  /**
8094
+ * Unified event-kind taxonomy — THE single source of truth for
8095
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8096
+ * icon }`.
8097
+ *
8098
+ * This dictionary folds together what used to be scattered across four
8099
+ * copies:
8100
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8101
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8102
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8103
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8104
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8105
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8106
+ *
8107
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8108
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8109
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8110
+ * color or an icon: they read this dictionary (server descriptors carry the
8111
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8112
+ *
8113
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8114
+ */
8115
+ var TAXONOMY_COLORS = {
8116
+ motion: "#f59e0b",
8117
+ audio: "#06b6d4",
8118
+ person: "#22c55e",
8119
+ vehicle: "#3b82f6",
8120
+ animal: "#f97316",
8121
+ package: "#a855f7",
8122
+ sensor: "#8b5cf6",
8123
+ control: "#10b981",
8124
+ genericDetection: "#64748b"
8125
+ };
8126
+ var DETECTION_SUB_COLORS = {
8127
+ car: "#f59e0b",
8128
+ truck: "#d97706",
8129
+ bus: "#b45309",
8130
+ motorcycle: "#eab308",
8131
+ bicycle: "#ca8a04",
8132
+ airplane: "#60a5fa",
8133
+ boat: "#2563eb",
8134
+ train: "#1d4ed8",
8135
+ bird: "#14b8a6",
8136
+ dog: "#84cc16",
8137
+ cat: "#f97316",
8138
+ horse: "#a16207",
8139
+ sheep: "#a3a3a3",
8140
+ cow: "#78716c",
8141
+ elephant: "#6b7280",
8142
+ bear: "#7c2d12",
8143
+ zebra: "#404040",
8144
+ giraffe: "#d4a373"
8145
+ };
8146
+ function titleCase(id) {
8147
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8148
+ }
8149
+ var entries = /* @__PURE__ */ new Map();
8150
+ function macro(kind, category, color, iconId, label) {
8151
+ entries.set(kind, {
8152
+ kind,
8153
+ parentKind: null,
8154
+ level: "macro",
8155
+ category,
8156
+ color,
8157
+ iconId,
8158
+ labelKey: `eventKind.${kind}`,
8159
+ label
8160
+ });
8161
+ }
8162
+ function sub(kind, parentKind, category, color, iconId, label) {
8163
+ entries.set(kind, {
8164
+ kind,
8165
+ parentKind,
8166
+ level: "sub",
8167
+ category,
8168
+ color,
8169
+ iconId,
8170
+ labelKey: `eventKind.${kind}`,
8171
+ label
8172
+ });
8173
+ }
8174
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8175
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8176
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8177
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8178
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8179
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8180
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8181
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8182
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8183
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8184
+ if (entries.has(cocoClass)) continue;
8185
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8186
+ }
8187
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8188
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8189
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8190
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8191
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8192
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8193
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8194
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8195
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8196
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8197
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8198
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8199
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8200
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8201
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8202
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8203
+ sub("button", "control", "control", "#10b981", "button", "Button");
8204
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8205
+ for (const l of AUDIO_MACRO_LABELS) {
8206
+ const kind = `audio-${l.id}`;
8207
+ if (entries.has(kind)) continue;
8208
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8209
+ }
8210
+ /** The complete taxonomy dictionary, keyed by kind. */
8211
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8212
+ /**
7940
8213
  * Error types for the safe expression engine. Two distinct classes so callers
7941
8214
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7942
8215
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -18935,17 +19208,30 @@ var EventKindCategorySchema = _enum([
18935
19208
  "audio",
18936
19209
  "detection",
18937
19210
  "sensor",
19211
+ "control",
18938
19212
  "custom",
18939
19213
  "package"
18940
19214
  ]);
19215
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19216
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18941
19217
  var EventKindDescriptorSchema = object({
18942
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19218
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18943
19219
  kind: string$2(),
19220
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19221
+ labelKey: string$2(),
19222
+ /** English fallback label (kept for clients that don't translate). */
18944
19223
  label: string$2(),
18945
19224
  /** Hex color for timeline/legend rendering. */
18946
19225
  color: string$2(),
19226
+ /** Dictionary id → lucide component on the UI side. */
19227
+ iconId: string$2(),
19228
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18947
19229
  icon: EventKindIconSchema,
18948
19230
  category: EventKindCategorySchema,
19231
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19232
+ parentKind: string$2().nullable(),
19233
+ /** Derived from `parentKind`, explicit for the client tree. */
19234
+ level: EventKindLevelSchema,
18949
19235
  /** Which cap + device contributes this kind. For built-ins the camera
18950
19236
  * itself; for sensor kinds the LINKED source device. */
18951
19237
  source: object({
@@ -19018,11 +19304,21 @@ var TrackAudioLabelSchema = object({
19018
19304
  firstAt: number(),
19019
19305
  lastAt: number()
19020
19306
  });
19307
+ /**
19308
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19309
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19310
+ * linked sensor/control state change (no positions; carries a snapshot). The
19311
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19312
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19313
+ */
19314
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19021
19315
  var TrackSchema = object({
19022
19316
  trackId: string$2(),
19023
19317
  deviceId: number(),
19024
19318
  className: string$2(),
19025
19319
  label: string$2().optional(),
19320
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19321
+ source: TrackSourceSchema.optional(),
19026
19322
  firstSeen: number(),
19027
19323
  lastSeen: number(),
19028
19324
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19399,6 +19695,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19399
19695
  eventId: string$2(),
19400
19696
  timestamp: number()
19401
19697
  });
19698
+ /**
19699
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19700
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19701
+ * caps into per-camera event-kind descriptors.
19702
+ *
19703
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19704
+ * is NOT duplicated here — every entry is derived from the single
19705
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19706
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19707
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19708
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19709
+ * eventful cap is missing.
19710
+ */
19711
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19712
+ var LEGACY_ICON = {
19713
+ motion: "motion",
19714
+ audio: "audio",
19715
+ person: "person",
19716
+ vehicle: "vehicle",
19717
+ animal: "animal",
19718
+ package: "package",
19719
+ door: "door",
19720
+ pir: "pir",
19721
+ smoke: "smoke",
19722
+ water: "water",
19723
+ button: "button",
19724
+ generic: "generic",
19725
+ gas: "smoke",
19726
+ vibration: "generic",
19727
+ tamper: "generic",
19728
+ presence: "person",
19729
+ lock: "generic",
19730
+ siren: "generic",
19731
+ switch: "generic",
19732
+ doorbell: "button"
19733
+ };
19734
+ function legacyIcon(iconId) {
19735
+ return LEGACY_ICON[iconId] ?? "generic";
19736
+ }
19737
+ /**
19738
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19739
+ * The anti-drift guard cross-checks this against the eventful caps declared
19740
+ * in `packages/types/src/capabilities/*.cap.ts`.
19741
+ */
19742
+ var CAP_TO_KIND = {
19743
+ contact: "contact",
19744
+ motion: "motion-sensor",
19745
+ smoke: "smoke",
19746
+ flood: "flood",
19747
+ gas: "gas",
19748
+ "carbon-monoxide": "carbon-monoxide",
19749
+ vibration: "vibration",
19750
+ tamper: "tamper",
19751
+ presence: "presence",
19752
+ "enum-sensor": "enum-sensor",
19753
+ "event-emitter": "device-event",
19754
+ "lock-control": "lock",
19755
+ switch: "switch",
19756
+ button: "button",
19757
+ doorbell: "doorbell"
19758
+ };
19759
+ function buildDescriptor(capName, kind) {
19760
+ const t = EVENT_TAXONOMY[kind];
19761
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19762
+ return {
19763
+ ...t,
19764
+ icon: legacyIcon(t.iconId)
19765
+ };
19766
+ }
19767
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19402
19768
  var CameraPipelineConfigSchema = object({
19403
19769
  engine: PipelineEngineChoiceSchema.optional(),
19404
19770
  steps: array(PipelineStepInputSchema).readonly(),
package/dist/addon.mjs CHANGED
@@ -7669,6 +7669,160 @@ var EncodeProfileSchema = object({
7669
7669
  */
7670
7670
  outputArgs: array(string$2()).optional()
7671
7671
  });
7672
+ var COCO_TO_MACRO = {
7673
+ mapping: {
7674
+ person: "person",
7675
+ bicycle: "vehicle",
7676
+ car: "vehicle",
7677
+ motorcycle: "vehicle",
7678
+ airplane: "vehicle",
7679
+ bus: "vehicle",
7680
+ train: "vehicle",
7681
+ truck: "vehicle",
7682
+ boat: "vehicle",
7683
+ bird: "animal",
7684
+ cat: "animal",
7685
+ dog: "animal",
7686
+ horse: "animal",
7687
+ sheep: "animal",
7688
+ cow: "animal",
7689
+ elephant: "animal",
7690
+ bear: "animal",
7691
+ zebra: "animal",
7692
+ giraffe: "animal",
7693
+ suitcase: "package",
7694
+ backpack: "package",
7695
+ handbag: "package"
7696
+ },
7697
+ preserveOriginal: false
7698
+ };
7699
+ var AUDIO_MACRO_LABELS = [
7700
+ {
7701
+ id: "speech",
7702
+ name: "Speech",
7703
+ icon: "🗣️"
7704
+ },
7705
+ {
7706
+ id: "scream",
7707
+ name: "Scream / Shout",
7708
+ icon: "😱"
7709
+ },
7710
+ {
7711
+ id: "crying",
7712
+ name: "Crying / Baby",
7713
+ icon: "😢"
7714
+ },
7715
+ {
7716
+ id: "laughter",
7717
+ name: "Laughter",
7718
+ icon: "😂"
7719
+ },
7720
+ {
7721
+ id: "music",
7722
+ name: "Music",
7723
+ icon: "🎵"
7724
+ },
7725
+ {
7726
+ id: "dog",
7727
+ name: "Dog",
7728
+ icon: "🐕"
7729
+ },
7730
+ {
7731
+ id: "cat",
7732
+ name: "Cat",
7733
+ icon: "🐈"
7734
+ },
7735
+ {
7736
+ id: "bird",
7737
+ name: "Bird",
7738
+ icon: "🐦"
7739
+ },
7740
+ {
7741
+ id: "animal",
7742
+ name: "Animal (other)",
7743
+ icon: "🐾"
7744
+ },
7745
+ {
7746
+ id: "alarm",
7747
+ name: "Alarm / Siren",
7748
+ icon: "🚨"
7749
+ },
7750
+ {
7751
+ id: "doorbell",
7752
+ name: "Doorbell / Knock",
7753
+ icon: "🔔"
7754
+ },
7755
+ {
7756
+ id: "glass_breaking",
7757
+ name: "Glass Breaking",
7758
+ icon: "💥"
7759
+ },
7760
+ {
7761
+ id: "gunshot",
7762
+ name: "Gunshot / Explosion",
7763
+ icon: "💣"
7764
+ },
7765
+ {
7766
+ id: "vehicle",
7767
+ name: "Vehicle",
7768
+ icon: "🚗"
7769
+ },
7770
+ {
7771
+ id: "siren",
7772
+ name: "Emergency Siren",
7773
+ icon: "🚑"
7774
+ },
7775
+ {
7776
+ id: "fire",
7777
+ name: "Fire / Smoke",
7778
+ icon: "🔥"
7779
+ },
7780
+ {
7781
+ id: "water",
7782
+ name: "Water",
7783
+ icon: "💧"
7784
+ },
7785
+ {
7786
+ id: "wind",
7787
+ name: "Wind / Weather",
7788
+ icon: "🌬️"
7789
+ },
7790
+ {
7791
+ id: "door",
7792
+ name: "Door",
7793
+ icon: "🚪"
7794
+ },
7795
+ {
7796
+ id: "footsteps",
7797
+ name: "Footsteps",
7798
+ icon: "👣"
7799
+ },
7800
+ {
7801
+ id: "crowd",
7802
+ name: "Crowd / Chatter",
7803
+ icon: "👥"
7804
+ },
7805
+ {
7806
+ id: "telephone",
7807
+ name: "Telephone",
7808
+ icon: "📞"
7809
+ },
7810
+ {
7811
+ id: "engine",
7812
+ name: "Engine / Motor",
7813
+ icon: "⚙️"
7814
+ },
7815
+ {
7816
+ id: "tools",
7817
+ name: "Tools / Construction",
7818
+ icon: "🔨"
7819
+ },
7820
+ {
7821
+ id: "silence",
7822
+ name: "Silence",
7823
+ icon: "🤫"
7824
+ }
7825
+ ];
7672
7826
  var YAMNET_TO_MACRO = {
7673
7827
  mapping: {
7674
7828
  Speech: "speech",
@@ -7935,6 +8089,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7935
8089
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7936
8090
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7937
8091
  /**
8092
+ * Unified event-kind taxonomy — THE single source of truth for
8093
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8094
+ * icon }`.
8095
+ *
8096
+ * This dictionary folds together what used to be scattered across four
8097
+ * copies:
8098
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8099
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8100
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8101
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8102
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8103
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8104
+ *
8105
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8106
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8107
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8108
+ * color or an icon: they read this dictionary (server descriptors carry the
8109
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8110
+ *
8111
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8112
+ */
8113
+ var TAXONOMY_COLORS = {
8114
+ motion: "#f59e0b",
8115
+ audio: "#06b6d4",
8116
+ person: "#22c55e",
8117
+ vehicle: "#3b82f6",
8118
+ animal: "#f97316",
8119
+ package: "#a855f7",
8120
+ sensor: "#8b5cf6",
8121
+ control: "#10b981",
8122
+ genericDetection: "#64748b"
8123
+ };
8124
+ var DETECTION_SUB_COLORS = {
8125
+ car: "#f59e0b",
8126
+ truck: "#d97706",
8127
+ bus: "#b45309",
8128
+ motorcycle: "#eab308",
8129
+ bicycle: "#ca8a04",
8130
+ airplane: "#60a5fa",
8131
+ boat: "#2563eb",
8132
+ train: "#1d4ed8",
8133
+ bird: "#14b8a6",
8134
+ dog: "#84cc16",
8135
+ cat: "#f97316",
8136
+ horse: "#a16207",
8137
+ sheep: "#a3a3a3",
8138
+ cow: "#78716c",
8139
+ elephant: "#6b7280",
8140
+ bear: "#7c2d12",
8141
+ zebra: "#404040",
8142
+ giraffe: "#d4a373"
8143
+ };
8144
+ function titleCase(id) {
8145
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8146
+ }
8147
+ var entries = /* @__PURE__ */ new Map();
8148
+ function macro(kind, category, color, iconId, label) {
8149
+ entries.set(kind, {
8150
+ kind,
8151
+ parentKind: null,
8152
+ level: "macro",
8153
+ category,
8154
+ color,
8155
+ iconId,
8156
+ labelKey: `eventKind.${kind}`,
8157
+ label
8158
+ });
8159
+ }
8160
+ function sub(kind, parentKind, category, color, iconId, label) {
8161
+ entries.set(kind, {
8162
+ kind,
8163
+ parentKind,
8164
+ level: "sub",
8165
+ category,
8166
+ color,
8167
+ iconId,
8168
+ labelKey: `eventKind.${kind}`,
8169
+ label
8170
+ });
8171
+ }
8172
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8173
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8174
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8175
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8176
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8177
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8178
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8179
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8180
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8181
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8182
+ if (entries.has(cocoClass)) continue;
8183
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8184
+ }
8185
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8186
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8187
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8188
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8189
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8190
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8191
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8192
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8193
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8194
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8195
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8196
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8197
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8198
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8199
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8200
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8201
+ sub("button", "control", "control", "#10b981", "button", "Button");
8202
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8203
+ for (const l of AUDIO_MACRO_LABELS) {
8204
+ const kind = `audio-${l.id}`;
8205
+ if (entries.has(kind)) continue;
8206
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8207
+ }
8208
+ /** The complete taxonomy dictionary, keyed by kind. */
8209
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8210
+ /**
7938
8211
  * Error types for the safe expression engine. Two distinct classes so callers
7939
8212
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7940
8213
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -18933,17 +19206,30 @@ var EventKindCategorySchema = _enum([
18933
19206
  "audio",
18934
19207
  "detection",
18935
19208
  "sensor",
19209
+ "control",
18936
19210
  "custom",
18937
19211
  "package"
18938
19212
  ]);
19213
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19214
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18939
19215
  var EventKindDescriptorSchema = object({
18940
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19216
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18941
19217
  kind: string$2(),
19218
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19219
+ labelKey: string$2(),
19220
+ /** English fallback label (kept for clients that don't translate). */
18942
19221
  label: string$2(),
18943
19222
  /** Hex color for timeline/legend rendering. */
18944
19223
  color: string$2(),
19224
+ /** Dictionary id → lucide component on the UI side. */
19225
+ iconId: string$2(),
19226
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18945
19227
  icon: EventKindIconSchema,
18946
19228
  category: EventKindCategorySchema,
19229
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19230
+ parentKind: string$2().nullable(),
19231
+ /** Derived from `parentKind`, explicit for the client tree. */
19232
+ level: EventKindLevelSchema,
18947
19233
  /** Which cap + device contributes this kind. For built-ins the camera
18948
19234
  * itself; for sensor kinds the LINKED source device. */
18949
19235
  source: object({
@@ -19016,11 +19302,21 @@ var TrackAudioLabelSchema = object({
19016
19302
  firstAt: number(),
19017
19303
  lastAt: number()
19018
19304
  });
19305
+ /**
19306
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19307
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19308
+ * linked sensor/control state change (no positions; carries a snapshot). The
19309
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19310
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19311
+ */
19312
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19019
19313
  var TrackSchema = object({
19020
19314
  trackId: string$2(),
19021
19315
  deviceId: number(),
19022
19316
  className: string$2(),
19023
19317
  label: string$2().optional(),
19318
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19319
+ source: TrackSourceSchema.optional(),
19024
19320
  firstSeen: number(),
19025
19321
  lastSeen: number(),
19026
19322
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19397,6 +19693,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19397
19693
  eventId: string$2(),
19398
19694
  timestamp: number()
19399
19695
  });
19696
+ /**
19697
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19698
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19699
+ * caps into per-camera event-kind descriptors.
19700
+ *
19701
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19702
+ * is NOT duplicated here — every entry is derived from the single
19703
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19704
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19705
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19706
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19707
+ * eventful cap is missing.
19708
+ */
19709
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19710
+ var LEGACY_ICON = {
19711
+ motion: "motion",
19712
+ audio: "audio",
19713
+ person: "person",
19714
+ vehicle: "vehicle",
19715
+ animal: "animal",
19716
+ package: "package",
19717
+ door: "door",
19718
+ pir: "pir",
19719
+ smoke: "smoke",
19720
+ water: "water",
19721
+ button: "button",
19722
+ generic: "generic",
19723
+ gas: "smoke",
19724
+ vibration: "generic",
19725
+ tamper: "generic",
19726
+ presence: "person",
19727
+ lock: "generic",
19728
+ siren: "generic",
19729
+ switch: "generic",
19730
+ doorbell: "button"
19731
+ };
19732
+ function legacyIcon(iconId) {
19733
+ return LEGACY_ICON[iconId] ?? "generic";
19734
+ }
19735
+ /**
19736
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19737
+ * The anti-drift guard cross-checks this against the eventful caps declared
19738
+ * in `packages/types/src/capabilities/*.cap.ts`.
19739
+ */
19740
+ var CAP_TO_KIND = {
19741
+ contact: "contact",
19742
+ motion: "motion-sensor",
19743
+ smoke: "smoke",
19744
+ flood: "flood",
19745
+ gas: "gas",
19746
+ "carbon-monoxide": "carbon-monoxide",
19747
+ vibration: "vibration",
19748
+ tamper: "tamper",
19749
+ presence: "presence",
19750
+ "enum-sensor": "enum-sensor",
19751
+ "event-emitter": "device-event",
19752
+ "lock-control": "lock",
19753
+ switch: "switch",
19754
+ button: "button",
19755
+ doorbell: "doorbell"
19756
+ };
19757
+ function buildDescriptor(capName, kind) {
19758
+ const t = EVENT_TAXONOMY[kind];
19759
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19760
+ return {
19761
+ ...t,
19762
+ icon: legacyIcon(t.iconId)
19763
+ };
19764
+ }
19765
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19400
19766
  var CameraPipelineConfigSchema = object({
19401
19767
  engine: PipelineEngineChoiceSchema.optional(),
19402
19768
  steps: array(PipelineStepInputSchema).readonly(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-matter-broker",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "Matter broker addon for CamStack — owns a Matter fabric (commissioning + the long-lived controller) via the matter.js controller and brokers commissioned Matter nodes into CamStack",
5
5
  "keywords": [
6
6
  "camstack",