@camstack/addon-cloudflare 1.1.28 → 1.1.29

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.
@@ -7626,6 +7626,160 @@ var EncodeProfileSchema = object({
7626
7626
  */
7627
7627
  outputArgs: array(string()).optional()
7628
7628
  });
7629
+ var COCO_TO_MACRO = {
7630
+ mapping: {
7631
+ person: "person",
7632
+ bicycle: "vehicle",
7633
+ car: "vehicle",
7634
+ motorcycle: "vehicle",
7635
+ airplane: "vehicle",
7636
+ bus: "vehicle",
7637
+ train: "vehicle",
7638
+ truck: "vehicle",
7639
+ boat: "vehicle",
7640
+ bird: "animal",
7641
+ cat: "animal",
7642
+ dog: "animal",
7643
+ horse: "animal",
7644
+ sheep: "animal",
7645
+ cow: "animal",
7646
+ elephant: "animal",
7647
+ bear: "animal",
7648
+ zebra: "animal",
7649
+ giraffe: "animal",
7650
+ suitcase: "package",
7651
+ backpack: "package",
7652
+ handbag: "package"
7653
+ },
7654
+ preserveOriginal: false
7655
+ };
7656
+ var AUDIO_MACRO_LABELS = [
7657
+ {
7658
+ id: "speech",
7659
+ name: "Speech",
7660
+ icon: "🗣️"
7661
+ },
7662
+ {
7663
+ id: "scream",
7664
+ name: "Scream / Shout",
7665
+ icon: "😱"
7666
+ },
7667
+ {
7668
+ id: "crying",
7669
+ name: "Crying / Baby",
7670
+ icon: "😢"
7671
+ },
7672
+ {
7673
+ id: "laughter",
7674
+ name: "Laughter",
7675
+ icon: "😂"
7676
+ },
7677
+ {
7678
+ id: "music",
7679
+ name: "Music",
7680
+ icon: "🎵"
7681
+ },
7682
+ {
7683
+ id: "dog",
7684
+ name: "Dog",
7685
+ icon: "🐕"
7686
+ },
7687
+ {
7688
+ id: "cat",
7689
+ name: "Cat",
7690
+ icon: "🐈"
7691
+ },
7692
+ {
7693
+ id: "bird",
7694
+ name: "Bird",
7695
+ icon: "🐦"
7696
+ },
7697
+ {
7698
+ id: "animal",
7699
+ name: "Animal (other)",
7700
+ icon: "🐾"
7701
+ },
7702
+ {
7703
+ id: "alarm",
7704
+ name: "Alarm / Siren",
7705
+ icon: "🚨"
7706
+ },
7707
+ {
7708
+ id: "doorbell",
7709
+ name: "Doorbell / Knock",
7710
+ icon: "🔔"
7711
+ },
7712
+ {
7713
+ id: "glass_breaking",
7714
+ name: "Glass Breaking",
7715
+ icon: "💥"
7716
+ },
7717
+ {
7718
+ id: "gunshot",
7719
+ name: "Gunshot / Explosion",
7720
+ icon: "💣"
7721
+ },
7722
+ {
7723
+ id: "vehicle",
7724
+ name: "Vehicle",
7725
+ icon: "🚗"
7726
+ },
7727
+ {
7728
+ id: "siren",
7729
+ name: "Emergency Siren",
7730
+ icon: "🚑"
7731
+ },
7732
+ {
7733
+ id: "fire",
7734
+ name: "Fire / Smoke",
7735
+ icon: "🔥"
7736
+ },
7737
+ {
7738
+ id: "water",
7739
+ name: "Water",
7740
+ icon: "💧"
7741
+ },
7742
+ {
7743
+ id: "wind",
7744
+ name: "Wind / Weather",
7745
+ icon: "🌬️"
7746
+ },
7747
+ {
7748
+ id: "door",
7749
+ name: "Door",
7750
+ icon: "🚪"
7751
+ },
7752
+ {
7753
+ id: "footsteps",
7754
+ name: "Footsteps",
7755
+ icon: "👣"
7756
+ },
7757
+ {
7758
+ id: "crowd",
7759
+ name: "Crowd / Chatter",
7760
+ icon: "👥"
7761
+ },
7762
+ {
7763
+ id: "telephone",
7764
+ name: "Telephone",
7765
+ icon: "📞"
7766
+ },
7767
+ {
7768
+ id: "engine",
7769
+ name: "Engine / Motor",
7770
+ icon: "⚙️"
7771
+ },
7772
+ {
7773
+ id: "tools",
7774
+ name: "Tools / Construction",
7775
+ icon: "🔨"
7776
+ },
7777
+ {
7778
+ id: "silence",
7779
+ name: "Silence",
7780
+ icon: "🤫"
7781
+ }
7782
+ ];
7629
7783
  var YAMNET_TO_MACRO = {
7630
7784
  mapping: {
7631
7785
  Speech: "speech",
@@ -7892,6 +8046,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7892
8046
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7893
8047
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7894
8048
  /**
8049
+ * Unified event-kind taxonomy — THE single source of truth for
8050
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8051
+ * icon }`.
8052
+ *
8053
+ * This dictionary folds together what used to be scattered across four
8054
+ * copies:
8055
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8056
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8057
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8058
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8059
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8060
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8061
+ *
8062
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8063
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8064
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8065
+ * color or an icon: they read this dictionary (server descriptors carry the
8066
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8067
+ *
8068
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8069
+ */
8070
+ var TAXONOMY_COLORS = {
8071
+ motion: "#f59e0b",
8072
+ audio: "#06b6d4",
8073
+ person: "#22c55e",
8074
+ vehicle: "#3b82f6",
8075
+ animal: "#f97316",
8076
+ package: "#a855f7",
8077
+ sensor: "#8b5cf6",
8078
+ control: "#10b981",
8079
+ genericDetection: "#64748b"
8080
+ };
8081
+ var DETECTION_SUB_COLORS = {
8082
+ car: "#f59e0b",
8083
+ truck: "#d97706",
8084
+ bus: "#b45309",
8085
+ motorcycle: "#eab308",
8086
+ bicycle: "#ca8a04",
8087
+ airplane: "#60a5fa",
8088
+ boat: "#2563eb",
8089
+ train: "#1d4ed8",
8090
+ bird: "#14b8a6",
8091
+ dog: "#84cc16",
8092
+ cat: "#f97316",
8093
+ horse: "#a16207",
8094
+ sheep: "#a3a3a3",
8095
+ cow: "#78716c",
8096
+ elephant: "#6b7280",
8097
+ bear: "#7c2d12",
8098
+ zebra: "#404040",
8099
+ giraffe: "#d4a373"
8100
+ };
8101
+ function titleCase(id) {
8102
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8103
+ }
8104
+ var entries = /* @__PURE__ */ new Map();
8105
+ function macro(kind, category, color, iconId, label) {
8106
+ entries.set(kind, {
8107
+ kind,
8108
+ parentKind: null,
8109
+ level: "macro",
8110
+ category,
8111
+ color,
8112
+ iconId,
8113
+ labelKey: `eventKind.${kind}`,
8114
+ label
8115
+ });
8116
+ }
8117
+ function sub(kind, parentKind, category, color, iconId, label) {
8118
+ entries.set(kind, {
8119
+ kind,
8120
+ parentKind,
8121
+ level: "sub",
8122
+ category,
8123
+ color,
8124
+ iconId,
8125
+ labelKey: `eventKind.${kind}`,
8126
+ label
8127
+ });
8128
+ }
8129
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8130
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8131
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8132
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8133
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8134
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8135
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8136
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8137
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8138
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8139
+ if (entries.has(cocoClass)) continue;
8140
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8141
+ }
8142
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8143
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8144
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8145
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8146
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8147
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8148
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8149
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8150
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8151
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8152
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8153
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8154
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8155
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8156
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8157
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8158
+ sub("button", "control", "control", "#10b981", "button", "Button");
8159
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8160
+ for (const l of AUDIO_MACRO_LABELS) {
8161
+ const kind = `audio-${l.id}`;
8162
+ if (entries.has(kind)) continue;
8163
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8164
+ }
8165
+ /** The complete taxonomy dictionary, keyed by kind. */
8166
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8167
+ /**
7895
8168
  * Error types for the safe expression engine. Two distinct classes so callers
7896
8169
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7897
8170
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -15879,17 +16152,30 @@ var EventKindCategorySchema = _enum([
15879
16152
  "audio",
15880
16153
  "detection",
15881
16154
  "sensor",
16155
+ "control",
15882
16156
  "custom",
15883
16157
  "package"
15884
16158
  ]);
16159
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16160
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15885
16161
  var EventKindDescriptorSchema = object({
15886
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16162
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15887
16163
  kind: string(),
16164
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16165
+ labelKey: string(),
16166
+ /** English fallback label (kept for clients that don't translate). */
15888
16167
  label: string(),
15889
16168
  /** Hex color for timeline/legend rendering. */
15890
16169
  color: string(),
16170
+ /** Dictionary id → lucide component on the UI side. */
16171
+ iconId: string(),
16172
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15891
16173
  icon: EventKindIconSchema,
15892
16174
  category: EventKindCategorySchema,
16175
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16176
+ parentKind: string().nullable(),
16177
+ /** Derived from `parentKind`, explicit for the client tree. */
16178
+ level: EventKindLevelSchema,
15893
16179
  /** Which cap + device contributes this kind. For built-ins the camera
15894
16180
  * itself; for sensor kinds the LINKED source device. */
15895
16181
  source: object({
@@ -15962,11 +16248,21 @@ var TrackAudioLabelSchema = object({
15962
16248
  firstAt: number(),
15963
16249
  lastAt: number()
15964
16250
  });
16251
+ /**
16252
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16253
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16254
+ * linked sensor/control state change (no positions; carries a snapshot). The
16255
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16256
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16257
+ */
16258
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
15965
16259
  var TrackSchema = object({
15966
16260
  trackId: string(),
15967
16261
  deviceId: number(),
15968
16262
  className: string(),
15969
16263
  label: string().optional(),
16264
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16265
+ source: TrackSourceSchema.optional(),
15970
16266
  firstSeen: number(),
15971
16267
  lastSeen: number(),
15972
16268
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16343,6 +16639,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16343
16639
  eventId: string(),
16344
16640
  timestamp: number()
16345
16641
  });
16642
+ /**
16643
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16644
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16645
+ * caps into per-camera event-kind descriptors.
16646
+ *
16647
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16648
+ * is NOT duplicated here — every entry is derived from the single
16649
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16650
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16651
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16652
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16653
+ * eventful cap is missing.
16654
+ */
16655
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16656
+ var LEGACY_ICON = {
16657
+ motion: "motion",
16658
+ audio: "audio",
16659
+ person: "person",
16660
+ vehicle: "vehicle",
16661
+ animal: "animal",
16662
+ package: "package",
16663
+ door: "door",
16664
+ pir: "pir",
16665
+ smoke: "smoke",
16666
+ water: "water",
16667
+ button: "button",
16668
+ generic: "generic",
16669
+ gas: "smoke",
16670
+ vibration: "generic",
16671
+ tamper: "generic",
16672
+ presence: "person",
16673
+ lock: "generic",
16674
+ siren: "generic",
16675
+ switch: "generic",
16676
+ doorbell: "button"
16677
+ };
16678
+ function legacyIcon(iconId) {
16679
+ return LEGACY_ICON[iconId] ?? "generic";
16680
+ }
16681
+ /**
16682
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16683
+ * The anti-drift guard cross-checks this against the eventful caps declared
16684
+ * in `packages/types/src/capabilities/*.cap.ts`.
16685
+ */
16686
+ var CAP_TO_KIND = {
16687
+ contact: "contact",
16688
+ motion: "motion-sensor",
16689
+ smoke: "smoke",
16690
+ flood: "flood",
16691
+ gas: "gas",
16692
+ "carbon-monoxide": "carbon-monoxide",
16693
+ vibration: "vibration",
16694
+ tamper: "tamper",
16695
+ presence: "presence",
16696
+ "enum-sensor": "enum-sensor",
16697
+ "event-emitter": "device-event",
16698
+ "lock-control": "lock",
16699
+ switch: "switch",
16700
+ button: "button",
16701
+ doorbell: "doorbell"
16702
+ };
16703
+ function buildDescriptor(capName, kind) {
16704
+ const t = EVENT_TAXONOMY[kind];
16705
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16706
+ return {
16707
+ ...t,
16708
+ icon: legacyIcon(t.iconId)
16709
+ };
16710
+ }
16711
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16346
16712
  var CameraPipelineConfigSchema = object({
16347
16713
  engine: PipelineEngineChoiceSchema.optional(),
16348
16714
  steps: array(PipelineStepInputSchema).readonly(),
@@ -7626,6 +7626,160 @@ var EncodeProfileSchema = object({
7626
7626
  */
7627
7627
  outputArgs: array(string()).optional()
7628
7628
  });
7629
+ var COCO_TO_MACRO = {
7630
+ mapping: {
7631
+ person: "person",
7632
+ bicycle: "vehicle",
7633
+ car: "vehicle",
7634
+ motorcycle: "vehicle",
7635
+ airplane: "vehicle",
7636
+ bus: "vehicle",
7637
+ train: "vehicle",
7638
+ truck: "vehicle",
7639
+ boat: "vehicle",
7640
+ bird: "animal",
7641
+ cat: "animal",
7642
+ dog: "animal",
7643
+ horse: "animal",
7644
+ sheep: "animal",
7645
+ cow: "animal",
7646
+ elephant: "animal",
7647
+ bear: "animal",
7648
+ zebra: "animal",
7649
+ giraffe: "animal",
7650
+ suitcase: "package",
7651
+ backpack: "package",
7652
+ handbag: "package"
7653
+ },
7654
+ preserveOriginal: false
7655
+ };
7656
+ var AUDIO_MACRO_LABELS = [
7657
+ {
7658
+ id: "speech",
7659
+ name: "Speech",
7660
+ icon: "🗣️"
7661
+ },
7662
+ {
7663
+ id: "scream",
7664
+ name: "Scream / Shout",
7665
+ icon: "😱"
7666
+ },
7667
+ {
7668
+ id: "crying",
7669
+ name: "Crying / Baby",
7670
+ icon: "😢"
7671
+ },
7672
+ {
7673
+ id: "laughter",
7674
+ name: "Laughter",
7675
+ icon: "😂"
7676
+ },
7677
+ {
7678
+ id: "music",
7679
+ name: "Music",
7680
+ icon: "🎵"
7681
+ },
7682
+ {
7683
+ id: "dog",
7684
+ name: "Dog",
7685
+ icon: "🐕"
7686
+ },
7687
+ {
7688
+ id: "cat",
7689
+ name: "Cat",
7690
+ icon: "🐈"
7691
+ },
7692
+ {
7693
+ id: "bird",
7694
+ name: "Bird",
7695
+ icon: "🐦"
7696
+ },
7697
+ {
7698
+ id: "animal",
7699
+ name: "Animal (other)",
7700
+ icon: "🐾"
7701
+ },
7702
+ {
7703
+ id: "alarm",
7704
+ name: "Alarm / Siren",
7705
+ icon: "🚨"
7706
+ },
7707
+ {
7708
+ id: "doorbell",
7709
+ name: "Doorbell / Knock",
7710
+ icon: "🔔"
7711
+ },
7712
+ {
7713
+ id: "glass_breaking",
7714
+ name: "Glass Breaking",
7715
+ icon: "💥"
7716
+ },
7717
+ {
7718
+ id: "gunshot",
7719
+ name: "Gunshot / Explosion",
7720
+ icon: "💣"
7721
+ },
7722
+ {
7723
+ id: "vehicle",
7724
+ name: "Vehicle",
7725
+ icon: "🚗"
7726
+ },
7727
+ {
7728
+ id: "siren",
7729
+ name: "Emergency Siren",
7730
+ icon: "🚑"
7731
+ },
7732
+ {
7733
+ id: "fire",
7734
+ name: "Fire / Smoke",
7735
+ icon: "🔥"
7736
+ },
7737
+ {
7738
+ id: "water",
7739
+ name: "Water",
7740
+ icon: "💧"
7741
+ },
7742
+ {
7743
+ id: "wind",
7744
+ name: "Wind / Weather",
7745
+ icon: "🌬️"
7746
+ },
7747
+ {
7748
+ id: "door",
7749
+ name: "Door",
7750
+ icon: "🚪"
7751
+ },
7752
+ {
7753
+ id: "footsteps",
7754
+ name: "Footsteps",
7755
+ icon: "👣"
7756
+ },
7757
+ {
7758
+ id: "crowd",
7759
+ name: "Crowd / Chatter",
7760
+ icon: "👥"
7761
+ },
7762
+ {
7763
+ id: "telephone",
7764
+ name: "Telephone",
7765
+ icon: "📞"
7766
+ },
7767
+ {
7768
+ id: "engine",
7769
+ name: "Engine / Motor",
7770
+ icon: "⚙️"
7771
+ },
7772
+ {
7773
+ id: "tools",
7774
+ name: "Tools / Construction",
7775
+ icon: "🔨"
7776
+ },
7777
+ {
7778
+ id: "silence",
7779
+ name: "Silence",
7780
+ icon: "🤫"
7781
+ }
7782
+ ];
7629
7783
  var YAMNET_TO_MACRO = {
7630
7784
  mapping: {
7631
7785
  Speech: "speech",
@@ -7892,6 +8046,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7892
8046
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7893
8047
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7894
8048
  /**
8049
+ * Unified event-kind taxonomy — THE single source of truth for
8050
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8051
+ * icon }`.
8052
+ *
8053
+ * This dictionary folds together what used to be scattered across four
8054
+ * copies:
8055
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8056
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8057
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8058
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8059
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8060
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8061
+ *
8062
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8063
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8064
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8065
+ * color or an icon: they read this dictionary (server descriptors carry the
8066
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8067
+ *
8068
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8069
+ */
8070
+ var TAXONOMY_COLORS = {
8071
+ motion: "#f59e0b",
8072
+ audio: "#06b6d4",
8073
+ person: "#22c55e",
8074
+ vehicle: "#3b82f6",
8075
+ animal: "#f97316",
8076
+ package: "#a855f7",
8077
+ sensor: "#8b5cf6",
8078
+ control: "#10b981",
8079
+ genericDetection: "#64748b"
8080
+ };
8081
+ var DETECTION_SUB_COLORS = {
8082
+ car: "#f59e0b",
8083
+ truck: "#d97706",
8084
+ bus: "#b45309",
8085
+ motorcycle: "#eab308",
8086
+ bicycle: "#ca8a04",
8087
+ airplane: "#60a5fa",
8088
+ boat: "#2563eb",
8089
+ train: "#1d4ed8",
8090
+ bird: "#14b8a6",
8091
+ dog: "#84cc16",
8092
+ cat: "#f97316",
8093
+ horse: "#a16207",
8094
+ sheep: "#a3a3a3",
8095
+ cow: "#78716c",
8096
+ elephant: "#6b7280",
8097
+ bear: "#7c2d12",
8098
+ zebra: "#404040",
8099
+ giraffe: "#d4a373"
8100
+ };
8101
+ function titleCase(id) {
8102
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8103
+ }
8104
+ var entries = /* @__PURE__ */ new Map();
8105
+ function macro(kind, category, color, iconId, label) {
8106
+ entries.set(kind, {
8107
+ kind,
8108
+ parentKind: null,
8109
+ level: "macro",
8110
+ category,
8111
+ color,
8112
+ iconId,
8113
+ labelKey: `eventKind.${kind}`,
8114
+ label
8115
+ });
8116
+ }
8117
+ function sub(kind, parentKind, category, color, iconId, label) {
8118
+ entries.set(kind, {
8119
+ kind,
8120
+ parentKind,
8121
+ level: "sub",
8122
+ category,
8123
+ color,
8124
+ iconId,
8125
+ labelKey: `eventKind.${kind}`,
8126
+ label
8127
+ });
8128
+ }
8129
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8130
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8131
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8132
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8133
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8134
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8135
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8136
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8137
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8138
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8139
+ if (entries.has(cocoClass)) continue;
8140
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8141
+ }
8142
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8143
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8144
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8145
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8146
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8147
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8148
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8149
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8150
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8151
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8152
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8153
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8154
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8155
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8156
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8157
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8158
+ sub("button", "control", "control", "#10b981", "button", "Button");
8159
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8160
+ for (const l of AUDIO_MACRO_LABELS) {
8161
+ const kind = `audio-${l.id}`;
8162
+ if (entries.has(kind)) continue;
8163
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8164
+ }
8165
+ /** The complete taxonomy dictionary, keyed by kind. */
8166
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8167
+ /**
7895
8168
  * Error types for the safe expression engine. Two distinct classes so callers
7896
8169
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7897
8170
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -15879,17 +16152,30 @@ var EventKindCategorySchema = _enum([
15879
16152
  "audio",
15880
16153
  "detection",
15881
16154
  "sensor",
16155
+ "control",
15882
16156
  "custom",
15883
16157
  "package"
15884
16158
  ]);
16159
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16160
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15885
16161
  var EventKindDescriptorSchema = object({
15886
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16162
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15887
16163
  kind: string(),
16164
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16165
+ labelKey: string(),
16166
+ /** English fallback label (kept for clients that don't translate). */
15888
16167
  label: string(),
15889
16168
  /** Hex color for timeline/legend rendering. */
15890
16169
  color: string(),
16170
+ /** Dictionary id → lucide component on the UI side. */
16171
+ iconId: string(),
16172
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15891
16173
  icon: EventKindIconSchema,
15892
16174
  category: EventKindCategorySchema,
16175
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16176
+ parentKind: string().nullable(),
16177
+ /** Derived from `parentKind`, explicit for the client tree. */
16178
+ level: EventKindLevelSchema,
15893
16179
  /** Which cap + device contributes this kind. For built-ins the camera
15894
16180
  * itself; for sensor kinds the LINKED source device. */
15895
16181
  source: object({
@@ -15962,11 +16248,21 @@ var TrackAudioLabelSchema = object({
15962
16248
  firstAt: number(),
15963
16249
  lastAt: number()
15964
16250
  });
16251
+ /**
16252
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16253
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16254
+ * linked sensor/control state change (no positions; carries a snapshot). The
16255
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16256
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16257
+ */
16258
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
15965
16259
  var TrackSchema = object({
15966
16260
  trackId: string(),
15967
16261
  deviceId: number(),
15968
16262
  className: string(),
15969
16263
  label: string().optional(),
16264
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16265
+ source: TrackSourceSchema.optional(),
15970
16266
  firstSeen: number(),
15971
16267
  lastSeen: number(),
15972
16268
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16343,6 +16639,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16343
16639
  eventId: string(),
16344
16640
  timestamp: number()
16345
16641
  });
16642
+ /**
16643
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16644
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16645
+ * caps into per-camera event-kind descriptors.
16646
+ *
16647
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16648
+ * is NOT duplicated here — every entry is derived from the single
16649
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16650
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16651
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16652
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16653
+ * eventful cap is missing.
16654
+ */
16655
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16656
+ var LEGACY_ICON = {
16657
+ motion: "motion",
16658
+ audio: "audio",
16659
+ person: "person",
16660
+ vehicle: "vehicle",
16661
+ animal: "animal",
16662
+ package: "package",
16663
+ door: "door",
16664
+ pir: "pir",
16665
+ smoke: "smoke",
16666
+ water: "water",
16667
+ button: "button",
16668
+ generic: "generic",
16669
+ gas: "smoke",
16670
+ vibration: "generic",
16671
+ tamper: "generic",
16672
+ presence: "person",
16673
+ lock: "generic",
16674
+ siren: "generic",
16675
+ switch: "generic",
16676
+ doorbell: "button"
16677
+ };
16678
+ function legacyIcon(iconId) {
16679
+ return LEGACY_ICON[iconId] ?? "generic";
16680
+ }
16681
+ /**
16682
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16683
+ * The anti-drift guard cross-checks this against the eventful caps declared
16684
+ * in `packages/types/src/capabilities/*.cap.ts`.
16685
+ */
16686
+ var CAP_TO_KIND = {
16687
+ contact: "contact",
16688
+ motion: "motion-sensor",
16689
+ smoke: "smoke",
16690
+ flood: "flood",
16691
+ gas: "gas",
16692
+ "carbon-monoxide": "carbon-monoxide",
16693
+ vibration: "vibration",
16694
+ tamper: "tamper",
16695
+ presence: "presence",
16696
+ "enum-sensor": "enum-sensor",
16697
+ "event-emitter": "device-event",
16698
+ "lock-control": "lock",
16699
+ switch: "switch",
16700
+ button: "button",
16701
+ doorbell: "doorbell"
16702
+ };
16703
+ function buildDescriptor(capName, kind) {
16704
+ const t = EVENT_TAXONOMY[kind];
16705
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16706
+ return {
16707
+ ...t,
16708
+ icon: legacyIcon(t.iconId)
16709
+ };
16710
+ }
16711
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16346
16712
  var CameraPipelineConfigSchema = object({
16347
16713
  engine: PipelineEngineChoiceSchema.optional(),
16348
16714
  steps: array(PipelineStepInputSchema).readonly(),
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  enumerable: true
22
22
  }) : target, mod));
23
23
  //#endregion
24
- const require_dist = require("../dist-DMo00v-O.js");
24
+ const require_dist = require("../dist-uEQ179pR.js");
25
25
  let node_path = require("node:path");
26
26
  node_path = __toESM(node_path);
27
27
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { a as BaseAddon, c as boolean, d as number, f as object, m as EventCategory, n as defineCustomActions, o as _enum, p as string, r as networkAccessCapability, s as array, t as customAction, u as literal } from "../dist-Cp3DWi9N.mjs";
1
+ import { a as BaseAddon, c as boolean, d as number, f as object, m as EventCategory, n as defineCustomActions, o as _enum, p as string, r as networkAccessCapability, s as array, t as customAction, u as literal } from "../dist-CNbtRwT8.mjs";
2
2
  import * as path from "node:path";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { spawn } from "node:child_process";
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_dist = require("../dist-DMo00v-O.js");
2
+ const require_dist = require("../dist-uEQ179pR.js");
3
3
  //#region src/turn/cloudflare-turn.ts
4
4
  /**
5
5
  * Cloudflare returns ICE servers in several flavours depending on which
@@ -1,4 +1,4 @@
1
- import { a as BaseAddon, c as boolean, d as number, f as object, i as turnProviderCapability, l as discriminatedUnion, n as defineCustomActions, p as string, t as customAction, u as literal } from "../dist-Cp3DWi9N.mjs";
1
+ import { a as BaseAddon, c as boolean, d as number, f as object, i as turnProviderCapability, l as discriminatedUnion, n as defineCustomActions, p as string, t as customAction, u as literal } from "../dist-CNbtRwT8.mjs";
2
2
  //#region src/turn/cloudflare-turn.ts
3
3
  /**
4
4
  * Cloudflare returns ICE servers in several flavours depending on which
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-cloudflare",
3
- "version": "1.1.28",
3
+ "version": "1.1.29",
4
4
  "description": "Cloudflare bundle — Tunnel (network-access) + TURN relay (turn-provider). Multi-entry npm package shipping 2 addons under a single bundle.",
5
5
  "keywords": [
6
6
  "camstack",