@camstack/addon-export-hap 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.
@@ -7717,6 +7717,160 @@ function pickClosestResolution(entries, target) {
7717
7717
  }
7718
7718
  return bestAbove?.entry ?? bestBelow?.entry;
7719
7719
  }
7720
+ var COCO_TO_MACRO = {
7721
+ mapping: {
7722
+ person: "person",
7723
+ bicycle: "vehicle",
7724
+ car: "vehicle",
7725
+ motorcycle: "vehicle",
7726
+ airplane: "vehicle",
7727
+ bus: "vehicle",
7728
+ train: "vehicle",
7729
+ truck: "vehicle",
7730
+ boat: "vehicle",
7731
+ bird: "animal",
7732
+ cat: "animal",
7733
+ dog: "animal",
7734
+ horse: "animal",
7735
+ sheep: "animal",
7736
+ cow: "animal",
7737
+ elephant: "animal",
7738
+ bear: "animal",
7739
+ zebra: "animal",
7740
+ giraffe: "animal",
7741
+ suitcase: "package",
7742
+ backpack: "package",
7743
+ handbag: "package"
7744
+ },
7745
+ preserveOriginal: false
7746
+ };
7747
+ var AUDIO_MACRO_LABELS = [
7748
+ {
7749
+ id: "speech",
7750
+ name: "Speech",
7751
+ icon: "🗣️"
7752
+ },
7753
+ {
7754
+ id: "scream",
7755
+ name: "Scream / Shout",
7756
+ icon: "😱"
7757
+ },
7758
+ {
7759
+ id: "crying",
7760
+ name: "Crying / Baby",
7761
+ icon: "😢"
7762
+ },
7763
+ {
7764
+ id: "laughter",
7765
+ name: "Laughter",
7766
+ icon: "😂"
7767
+ },
7768
+ {
7769
+ id: "music",
7770
+ name: "Music",
7771
+ icon: "🎵"
7772
+ },
7773
+ {
7774
+ id: "dog",
7775
+ name: "Dog",
7776
+ icon: "🐕"
7777
+ },
7778
+ {
7779
+ id: "cat",
7780
+ name: "Cat",
7781
+ icon: "🐈"
7782
+ },
7783
+ {
7784
+ id: "bird",
7785
+ name: "Bird",
7786
+ icon: "🐦"
7787
+ },
7788
+ {
7789
+ id: "animal",
7790
+ name: "Animal (other)",
7791
+ icon: "🐾"
7792
+ },
7793
+ {
7794
+ id: "alarm",
7795
+ name: "Alarm / Siren",
7796
+ icon: "🚨"
7797
+ },
7798
+ {
7799
+ id: "doorbell",
7800
+ name: "Doorbell / Knock",
7801
+ icon: "🔔"
7802
+ },
7803
+ {
7804
+ id: "glass_breaking",
7805
+ name: "Glass Breaking",
7806
+ icon: "💥"
7807
+ },
7808
+ {
7809
+ id: "gunshot",
7810
+ name: "Gunshot / Explosion",
7811
+ icon: "💣"
7812
+ },
7813
+ {
7814
+ id: "vehicle",
7815
+ name: "Vehicle",
7816
+ icon: "🚗"
7817
+ },
7818
+ {
7819
+ id: "siren",
7820
+ name: "Emergency Siren",
7821
+ icon: "🚑"
7822
+ },
7823
+ {
7824
+ id: "fire",
7825
+ name: "Fire / Smoke",
7826
+ icon: "🔥"
7827
+ },
7828
+ {
7829
+ id: "water",
7830
+ name: "Water",
7831
+ icon: "💧"
7832
+ },
7833
+ {
7834
+ id: "wind",
7835
+ name: "Wind / Weather",
7836
+ icon: "🌬️"
7837
+ },
7838
+ {
7839
+ id: "door",
7840
+ name: "Door",
7841
+ icon: "🚪"
7842
+ },
7843
+ {
7844
+ id: "footsteps",
7845
+ name: "Footsteps",
7846
+ icon: "👣"
7847
+ },
7848
+ {
7849
+ id: "crowd",
7850
+ name: "Crowd / Chatter",
7851
+ icon: "👥"
7852
+ },
7853
+ {
7854
+ id: "telephone",
7855
+ name: "Telephone",
7856
+ icon: "📞"
7857
+ },
7858
+ {
7859
+ id: "engine",
7860
+ name: "Engine / Motor",
7861
+ icon: "⚙️"
7862
+ },
7863
+ {
7864
+ id: "tools",
7865
+ name: "Tools / Construction",
7866
+ icon: "🔨"
7867
+ },
7868
+ {
7869
+ id: "silence",
7870
+ name: "Silence",
7871
+ icon: "🤫"
7872
+ }
7873
+ ];
7720
7874
  var YAMNET_TO_MACRO = {
7721
7875
  mapping: {
7722
7876
  Speech: "speech",
@@ -7983,6 +8137,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7983
8137
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7984
8138
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7985
8139
  /**
8140
+ * Unified event-kind taxonomy — THE single source of truth for
8141
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8142
+ * icon }`.
8143
+ *
8144
+ * This dictionary folds together what used to be scattered across four
8145
+ * copies:
8146
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8147
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8148
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8149
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8150
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8151
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8152
+ *
8153
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8154
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8155
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8156
+ * color or an icon: they read this dictionary (server descriptors carry the
8157
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8158
+ *
8159
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8160
+ */
8161
+ var TAXONOMY_COLORS = {
8162
+ motion: "#f59e0b",
8163
+ audio: "#06b6d4",
8164
+ person: "#22c55e",
8165
+ vehicle: "#3b82f6",
8166
+ animal: "#f97316",
8167
+ package: "#a855f7",
8168
+ sensor: "#8b5cf6",
8169
+ control: "#10b981",
8170
+ genericDetection: "#64748b"
8171
+ };
8172
+ var DETECTION_SUB_COLORS = {
8173
+ car: "#f59e0b",
8174
+ truck: "#d97706",
8175
+ bus: "#b45309",
8176
+ motorcycle: "#eab308",
8177
+ bicycle: "#ca8a04",
8178
+ airplane: "#60a5fa",
8179
+ boat: "#2563eb",
8180
+ train: "#1d4ed8",
8181
+ bird: "#14b8a6",
8182
+ dog: "#84cc16",
8183
+ cat: "#f97316",
8184
+ horse: "#a16207",
8185
+ sheep: "#a3a3a3",
8186
+ cow: "#78716c",
8187
+ elephant: "#6b7280",
8188
+ bear: "#7c2d12",
8189
+ zebra: "#404040",
8190
+ giraffe: "#d4a373"
8191
+ };
8192
+ function titleCase(id) {
8193
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8194
+ }
8195
+ var entries = /* @__PURE__ */ new Map();
8196
+ function macro(kind, category, color, iconId, label) {
8197
+ entries.set(kind, {
8198
+ kind,
8199
+ parentKind: null,
8200
+ level: "macro",
8201
+ category,
8202
+ color,
8203
+ iconId,
8204
+ labelKey: `eventKind.${kind}`,
8205
+ label
8206
+ });
8207
+ }
8208
+ function sub(kind, parentKind, category, color, iconId, label) {
8209
+ entries.set(kind, {
8210
+ kind,
8211
+ parentKind,
8212
+ level: "sub",
8213
+ category,
8214
+ color,
8215
+ iconId,
8216
+ labelKey: `eventKind.${kind}`,
8217
+ label
8218
+ });
8219
+ }
8220
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8221
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8222
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8223
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8224
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8225
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8226
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8227
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8228
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8229
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8230
+ if (entries.has(cocoClass)) continue;
8231
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8232
+ }
8233
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8234
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8235
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8236
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8237
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8238
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8239
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8240
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8241
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8242
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8243
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8244
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8245
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8246
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8247
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8248
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8249
+ sub("button", "control", "control", "#10b981", "button", "Button");
8250
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8251
+ for (const l of AUDIO_MACRO_LABELS) {
8252
+ const kind = `audio-${l.id}`;
8253
+ if (entries.has(kind)) continue;
8254
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8255
+ }
8256
+ /** The complete taxonomy dictionary, keyed by kind. */
8257
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8258
+ /**
7986
8259
  * Error types for the safe expression engine. Two distinct classes so callers
7987
8260
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7988
8261
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -15957,17 +16230,30 @@ var EventKindCategorySchema = _enum([
15957
16230
  "audio",
15958
16231
  "detection",
15959
16232
  "sensor",
16233
+ "control",
15960
16234
  "custom",
15961
16235
  "package"
15962
16236
  ]);
16237
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16238
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15963
16239
  var EventKindDescriptorSchema = object({
15964
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16240
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15965
16241
  kind: string(),
16242
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16243
+ labelKey: string(),
16244
+ /** English fallback label (kept for clients that don't translate). */
15966
16245
  label: string(),
15967
16246
  /** Hex color for timeline/legend rendering. */
15968
16247
  color: string(),
16248
+ /** Dictionary id → lucide component on the UI side. */
16249
+ iconId: string(),
16250
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15969
16251
  icon: EventKindIconSchema,
15970
16252
  category: EventKindCategorySchema,
16253
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16254
+ parentKind: string().nullable(),
16255
+ /** Derived from `parentKind`, explicit for the client tree. */
16256
+ level: EventKindLevelSchema,
15971
16257
  /** Which cap + device contributes this kind. For built-ins the camera
15972
16258
  * itself; for sensor kinds the LINKED source device. */
15973
16259
  source: object({
@@ -16040,11 +16326,21 @@ var TrackAudioLabelSchema = object({
16040
16326
  firstAt: number(),
16041
16327
  lastAt: number()
16042
16328
  });
16329
+ /**
16330
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16331
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16332
+ * linked sensor/control state change (no positions; carries a snapshot). The
16333
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16334
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16335
+ */
16336
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16043
16337
  var TrackSchema = object({
16044
16338
  trackId: string(),
16045
16339
  deviceId: number(),
16046
16340
  className: string(),
16047
16341
  label: string().optional(),
16342
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16343
+ source: TrackSourceSchema.optional(),
16048
16344
  firstSeen: number(),
16049
16345
  lastSeen: number(),
16050
16346
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16421,6 +16717,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16421
16717
  eventId: string(),
16422
16718
  timestamp: number()
16423
16719
  });
16720
+ /**
16721
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16722
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16723
+ * caps into per-camera event-kind descriptors.
16724
+ *
16725
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16726
+ * is NOT duplicated here — every entry is derived from the single
16727
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16728
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16729
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16730
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16731
+ * eventful cap is missing.
16732
+ */
16733
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16734
+ var LEGACY_ICON = {
16735
+ motion: "motion",
16736
+ audio: "audio",
16737
+ person: "person",
16738
+ vehicle: "vehicle",
16739
+ animal: "animal",
16740
+ package: "package",
16741
+ door: "door",
16742
+ pir: "pir",
16743
+ smoke: "smoke",
16744
+ water: "water",
16745
+ button: "button",
16746
+ generic: "generic",
16747
+ gas: "smoke",
16748
+ vibration: "generic",
16749
+ tamper: "generic",
16750
+ presence: "person",
16751
+ lock: "generic",
16752
+ siren: "generic",
16753
+ switch: "generic",
16754
+ doorbell: "button"
16755
+ };
16756
+ function legacyIcon(iconId) {
16757
+ return LEGACY_ICON[iconId] ?? "generic";
16758
+ }
16759
+ /**
16760
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16761
+ * The anti-drift guard cross-checks this against the eventful caps declared
16762
+ * in `packages/types/src/capabilities/*.cap.ts`.
16763
+ */
16764
+ var CAP_TO_KIND = {
16765
+ contact: "contact",
16766
+ motion: "motion-sensor",
16767
+ smoke: "smoke",
16768
+ flood: "flood",
16769
+ gas: "gas",
16770
+ "carbon-monoxide": "carbon-monoxide",
16771
+ vibration: "vibration",
16772
+ tamper: "tamper",
16773
+ presence: "presence",
16774
+ "enum-sensor": "enum-sensor",
16775
+ "event-emitter": "device-event",
16776
+ "lock-control": "lock",
16777
+ switch: "switch",
16778
+ button: "button",
16779
+ doorbell: "doorbell"
16780
+ };
16781
+ function buildDescriptor(capName, kind) {
16782
+ const t = EVENT_TAXONOMY[kind];
16783
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16784
+ return {
16785
+ ...t,
16786
+ icon: legacyIcon(t.iconId)
16787
+ };
16788
+ }
16789
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16424
16790
  var CameraPipelineConfigSchema = object({
16425
16791
  engine: PipelineEngineChoiceSchema.optional(),
16426
16792
  steps: array(PipelineStepInputSchema).readonly(),
@@ -7692,6 +7692,160 @@ function pickClosestResolution(entries, target) {
7692
7692
  }
7693
7693
  return bestAbove?.entry ?? bestBelow?.entry;
7694
7694
  }
7695
+ var COCO_TO_MACRO = {
7696
+ mapping: {
7697
+ person: "person",
7698
+ bicycle: "vehicle",
7699
+ car: "vehicle",
7700
+ motorcycle: "vehicle",
7701
+ airplane: "vehicle",
7702
+ bus: "vehicle",
7703
+ train: "vehicle",
7704
+ truck: "vehicle",
7705
+ boat: "vehicle",
7706
+ bird: "animal",
7707
+ cat: "animal",
7708
+ dog: "animal",
7709
+ horse: "animal",
7710
+ sheep: "animal",
7711
+ cow: "animal",
7712
+ elephant: "animal",
7713
+ bear: "animal",
7714
+ zebra: "animal",
7715
+ giraffe: "animal",
7716
+ suitcase: "package",
7717
+ backpack: "package",
7718
+ handbag: "package"
7719
+ },
7720
+ preserveOriginal: false
7721
+ };
7722
+ var AUDIO_MACRO_LABELS = [
7723
+ {
7724
+ id: "speech",
7725
+ name: "Speech",
7726
+ icon: "🗣️"
7727
+ },
7728
+ {
7729
+ id: "scream",
7730
+ name: "Scream / Shout",
7731
+ icon: "😱"
7732
+ },
7733
+ {
7734
+ id: "crying",
7735
+ name: "Crying / Baby",
7736
+ icon: "😢"
7737
+ },
7738
+ {
7739
+ id: "laughter",
7740
+ name: "Laughter",
7741
+ icon: "😂"
7742
+ },
7743
+ {
7744
+ id: "music",
7745
+ name: "Music",
7746
+ icon: "🎵"
7747
+ },
7748
+ {
7749
+ id: "dog",
7750
+ name: "Dog",
7751
+ icon: "🐕"
7752
+ },
7753
+ {
7754
+ id: "cat",
7755
+ name: "Cat",
7756
+ icon: "🐈"
7757
+ },
7758
+ {
7759
+ id: "bird",
7760
+ name: "Bird",
7761
+ icon: "🐦"
7762
+ },
7763
+ {
7764
+ id: "animal",
7765
+ name: "Animal (other)",
7766
+ icon: "🐾"
7767
+ },
7768
+ {
7769
+ id: "alarm",
7770
+ name: "Alarm / Siren",
7771
+ icon: "🚨"
7772
+ },
7773
+ {
7774
+ id: "doorbell",
7775
+ name: "Doorbell / Knock",
7776
+ icon: "🔔"
7777
+ },
7778
+ {
7779
+ id: "glass_breaking",
7780
+ name: "Glass Breaking",
7781
+ icon: "💥"
7782
+ },
7783
+ {
7784
+ id: "gunshot",
7785
+ name: "Gunshot / Explosion",
7786
+ icon: "💣"
7787
+ },
7788
+ {
7789
+ id: "vehicle",
7790
+ name: "Vehicle",
7791
+ icon: "🚗"
7792
+ },
7793
+ {
7794
+ id: "siren",
7795
+ name: "Emergency Siren",
7796
+ icon: "🚑"
7797
+ },
7798
+ {
7799
+ id: "fire",
7800
+ name: "Fire / Smoke",
7801
+ icon: "🔥"
7802
+ },
7803
+ {
7804
+ id: "water",
7805
+ name: "Water",
7806
+ icon: "💧"
7807
+ },
7808
+ {
7809
+ id: "wind",
7810
+ name: "Wind / Weather",
7811
+ icon: "🌬️"
7812
+ },
7813
+ {
7814
+ id: "door",
7815
+ name: "Door",
7816
+ icon: "🚪"
7817
+ },
7818
+ {
7819
+ id: "footsteps",
7820
+ name: "Footsteps",
7821
+ icon: "👣"
7822
+ },
7823
+ {
7824
+ id: "crowd",
7825
+ name: "Crowd / Chatter",
7826
+ icon: "👥"
7827
+ },
7828
+ {
7829
+ id: "telephone",
7830
+ name: "Telephone",
7831
+ icon: "📞"
7832
+ },
7833
+ {
7834
+ id: "engine",
7835
+ name: "Engine / Motor",
7836
+ icon: "⚙️"
7837
+ },
7838
+ {
7839
+ id: "tools",
7840
+ name: "Tools / Construction",
7841
+ icon: "🔨"
7842
+ },
7843
+ {
7844
+ id: "silence",
7845
+ name: "Silence",
7846
+ icon: "🤫"
7847
+ }
7848
+ ];
7695
7849
  var YAMNET_TO_MACRO = {
7696
7850
  mapping: {
7697
7851
  Speech: "speech",
@@ -7958,6 +8112,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7958
8112
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7959
8113
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7960
8114
  /**
8115
+ * Unified event-kind taxonomy — THE single source of truth for
8116
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8117
+ * icon }`.
8118
+ *
8119
+ * This dictionary folds together what used to be scattered across four
8120
+ * copies:
8121
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8122
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8123
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8124
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8125
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8126
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8127
+ *
8128
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8129
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8130
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8131
+ * color or an icon: they read this dictionary (server descriptors carry the
8132
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8133
+ *
8134
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8135
+ */
8136
+ var TAXONOMY_COLORS = {
8137
+ motion: "#f59e0b",
8138
+ audio: "#06b6d4",
8139
+ person: "#22c55e",
8140
+ vehicle: "#3b82f6",
8141
+ animal: "#f97316",
8142
+ package: "#a855f7",
8143
+ sensor: "#8b5cf6",
8144
+ control: "#10b981",
8145
+ genericDetection: "#64748b"
8146
+ };
8147
+ var DETECTION_SUB_COLORS = {
8148
+ car: "#f59e0b",
8149
+ truck: "#d97706",
8150
+ bus: "#b45309",
8151
+ motorcycle: "#eab308",
8152
+ bicycle: "#ca8a04",
8153
+ airplane: "#60a5fa",
8154
+ boat: "#2563eb",
8155
+ train: "#1d4ed8",
8156
+ bird: "#14b8a6",
8157
+ dog: "#84cc16",
8158
+ cat: "#f97316",
8159
+ horse: "#a16207",
8160
+ sheep: "#a3a3a3",
8161
+ cow: "#78716c",
8162
+ elephant: "#6b7280",
8163
+ bear: "#7c2d12",
8164
+ zebra: "#404040",
8165
+ giraffe: "#d4a373"
8166
+ };
8167
+ function titleCase(id) {
8168
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8169
+ }
8170
+ var entries = /* @__PURE__ */ new Map();
8171
+ function macro(kind, category, color, iconId, label) {
8172
+ entries.set(kind, {
8173
+ kind,
8174
+ parentKind: null,
8175
+ level: "macro",
8176
+ category,
8177
+ color,
8178
+ iconId,
8179
+ labelKey: `eventKind.${kind}`,
8180
+ label
8181
+ });
8182
+ }
8183
+ function sub(kind, parentKind, category, color, iconId, label) {
8184
+ entries.set(kind, {
8185
+ kind,
8186
+ parentKind,
8187
+ level: "sub",
8188
+ category,
8189
+ color,
8190
+ iconId,
8191
+ labelKey: `eventKind.${kind}`,
8192
+ label
8193
+ });
8194
+ }
8195
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8196
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8197
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8198
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8199
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8200
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8201
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8202
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8203
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8204
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8205
+ if (entries.has(cocoClass)) continue;
8206
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8207
+ }
8208
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8209
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8210
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8211
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8212
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8213
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8214
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8215
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8216
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8217
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8218
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8219
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8220
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8221
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8222
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8223
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8224
+ sub("button", "control", "control", "#10b981", "button", "Button");
8225
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8226
+ for (const l of AUDIO_MACRO_LABELS) {
8227
+ const kind = `audio-${l.id}`;
8228
+ if (entries.has(kind)) continue;
8229
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8230
+ }
8231
+ /** The complete taxonomy dictionary, keyed by kind. */
8232
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8233
+ /**
7961
8234
  * Error types for the safe expression engine. Two distinct classes so callers
7962
8235
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7963
8236
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -15932,17 +16205,30 @@ var EventKindCategorySchema = _enum([
15932
16205
  "audio",
15933
16206
  "detection",
15934
16207
  "sensor",
16208
+ "control",
15935
16209
  "custom",
15936
16210
  "package"
15937
16211
  ]);
16212
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16213
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15938
16214
  var EventKindDescriptorSchema = object({
15939
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16215
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15940
16216
  kind: string(),
16217
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16218
+ labelKey: string(),
16219
+ /** English fallback label (kept for clients that don't translate). */
15941
16220
  label: string(),
15942
16221
  /** Hex color for timeline/legend rendering. */
15943
16222
  color: string(),
16223
+ /** Dictionary id → lucide component on the UI side. */
16224
+ iconId: string(),
16225
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15944
16226
  icon: EventKindIconSchema,
15945
16227
  category: EventKindCategorySchema,
16228
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16229
+ parentKind: string().nullable(),
16230
+ /** Derived from `parentKind`, explicit for the client tree. */
16231
+ level: EventKindLevelSchema,
15946
16232
  /** Which cap + device contributes this kind. For built-ins the camera
15947
16233
  * itself; for sensor kinds the LINKED source device. */
15948
16234
  source: object({
@@ -16015,11 +16301,21 @@ var TrackAudioLabelSchema = object({
16015
16301
  firstAt: number(),
16016
16302
  lastAt: number()
16017
16303
  });
16304
+ /**
16305
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16306
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16307
+ * linked sensor/control state change (no positions; carries a snapshot). The
16308
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16309
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16310
+ */
16311
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16018
16312
  var TrackSchema = object({
16019
16313
  trackId: string(),
16020
16314
  deviceId: number(),
16021
16315
  className: string(),
16022
16316
  label: string().optional(),
16317
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16318
+ source: TrackSourceSchema.optional(),
16023
16319
  firstSeen: number(),
16024
16320
  lastSeen: number(),
16025
16321
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16396,6 +16692,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16396
16692
  eventId: string(),
16397
16693
  timestamp: number()
16398
16694
  });
16695
+ /**
16696
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16697
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16698
+ * caps into per-camera event-kind descriptors.
16699
+ *
16700
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16701
+ * is NOT duplicated here — every entry is derived from the single
16702
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16703
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16704
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16705
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16706
+ * eventful cap is missing.
16707
+ */
16708
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16709
+ var LEGACY_ICON = {
16710
+ motion: "motion",
16711
+ audio: "audio",
16712
+ person: "person",
16713
+ vehicle: "vehicle",
16714
+ animal: "animal",
16715
+ package: "package",
16716
+ door: "door",
16717
+ pir: "pir",
16718
+ smoke: "smoke",
16719
+ water: "water",
16720
+ button: "button",
16721
+ generic: "generic",
16722
+ gas: "smoke",
16723
+ vibration: "generic",
16724
+ tamper: "generic",
16725
+ presence: "person",
16726
+ lock: "generic",
16727
+ siren: "generic",
16728
+ switch: "generic",
16729
+ doorbell: "button"
16730
+ };
16731
+ function legacyIcon(iconId) {
16732
+ return LEGACY_ICON[iconId] ?? "generic";
16733
+ }
16734
+ /**
16735
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16736
+ * The anti-drift guard cross-checks this against the eventful caps declared
16737
+ * in `packages/types/src/capabilities/*.cap.ts`.
16738
+ */
16739
+ var CAP_TO_KIND = {
16740
+ contact: "contact",
16741
+ motion: "motion-sensor",
16742
+ smoke: "smoke",
16743
+ flood: "flood",
16744
+ gas: "gas",
16745
+ "carbon-monoxide": "carbon-monoxide",
16746
+ vibration: "vibration",
16747
+ tamper: "tamper",
16748
+ presence: "presence",
16749
+ "enum-sensor": "enum-sensor",
16750
+ "event-emitter": "device-event",
16751
+ "lock-control": "lock",
16752
+ switch: "switch",
16753
+ button: "button",
16754
+ doorbell: "doorbell"
16755
+ };
16756
+ function buildDescriptor(capName, kind) {
16757
+ const t = EVENT_TAXONOMY[kind];
16758
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16759
+ return {
16760
+ ...t,
16761
+ icon: legacyIcon(t.iconId)
16762
+ };
16763
+ }
16764
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16399
16765
  var CameraPipelineConfigSchema = object({
16400
16766
  engine: PipelineEngineChoiceSchema.optional(),
16401
16767
  steps: array(PipelineStepInputSchema).readonly(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-hap",
3
- "version": "1.1.27",
3
+ "version": "1.1.28",
4
4
  "description": "HomeKit (HAP) bridge exporter for CamStack devices. Publishes a bridged accessory per exposed device — MotionSensor in this MVP; Camera/Doorbell/Switch/Light follow.",
5
5
  "keywords": [
6
6
  "camstack",