@camstack/addon-import-alexa 0.1.24 → 0.1.25

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
@@ -7813,6 +7813,160 @@ var EncodeProfileSchema = object({
7813
7813
  */
7814
7814
  outputArgs: array(string()).optional()
7815
7815
  });
7816
+ var COCO_TO_MACRO = {
7817
+ mapping: {
7818
+ person: "person",
7819
+ bicycle: "vehicle",
7820
+ car: "vehicle",
7821
+ motorcycle: "vehicle",
7822
+ airplane: "vehicle",
7823
+ bus: "vehicle",
7824
+ train: "vehicle",
7825
+ truck: "vehicle",
7826
+ boat: "vehicle",
7827
+ bird: "animal",
7828
+ cat: "animal",
7829
+ dog: "animal",
7830
+ horse: "animal",
7831
+ sheep: "animal",
7832
+ cow: "animal",
7833
+ elephant: "animal",
7834
+ bear: "animal",
7835
+ zebra: "animal",
7836
+ giraffe: "animal",
7837
+ suitcase: "package",
7838
+ backpack: "package",
7839
+ handbag: "package"
7840
+ },
7841
+ preserveOriginal: false
7842
+ };
7843
+ var AUDIO_MACRO_LABELS = [
7844
+ {
7845
+ id: "speech",
7846
+ name: "Speech",
7847
+ icon: "🗣️"
7848
+ },
7849
+ {
7850
+ id: "scream",
7851
+ name: "Scream / Shout",
7852
+ icon: "😱"
7853
+ },
7854
+ {
7855
+ id: "crying",
7856
+ name: "Crying / Baby",
7857
+ icon: "😢"
7858
+ },
7859
+ {
7860
+ id: "laughter",
7861
+ name: "Laughter",
7862
+ icon: "😂"
7863
+ },
7864
+ {
7865
+ id: "music",
7866
+ name: "Music",
7867
+ icon: "🎵"
7868
+ },
7869
+ {
7870
+ id: "dog",
7871
+ name: "Dog",
7872
+ icon: "🐕"
7873
+ },
7874
+ {
7875
+ id: "cat",
7876
+ name: "Cat",
7877
+ icon: "🐈"
7878
+ },
7879
+ {
7880
+ id: "bird",
7881
+ name: "Bird",
7882
+ icon: "🐦"
7883
+ },
7884
+ {
7885
+ id: "animal",
7886
+ name: "Animal (other)",
7887
+ icon: "🐾"
7888
+ },
7889
+ {
7890
+ id: "alarm",
7891
+ name: "Alarm / Siren",
7892
+ icon: "🚨"
7893
+ },
7894
+ {
7895
+ id: "doorbell",
7896
+ name: "Doorbell / Knock",
7897
+ icon: "🔔"
7898
+ },
7899
+ {
7900
+ id: "glass_breaking",
7901
+ name: "Glass Breaking",
7902
+ icon: "💥"
7903
+ },
7904
+ {
7905
+ id: "gunshot",
7906
+ name: "Gunshot / Explosion",
7907
+ icon: "💣"
7908
+ },
7909
+ {
7910
+ id: "vehicle",
7911
+ name: "Vehicle",
7912
+ icon: "🚗"
7913
+ },
7914
+ {
7915
+ id: "siren",
7916
+ name: "Emergency Siren",
7917
+ icon: "🚑"
7918
+ },
7919
+ {
7920
+ id: "fire",
7921
+ name: "Fire / Smoke",
7922
+ icon: "🔥"
7923
+ },
7924
+ {
7925
+ id: "water",
7926
+ name: "Water",
7927
+ icon: "💧"
7928
+ },
7929
+ {
7930
+ id: "wind",
7931
+ name: "Wind / Weather",
7932
+ icon: "🌬️"
7933
+ },
7934
+ {
7935
+ id: "door",
7936
+ name: "Door",
7937
+ icon: "🚪"
7938
+ },
7939
+ {
7940
+ id: "footsteps",
7941
+ name: "Footsteps",
7942
+ icon: "👣"
7943
+ },
7944
+ {
7945
+ id: "crowd",
7946
+ name: "Crowd / Chatter",
7947
+ icon: "👥"
7948
+ },
7949
+ {
7950
+ id: "telephone",
7951
+ name: "Telephone",
7952
+ icon: "📞"
7953
+ },
7954
+ {
7955
+ id: "engine",
7956
+ name: "Engine / Motor",
7957
+ icon: "⚙️"
7958
+ },
7959
+ {
7960
+ id: "tools",
7961
+ name: "Tools / Construction",
7962
+ icon: "🔨"
7963
+ },
7964
+ {
7965
+ id: "silence",
7966
+ name: "Silence",
7967
+ icon: "🤫"
7968
+ }
7969
+ ];
7816
7970
  var YAMNET_TO_MACRO = {
7817
7971
  mapping: {
7818
7972
  Speech: "speech",
@@ -8079,6 +8233,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
8079
8233
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8080
8234
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8081
8235
  /**
8236
+ * Unified event-kind taxonomy — THE single source of truth for
8237
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8238
+ * icon }`.
8239
+ *
8240
+ * This dictionary folds together what used to be scattered across four
8241
+ * copies:
8242
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8243
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8244
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8245
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8246
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8247
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8248
+ *
8249
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8250
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8251
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8252
+ * color or an icon: they read this dictionary (server descriptors carry the
8253
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8254
+ *
8255
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8256
+ */
8257
+ var TAXONOMY_COLORS = {
8258
+ motion: "#f59e0b",
8259
+ audio: "#06b6d4",
8260
+ person: "#22c55e",
8261
+ vehicle: "#3b82f6",
8262
+ animal: "#f97316",
8263
+ package: "#a855f7",
8264
+ sensor: "#8b5cf6",
8265
+ control: "#10b981",
8266
+ genericDetection: "#64748b"
8267
+ };
8268
+ var DETECTION_SUB_COLORS = {
8269
+ car: "#f59e0b",
8270
+ truck: "#d97706",
8271
+ bus: "#b45309",
8272
+ motorcycle: "#eab308",
8273
+ bicycle: "#ca8a04",
8274
+ airplane: "#60a5fa",
8275
+ boat: "#2563eb",
8276
+ train: "#1d4ed8",
8277
+ bird: "#14b8a6",
8278
+ dog: "#84cc16",
8279
+ cat: "#f97316",
8280
+ horse: "#a16207",
8281
+ sheep: "#a3a3a3",
8282
+ cow: "#78716c",
8283
+ elephant: "#6b7280",
8284
+ bear: "#7c2d12",
8285
+ zebra: "#404040",
8286
+ giraffe: "#d4a373"
8287
+ };
8288
+ function titleCase(id) {
8289
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8290
+ }
8291
+ var entries = /* @__PURE__ */ new Map();
8292
+ function macro(kind, category, color, iconId, label) {
8293
+ entries.set(kind, {
8294
+ kind,
8295
+ parentKind: null,
8296
+ level: "macro",
8297
+ category,
8298
+ color,
8299
+ iconId,
8300
+ labelKey: `eventKind.${kind}`,
8301
+ label
8302
+ });
8303
+ }
8304
+ function sub(kind, parentKind, category, color, iconId, label) {
8305
+ entries.set(kind, {
8306
+ kind,
8307
+ parentKind,
8308
+ level: "sub",
8309
+ category,
8310
+ color,
8311
+ iconId,
8312
+ labelKey: `eventKind.${kind}`,
8313
+ label
8314
+ });
8315
+ }
8316
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8317
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8318
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8319
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8320
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8321
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8322
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8323
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8324
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8325
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8326
+ if (entries.has(cocoClass)) continue;
8327
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8328
+ }
8329
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8330
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8331
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8332
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8333
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8334
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8335
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8336
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8337
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8338
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8339
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8340
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8341
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8342
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8343
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8344
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8345
+ sub("button", "control", "control", "#10b981", "button", "Button");
8346
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8347
+ for (const l of AUDIO_MACRO_LABELS) {
8348
+ const kind = `audio-${l.id}`;
8349
+ if (entries.has(kind)) continue;
8350
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8351
+ }
8352
+ /** The complete taxonomy dictionary, keyed by kind. */
8353
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8354
+ /**
8082
8355
  * Error types for the safe expression engine. Two distinct classes so callers
8083
8356
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
8084
8357
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -19096,17 +19369,30 @@ var EventKindCategorySchema = _enum([
19096
19369
  "audio",
19097
19370
  "detection",
19098
19371
  "sensor",
19372
+ "control",
19099
19373
  "custom",
19100
19374
  "package"
19101
19375
  ]);
19376
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19377
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
19102
19378
  var EventKindDescriptorSchema = object({
19103
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19379
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
19104
19380
  kind: string(),
19381
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19382
+ labelKey: string(),
19383
+ /** English fallback label (kept for clients that don't translate). */
19105
19384
  label: string(),
19106
19385
  /** Hex color for timeline/legend rendering. */
19107
19386
  color: string(),
19387
+ /** Dictionary id → lucide component on the UI side. */
19388
+ iconId: string(),
19389
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
19108
19390
  icon: EventKindIconSchema,
19109
19391
  category: EventKindCategorySchema,
19392
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19393
+ parentKind: string().nullable(),
19394
+ /** Derived from `parentKind`, explicit for the client tree. */
19395
+ level: EventKindLevelSchema,
19110
19396
  /** Which cap + device contributes this kind. For built-ins the camera
19111
19397
  * itself; for sensor kinds the LINKED source device. */
19112
19398
  source: object({
@@ -19179,11 +19465,21 @@ var TrackAudioLabelSchema = object({
19179
19465
  firstAt: number(),
19180
19466
  lastAt: number()
19181
19467
  });
19468
+ /**
19469
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19470
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19471
+ * linked sensor/control state change (no positions; carries a snapshot). The
19472
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19473
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19474
+ */
19475
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19182
19476
  var TrackSchema = object({
19183
19477
  trackId: string(),
19184
19478
  deviceId: number(),
19185
19479
  className: string(),
19186
19480
  label: string().optional(),
19481
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19482
+ source: TrackSourceSchema.optional(),
19187
19483
  firstSeen: number(),
19188
19484
  lastSeen: number(),
19189
19485
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19560,6 +19856,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19560
19856
  eventId: string(),
19561
19857
  timestamp: number()
19562
19858
  });
19859
+ /**
19860
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19861
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19862
+ * caps into per-camera event-kind descriptors.
19863
+ *
19864
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19865
+ * is NOT duplicated here — every entry is derived from the single
19866
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19867
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19868
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19869
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19870
+ * eventful cap is missing.
19871
+ */
19872
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19873
+ var LEGACY_ICON = {
19874
+ motion: "motion",
19875
+ audio: "audio",
19876
+ person: "person",
19877
+ vehicle: "vehicle",
19878
+ animal: "animal",
19879
+ package: "package",
19880
+ door: "door",
19881
+ pir: "pir",
19882
+ smoke: "smoke",
19883
+ water: "water",
19884
+ button: "button",
19885
+ generic: "generic",
19886
+ gas: "smoke",
19887
+ vibration: "generic",
19888
+ tamper: "generic",
19889
+ presence: "person",
19890
+ lock: "generic",
19891
+ siren: "generic",
19892
+ switch: "generic",
19893
+ doorbell: "button"
19894
+ };
19895
+ function legacyIcon(iconId) {
19896
+ return LEGACY_ICON[iconId] ?? "generic";
19897
+ }
19898
+ /**
19899
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19900
+ * The anti-drift guard cross-checks this against the eventful caps declared
19901
+ * in `packages/types/src/capabilities/*.cap.ts`.
19902
+ */
19903
+ var CAP_TO_KIND = {
19904
+ contact: "contact",
19905
+ motion: "motion-sensor",
19906
+ smoke: "smoke",
19907
+ flood: "flood",
19908
+ gas: "gas",
19909
+ "carbon-monoxide": "carbon-monoxide",
19910
+ vibration: "vibration",
19911
+ tamper: "tamper",
19912
+ presence: "presence",
19913
+ "enum-sensor": "enum-sensor",
19914
+ "event-emitter": "device-event",
19915
+ "lock-control": "lock",
19916
+ switch: "switch",
19917
+ button: "button",
19918
+ doorbell: "doorbell"
19919
+ };
19920
+ function buildDescriptor(capName, kind) {
19921
+ const t = EVENT_TAXONOMY[kind];
19922
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19923
+ return {
19924
+ ...t,
19925
+ icon: legacyIcon(t.iconId)
19926
+ };
19927
+ }
19928
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19563
19929
  var CameraPipelineConfigSchema = object({
19564
19930
  engine: PipelineEngineChoiceSchema.optional(),
19565
19931
  steps: array(PipelineStepInputSchema).readonly(),
package/dist/addon.mjs CHANGED
@@ -7813,6 +7813,160 @@ var EncodeProfileSchema = object({
7813
7813
  */
7814
7814
  outputArgs: array(string()).optional()
7815
7815
  });
7816
+ var COCO_TO_MACRO = {
7817
+ mapping: {
7818
+ person: "person",
7819
+ bicycle: "vehicle",
7820
+ car: "vehicle",
7821
+ motorcycle: "vehicle",
7822
+ airplane: "vehicle",
7823
+ bus: "vehicle",
7824
+ train: "vehicle",
7825
+ truck: "vehicle",
7826
+ boat: "vehicle",
7827
+ bird: "animal",
7828
+ cat: "animal",
7829
+ dog: "animal",
7830
+ horse: "animal",
7831
+ sheep: "animal",
7832
+ cow: "animal",
7833
+ elephant: "animal",
7834
+ bear: "animal",
7835
+ zebra: "animal",
7836
+ giraffe: "animal",
7837
+ suitcase: "package",
7838
+ backpack: "package",
7839
+ handbag: "package"
7840
+ },
7841
+ preserveOriginal: false
7842
+ };
7843
+ var AUDIO_MACRO_LABELS = [
7844
+ {
7845
+ id: "speech",
7846
+ name: "Speech",
7847
+ icon: "🗣️"
7848
+ },
7849
+ {
7850
+ id: "scream",
7851
+ name: "Scream / Shout",
7852
+ icon: "😱"
7853
+ },
7854
+ {
7855
+ id: "crying",
7856
+ name: "Crying / Baby",
7857
+ icon: "😢"
7858
+ },
7859
+ {
7860
+ id: "laughter",
7861
+ name: "Laughter",
7862
+ icon: "😂"
7863
+ },
7864
+ {
7865
+ id: "music",
7866
+ name: "Music",
7867
+ icon: "🎵"
7868
+ },
7869
+ {
7870
+ id: "dog",
7871
+ name: "Dog",
7872
+ icon: "🐕"
7873
+ },
7874
+ {
7875
+ id: "cat",
7876
+ name: "Cat",
7877
+ icon: "🐈"
7878
+ },
7879
+ {
7880
+ id: "bird",
7881
+ name: "Bird",
7882
+ icon: "🐦"
7883
+ },
7884
+ {
7885
+ id: "animal",
7886
+ name: "Animal (other)",
7887
+ icon: "🐾"
7888
+ },
7889
+ {
7890
+ id: "alarm",
7891
+ name: "Alarm / Siren",
7892
+ icon: "🚨"
7893
+ },
7894
+ {
7895
+ id: "doorbell",
7896
+ name: "Doorbell / Knock",
7897
+ icon: "🔔"
7898
+ },
7899
+ {
7900
+ id: "glass_breaking",
7901
+ name: "Glass Breaking",
7902
+ icon: "💥"
7903
+ },
7904
+ {
7905
+ id: "gunshot",
7906
+ name: "Gunshot / Explosion",
7907
+ icon: "💣"
7908
+ },
7909
+ {
7910
+ id: "vehicle",
7911
+ name: "Vehicle",
7912
+ icon: "🚗"
7913
+ },
7914
+ {
7915
+ id: "siren",
7916
+ name: "Emergency Siren",
7917
+ icon: "🚑"
7918
+ },
7919
+ {
7920
+ id: "fire",
7921
+ name: "Fire / Smoke",
7922
+ icon: "🔥"
7923
+ },
7924
+ {
7925
+ id: "water",
7926
+ name: "Water",
7927
+ icon: "💧"
7928
+ },
7929
+ {
7930
+ id: "wind",
7931
+ name: "Wind / Weather",
7932
+ icon: "🌬️"
7933
+ },
7934
+ {
7935
+ id: "door",
7936
+ name: "Door",
7937
+ icon: "🚪"
7938
+ },
7939
+ {
7940
+ id: "footsteps",
7941
+ name: "Footsteps",
7942
+ icon: "👣"
7943
+ },
7944
+ {
7945
+ id: "crowd",
7946
+ name: "Crowd / Chatter",
7947
+ icon: "👥"
7948
+ },
7949
+ {
7950
+ id: "telephone",
7951
+ name: "Telephone",
7952
+ icon: "📞"
7953
+ },
7954
+ {
7955
+ id: "engine",
7956
+ name: "Engine / Motor",
7957
+ icon: "⚙️"
7958
+ },
7959
+ {
7960
+ id: "tools",
7961
+ name: "Tools / Construction",
7962
+ icon: "🔨"
7963
+ },
7964
+ {
7965
+ id: "silence",
7966
+ name: "Silence",
7967
+ icon: "🤫"
7968
+ }
7969
+ ];
7816
7970
  var YAMNET_TO_MACRO = {
7817
7971
  mapping: {
7818
7972
  Speech: "speech",
@@ -8079,6 +8233,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
8079
8233
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8080
8234
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8081
8235
  /**
8236
+ * Unified event-kind taxonomy — THE single source of truth for
8237
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8238
+ * icon }`.
8239
+ *
8240
+ * This dictionary folds together what used to be scattered across four
8241
+ * copies:
8242
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8243
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8244
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8245
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8246
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8247
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8248
+ *
8249
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8250
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8251
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8252
+ * color or an icon: they read this dictionary (server descriptors carry the
8253
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8254
+ *
8255
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8256
+ */
8257
+ var TAXONOMY_COLORS = {
8258
+ motion: "#f59e0b",
8259
+ audio: "#06b6d4",
8260
+ person: "#22c55e",
8261
+ vehicle: "#3b82f6",
8262
+ animal: "#f97316",
8263
+ package: "#a855f7",
8264
+ sensor: "#8b5cf6",
8265
+ control: "#10b981",
8266
+ genericDetection: "#64748b"
8267
+ };
8268
+ var DETECTION_SUB_COLORS = {
8269
+ car: "#f59e0b",
8270
+ truck: "#d97706",
8271
+ bus: "#b45309",
8272
+ motorcycle: "#eab308",
8273
+ bicycle: "#ca8a04",
8274
+ airplane: "#60a5fa",
8275
+ boat: "#2563eb",
8276
+ train: "#1d4ed8",
8277
+ bird: "#14b8a6",
8278
+ dog: "#84cc16",
8279
+ cat: "#f97316",
8280
+ horse: "#a16207",
8281
+ sheep: "#a3a3a3",
8282
+ cow: "#78716c",
8283
+ elephant: "#6b7280",
8284
+ bear: "#7c2d12",
8285
+ zebra: "#404040",
8286
+ giraffe: "#d4a373"
8287
+ };
8288
+ function titleCase(id) {
8289
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8290
+ }
8291
+ var entries = /* @__PURE__ */ new Map();
8292
+ function macro(kind, category, color, iconId, label) {
8293
+ entries.set(kind, {
8294
+ kind,
8295
+ parentKind: null,
8296
+ level: "macro",
8297
+ category,
8298
+ color,
8299
+ iconId,
8300
+ labelKey: `eventKind.${kind}`,
8301
+ label
8302
+ });
8303
+ }
8304
+ function sub(kind, parentKind, category, color, iconId, label) {
8305
+ entries.set(kind, {
8306
+ kind,
8307
+ parentKind,
8308
+ level: "sub",
8309
+ category,
8310
+ color,
8311
+ iconId,
8312
+ labelKey: `eventKind.${kind}`,
8313
+ label
8314
+ });
8315
+ }
8316
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8317
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8318
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8319
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8320
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8321
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8322
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8323
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8324
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8325
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8326
+ if (entries.has(cocoClass)) continue;
8327
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8328
+ }
8329
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8330
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8331
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8332
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8333
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8334
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8335
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8336
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8337
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8338
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8339
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8340
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8341
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8342
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8343
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8344
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8345
+ sub("button", "control", "control", "#10b981", "button", "Button");
8346
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8347
+ for (const l of AUDIO_MACRO_LABELS) {
8348
+ const kind = `audio-${l.id}`;
8349
+ if (entries.has(kind)) continue;
8350
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8351
+ }
8352
+ /** The complete taxonomy dictionary, keyed by kind. */
8353
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8354
+ /**
8082
8355
  * Error types for the safe expression engine. Two distinct classes so callers
8083
8356
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
8084
8357
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -19096,17 +19369,30 @@ var EventKindCategorySchema = _enum([
19096
19369
  "audio",
19097
19370
  "detection",
19098
19371
  "sensor",
19372
+ "control",
19099
19373
  "custom",
19100
19374
  "package"
19101
19375
  ]);
19376
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19377
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
19102
19378
  var EventKindDescriptorSchema = object({
19103
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19379
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
19104
19380
  kind: string(),
19381
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19382
+ labelKey: string(),
19383
+ /** English fallback label (kept for clients that don't translate). */
19105
19384
  label: string(),
19106
19385
  /** Hex color for timeline/legend rendering. */
19107
19386
  color: string(),
19387
+ /** Dictionary id → lucide component on the UI side. */
19388
+ iconId: string(),
19389
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
19108
19390
  icon: EventKindIconSchema,
19109
19391
  category: EventKindCategorySchema,
19392
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19393
+ parentKind: string().nullable(),
19394
+ /** Derived from `parentKind`, explicit for the client tree. */
19395
+ level: EventKindLevelSchema,
19110
19396
  /** Which cap + device contributes this kind. For built-ins the camera
19111
19397
  * itself; for sensor kinds the LINKED source device. */
19112
19398
  source: object({
@@ -19179,11 +19465,21 @@ var TrackAudioLabelSchema = object({
19179
19465
  firstAt: number(),
19180
19466
  lastAt: number()
19181
19467
  });
19468
+ /**
19469
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19470
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19471
+ * linked sensor/control state change (no positions; carries a snapshot). The
19472
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19473
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19474
+ */
19475
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19182
19476
  var TrackSchema = object({
19183
19477
  trackId: string(),
19184
19478
  deviceId: number(),
19185
19479
  className: string(),
19186
19480
  label: string().optional(),
19481
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19482
+ source: TrackSourceSchema.optional(),
19187
19483
  firstSeen: number(),
19188
19484
  lastSeen: number(),
19189
19485
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19560,6 +19856,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19560
19856
  eventId: string(),
19561
19857
  timestamp: number()
19562
19858
  });
19859
+ /**
19860
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19861
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19862
+ * caps into per-camera event-kind descriptors.
19863
+ *
19864
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19865
+ * is NOT duplicated here — every entry is derived from the single
19866
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19867
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19868
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19869
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19870
+ * eventful cap is missing.
19871
+ */
19872
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19873
+ var LEGACY_ICON = {
19874
+ motion: "motion",
19875
+ audio: "audio",
19876
+ person: "person",
19877
+ vehicle: "vehicle",
19878
+ animal: "animal",
19879
+ package: "package",
19880
+ door: "door",
19881
+ pir: "pir",
19882
+ smoke: "smoke",
19883
+ water: "water",
19884
+ button: "button",
19885
+ generic: "generic",
19886
+ gas: "smoke",
19887
+ vibration: "generic",
19888
+ tamper: "generic",
19889
+ presence: "person",
19890
+ lock: "generic",
19891
+ siren: "generic",
19892
+ switch: "generic",
19893
+ doorbell: "button"
19894
+ };
19895
+ function legacyIcon(iconId) {
19896
+ return LEGACY_ICON[iconId] ?? "generic";
19897
+ }
19898
+ /**
19899
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19900
+ * The anti-drift guard cross-checks this against the eventful caps declared
19901
+ * in `packages/types/src/capabilities/*.cap.ts`.
19902
+ */
19903
+ var CAP_TO_KIND = {
19904
+ contact: "contact",
19905
+ motion: "motion-sensor",
19906
+ smoke: "smoke",
19907
+ flood: "flood",
19908
+ gas: "gas",
19909
+ "carbon-monoxide": "carbon-monoxide",
19910
+ vibration: "vibration",
19911
+ tamper: "tamper",
19912
+ presence: "presence",
19913
+ "enum-sensor": "enum-sensor",
19914
+ "event-emitter": "device-event",
19915
+ "lock-control": "lock",
19916
+ switch: "switch",
19917
+ button: "button",
19918
+ doorbell: "doorbell"
19919
+ };
19920
+ function buildDescriptor(capName, kind) {
19921
+ const t = EVENT_TAXONOMY[kind];
19922
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19923
+ return {
19924
+ ...t,
19925
+ icon: legacyIcon(t.iconId)
19926
+ };
19927
+ }
19928
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19563
19929
  var CameraPipelineConfigSchema = object({
19564
19930
  engine: PipelineEngineChoiceSchema.optional(),
19565
19931
  steps: array(PipelineStepInputSchema).readonly(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-import-alexa",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "Alexa device-import provider for CamStack — imports the smart-home devices in a user's Alexa account via the unofficial alexa-remote2 cookie/token client (the inverse of the Alexa exporter)",
5
5
  "keywords": [
6
6
  "camstack",