@camstack/addon-mqtt-broker 1.1.27 → 1.1.28

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.
@@ -7672,6 +7672,160 @@ var EncodeProfileSchema = object({
7672
7672
  */
7673
7673
  outputArgs: array(string()).optional()
7674
7674
  });
7675
+ var COCO_TO_MACRO = {
7676
+ mapping: {
7677
+ person: "person",
7678
+ bicycle: "vehicle",
7679
+ car: "vehicle",
7680
+ motorcycle: "vehicle",
7681
+ airplane: "vehicle",
7682
+ bus: "vehicle",
7683
+ train: "vehicle",
7684
+ truck: "vehicle",
7685
+ boat: "vehicle",
7686
+ bird: "animal",
7687
+ cat: "animal",
7688
+ dog: "animal",
7689
+ horse: "animal",
7690
+ sheep: "animal",
7691
+ cow: "animal",
7692
+ elephant: "animal",
7693
+ bear: "animal",
7694
+ zebra: "animal",
7695
+ giraffe: "animal",
7696
+ suitcase: "package",
7697
+ backpack: "package",
7698
+ handbag: "package"
7699
+ },
7700
+ preserveOriginal: false
7701
+ };
7702
+ var AUDIO_MACRO_LABELS = [
7703
+ {
7704
+ id: "speech",
7705
+ name: "Speech",
7706
+ icon: "🗣️"
7707
+ },
7708
+ {
7709
+ id: "scream",
7710
+ name: "Scream / Shout",
7711
+ icon: "😱"
7712
+ },
7713
+ {
7714
+ id: "crying",
7715
+ name: "Crying / Baby",
7716
+ icon: "😢"
7717
+ },
7718
+ {
7719
+ id: "laughter",
7720
+ name: "Laughter",
7721
+ icon: "😂"
7722
+ },
7723
+ {
7724
+ id: "music",
7725
+ name: "Music",
7726
+ icon: "🎵"
7727
+ },
7728
+ {
7729
+ id: "dog",
7730
+ name: "Dog",
7731
+ icon: "🐕"
7732
+ },
7733
+ {
7734
+ id: "cat",
7735
+ name: "Cat",
7736
+ icon: "🐈"
7737
+ },
7738
+ {
7739
+ id: "bird",
7740
+ name: "Bird",
7741
+ icon: "🐦"
7742
+ },
7743
+ {
7744
+ id: "animal",
7745
+ name: "Animal (other)",
7746
+ icon: "🐾"
7747
+ },
7748
+ {
7749
+ id: "alarm",
7750
+ name: "Alarm / Siren",
7751
+ icon: "🚨"
7752
+ },
7753
+ {
7754
+ id: "doorbell",
7755
+ name: "Doorbell / Knock",
7756
+ icon: "🔔"
7757
+ },
7758
+ {
7759
+ id: "glass_breaking",
7760
+ name: "Glass Breaking",
7761
+ icon: "💥"
7762
+ },
7763
+ {
7764
+ id: "gunshot",
7765
+ name: "Gunshot / Explosion",
7766
+ icon: "💣"
7767
+ },
7768
+ {
7769
+ id: "vehicle",
7770
+ name: "Vehicle",
7771
+ icon: "🚗"
7772
+ },
7773
+ {
7774
+ id: "siren",
7775
+ name: "Emergency Siren",
7776
+ icon: "🚑"
7777
+ },
7778
+ {
7779
+ id: "fire",
7780
+ name: "Fire / Smoke",
7781
+ icon: "🔥"
7782
+ },
7783
+ {
7784
+ id: "water",
7785
+ name: "Water",
7786
+ icon: "💧"
7787
+ },
7788
+ {
7789
+ id: "wind",
7790
+ name: "Wind / Weather",
7791
+ icon: "🌬️"
7792
+ },
7793
+ {
7794
+ id: "door",
7795
+ name: "Door",
7796
+ icon: "🚪"
7797
+ },
7798
+ {
7799
+ id: "footsteps",
7800
+ name: "Footsteps",
7801
+ icon: "👣"
7802
+ },
7803
+ {
7804
+ id: "crowd",
7805
+ name: "Crowd / Chatter",
7806
+ icon: "👥"
7807
+ },
7808
+ {
7809
+ id: "telephone",
7810
+ name: "Telephone",
7811
+ icon: "📞"
7812
+ },
7813
+ {
7814
+ id: "engine",
7815
+ name: "Engine / Motor",
7816
+ icon: "⚙️"
7817
+ },
7818
+ {
7819
+ id: "tools",
7820
+ name: "Tools / Construction",
7821
+ icon: "🔨"
7822
+ },
7823
+ {
7824
+ id: "silence",
7825
+ name: "Silence",
7826
+ icon: "🤫"
7827
+ }
7828
+ ];
7675
7829
  var YAMNET_TO_MACRO = {
7676
7830
  mapping: {
7677
7831
  Speech: "speech",
@@ -7938,6 +8092,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7938
8092
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7939
8093
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7940
8094
  /**
8095
+ * Unified event-kind taxonomy — THE single source of truth for
8096
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8097
+ * icon }`.
8098
+ *
8099
+ * This dictionary folds together what used to be scattered across four
8100
+ * copies:
8101
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8102
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8103
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8104
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8105
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8106
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8107
+ *
8108
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8109
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8110
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8111
+ * color or an icon: they read this dictionary (server descriptors carry the
8112
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8113
+ *
8114
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8115
+ */
8116
+ var TAXONOMY_COLORS = {
8117
+ motion: "#f59e0b",
8118
+ audio: "#06b6d4",
8119
+ person: "#22c55e",
8120
+ vehicle: "#3b82f6",
8121
+ animal: "#f97316",
8122
+ package: "#a855f7",
8123
+ sensor: "#8b5cf6",
8124
+ control: "#10b981",
8125
+ genericDetection: "#64748b"
8126
+ };
8127
+ var DETECTION_SUB_COLORS = {
8128
+ car: "#f59e0b",
8129
+ truck: "#d97706",
8130
+ bus: "#b45309",
8131
+ motorcycle: "#eab308",
8132
+ bicycle: "#ca8a04",
8133
+ airplane: "#60a5fa",
8134
+ boat: "#2563eb",
8135
+ train: "#1d4ed8",
8136
+ bird: "#14b8a6",
8137
+ dog: "#84cc16",
8138
+ cat: "#f97316",
8139
+ horse: "#a16207",
8140
+ sheep: "#a3a3a3",
8141
+ cow: "#78716c",
8142
+ elephant: "#6b7280",
8143
+ bear: "#7c2d12",
8144
+ zebra: "#404040",
8145
+ giraffe: "#d4a373"
8146
+ };
8147
+ function titleCase(id) {
8148
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8149
+ }
8150
+ var entries = /* @__PURE__ */ new Map();
8151
+ function macro(kind, category, color, iconId, label) {
8152
+ entries.set(kind, {
8153
+ kind,
8154
+ parentKind: null,
8155
+ level: "macro",
8156
+ category,
8157
+ color,
8158
+ iconId,
8159
+ labelKey: `eventKind.${kind}`,
8160
+ label
8161
+ });
8162
+ }
8163
+ function sub(kind, parentKind, category, color, iconId, label) {
8164
+ entries.set(kind, {
8165
+ kind,
8166
+ parentKind,
8167
+ level: "sub",
8168
+ category,
8169
+ color,
8170
+ iconId,
8171
+ labelKey: `eventKind.${kind}`,
8172
+ label
8173
+ });
8174
+ }
8175
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8176
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8177
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8178
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8179
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8180
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8181
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8182
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8183
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8184
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8185
+ if (entries.has(cocoClass)) continue;
8186
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8187
+ }
8188
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8189
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8190
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8191
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8192
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8193
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8194
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8195
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8196
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8197
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8198
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8199
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8200
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8201
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8202
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8203
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8204
+ sub("button", "control", "control", "#10b981", "button", "Button");
8205
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8206
+ for (const l of AUDIO_MACRO_LABELS) {
8207
+ const kind = `audio-${l.id}`;
8208
+ if (entries.has(kind)) continue;
8209
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8210
+ }
8211
+ /** The complete taxonomy dictionary, keyed by kind. */
8212
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8213
+ /**
7941
8214
  * Error types for the safe expression engine. Two distinct classes so callers
7942
8215
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7943
8216
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -15955,17 +16228,30 @@ var EventKindCategorySchema = _enum([
15955
16228
  "audio",
15956
16229
  "detection",
15957
16230
  "sensor",
16231
+ "control",
15958
16232
  "custom",
15959
16233
  "package"
15960
16234
  ]);
16235
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16236
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15961
16237
  var EventKindDescriptorSchema = object({
15962
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16238
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15963
16239
  kind: string(),
16240
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16241
+ labelKey: string(),
16242
+ /** English fallback label (kept for clients that don't translate). */
15964
16243
  label: string(),
15965
16244
  /** Hex color for timeline/legend rendering. */
15966
16245
  color: string(),
16246
+ /** Dictionary id → lucide component on the UI side. */
16247
+ iconId: string(),
16248
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15967
16249
  icon: EventKindIconSchema,
15968
16250
  category: EventKindCategorySchema,
16251
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16252
+ parentKind: string().nullable(),
16253
+ /** Derived from `parentKind`, explicit for the client tree. */
16254
+ level: EventKindLevelSchema,
15969
16255
  /** Which cap + device contributes this kind. For built-ins the camera
15970
16256
  * itself; for sensor kinds the LINKED source device. */
15971
16257
  source: object({
@@ -16038,11 +16324,21 @@ var TrackAudioLabelSchema = object({
16038
16324
  firstAt: number(),
16039
16325
  lastAt: number()
16040
16326
  });
16327
+ /**
16328
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16329
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16330
+ * linked sensor/control state change (no positions; carries a snapshot). The
16331
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16332
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16333
+ */
16334
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16041
16335
  var TrackSchema = object({
16042
16336
  trackId: string(),
16043
16337
  deviceId: number(),
16044
16338
  className: string(),
16045
16339
  label: string().optional(),
16340
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16341
+ source: TrackSourceSchema.optional(),
16046
16342
  firstSeen: number(),
16047
16343
  lastSeen: number(),
16048
16344
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16419,6 +16715,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16419
16715
  eventId: string(),
16420
16716
  timestamp: number()
16421
16717
  });
16718
+ /**
16719
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16720
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16721
+ * caps into per-camera event-kind descriptors.
16722
+ *
16723
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16724
+ * is NOT duplicated here — every entry is derived from the single
16725
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16726
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16727
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16728
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16729
+ * eventful cap is missing.
16730
+ */
16731
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16732
+ var LEGACY_ICON = {
16733
+ motion: "motion",
16734
+ audio: "audio",
16735
+ person: "person",
16736
+ vehicle: "vehicle",
16737
+ animal: "animal",
16738
+ package: "package",
16739
+ door: "door",
16740
+ pir: "pir",
16741
+ smoke: "smoke",
16742
+ water: "water",
16743
+ button: "button",
16744
+ generic: "generic",
16745
+ gas: "smoke",
16746
+ vibration: "generic",
16747
+ tamper: "generic",
16748
+ presence: "person",
16749
+ lock: "generic",
16750
+ siren: "generic",
16751
+ switch: "generic",
16752
+ doorbell: "button"
16753
+ };
16754
+ function legacyIcon(iconId) {
16755
+ return LEGACY_ICON[iconId] ?? "generic";
16756
+ }
16757
+ /**
16758
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16759
+ * The anti-drift guard cross-checks this against the eventful caps declared
16760
+ * in `packages/types/src/capabilities/*.cap.ts`.
16761
+ */
16762
+ var CAP_TO_KIND = {
16763
+ contact: "contact",
16764
+ motion: "motion-sensor",
16765
+ smoke: "smoke",
16766
+ flood: "flood",
16767
+ gas: "gas",
16768
+ "carbon-monoxide": "carbon-monoxide",
16769
+ vibration: "vibration",
16770
+ tamper: "tamper",
16771
+ presence: "presence",
16772
+ "enum-sensor": "enum-sensor",
16773
+ "event-emitter": "device-event",
16774
+ "lock-control": "lock",
16775
+ switch: "switch",
16776
+ button: "button",
16777
+ doorbell: "doorbell"
16778
+ };
16779
+ function buildDescriptor(capName, kind) {
16780
+ const t = EVENT_TAXONOMY[kind];
16781
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16782
+ return {
16783
+ ...t,
16784
+ icon: legacyIcon(t.iconId)
16785
+ };
16786
+ }
16787
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16422
16788
  var CameraPipelineConfigSchema = object({
16423
16789
  engine: PipelineEngineChoiceSchema.optional(),
16424
16790
  steps: array(PipelineStepInputSchema).readonly(),
@@ -7667,6 +7667,160 @@ var EncodeProfileSchema = object({
7667
7667
  */
7668
7668
  outputArgs: array(string()).optional()
7669
7669
  });
7670
+ var COCO_TO_MACRO = {
7671
+ mapping: {
7672
+ person: "person",
7673
+ bicycle: "vehicle",
7674
+ car: "vehicle",
7675
+ motorcycle: "vehicle",
7676
+ airplane: "vehicle",
7677
+ bus: "vehicle",
7678
+ train: "vehicle",
7679
+ truck: "vehicle",
7680
+ boat: "vehicle",
7681
+ bird: "animal",
7682
+ cat: "animal",
7683
+ dog: "animal",
7684
+ horse: "animal",
7685
+ sheep: "animal",
7686
+ cow: "animal",
7687
+ elephant: "animal",
7688
+ bear: "animal",
7689
+ zebra: "animal",
7690
+ giraffe: "animal",
7691
+ suitcase: "package",
7692
+ backpack: "package",
7693
+ handbag: "package"
7694
+ },
7695
+ preserveOriginal: false
7696
+ };
7697
+ var AUDIO_MACRO_LABELS = [
7698
+ {
7699
+ id: "speech",
7700
+ name: "Speech",
7701
+ icon: "🗣️"
7702
+ },
7703
+ {
7704
+ id: "scream",
7705
+ name: "Scream / Shout",
7706
+ icon: "😱"
7707
+ },
7708
+ {
7709
+ id: "crying",
7710
+ name: "Crying / Baby",
7711
+ icon: "😢"
7712
+ },
7713
+ {
7714
+ id: "laughter",
7715
+ name: "Laughter",
7716
+ icon: "😂"
7717
+ },
7718
+ {
7719
+ id: "music",
7720
+ name: "Music",
7721
+ icon: "🎵"
7722
+ },
7723
+ {
7724
+ id: "dog",
7725
+ name: "Dog",
7726
+ icon: "🐕"
7727
+ },
7728
+ {
7729
+ id: "cat",
7730
+ name: "Cat",
7731
+ icon: "🐈"
7732
+ },
7733
+ {
7734
+ id: "bird",
7735
+ name: "Bird",
7736
+ icon: "🐦"
7737
+ },
7738
+ {
7739
+ id: "animal",
7740
+ name: "Animal (other)",
7741
+ icon: "🐾"
7742
+ },
7743
+ {
7744
+ id: "alarm",
7745
+ name: "Alarm / Siren",
7746
+ icon: "🚨"
7747
+ },
7748
+ {
7749
+ id: "doorbell",
7750
+ name: "Doorbell / Knock",
7751
+ icon: "🔔"
7752
+ },
7753
+ {
7754
+ id: "glass_breaking",
7755
+ name: "Glass Breaking",
7756
+ icon: "💥"
7757
+ },
7758
+ {
7759
+ id: "gunshot",
7760
+ name: "Gunshot / Explosion",
7761
+ icon: "💣"
7762
+ },
7763
+ {
7764
+ id: "vehicle",
7765
+ name: "Vehicle",
7766
+ icon: "🚗"
7767
+ },
7768
+ {
7769
+ id: "siren",
7770
+ name: "Emergency Siren",
7771
+ icon: "🚑"
7772
+ },
7773
+ {
7774
+ id: "fire",
7775
+ name: "Fire / Smoke",
7776
+ icon: "🔥"
7777
+ },
7778
+ {
7779
+ id: "water",
7780
+ name: "Water",
7781
+ icon: "💧"
7782
+ },
7783
+ {
7784
+ id: "wind",
7785
+ name: "Wind / Weather",
7786
+ icon: "🌬️"
7787
+ },
7788
+ {
7789
+ id: "door",
7790
+ name: "Door",
7791
+ icon: "🚪"
7792
+ },
7793
+ {
7794
+ id: "footsteps",
7795
+ name: "Footsteps",
7796
+ icon: "👣"
7797
+ },
7798
+ {
7799
+ id: "crowd",
7800
+ name: "Crowd / Chatter",
7801
+ icon: "👥"
7802
+ },
7803
+ {
7804
+ id: "telephone",
7805
+ name: "Telephone",
7806
+ icon: "📞"
7807
+ },
7808
+ {
7809
+ id: "engine",
7810
+ name: "Engine / Motor",
7811
+ icon: "⚙️"
7812
+ },
7813
+ {
7814
+ id: "tools",
7815
+ name: "Tools / Construction",
7816
+ icon: "🔨"
7817
+ },
7818
+ {
7819
+ id: "silence",
7820
+ name: "Silence",
7821
+ icon: "🤫"
7822
+ }
7823
+ ];
7670
7824
  var YAMNET_TO_MACRO = {
7671
7825
  mapping: {
7672
7826
  Speech: "speech",
@@ -7933,6 +8087,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7933
8087
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7934
8088
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7935
8089
  /**
8090
+ * Unified event-kind taxonomy — THE single source of truth for
8091
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8092
+ * icon }`.
8093
+ *
8094
+ * This dictionary folds together what used to be scattered across four
8095
+ * copies:
8096
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8097
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8098
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8099
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8100
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8101
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8102
+ *
8103
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8104
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8105
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8106
+ * color or an icon: they read this dictionary (server descriptors carry the
8107
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8108
+ *
8109
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8110
+ */
8111
+ var TAXONOMY_COLORS = {
8112
+ motion: "#f59e0b",
8113
+ audio: "#06b6d4",
8114
+ person: "#22c55e",
8115
+ vehicle: "#3b82f6",
8116
+ animal: "#f97316",
8117
+ package: "#a855f7",
8118
+ sensor: "#8b5cf6",
8119
+ control: "#10b981",
8120
+ genericDetection: "#64748b"
8121
+ };
8122
+ var DETECTION_SUB_COLORS = {
8123
+ car: "#f59e0b",
8124
+ truck: "#d97706",
8125
+ bus: "#b45309",
8126
+ motorcycle: "#eab308",
8127
+ bicycle: "#ca8a04",
8128
+ airplane: "#60a5fa",
8129
+ boat: "#2563eb",
8130
+ train: "#1d4ed8",
8131
+ bird: "#14b8a6",
8132
+ dog: "#84cc16",
8133
+ cat: "#f97316",
8134
+ horse: "#a16207",
8135
+ sheep: "#a3a3a3",
8136
+ cow: "#78716c",
8137
+ elephant: "#6b7280",
8138
+ bear: "#7c2d12",
8139
+ zebra: "#404040",
8140
+ giraffe: "#d4a373"
8141
+ };
8142
+ function titleCase(id) {
8143
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8144
+ }
8145
+ var entries = /* @__PURE__ */ new Map();
8146
+ function macro(kind, category, color, iconId, label) {
8147
+ entries.set(kind, {
8148
+ kind,
8149
+ parentKind: null,
8150
+ level: "macro",
8151
+ category,
8152
+ color,
8153
+ iconId,
8154
+ labelKey: `eventKind.${kind}`,
8155
+ label
8156
+ });
8157
+ }
8158
+ function sub(kind, parentKind, category, color, iconId, label) {
8159
+ entries.set(kind, {
8160
+ kind,
8161
+ parentKind,
8162
+ level: "sub",
8163
+ category,
8164
+ color,
8165
+ iconId,
8166
+ labelKey: `eventKind.${kind}`,
8167
+ label
8168
+ });
8169
+ }
8170
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8171
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8172
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8173
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8174
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8175
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8176
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8177
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8178
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8179
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8180
+ if (entries.has(cocoClass)) continue;
8181
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8182
+ }
8183
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8184
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8185
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8186
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8187
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8188
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8189
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8190
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8191
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8192
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8193
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8194
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8195
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8196
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8197
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8198
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8199
+ sub("button", "control", "control", "#10b981", "button", "Button");
8200
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8201
+ for (const l of AUDIO_MACRO_LABELS) {
8202
+ const kind = `audio-${l.id}`;
8203
+ if (entries.has(kind)) continue;
8204
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8205
+ }
8206
+ /** The complete taxonomy dictionary, keyed by kind. */
8207
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8208
+ /**
7936
8209
  * Error types for the safe expression engine. Two distinct classes so callers
7937
8210
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7938
8211
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -15950,17 +16223,30 @@ var EventKindCategorySchema = _enum([
15950
16223
  "audio",
15951
16224
  "detection",
15952
16225
  "sensor",
16226
+ "control",
15953
16227
  "custom",
15954
16228
  "package"
15955
16229
  ]);
16230
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16231
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15956
16232
  var EventKindDescriptorSchema = object({
15957
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16233
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15958
16234
  kind: string(),
16235
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16236
+ labelKey: string(),
16237
+ /** English fallback label (kept for clients that don't translate). */
15959
16238
  label: string(),
15960
16239
  /** Hex color for timeline/legend rendering. */
15961
16240
  color: string(),
16241
+ /** Dictionary id → lucide component on the UI side. */
16242
+ iconId: string(),
16243
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15962
16244
  icon: EventKindIconSchema,
15963
16245
  category: EventKindCategorySchema,
16246
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16247
+ parentKind: string().nullable(),
16248
+ /** Derived from `parentKind`, explicit for the client tree. */
16249
+ level: EventKindLevelSchema,
15964
16250
  /** Which cap + device contributes this kind. For built-ins the camera
15965
16251
  * itself; for sensor kinds the LINKED source device. */
15966
16252
  source: object({
@@ -16033,11 +16319,21 @@ var TrackAudioLabelSchema = object({
16033
16319
  firstAt: number(),
16034
16320
  lastAt: number()
16035
16321
  });
16322
+ /**
16323
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16324
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16325
+ * linked sensor/control state change (no positions; carries a snapshot). The
16326
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16327
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16328
+ */
16329
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16036
16330
  var TrackSchema = object({
16037
16331
  trackId: string(),
16038
16332
  deviceId: number(),
16039
16333
  className: string(),
16040
16334
  label: string().optional(),
16335
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16336
+ source: TrackSourceSchema.optional(),
16041
16337
  firstSeen: number(),
16042
16338
  lastSeen: number(),
16043
16339
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16414,6 +16710,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16414
16710
  eventId: string(),
16415
16711
  timestamp: number()
16416
16712
  });
16713
+ /**
16714
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16715
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16716
+ * caps into per-camera event-kind descriptors.
16717
+ *
16718
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16719
+ * is NOT duplicated here — every entry is derived from the single
16720
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16721
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16722
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16723
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16724
+ * eventful cap is missing.
16725
+ */
16726
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16727
+ var LEGACY_ICON = {
16728
+ motion: "motion",
16729
+ audio: "audio",
16730
+ person: "person",
16731
+ vehicle: "vehicle",
16732
+ animal: "animal",
16733
+ package: "package",
16734
+ door: "door",
16735
+ pir: "pir",
16736
+ smoke: "smoke",
16737
+ water: "water",
16738
+ button: "button",
16739
+ generic: "generic",
16740
+ gas: "smoke",
16741
+ vibration: "generic",
16742
+ tamper: "generic",
16743
+ presence: "person",
16744
+ lock: "generic",
16745
+ siren: "generic",
16746
+ switch: "generic",
16747
+ doorbell: "button"
16748
+ };
16749
+ function legacyIcon(iconId) {
16750
+ return LEGACY_ICON[iconId] ?? "generic";
16751
+ }
16752
+ /**
16753
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16754
+ * The anti-drift guard cross-checks this against the eventful caps declared
16755
+ * in `packages/types/src/capabilities/*.cap.ts`.
16756
+ */
16757
+ var CAP_TO_KIND = {
16758
+ contact: "contact",
16759
+ motion: "motion-sensor",
16760
+ smoke: "smoke",
16761
+ flood: "flood",
16762
+ gas: "gas",
16763
+ "carbon-monoxide": "carbon-monoxide",
16764
+ vibration: "vibration",
16765
+ tamper: "tamper",
16766
+ presence: "presence",
16767
+ "enum-sensor": "enum-sensor",
16768
+ "event-emitter": "device-event",
16769
+ "lock-control": "lock",
16770
+ switch: "switch",
16771
+ button: "button",
16772
+ doorbell: "doorbell"
16773
+ };
16774
+ function buildDescriptor(capName, kind) {
16775
+ const t = EVENT_TAXONOMY[kind];
16776
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16777
+ return {
16778
+ ...t,
16779
+ icon: legacyIcon(t.iconId)
16780
+ };
16781
+ }
16782
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16417
16783
  var CameraPipelineConfigSchema = object({
16418
16784
  engine: PipelineEngineChoiceSchema.optional(),
16419
16785
  steps: array(PipelineStepInputSchema).readonly(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-mqtt-broker",
3
- "version": "1.1.27",
3
+ "version": "1.1.28",
4
4
  "description": "MQTT broker registry addon for CamStack — manages external broker entries + an optional embedded aedes broker. Consumers spin up their own `mqtt.js` clients via the `mqtt-broker` cap.",
5
5
  "keywords": [
6
6
  "camstack",