@camstack/addon-provider-rtsp 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.
package/dist/addon.js CHANGED
@@ -7701,6 +7701,160 @@ var EncodeProfileSchema = object({
7701
7701
  */
7702
7702
  outputArgs: array(string()).optional()
7703
7703
  });
7704
+ var COCO_TO_MACRO = {
7705
+ mapping: {
7706
+ person: "person",
7707
+ bicycle: "vehicle",
7708
+ car: "vehicle",
7709
+ motorcycle: "vehicle",
7710
+ airplane: "vehicle",
7711
+ bus: "vehicle",
7712
+ train: "vehicle",
7713
+ truck: "vehicle",
7714
+ boat: "vehicle",
7715
+ bird: "animal",
7716
+ cat: "animal",
7717
+ dog: "animal",
7718
+ horse: "animal",
7719
+ sheep: "animal",
7720
+ cow: "animal",
7721
+ elephant: "animal",
7722
+ bear: "animal",
7723
+ zebra: "animal",
7724
+ giraffe: "animal",
7725
+ suitcase: "package",
7726
+ backpack: "package",
7727
+ handbag: "package"
7728
+ },
7729
+ preserveOriginal: false
7730
+ };
7731
+ var AUDIO_MACRO_LABELS = [
7732
+ {
7733
+ id: "speech",
7734
+ name: "Speech",
7735
+ icon: "🗣️"
7736
+ },
7737
+ {
7738
+ id: "scream",
7739
+ name: "Scream / Shout",
7740
+ icon: "😱"
7741
+ },
7742
+ {
7743
+ id: "crying",
7744
+ name: "Crying / Baby",
7745
+ icon: "😢"
7746
+ },
7747
+ {
7748
+ id: "laughter",
7749
+ name: "Laughter",
7750
+ icon: "😂"
7751
+ },
7752
+ {
7753
+ id: "music",
7754
+ name: "Music",
7755
+ icon: "🎵"
7756
+ },
7757
+ {
7758
+ id: "dog",
7759
+ name: "Dog",
7760
+ icon: "🐕"
7761
+ },
7762
+ {
7763
+ id: "cat",
7764
+ name: "Cat",
7765
+ icon: "🐈"
7766
+ },
7767
+ {
7768
+ id: "bird",
7769
+ name: "Bird",
7770
+ icon: "🐦"
7771
+ },
7772
+ {
7773
+ id: "animal",
7774
+ name: "Animal (other)",
7775
+ icon: "🐾"
7776
+ },
7777
+ {
7778
+ id: "alarm",
7779
+ name: "Alarm / Siren",
7780
+ icon: "🚨"
7781
+ },
7782
+ {
7783
+ id: "doorbell",
7784
+ name: "Doorbell / Knock",
7785
+ icon: "🔔"
7786
+ },
7787
+ {
7788
+ id: "glass_breaking",
7789
+ name: "Glass Breaking",
7790
+ icon: "💥"
7791
+ },
7792
+ {
7793
+ id: "gunshot",
7794
+ name: "Gunshot / Explosion",
7795
+ icon: "💣"
7796
+ },
7797
+ {
7798
+ id: "vehicle",
7799
+ name: "Vehicle",
7800
+ icon: "🚗"
7801
+ },
7802
+ {
7803
+ id: "siren",
7804
+ name: "Emergency Siren",
7805
+ icon: "🚑"
7806
+ },
7807
+ {
7808
+ id: "fire",
7809
+ name: "Fire / Smoke",
7810
+ icon: "🔥"
7811
+ },
7812
+ {
7813
+ id: "water",
7814
+ name: "Water",
7815
+ icon: "💧"
7816
+ },
7817
+ {
7818
+ id: "wind",
7819
+ name: "Wind / Weather",
7820
+ icon: "🌬️"
7821
+ },
7822
+ {
7823
+ id: "door",
7824
+ name: "Door",
7825
+ icon: "🚪"
7826
+ },
7827
+ {
7828
+ id: "footsteps",
7829
+ name: "Footsteps",
7830
+ icon: "👣"
7831
+ },
7832
+ {
7833
+ id: "crowd",
7834
+ name: "Crowd / Chatter",
7835
+ icon: "👥"
7836
+ },
7837
+ {
7838
+ id: "telephone",
7839
+ name: "Telephone",
7840
+ icon: "📞"
7841
+ },
7842
+ {
7843
+ id: "engine",
7844
+ name: "Engine / Motor",
7845
+ icon: "⚙️"
7846
+ },
7847
+ {
7848
+ id: "tools",
7849
+ name: "Tools / Construction",
7850
+ icon: "🔨"
7851
+ },
7852
+ {
7853
+ id: "silence",
7854
+ name: "Silence",
7855
+ icon: "🤫"
7856
+ }
7857
+ ];
7704
7858
  var YAMNET_TO_MACRO = {
7705
7859
  mapping: {
7706
7860
  Speech: "speech",
@@ -7967,6 +8121,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7967
8121
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7968
8122
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7969
8123
  /**
8124
+ * Unified event-kind taxonomy — THE single source of truth for
8125
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8126
+ * icon }`.
8127
+ *
8128
+ * This dictionary folds together what used to be scattered across four
8129
+ * copies:
8130
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8131
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8132
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8133
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8134
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8135
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8136
+ *
8137
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8138
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8139
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8140
+ * color or an icon: they read this dictionary (server descriptors carry the
8141
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8142
+ *
8143
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8144
+ */
8145
+ var TAXONOMY_COLORS = {
8146
+ motion: "#f59e0b",
8147
+ audio: "#06b6d4",
8148
+ person: "#22c55e",
8149
+ vehicle: "#3b82f6",
8150
+ animal: "#f97316",
8151
+ package: "#a855f7",
8152
+ sensor: "#8b5cf6",
8153
+ control: "#10b981",
8154
+ genericDetection: "#64748b"
8155
+ };
8156
+ var DETECTION_SUB_COLORS = {
8157
+ car: "#f59e0b",
8158
+ truck: "#d97706",
8159
+ bus: "#b45309",
8160
+ motorcycle: "#eab308",
8161
+ bicycle: "#ca8a04",
8162
+ airplane: "#60a5fa",
8163
+ boat: "#2563eb",
8164
+ train: "#1d4ed8",
8165
+ bird: "#14b8a6",
8166
+ dog: "#84cc16",
8167
+ cat: "#f97316",
8168
+ horse: "#a16207",
8169
+ sheep: "#a3a3a3",
8170
+ cow: "#78716c",
8171
+ elephant: "#6b7280",
8172
+ bear: "#7c2d12",
8173
+ zebra: "#404040",
8174
+ giraffe: "#d4a373"
8175
+ };
8176
+ function titleCase(id) {
8177
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8178
+ }
8179
+ var entries = /* @__PURE__ */ new Map();
8180
+ function macro(kind, category, color, iconId, label) {
8181
+ entries.set(kind, {
8182
+ kind,
8183
+ parentKind: null,
8184
+ level: "macro",
8185
+ category,
8186
+ color,
8187
+ iconId,
8188
+ labelKey: `eventKind.${kind}`,
8189
+ label
8190
+ });
8191
+ }
8192
+ function sub(kind, parentKind, category, color, iconId, label) {
8193
+ entries.set(kind, {
8194
+ kind,
8195
+ parentKind,
8196
+ level: "sub",
8197
+ category,
8198
+ color,
8199
+ iconId,
8200
+ labelKey: `eventKind.${kind}`,
8201
+ label
8202
+ });
8203
+ }
8204
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8205
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8206
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8207
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8208
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8209
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8210
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8211
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8212
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8213
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8214
+ if (entries.has(cocoClass)) continue;
8215
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8216
+ }
8217
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8218
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8219
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8220
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8221
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8222
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8223
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8224
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8225
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8226
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8227
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8228
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8229
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8230
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8231
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8232
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8233
+ sub("button", "control", "control", "#10b981", "button", "Button");
8234
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8235
+ for (const l of AUDIO_MACRO_LABELS) {
8236
+ const kind = `audio-${l.id}`;
8237
+ if (entries.has(kind)) continue;
8238
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8239
+ }
8240
+ /** The complete taxonomy dictionary, keyed by kind. */
8241
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8242
+ /**
7970
8243
  * Error types for the safe expression engine. Two distinct classes so callers
7971
8244
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7972
8245
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -18965,17 +19238,30 @@ var EventKindCategorySchema = _enum([
18965
19238
  "audio",
18966
19239
  "detection",
18967
19240
  "sensor",
19241
+ "control",
18968
19242
  "custom",
18969
19243
  "package"
18970
19244
  ]);
19245
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19246
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18971
19247
  var EventKindDescriptorSchema = object({
18972
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19248
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18973
19249
  kind: string(),
19250
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19251
+ labelKey: string(),
19252
+ /** English fallback label (kept for clients that don't translate). */
18974
19253
  label: string(),
18975
19254
  /** Hex color for timeline/legend rendering. */
18976
19255
  color: string(),
19256
+ /** Dictionary id → lucide component on the UI side. */
19257
+ iconId: string(),
19258
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18977
19259
  icon: EventKindIconSchema,
18978
19260
  category: EventKindCategorySchema,
19261
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19262
+ parentKind: string().nullable(),
19263
+ /** Derived from `parentKind`, explicit for the client tree. */
19264
+ level: EventKindLevelSchema,
18979
19265
  /** Which cap + device contributes this kind. For built-ins the camera
18980
19266
  * itself; for sensor kinds the LINKED source device. */
18981
19267
  source: object({
@@ -19048,11 +19334,21 @@ var TrackAudioLabelSchema = object({
19048
19334
  firstAt: number(),
19049
19335
  lastAt: number()
19050
19336
  });
19337
+ /**
19338
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19339
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19340
+ * linked sensor/control state change (no positions; carries a snapshot). The
19341
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19342
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19343
+ */
19344
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19051
19345
  var TrackSchema = object({
19052
19346
  trackId: string(),
19053
19347
  deviceId: number(),
19054
19348
  className: string(),
19055
19349
  label: string().optional(),
19350
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19351
+ source: TrackSourceSchema.optional(),
19056
19352
  firstSeen: number(),
19057
19353
  lastSeen: number(),
19058
19354
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19429,6 +19725,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19429
19725
  eventId: string(),
19430
19726
  timestamp: number()
19431
19727
  });
19728
+ /**
19729
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19730
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19731
+ * caps into per-camera event-kind descriptors.
19732
+ *
19733
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19734
+ * is NOT duplicated here — every entry is derived from the single
19735
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19736
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19737
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19738
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19739
+ * eventful cap is missing.
19740
+ */
19741
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19742
+ var LEGACY_ICON = {
19743
+ motion: "motion",
19744
+ audio: "audio",
19745
+ person: "person",
19746
+ vehicle: "vehicle",
19747
+ animal: "animal",
19748
+ package: "package",
19749
+ door: "door",
19750
+ pir: "pir",
19751
+ smoke: "smoke",
19752
+ water: "water",
19753
+ button: "button",
19754
+ generic: "generic",
19755
+ gas: "smoke",
19756
+ vibration: "generic",
19757
+ tamper: "generic",
19758
+ presence: "person",
19759
+ lock: "generic",
19760
+ siren: "generic",
19761
+ switch: "generic",
19762
+ doorbell: "button"
19763
+ };
19764
+ function legacyIcon(iconId) {
19765
+ return LEGACY_ICON[iconId] ?? "generic";
19766
+ }
19767
+ /**
19768
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19769
+ * The anti-drift guard cross-checks this against the eventful caps declared
19770
+ * in `packages/types/src/capabilities/*.cap.ts`.
19771
+ */
19772
+ var CAP_TO_KIND = {
19773
+ contact: "contact",
19774
+ motion: "motion-sensor",
19775
+ smoke: "smoke",
19776
+ flood: "flood",
19777
+ gas: "gas",
19778
+ "carbon-monoxide": "carbon-monoxide",
19779
+ vibration: "vibration",
19780
+ tamper: "tamper",
19781
+ presence: "presence",
19782
+ "enum-sensor": "enum-sensor",
19783
+ "event-emitter": "device-event",
19784
+ "lock-control": "lock",
19785
+ switch: "switch",
19786
+ button: "button",
19787
+ doorbell: "doorbell"
19788
+ };
19789
+ function buildDescriptor(capName, kind) {
19790
+ const t = EVENT_TAXONOMY[kind];
19791
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19792
+ return {
19793
+ ...t,
19794
+ icon: legacyIcon(t.iconId)
19795
+ };
19796
+ }
19797
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19432
19798
  var CameraPipelineConfigSchema = object({
19433
19799
  engine: PipelineEngineChoiceSchema.optional(),
19434
19800
  steps: array(PipelineStepInputSchema).readonly(),
package/dist/addon.mjs CHANGED
@@ -7677,6 +7677,160 @@ var EncodeProfileSchema = object({
7677
7677
  */
7678
7678
  outputArgs: array(string()).optional()
7679
7679
  });
7680
+ var COCO_TO_MACRO = {
7681
+ mapping: {
7682
+ person: "person",
7683
+ bicycle: "vehicle",
7684
+ car: "vehicle",
7685
+ motorcycle: "vehicle",
7686
+ airplane: "vehicle",
7687
+ bus: "vehicle",
7688
+ train: "vehicle",
7689
+ truck: "vehicle",
7690
+ boat: "vehicle",
7691
+ bird: "animal",
7692
+ cat: "animal",
7693
+ dog: "animal",
7694
+ horse: "animal",
7695
+ sheep: "animal",
7696
+ cow: "animal",
7697
+ elephant: "animal",
7698
+ bear: "animal",
7699
+ zebra: "animal",
7700
+ giraffe: "animal",
7701
+ suitcase: "package",
7702
+ backpack: "package",
7703
+ handbag: "package"
7704
+ },
7705
+ preserveOriginal: false
7706
+ };
7707
+ var AUDIO_MACRO_LABELS = [
7708
+ {
7709
+ id: "speech",
7710
+ name: "Speech",
7711
+ icon: "🗣️"
7712
+ },
7713
+ {
7714
+ id: "scream",
7715
+ name: "Scream / Shout",
7716
+ icon: "😱"
7717
+ },
7718
+ {
7719
+ id: "crying",
7720
+ name: "Crying / Baby",
7721
+ icon: "😢"
7722
+ },
7723
+ {
7724
+ id: "laughter",
7725
+ name: "Laughter",
7726
+ icon: "😂"
7727
+ },
7728
+ {
7729
+ id: "music",
7730
+ name: "Music",
7731
+ icon: "🎵"
7732
+ },
7733
+ {
7734
+ id: "dog",
7735
+ name: "Dog",
7736
+ icon: "🐕"
7737
+ },
7738
+ {
7739
+ id: "cat",
7740
+ name: "Cat",
7741
+ icon: "🐈"
7742
+ },
7743
+ {
7744
+ id: "bird",
7745
+ name: "Bird",
7746
+ icon: "🐦"
7747
+ },
7748
+ {
7749
+ id: "animal",
7750
+ name: "Animal (other)",
7751
+ icon: "🐾"
7752
+ },
7753
+ {
7754
+ id: "alarm",
7755
+ name: "Alarm / Siren",
7756
+ icon: "🚨"
7757
+ },
7758
+ {
7759
+ id: "doorbell",
7760
+ name: "Doorbell / Knock",
7761
+ icon: "🔔"
7762
+ },
7763
+ {
7764
+ id: "glass_breaking",
7765
+ name: "Glass Breaking",
7766
+ icon: "💥"
7767
+ },
7768
+ {
7769
+ id: "gunshot",
7770
+ name: "Gunshot / Explosion",
7771
+ icon: "💣"
7772
+ },
7773
+ {
7774
+ id: "vehicle",
7775
+ name: "Vehicle",
7776
+ icon: "🚗"
7777
+ },
7778
+ {
7779
+ id: "siren",
7780
+ name: "Emergency Siren",
7781
+ icon: "🚑"
7782
+ },
7783
+ {
7784
+ id: "fire",
7785
+ name: "Fire / Smoke",
7786
+ icon: "🔥"
7787
+ },
7788
+ {
7789
+ id: "water",
7790
+ name: "Water",
7791
+ icon: "💧"
7792
+ },
7793
+ {
7794
+ id: "wind",
7795
+ name: "Wind / Weather",
7796
+ icon: "🌬️"
7797
+ },
7798
+ {
7799
+ id: "door",
7800
+ name: "Door",
7801
+ icon: "🚪"
7802
+ },
7803
+ {
7804
+ id: "footsteps",
7805
+ name: "Footsteps",
7806
+ icon: "👣"
7807
+ },
7808
+ {
7809
+ id: "crowd",
7810
+ name: "Crowd / Chatter",
7811
+ icon: "👥"
7812
+ },
7813
+ {
7814
+ id: "telephone",
7815
+ name: "Telephone",
7816
+ icon: "📞"
7817
+ },
7818
+ {
7819
+ id: "engine",
7820
+ name: "Engine / Motor",
7821
+ icon: "⚙️"
7822
+ },
7823
+ {
7824
+ id: "tools",
7825
+ name: "Tools / Construction",
7826
+ icon: "🔨"
7827
+ },
7828
+ {
7829
+ id: "silence",
7830
+ name: "Silence",
7831
+ icon: "🤫"
7832
+ }
7833
+ ];
7680
7834
  var YAMNET_TO_MACRO = {
7681
7835
  mapping: {
7682
7836
  Speech: "speech",
@@ -7943,6 +8097,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7943
8097
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7944
8098
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7945
8099
  /**
8100
+ * Unified event-kind taxonomy — THE single source of truth for
8101
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8102
+ * icon }`.
8103
+ *
8104
+ * This dictionary folds together what used to be scattered across four
8105
+ * copies:
8106
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8107
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8108
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8109
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8110
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8111
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8112
+ *
8113
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8114
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8115
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8116
+ * color or an icon: they read this dictionary (server descriptors carry the
8117
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8118
+ *
8119
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8120
+ */
8121
+ var TAXONOMY_COLORS = {
8122
+ motion: "#f59e0b",
8123
+ audio: "#06b6d4",
8124
+ person: "#22c55e",
8125
+ vehicle: "#3b82f6",
8126
+ animal: "#f97316",
8127
+ package: "#a855f7",
8128
+ sensor: "#8b5cf6",
8129
+ control: "#10b981",
8130
+ genericDetection: "#64748b"
8131
+ };
8132
+ var DETECTION_SUB_COLORS = {
8133
+ car: "#f59e0b",
8134
+ truck: "#d97706",
8135
+ bus: "#b45309",
8136
+ motorcycle: "#eab308",
8137
+ bicycle: "#ca8a04",
8138
+ airplane: "#60a5fa",
8139
+ boat: "#2563eb",
8140
+ train: "#1d4ed8",
8141
+ bird: "#14b8a6",
8142
+ dog: "#84cc16",
8143
+ cat: "#f97316",
8144
+ horse: "#a16207",
8145
+ sheep: "#a3a3a3",
8146
+ cow: "#78716c",
8147
+ elephant: "#6b7280",
8148
+ bear: "#7c2d12",
8149
+ zebra: "#404040",
8150
+ giraffe: "#d4a373"
8151
+ };
8152
+ function titleCase(id) {
8153
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8154
+ }
8155
+ var entries = /* @__PURE__ */ new Map();
8156
+ function macro(kind, category, color, iconId, label) {
8157
+ entries.set(kind, {
8158
+ kind,
8159
+ parentKind: null,
8160
+ level: "macro",
8161
+ category,
8162
+ color,
8163
+ iconId,
8164
+ labelKey: `eventKind.${kind}`,
8165
+ label
8166
+ });
8167
+ }
8168
+ function sub(kind, parentKind, category, color, iconId, label) {
8169
+ entries.set(kind, {
8170
+ kind,
8171
+ parentKind,
8172
+ level: "sub",
8173
+ category,
8174
+ color,
8175
+ iconId,
8176
+ labelKey: `eventKind.${kind}`,
8177
+ label
8178
+ });
8179
+ }
8180
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8181
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8182
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8183
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8184
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8185
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8186
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8187
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8188
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8189
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8190
+ if (entries.has(cocoClass)) continue;
8191
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8192
+ }
8193
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8194
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8195
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8196
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8197
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8198
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8199
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8200
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8201
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8202
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8203
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8204
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8205
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8206
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8207
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8208
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8209
+ sub("button", "control", "control", "#10b981", "button", "Button");
8210
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8211
+ for (const l of AUDIO_MACRO_LABELS) {
8212
+ const kind = `audio-${l.id}`;
8213
+ if (entries.has(kind)) continue;
8214
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8215
+ }
8216
+ /** The complete taxonomy dictionary, keyed by kind. */
8217
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8218
+ /**
7946
8219
  * Error types for the safe expression engine. Two distinct classes so callers
7947
8220
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7948
8221
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -18941,17 +19214,30 @@ var EventKindCategorySchema = _enum([
18941
19214
  "audio",
18942
19215
  "detection",
18943
19216
  "sensor",
19217
+ "control",
18944
19218
  "custom",
18945
19219
  "package"
18946
19220
  ]);
19221
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19222
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18947
19223
  var EventKindDescriptorSchema = object({
18948
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19224
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18949
19225
  kind: string(),
19226
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19227
+ labelKey: string(),
19228
+ /** English fallback label (kept for clients that don't translate). */
18950
19229
  label: string(),
18951
19230
  /** Hex color for timeline/legend rendering. */
18952
19231
  color: string(),
19232
+ /** Dictionary id → lucide component on the UI side. */
19233
+ iconId: string(),
19234
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18953
19235
  icon: EventKindIconSchema,
18954
19236
  category: EventKindCategorySchema,
19237
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19238
+ parentKind: string().nullable(),
19239
+ /** Derived from `parentKind`, explicit for the client tree. */
19240
+ level: EventKindLevelSchema,
18955
19241
  /** Which cap + device contributes this kind. For built-ins the camera
18956
19242
  * itself; for sensor kinds the LINKED source device. */
18957
19243
  source: object({
@@ -19024,11 +19310,21 @@ var TrackAudioLabelSchema = object({
19024
19310
  firstAt: number(),
19025
19311
  lastAt: number()
19026
19312
  });
19313
+ /**
19314
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19315
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19316
+ * linked sensor/control state change (no positions; carries a snapshot). The
19317
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19318
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19319
+ */
19320
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19027
19321
  var TrackSchema = object({
19028
19322
  trackId: string(),
19029
19323
  deviceId: number(),
19030
19324
  className: string(),
19031
19325
  label: string().optional(),
19326
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19327
+ source: TrackSourceSchema.optional(),
19032
19328
  firstSeen: number(),
19033
19329
  lastSeen: number(),
19034
19330
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19405,6 +19701,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19405
19701
  eventId: string(),
19406
19702
  timestamp: number()
19407
19703
  });
19704
+ /**
19705
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19706
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19707
+ * caps into per-camera event-kind descriptors.
19708
+ *
19709
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19710
+ * is NOT duplicated here — every entry is derived from the single
19711
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19712
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19713
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19714
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19715
+ * eventful cap is missing.
19716
+ */
19717
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19718
+ var LEGACY_ICON = {
19719
+ motion: "motion",
19720
+ audio: "audio",
19721
+ person: "person",
19722
+ vehicle: "vehicle",
19723
+ animal: "animal",
19724
+ package: "package",
19725
+ door: "door",
19726
+ pir: "pir",
19727
+ smoke: "smoke",
19728
+ water: "water",
19729
+ button: "button",
19730
+ generic: "generic",
19731
+ gas: "smoke",
19732
+ vibration: "generic",
19733
+ tamper: "generic",
19734
+ presence: "person",
19735
+ lock: "generic",
19736
+ siren: "generic",
19737
+ switch: "generic",
19738
+ doorbell: "button"
19739
+ };
19740
+ function legacyIcon(iconId) {
19741
+ return LEGACY_ICON[iconId] ?? "generic";
19742
+ }
19743
+ /**
19744
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19745
+ * The anti-drift guard cross-checks this against the eventful caps declared
19746
+ * in `packages/types/src/capabilities/*.cap.ts`.
19747
+ */
19748
+ var CAP_TO_KIND = {
19749
+ contact: "contact",
19750
+ motion: "motion-sensor",
19751
+ smoke: "smoke",
19752
+ flood: "flood",
19753
+ gas: "gas",
19754
+ "carbon-monoxide": "carbon-monoxide",
19755
+ vibration: "vibration",
19756
+ tamper: "tamper",
19757
+ presence: "presence",
19758
+ "enum-sensor": "enum-sensor",
19759
+ "event-emitter": "device-event",
19760
+ "lock-control": "lock",
19761
+ switch: "switch",
19762
+ button: "button",
19763
+ doorbell: "doorbell"
19764
+ };
19765
+ function buildDescriptor(capName, kind) {
19766
+ const t = EVENT_TAXONOMY[kind];
19767
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19768
+ return {
19769
+ ...t,
19770
+ icon: legacyIcon(t.iconId)
19771
+ };
19772
+ }
19773
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19408
19774
  var CameraPipelineConfigSchema = object({
19409
19775
  engine: PipelineEngineChoiceSchema.optional(),
19410
19776
  steps: array(PipelineStepInputSchema).readonly(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-rtsp",
3
- "version": "1.1.27",
3
+ "version": "1.1.28",
4
4
  "description": "Generic RTSP camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",