@camstack/addon-provider-reolink 1.1.29 → 1.1.30

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
@@ -7857,6 +7857,160 @@ var EncodeProfileSchema = object({
7857
7857
  */
7858
7858
  outputArgs: array(string()).optional()
7859
7859
  });
7860
+ var COCO_TO_MACRO = {
7861
+ mapping: {
7862
+ person: "person",
7863
+ bicycle: "vehicle",
7864
+ car: "vehicle",
7865
+ motorcycle: "vehicle",
7866
+ airplane: "vehicle",
7867
+ bus: "vehicle",
7868
+ train: "vehicle",
7869
+ truck: "vehicle",
7870
+ boat: "vehicle",
7871
+ bird: "animal",
7872
+ cat: "animal",
7873
+ dog: "animal",
7874
+ horse: "animal",
7875
+ sheep: "animal",
7876
+ cow: "animal",
7877
+ elephant: "animal",
7878
+ bear: "animal",
7879
+ zebra: "animal",
7880
+ giraffe: "animal",
7881
+ suitcase: "package",
7882
+ backpack: "package",
7883
+ handbag: "package"
7884
+ },
7885
+ preserveOriginal: false
7886
+ };
7887
+ var AUDIO_MACRO_LABELS = [
7888
+ {
7889
+ id: "speech",
7890
+ name: "Speech",
7891
+ icon: "🗣️"
7892
+ },
7893
+ {
7894
+ id: "scream",
7895
+ name: "Scream / Shout",
7896
+ icon: "😱"
7897
+ },
7898
+ {
7899
+ id: "crying",
7900
+ name: "Crying / Baby",
7901
+ icon: "😢"
7902
+ },
7903
+ {
7904
+ id: "laughter",
7905
+ name: "Laughter",
7906
+ icon: "😂"
7907
+ },
7908
+ {
7909
+ id: "music",
7910
+ name: "Music",
7911
+ icon: "🎵"
7912
+ },
7913
+ {
7914
+ id: "dog",
7915
+ name: "Dog",
7916
+ icon: "🐕"
7917
+ },
7918
+ {
7919
+ id: "cat",
7920
+ name: "Cat",
7921
+ icon: "🐈"
7922
+ },
7923
+ {
7924
+ id: "bird",
7925
+ name: "Bird",
7926
+ icon: "🐦"
7927
+ },
7928
+ {
7929
+ id: "animal",
7930
+ name: "Animal (other)",
7931
+ icon: "🐾"
7932
+ },
7933
+ {
7934
+ id: "alarm",
7935
+ name: "Alarm / Siren",
7936
+ icon: "🚨"
7937
+ },
7938
+ {
7939
+ id: "doorbell",
7940
+ name: "Doorbell / Knock",
7941
+ icon: "🔔"
7942
+ },
7943
+ {
7944
+ id: "glass_breaking",
7945
+ name: "Glass Breaking",
7946
+ icon: "💥"
7947
+ },
7948
+ {
7949
+ id: "gunshot",
7950
+ name: "Gunshot / Explosion",
7951
+ icon: "💣"
7952
+ },
7953
+ {
7954
+ id: "vehicle",
7955
+ name: "Vehicle",
7956
+ icon: "🚗"
7957
+ },
7958
+ {
7959
+ id: "siren",
7960
+ name: "Emergency Siren",
7961
+ icon: "🚑"
7962
+ },
7963
+ {
7964
+ id: "fire",
7965
+ name: "Fire / Smoke",
7966
+ icon: "🔥"
7967
+ },
7968
+ {
7969
+ id: "water",
7970
+ name: "Water",
7971
+ icon: "💧"
7972
+ },
7973
+ {
7974
+ id: "wind",
7975
+ name: "Wind / Weather",
7976
+ icon: "🌬️"
7977
+ },
7978
+ {
7979
+ id: "door",
7980
+ name: "Door",
7981
+ icon: "🚪"
7982
+ },
7983
+ {
7984
+ id: "footsteps",
7985
+ name: "Footsteps",
7986
+ icon: "👣"
7987
+ },
7988
+ {
7989
+ id: "crowd",
7990
+ name: "Crowd / Chatter",
7991
+ icon: "👥"
7992
+ },
7993
+ {
7994
+ id: "telephone",
7995
+ name: "Telephone",
7996
+ icon: "📞"
7997
+ },
7998
+ {
7999
+ id: "engine",
8000
+ name: "Engine / Motor",
8001
+ icon: "⚙️"
8002
+ },
8003
+ {
8004
+ id: "tools",
8005
+ name: "Tools / Construction",
8006
+ icon: "🔨"
8007
+ },
8008
+ {
8009
+ id: "silence",
8010
+ name: "Silence",
8011
+ icon: "🤫"
8012
+ }
8013
+ ];
7860
8014
  var YAMNET_TO_MACRO = {
7861
8015
  mapping: {
7862
8016
  Speech: "speech",
@@ -8123,6 +8277,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
8123
8277
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8124
8278
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8125
8279
  /**
8280
+ * Unified event-kind taxonomy — THE single source of truth for
8281
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8282
+ * icon }`.
8283
+ *
8284
+ * This dictionary folds together what used to be scattered across four
8285
+ * copies:
8286
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8287
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8288
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8289
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8290
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8291
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8292
+ *
8293
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8294
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8295
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8296
+ * color or an icon: they read this dictionary (server descriptors carry the
8297
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8298
+ *
8299
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8300
+ */
8301
+ var TAXONOMY_COLORS = {
8302
+ motion: "#f59e0b",
8303
+ audio: "#06b6d4",
8304
+ person: "#22c55e",
8305
+ vehicle: "#3b82f6",
8306
+ animal: "#f97316",
8307
+ package: "#a855f7",
8308
+ sensor: "#8b5cf6",
8309
+ control: "#10b981",
8310
+ genericDetection: "#64748b"
8311
+ };
8312
+ var DETECTION_SUB_COLORS = {
8313
+ car: "#f59e0b",
8314
+ truck: "#d97706",
8315
+ bus: "#b45309",
8316
+ motorcycle: "#eab308",
8317
+ bicycle: "#ca8a04",
8318
+ airplane: "#60a5fa",
8319
+ boat: "#2563eb",
8320
+ train: "#1d4ed8",
8321
+ bird: "#14b8a6",
8322
+ dog: "#84cc16",
8323
+ cat: "#f97316",
8324
+ horse: "#a16207",
8325
+ sheep: "#a3a3a3",
8326
+ cow: "#78716c",
8327
+ elephant: "#6b7280",
8328
+ bear: "#7c2d12",
8329
+ zebra: "#404040",
8330
+ giraffe: "#d4a373"
8331
+ };
8332
+ function titleCase(id) {
8333
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8334
+ }
8335
+ var entries = /* @__PURE__ */ new Map();
8336
+ function macro(kind, category, color, iconId, label) {
8337
+ entries.set(kind, {
8338
+ kind,
8339
+ parentKind: null,
8340
+ level: "macro",
8341
+ category,
8342
+ color,
8343
+ iconId,
8344
+ labelKey: `eventKind.${kind}`,
8345
+ label
8346
+ });
8347
+ }
8348
+ function sub(kind, parentKind, category, color, iconId, label) {
8349
+ entries.set(kind, {
8350
+ kind,
8351
+ parentKind,
8352
+ level: "sub",
8353
+ category,
8354
+ color,
8355
+ iconId,
8356
+ labelKey: `eventKind.${kind}`,
8357
+ label
8358
+ });
8359
+ }
8360
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8361
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8362
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8363
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8364
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8365
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8366
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8367
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8368
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8369
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8370
+ if (entries.has(cocoClass)) continue;
8371
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8372
+ }
8373
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8374
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8375
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8376
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8377
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8378
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8379
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8380
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8381
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8382
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8383
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8384
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8385
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8386
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8387
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8388
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8389
+ sub("button", "control", "control", "#10b981", "button", "Button");
8390
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8391
+ for (const l of AUDIO_MACRO_LABELS) {
8392
+ const kind = `audio-${l.id}`;
8393
+ if (entries.has(kind)) continue;
8394
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8395
+ }
8396
+ /** The complete taxonomy dictionary, keyed by kind. */
8397
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8398
+ /**
8126
8399
  * Error types for the safe expression engine. Two distinct classes so callers
8127
8400
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
8128
8401
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -19106,17 +19379,30 @@ var EventKindCategorySchema = _enum([
19106
19379
  "audio",
19107
19380
  "detection",
19108
19381
  "sensor",
19382
+ "control",
19109
19383
  "custom",
19110
19384
  "package"
19111
19385
  ]);
19386
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19387
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
19112
19388
  var EventKindDescriptorSchema = object({
19113
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19389
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
19114
19390
  kind: string(),
19391
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19392
+ labelKey: string(),
19393
+ /** English fallback label (kept for clients that don't translate). */
19115
19394
  label: string(),
19116
19395
  /** Hex color for timeline/legend rendering. */
19117
19396
  color: string(),
19397
+ /** Dictionary id → lucide component on the UI side. */
19398
+ iconId: string(),
19399
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
19118
19400
  icon: EventKindIconSchema,
19119
19401
  category: EventKindCategorySchema,
19402
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19403
+ parentKind: string().nullable(),
19404
+ /** Derived from `parentKind`, explicit for the client tree. */
19405
+ level: EventKindLevelSchema,
19120
19406
  /** Which cap + device contributes this kind. For built-ins the camera
19121
19407
  * itself; for sensor kinds the LINKED source device. */
19122
19408
  source: object({
@@ -19189,11 +19475,21 @@ var TrackAudioLabelSchema = object({
19189
19475
  firstAt: number(),
19190
19476
  lastAt: number()
19191
19477
  });
19478
+ /**
19479
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19480
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19481
+ * linked sensor/control state change (no positions; carries a snapshot). The
19482
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19483
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19484
+ */
19485
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19192
19486
  var TrackSchema = object({
19193
19487
  trackId: string(),
19194
19488
  deviceId: number(),
19195
19489
  className: string(),
19196
19490
  label: string().optional(),
19491
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19492
+ source: TrackSourceSchema.optional(),
19197
19493
  firstSeen: number(),
19198
19494
  lastSeen: number(),
19199
19495
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19570,6 +19866,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19570
19866
  eventId: string(),
19571
19867
  timestamp: number()
19572
19868
  });
19869
+ /**
19870
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19871
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19872
+ * caps into per-camera event-kind descriptors.
19873
+ *
19874
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19875
+ * is NOT duplicated here — every entry is derived from the single
19876
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19877
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19878
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19879
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19880
+ * eventful cap is missing.
19881
+ */
19882
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19883
+ var LEGACY_ICON = {
19884
+ motion: "motion",
19885
+ audio: "audio",
19886
+ person: "person",
19887
+ vehicle: "vehicle",
19888
+ animal: "animal",
19889
+ package: "package",
19890
+ door: "door",
19891
+ pir: "pir",
19892
+ smoke: "smoke",
19893
+ water: "water",
19894
+ button: "button",
19895
+ generic: "generic",
19896
+ gas: "smoke",
19897
+ vibration: "generic",
19898
+ tamper: "generic",
19899
+ presence: "person",
19900
+ lock: "generic",
19901
+ siren: "generic",
19902
+ switch: "generic",
19903
+ doorbell: "button"
19904
+ };
19905
+ function legacyIcon(iconId) {
19906
+ return LEGACY_ICON[iconId] ?? "generic";
19907
+ }
19908
+ /**
19909
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19910
+ * The anti-drift guard cross-checks this against the eventful caps declared
19911
+ * in `packages/types/src/capabilities/*.cap.ts`.
19912
+ */
19913
+ var CAP_TO_KIND = {
19914
+ contact: "contact",
19915
+ motion: "motion-sensor",
19916
+ smoke: "smoke",
19917
+ flood: "flood",
19918
+ gas: "gas",
19919
+ "carbon-monoxide": "carbon-monoxide",
19920
+ vibration: "vibration",
19921
+ tamper: "tamper",
19922
+ presence: "presence",
19923
+ "enum-sensor": "enum-sensor",
19924
+ "event-emitter": "device-event",
19925
+ "lock-control": "lock",
19926
+ switch: "switch",
19927
+ button: "button",
19928
+ doorbell: "doorbell"
19929
+ };
19930
+ function buildDescriptor(capName, kind) {
19931
+ const t = EVENT_TAXONOMY[kind];
19932
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19933
+ return {
19934
+ ...t,
19935
+ icon: legacyIcon(t.iconId)
19936
+ };
19937
+ }
19938
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19573
19939
  var CameraPipelineConfigSchema = object({
19574
19940
  engine: PipelineEngineChoiceSchema.optional(),
19575
19941
  steps: array(PipelineStepInputSchema).readonly(),
package/dist/addon.mjs CHANGED
@@ -7852,6 +7852,160 @@ var EncodeProfileSchema = object({
7852
7852
  */
7853
7853
  outputArgs: array(string()).optional()
7854
7854
  });
7855
+ var COCO_TO_MACRO = {
7856
+ mapping: {
7857
+ person: "person",
7858
+ bicycle: "vehicle",
7859
+ car: "vehicle",
7860
+ motorcycle: "vehicle",
7861
+ airplane: "vehicle",
7862
+ bus: "vehicle",
7863
+ train: "vehicle",
7864
+ truck: "vehicle",
7865
+ boat: "vehicle",
7866
+ bird: "animal",
7867
+ cat: "animal",
7868
+ dog: "animal",
7869
+ horse: "animal",
7870
+ sheep: "animal",
7871
+ cow: "animal",
7872
+ elephant: "animal",
7873
+ bear: "animal",
7874
+ zebra: "animal",
7875
+ giraffe: "animal",
7876
+ suitcase: "package",
7877
+ backpack: "package",
7878
+ handbag: "package"
7879
+ },
7880
+ preserveOriginal: false
7881
+ };
7882
+ var AUDIO_MACRO_LABELS = [
7883
+ {
7884
+ id: "speech",
7885
+ name: "Speech",
7886
+ icon: "🗣️"
7887
+ },
7888
+ {
7889
+ id: "scream",
7890
+ name: "Scream / Shout",
7891
+ icon: "😱"
7892
+ },
7893
+ {
7894
+ id: "crying",
7895
+ name: "Crying / Baby",
7896
+ icon: "😢"
7897
+ },
7898
+ {
7899
+ id: "laughter",
7900
+ name: "Laughter",
7901
+ icon: "😂"
7902
+ },
7903
+ {
7904
+ id: "music",
7905
+ name: "Music",
7906
+ icon: "🎵"
7907
+ },
7908
+ {
7909
+ id: "dog",
7910
+ name: "Dog",
7911
+ icon: "🐕"
7912
+ },
7913
+ {
7914
+ id: "cat",
7915
+ name: "Cat",
7916
+ icon: "🐈"
7917
+ },
7918
+ {
7919
+ id: "bird",
7920
+ name: "Bird",
7921
+ icon: "🐦"
7922
+ },
7923
+ {
7924
+ id: "animal",
7925
+ name: "Animal (other)",
7926
+ icon: "🐾"
7927
+ },
7928
+ {
7929
+ id: "alarm",
7930
+ name: "Alarm / Siren",
7931
+ icon: "🚨"
7932
+ },
7933
+ {
7934
+ id: "doorbell",
7935
+ name: "Doorbell / Knock",
7936
+ icon: "🔔"
7937
+ },
7938
+ {
7939
+ id: "glass_breaking",
7940
+ name: "Glass Breaking",
7941
+ icon: "💥"
7942
+ },
7943
+ {
7944
+ id: "gunshot",
7945
+ name: "Gunshot / Explosion",
7946
+ icon: "💣"
7947
+ },
7948
+ {
7949
+ id: "vehicle",
7950
+ name: "Vehicle",
7951
+ icon: "🚗"
7952
+ },
7953
+ {
7954
+ id: "siren",
7955
+ name: "Emergency Siren",
7956
+ icon: "🚑"
7957
+ },
7958
+ {
7959
+ id: "fire",
7960
+ name: "Fire / Smoke",
7961
+ icon: "🔥"
7962
+ },
7963
+ {
7964
+ id: "water",
7965
+ name: "Water",
7966
+ icon: "💧"
7967
+ },
7968
+ {
7969
+ id: "wind",
7970
+ name: "Wind / Weather",
7971
+ icon: "🌬️"
7972
+ },
7973
+ {
7974
+ id: "door",
7975
+ name: "Door",
7976
+ icon: "🚪"
7977
+ },
7978
+ {
7979
+ id: "footsteps",
7980
+ name: "Footsteps",
7981
+ icon: "👣"
7982
+ },
7983
+ {
7984
+ id: "crowd",
7985
+ name: "Crowd / Chatter",
7986
+ icon: "👥"
7987
+ },
7988
+ {
7989
+ id: "telephone",
7990
+ name: "Telephone",
7991
+ icon: "📞"
7992
+ },
7993
+ {
7994
+ id: "engine",
7995
+ name: "Engine / Motor",
7996
+ icon: "⚙️"
7997
+ },
7998
+ {
7999
+ id: "tools",
8000
+ name: "Tools / Construction",
8001
+ icon: "🔨"
8002
+ },
8003
+ {
8004
+ id: "silence",
8005
+ name: "Silence",
8006
+ icon: "🤫"
8007
+ }
8008
+ ];
7855
8009
  var YAMNET_TO_MACRO = {
7856
8010
  mapping: {
7857
8011
  Speech: "speech",
@@ -8118,6 +8272,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
8118
8272
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8119
8273
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8120
8274
  /**
8275
+ * Unified event-kind taxonomy — THE single source of truth for
8276
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8277
+ * icon }`.
8278
+ *
8279
+ * This dictionary folds together what used to be scattered across four
8280
+ * copies:
8281
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8282
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8283
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8284
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8285
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8286
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8287
+ *
8288
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8289
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8290
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8291
+ * color or an icon: they read this dictionary (server descriptors carry the
8292
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8293
+ *
8294
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8295
+ */
8296
+ var TAXONOMY_COLORS = {
8297
+ motion: "#f59e0b",
8298
+ audio: "#06b6d4",
8299
+ person: "#22c55e",
8300
+ vehicle: "#3b82f6",
8301
+ animal: "#f97316",
8302
+ package: "#a855f7",
8303
+ sensor: "#8b5cf6",
8304
+ control: "#10b981",
8305
+ genericDetection: "#64748b"
8306
+ };
8307
+ var DETECTION_SUB_COLORS = {
8308
+ car: "#f59e0b",
8309
+ truck: "#d97706",
8310
+ bus: "#b45309",
8311
+ motorcycle: "#eab308",
8312
+ bicycle: "#ca8a04",
8313
+ airplane: "#60a5fa",
8314
+ boat: "#2563eb",
8315
+ train: "#1d4ed8",
8316
+ bird: "#14b8a6",
8317
+ dog: "#84cc16",
8318
+ cat: "#f97316",
8319
+ horse: "#a16207",
8320
+ sheep: "#a3a3a3",
8321
+ cow: "#78716c",
8322
+ elephant: "#6b7280",
8323
+ bear: "#7c2d12",
8324
+ zebra: "#404040",
8325
+ giraffe: "#d4a373"
8326
+ };
8327
+ function titleCase(id) {
8328
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8329
+ }
8330
+ var entries = /* @__PURE__ */ new Map();
8331
+ function macro(kind, category, color, iconId, label) {
8332
+ entries.set(kind, {
8333
+ kind,
8334
+ parentKind: null,
8335
+ level: "macro",
8336
+ category,
8337
+ color,
8338
+ iconId,
8339
+ labelKey: `eventKind.${kind}`,
8340
+ label
8341
+ });
8342
+ }
8343
+ function sub(kind, parentKind, category, color, iconId, label) {
8344
+ entries.set(kind, {
8345
+ kind,
8346
+ parentKind,
8347
+ level: "sub",
8348
+ category,
8349
+ color,
8350
+ iconId,
8351
+ labelKey: `eventKind.${kind}`,
8352
+ label
8353
+ });
8354
+ }
8355
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8356
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8357
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8358
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8359
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8360
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8361
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8362
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8363
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8364
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8365
+ if (entries.has(cocoClass)) continue;
8366
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8367
+ }
8368
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8369
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8370
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8371
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8372
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8373
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8374
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8375
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8376
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8377
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8378
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8379
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8380
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8381
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8382
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8383
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8384
+ sub("button", "control", "control", "#10b981", "button", "Button");
8385
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8386
+ for (const l of AUDIO_MACRO_LABELS) {
8387
+ const kind = `audio-${l.id}`;
8388
+ if (entries.has(kind)) continue;
8389
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8390
+ }
8391
+ /** The complete taxonomy dictionary, keyed by kind. */
8392
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8393
+ /**
8121
8394
  * Error types for the safe expression engine. Two distinct classes so callers
8122
8395
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
8123
8396
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -19101,17 +19374,30 @@ var EventKindCategorySchema = _enum([
19101
19374
  "audio",
19102
19375
  "detection",
19103
19376
  "sensor",
19377
+ "control",
19104
19378
  "custom",
19105
19379
  "package"
19106
19380
  ]);
19381
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19382
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
19107
19383
  var EventKindDescriptorSchema = object({
19108
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19384
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
19109
19385
  kind: string(),
19386
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19387
+ labelKey: string(),
19388
+ /** English fallback label (kept for clients that don't translate). */
19110
19389
  label: string(),
19111
19390
  /** Hex color for timeline/legend rendering. */
19112
19391
  color: string(),
19392
+ /** Dictionary id → lucide component on the UI side. */
19393
+ iconId: string(),
19394
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
19113
19395
  icon: EventKindIconSchema,
19114
19396
  category: EventKindCategorySchema,
19397
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19398
+ parentKind: string().nullable(),
19399
+ /** Derived from `parentKind`, explicit for the client tree. */
19400
+ level: EventKindLevelSchema,
19115
19401
  /** Which cap + device contributes this kind. For built-ins the camera
19116
19402
  * itself; for sensor kinds the LINKED source device. */
19117
19403
  source: object({
@@ -19184,11 +19470,21 @@ var TrackAudioLabelSchema = object({
19184
19470
  firstAt: number(),
19185
19471
  lastAt: number()
19186
19472
  });
19473
+ /**
19474
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19475
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19476
+ * linked sensor/control state change (no positions; carries a snapshot). The
19477
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19478
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19479
+ */
19480
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19187
19481
  var TrackSchema = object({
19188
19482
  trackId: string(),
19189
19483
  deviceId: number(),
19190
19484
  className: string(),
19191
19485
  label: string().optional(),
19486
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19487
+ source: TrackSourceSchema.optional(),
19192
19488
  firstSeen: number(),
19193
19489
  lastSeen: number(),
19194
19490
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19565,6 +19861,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19565
19861
  eventId: string(),
19566
19862
  timestamp: number()
19567
19863
  });
19864
+ /**
19865
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19866
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19867
+ * caps into per-camera event-kind descriptors.
19868
+ *
19869
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19870
+ * is NOT duplicated here — every entry is derived from the single
19871
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19872
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19873
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19874
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19875
+ * eventful cap is missing.
19876
+ */
19877
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19878
+ var LEGACY_ICON = {
19879
+ motion: "motion",
19880
+ audio: "audio",
19881
+ person: "person",
19882
+ vehicle: "vehicle",
19883
+ animal: "animal",
19884
+ package: "package",
19885
+ door: "door",
19886
+ pir: "pir",
19887
+ smoke: "smoke",
19888
+ water: "water",
19889
+ button: "button",
19890
+ generic: "generic",
19891
+ gas: "smoke",
19892
+ vibration: "generic",
19893
+ tamper: "generic",
19894
+ presence: "person",
19895
+ lock: "generic",
19896
+ siren: "generic",
19897
+ switch: "generic",
19898
+ doorbell: "button"
19899
+ };
19900
+ function legacyIcon(iconId) {
19901
+ return LEGACY_ICON[iconId] ?? "generic";
19902
+ }
19903
+ /**
19904
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19905
+ * The anti-drift guard cross-checks this against the eventful caps declared
19906
+ * in `packages/types/src/capabilities/*.cap.ts`.
19907
+ */
19908
+ var CAP_TO_KIND = {
19909
+ contact: "contact",
19910
+ motion: "motion-sensor",
19911
+ smoke: "smoke",
19912
+ flood: "flood",
19913
+ gas: "gas",
19914
+ "carbon-monoxide": "carbon-monoxide",
19915
+ vibration: "vibration",
19916
+ tamper: "tamper",
19917
+ presence: "presence",
19918
+ "enum-sensor": "enum-sensor",
19919
+ "event-emitter": "device-event",
19920
+ "lock-control": "lock",
19921
+ switch: "switch",
19922
+ button: "button",
19923
+ doorbell: "doorbell"
19924
+ };
19925
+ function buildDescriptor(capName, kind) {
19926
+ const t = EVENT_TAXONOMY[kind];
19927
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19928
+ return {
19929
+ ...t,
19930
+ icon: legacyIcon(t.iconId)
19931
+ };
19932
+ }
19933
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19568
19934
  var CameraPipelineConfigSchema = object({
19569
19935
  engine: PipelineEngineChoiceSchema.optional(),
19570
19936
  steps: array(PipelineStepInputSchema).readonly(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-reolink",
3
- "version": "1.1.29",
3
+ "version": "1.1.30",
4
4
  "description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
5
5
  "keywords": [
6
6
  "camstack",