@camstack/addon-provider-dreame 0.1.32 → 0.1.34

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
@@ -7396,6 +7396,62 @@ var RecordingConfigSchema = object({
7396
7396
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7397
7397
  });
7398
7398
  /**
7399
+ * Ops-log — the durable, append-only operations audit shared by the
7400
+ * recordings and events management surfaces.
7401
+ *
7402
+ * ONE row shape is reused for both domains so a single "Activity" view can
7403
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7404
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7405
+ * management operation, WHY it ran (reason), and its measurable effect
7406
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7407
+ * never fail the operation it records.
7408
+ */
7409
+ /** Which management domain the operation belongs to. */
7410
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7411
+ /** The kind of management operation performed. */
7412
+ var OpsLogOpSchema = _enum([
7413
+ "prune",
7414
+ "manual-delete",
7415
+ "rescan",
7416
+ "retention-run"
7417
+ ]);
7418
+ /** Why the operation ran. */
7419
+ var OpsLogReasonSchema = _enum([
7420
+ "retention",
7421
+ "quota",
7422
+ "manual",
7423
+ "operator"
7424
+ ]);
7425
+ /** One audit row, shared verbatim by both domains. */
7426
+ var OpsLogEntrySchema = object({
7427
+ /** Unique row id. */
7428
+ id: string(),
7429
+ /** Epoch ms the operation completed. */
7430
+ at: number(),
7431
+ domain: OpsLogDomainSchema,
7432
+ op: OpsLogOpSchema,
7433
+ reason: OpsLogReasonSchema,
7434
+ /** The camera the op targeted; null for a cluster/global op. */
7435
+ deviceId: number().nullable(),
7436
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7437
+ nodeId: string(),
7438
+ /** Buckets / rows deleted (op-specific unit). */
7439
+ itemsAffected: number(),
7440
+ /** Bytes reclaimed by the op (0 when not measurable). */
7441
+ bytesReclaimed: number(),
7442
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7443
+ detail: string().nullable(),
7444
+ /** Who/what triggered the op. */
7445
+ actor: string()
7446
+ });
7447
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7448
+ var OpsLogQueryInputSchema = object({
7449
+ /** Restrict to a single camera; omit for every row. */
7450
+ deviceId: number().optional(),
7451
+ /** Max rows returned, newest-first. */
7452
+ limit: number().int().min(1).max(1e3).optional()
7453
+ });
7454
+ /**
7399
7455
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7400
7456
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7401
7457
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7639,6 +7695,160 @@ var EncodeProfileSchema = object({
7639
7695
  */
7640
7696
  outputArgs: array(string()).optional()
7641
7697
  });
7698
+ var COCO_TO_MACRO = {
7699
+ mapping: {
7700
+ person: "person",
7701
+ bicycle: "vehicle",
7702
+ car: "vehicle",
7703
+ motorcycle: "vehicle",
7704
+ airplane: "vehicle",
7705
+ bus: "vehicle",
7706
+ train: "vehicle",
7707
+ truck: "vehicle",
7708
+ boat: "vehicle",
7709
+ bird: "animal",
7710
+ cat: "animal",
7711
+ dog: "animal",
7712
+ horse: "animal",
7713
+ sheep: "animal",
7714
+ cow: "animal",
7715
+ elephant: "animal",
7716
+ bear: "animal",
7717
+ zebra: "animal",
7718
+ giraffe: "animal",
7719
+ suitcase: "package",
7720
+ backpack: "package",
7721
+ handbag: "package"
7722
+ },
7723
+ preserveOriginal: false
7724
+ };
7725
+ var AUDIO_MACRO_LABELS = [
7726
+ {
7727
+ id: "speech",
7728
+ name: "Speech",
7729
+ icon: "🗣️"
7730
+ },
7731
+ {
7732
+ id: "scream",
7733
+ name: "Scream / Shout",
7734
+ icon: "😱"
7735
+ },
7736
+ {
7737
+ id: "crying",
7738
+ name: "Crying / Baby",
7739
+ icon: "😢"
7740
+ },
7741
+ {
7742
+ id: "laughter",
7743
+ name: "Laughter",
7744
+ icon: "😂"
7745
+ },
7746
+ {
7747
+ id: "music",
7748
+ name: "Music",
7749
+ icon: "🎵"
7750
+ },
7751
+ {
7752
+ id: "dog",
7753
+ name: "Dog",
7754
+ icon: "🐕"
7755
+ },
7756
+ {
7757
+ id: "cat",
7758
+ name: "Cat",
7759
+ icon: "🐈"
7760
+ },
7761
+ {
7762
+ id: "bird",
7763
+ name: "Bird",
7764
+ icon: "🐦"
7765
+ },
7766
+ {
7767
+ id: "animal",
7768
+ name: "Animal (other)",
7769
+ icon: "🐾"
7770
+ },
7771
+ {
7772
+ id: "alarm",
7773
+ name: "Alarm / Siren",
7774
+ icon: "🚨"
7775
+ },
7776
+ {
7777
+ id: "doorbell",
7778
+ name: "Doorbell / Knock",
7779
+ icon: "🔔"
7780
+ },
7781
+ {
7782
+ id: "glass_breaking",
7783
+ name: "Glass Breaking",
7784
+ icon: "💥"
7785
+ },
7786
+ {
7787
+ id: "gunshot",
7788
+ name: "Gunshot / Explosion",
7789
+ icon: "💣"
7790
+ },
7791
+ {
7792
+ id: "vehicle",
7793
+ name: "Vehicle",
7794
+ icon: "🚗"
7795
+ },
7796
+ {
7797
+ id: "siren",
7798
+ name: "Emergency Siren",
7799
+ icon: "🚑"
7800
+ },
7801
+ {
7802
+ id: "fire",
7803
+ name: "Fire / Smoke",
7804
+ icon: "🔥"
7805
+ },
7806
+ {
7807
+ id: "water",
7808
+ name: "Water",
7809
+ icon: "💧"
7810
+ },
7811
+ {
7812
+ id: "wind",
7813
+ name: "Wind / Weather",
7814
+ icon: "🌬️"
7815
+ },
7816
+ {
7817
+ id: "door",
7818
+ name: "Door",
7819
+ icon: "🚪"
7820
+ },
7821
+ {
7822
+ id: "footsteps",
7823
+ name: "Footsteps",
7824
+ icon: "👣"
7825
+ },
7826
+ {
7827
+ id: "crowd",
7828
+ name: "Crowd / Chatter",
7829
+ icon: "👥"
7830
+ },
7831
+ {
7832
+ id: "telephone",
7833
+ name: "Telephone",
7834
+ icon: "📞"
7835
+ },
7836
+ {
7837
+ id: "engine",
7838
+ name: "Engine / Motor",
7839
+ icon: "⚙️"
7840
+ },
7841
+ {
7842
+ id: "tools",
7843
+ name: "Tools / Construction",
7844
+ icon: "🔨"
7845
+ },
7846
+ {
7847
+ id: "silence",
7848
+ name: "Silence",
7849
+ icon: "🤫"
7850
+ }
7851
+ ];
7642
7852
  var YAMNET_TO_MACRO = {
7643
7853
  mapping: {
7644
7854
  Speech: "speech",
@@ -7905,6 +8115,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7905
8115
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7906
8116
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7907
8117
  /**
8118
+ * Unified event-kind taxonomy — THE single source of truth for
8119
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8120
+ * icon }`.
8121
+ *
8122
+ * This dictionary folds together what used to be scattered across four
8123
+ * copies:
8124
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8125
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8126
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8127
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8128
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8129
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8130
+ *
8131
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8132
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8133
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8134
+ * color or an icon: they read this dictionary (server descriptors carry the
8135
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8136
+ *
8137
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8138
+ */
8139
+ var TAXONOMY_COLORS = {
8140
+ motion: "#f59e0b",
8141
+ audio: "#06b6d4",
8142
+ person: "#22c55e",
8143
+ vehicle: "#3b82f6",
8144
+ animal: "#f97316",
8145
+ package: "#a855f7",
8146
+ sensor: "#8b5cf6",
8147
+ control: "#10b981",
8148
+ genericDetection: "#64748b"
8149
+ };
8150
+ var DETECTION_SUB_COLORS = {
8151
+ car: "#f59e0b",
8152
+ truck: "#d97706",
8153
+ bus: "#b45309",
8154
+ motorcycle: "#eab308",
8155
+ bicycle: "#ca8a04",
8156
+ airplane: "#60a5fa",
8157
+ boat: "#2563eb",
8158
+ train: "#1d4ed8",
8159
+ bird: "#14b8a6",
8160
+ dog: "#84cc16",
8161
+ cat: "#f97316",
8162
+ horse: "#a16207",
8163
+ sheep: "#a3a3a3",
8164
+ cow: "#78716c",
8165
+ elephant: "#6b7280",
8166
+ bear: "#7c2d12",
8167
+ zebra: "#404040",
8168
+ giraffe: "#d4a373"
8169
+ };
8170
+ function titleCase(id) {
8171
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8172
+ }
8173
+ var entries = /* @__PURE__ */ new Map();
8174
+ function macro(kind, category, color, iconId, label) {
8175
+ entries.set(kind, {
8176
+ kind,
8177
+ parentKind: null,
8178
+ level: "macro",
8179
+ category,
8180
+ color,
8181
+ iconId,
8182
+ labelKey: `eventKind.${kind}`,
8183
+ label
8184
+ });
8185
+ }
8186
+ function sub(kind, parentKind, category, color, iconId, label) {
8187
+ entries.set(kind, {
8188
+ kind,
8189
+ parentKind,
8190
+ level: "sub",
8191
+ category,
8192
+ color,
8193
+ iconId,
8194
+ labelKey: `eventKind.${kind}`,
8195
+ label
8196
+ });
8197
+ }
8198
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8199
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8200
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8201
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8202
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8203
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8204
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8205
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8206
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8207
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8208
+ if (entries.has(cocoClass)) continue;
8209
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8210
+ }
8211
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8212
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8213
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8214
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8215
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8216
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8217
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8218
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8219
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8220
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8221
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8222
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8223
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8224
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8225
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8226
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8227
+ sub("button", "control", "control", "#10b981", "button", "Button");
8228
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8229
+ for (const l of AUDIO_MACRO_LABELS) {
8230
+ const kind = `audio-${l.id}`;
8231
+ if (entries.has(kind)) continue;
8232
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8233
+ }
8234
+ /** The complete taxonomy dictionary, keyed by kind. */
8235
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8236
+ /**
7908
8237
  * Error types for the safe expression engine. Two distinct classes so callers
7909
8238
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7910
8239
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -14859,9 +15188,10 @@ var DEVICE_LOCAL_STATE_CAPS = {
14859
15188
  * `package` backs the package-drop detector — a package zone is a
14860
15189
  * `ZoneRule` on the `'package'` stage referencing drawn polygons
14861
15190
  * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14862
- * The orchestrator provider that writes this stage lands in a later
14863
- * slice; until then the mirror carries only `{motion, detection}` and
14864
- * consumers read `package` as absent (treat as `[]`).
15191
+ * The orchestrator provider writes this stage as a first-class slice
15192
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
15193
+ * package}` shape, so consumers read the current package rules directly
15194
+ * off `device.state.zoneRules.value.package`.
14865
15195
  */
14866
15196
  runtimeState: object({
14867
15197
  motion: array(ZoneRuleSchema).readonly(),
@@ -18853,17 +19183,30 @@ var EventKindCategorySchema = _enum([
18853
19183
  "audio",
18854
19184
  "detection",
18855
19185
  "sensor",
19186
+ "control",
18856
19187
  "custom",
18857
19188
  "package"
18858
19189
  ]);
19190
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19191
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18859
19192
  var EventKindDescriptorSchema = object({
18860
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19193
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18861
19194
  kind: string(),
19195
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19196
+ labelKey: string(),
19197
+ /** English fallback label (kept for clients that don't translate). */
18862
19198
  label: string(),
18863
19199
  /** Hex color for timeline/legend rendering. */
18864
19200
  color: string(),
19201
+ /** Dictionary id → lucide component on the UI side. */
19202
+ iconId: string(),
19203
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18865
19204
  icon: EventKindIconSchema,
18866
19205
  category: EventKindCategorySchema,
19206
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19207
+ parentKind: string().nullable(),
19208
+ /** Derived from `parentKind`, explicit for the client tree. */
19209
+ level: EventKindLevelSchema,
18867
19210
  /** Which cap + device contributes this kind. For built-ins the camera
18868
19211
  * itself; for sensor kinds the LINKED source device. */
18869
19212
  source: object({
@@ -18936,11 +19279,21 @@ var TrackAudioLabelSchema = object({
18936
19279
  firstAt: number(),
18937
19280
  lastAt: number()
18938
19281
  });
19282
+ /**
19283
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19284
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19285
+ * linked sensor/control state change (no positions; carries a snapshot). The
19286
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19287
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19288
+ */
19289
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18939
19290
  var TrackSchema = object({
18940
19291
  trackId: string(),
18941
19292
  deviceId: number(),
18942
19293
  className: string(),
18943
19294
  label: string().optional(),
19295
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19296
+ source: TrackSourceSchema.optional(),
18944
19297
  firstSeen: number(),
18945
19298
  lastSeen: number(),
18946
19299
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19195,6 +19548,26 @@ var TrackCascadeCountsSchema = object({
19195
19548
  /** Per-track CLIP search vectors removed (best-effort). */
19196
19549
  embeddings: number().int()
19197
19550
  });
19551
+ /** Event-store footprint for one camera. */
19552
+ var EventStoreDeviceFootprintSchema = object({
19553
+ deviceId: number(),
19554
+ /** Persisted event rows (motion + object + audio) for the camera. */
19555
+ rows: number().int(),
19556
+ /** Event-owned media bytes on disk for the camera. */
19557
+ bytes: number().int()
19558
+ });
19559
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19560
+ var EventStoreFootprintSchema = object({
19561
+ totalRows: number().int(),
19562
+ totalBytes: number().int(),
19563
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19564
+ });
19565
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19566
+ var EventPruneCountsSchema = object({
19567
+ motion: number().int(),
19568
+ object: number().int(),
19569
+ audio: number().int()
19570
+ });
19198
19571
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19199
19572
  deviceId: number(),
19200
19573
  trackId: string()
@@ -19258,6 +19631,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19258
19631
  }), {
19259
19632
  kind: "mutation",
19260
19633
  auth: "admin"
19634
+ }), method(object({}), EventStoreFootprintSchema, {
19635
+ kind: "query",
19636
+ auth: "admin"
19637
+ }), method(object({
19638
+ olderThanMs: number(),
19639
+ reason: OpsLogReasonSchema.optional()
19640
+ }), EventPruneCountsSchema, {
19641
+ kind: "mutation",
19642
+ auth: "admin"
19643
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19644
+ kind: "mutation",
19645
+ auth: "admin"
19646
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19647
+ kind: "query",
19648
+ auth: "admin"
19261
19649
  }), method(object({
19262
19650
  eventId: string(),
19263
19651
  kind: MediaFileKindEnum.optional()
@@ -19282,6 +19670,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19282
19670
  eventId: string(),
19283
19671
  timestamp: number()
19284
19672
  });
19673
+ /**
19674
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19675
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19676
+ * caps into per-camera event-kind descriptors.
19677
+ *
19678
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19679
+ * is NOT duplicated here — every entry is derived from the single
19680
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19681
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19682
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19683
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19684
+ * eventful cap is missing.
19685
+ */
19686
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19687
+ var LEGACY_ICON = {
19688
+ motion: "motion",
19689
+ audio: "audio",
19690
+ person: "person",
19691
+ vehicle: "vehicle",
19692
+ animal: "animal",
19693
+ package: "package",
19694
+ door: "door",
19695
+ pir: "pir",
19696
+ smoke: "smoke",
19697
+ water: "water",
19698
+ button: "button",
19699
+ generic: "generic",
19700
+ gas: "smoke",
19701
+ vibration: "generic",
19702
+ tamper: "generic",
19703
+ presence: "person",
19704
+ lock: "generic",
19705
+ siren: "generic",
19706
+ switch: "generic",
19707
+ doorbell: "button"
19708
+ };
19709
+ function legacyIcon(iconId) {
19710
+ return LEGACY_ICON[iconId] ?? "generic";
19711
+ }
19712
+ /**
19713
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19714
+ * The anti-drift guard cross-checks this against the eventful caps declared
19715
+ * in `packages/types/src/capabilities/*.cap.ts`.
19716
+ */
19717
+ var CAP_TO_KIND = {
19718
+ contact: "contact",
19719
+ motion: "motion-sensor",
19720
+ smoke: "smoke",
19721
+ flood: "flood",
19722
+ gas: "gas",
19723
+ "carbon-monoxide": "carbon-monoxide",
19724
+ vibration: "vibration",
19725
+ tamper: "tamper",
19726
+ presence: "presence",
19727
+ "enum-sensor": "enum-sensor",
19728
+ "event-emitter": "device-event",
19729
+ "lock-control": "lock",
19730
+ switch: "switch",
19731
+ button: "button",
19732
+ doorbell: "doorbell"
19733
+ };
19734
+ function buildDescriptor(capName, kind) {
19735
+ const t = EVENT_TAXONOMY[kind];
19736
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19737
+ return {
19738
+ ...t,
19739
+ icon: legacyIcon(t.iconId)
19740
+ };
19741
+ }
19742
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19285
19743
  var CameraPipelineConfigSchema = object({
19286
19744
  engine: PipelineEngineChoiceSchema.optional(),
19287
19745
  steps: array(PipelineStepInputSchema).readonly(),
@@ -22508,13 +22966,29 @@ method(object({
22508
22966
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22509
22967
  kind: "mutation",
22510
22968
  auth: "admin"
22511
- }), method(object({ deviceId: number() }), object({
22969
+ }), method(object({
22970
+ deviceId: number(),
22971
+ reason: OpsLogReasonSchema.optional()
22972
+ }), object({
22512
22973
  floorMs: number().nullable(),
22513
22974
  deletedBuckets: number().int(),
22514
22975
  reclaimedBytes: number().int()
22515
22976
  }), {
22516
22977
  kind: "mutation",
22517
22978
  auth: "admin"
22979
+ }), method(object({
22980
+ deviceId: number(),
22981
+ fromMs: number().optional(),
22982
+ toMs: number().optional()
22983
+ }), object({
22984
+ deletedBuckets: number().int(),
22985
+ reclaimedBytes: number().int()
22986
+ }), {
22987
+ kind: "mutation",
22988
+ auth: "admin"
22989
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
22990
+ kind: "query",
22991
+ auth: "admin"
22518
22992
  });
22519
22993
  /**
22520
22994
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -25636,6 +26110,12 @@ Object.freeze({
25636
26110
  addonId: null,
25637
26111
  access: "delete"
25638
26112
  },
26113
+ "pipelineAnalytics.deleteDeviceEvents": {
26114
+ capName: "pipeline-analytics",
26115
+ capScope: "device",
26116
+ addonId: null,
26117
+ access: "delete"
26118
+ },
25639
26119
  "pipelineAnalytics.deleteTracks": {
25640
26120
  capName: "pipeline-analytics",
25641
26121
  capScope: "device",
@@ -25666,6 +26146,12 @@ Object.freeze({
25666
26146
  addonId: null,
25667
26147
  access: "view"
25668
26148
  },
26149
+ "pipelineAnalytics.getEventStoreFootprint": {
26150
+ capName: "pipeline-analytics",
26151
+ capScope: "device",
26152
+ addonId: null,
26153
+ access: "view"
26154
+ },
25669
26155
  "pipelineAnalytics.getKeyEvents": {
25670
26156
  capName: "pipeline-analytics",
25671
26157
  capScope: "device",
@@ -25708,6 +26194,12 @@ Object.freeze({
25708
26194
  addonId: null,
25709
26195
  access: "view"
25710
26196
  },
26197
+ "pipelineAnalytics.listOpsLog": {
26198
+ capName: "pipeline-analytics",
26199
+ capScope: "device",
26200
+ addonId: null,
26201
+ access: "view"
26202
+ },
25711
26203
  "pipelineAnalytics.listRecentTracks": {
25712
26204
  capName: "pipeline-analytics",
25713
26205
  capScope: "device",
@@ -25720,6 +26212,12 @@ Object.freeze({
25720
26212
  addonId: null,
25721
26213
  access: "view"
25722
26214
  },
26215
+ "pipelineAnalytics.pruneEvents": {
26216
+ capName: "pipeline-analytics",
26217
+ capScope: "device",
26218
+ addonId: null,
26219
+ access: "create"
26220
+ },
25723
26221
  "pipelineAnalytics.pruneEventsBefore": {
25724
26222
  capName: "pipeline-analytics",
25725
26223
  capScope: "device",
@@ -26482,6 +26980,12 @@ Object.freeze({
26482
26980
  addonId: null,
26483
26981
  access: "create"
26484
26982
  },
26983
+ "recording.deleteFootprint": {
26984
+ capName: "recording",
26985
+ capScope: "system",
26986
+ addonId: null,
26987
+ access: "delete"
26988
+ },
26485
26989
  "recording.getAvailability": {
26486
26990
  capName: "recording",
26487
26991
  capScope: "system",
@@ -26512,6 +27016,12 @@ Object.freeze({
26512
27016
  addonId: null,
26513
27017
  access: "view"
26514
27018
  },
27019
+ "recording.listOpsLog": {
27020
+ capName: "recording",
27021
+ capScope: "system",
27022
+ addonId: null,
27023
+ access: "view"
27024
+ },
26515
27025
  "recording.locateSegment": {
26516
27026
  capName: "recording",
26517
27027
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -7396,6 +7396,62 @@ var RecordingConfigSchema = object({
7396
7396
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7397
7397
  });
7398
7398
  /**
7399
+ * Ops-log — the durable, append-only operations audit shared by the
7400
+ * recordings and events management surfaces.
7401
+ *
7402
+ * ONE row shape is reused for both domains so a single "Activity" view can
7403
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7404
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7405
+ * management operation, WHY it ran (reason), and its measurable effect
7406
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7407
+ * never fail the operation it records.
7408
+ */
7409
+ /** Which management domain the operation belongs to. */
7410
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7411
+ /** The kind of management operation performed. */
7412
+ var OpsLogOpSchema = _enum([
7413
+ "prune",
7414
+ "manual-delete",
7415
+ "rescan",
7416
+ "retention-run"
7417
+ ]);
7418
+ /** Why the operation ran. */
7419
+ var OpsLogReasonSchema = _enum([
7420
+ "retention",
7421
+ "quota",
7422
+ "manual",
7423
+ "operator"
7424
+ ]);
7425
+ /** One audit row, shared verbatim by both domains. */
7426
+ var OpsLogEntrySchema = object({
7427
+ /** Unique row id. */
7428
+ id: string(),
7429
+ /** Epoch ms the operation completed. */
7430
+ at: number(),
7431
+ domain: OpsLogDomainSchema,
7432
+ op: OpsLogOpSchema,
7433
+ reason: OpsLogReasonSchema,
7434
+ /** The camera the op targeted; null for a cluster/global op. */
7435
+ deviceId: number().nullable(),
7436
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7437
+ nodeId: string(),
7438
+ /** Buckets / rows deleted (op-specific unit). */
7439
+ itemsAffected: number(),
7440
+ /** Bytes reclaimed by the op (0 when not measurable). */
7441
+ bytesReclaimed: number(),
7442
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7443
+ detail: string().nullable(),
7444
+ /** Who/what triggered the op. */
7445
+ actor: string()
7446
+ });
7447
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7448
+ var OpsLogQueryInputSchema = object({
7449
+ /** Restrict to a single camera; omit for every row. */
7450
+ deviceId: number().optional(),
7451
+ /** Max rows returned, newest-first. */
7452
+ limit: number().int().min(1).max(1e3).optional()
7453
+ });
7454
+ /**
7399
7455
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7400
7456
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7401
7457
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7639,6 +7695,160 @@ var EncodeProfileSchema = object({
7639
7695
  */
7640
7696
  outputArgs: array(string()).optional()
7641
7697
  });
7698
+ var COCO_TO_MACRO = {
7699
+ mapping: {
7700
+ person: "person",
7701
+ bicycle: "vehicle",
7702
+ car: "vehicle",
7703
+ motorcycle: "vehicle",
7704
+ airplane: "vehicle",
7705
+ bus: "vehicle",
7706
+ train: "vehicle",
7707
+ truck: "vehicle",
7708
+ boat: "vehicle",
7709
+ bird: "animal",
7710
+ cat: "animal",
7711
+ dog: "animal",
7712
+ horse: "animal",
7713
+ sheep: "animal",
7714
+ cow: "animal",
7715
+ elephant: "animal",
7716
+ bear: "animal",
7717
+ zebra: "animal",
7718
+ giraffe: "animal",
7719
+ suitcase: "package",
7720
+ backpack: "package",
7721
+ handbag: "package"
7722
+ },
7723
+ preserveOriginal: false
7724
+ };
7725
+ var AUDIO_MACRO_LABELS = [
7726
+ {
7727
+ id: "speech",
7728
+ name: "Speech",
7729
+ icon: "🗣️"
7730
+ },
7731
+ {
7732
+ id: "scream",
7733
+ name: "Scream / Shout",
7734
+ icon: "😱"
7735
+ },
7736
+ {
7737
+ id: "crying",
7738
+ name: "Crying / Baby",
7739
+ icon: "😢"
7740
+ },
7741
+ {
7742
+ id: "laughter",
7743
+ name: "Laughter",
7744
+ icon: "😂"
7745
+ },
7746
+ {
7747
+ id: "music",
7748
+ name: "Music",
7749
+ icon: "🎵"
7750
+ },
7751
+ {
7752
+ id: "dog",
7753
+ name: "Dog",
7754
+ icon: "🐕"
7755
+ },
7756
+ {
7757
+ id: "cat",
7758
+ name: "Cat",
7759
+ icon: "🐈"
7760
+ },
7761
+ {
7762
+ id: "bird",
7763
+ name: "Bird",
7764
+ icon: "🐦"
7765
+ },
7766
+ {
7767
+ id: "animal",
7768
+ name: "Animal (other)",
7769
+ icon: "🐾"
7770
+ },
7771
+ {
7772
+ id: "alarm",
7773
+ name: "Alarm / Siren",
7774
+ icon: "🚨"
7775
+ },
7776
+ {
7777
+ id: "doorbell",
7778
+ name: "Doorbell / Knock",
7779
+ icon: "🔔"
7780
+ },
7781
+ {
7782
+ id: "glass_breaking",
7783
+ name: "Glass Breaking",
7784
+ icon: "💥"
7785
+ },
7786
+ {
7787
+ id: "gunshot",
7788
+ name: "Gunshot / Explosion",
7789
+ icon: "💣"
7790
+ },
7791
+ {
7792
+ id: "vehicle",
7793
+ name: "Vehicle",
7794
+ icon: "🚗"
7795
+ },
7796
+ {
7797
+ id: "siren",
7798
+ name: "Emergency Siren",
7799
+ icon: "🚑"
7800
+ },
7801
+ {
7802
+ id: "fire",
7803
+ name: "Fire / Smoke",
7804
+ icon: "🔥"
7805
+ },
7806
+ {
7807
+ id: "water",
7808
+ name: "Water",
7809
+ icon: "💧"
7810
+ },
7811
+ {
7812
+ id: "wind",
7813
+ name: "Wind / Weather",
7814
+ icon: "🌬️"
7815
+ },
7816
+ {
7817
+ id: "door",
7818
+ name: "Door",
7819
+ icon: "🚪"
7820
+ },
7821
+ {
7822
+ id: "footsteps",
7823
+ name: "Footsteps",
7824
+ icon: "👣"
7825
+ },
7826
+ {
7827
+ id: "crowd",
7828
+ name: "Crowd / Chatter",
7829
+ icon: "👥"
7830
+ },
7831
+ {
7832
+ id: "telephone",
7833
+ name: "Telephone",
7834
+ icon: "📞"
7835
+ },
7836
+ {
7837
+ id: "engine",
7838
+ name: "Engine / Motor",
7839
+ icon: "⚙️"
7840
+ },
7841
+ {
7842
+ id: "tools",
7843
+ name: "Tools / Construction",
7844
+ icon: "🔨"
7845
+ },
7846
+ {
7847
+ id: "silence",
7848
+ name: "Silence",
7849
+ icon: "🤫"
7850
+ }
7851
+ ];
7642
7852
  var YAMNET_TO_MACRO = {
7643
7853
  mapping: {
7644
7854
  Speech: "speech",
@@ -7905,6 +8115,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7905
8115
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7906
8116
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7907
8117
  /**
8118
+ * Unified event-kind taxonomy — THE single source of truth for
8119
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8120
+ * icon }`.
8121
+ *
8122
+ * This dictionary folds together what used to be scattered across four
8123
+ * copies:
8124
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8125
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8126
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8127
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8128
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8129
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8130
+ *
8131
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8132
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8133
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8134
+ * color or an icon: they read this dictionary (server descriptors carry the
8135
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8136
+ *
8137
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8138
+ */
8139
+ var TAXONOMY_COLORS = {
8140
+ motion: "#f59e0b",
8141
+ audio: "#06b6d4",
8142
+ person: "#22c55e",
8143
+ vehicle: "#3b82f6",
8144
+ animal: "#f97316",
8145
+ package: "#a855f7",
8146
+ sensor: "#8b5cf6",
8147
+ control: "#10b981",
8148
+ genericDetection: "#64748b"
8149
+ };
8150
+ var DETECTION_SUB_COLORS = {
8151
+ car: "#f59e0b",
8152
+ truck: "#d97706",
8153
+ bus: "#b45309",
8154
+ motorcycle: "#eab308",
8155
+ bicycle: "#ca8a04",
8156
+ airplane: "#60a5fa",
8157
+ boat: "#2563eb",
8158
+ train: "#1d4ed8",
8159
+ bird: "#14b8a6",
8160
+ dog: "#84cc16",
8161
+ cat: "#f97316",
8162
+ horse: "#a16207",
8163
+ sheep: "#a3a3a3",
8164
+ cow: "#78716c",
8165
+ elephant: "#6b7280",
8166
+ bear: "#7c2d12",
8167
+ zebra: "#404040",
8168
+ giraffe: "#d4a373"
8169
+ };
8170
+ function titleCase(id) {
8171
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8172
+ }
8173
+ var entries = /* @__PURE__ */ new Map();
8174
+ function macro(kind, category, color, iconId, label) {
8175
+ entries.set(kind, {
8176
+ kind,
8177
+ parentKind: null,
8178
+ level: "macro",
8179
+ category,
8180
+ color,
8181
+ iconId,
8182
+ labelKey: `eventKind.${kind}`,
8183
+ label
8184
+ });
8185
+ }
8186
+ function sub(kind, parentKind, category, color, iconId, label) {
8187
+ entries.set(kind, {
8188
+ kind,
8189
+ parentKind,
8190
+ level: "sub",
8191
+ category,
8192
+ color,
8193
+ iconId,
8194
+ labelKey: `eventKind.${kind}`,
8195
+ label
8196
+ });
8197
+ }
8198
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8199
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8200
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8201
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8202
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8203
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8204
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8205
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8206
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8207
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8208
+ if (entries.has(cocoClass)) continue;
8209
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8210
+ }
8211
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8212
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8213
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8214
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8215
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8216
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8217
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8218
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8219
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8220
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8221
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8222
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8223
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8224
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8225
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8226
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8227
+ sub("button", "control", "control", "#10b981", "button", "Button");
8228
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8229
+ for (const l of AUDIO_MACRO_LABELS) {
8230
+ const kind = `audio-${l.id}`;
8231
+ if (entries.has(kind)) continue;
8232
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8233
+ }
8234
+ /** The complete taxonomy dictionary, keyed by kind. */
8235
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8236
+ /**
7908
8237
  * Error types for the safe expression engine. Two distinct classes so callers
7909
8238
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7910
8239
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -14859,9 +15188,10 @@ var DEVICE_LOCAL_STATE_CAPS = {
14859
15188
  * `package` backs the package-drop detector — a package zone is a
14860
15189
  * `ZoneRule` on the `'package'` stage referencing drawn polygons
14861
15190
  * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14862
- * The orchestrator provider that writes this stage lands in a later
14863
- * slice; until then the mirror carries only `{motion, detection}` and
14864
- * consumers read `package` as absent (treat as `[]`).
15191
+ * The orchestrator provider writes this stage as a first-class slice
15192
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
15193
+ * package}` shape, so consumers read the current package rules directly
15194
+ * off `device.state.zoneRules.value.package`.
14865
15195
  */
14866
15196
  runtimeState: object({
14867
15197
  motion: array(ZoneRuleSchema).readonly(),
@@ -18853,17 +19183,30 @@ var EventKindCategorySchema = _enum([
18853
19183
  "audio",
18854
19184
  "detection",
18855
19185
  "sensor",
19186
+ "control",
18856
19187
  "custom",
18857
19188
  "package"
18858
19189
  ]);
19190
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19191
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18859
19192
  var EventKindDescriptorSchema = object({
18860
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19193
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18861
19194
  kind: string(),
19195
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19196
+ labelKey: string(),
19197
+ /** English fallback label (kept for clients that don't translate). */
18862
19198
  label: string(),
18863
19199
  /** Hex color for timeline/legend rendering. */
18864
19200
  color: string(),
19201
+ /** Dictionary id → lucide component on the UI side. */
19202
+ iconId: string(),
19203
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18865
19204
  icon: EventKindIconSchema,
18866
19205
  category: EventKindCategorySchema,
19206
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19207
+ parentKind: string().nullable(),
19208
+ /** Derived from `parentKind`, explicit for the client tree. */
19209
+ level: EventKindLevelSchema,
18867
19210
  /** Which cap + device contributes this kind. For built-ins the camera
18868
19211
  * itself; for sensor kinds the LINKED source device. */
18869
19212
  source: object({
@@ -18936,11 +19279,21 @@ var TrackAudioLabelSchema = object({
18936
19279
  firstAt: number(),
18937
19280
  lastAt: number()
18938
19281
  });
19282
+ /**
19283
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19284
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19285
+ * linked sensor/control state change (no positions; carries a snapshot). The
19286
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19287
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19288
+ */
19289
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18939
19290
  var TrackSchema = object({
18940
19291
  trackId: string(),
18941
19292
  deviceId: number(),
18942
19293
  className: string(),
18943
19294
  label: string().optional(),
19295
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19296
+ source: TrackSourceSchema.optional(),
18944
19297
  firstSeen: number(),
18945
19298
  lastSeen: number(),
18946
19299
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19195,6 +19548,26 @@ var TrackCascadeCountsSchema = object({
19195
19548
  /** Per-track CLIP search vectors removed (best-effort). */
19196
19549
  embeddings: number().int()
19197
19550
  });
19551
+ /** Event-store footprint for one camera. */
19552
+ var EventStoreDeviceFootprintSchema = object({
19553
+ deviceId: number(),
19554
+ /** Persisted event rows (motion + object + audio) for the camera. */
19555
+ rows: number().int(),
19556
+ /** Event-owned media bytes on disk for the camera. */
19557
+ bytes: number().int()
19558
+ });
19559
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19560
+ var EventStoreFootprintSchema = object({
19561
+ totalRows: number().int(),
19562
+ totalBytes: number().int(),
19563
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19564
+ });
19565
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19566
+ var EventPruneCountsSchema = object({
19567
+ motion: number().int(),
19568
+ object: number().int(),
19569
+ audio: number().int()
19570
+ });
19198
19571
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19199
19572
  deviceId: number(),
19200
19573
  trackId: string()
@@ -19258,6 +19631,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19258
19631
  }), {
19259
19632
  kind: "mutation",
19260
19633
  auth: "admin"
19634
+ }), method(object({}), EventStoreFootprintSchema, {
19635
+ kind: "query",
19636
+ auth: "admin"
19637
+ }), method(object({
19638
+ olderThanMs: number(),
19639
+ reason: OpsLogReasonSchema.optional()
19640
+ }), EventPruneCountsSchema, {
19641
+ kind: "mutation",
19642
+ auth: "admin"
19643
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19644
+ kind: "mutation",
19645
+ auth: "admin"
19646
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19647
+ kind: "query",
19648
+ auth: "admin"
19261
19649
  }), method(object({
19262
19650
  eventId: string(),
19263
19651
  kind: MediaFileKindEnum.optional()
@@ -19282,6 +19670,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19282
19670
  eventId: string(),
19283
19671
  timestamp: number()
19284
19672
  });
19673
+ /**
19674
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19675
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19676
+ * caps into per-camera event-kind descriptors.
19677
+ *
19678
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19679
+ * is NOT duplicated here — every entry is derived from the single
19680
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19681
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19682
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19683
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19684
+ * eventful cap is missing.
19685
+ */
19686
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19687
+ var LEGACY_ICON = {
19688
+ motion: "motion",
19689
+ audio: "audio",
19690
+ person: "person",
19691
+ vehicle: "vehicle",
19692
+ animal: "animal",
19693
+ package: "package",
19694
+ door: "door",
19695
+ pir: "pir",
19696
+ smoke: "smoke",
19697
+ water: "water",
19698
+ button: "button",
19699
+ generic: "generic",
19700
+ gas: "smoke",
19701
+ vibration: "generic",
19702
+ tamper: "generic",
19703
+ presence: "person",
19704
+ lock: "generic",
19705
+ siren: "generic",
19706
+ switch: "generic",
19707
+ doorbell: "button"
19708
+ };
19709
+ function legacyIcon(iconId) {
19710
+ return LEGACY_ICON[iconId] ?? "generic";
19711
+ }
19712
+ /**
19713
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19714
+ * The anti-drift guard cross-checks this against the eventful caps declared
19715
+ * in `packages/types/src/capabilities/*.cap.ts`.
19716
+ */
19717
+ var CAP_TO_KIND = {
19718
+ contact: "contact",
19719
+ motion: "motion-sensor",
19720
+ smoke: "smoke",
19721
+ flood: "flood",
19722
+ gas: "gas",
19723
+ "carbon-monoxide": "carbon-monoxide",
19724
+ vibration: "vibration",
19725
+ tamper: "tamper",
19726
+ presence: "presence",
19727
+ "enum-sensor": "enum-sensor",
19728
+ "event-emitter": "device-event",
19729
+ "lock-control": "lock",
19730
+ switch: "switch",
19731
+ button: "button",
19732
+ doorbell: "doorbell"
19733
+ };
19734
+ function buildDescriptor(capName, kind) {
19735
+ const t = EVENT_TAXONOMY[kind];
19736
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19737
+ return {
19738
+ ...t,
19739
+ icon: legacyIcon(t.iconId)
19740
+ };
19741
+ }
19742
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19285
19743
  var CameraPipelineConfigSchema = object({
19286
19744
  engine: PipelineEngineChoiceSchema.optional(),
19287
19745
  steps: array(PipelineStepInputSchema).readonly(),
@@ -22508,13 +22966,29 @@ method(object({
22508
22966
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22509
22967
  kind: "mutation",
22510
22968
  auth: "admin"
22511
- }), method(object({ deviceId: number() }), object({
22969
+ }), method(object({
22970
+ deviceId: number(),
22971
+ reason: OpsLogReasonSchema.optional()
22972
+ }), object({
22512
22973
  floorMs: number().nullable(),
22513
22974
  deletedBuckets: number().int(),
22514
22975
  reclaimedBytes: number().int()
22515
22976
  }), {
22516
22977
  kind: "mutation",
22517
22978
  auth: "admin"
22979
+ }), method(object({
22980
+ deviceId: number(),
22981
+ fromMs: number().optional(),
22982
+ toMs: number().optional()
22983
+ }), object({
22984
+ deletedBuckets: number().int(),
22985
+ reclaimedBytes: number().int()
22986
+ }), {
22987
+ kind: "mutation",
22988
+ auth: "admin"
22989
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
22990
+ kind: "query",
22991
+ auth: "admin"
22518
22992
  });
22519
22993
  /**
22520
22994
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -25636,6 +26110,12 @@ Object.freeze({
25636
26110
  addonId: null,
25637
26111
  access: "delete"
25638
26112
  },
26113
+ "pipelineAnalytics.deleteDeviceEvents": {
26114
+ capName: "pipeline-analytics",
26115
+ capScope: "device",
26116
+ addonId: null,
26117
+ access: "delete"
26118
+ },
25639
26119
  "pipelineAnalytics.deleteTracks": {
25640
26120
  capName: "pipeline-analytics",
25641
26121
  capScope: "device",
@@ -25666,6 +26146,12 @@ Object.freeze({
25666
26146
  addonId: null,
25667
26147
  access: "view"
25668
26148
  },
26149
+ "pipelineAnalytics.getEventStoreFootprint": {
26150
+ capName: "pipeline-analytics",
26151
+ capScope: "device",
26152
+ addonId: null,
26153
+ access: "view"
26154
+ },
25669
26155
  "pipelineAnalytics.getKeyEvents": {
25670
26156
  capName: "pipeline-analytics",
25671
26157
  capScope: "device",
@@ -25708,6 +26194,12 @@ Object.freeze({
25708
26194
  addonId: null,
25709
26195
  access: "view"
25710
26196
  },
26197
+ "pipelineAnalytics.listOpsLog": {
26198
+ capName: "pipeline-analytics",
26199
+ capScope: "device",
26200
+ addonId: null,
26201
+ access: "view"
26202
+ },
25711
26203
  "pipelineAnalytics.listRecentTracks": {
25712
26204
  capName: "pipeline-analytics",
25713
26205
  capScope: "device",
@@ -25720,6 +26212,12 @@ Object.freeze({
25720
26212
  addonId: null,
25721
26213
  access: "view"
25722
26214
  },
26215
+ "pipelineAnalytics.pruneEvents": {
26216
+ capName: "pipeline-analytics",
26217
+ capScope: "device",
26218
+ addonId: null,
26219
+ access: "create"
26220
+ },
25723
26221
  "pipelineAnalytics.pruneEventsBefore": {
25724
26222
  capName: "pipeline-analytics",
25725
26223
  capScope: "device",
@@ -26482,6 +26980,12 @@ Object.freeze({
26482
26980
  addonId: null,
26483
26981
  access: "create"
26484
26982
  },
26983
+ "recording.deleteFootprint": {
26984
+ capName: "recording",
26985
+ capScope: "system",
26986
+ addonId: null,
26987
+ access: "delete"
26988
+ },
26485
26989
  "recording.getAvailability": {
26486
26990
  capName: "recording",
26487
26991
  capScope: "system",
@@ -26512,6 +27016,12 @@ Object.freeze({
26512
27016
  addonId: null,
26513
27017
  access: "view"
26514
27018
  },
27019
+ "recording.listOpsLog": {
27020
+ capName: "recording",
27021
+ capScope: "system",
27022
+ addonId: null,
27023
+ access: "view"
27024
+ },
26515
27025
  "recording.locateSegment": {
26516
27026
  capName: "recording",
26517
27027
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreame",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "Dreame robot-vacuum / lawn-mower device-provider addon for CamStack — wraps the @apocaliss92/nodedreame Dreamehome cloud client",
5
5
  "keywords": [
6
6
  "camstack",