@camstack/addon-advanced-notifier 1.1.29 → 1.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +372 -4
- package/dist/addon.mjs +372 -4
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -7645,6 +7645,160 @@ function cosineSimilarity(a, b) {
|
|
|
7645
7645
|
const denom = Math.sqrt(normA) * Math.sqrt(normB);
|
|
7646
7646
|
return denom === 0 ? 0 : dotProduct / denom;
|
|
7647
7647
|
}
|
|
7648
|
+
var COCO_TO_MACRO = {
|
|
7649
|
+
mapping: {
|
|
7650
|
+
person: "person",
|
|
7651
|
+
bicycle: "vehicle",
|
|
7652
|
+
car: "vehicle",
|
|
7653
|
+
motorcycle: "vehicle",
|
|
7654
|
+
airplane: "vehicle",
|
|
7655
|
+
bus: "vehicle",
|
|
7656
|
+
train: "vehicle",
|
|
7657
|
+
truck: "vehicle",
|
|
7658
|
+
boat: "vehicle",
|
|
7659
|
+
bird: "animal",
|
|
7660
|
+
cat: "animal",
|
|
7661
|
+
dog: "animal",
|
|
7662
|
+
horse: "animal",
|
|
7663
|
+
sheep: "animal",
|
|
7664
|
+
cow: "animal",
|
|
7665
|
+
elephant: "animal",
|
|
7666
|
+
bear: "animal",
|
|
7667
|
+
zebra: "animal",
|
|
7668
|
+
giraffe: "animal",
|
|
7669
|
+
suitcase: "package",
|
|
7670
|
+
backpack: "package",
|
|
7671
|
+
handbag: "package"
|
|
7672
|
+
},
|
|
7673
|
+
preserveOriginal: false
|
|
7674
|
+
};
|
|
7675
|
+
var AUDIO_MACRO_LABELS = [
|
|
7676
|
+
{
|
|
7677
|
+
id: "speech",
|
|
7678
|
+
name: "Speech",
|
|
7679
|
+
icon: "🗣️"
|
|
7680
|
+
},
|
|
7681
|
+
{
|
|
7682
|
+
id: "scream",
|
|
7683
|
+
name: "Scream / Shout",
|
|
7684
|
+
icon: "😱"
|
|
7685
|
+
},
|
|
7686
|
+
{
|
|
7687
|
+
id: "crying",
|
|
7688
|
+
name: "Crying / Baby",
|
|
7689
|
+
icon: "😢"
|
|
7690
|
+
},
|
|
7691
|
+
{
|
|
7692
|
+
id: "laughter",
|
|
7693
|
+
name: "Laughter",
|
|
7694
|
+
icon: "😂"
|
|
7695
|
+
},
|
|
7696
|
+
{
|
|
7697
|
+
id: "music",
|
|
7698
|
+
name: "Music",
|
|
7699
|
+
icon: "🎵"
|
|
7700
|
+
},
|
|
7701
|
+
{
|
|
7702
|
+
id: "dog",
|
|
7703
|
+
name: "Dog",
|
|
7704
|
+
icon: "🐕"
|
|
7705
|
+
},
|
|
7706
|
+
{
|
|
7707
|
+
id: "cat",
|
|
7708
|
+
name: "Cat",
|
|
7709
|
+
icon: "🐈"
|
|
7710
|
+
},
|
|
7711
|
+
{
|
|
7712
|
+
id: "bird",
|
|
7713
|
+
name: "Bird",
|
|
7714
|
+
icon: "🐦"
|
|
7715
|
+
},
|
|
7716
|
+
{
|
|
7717
|
+
id: "animal",
|
|
7718
|
+
name: "Animal (other)",
|
|
7719
|
+
icon: "🐾"
|
|
7720
|
+
},
|
|
7721
|
+
{
|
|
7722
|
+
id: "alarm",
|
|
7723
|
+
name: "Alarm / Siren",
|
|
7724
|
+
icon: "🚨"
|
|
7725
|
+
},
|
|
7726
|
+
{
|
|
7727
|
+
id: "doorbell",
|
|
7728
|
+
name: "Doorbell / Knock",
|
|
7729
|
+
icon: "🔔"
|
|
7730
|
+
},
|
|
7731
|
+
{
|
|
7732
|
+
id: "glass_breaking",
|
|
7733
|
+
name: "Glass Breaking",
|
|
7734
|
+
icon: "💥"
|
|
7735
|
+
},
|
|
7736
|
+
{
|
|
7737
|
+
id: "gunshot",
|
|
7738
|
+
name: "Gunshot / Explosion",
|
|
7739
|
+
icon: "💣"
|
|
7740
|
+
},
|
|
7741
|
+
{
|
|
7742
|
+
id: "vehicle",
|
|
7743
|
+
name: "Vehicle",
|
|
7744
|
+
icon: "🚗"
|
|
7745
|
+
},
|
|
7746
|
+
{
|
|
7747
|
+
id: "siren",
|
|
7748
|
+
name: "Emergency Siren",
|
|
7749
|
+
icon: "🚑"
|
|
7750
|
+
},
|
|
7751
|
+
{
|
|
7752
|
+
id: "fire",
|
|
7753
|
+
name: "Fire / Smoke",
|
|
7754
|
+
icon: "🔥"
|
|
7755
|
+
},
|
|
7756
|
+
{
|
|
7757
|
+
id: "water",
|
|
7758
|
+
name: "Water",
|
|
7759
|
+
icon: "💧"
|
|
7760
|
+
},
|
|
7761
|
+
{
|
|
7762
|
+
id: "wind",
|
|
7763
|
+
name: "Wind / Weather",
|
|
7764
|
+
icon: "🌬️"
|
|
7765
|
+
},
|
|
7766
|
+
{
|
|
7767
|
+
id: "door",
|
|
7768
|
+
name: "Door",
|
|
7769
|
+
icon: "🚪"
|
|
7770
|
+
},
|
|
7771
|
+
{
|
|
7772
|
+
id: "footsteps",
|
|
7773
|
+
name: "Footsteps",
|
|
7774
|
+
icon: "👣"
|
|
7775
|
+
},
|
|
7776
|
+
{
|
|
7777
|
+
id: "crowd",
|
|
7778
|
+
name: "Crowd / Chatter",
|
|
7779
|
+
icon: "👥"
|
|
7780
|
+
},
|
|
7781
|
+
{
|
|
7782
|
+
id: "telephone",
|
|
7783
|
+
name: "Telephone",
|
|
7784
|
+
icon: "📞"
|
|
7785
|
+
},
|
|
7786
|
+
{
|
|
7787
|
+
id: "engine",
|
|
7788
|
+
name: "Engine / Motor",
|
|
7789
|
+
icon: "⚙️"
|
|
7790
|
+
},
|
|
7791
|
+
{
|
|
7792
|
+
id: "tools",
|
|
7793
|
+
name: "Tools / Construction",
|
|
7794
|
+
icon: "🔨"
|
|
7795
|
+
},
|
|
7796
|
+
{
|
|
7797
|
+
id: "silence",
|
|
7798
|
+
name: "Silence",
|
|
7799
|
+
icon: "🤫"
|
|
7800
|
+
}
|
|
7801
|
+
];
|
|
7648
7802
|
var YAMNET_TO_MACRO = {
|
|
7649
7803
|
mapping: {
|
|
7650
7804
|
Speech: "speech",
|
|
@@ -7911,6 +8065,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
|
|
|
7911
8065
|
for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7912
8066
|
for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7913
8067
|
/**
|
|
8068
|
+
* Unified event-kind taxonomy — THE single source of truth for
|
|
8069
|
+
* `kind → { parentKind, category, level, color, iconId, labelKey, label,
|
|
8070
|
+
* icon }`.
|
|
8071
|
+
*
|
|
8072
|
+
* This dictionary folds together what used to be scattered across four
|
|
8073
|
+
* copies:
|
|
8074
|
+
* - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
|
|
8075
|
+
* - `addon-post-analysis/.../services/event-kinds.ts`
|
|
8076
|
+
* (MOTION/PERSON/VEHICLE… _COLOR constants)
|
|
8077
|
+
* - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
|
|
8078
|
+
* - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
|
|
8079
|
+
* - the COCO / audio class maps (macro ↔ sub relationships)
|
|
8080
|
+
*
|
|
8081
|
+
* The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
|
|
8082
|
+
* `@camstack/types`. The UI-side mapping `iconId → lucide component` and
|
|
8083
|
+
* `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
|
|
8084
|
+
* color or an icon: they read this dictionary (server descriptors carry the
|
|
8085
|
+
* fields inline; the client resolves color/icon/label from `iconId`/`kind`).
|
|
8086
|
+
*
|
|
8087
|
+
* Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
|
|
8088
|
+
*/
|
|
8089
|
+
var TAXONOMY_COLORS = {
|
|
8090
|
+
motion: "#f59e0b",
|
|
8091
|
+
audio: "#06b6d4",
|
|
8092
|
+
person: "#22c55e",
|
|
8093
|
+
vehicle: "#3b82f6",
|
|
8094
|
+
animal: "#f97316",
|
|
8095
|
+
package: "#a855f7",
|
|
8096
|
+
sensor: "#8b5cf6",
|
|
8097
|
+
control: "#10b981",
|
|
8098
|
+
genericDetection: "#64748b"
|
|
8099
|
+
};
|
|
8100
|
+
var DETECTION_SUB_COLORS = {
|
|
8101
|
+
car: "#f59e0b",
|
|
8102
|
+
truck: "#d97706",
|
|
8103
|
+
bus: "#b45309",
|
|
8104
|
+
motorcycle: "#eab308",
|
|
8105
|
+
bicycle: "#ca8a04",
|
|
8106
|
+
airplane: "#60a5fa",
|
|
8107
|
+
boat: "#2563eb",
|
|
8108
|
+
train: "#1d4ed8",
|
|
8109
|
+
bird: "#14b8a6",
|
|
8110
|
+
dog: "#84cc16",
|
|
8111
|
+
cat: "#f97316",
|
|
8112
|
+
horse: "#a16207",
|
|
8113
|
+
sheep: "#a3a3a3",
|
|
8114
|
+
cow: "#78716c",
|
|
8115
|
+
elephant: "#6b7280",
|
|
8116
|
+
bear: "#7c2d12",
|
|
8117
|
+
zebra: "#404040",
|
|
8118
|
+
giraffe: "#d4a373"
|
|
8119
|
+
};
|
|
8120
|
+
function titleCase(id) {
|
|
8121
|
+
return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
|
|
8122
|
+
}
|
|
8123
|
+
var entries = /* @__PURE__ */ new Map();
|
|
8124
|
+
function macro(kind, category, color, iconId, label) {
|
|
8125
|
+
entries.set(kind, {
|
|
8126
|
+
kind,
|
|
8127
|
+
parentKind: null,
|
|
8128
|
+
level: "macro",
|
|
8129
|
+
category,
|
|
8130
|
+
color,
|
|
8131
|
+
iconId,
|
|
8132
|
+
labelKey: `eventKind.${kind}`,
|
|
8133
|
+
label
|
|
8134
|
+
});
|
|
8135
|
+
}
|
|
8136
|
+
function sub(kind, parentKind, category, color, iconId, label) {
|
|
8137
|
+
entries.set(kind, {
|
|
8138
|
+
kind,
|
|
8139
|
+
parentKind,
|
|
8140
|
+
level: "sub",
|
|
8141
|
+
category,
|
|
8142
|
+
color,
|
|
8143
|
+
iconId,
|
|
8144
|
+
labelKey: `eventKind.${kind}`,
|
|
8145
|
+
label
|
|
8146
|
+
});
|
|
8147
|
+
}
|
|
8148
|
+
macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
|
|
8149
|
+
macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
|
|
8150
|
+
macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
|
|
8151
|
+
macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
|
|
8152
|
+
macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
|
|
8153
|
+
macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
|
|
8154
|
+
macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
|
|
8155
|
+
macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
|
|
8156
|
+
for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
|
|
8157
|
+
if (macroClass !== "vehicle" && macroClass !== "animal") continue;
|
|
8158
|
+
if (entries.has(cocoClass)) continue;
|
|
8159
|
+
sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
|
|
8160
|
+
}
|
|
8161
|
+
sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
|
|
8162
|
+
sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
|
|
8163
|
+
sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
|
|
8164
|
+
sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
|
|
8165
|
+
sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
|
|
8166
|
+
sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
|
|
8167
|
+
sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
|
|
8168
|
+
sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
|
|
8169
|
+
sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
|
|
8170
|
+
sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
|
|
8171
|
+
sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
|
|
8172
|
+
sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
|
|
8173
|
+
sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
|
|
8174
|
+
sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
|
|
8175
|
+
sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
|
|
8176
|
+
sub("siren", "control", "control", "#dc2626", "siren", "Siren");
|
|
8177
|
+
sub("button", "control", "control", "#10b981", "button", "Button");
|
|
8178
|
+
sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
|
|
8179
|
+
for (const l of AUDIO_MACRO_LABELS) {
|
|
8180
|
+
const kind = `audio-${l.id}`;
|
|
8181
|
+
if (entries.has(kind)) continue;
|
|
8182
|
+
sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
|
|
8183
|
+
}
|
|
8184
|
+
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8185
|
+
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8186
|
+
/**
|
|
7914
8187
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
7915
8188
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
7916
8189
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -15886,17 +16159,30 @@ var EventKindCategorySchema = _enum([
|
|
|
15886
16159
|
"audio",
|
|
15887
16160
|
"detection",
|
|
15888
16161
|
"sensor",
|
|
16162
|
+
"control",
|
|
15889
16163
|
"custom",
|
|
15890
16164
|
"package"
|
|
15891
16165
|
]);
|
|
16166
|
+
/** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
|
|
16167
|
+
var EventKindLevelSchema = _enum(["macro", "sub"]);
|
|
15892
16168
|
var EventKindDescriptorSchema = object({
|
|
15893
|
-
/** Stable kind id (e.g. 'motion', '
|
|
16169
|
+
/** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
|
|
15894
16170
|
kind: string(),
|
|
16171
|
+
/** i18n key resolved on the UI side; `label` is the English fallback. */
|
|
16172
|
+
labelKey: string(),
|
|
16173
|
+
/** English fallback label (kept for clients that don't translate). */
|
|
15895
16174
|
label: string(),
|
|
15896
16175
|
/** Hex color for timeline/legend rendering. */
|
|
15897
16176
|
color: string(),
|
|
16177
|
+
/** Dictionary id → lucide component on the UI side. */
|
|
16178
|
+
iconId: string(),
|
|
16179
|
+
/** Legacy closed-vocab glyph — fallback for `iconId`. */
|
|
15898
16180
|
icon: EventKindIconSchema,
|
|
15899
16181
|
category: EventKindCategorySchema,
|
|
16182
|
+
/** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
|
|
16183
|
+
parentKind: string().nullable(),
|
|
16184
|
+
/** Derived from `parentKind`, explicit for the client tree. */
|
|
16185
|
+
level: EventKindLevelSchema,
|
|
15900
16186
|
/** Which cap + device contributes this kind. For built-ins the camera
|
|
15901
16187
|
* itself; for sensor kinds the LINKED source device. */
|
|
15902
16188
|
source: object({
|
|
@@ -15969,11 +16255,21 @@ var TrackAudioLabelSchema = object({
|
|
|
15969
16255
|
firstAt: number(),
|
|
15970
16256
|
lastAt: number()
|
|
15971
16257
|
});
|
|
16258
|
+
/**
|
|
16259
|
+
* How a track was produced. `pipeline` (default / absent) = the spatial
|
|
16260
|
+
* detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
|
|
16261
|
+
* linked sensor/control state change (no positions; carries a snapshot). The
|
|
16262
|
+
* spatial subsystems (tracker association, occupancy count, re-id/embedding,
|
|
16263
|
+
* resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
|
|
16264
|
+
*/
|
|
16265
|
+
var TrackSourceSchema = _enum(["pipeline", "sensor"]);
|
|
15972
16266
|
var TrackSchema = object({
|
|
15973
16267
|
trackId: string(),
|
|
15974
16268
|
deviceId: number(),
|
|
15975
16269
|
className: string(),
|
|
15976
16270
|
label: string().optional(),
|
|
16271
|
+
/** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
|
|
16272
|
+
source: TrackSourceSchema.optional(),
|
|
15977
16273
|
firstSeen: number(),
|
|
15978
16274
|
lastSeen: number(),
|
|
15979
16275
|
/** Frame-rate position history (subject to maxPositionHistory cap). */
|
|
@@ -16350,6 +16646,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16350
16646
|
eventId: string(),
|
|
16351
16647
|
timestamp: number()
|
|
16352
16648
|
});
|
|
16649
|
+
/**
|
|
16650
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
16651
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
16652
|
+
* caps into per-camera event-kind descriptors.
|
|
16653
|
+
*
|
|
16654
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
16655
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
16656
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
16657
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
16658
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
16659
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
16660
|
+
* eventful cap is missing.
|
|
16661
|
+
*/
|
|
16662
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
16663
|
+
var LEGACY_ICON = {
|
|
16664
|
+
motion: "motion",
|
|
16665
|
+
audio: "audio",
|
|
16666
|
+
person: "person",
|
|
16667
|
+
vehicle: "vehicle",
|
|
16668
|
+
animal: "animal",
|
|
16669
|
+
package: "package",
|
|
16670
|
+
door: "door",
|
|
16671
|
+
pir: "pir",
|
|
16672
|
+
smoke: "smoke",
|
|
16673
|
+
water: "water",
|
|
16674
|
+
button: "button",
|
|
16675
|
+
generic: "generic",
|
|
16676
|
+
gas: "smoke",
|
|
16677
|
+
vibration: "generic",
|
|
16678
|
+
tamper: "generic",
|
|
16679
|
+
presence: "person",
|
|
16680
|
+
lock: "generic",
|
|
16681
|
+
siren: "generic",
|
|
16682
|
+
switch: "generic",
|
|
16683
|
+
doorbell: "button"
|
|
16684
|
+
};
|
|
16685
|
+
function legacyIcon(iconId) {
|
|
16686
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
16687
|
+
}
|
|
16688
|
+
/**
|
|
16689
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
16690
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
16691
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
16692
|
+
*/
|
|
16693
|
+
var CAP_TO_KIND = {
|
|
16694
|
+
contact: "contact",
|
|
16695
|
+
motion: "motion-sensor",
|
|
16696
|
+
smoke: "smoke",
|
|
16697
|
+
flood: "flood",
|
|
16698
|
+
gas: "gas",
|
|
16699
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
16700
|
+
vibration: "vibration",
|
|
16701
|
+
tamper: "tamper",
|
|
16702
|
+
presence: "presence",
|
|
16703
|
+
"enum-sensor": "enum-sensor",
|
|
16704
|
+
"event-emitter": "device-event",
|
|
16705
|
+
"lock-control": "lock",
|
|
16706
|
+
switch: "switch",
|
|
16707
|
+
button: "button",
|
|
16708
|
+
doorbell: "doorbell"
|
|
16709
|
+
};
|
|
16710
|
+
function buildDescriptor(capName, kind) {
|
|
16711
|
+
const t = EVENT_TAXONOMY[kind];
|
|
16712
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
16713
|
+
return {
|
|
16714
|
+
...t,
|
|
16715
|
+
icon: legacyIcon(t.iconId)
|
|
16716
|
+
};
|
|
16717
|
+
}
|
|
16718
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
16353
16719
|
var CameraPipelineConfigSchema = object({
|
|
16354
16720
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
16355
16721
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -24988,7 +25354,7 @@ var RuleEngine = class {
|
|
|
24988
25354
|
if (!className || !conditions.classNames.includes(className)) return false;
|
|
24989
25355
|
}
|
|
24990
25356
|
if (conditions.zoneIds?.length) {
|
|
24991
|
-
const zones = data["zones"];
|
|
25357
|
+
const zones = data["zones"] ?? data["zoneIds"];
|
|
24992
25358
|
const zoneId = data["zoneId"];
|
|
24993
25359
|
if (!(zones ?? (zoneId ? [zoneId] : [])).some((z) => conditions.zoneIds.includes(z))) return false;
|
|
24994
25360
|
}
|
|
@@ -25075,7 +25441,9 @@ var EVENT_CATEGORIES = [
|
|
|
25075
25441
|
EventCategory.DetectionRaw,
|
|
25076
25442
|
EventCategory.DetectionResult,
|
|
25077
25443
|
EventCategory.PipelineAnalyticsDetectionEvent,
|
|
25078
|
-
EventCategory.EventEmitted
|
|
25444
|
+
EventCategory.EventEmitted,
|
|
25445
|
+
EventCategory.PipelineAnalyticsPackageDelivered,
|
|
25446
|
+
EventCategory.PipelineAnalyticsPackagePickedUp
|
|
25079
25447
|
];
|
|
25080
25448
|
var DEFAULT_NOTIFIER_CONFIG = {
|
|
25081
25449
|
defaultCooldownSeconds: 60,
|
|
@@ -25330,7 +25698,7 @@ var AdvancedNotifierAddon = class extends BaseAddon {
|
|
|
25330
25698
|
deviceName: data["deviceName"] ?? String(event.source.id),
|
|
25331
25699
|
className: data["className"] ?? "",
|
|
25332
25700
|
confidence: String(data["confidence"] ?? ""),
|
|
25333
|
-
zoneId: data["zoneId"] ?? "",
|
|
25701
|
+
zoneId: data["zoneId"] ?? (Array.isArray(data["zoneIds"]) ? String(data["zoneIds"][0] ?? "") : ""),
|
|
25334
25702
|
zoneName: data["zoneName"] ?? "",
|
|
25335
25703
|
category: event.category,
|
|
25336
25704
|
timestamp: event.timestamp.toISOString()
|
package/dist/addon.mjs
CHANGED
|
@@ -7641,6 +7641,160 @@ function cosineSimilarity(a, b) {
|
|
|
7641
7641
|
const denom = Math.sqrt(normA) * Math.sqrt(normB);
|
|
7642
7642
|
return denom === 0 ? 0 : dotProduct / denom;
|
|
7643
7643
|
}
|
|
7644
|
+
var COCO_TO_MACRO = {
|
|
7645
|
+
mapping: {
|
|
7646
|
+
person: "person",
|
|
7647
|
+
bicycle: "vehicle",
|
|
7648
|
+
car: "vehicle",
|
|
7649
|
+
motorcycle: "vehicle",
|
|
7650
|
+
airplane: "vehicle",
|
|
7651
|
+
bus: "vehicle",
|
|
7652
|
+
train: "vehicle",
|
|
7653
|
+
truck: "vehicle",
|
|
7654
|
+
boat: "vehicle",
|
|
7655
|
+
bird: "animal",
|
|
7656
|
+
cat: "animal",
|
|
7657
|
+
dog: "animal",
|
|
7658
|
+
horse: "animal",
|
|
7659
|
+
sheep: "animal",
|
|
7660
|
+
cow: "animal",
|
|
7661
|
+
elephant: "animal",
|
|
7662
|
+
bear: "animal",
|
|
7663
|
+
zebra: "animal",
|
|
7664
|
+
giraffe: "animal",
|
|
7665
|
+
suitcase: "package",
|
|
7666
|
+
backpack: "package",
|
|
7667
|
+
handbag: "package"
|
|
7668
|
+
},
|
|
7669
|
+
preserveOriginal: false
|
|
7670
|
+
};
|
|
7671
|
+
var AUDIO_MACRO_LABELS = [
|
|
7672
|
+
{
|
|
7673
|
+
id: "speech",
|
|
7674
|
+
name: "Speech",
|
|
7675
|
+
icon: "🗣️"
|
|
7676
|
+
},
|
|
7677
|
+
{
|
|
7678
|
+
id: "scream",
|
|
7679
|
+
name: "Scream / Shout",
|
|
7680
|
+
icon: "😱"
|
|
7681
|
+
},
|
|
7682
|
+
{
|
|
7683
|
+
id: "crying",
|
|
7684
|
+
name: "Crying / Baby",
|
|
7685
|
+
icon: "😢"
|
|
7686
|
+
},
|
|
7687
|
+
{
|
|
7688
|
+
id: "laughter",
|
|
7689
|
+
name: "Laughter",
|
|
7690
|
+
icon: "😂"
|
|
7691
|
+
},
|
|
7692
|
+
{
|
|
7693
|
+
id: "music",
|
|
7694
|
+
name: "Music",
|
|
7695
|
+
icon: "🎵"
|
|
7696
|
+
},
|
|
7697
|
+
{
|
|
7698
|
+
id: "dog",
|
|
7699
|
+
name: "Dog",
|
|
7700
|
+
icon: "🐕"
|
|
7701
|
+
},
|
|
7702
|
+
{
|
|
7703
|
+
id: "cat",
|
|
7704
|
+
name: "Cat",
|
|
7705
|
+
icon: "🐈"
|
|
7706
|
+
},
|
|
7707
|
+
{
|
|
7708
|
+
id: "bird",
|
|
7709
|
+
name: "Bird",
|
|
7710
|
+
icon: "🐦"
|
|
7711
|
+
},
|
|
7712
|
+
{
|
|
7713
|
+
id: "animal",
|
|
7714
|
+
name: "Animal (other)",
|
|
7715
|
+
icon: "🐾"
|
|
7716
|
+
},
|
|
7717
|
+
{
|
|
7718
|
+
id: "alarm",
|
|
7719
|
+
name: "Alarm / Siren",
|
|
7720
|
+
icon: "🚨"
|
|
7721
|
+
},
|
|
7722
|
+
{
|
|
7723
|
+
id: "doorbell",
|
|
7724
|
+
name: "Doorbell / Knock",
|
|
7725
|
+
icon: "🔔"
|
|
7726
|
+
},
|
|
7727
|
+
{
|
|
7728
|
+
id: "glass_breaking",
|
|
7729
|
+
name: "Glass Breaking",
|
|
7730
|
+
icon: "💥"
|
|
7731
|
+
},
|
|
7732
|
+
{
|
|
7733
|
+
id: "gunshot",
|
|
7734
|
+
name: "Gunshot / Explosion",
|
|
7735
|
+
icon: "💣"
|
|
7736
|
+
},
|
|
7737
|
+
{
|
|
7738
|
+
id: "vehicle",
|
|
7739
|
+
name: "Vehicle",
|
|
7740
|
+
icon: "🚗"
|
|
7741
|
+
},
|
|
7742
|
+
{
|
|
7743
|
+
id: "siren",
|
|
7744
|
+
name: "Emergency Siren",
|
|
7745
|
+
icon: "🚑"
|
|
7746
|
+
},
|
|
7747
|
+
{
|
|
7748
|
+
id: "fire",
|
|
7749
|
+
name: "Fire / Smoke",
|
|
7750
|
+
icon: "🔥"
|
|
7751
|
+
},
|
|
7752
|
+
{
|
|
7753
|
+
id: "water",
|
|
7754
|
+
name: "Water",
|
|
7755
|
+
icon: "💧"
|
|
7756
|
+
},
|
|
7757
|
+
{
|
|
7758
|
+
id: "wind",
|
|
7759
|
+
name: "Wind / Weather",
|
|
7760
|
+
icon: "🌬️"
|
|
7761
|
+
},
|
|
7762
|
+
{
|
|
7763
|
+
id: "door",
|
|
7764
|
+
name: "Door",
|
|
7765
|
+
icon: "🚪"
|
|
7766
|
+
},
|
|
7767
|
+
{
|
|
7768
|
+
id: "footsteps",
|
|
7769
|
+
name: "Footsteps",
|
|
7770
|
+
icon: "👣"
|
|
7771
|
+
},
|
|
7772
|
+
{
|
|
7773
|
+
id: "crowd",
|
|
7774
|
+
name: "Crowd / Chatter",
|
|
7775
|
+
icon: "👥"
|
|
7776
|
+
},
|
|
7777
|
+
{
|
|
7778
|
+
id: "telephone",
|
|
7779
|
+
name: "Telephone",
|
|
7780
|
+
icon: "📞"
|
|
7781
|
+
},
|
|
7782
|
+
{
|
|
7783
|
+
id: "engine",
|
|
7784
|
+
name: "Engine / Motor",
|
|
7785
|
+
icon: "⚙️"
|
|
7786
|
+
},
|
|
7787
|
+
{
|
|
7788
|
+
id: "tools",
|
|
7789
|
+
name: "Tools / Construction",
|
|
7790
|
+
icon: "🔨"
|
|
7791
|
+
},
|
|
7792
|
+
{
|
|
7793
|
+
id: "silence",
|
|
7794
|
+
name: "Silence",
|
|
7795
|
+
icon: "🤫"
|
|
7796
|
+
}
|
|
7797
|
+
];
|
|
7644
7798
|
var YAMNET_TO_MACRO = {
|
|
7645
7799
|
mapping: {
|
|
7646
7800
|
Speech: "speech",
|
|
@@ -7907,6 +8061,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
|
|
|
7907
8061
|
for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7908
8062
|
for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7909
8063
|
/**
|
|
8064
|
+
* Unified event-kind taxonomy — THE single source of truth for
|
|
8065
|
+
* `kind → { parentKind, category, level, color, iconId, labelKey, label,
|
|
8066
|
+
* icon }`.
|
|
8067
|
+
*
|
|
8068
|
+
* This dictionary folds together what used to be scattered across four
|
|
8069
|
+
* copies:
|
|
8070
|
+
* - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
|
|
8071
|
+
* - `addon-post-analysis/.../services/event-kinds.ts`
|
|
8072
|
+
* (MOTION/PERSON/VEHICLE… _COLOR constants)
|
|
8073
|
+
* - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
|
|
8074
|
+
* - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
|
|
8075
|
+
* - the COCO / audio class maps (macro ↔ sub relationships)
|
|
8076
|
+
*
|
|
8077
|
+
* The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
|
|
8078
|
+
* `@camstack/types`. The UI-side mapping `iconId → lucide component` and
|
|
8079
|
+
* `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
|
|
8080
|
+
* color or an icon: they read this dictionary (server descriptors carry the
|
|
8081
|
+
* fields inline; the client resolves color/icon/label from `iconId`/`kind`).
|
|
8082
|
+
*
|
|
8083
|
+
* Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
|
|
8084
|
+
*/
|
|
8085
|
+
var TAXONOMY_COLORS = {
|
|
8086
|
+
motion: "#f59e0b",
|
|
8087
|
+
audio: "#06b6d4",
|
|
8088
|
+
person: "#22c55e",
|
|
8089
|
+
vehicle: "#3b82f6",
|
|
8090
|
+
animal: "#f97316",
|
|
8091
|
+
package: "#a855f7",
|
|
8092
|
+
sensor: "#8b5cf6",
|
|
8093
|
+
control: "#10b981",
|
|
8094
|
+
genericDetection: "#64748b"
|
|
8095
|
+
};
|
|
8096
|
+
var DETECTION_SUB_COLORS = {
|
|
8097
|
+
car: "#f59e0b",
|
|
8098
|
+
truck: "#d97706",
|
|
8099
|
+
bus: "#b45309",
|
|
8100
|
+
motorcycle: "#eab308",
|
|
8101
|
+
bicycle: "#ca8a04",
|
|
8102
|
+
airplane: "#60a5fa",
|
|
8103
|
+
boat: "#2563eb",
|
|
8104
|
+
train: "#1d4ed8",
|
|
8105
|
+
bird: "#14b8a6",
|
|
8106
|
+
dog: "#84cc16",
|
|
8107
|
+
cat: "#f97316",
|
|
8108
|
+
horse: "#a16207",
|
|
8109
|
+
sheep: "#a3a3a3",
|
|
8110
|
+
cow: "#78716c",
|
|
8111
|
+
elephant: "#6b7280",
|
|
8112
|
+
bear: "#7c2d12",
|
|
8113
|
+
zebra: "#404040",
|
|
8114
|
+
giraffe: "#d4a373"
|
|
8115
|
+
};
|
|
8116
|
+
function titleCase(id) {
|
|
8117
|
+
return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
|
|
8118
|
+
}
|
|
8119
|
+
var entries = /* @__PURE__ */ new Map();
|
|
8120
|
+
function macro(kind, category, color, iconId, label) {
|
|
8121
|
+
entries.set(kind, {
|
|
8122
|
+
kind,
|
|
8123
|
+
parentKind: null,
|
|
8124
|
+
level: "macro",
|
|
8125
|
+
category,
|
|
8126
|
+
color,
|
|
8127
|
+
iconId,
|
|
8128
|
+
labelKey: `eventKind.${kind}`,
|
|
8129
|
+
label
|
|
8130
|
+
});
|
|
8131
|
+
}
|
|
8132
|
+
function sub(kind, parentKind, category, color, iconId, label) {
|
|
8133
|
+
entries.set(kind, {
|
|
8134
|
+
kind,
|
|
8135
|
+
parentKind,
|
|
8136
|
+
level: "sub",
|
|
8137
|
+
category,
|
|
8138
|
+
color,
|
|
8139
|
+
iconId,
|
|
8140
|
+
labelKey: `eventKind.${kind}`,
|
|
8141
|
+
label
|
|
8142
|
+
});
|
|
8143
|
+
}
|
|
8144
|
+
macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
|
|
8145
|
+
macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
|
|
8146
|
+
macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
|
|
8147
|
+
macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
|
|
8148
|
+
macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
|
|
8149
|
+
macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
|
|
8150
|
+
macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
|
|
8151
|
+
macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
|
|
8152
|
+
for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
|
|
8153
|
+
if (macroClass !== "vehicle" && macroClass !== "animal") continue;
|
|
8154
|
+
if (entries.has(cocoClass)) continue;
|
|
8155
|
+
sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
|
|
8156
|
+
}
|
|
8157
|
+
sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
|
|
8158
|
+
sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
|
|
8159
|
+
sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
|
|
8160
|
+
sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
|
|
8161
|
+
sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
|
|
8162
|
+
sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
|
|
8163
|
+
sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
|
|
8164
|
+
sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
|
|
8165
|
+
sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
|
|
8166
|
+
sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
|
|
8167
|
+
sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
|
|
8168
|
+
sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
|
|
8169
|
+
sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
|
|
8170
|
+
sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
|
|
8171
|
+
sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
|
|
8172
|
+
sub("siren", "control", "control", "#dc2626", "siren", "Siren");
|
|
8173
|
+
sub("button", "control", "control", "#10b981", "button", "Button");
|
|
8174
|
+
sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
|
|
8175
|
+
for (const l of AUDIO_MACRO_LABELS) {
|
|
8176
|
+
const kind = `audio-${l.id}`;
|
|
8177
|
+
if (entries.has(kind)) continue;
|
|
8178
|
+
sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
|
|
8179
|
+
}
|
|
8180
|
+
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8181
|
+
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8182
|
+
/**
|
|
7910
8183
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
7911
8184
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
7912
8185
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -15882,17 +16155,30 @@ var EventKindCategorySchema = _enum([
|
|
|
15882
16155
|
"audio",
|
|
15883
16156
|
"detection",
|
|
15884
16157
|
"sensor",
|
|
16158
|
+
"control",
|
|
15885
16159
|
"custom",
|
|
15886
16160
|
"package"
|
|
15887
16161
|
]);
|
|
16162
|
+
/** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
|
|
16163
|
+
var EventKindLevelSchema = _enum(["macro", "sub"]);
|
|
15888
16164
|
var EventKindDescriptorSchema = object({
|
|
15889
|
-
/** Stable kind id (e.g. 'motion', '
|
|
16165
|
+
/** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
|
|
15890
16166
|
kind: string(),
|
|
16167
|
+
/** i18n key resolved on the UI side; `label` is the English fallback. */
|
|
16168
|
+
labelKey: string(),
|
|
16169
|
+
/** English fallback label (kept for clients that don't translate). */
|
|
15891
16170
|
label: string(),
|
|
15892
16171
|
/** Hex color for timeline/legend rendering. */
|
|
15893
16172
|
color: string(),
|
|
16173
|
+
/** Dictionary id → lucide component on the UI side. */
|
|
16174
|
+
iconId: string(),
|
|
16175
|
+
/** Legacy closed-vocab glyph — fallback for `iconId`. */
|
|
15894
16176
|
icon: EventKindIconSchema,
|
|
15895
16177
|
category: EventKindCategorySchema,
|
|
16178
|
+
/** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
|
|
16179
|
+
parentKind: string().nullable(),
|
|
16180
|
+
/** Derived from `parentKind`, explicit for the client tree. */
|
|
16181
|
+
level: EventKindLevelSchema,
|
|
15896
16182
|
/** Which cap + device contributes this kind. For built-ins the camera
|
|
15897
16183
|
* itself; for sensor kinds the LINKED source device. */
|
|
15898
16184
|
source: object({
|
|
@@ -15965,11 +16251,21 @@ var TrackAudioLabelSchema = object({
|
|
|
15965
16251
|
firstAt: number(),
|
|
15966
16252
|
lastAt: number()
|
|
15967
16253
|
});
|
|
16254
|
+
/**
|
|
16255
|
+
* How a track was produced. `pipeline` (default / absent) = the spatial
|
|
16256
|
+
* detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
|
|
16257
|
+
* linked sensor/control state change (no positions; carries a snapshot). The
|
|
16258
|
+
* spatial subsystems (tracker association, occupancy count, re-id/embedding,
|
|
16259
|
+
* resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
|
|
16260
|
+
*/
|
|
16261
|
+
var TrackSourceSchema = _enum(["pipeline", "sensor"]);
|
|
15968
16262
|
var TrackSchema = object({
|
|
15969
16263
|
trackId: string(),
|
|
15970
16264
|
deviceId: number(),
|
|
15971
16265
|
className: string(),
|
|
15972
16266
|
label: string().optional(),
|
|
16267
|
+
/** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
|
|
16268
|
+
source: TrackSourceSchema.optional(),
|
|
15973
16269
|
firstSeen: number(),
|
|
15974
16270
|
lastSeen: number(),
|
|
15975
16271
|
/** Frame-rate position history (subject to maxPositionHistory cap). */
|
|
@@ -16346,6 +16642,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16346
16642
|
eventId: string(),
|
|
16347
16643
|
timestamp: number()
|
|
16348
16644
|
});
|
|
16645
|
+
/**
|
|
16646
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
16647
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
16648
|
+
* caps into per-camera event-kind descriptors.
|
|
16649
|
+
*
|
|
16650
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
16651
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
16652
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
16653
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
16654
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
16655
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
16656
|
+
* eventful cap is missing.
|
|
16657
|
+
*/
|
|
16658
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
16659
|
+
var LEGACY_ICON = {
|
|
16660
|
+
motion: "motion",
|
|
16661
|
+
audio: "audio",
|
|
16662
|
+
person: "person",
|
|
16663
|
+
vehicle: "vehicle",
|
|
16664
|
+
animal: "animal",
|
|
16665
|
+
package: "package",
|
|
16666
|
+
door: "door",
|
|
16667
|
+
pir: "pir",
|
|
16668
|
+
smoke: "smoke",
|
|
16669
|
+
water: "water",
|
|
16670
|
+
button: "button",
|
|
16671
|
+
generic: "generic",
|
|
16672
|
+
gas: "smoke",
|
|
16673
|
+
vibration: "generic",
|
|
16674
|
+
tamper: "generic",
|
|
16675
|
+
presence: "person",
|
|
16676
|
+
lock: "generic",
|
|
16677
|
+
siren: "generic",
|
|
16678
|
+
switch: "generic",
|
|
16679
|
+
doorbell: "button"
|
|
16680
|
+
};
|
|
16681
|
+
function legacyIcon(iconId) {
|
|
16682
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
16683
|
+
}
|
|
16684
|
+
/**
|
|
16685
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
16686
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
16687
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
16688
|
+
*/
|
|
16689
|
+
var CAP_TO_KIND = {
|
|
16690
|
+
contact: "contact",
|
|
16691
|
+
motion: "motion-sensor",
|
|
16692
|
+
smoke: "smoke",
|
|
16693
|
+
flood: "flood",
|
|
16694
|
+
gas: "gas",
|
|
16695
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
16696
|
+
vibration: "vibration",
|
|
16697
|
+
tamper: "tamper",
|
|
16698
|
+
presence: "presence",
|
|
16699
|
+
"enum-sensor": "enum-sensor",
|
|
16700
|
+
"event-emitter": "device-event",
|
|
16701
|
+
"lock-control": "lock",
|
|
16702
|
+
switch: "switch",
|
|
16703
|
+
button: "button",
|
|
16704
|
+
doorbell: "doorbell"
|
|
16705
|
+
};
|
|
16706
|
+
function buildDescriptor(capName, kind) {
|
|
16707
|
+
const t = EVENT_TAXONOMY[kind];
|
|
16708
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
16709
|
+
return {
|
|
16710
|
+
...t,
|
|
16711
|
+
icon: legacyIcon(t.iconId)
|
|
16712
|
+
};
|
|
16713
|
+
}
|
|
16714
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
16349
16715
|
var CameraPipelineConfigSchema = object({
|
|
16350
16716
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
16351
16717
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -24984,7 +25350,7 @@ var RuleEngine = class {
|
|
|
24984
25350
|
if (!className || !conditions.classNames.includes(className)) return false;
|
|
24985
25351
|
}
|
|
24986
25352
|
if (conditions.zoneIds?.length) {
|
|
24987
|
-
const zones = data["zones"];
|
|
25353
|
+
const zones = data["zones"] ?? data["zoneIds"];
|
|
24988
25354
|
const zoneId = data["zoneId"];
|
|
24989
25355
|
if (!(zones ?? (zoneId ? [zoneId] : [])).some((z) => conditions.zoneIds.includes(z))) return false;
|
|
24990
25356
|
}
|
|
@@ -25071,7 +25437,9 @@ var EVENT_CATEGORIES = [
|
|
|
25071
25437
|
EventCategory.DetectionRaw,
|
|
25072
25438
|
EventCategory.DetectionResult,
|
|
25073
25439
|
EventCategory.PipelineAnalyticsDetectionEvent,
|
|
25074
|
-
EventCategory.EventEmitted
|
|
25440
|
+
EventCategory.EventEmitted,
|
|
25441
|
+
EventCategory.PipelineAnalyticsPackageDelivered,
|
|
25442
|
+
EventCategory.PipelineAnalyticsPackagePickedUp
|
|
25075
25443
|
];
|
|
25076
25444
|
var DEFAULT_NOTIFIER_CONFIG = {
|
|
25077
25445
|
defaultCooldownSeconds: 60,
|
|
@@ -25326,7 +25694,7 @@ var AdvancedNotifierAddon = class extends BaseAddon {
|
|
|
25326
25694
|
deviceName: data["deviceName"] ?? String(event.source.id),
|
|
25327
25695
|
className: data["className"] ?? "",
|
|
25328
25696
|
confidence: String(data["confidence"] ?? ""),
|
|
25329
|
-
zoneId: data["zoneId"] ?? "",
|
|
25697
|
+
zoneId: data["zoneId"] ?? (Array.isArray(data["zoneIds"]) ? String(data["zoneIds"][0] ?? "") : ""),
|
|
25330
25698
|
zoneName: data["zoneName"] ?? "",
|
|
25331
25699
|
category: event.category,
|
|
25332
25700
|
timestamp: event.timestamp.toISOString()
|