@camstack/addon-provider-amcrest 0.1.14 → 0.1.15

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
@@ -7636,6 +7636,160 @@ var EncodeProfileSchema = object({
7636
7636
  */
7637
7637
  outputArgs: array(string()).optional()
7638
7638
  });
7639
+ var COCO_TO_MACRO = {
7640
+ mapping: {
7641
+ person: "person",
7642
+ bicycle: "vehicle",
7643
+ car: "vehicle",
7644
+ motorcycle: "vehicle",
7645
+ airplane: "vehicle",
7646
+ bus: "vehicle",
7647
+ train: "vehicle",
7648
+ truck: "vehicle",
7649
+ boat: "vehicle",
7650
+ bird: "animal",
7651
+ cat: "animal",
7652
+ dog: "animal",
7653
+ horse: "animal",
7654
+ sheep: "animal",
7655
+ cow: "animal",
7656
+ elephant: "animal",
7657
+ bear: "animal",
7658
+ zebra: "animal",
7659
+ giraffe: "animal",
7660
+ suitcase: "package",
7661
+ backpack: "package",
7662
+ handbag: "package"
7663
+ },
7664
+ preserveOriginal: false
7665
+ };
7666
+ var AUDIO_MACRO_LABELS = [
7667
+ {
7668
+ id: "speech",
7669
+ name: "Speech",
7670
+ icon: "🗣️"
7671
+ },
7672
+ {
7673
+ id: "scream",
7674
+ name: "Scream / Shout",
7675
+ icon: "😱"
7676
+ },
7677
+ {
7678
+ id: "crying",
7679
+ name: "Crying / Baby",
7680
+ icon: "😢"
7681
+ },
7682
+ {
7683
+ id: "laughter",
7684
+ name: "Laughter",
7685
+ icon: "😂"
7686
+ },
7687
+ {
7688
+ id: "music",
7689
+ name: "Music",
7690
+ icon: "🎵"
7691
+ },
7692
+ {
7693
+ id: "dog",
7694
+ name: "Dog",
7695
+ icon: "🐕"
7696
+ },
7697
+ {
7698
+ id: "cat",
7699
+ name: "Cat",
7700
+ icon: "🐈"
7701
+ },
7702
+ {
7703
+ id: "bird",
7704
+ name: "Bird",
7705
+ icon: "🐦"
7706
+ },
7707
+ {
7708
+ id: "animal",
7709
+ name: "Animal (other)",
7710
+ icon: "🐾"
7711
+ },
7712
+ {
7713
+ id: "alarm",
7714
+ name: "Alarm / Siren",
7715
+ icon: "🚨"
7716
+ },
7717
+ {
7718
+ id: "doorbell",
7719
+ name: "Doorbell / Knock",
7720
+ icon: "🔔"
7721
+ },
7722
+ {
7723
+ id: "glass_breaking",
7724
+ name: "Glass Breaking",
7725
+ icon: "💥"
7726
+ },
7727
+ {
7728
+ id: "gunshot",
7729
+ name: "Gunshot / Explosion",
7730
+ icon: "💣"
7731
+ },
7732
+ {
7733
+ id: "vehicle",
7734
+ name: "Vehicle",
7735
+ icon: "🚗"
7736
+ },
7737
+ {
7738
+ id: "siren",
7739
+ name: "Emergency Siren",
7740
+ icon: "🚑"
7741
+ },
7742
+ {
7743
+ id: "fire",
7744
+ name: "Fire / Smoke",
7745
+ icon: "🔥"
7746
+ },
7747
+ {
7748
+ id: "water",
7749
+ name: "Water",
7750
+ icon: "💧"
7751
+ },
7752
+ {
7753
+ id: "wind",
7754
+ name: "Wind / Weather",
7755
+ icon: "🌬️"
7756
+ },
7757
+ {
7758
+ id: "door",
7759
+ name: "Door",
7760
+ icon: "🚪"
7761
+ },
7762
+ {
7763
+ id: "footsteps",
7764
+ name: "Footsteps",
7765
+ icon: "👣"
7766
+ },
7767
+ {
7768
+ id: "crowd",
7769
+ name: "Crowd / Chatter",
7770
+ icon: "👥"
7771
+ },
7772
+ {
7773
+ id: "telephone",
7774
+ name: "Telephone",
7775
+ icon: "📞"
7776
+ },
7777
+ {
7778
+ id: "engine",
7779
+ name: "Engine / Motor",
7780
+ icon: "⚙️"
7781
+ },
7782
+ {
7783
+ id: "tools",
7784
+ name: "Tools / Construction",
7785
+ icon: "🔨"
7786
+ },
7787
+ {
7788
+ id: "silence",
7789
+ name: "Silence",
7790
+ icon: "🤫"
7791
+ }
7792
+ ];
7639
7793
  var YAMNET_TO_MACRO = {
7640
7794
  mapping: {
7641
7795
  Speech: "speech",
@@ -7902,6 +8056,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7902
8056
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7903
8057
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7904
8058
  /**
8059
+ * Unified event-kind taxonomy — THE single source of truth for
8060
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8061
+ * icon }`.
8062
+ *
8063
+ * This dictionary folds together what used to be scattered across four
8064
+ * copies:
8065
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8066
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8067
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8068
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8069
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8070
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8071
+ *
8072
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8073
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8074
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8075
+ * color or an icon: they read this dictionary (server descriptors carry the
8076
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8077
+ *
8078
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8079
+ */
8080
+ var TAXONOMY_COLORS = {
8081
+ motion: "#f59e0b",
8082
+ audio: "#06b6d4",
8083
+ person: "#22c55e",
8084
+ vehicle: "#3b82f6",
8085
+ animal: "#f97316",
8086
+ package: "#a855f7",
8087
+ sensor: "#8b5cf6",
8088
+ control: "#10b981",
8089
+ genericDetection: "#64748b"
8090
+ };
8091
+ var DETECTION_SUB_COLORS = {
8092
+ car: "#f59e0b",
8093
+ truck: "#d97706",
8094
+ bus: "#b45309",
8095
+ motorcycle: "#eab308",
8096
+ bicycle: "#ca8a04",
8097
+ airplane: "#60a5fa",
8098
+ boat: "#2563eb",
8099
+ train: "#1d4ed8",
8100
+ bird: "#14b8a6",
8101
+ dog: "#84cc16",
8102
+ cat: "#f97316",
8103
+ horse: "#a16207",
8104
+ sheep: "#a3a3a3",
8105
+ cow: "#78716c",
8106
+ elephant: "#6b7280",
8107
+ bear: "#7c2d12",
8108
+ zebra: "#404040",
8109
+ giraffe: "#d4a373"
8110
+ };
8111
+ function titleCase(id) {
8112
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8113
+ }
8114
+ var entries = /* @__PURE__ */ new Map();
8115
+ function macro(kind, category, color, iconId, label) {
8116
+ entries.set(kind, {
8117
+ kind,
8118
+ parentKind: null,
8119
+ level: "macro",
8120
+ category,
8121
+ color,
8122
+ iconId,
8123
+ labelKey: `eventKind.${kind}`,
8124
+ label
8125
+ });
8126
+ }
8127
+ function sub(kind, parentKind, category, color, iconId, label) {
8128
+ entries.set(kind, {
8129
+ kind,
8130
+ parentKind,
8131
+ level: "sub",
8132
+ category,
8133
+ color,
8134
+ iconId,
8135
+ labelKey: `eventKind.${kind}`,
8136
+ label
8137
+ });
8138
+ }
8139
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8140
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8141
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8142
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8143
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8144
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8145
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8146
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8147
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8148
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8149
+ if (entries.has(cocoClass)) continue;
8150
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8151
+ }
8152
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8153
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8154
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8155
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8156
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8157
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8158
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8159
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8160
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8161
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8162
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8163
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8164
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8165
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8166
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8167
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8168
+ sub("button", "control", "control", "#10b981", "button", "Button");
8169
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8170
+ for (const l of AUDIO_MACRO_LABELS) {
8171
+ const kind = `audio-${l.id}`;
8172
+ if (entries.has(kind)) continue;
8173
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8174
+ }
8175
+ /** The complete taxonomy dictionary, keyed by kind. */
8176
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8177
+ /**
7905
8178
  * Error types for the safe expression engine. Two distinct classes so callers
7906
8179
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7907
8180
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -18924,17 +19197,30 @@ var EventKindCategorySchema = _enum([
18924
19197
  "audio",
18925
19198
  "detection",
18926
19199
  "sensor",
19200
+ "control",
18927
19201
  "custom",
18928
19202
  "package"
18929
19203
  ]);
19204
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19205
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18930
19206
  var EventKindDescriptorSchema = object({
18931
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19207
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18932
19208
  kind: string(),
19209
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19210
+ labelKey: string(),
19211
+ /** English fallback label (kept for clients that don't translate). */
18933
19212
  label: string(),
18934
19213
  /** Hex color for timeline/legend rendering. */
18935
19214
  color: string(),
19215
+ /** Dictionary id → lucide component on the UI side. */
19216
+ iconId: string(),
19217
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18936
19218
  icon: EventKindIconSchema,
18937
19219
  category: EventKindCategorySchema,
19220
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19221
+ parentKind: string().nullable(),
19222
+ /** Derived from `parentKind`, explicit for the client tree. */
19223
+ level: EventKindLevelSchema,
18938
19224
  /** Which cap + device contributes this kind. For built-ins the camera
18939
19225
  * itself; for sensor kinds the LINKED source device. */
18940
19226
  source: object({
@@ -19007,11 +19293,21 @@ var TrackAudioLabelSchema = object({
19007
19293
  firstAt: number(),
19008
19294
  lastAt: number()
19009
19295
  });
19296
+ /**
19297
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19298
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19299
+ * linked sensor/control state change (no positions; carries a snapshot). The
19300
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19301
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19302
+ */
19303
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19010
19304
  var TrackSchema = object({
19011
19305
  trackId: string(),
19012
19306
  deviceId: number(),
19013
19307
  className: string(),
19014
19308
  label: string().optional(),
19309
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19310
+ source: TrackSourceSchema.optional(),
19015
19311
  firstSeen: number(),
19016
19312
  lastSeen: number(),
19017
19313
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19388,6 +19684,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19388
19684
  eventId: string(),
19389
19685
  timestamp: number()
19390
19686
  });
19687
+ /**
19688
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19689
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19690
+ * caps into per-camera event-kind descriptors.
19691
+ *
19692
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19693
+ * is NOT duplicated here — every entry is derived from the single
19694
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19695
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19696
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19697
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19698
+ * eventful cap is missing.
19699
+ */
19700
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19701
+ var LEGACY_ICON = {
19702
+ motion: "motion",
19703
+ audio: "audio",
19704
+ person: "person",
19705
+ vehicle: "vehicle",
19706
+ animal: "animal",
19707
+ package: "package",
19708
+ door: "door",
19709
+ pir: "pir",
19710
+ smoke: "smoke",
19711
+ water: "water",
19712
+ button: "button",
19713
+ generic: "generic",
19714
+ gas: "smoke",
19715
+ vibration: "generic",
19716
+ tamper: "generic",
19717
+ presence: "person",
19718
+ lock: "generic",
19719
+ siren: "generic",
19720
+ switch: "generic",
19721
+ doorbell: "button"
19722
+ };
19723
+ function legacyIcon(iconId) {
19724
+ return LEGACY_ICON[iconId] ?? "generic";
19725
+ }
19726
+ /**
19727
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19728
+ * The anti-drift guard cross-checks this against the eventful caps declared
19729
+ * in `packages/types/src/capabilities/*.cap.ts`.
19730
+ */
19731
+ var CAP_TO_KIND = {
19732
+ contact: "contact",
19733
+ motion: "motion-sensor",
19734
+ smoke: "smoke",
19735
+ flood: "flood",
19736
+ gas: "gas",
19737
+ "carbon-monoxide": "carbon-monoxide",
19738
+ vibration: "vibration",
19739
+ tamper: "tamper",
19740
+ presence: "presence",
19741
+ "enum-sensor": "enum-sensor",
19742
+ "event-emitter": "device-event",
19743
+ "lock-control": "lock",
19744
+ switch: "switch",
19745
+ button: "button",
19746
+ doorbell: "doorbell"
19747
+ };
19748
+ function buildDescriptor(capName, kind) {
19749
+ const t = EVENT_TAXONOMY[kind];
19750
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19751
+ return {
19752
+ ...t,
19753
+ icon: legacyIcon(t.iconId)
19754
+ };
19755
+ }
19756
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19391
19757
  var CameraPipelineConfigSchema = object({
19392
19758
  engine: PipelineEngineChoiceSchema.optional(),
19393
19759
  steps: array(PipelineStepInputSchema).readonly(),
package/dist/addon.mjs CHANGED
@@ -7637,6 +7637,160 @@ var EncodeProfileSchema = object({
7637
7637
  */
7638
7638
  outputArgs: array(string()).optional()
7639
7639
  });
7640
+ var COCO_TO_MACRO = {
7641
+ mapping: {
7642
+ person: "person",
7643
+ bicycle: "vehicle",
7644
+ car: "vehicle",
7645
+ motorcycle: "vehicle",
7646
+ airplane: "vehicle",
7647
+ bus: "vehicle",
7648
+ train: "vehicle",
7649
+ truck: "vehicle",
7650
+ boat: "vehicle",
7651
+ bird: "animal",
7652
+ cat: "animal",
7653
+ dog: "animal",
7654
+ horse: "animal",
7655
+ sheep: "animal",
7656
+ cow: "animal",
7657
+ elephant: "animal",
7658
+ bear: "animal",
7659
+ zebra: "animal",
7660
+ giraffe: "animal",
7661
+ suitcase: "package",
7662
+ backpack: "package",
7663
+ handbag: "package"
7664
+ },
7665
+ preserveOriginal: false
7666
+ };
7667
+ var AUDIO_MACRO_LABELS = [
7668
+ {
7669
+ id: "speech",
7670
+ name: "Speech",
7671
+ icon: "🗣️"
7672
+ },
7673
+ {
7674
+ id: "scream",
7675
+ name: "Scream / Shout",
7676
+ icon: "😱"
7677
+ },
7678
+ {
7679
+ id: "crying",
7680
+ name: "Crying / Baby",
7681
+ icon: "😢"
7682
+ },
7683
+ {
7684
+ id: "laughter",
7685
+ name: "Laughter",
7686
+ icon: "😂"
7687
+ },
7688
+ {
7689
+ id: "music",
7690
+ name: "Music",
7691
+ icon: "🎵"
7692
+ },
7693
+ {
7694
+ id: "dog",
7695
+ name: "Dog",
7696
+ icon: "🐕"
7697
+ },
7698
+ {
7699
+ id: "cat",
7700
+ name: "Cat",
7701
+ icon: "🐈"
7702
+ },
7703
+ {
7704
+ id: "bird",
7705
+ name: "Bird",
7706
+ icon: "🐦"
7707
+ },
7708
+ {
7709
+ id: "animal",
7710
+ name: "Animal (other)",
7711
+ icon: "🐾"
7712
+ },
7713
+ {
7714
+ id: "alarm",
7715
+ name: "Alarm / Siren",
7716
+ icon: "🚨"
7717
+ },
7718
+ {
7719
+ id: "doorbell",
7720
+ name: "Doorbell / Knock",
7721
+ icon: "🔔"
7722
+ },
7723
+ {
7724
+ id: "glass_breaking",
7725
+ name: "Glass Breaking",
7726
+ icon: "💥"
7727
+ },
7728
+ {
7729
+ id: "gunshot",
7730
+ name: "Gunshot / Explosion",
7731
+ icon: "💣"
7732
+ },
7733
+ {
7734
+ id: "vehicle",
7735
+ name: "Vehicle",
7736
+ icon: "🚗"
7737
+ },
7738
+ {
7739
+ id: "siren",
7740
+ name: "Emergency Siren",
7741
+ icon: "🚑"
7742
+ },
7743
+ {
7744
+ id: "fire",
7745
+ name: "Fire / Smoke",
7746
+ icon: "🔥"
7747
+ },
7748
+ {
7749
+ id: "water",
7750
+ name: "Water",
7751
+ icon: "💧"
7752
+ },
7753
+ {
7754
+ id: "wind",
7755
+ name: "Wind / Weather",
7756
+ icon: "🌬️"
7757
+ },
7758
+ {
7759
+ id: "door",
7760
+ name: "Door",
7761
+ icon: "🚪"
7762
+ },
7763
+ {
7764
+ id: "footsteps",
7765
+ name: "Footsteps",
7766
+ icon: "👣"
7767
+ },
7768
+ {
7769
+ id: "crowd",
7770
+ name: "Crowd / Chatter",
7771
+ icon: "👥"
7772
+ },
7773
+ {
7774
+ id: "telephone",
7775
+ name: "Telephone",
7776
+ icon: "📞"
7777
+ },
7778
+ {
7779
+ id: "engine",
7780
+ name: "Engine / Motor",
7781
+ icon: "⚙️"
7782
+ },
7783
+ {
7784
+ id: "tools",
7785
+ name: "Tools / Construction",
7786
+ icon: "🔨"
7787
+ },
7788
+ {
7789
+ id: "silence",
7790
+ name: "Silence",
7791
+ icon: "🤫"
7792
+ }
7793
+ ];
7640
7794
  var YAMNET_TO_MACRO = {
7641
7795
  mapping: {
7642
7796
  Speech: "speech",
@@ -7903,6 +8057,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7903
8057
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7904
8058
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7905
8059
  /**
8060
+ * Unified event-kind taxonomy — THE single source of truth for
8061
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8062
+ * icon }`.
8063
+ *
8064
+ * This dictionary folds together what used to be scattered across four
8065
+ * copies:
8066
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8067
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8068
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8069
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8070
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8071
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8072
+ *
8073
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8074
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8075
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8076
+ * color or an icon: they read this dictionary (server descriptors carry the
8077
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8078
+ *
8079
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8080
+ */
8081
+ var TAXONOMY_COLORS = {
8082
+ motion: "#f59e0b",
8083
+ audio: "#06b6d4",
8084
+ person: "#22c55e",
8085
+ vehicle: "#3b82f6",
8086
+ animal: "#f97316",
8087
+ package: "#a855f7",
8088
+ sensor: "#8b5cf6",
8089
+ control: "#10b981",
8090
+ genericDetection: "#64748b"
8091
+ };
8092
+ var DETECTION_SUB_COLORS = {
8093
+ car: "#f59e0b",
8094
+ truck: "#d97706",
8095
+ bus: "#b45309",
8096
+ motorcycle: "#eab308",
8097
+ bicycle: "#ca8a04",
8098
+ airplane: "#60a5fa",
8099
+ boat: "#2563eb",
8100
+ train: "#1d4ed8",
8101
+ bird: "#14b8a6",
8102
+ dog: "#84cc16",
8103
+ cat: "#f97316",
8104
+ horse: "#a16207",
8105
+ sheep: "#a3a3a3",
8106
+ cow: "#78716c",
8107
+ elephant: "#6b7280",
8108
+ bear: "#7c2d12",
8109
+ zebra: "#404040",
8110
+ giraffe: "#d4a373"
8111
+ };
8112
+ function titleCase(id) {
8113
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8114
+ }
8115
+ var entries = /* @__PURE__ */ new Map();
8116
+ function macro(kind, category, color, iconId, label) {
8117
+ entries.set(kind, {
8118
+ kind,
8119
+ parentKind: null,
8120
+ level: "macro",
8121
+ category,
8122
+ color,
8123
+ iconId,
8124
+ labelKey: `eventKind.${kind}`,
8125
+ label
8126
+ });
8127
+ }
8128
+ function sub(kind, parentKind, category, color, iconId, label) {
8129
+ entries.set(kind, {
8130
+ kind,
8131
+ parentKind,
8132
+ level: "sub",
8133
+ category,
8134
+ color,
8135
+ iconId,
8136
+ labelKey: `eventKind.${kind}`,
8137
+ label
8138
+ });
8139
+ }
8140
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8141
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8142
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8143
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8144
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8145
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8146
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8147
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8148
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8149
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8150
+ if (entries.has(cocoClass)) continue;
8151
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8152
+ }
8153
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8154
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8155
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8156
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8157
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8158
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8159
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8160
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8161
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8162
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8163
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8164
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8165
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8166
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8167
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8168
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8169
+ sub("button", "control", "control", "#10b981", "button", "Button");
8170
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8171
+ for (const l of AUDIO_MACRO_LABELS) {
8172
+ const kind = `audio-${l.id}`;
8173
+ if (entries.has(kind)) continue;
8174
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8175
+ }
8176
+ /** The complete taxonomy dictionary, keyed by kind. */
8177
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8178
+ /**
7906
8179
  * Error types for the safe expression engine. Two distinct classes so callers
7907
8180
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7908
8181
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -18925,17 +19198,30 @@ var EventKindCategorySchema = _enum([
18925
19198
  "audio",
18926
19199
  "detection",
18927
19200
  "sensor",
19201
+ "control",
18928
19202
  "custom",
18929
19203
  "package"
18930
19204
  ]);
19205
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19206
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18931
19207
  var EventKindDescriptorSchema = object({
18932
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19208
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18933
19209
  kind: string(),
19210
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19211
+ labelKey: string(),
19212
+ /** English fallback label (kept for clients that don't translate). */
18934
19213
  label: string(),
18935
19214
  /** Hex color for timeline/legend rendering. */
18936
19215
  color: string(),
19216
+ /** Dictionary id → lucide component on the UI side. */
19217
+ iconId: string(),
19218
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18937
19219
  icon: EventKindIconSchema,
18938
19220
  category: EventKindCategorySchema,
19221
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19222
+ parentKind: string().nullable(),
19223
+ /** Derived from `parentKind`, explicit for the client tree. */
19224
+ level: EventKindLevelSchema,
18939
19225
  /** Which cap + device contributes this kind. For built-ins the camera
18940
19226
  * itself; for sensor kinds the LINKED source device. */
18941
19227
  source: object({
@@ -19008,11 +19294,21 @@ var TrackAudioLabelSchema = object({
19008
19294
  firstAt: number(),
19009
19295
  lastAt: number()
19010
19296
  });
19297
+ /**
19298
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19299
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19300
+ * linked sensor/control state change (no positions; carries a snapshot). The
19301
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19302
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19303
+ */
19304
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19011
19305
  var TrackSchema = object({
19012
19306
  trackId: string(),
19013
19307
  deviceId: number(),
19014
19308
  className: string(),
19015
19309
  label: string().optional(),
19310
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19311
+ source: TrackSourceSchema.optional(),
19016
19312
  firstSeen: number(),
19017
19313
  lastSeen: number(),
19018
19314
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19389,6 +19685,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19389
19685
  eventId: string(),
19390
19686
  timestamp: number()
19391
19687
  });
19688
+ /**
19689
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19690
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19691
+ * caps into per-camera event-kind descriptors.
19692
+ *
19693
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19694
+ * is NOT duplicated here — every entry is derived from the single
19695
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19696
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19697
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19698
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19699
+ * eventful cap is missing.
19700
+ */
19701
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19702
+ var LEGACY_ICON = {
19703
+ motion: "motion",
19704
+ audio: "audio",
19705
+ person: "person",
19706
+ vehicle: "vehicle",
19707
+ animal: "animal",
19708
+ package: "package",
19709
+ door: "door",
19710
+ pir: "pir",
19711
+ smoke: "smoke",
19712
+ water: "water",
19713
+ button: "button",
19714
+ generic: "generic",
19715
+ gas: "smoke",
19716
+ vibration: "generic",
19717
+ tamper: "generic",
19718
+ presence: "person",
19719
+ lock: "generic",
19720
+ siren: "generic",
19721
+ switch: "generic",
19722
+ doorbell: "button"
19723
+ };
19724
+ function legacyIcon(iconId) {
19725
+ return LEGACY_ICON[iconId] ?? "generic";
19726
+ }
19727
+ /**
19728
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19729
+ * The anti-drift guard cross-checks this against the eventful caps declared
19730
+ * in `packages/types/src/capabilities/*.cap.ts`.
19731
+ */
19732
+ var CAP_TO_KIND = {
19733
+ contact: "contact",
19734
+ motion: "motion-sensor",
19735
+ smoke: "smoke",
19736
+ flood: "flood",
19737
+ gas: "gas",
19738
+ "carbon-monoxide": "carbon-monoxide",
19739
+ vibration: "vibration",
19740
+ tamper: "tamper",
19741
+ presence: "presence",
19742
+ "enum-sensor": "enum-sensor",
19743
+ "event-emitter": "device-event",
19744
+ "lock-control": "lock",
19745
+ switch: "switch",
19746
+ button: "button",
19747
+ doorbell: "doorbell"
19748
+ };
19749
+ function buildDescriptor(capName, kind) {
19750
+ const t = EVENT_TAXONOMY[kind];
19751
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19752
+ return {
19753
+ ...t,
19754
+ icon: legacyIcon(t.iconId)
19755
+ };
19756
+ }
19757
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19392
19758
  var CameraPipelineConfigSchema = object({
19393
19759
  engine: PipelineEngineChoiceSchema.optional(),
19394
19760
  steps: array(PipelineStepInputSchema).readonly(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-amcrest",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Amcrest/Dahua camera device provider addon for CamStack — Dahua CGI over HTTP(S) with digest auth (snapshot, RTSP catalog, PTZ, image/day-night config)",
5
5
  "keywords": [
6
6
  "camstack",