@camstack/addon-provider-dreame 0.1.33 → 0.1.34

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
@@ -7695,6 +7695,160 @@ var EncodeProfileSchema = object({
7695
7695
  */
7696
7696
  outputArgs: array(string()).optional()
7697
7697
  });
7698
+ var COCO_TO_MACRO = {
7699
+ mapping: {
7700
+ person: "person",
7701
+ bicycle: "vehicle",
7702
+ car: "vehicle",
7703
+ motorcycle: "vehicle",
7704
+ airplane: "vehicle",
7705
+ bus: "vehicle",
7706
+ train: "vehicle",
7707
+ truck: "vehicle",
7708
+ boat: "vehicle",
7709
+ bird: "animal",
7710
+ cat: "animal",
7711
+ dog: "animal",
7712
+ horse: "animal",
7713
+ sheep: "animal",
7714
+ cow: "animal",
7715
+ elephant: "animal",
7716
+ bear: "animal",
7717
+ zebra: "animal",
7718
+ giraffe: "animal",
7719
+ suitcase: "package",
7720
+ backpack: "package",
7721
+ handbag: "package"
7722
+ },
7723
+ preserveOriginal: false
7724
+ };
7725
+ var AUDIO_MACRO_LABELS = [
7726
+ {
7727
+ id: "speech",
7728
+ name: "Speech",
7729
+ icon: "🗣️"
7730
+ },
7731
+ {
7732
+ id: "scream",
7733
+ name: "Scream / Shout",
7734
+ icon: "😱"
7735
+ },
7736
+ {
7737
+ id: "crying",
7738
+ name: "Crying / Baby",
7739
+ icon: "😢"
7740
+ },
7741
+ {
7742
+ id: "laughter",
7743
+ name: "Laughter",
7744
+ icon: "😂"
7745
+ },
7746
+ {
7747
+ id: "music",
7748
+ name: "Music",
7749
+ icon: "🎵"
7750
+ },
7751
+ {
7752
+ id: "dog",
7753
+ name: "Dog",
7754
+ icon: "🐕"
7755
+ },
7756
+ {
7757
+ id: "cat",
7758
+ name: "Cat",
7759
+ icon: "🐈"
7760
+ },
7761
+ {
7762
+ id: "bird",
7763
+ name: "Bird",
7764
+ icon: "🐦"
7765
+ },
7766
+ {
7767
+ id: "animal",
7768
+ name: "Animal (other)",
7769
+ icon: "🐾"
7770
+ },
7771
+ {
7772
+ id: "alarm",
7773
+ name: "Alarm / Siren",
7774
+ icon: "🚨"
7775
+ },
7776
+ {
7777
+ id: "doorbell",
7778
+ name: "Doorbell / Knock",
7779
+ icon: "🔔"
7780
+ },
7781
+ {
7782
+ id: "glass_breaking",
7783
+ name: "Glass Breaking",
7784
+ icon: "💥"
7785
+ },
7786
+ {
7787
+ id: "gunshot",
7788
+ name: "Gunshot / Explosion",
7789
+ icon: "💣"
7790
+ },
7791
+ {
7792
+ id: "vehicle",
7793
+ name: "Vehicle",
7794
+ icon: "🚗"
7795
+ },
7796
+ {
7797
+ id: "siren",
7798
+ name: "Emergency Siren",
7799
+ icon: "🚑"
7800
+ },
7801
+ {
7802
+ id: "fire",
7803
+ name: "Fire / Smoke",
7804
+ icon: "🔥"
7805
+ },
7806
+ {
7807
+ id: "water",
7808
+ name: "Water",
7809
+ icon: "💧"
7810
+ },
7811
+ {
7812
+ id: "wind",
7813
+ name: "Wind / Weather",
7814
+ icon: "🌬️"
7815
+ },
7816
+ {
7817
+ id: "door",
7818
+ name: "Door",
7819
+ icon: "🚪"
7820
+ },
7821
+ {
7822
+ id: "footsteps",
7823
+ name: "Footsteps",
7824
+ icon: "👣"
7825
+ },
7826
+ {
7827
+ id: "crowd",
7828
+ name: "Crowd / Chatter",
7829
+ icon: "👥"
7830
+ },
7831
+ {
7832
+ id: "telephone",
7833
+ name: "Telephone",
7834
+ icon: "📞"
7835
+ },
7836
+ {
7837
+ id: "engine",
7838
+ name: "Engine / Motor",
7839
+ icon: "⚙️"
7840
+ },
7841
+ {
7842
+ id: "tools",
7843
+ name: "Tools / Construction",
7844
+ icon: "🔨"
7845
+ },
7846
+ {
7847
+ id: "silence",
7848
+ name: "Silence",
7849
+ icon: "🤫"
7850
+ }
7851
+ ];
7698
7852
  var YAMNET_TO_MACRO = {
7699
7853
  mapping: {
7700
7854
  Speech: "speech",
@@ -7961,6 +8115,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7961
8115
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7962
8116
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7963
8117
  /**
8118
+ * Unified event-kind taxonomy — THE single source of truth for
8119
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8120
+ * icon }`.
8121
+ *
8122
+ * This dictionary folds together what used to be scattered across four
8123
+ * copies:
8124
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8125
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8126
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8127
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8128
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8129
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8130
+ *
8131
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8132
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8133
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8134
+ * color or an icon: they read this dictionary (server descriptors carry the
8135
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8136
+ *
8137
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8138
+ */
8139
+ var TAXONOMY_COLORS = {
8140
+ motion: "#f59e0b",
8141
+ audio: "#06b6d4",
8142
+ person: "#22c55e",
8143
+ vehicle: "#3b82f6",
8144
+ animal: "#f97316",
8145
+ package: "#a855f7",
8146
+ sensor: "#8b5cf6",
8147
+ control: "#10b981",
8148
+ genericDetection: "#64748b"
8149
+ };
8150
+ var DETECTION_SUB_COLORS = {
8151
+ car: "#f59e0b",
8152
+ truck: "#d97706",
8153
+ bus: "#b45309",
8154
+ motorcycle: "#eab308",
8155
+ bicycle: "#ca8a04",
8156
+ airplane: "#60a5fa",
8157
+ boat: "#2563eb",
8158
+ train: "#1d4ed8",
8159
+ bird: "#14b8a6",
8160
+ dog: "#84cc16",
8161
+ cat: "#f97316",
8162
+ horse: "#a16207",
8163
+ sheep: "#a3a3a3",
8164
+ cow: "#78716c",
8165
+ elephant: "#6b7280",
8166
+ bear: "#7c2d12",
8167
+ zebra: "#404040",
8168
+ giraffe: "#d4a373"
8169
+ };
8170
+ function titleCase(id) {
8171
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8172
+ }
8173
+ var entries = /* @__PURE__ */ new Map();
8174
+ function macro(kind, category, color, iconId, label) {
8175
+ entries.set(kind, {
8176
+ kind,
8177
+ parentKind: null,
8178
+ level: "macro",
8179
+ category,
8180
+ color,
8181
+ iconId,
8182
+ labelKey: `eventKind.${kind}`,
8183
+ label
8184
+ });
8185
+ }
8186
+ function sub(kind, parentKind, category, color, iconId, label) {
8187
+ entries.set(kind, {
8188
+ kind,
8189
+ parentKind,
8190
+ level: "sub",
8191
+ category,
8192
+ color,
8193
+ iconId,
8194
+ labelKey: `eventKind.${kind}`,
8195
+ label
8196
+ });
8197
+ }
8198
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8199
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8200
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8201
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8202
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8203
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8204
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8205
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8206
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8207
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8208
+ if (entries.has(cocoClass)) continue;
8209
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8210
+ }
8211
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8212
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8213
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8214
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8215
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8216
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8217
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8218
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8219
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8220
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8221
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8222
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8223
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8224
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8225
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8226
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8227
+ sub("button", "control", "control", "#10b981", "button", "Button");
8228
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8229
+ for (const l of AUDIO_MACRO_LABELS) {
8230
+ const kind = `audio-${l.id}`;
8231
+ if (entries.has(kind)) continue;
8232
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8233
+ }
8234
+ /** The complete taxonomy dictionary, keyed by kind. */
8235
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8236
+ /**
7964
8237
  * Error types for the safe expression engine. Two distinct classes so callers
7965
8238
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7966
8239
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -18910,17 +19183,30 @@ var EventKindCategorySchema = _enum([
18910
19183
  "audio",
18911
19184
  "detection",
18912
19185
  "sensor",
19186
+ "control",
18913
19187
  "custom",
18914
19188
  "package"
18915
19189
  ]);
19190
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19191
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18916
19192
  var EventKindDescriptorSchema = object({
18917
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19193
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18918
19194
  kind: string(),
19195
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19196
+ labelKey: string(),
19197
+ /** English fallback label (kept for clients that don't translate). */
18919
19198
  label: string(),
18920
19199
  /** Hex color for timeline/legend rendering. */
18921
19200
  color: string(),
19201
+ /** Dictionary id → lucide component on the UI side. */
19202
+ iconId: string(),
19203
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18922
19204
  icon: EventKindIconSchema,
18923
19205
  category: EventKindCategorySchema,
19206
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19207
+ parentKind: string().nullable(),
19208
+ /** Derived from `parentKind`, explicit for the client tree. */
19209
+ level: EventKindLevelSchema,
18924
19210
  /** Which cap + device contributes this kind. For built-ins the camera
18925
19211
  * itself; for sensor kinds the LINKED source device. */
18926
19212
  source: object({
@@ -18993,11 +19279,21 @@ var TrackAudioLabelSchema = object({
18993
19279
  firstAt: number(),
18994
19280
  lastAt: number()
18995
19281
  });
19282
+ /**
19283
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19284
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19285
+ * linked sensor/control state change (no positions; carries a snapshot). The
19286
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19287
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19288
+ */
19289
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18996
19290
  var TrackSchema = object({
18997
19291
  trackId: string(),
18998
19292
  deviceId: number(),
18999
19293
  className: string(),
19000
19294
  label: string().optional(),
19295
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19296
+ source: TrackSourceSchema.optional(),
19001
19297
  firstSeen: number(),
19002
19298
  lastSeen: number(),
19003
19299
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19374,6 +19670,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19374
19670
  eventId: string(),
19375
19671
  timestamp: number()
19376
19672
  });
19673
+ /**
19674
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19675
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19676
+ * caps into per-camera event-kind descriptors.
19677
+ *
19678
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19679
+ * is NOT duplicated here — every entry is derived from the single
19680
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19681
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19682
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19683
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19684
+ * eventful cap is missing.
19685
+ */
19686
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19687
+ var LEGACY_ICON = {
19688
+ motion: "motion",
19689
+ audio: "audio",
19690
+ person: "person",
19691
+ vehicle: "vehicle",
19692
+ animal: "animal",
19693
+ package: "package",
19694
+ door: "door",
19695
+ pir: "pir",
19696
+ smoke: "smoke",
19697
+ water: "water",
19698
+ button: "button",
19699
+ generic: "generic",
19700
+ gas: "smoke",
19701
+ vibration: "generic",
19702
+ tamper: "generic",
19703
+ presence: "person",
19704
+ lock: "generic",
19705
+ siren: "generic",
19706
+ switch: "generic",
19707
+ doorbell: "button"
19708
+ };
19709
+ function legacyIcon(iconId) {
19710
+ return LEGACY_ICON[iconId] ?? "generic";
19711
+ }
19712
+ /**
19713
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19714
+ * The anti-drift guard cross-checks this against the eventful caps declared
19715
+ * in `packages/types/src/capabilities/*.cap.ts`.
19716
+ */
19717
+ var CAP_TO_KIND = {
19718
+ contact: "contact",
19719
+ motion: "motion-sensor",
19720
+ smoke: "smoke",
19721
+ flood: "flood",
19722
+ gas: "gas",
19723
+ "carbon-monoxide": "carbon-monoxide",
19724
+ vibration: "vibration",
19725
+ tamper: "tamper",
19726
+ presence: "presence",
19727
+ "enum-sensor": "enum-sensor",
19728
+ "event-emitter": "device-event",
19729
+ "lock-control": "lock",
19730
+ switch: "switch",
19731
+ button: "button",
19732
+ doorbell: "doorbell"
19733
+ };
19734
+ function buildDescriptor(capName, kind) {
19735
+ const t = EVENT_TAXONOMY[kind];
19736
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19737
+ return {
19738
+ ...t,
19739
+ icon: legacyIcon(t.iconId)
19740
+ };
19741
+ }
19742
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19377
19743
  var CameraPipelineConfigSchema = object({
19378
19744
  engine: PipelineEngineChoiceSchema.optional(),
19379
19745
  steps: array(PipelineStepInputSchema).readonly(),
package/dist/addon.mjs CHANGED
@@ -7695,6 +7695,160 @@ var EncodeProfileSchema = object({
7695
7695
  */
7696
7696
  outputArgs: array(string()).optional()
7697
7697
  });
7698
+ var COCO_TO_MACRO = {
7699
+ mapping: {
7700
+ person: "person",
7701
+ bicycle: "vehicle",
7702
+ car: "vehicle",
7703
+ motorcycle: "vehicle",
7704
+ airplane: "vehicle",
7705
+ bus: "vehicle",
7706
+ train: "vehicle",
7707
+ truck: "vehicle",
7708
+ boat: "vehicle",
7709
+ bird: "animal",
7710
+ cat: "animal",
7711
+ dog: "animal",
7712
+ horse: "animal",
7713
+ sheep: "animal",
7714
+ cow: "animal",
7715
+ elephant: "animal",
7716
+ bear: "animal",
7717
+ zebra: "animal",
7718
+ giraffe: "animal",
7719
+ suitcase: "package",
7720
+ backpack: "package",
7721
+ handbag: "package"
7722
+ },
7723
+ preserveOriginal: false
7724
+ };
7725
+ var AUDIO_MACRO_LABELS = [
7726
+ {
7727
+ id: "speech",
7728
+ name: "Speech",
7729
+ icon: "🗣️"
7730
+ },
7731
+ {
7732
+ id: "scream",
7733
+ name: "Scream / Shout",
7734
+ icon: "😱"
7735
+ },
7736
+ {
7737
+ id: "crying",
7738
+ name: "Crying / Baby",
7739
+ icon: "😢"
7740
+ },
7741
+ {
7742
+ id: "laughter",
7743
+ name: "Laughter",
7744
+ icon: "😂"
7745
+ },
7746
+ {
7747
+ id: "music",
7748
+ name: "Music",
7749
+ icon: "🎵"
7750
+ },
7751
+ {
7752
+ id: "dog",
7753
+ name: "Dog",
7754
+ icon: "🐕"
7755
+ },
7756
+ {
7757
+ id: "cat",
7758
+ name: "Cat",
7759
+ icon: "🐈"
7760
+ },
7761
+ {
7762
+ id: "bird",
7763
+ name: "Bird",
7764
+ icon: "🐦"
7765
+ },
7766
+ {
7767
+ id: "animal",
7768
+ name: "Animal (other)",
7769
+ icon: "🐾"
7770
+ },
7771
+ {
7772
+ id: "alarm",
7773
+ name: "Alarm / Siren",
7774
+ icon: "🚨"
7775
+ },
7776
+ {
7777
+ id: "doorbell",
7778
+ name: "Doorbell / Knock",
7779
+ icon: "🔔"
7780
+ },
7781
+ {
7782
+ id: "glass_breaking",
7783
+ name: "Glass Breaking",
7784
+ icon: "💥"
7785
+ },
7786
+ {
7787
+ id: "gunshot",
7788
+ name: "Gunshot / Explosion",
7789
+ icon: "💣"
7790
+ },
7791
+ {
7792
+ id: "vehicle",
7793
+ name: "Vehicle",
7794
+ icon: "🚗"
7795
+ },
7796
+ {
7797
+ id: "siren",
7798
+ name: "Emergency Siren",
7799
+ icon: "🚑"
7800
+ },
7801
+ {
7802
+ id: "fire",
7803
+ name: "Fire / Smoke",
7804
+ icon: "🔥"
7805
+ },
7806
+ {
7807
+ id: "water",
7808
+ name: "Water",
7809
+ icon: "💧"
7810
+ },
7811
+ {
7812
+ id: "wind",
7813
+ name: "Wind / Weather",
7814
+ icon: "🌬️"
7815
+ },
7816
+ {
7817
+ id: "door",
7818
+ name: "Door",
7819
+ icon: "🚪"
7820
+ },
7821
+ {
7822
+ id: "footsteps",
7823
+ name: "Footsteps",
7824
+ icon: "👣"
7825
+ },
7826
+ {
7827
+ id: "crowd",
7828
+ name: "Crowd / Chatter",
7829
+ icon: "👥"
7830
+ },
7831
+ {
7832
+ id: "telephone",
7833
+ name: "Telephone",
7834
+ icon: "📞"
7835
+ },
7836
+ {
7837
+ id: "engine",
7838
+ name: "Engine / Motor",
7839
+ icon: "⚙️"
7840
+ },
7841
+ {
7842
+ id: "tools",
7843
+ name: "Tools / Construction",
7844
+ icon: "🔨"
7845
+ },
7846
+ {
7847
+ id: "silence",
7848
+ name: "Silence",
7849
+ icon: "🤫"
7850
+ }
7851
+ ];
7698
7852
  var YAMNET_TO_MACRO = {
7699
7853
  mapping: {
7700
7854
  Speech: "speech",
@@ -7961,6 +8115,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7961
8115
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7962
8116
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7963
8117
  /**
8118
+ * Unified event-kind taxonomy — THE single source of truth for
8119
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8120
+ * icon }`.
8121
+ *
8122
+ * This dictionary folds together what used to be scattered across four
8123
+ * copies:
8124
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8125
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8126
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8127
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8128
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8129
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8130
+ *
8131
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8132
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8133
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8134
+ * color or an icon: they read this dictionary (server descriptors carry the
8135
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8136
+ *
8137
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8138
+ */
8139
+ var TAXONOMY_COLORS = {
8140
+ motion: "#f59e0b",
8141
+ audio: "#06b6d4",
8142
+ person: "#22c55e",
8143
+ vehicle: "#3b82f6",
8144
+ animal: "#f97316",
8145
+ package: "#a855f7",
8146
+ sensor: "#8b5cf6",
8147
+ control: "#10b981",
8148
+ genericDetection: "#64748b"
8149
+ };
8150
+ var DETECTION_SUB_COLORS = {
8151
+ car: "#f59e0b",
8152
+ truck: "#d97706",
8153
+ bus: "#b45309",
8154
+ motorcycle: "#eab308",
8155
+ bicycle: "#ca8a04",
8156
+ airplane: "#60a5fa",
8157
+ boat: "#2563eb",
8158
+ train: "#1d4ed8",
8159
+ bird: "#14b8a6",
8160
+ dog: "#84cc16",
8161
+ cat: "#f97316",
8162
+ horse: "#a16207",
8163
+ sheep: "#a3a3a3",
8164
+ cow: "#78716c",
8165
+ elephant: "#6b7280",
8166
+ bear: "#7c2d12",
8167
+ zebra: "#404040",
8168
+ giraffe: "#d4a373"
8169
+ };
8170
+ function titleCase(id) {
8171
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8172
+ }
8173
+ var entries = /* @__PURE__ */ new Map();
8174
+ function macro(kind, category, color, iconId, label) {
8175
+ entries.set(kind, {
8176
+ kind,
8177
+ parentKind: null,
8178
+ level: "macro",
8179
+ category,
8180
+ color,
8181
+ iconId,
8182
+ labelKey: `eventKind.${kind}`,
8183
+ label
8184
+ });
8185
+ }
8186
+ function sub(kind, parentKind, category, color, iconId, label) {
8187
+ entries.set(kind, {
8188
+ kind,
8189
+ parentKind,
8190
+ level: "sub",
8191
+ category,
8192
+ color,
8193
+ iconId,
8194
+ labelKey: `eventKind.${kind}`,
8195
+ label
8196
+ });
8197
+ }
8198
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8199
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8200
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8201
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8202
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8203
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8204
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8205
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8206
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8207
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8208
+ if (entries.has(cocoClass)) continue;
8209
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8210
+ }
8211
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8212
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8213
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8214
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8215
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8216
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8217
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8218
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8219
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8220
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8221
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8222
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8223
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8224
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8225
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8226
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8227
+ sub("button", "control", "control", "#10b981", "button", "Button");
8228
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8229
+ for (const l of AUDIO_MACRO_LABELS) {
8230
+ const kind = `audio-${l.id}`;
8231
+ if (entries.has(kind)) continue;
8232
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8233
+ }
8234
+ /** The complete taxonomy dictionary, keyed by kind. */
8235
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8236
+ /**
7964
8237
  * Error types for the safe expression engine. Two distinct classes so callers
7965
8238
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7966
8239
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -18910,17 +19183,30 @@ var EventKindCategorySchema = _enum([
18910
19183
  "audio",
18911
19184
  "detection",
18912
19185
  "sensor",
19186
+ "control",
18913
19187
  "custom",
18914
19188
  "package"
18915
19189
  ]);
19190
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19191
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18916
19192
  var EventKindDescriptorSchema = object({
18917
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19193
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18918
19194
  kind: string(),
19195
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19196
+ labelKey: string(),
19197
+ /** English fallback label (kept for clients that don't translate). */
18919
19198
  label: string(),
18920
19199
  /** Hex color for timeline/legend rendering. */
18921
19200
  color: string(),
19201
+ /** Dictionary id → lucide component on the UI side. */
19202
+ iconId: string(),
19203
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18922
19204
  icon: EventKindIconSchema,
18923
19205
  category: EventKindCategorySchema,
19206
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19207
+ parentKind: string().nullable(),
19208
+ /** Derived from `parentKind`, explicit for the client tree. */
19209
+ level: EventKindLevelSchema,
18924
19210
  /** Which cap + device contributes this kind. For built-ins the camera
18925
19211
  * itself; for sensor kinds the LINKED source device. */
18926
19212
  source: object({
@@ -18993,11 +19279,21 @@ var TrackAudioLabelSchema = object({
18993
19279
  firstAt: number(),
18994
19280
  lastAt: number()
18995
19281
  });
19282
+ /**
19283
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19284
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19285
+ * linked sensor/control state change (no positions; carries a snapshot). The
19286
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19287
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19288
+ */
19289
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18996
19290
  var TrackSchema = object({
18997
19291
  trackId: string(),
18998
19292
  deviceId: number(),
18999
19293
  className: string(),
19000
19294
  label: string().optional(),
19295
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19296
+ source: TrackSourceSchema.optional(),
19001
19297
  firstSeen: number(),
19002
19298
  lastSeen: number(),
19003
19299
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19374,6 +19670,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19374
19670
  eventId: string(),
19375
19671
  timestamp: number()
19376
19672
  });
19673
+ /**
19674
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19675
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19676
+ * caps into per-camera event-kind descriptors.
19677
+ *
19678
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19679
+ * is NOT duplicated here — every entry is derived from the single
19680
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19681
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19682
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19683
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19684
+ * eventful cap is missing.
19685
+ */
19686
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19687
+ var LEGACY_ICON = {
19688
+ motion: "motion",
19689
+ audio: "audio",
19690
+ person: "person",
19691
+ vehicle: "vehicle",
19692
+ animal: "animal",
19693
+ package: "package",
19694
+ door: "door",
19695
+ pir: "pir",
19696
+ smoke: "smoke",
19697
+ water: "water",
19698
+ button: "button",
19699
+ generic: "generic",
19700
+ gas: "smoke",
19701
+ vibration: "generic",
19702
+ tamper: "generic",
19703
+ presence: "person",
19704
+ lock: "generic",
19705
+ siren: "generic",
19706
+ switch: "generic",
19707
+ doorbell: "button"
19708
+ };
19709
+ function legacyIcon(iconId) {
19710
+ return LEGACY_ICON[iconId] ?? "generic";
19711
+ }
19712
+ /**
19713
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19714
+ * The anti-drift guard cross-checks this against the eventful caps declared
19715
+ * in `packages/types/src/capabilities/*.cap.ts`.
19716
+ */
19717
+ var CAP_TO_KIND = {
19718
+ contact: "contact",
19719
+ motion: "motion-sensor",
19720
+ smoke: "smoke",
19721
+ flood: "flood",
19722
+ gas: "gas",
19723
+ "carbon-monoxide": "carbon-monoxide",
19724
+ vibration: "vibration",
19725
+ tamper: "tamper",
19726
+ presence: "presence",
19727
+ "enum-sensor": "enum-sensor",
19728
+ "event-emitter": "device-event",
19729
+ "lock-control": "lock",
19730
+ switch: "switch",
19731
+ button: "button",
19732
+ doorbell: "doorbell"
19733
+ };
19734
+ function buildDescriptor(capName, kind) {
19735
+ const t = EVENT_TAXONOMY[kind];
19736
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19737
+ return {
19738
+ ...t,
19739
+ icon: legacyIcon(t.iconId)
19740
+ };
19741
+ }
19742
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19377
19743
  var CameraPipelineConfigSchema = object({
19378
19744
  engine: PipelineEngineChoiceSchema.optional(),
19379
19745
  steps: array(PipelineStepInputSchema).readonly(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreame",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "description": "Dreame robot-vacuum / lawn-mower device-provider addon for CamStack — wraps the @apocaliss92/nodedreame Dreamehome cloud client",
5
5
  "keywords": [
6
6
  "camstack",