@camstack/addon-post-analysis 1.1.33 → 1.1.35
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/{dist-CA0GikiM.mjs → dist-8DTQLWKO.mjs} +589 -48
- package/dist/{dist-V8XOHDoj.js → dist-Bc4L7FGf.js} +618 -47
- package/dist/embedding-encoder/index.js +1 -1
- package/dist/embedding-encoder/index.mjs +1 -1
- package/dist/{node-E-m2CYYM.js → node-BRwocT7C.js} +1 -1
- package/dist/pipeline-analytics/_stub.js +1 -1
- package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-BbAKLasA.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-CMH9Gs68.mjs} +3 -3
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DLzy78dH.mjs +26 -0
- package/dist/pipeline-analytics/{hostInit-lUENPwl7.mjs → hostInit-Bhr2CNHt.mjs} +3 -3
- package/dist/pipeline-analytics/index.js +596 -127
- package/dist/pipeline-analytics/index.mjs +595 -126
- package/dist/pipeline-analytics/remoteEntry.js +1 -1
- package/package.json +1 -1
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-ai-NpPOn.mjs +0 -26
|
@@ -7358,6 +7358,62 @@ var RecordingConfigSchema = object({
|
|
|
7358
7358
|
scrubThumbnails: ScrubThumbnailPresetSchema.optional()
|
|
7359
7359
|
});
|
|
7360
7360
|
/**
|
|
7361
|
+
* Ops-log — the durable, append-only operations audit shared by the
|
|
7362
|
+
* recordings and events management surfaces.
|
|
7363
|
+
*
|
|
7364
|
+
* ONE row shape is reused for both domains so a single "Activity" view can
|
|
7365
|
+
* merge the recorder's DurableState ring (recordings ops-log) and the
|
|
7366
|
+
* pipeline-analytics SQLite collection (events ops-log). Each row records a
|
|
7367
|
+
* management operation, WHY it ran (reason), and its measurable effect
|
|
7368
|
+
* (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
|
|
7369
|
+
* never fail the operation it records.
|
|
7370
|
+
*/
|
|
7371
|
+
/** Which management domain the operation belongs to. */
|
|
7372
|
+
var OpsLogDomainSchema = _enum(["recording", "events"]);
|
|
7373
|
+
/** The kind of management operation performed. */
|
|
7374
|
+
var OpsLogOpSchema = _enum([
|
|
7375
|
+
"prune",
|
|
7376
|
+
"manual-delete",
|
|
7377
|
+
"rescan",
|
|
7378
|
+
"retention-run"
|
|
7379
|
+
]);
|
|
7380
|
+
/** Why the operation ran. */
|
|
7381
|
+
var OpsLogReasonSchema = _enum([
|
|
7382
|
+
"retention",
|
|
7383
|
+
"quota",
|
|
7384
|
+
"manual",
|
|
7385
|
+
"operator"
|
|
7386
|
+
]);
|
|
7387
|
+
/** One audit row, shared verbatim by both domains. */
|
|
7388
|
+
var OpsLogEntrySchema = object({
|
|
7389
|
+
/** Unique row id. */
|
|
7390
|
+
id: string(),
|
|
7391
|
+
/** Epoch ms the operation completed. */
|
|
7392
|
+
at: number(),
|
|
7393
|
+
domain: OpsLogDomainSchema,
|
|
7394
|
+
op: OpsLogOpSchema,
|
|
7395
|
+
reason: OpsLogReasonSchema,
|
|
7396
|
+
/** The camera the op targeted; null for a cluster/global op. */
|
|
7397
|
+
deviceId: number().nullable(),
|
|
7398
|
+
/** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
|
|
7399
|
+
nodeId: string(),
|
|
7400
|
+
/** Buckets / rows deleted (op-specific unit). */
|
|
7401
|
+
itemsAffected: number(),
|
|
7402
|
+
/** Bytes reclaimed by the op (0 when not measurable). */
|
|
7403
|
+
bytesReclaimed: number(),
|
|
7404
|
+
/** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
|
|
7405
|
+
detail: string().nullable(),
|
|
7406
|
+
/** Who/what triggered the op. */
|
|
7407
|
+
actor: string()
|
|
7408
|
+
});
|
|
7409
|
+
/** Shared query input for the per-domain `listOpsLog` cap methods. */
|
|
7410
|
+
var OpsLogQueryInputSchema = object({
|
|
7411
|
+
/** Restrict to a single camera; omit for every row. */
|
|
7412
|
+
deviceId: number().optional(),
|
|
7413
|
+
/** Max rows returned, newest-first. */
|
|
7414
|
+
limit: number().int().min(1).max(1e3).optional()
|
|
7415
|
+
});
|
|
7416
|
+
/**
|
|
7361
7417
|
* `StorageLocationType` — an addon-declared id that identifies the *kind* of
|
|
7362
7418
|
* storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
|
|
7363
7419
|
* so the persisted record schema and the consumer-facing cap can both consume it
|
|
@@ -7648,6 +7704,178 @@ function cosineSimilarity(a, b) {
|
|
|
7648
7704
|
const denom = Math.sqrt(normA) * Math.sqrt(normB);
|
|
7649
7705
|
return denom === 0 ? 0 : dotProduct / denom;
|
|
7650
7706
|
}
|
|
7707
|
+
var MACRO_LABELS = [
|
|
7708
|
+
{
|
|
7709
|
+
id: "person",
|
|
7710
|
+
name: "Person"
|
|
7711
|
+
},
|
|
7712
|
+
{
|
|
7713
|
+
id: "vehicle",
|
|
7714
|
+
name: "Vehicle"
|
|
7715
|
+
},
|
|
7716
|
+
{
|
|
7717
|
+
id: "animal",
|
|
7718
|
+
name: "Animal"
|
|
7719
|
+
},
|
|
7720
|
+
{
|
|
7721
|
+
id: "package",
|
|
7722
|
+
name: "Package"
|
|
7723
|
+
}
|
|
7724
|
+
];
|
|
7725
|
+
var COCO_TO_MACRO = {
|
|
7726
|
+
mapping: {
|
|
7727
|
+
person: "person",
|
|
7728
|
+
bicycle: "vehicle",
|
|
7729
|
+
car: "vehicle",
|
|
7730
|
+
motorcycle: "vehicle",
|
|
7731
|
+
airplane: "vehicle",
|
|
7732
|
+
bus: "vehicle",
|
|
7733
|
+
train: "vehicle",
|
|
7734
|
+
truck: "vehicle",
|
|
7735
|
+
boat: "vehicle",
|
|
7736
|
+
bird: "animal",
|
|
7737
|
+
cat: "animal",
|
|
7738
|
+
dog: "animal",
|
|
7739
|
+
horse: "animal",
|
|
7740
|
+
sheep: "animal",
|
|
7741
|
+
cow: "animal",
|
|
7742
|
+
elephant: "animal",
|
|
7743
|
+
bear: "animal",
|
|
7744
|
+
zebra: "animal",
|
|
7745
|
+
giraffe: "animal",
|
|
7746
|
+
suitcase: "package",
|
|
7747
|
+
backpack: "package",
|
|
7748
|
+
handbag: "package"
|
|
7749
|
+
},
|
|
7750
|
+
preserveOriginal: false
|
|
7751
|
+
};
|
|
7752
|
+
var AUDIO_MACRO_LABELS = [
|
|
7753
|
+
{
|
|
7754
|
+
id: "speech",
|
|
7755
|
+
name: "Speech",
|
|
7756
|
+
icon: "🗣️"
|
|
7757
|
+
},
|
|
7758
|
+
{
|
|
7759
|
+
id: "scream",
|
|
7760
|
+
name: "Scream / Shout",
|
|
7761
|
+
icon: "😱"
|
|
7762
|
+
},
|
|
7763
|
+
{
|
|
7764
|
+
id: "crying",
|
|
7765
|
+
name: "Crying / Baby",
|
|
7766
|
+
icon: "😢"
|
|
7767
|
+
},
|
|
7768
|
+
{
|
|
7769
|
+
id: "laughter",
|
|
7770
|
+
name: "Laughter",
|
|
7771
|
+
icon: "😂"
|
|
7772
|
+
},
|
|
7773
|
+
{
|
|
7774
|
+
id: "music",
|
|
7775
|
+
name: "Music",
|
|
7776
|
+
icon: "🎵"
|
|
7777
|
+
},
|
|
7778
|
+
{
|
|
7779
|
+
id: "dog",
|
|
7780
|
+
name: "Dog",
|
|
7781
|
+
icon: "🐕"
|
|
7782
|
+
},
|
|
7783
|
+
{
|
|
7784
|
+
id: "cat",
|
|
7785
|
+
name: "Cat",
|
|
7786
|
+
icon: "🐈"
|
|
7787
|
+
},
|
|
7788
|
+
{
|
|
7789
|
+
id: "bird",
|
|
7790
|
+
name: "Bird",
|
|
7791
|
+
icon: "🐦"
|
|
7792
|
+
},
|
|
7793
|
+
{
|
|
7794
|
+
id: "animal",
|
|
7795
|
+
name: "Animal (other)",
|
|
7796
|
+
icon: "🐾"
|
|
7797
|
+
},
|
|
7798
|
+
{
|
|
7799
|
+
id: "alarm",
|
|
7800
|
+
name: "Alarm / Siren",
|
|
7801
|
+
icon: "🚨"
|
|
7802
|
+
},
|
|
7803
|
+
{
|
|
7804
|
+
id: "doorbell",
|
|
7805
|
+
name: "Doorbell / Knock",
|
|
7806
|
+
icon: "🔔"
|
|
7807
|
+
},
|
|
7808
|
+
{
|
|
7809
|
+
id: "glass_breaking",
|
|
7810
|
+
name: "Glass Breaking",
|
|
7811
|
+
icon: "💥"
|
|
7812
|
+
},
|
|
7813
|
+
{
|
|
7814
|
+
id: "gunshot",
|
|
7815
|
+
name: "Gunshot / Explosion",
|
|
7816
|
+
icon: "💣"
|
|
7817
|
+
},
|
|
7818
|
+
{
|
|
7819
|
+
id: "vehicle",
|
|
7820
|
+
name: "Vehicle",
|
|
7821
|
+
icon: "🚗"
|
|
7822
|
+
},
|
|
7823
|
+
{
|
|
7824
|
+
id: "siren",
|
|
7825
|
+
name: "Emergency Siren",
|
|
7826
|
+
icon: "🚑"
|
|
7827
|
+
},
|
|
7828
|
+
{
|
|
7829
|
+
id: "fire",
|
|
7830
|
+
name: "Fire / Smoke",
|
|
7831
|
+
icon: "🔥"
|
|
7832
|
+
},
|
|
7833
|
+
{
|
|
7834
|
+
id: "water",
|
|
7835
|
+
name: "Water",
|
|
7836
|
+
icon: "💧"
|
|
7837
|
+
},
|
|
7838
|
+
{
|
|
7839
|
+
id: "wind",
|
|
7840
|
+
name: "Wind / Weather",
|
|
7841
|
+
icon: "🌬️"
|
|
7842
|
+
},
|
|
7843
|
+
{
|
|
7844
|
+
id: "door",
|
|
7845
|
+
name: "Door",
|
|
7846
|
+
icon: "🚪"
|
|
7847
|
+
},
|
|
7848
|
+
{
|
|
7849
|
+
id: "footsteps",
|
|
7850
|
+
name: "Footsteps",
|
|
7851
|
+
icon: "👣"
|
|
7852
|
+
},
|
|
7853
|
+
{
|
|
7854
|
+
id: "crowd",
|
|
7855
|
+
name: "Crowd / Chatter",
|
|
7856
|
+
icon: "👥"
|
|
7857
|
+
},
|
|
7858
|
+
{
|
|
7859
|
+
id: "telephone",
|
|
7860
|
+
name: "Telephone",
|
|
7861
|
+
icon: "📞"
|
|
7862
|
+
},
|
|
7863
|
+
{
|
|
7864
|
+
id: "engine",
|
|
7865
|
+
name: "Engine / Motor",
|
|
7866
|
+
icon: "⚙️"
|
|
7867
|
+
},
|
|
7868
|
+
{
|
|
7869
|
+
id: "tools",
|
|
7870
|
+
name: "Tools / Construction",
|
|
7871
|
+
icon: "🔨"
|
|
7872
|
+
},
|
|
7873
|
+
{
|
|
7874
|
+
id: "silence",
|
|
7875
|
+
name: "Silence",
|
|
7876
|
+
icon: "🤫"
|
|
7877
|
+
}
|
|
7878
|
+
];
|
|
7651
7879
|
var YAMNET_TO_MACRO = {
|
|
7652
7880
|
mapping: {
|
|
7653
7881
|
Speech: "speech",
|
|
@@ -7914,6 +8142,133 @@ var _macroLookup = /* @__PURE__ */ new Map();
|
|
|
7914
8142
|
for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7915
8143
|
for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7916
8144
|
/**
|
|
8145
|
+
* Unified event-kind taxonomy — THE single source of truth for
|
|
8146
|
+
* `kind → { parentKind, category, level, color, iconId, labelKey, label,
|
|
8147
|
+
* icon }`.
|
|
8148
|
+
*
|
|
8149
|
+
* This dictionary folds together what used to be scattered across four
|
|
8150
|
+
* copies:
|
|
8151
|
+
* - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
|
|
8152
|
+
* - `addon-post-analysis/.../services/event-kinds.ts`
|
|
8153
|
+
* (MOTION/PERSON/VEHICLE… _COLOR constants)
|
|
8154
|
+
* - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
|
|
8155
|
+
* - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
|
|
8156
|
+
* - the COCO / audio class maps (macro ↔ sub relationships)
|
|
8157
|
+
*
|
|
8158
|
+
* The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
|
|
8159
|
+
* `@camstack/types`. The UI-side mapping `iconId → lucide component` and
|
|
8160
|
+
* `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
|
|
8161
|
+
* color or an icon: they read this dictionary (server descriptors carry the
|
|
8162
|
+
* fields inline; the client resolves color/icon/label from `iconId`/`kind`).
|
|
8163
|
+
*
|
|
8164
|
+
* Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
|
|
8165
|
+
*/
|
|
8166
|
+
var TAXONOMY_COLORS = {
|
|
8167
|
+
motion: "#f59e0b",
|
|
8168
|
+
audio: "#06b6d4",
|
|
8169
|
+
person: "#22c55e",
|
|
8170
|
+
vehicle: "#3b82f6",
|
|
8171
|
+
animal: "#f97316",
|
|
8172
|
+
package: "#a855f7",
|
|
8173
|
+
sensor: "#8b5cf6",
|
|
8174
|
+
control: "#10b981",
|
|
8175
|
+
genericDetection: "#64748b"
|
|
8176
|
+
};
|
|
8177
|
+
/** Global default color when a kind is unknown (matches legacy box-drawer). */
|
|
8178
|
+
var DEFAULT_EVENT_COLOR = "#22ff55";
|
|
8179
|
+
var DETECTION_SUB_COLORS = {
|
|
8180
|
+
car: "#f59e0b",
|
|
8181
|
+
truck: "#d97706",
|
|
8182
|
+
bus: "#b45309",
|
|
8183
|
+
motorcycle: "#eab308",
|
|
8184
|
+
bicycle: "#ca8a04",
|
|
8185
|
+
airplane: "#60a5fa",
|
|
8186
|
+
boat: "#2563eb",
|
|
8187
|
+
train: "#1d4ed8",
|
|
8188
|
+
bird: "#14b8a6",
|
|
8189
|
+
dog: "#84cc16",
|
|
8190
|
+
cat: "#f97316",
|
|
8191
|
+
horse: "#a16207",
|
|
8192
|
+
sheep: "#a3a3a3",
|
|
8193
|
+
cow: "#78716c",
|
|
8194
|
+
elephant: "#6b7280",
|
|
8195
|
+
bear: "#7c2d12",
|
|
8196
|
+
zebra: "#404040",
|
|
8197
|
+
giraffe: "#d4a373"
|
|
8198
|
+
};
|
|
8199
|
+
function titleCase(id) {
|
|
8200
|
+
return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
|
|
8201
|
+
}
|
|
8202
|
+
var entries = /* @__PURE__ */ new Map();
|
|
8203
|
+
function macro(kind, category, color, iconId, label) {
|
|
8204
|
+
entries.set(kind, {
|
|
8205
|
+
kind,
|
|
8206
|
+
parentKind: null,
|
|
8207
|
+
level: "macro",
|
|
8208
|
+
category,
|
|
8209
|
+
color,
|
|
8210
|
+
iconId,
|
|
8211
|
+
labelKey: `eventKind.${kind}`,
|
|
8212
|
+
label
|
|
8213
|
+
});
|
|
8214
|
+
}
|
|
8215
|
+
function sub(kind, parentKind, category, color, iconId, label) {
|
|
8216
|
+
entries.set(kind, {
|
|
8217
|
+
kind,
|
|
8218
|
+
parentKind,
|
|
8219
|
+
level: "sub",
|
|
8220
|
+
category,
|
|
8221
|
+
color,
|
|
8222
|
+
iconId,
|
|
8223
|
+
labelKey: `eventKind.${kind}`,
|
|
8224
|
+
label
|
|
8225
|
+
});
|
|
8226
|
+
}
|
|
8227
|
+
macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
|
|
8228
|
+
macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
|
|
8229
|
+
macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
|
|
8230
|
+
macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
|
|
8231
|
+
macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
|
|
8232
|
+
macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
|
|
8233
|
+
macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
|
|
8234
|
+
macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
|
|
8235
|
+
for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
|
|
8236
|
+
if (macroClass !== "vehicle" && macroClass !== "animal") continue;
|
|
8237
|
+
if (entries.has(cocoClass)) continue;
|
|
8238
|
+
sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
|
|
8239
|
+
}
|
|
8240
|
+
sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
|
|
8241
|
+
sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
|
|
8242
|
+
sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
|
|
8243
|
+
sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
|
|
8244
|
+
sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
|
|
8245
|
+
sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
|
|
8246
|
+
sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
|
|
8247
|
+
sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
|
|
8248
|
+
sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
|
|
8249
|
+
sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
|
|
8250
|
+
sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
|
|
8251
|
+
sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
|
|
8252
|
+
sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
|
|
8253
|
+
sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
|
|
8254
|
+
sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
|
|
8255
|
+
sub("siren", "control", "control", "#dc2626", "siren", "Siren");
|
|
8256
|
+
sub("button", "control", "control", "#10b981", "button", "Button");
|
|
8257
|
+
sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
|
|
8258
|
+
for (const l of AUDIO_MACRO_LABELS) {
|
|
8259
|
+
const kind = `audio-${l.id}`;
|
|
8260
|
+
if (entries.has(kind)) continue;
|
|
8261
|
+
sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
|
|
8262
|
+
}
|
|
8263
|
+
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8264
|
+
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8265
|
+
/** The sub kinds whose `parentKind` is `macro` (empty for a leaf macro). */
|
|
8266
|
+
function subKindsOf(macro) {
|
|
8267
|
+
const out = [];
|
|
8268
|
+
for (const e of Object.values(EVENT_TAXONOMY)) if (e.parentKind === macro) out.push(e);
|
|
8269
|
+
return out;
|
|
8270
|
+
}
|
|
8271
|
+
/**
|
|
7917
8272
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
7918
8273
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
7919
8274
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -15957,17 +16312,30 @@ var EventKindCategorySchema = _enum([
|
|
|
15957
16312
|
"audio",
|
|
15958
16313
|
"detection",
|
|
15959
16314
|
"sensor",
|
|
16315
|
+
"control",
|
|
15960
16316
|
"custom",
|
|
15961
16317
|
"package"
|
|
15962
16318
|
]);
|
|
16319
|
+
/** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
|
|
16320
|
+
var EventKindLevelSchema = _enum(["macro", "sub"]);
|
|
15963
16321
|
var EventKindDescriptorSchema = object({
|
|
15964
|
-
/** Stable kind id (e.g. 'motion', '
|
|
16322
|
+
/** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
|
|
15965
16323
|
kind: string(),
|
|
16324
|
+
/** i18n key resolved on the UI side; `label` is the English fallback. */
|
|
16325
|
+
labelKey: string(),
|
|
16326
|
+
/** English fallback label (kept for clients that don't translate). */
|
|
15966
16327
|
label: string(),
|
|
15967
16328
|
/** Hex color for timeline/legend rendering. */
|
|
15968
16329
|
color: string(),
|
|
16330
|
+
/** Dictionary id → lucide component on the UI side. */
|
|
16331
|
+
iconId: string(),
|
|
16332
|
+
/** Legacy closed-vocab glyph — fallback for `iconId`. */
|
|
15969
16333
|
icon: EventKindIconSchema,
|
|
15970
16334
|
category: EventKindCategorySchema,
|
|
16335
|
+
/** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
|
|
16336
|
+
parentKind: string().nullable(),
|
|
16337
|
+
/** Derived from `parentKind`, explicit for the client tree. */
|
|
16338
|
+
level: EventKindLevelSchema,
|
|
15971
16339
|
/** Which cap + device contributes this kind. For built-ins the camera
|
|
15972
16340
|
* itself; for sensor kinds the LINKED source device. */
|
|
15973
16341
|
source: object({
|
|
@@ -16040,11 +16408,21 @@ var TrackAudioLabelSchema = object({
|
|
|
16040
16408
|
firstAt: number(),
|
|
16041
16409
|
lastAt: number()
|
|
16042
16410
|
});
|
|
16411
|
+
/**
|
|
16412
|
+
* How a track was produced. `pipeline` (default / absent) = the spatial
|
|
16413
|
+
* detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
|
|
16414
|
+
* linked sensor/control state change (no positions; carries a snapshot). The
|
|
16415
|
+
* spatial subsystems (tracker association, occupancy count, re-id/embedding,
|
|
16416
|
+
* resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
|
|
16417
|
+
*/
|
|
16418
|
+
var TrackSourceSchema = _enum(["pipeline", "sensor"]);
|
|
16043
16419
|
var TrackSchema = object({
|
|
16044
16420
|
trackId: string(),
|
|
16045
16421
|
deviceId: number(),
|
|
16046
16422
|
className: string(),
|
|
16047
16423
|
label: string().optional(),
|
|
16424
|
+
/** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
|
|
16425
|
+
source: TrackSourceSchema.optional(),
|
|
16048
16426
|
firstSeen: number(),
|
|
16049
16427
|
lastSeen: number(),
|
|
16050
16428
|
/** Frame-rate position history (subject to maxPositionHistory cap). */
|
|
@@ -16299,6 +16677,26 @@ var TrackCascadeCountsSchema = object({
|
|
|
16299
16677
|
/** Per-track CLIP search vectors removed (best-effort). */
|
|
16300
16678
|
embeddings: number().int()
|
|
16301
16679
|
});
|
|
16680
|
+
/** Event-store footprint for one camera. */
|
|
16681
|
+
var EventStoreDeviceFootprintSchema = object({
|
|
16682
|
+
deviceId: number(),
|
|
16683
|
+
/** Persisted event rows (motion + object + audio) for the camera. */
|
|
16684
|
+
rows: number().int(),
|
|
16685
|
+
/** Event-owned media bytes on disk for the camera. */
|
|
16686
|
+
bytes: number().int()
|
|
16687
|
+
});
|
|
16688
|
+
/** Aggregate event-store footprint: global totals + per-camera breakdown. */
|
|
16689
|
+
var EventStoreFootprintSchema = object({
|
|
16690
|
+
totalRows: number().int(),
|
|
16691
|
+
totalBytes: number().int(),
|
|
16692
|
+
devices: array(EventStoreDeviceFootprintSchema).readonly()
|
|
16693
|
+
});
|
|
16694
|
+
/** Per-kind counts returned by the event-prune / device-delete mutations. */
|
|
16695
|
+
var EventPruneCountsSchema = object({
|
|
16696
|
+
motion: number().int(),
|
|
16697
|
+
object: number().int(),
|
|
16698
|
+
audio: number().int()
|
|
16699
|
+
});
|
|
16302
16700
|
var pipelineAnalyticsCapability = {
|
|
16303
16701
|
name: "pipeline-analytics",
|
|
16304
16702
|
scope: "device",
|
|
@@ -16460,6 +16858,45 @@ var pipelineAnalyticsCapability = {
|
|
|
16460
16858
|
kind: "mutation",
|
|
16461
16859
|
auth: "admin"
|
|
16462
16860
|
}),
|
|
16861
|
+
/**
|
|
16862
|
+
* Durable event-store footprint for the management UI: event rows
|
|
16863
|
+
* (motion + object + audio) counted per camera + total, plus the
|
|
16864
|
+
* event-owned media bytes on disk per camera + total. Stat/count-based,
|
|
16865
|
+
* computed on demand.
|
|
16866
|
+
*/
|
|
16867
|
+
getEventStoreFootprint: method(object({}), EventStoreFootprintSchema, {
|
|
16868
|
+
kind: "query",
|
|
16869
|
+
auth: "admin"
|
|
16870
|
+
}),
|
|
16871
|
+
/**
|
|
16872
|
+
* Cluster-wide prune of events older than `olderThanMs` (exclusive) across
|
|
16873
|
+
* every camera, deleting each event's media in lockstep. Logged to the
|
|
16874
|
+
* events ops-log with `reason` (default `'retention'`). Returns the summed
|
|
16875
|
+
* per-kind deleted counts.
|
|
16876
|
+
*/
|
|
16877
|
+
pruneEvents: method(object({
|
|
16878
|
+
olderThanMs: number(),
|
|
16879
|
+
reason: OpsLogReasonSchema.optional()
|
|
16880
|
+
}), EventPruneCountsSchema, {
|
|
16881
|
+
kind: "mutation",
|
|
16882
|
+
auth: "admin"
|
|
16883
|
+
}),
|
|
16884
|
+
/**
|
|
16885
|
+
* Manually delete EVERY event (motion + object + audio) for one camera and
|
|
16886
|
+
* its event-owned media in lockstep. Logged to the events ops-log as
|
|
16887
|
+
* `op:'manual-delete', reason:'manual'`. Destructive — the admin UI guards
|
|
16888
|
+
* it behind a confirm.
|
|
16889
|
+
*/
|
|
16890
|
+
deleteDeviceEvents: method(object({ deviceId: number() }), EventPruneCountsSchema, {
|
|
16891
|
+
kind: "mutation",
|
|
16892
|
+
auth: "admin"
|
|
16893
|
+
}),
|
|
16894
|
+
/** The events ops-log rows (newest-first), optionally scoped to one camera.
|
|
16895
|
+
* Backed by a declared pipeline-analytics SQLite collection. */
|
|
16896
|
+
listOpsLog: method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
|
|
16897
|
+
kind: "query",
|
|
16898
|
+
auth: "admin"
|
|
16899
|
+
}),
|
|
16463
16900
|
getEventMedia: method(object({
|
|
16464
16901
|
eventId: string(),
|
|
16465
16902
|
kind: MediaFileKindEnum.optional()
|
|
@@ -16514,53 +16951,105 @@ var pipelineAnalyticsCapability = {
|
|
|
16514
16951
|
}
|
|
16515
16952
|
};
|
|
16516
16953
|
/**
|
|
16517
|
-
*
|
|
16518
|
-
*
|
|
16954
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
16955
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
16956
|
+
* caps into per-camera event-kind descriptors.
|
|
16957
|
+
*
|
|
16958
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
16959
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
16960
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
16961
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
16962
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
16963
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
16964
|
+
* eventful cap is missing.
|
|
16519
16965
|
*/
|
|
16520
|
-
|
|
16521
|
-
|
|
16522
|
-
|
|
16523
|
-
|
|
16524
|
-
|
|
16525
|
-
|
|
16526
|
-
|
|
16527
|
-
|
|
16528
|
-
|
|
16529
|
-
|
|
16530
|
-
|
|
16531
|
-
|
|
16532
|
-
|
|
16533
|
-
|
|
16534
|
-
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
|
|
16538
|
-
|
|
16539
|
-
|
|
16540
|
-
|
|
16541
|
-
|
|
16542
|
-
|
|
16543
|
-
|
|
16544
|
-
|
|
16545
|
-
|
|
16546
|
-
|
|
16547
|
-
|
|
16548
|
-
|
|
16549
|
-
|
|
16550
|
-
|
|
16551
|
-
|
|
16552
|
-
|
|
16553
|
-
|
|
16554
|
-
|
|
16555
|
-
|
|
16556
|
-
"
|
|
16557
|
-
|
|
16558
|
-
|
|
16559
|
-
|
|
16560
|
-
|
|
16561
|
-
|
|
16562
|
-
|
|
16966
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
16967
|
+
var LEGACY_ICON = {
|
|
16968
|
+
motion: "motion",
|
|
16969
|
+
audio: "audio",
|
|
16970
|
+
person: "person",
|
|
16971
|
+
vehicle: "vehicle",
|
|
16972
|
+
animal: "animal",
|
|
16973
|
+
package: "package",
|
|
16974
|
+
door: "door",
|
|
16975
|
+
pir: "pir",
|
|
16976
|
+
smoke: "smoke",
|
|
16977
|
+
water: "water",
|
|
16978
|
+
button: "button",
|
|
16979
|
+
generic: "generic",
|
|
16980
|
+
gas: "smoke",
|
|
16981
|
+
vibration: "generic",
|
|
16982
|
+
tamper: "generic",
|
|
16983
|
+
presence: "person",
|
|
16984
|
+
lock: "generic",
|
|
16985
|
+
siren: "generic",
|
|
16986
|
+
switch: "generic",
|
|
16987
|
+
doorbell: "button"
|
|
16988
|
+
};
|
|
16989
|
+
function legacyIcon(iconId) {
|
|
16990
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
16991
|
+
}
|
|
16992
|
+
/**
|
|
16993
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
16994
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
16995
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
16996
|
+
*/
|
|
16997
|
+
var CAP_TO_KIND = {
|
|
16998
|
+
contact: "contact",
|
|
16999
|
+
motion: "motion-sensor",
|
|
17000
|
+
smoke: "smoke",
|
|
17001
|
+
flood: "flood",
|
|
17002
|
+
gas: "gas",
|
|
17003
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
17004
|
+
vibration: "vibration",
|
|
17005
|
+
tamper: "tamper",
|
|
17006
|
+
presence: "presence",
|
|
17007
|
+
"enum-sensor": "enum-sensor",
|
|
17008
|
+
"event-emitter": "device-event",
|
|
17009
|
+
"lock-control": "lock",
|
|
17010
|
+
switch: "switch",
|
|
17011
|
+
button: "button",
|
|
17012
|
+
doorbell: "doorbell"
|
|
16563
17013
|
};
|
|
17014
|
+
function buildDescriptor(capName, kind) {
|
|
17015
|
+
const t = EVENT_TAXONOMY[kind];
|
|
17016
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
17017
|
+
return {
|
|
17018
|
+
...t,
|
|
17019
|
+
icon: legacyIcon(t.iconId)
|
|
17020
|
+
};
|
|
17021
|
+
}
|
|
17022
|
+
/**
|
|
17023
|
+
* Sensor / control cap name → static event-kind descriptor. A linked device
|
|
17024
|
+
* contributes one entry per bound cap present in this map.
|
|
17025
|
+
*/
|
|
17026
|
+
var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
17027
|
+
/**
|
|
17028
|
+
* Build a full `EventKindDescriptor` for a taxonomy `kind`, stamping the
|
|
17029
|
+
* per-device `source`. Returns null when `kind` is not in the taxonomy.
|
|
17030
|
+
* This is THE bridge from the serializable taxonomy dictionary to the cap
|
|
17031
|
+
* wire shape — every event-kind descriptor the server emits goes through it,
|
|
17032
|
+
* so color/iconId/labelKey are never re-declared at a call site.
|
|
17033
|
+
*/
|
|
17034
|
+
function buildEventKindDescriptor(kind, source) {
|
|
17035
|
+
const t = EVENT_TAXONOMY[kind];
|
|
17036
|
+
if (t === void 0) return null;
|
|
17037
|
+
return {
|
|
17038
|
+
kind: t.kind,
|
|
17039
|
+
labelKey: t.labelKey,
|
|
17040
|
+
label: t.label,
|
|
17041
|
+
color: t.color,
|
|
17042
|
+
iconId: t.iconId,
|
|
17043
|
+
icon: legacyIcon(t.iconId),
|
|
17044
|
+
category: t.category,
|
|
17045
|
+
parentKind: t.parentKind,
|
|
17046
|
+
level: t.level,
|
|
17047
|
+
source: {
|
|
17048
|
+
capName: source.capName,
|
|
17049
|
+
deviceId: source.deviceId
|
|
17050
|
+
}
|
|
17051
|
+
};
|
|
17052
|
+
}
|
|
16564
17053
|
var CameraPipelineConfigSchema = object({
|
|
16565
17054
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
16566
17055
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -19840,13 +20329,29 @@ method(object({
|
|
|
19840
20329
|
}), method(object({ deviceId: number() }), RecordingStatusSchema, {
|
|
19841
20330
|
kind: "mutation",
|
|
19842
20331
|
auth: "admin"
|
|
19843
|
-
}), method(object({
|
|
20332
|
+
}), method(object({
|
|
20333
|
+
deviceId: number(),
|
|
20334
|
+
reason: OpsLogReasonSchema.optional()
|
|
20335
|
+
}), object({
|
|
19844
20336
|
floorMs: number().nullable(),
|
|
19845
20337
|
deletedBuckets: number().int(),
|
|
19846
20338
|
reclaimedBytes: number().int()
|
|
19847
20339
|
}), {
|
|
19848
20340
|
kind: "mutation",
|
|
19849
20341
|
auth: "admin"
|
|
20342
|
+
}), method(object({
|
|
20343
|
+
deviceId: number(),
|
|
20344
|
+
fromMs: number().optional(),
|
|
20345
|
+
toMs: number().optional()
|
|
20346
|
+
}), object({
|
|
20347
|
+
deletedBuckets: number().int(),
|
|
20348
|
+
reclaimedBytes: number().int()
|
|
20349
|
+
}), {
|
|
20350
|
+
kind: "mutation",
|
|
20351
|
+
auth: "admin"
|
|
20352
|
+
}), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
|
|
20353
|
+
kind: "query",
|
|
20354
|
+
auth: "admin"
|
|
19850
20355
|
});
|
|
19851
20356
|
/**
|
|
19852
20357
|
* `recordingExport` cap — render a footage time range into a single downloadable
|
|
@@ -22968,6 +23473,12 @@ Object.freeze({
|
|
|
22968
23473
|
addonId: null,
|
|
22969
23474
|
access: "delete"
|
|
22970
23475
|
},
|
|
23476
|
+
"pipelineAnalytics.deleteDeviceEvents": {
|
|
23477
|
+
capName: "pipeline-analytics",
|
|
23478
|
+
capScope: "device",
|
|
23479
|
+
addonId: null,
|
|
23480
|
+
access: "delete"
|
|
23481
|
+
},
|
|
22971
23482
|
"pipelineAnalytics.deleteTracks": {
|
|
22972
23483
|
capName: "pipeline-analytics",
|
|
22973
23484
|
capScope: "device",
|
|
@@ -22998,6 +23509,12 @@ Object.freeze({
|
|
|
22998
23509
|
addonId: null,
|
|
22999
23510
|
access: "view"
|
|
23000
23511
|
},
|
|
23512
|
+
"pipelineAnalytics.getEventStoreFootprint": {
|
|
23513
|
+
capName: "pipeline-analytics",
|
|
23514
|
+
capScope: "device",
|
|
23515
|
+
addonId: null,
|
|
23516
|
+
access: "view"
|
|
23517
|
+
},
|
|
23001
23518
|
"pipelineAnalytics.getKeyEvents": {
|
|
23002
23519
|
capName: "pipeline-analytics",
|
|
23003
23520
|
capScope: "device",
|
|
@@ -23040,6 +23557,12 @@ Object.freeze({
|
|
|
23040
23557
|
addonId: null,
|
|
23041
23558
|
access: "view"
|
|
23042
23559
|
},
|
|
23560
|
+
"pipelineAnalytics.listOpsLog": {
|
|
23561
|
+
capName: "pipeline-analytics",
|
|
23562
|
+
capScope: "device",
|
|
23563
|
+
addonId: null,
|
|
23564
|
+
access: "view"
|
|
23565
|
+
},
|
|
23043
23566
|
"pipelineAnalytics.listRecentTracks": {
|
|
23044
23567
|
capName: "pipeline-analytics",
|
|
23045
23568
|
capScope: "device",
|
|
@@ -23052,6 +23575,12 @@ Object.freeze({
|
|
|
23052
23575
|
addonId: null,
|
|
23053
23576
|
access: "view"
|
|
23054
23577
|
},
|
|
23578
|
+
"pipelineAnalytics.pruneEvents": {
|
|
23579
|
+
capName: "pipeline-analytics",
|
|
23580
|
+
capScope: "device",
|
|
23581
|
+
addonId: null,
|
|
23582
|
+
access: "create"
|
|
23583
|
+
},
|
|
23055
23584
|
"pipelineAnalytics.pruneEventsBefore": {
|
|
23056
23585
|
capName: "pipeline-analytics",
|
|
23057
23586
|
capScope: "device",
|
|
@@ -23814,6 +24343,12 @@ Object.freeze({
|
|
|
23814
24343
|
addonId: null,
|
|
23815
24344
|
access: "create"
|
|
23816
24345
|
},
|
|
24346
|
+
"recording.deleteFootprint": {
|
|
24347
|
+
capName: "recording",
|
|
24348
|
+
capScope: "system",
|
|
24349
|
+
addonId: null,
|
|
24350
|
+
access: "delete"
|
|
24351
|
+
},
|
|
23817
24352
|
"recording.getAvailability": {
|
|
23818
24353
|
capName: "recording",
|
|
23819
24354
|
capScope: "system",
|
|
@@ -23844,6 +24379,12 @@ Object.freeze({
|
|
|
23844
24379
|
addonId: null,
|
|
23845
24380
|
access: "view"
|
|
23846
24381
|
},
|
|
24382
|
+
"recording.listOpsLog": {
|
|
24383
|
+
capName: "recording",
|
|
24384
|
+
capScope: "system",
|
|
24385
|
+
addonId: null,
|
|
24386
|
+
access: "view"
|
|
24387
|
+
},
|
|
23847
24388
|
"recording.locateSegment": {
|
|
23848
24389
|
capName: "recording",
|
|
23849
24390
|
capScope: "system",
|
|
@@ -25069,4 +25610,4 @@ object({
|
|
|
25069
25610
|
schemaVersion: literal(1)
|
|
25070
25611
|
});
|
|
25071
25612
|
//#endregion
|
|
25072
|
-
export {
|
|
25613
|
+
export { hydrateSchema as C, object as D, number as E, string as O, createEvent as S, boolean as T, videoclipsCapability as _, OpsLogEntrySchema as a, BaseAddon as b, buildEventKindDescriptor as c, faceGalleryCapability as d, hfModelUrl as f, subKindsOf as g, plateGalleryCapability as h, MACRO_LABELS as i, EventCategory as k, cosineSimilarity as l, pipelineAnalyticsCapability as m, EVENT_KIND_BY_CAP as n, addonWidgetsSourceCapability as o, nodePin as p, EVENT_PAD_MS as r, audioMetricsCapability as s, DEFAULT_EVENT_COLOR as t, embeddingEncoderCapability as u, zoneAnalyticsCapability as v, array as w, DeviceType as x, errMsg as y };
|