@camstack/addon-provider-tuya 0.1.12 → 0.1.14

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
@@ -7362,6 +7362,62 @@ var RecordingConfigSchema = object({
7362
7362
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7363
7363
  });
7364
7364
  /**
7365
+ * Ops-log — the durable, append-only operations audit shared by the
7366
+ * recordings and events management surfaces.
7367
+ *
7368
+ * ONE row shape is reused for both domains so a single "Activity" view can
7369
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7370
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7371
+ * management operation, WHY it ran (reason), and its measurable effect
7372
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7373
+ * never fail the operation it records.
7374
+ */
7375
+ /** Which management domain the operation belongs to. */
7376
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7377
+ /** The kind of management operation performed. */
7378
+ var OpsLogOpSchema = _enum([
7379
+ "prune",
7380
+ "manual-delete",
7381
+ "rescan",
7382
+ "retention-run"
7383
+ ]);
7384
+ /** Why the operation ran. */
7385
+ var OpsLogReasonSchema = _enum([
7386
+ "retention",
7387
+ "quota",
7388
+ "manual",
7389
+ "operator"
7390
+ ]);
7391
+ /** One audit row, shared verbatim by both domains. */
7392
+ var OpsLogEntrySchema = object({
7393
+ /** Unique row id. */
7394
+ id: string(),
7395
+ /** Epoch ms the operation completed. */
7396
+ at: number(),
7397
+ domain: OpsLogDomainSchema,
7398
+ op: OpsLogOpSchema,
7399
+ reason: OpsLogReasonSchema,
7400
+ /** The camera the op targeted; null for a cluster/global op. */
7401
+ deviceId: number().nullable(),
7402
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7403
+ nodeId: string(),
7404
+ /** Buckets / rows deleted (op-specific unit). */
7405
+ itemsAffected: number(),
7406
+ /** Bytes reclaimed by the op (0 when not measurable). */
7407
+ bytesReclaimed: number(),
7408
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7409
+ detail: string().nullable(),
7410
+ /** Who/what triggered the op. */
7411
+ actor: string()
7412
+ });
7413
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7414
+ var OpsLogQueryInputSchema = object({
7415
+ /** Restrict to a single camera; omit for every row. */
7416
+ deviceId: number().optional(),
7417
+ /** Max rows returned, newest-first. */
7418
+ limit: number().int().min(1).max(1e3).optional()
7419
+ });
7420
+ /**
7365
7421
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7366
7422
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7367
7423
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7605,6 +7661,160 @@ var EncodeProfileSchema = object({
7605
7661
  */
7606
7662
  outputArgs: array(string()).optional()
7607
7663
  });
7664
+ var COCO_TO_MACRO = {
7665
+ mapping: {
7666
+ person: "person",
7667
+ bicycle: "vehicle",
7668
+ car: "vehicle",
7669
+ motorcycle: "vehicle",
7670
+ airplane: "vehicle",
7671
+ bus: "vehicle",
7672
+ train: "vehicle",
7673
+ truck: "vehicle",
7674
+ boat: "vehicle",
7675
+ bird: "animal",
7676
+ cat: "animal",
7677
+ dog: "animal",
7678
+ horse: "animal",
7679
+ sheep: "animal",
7680
+ cow: "animal",
7681
+ elephant: "animal",
7682
+ bear: "animal",
7683
+ zebra: "animal",
7684
+ giraffe: "animal",
7685
+ suitcase: "package",
7686
+ backpack: "package",
7687
+ handbag: "package"
7688
+ },
7689
+ preserveOriginal: false
7690
+ };
7691
+ var AUDIO_MACRO_LABELS = [
7692
+ {
7693
+ id: "speech",
7694
+ name: "Speech",
7695
+ icon: "🗣️"
7696
+ },
7697
+ {
7698
+ id: "scream",
7699
+ name: "Scream / Shout",
7700
+ icon: "😱"
7701
+ },
7702
+ {
7703
+ id: "crying",
7704
+ name: "Crying / Baby",
7705
+ icon: "😢"
7706
+ },
7707
+ {
7708
+ id: "laughter",
7709
+ name: "Laughter",
7710
+ icon: "😂"
7711
+ },
7712
+ {
7713
+ id: "music",
7714
+ name: "Music",
7715
+ icon: "🎵"
7716
+ },
7717
+ {
7718
+ id: "dog",
7719
+ name: "Dog",
7720
+ icon: "🐕"
7721
+ },
7722
+ {
7723
+ id: "cat",
7724
+ name: "Cat",
7725
+ icon: "🐈"
7726
+ },
7727
+ {
7728
+ id: "bird",
7729
+ name: "Bird",
7730
+ icon: "🐦"
7731
+ },
7732
+ {
7733
+ id: "animal",
7734
+ name: "Animal (other)",
7735
+ icon: "🐾"
7736
+ },
7737
+ {
7738
+ id: "alarm",
7739
+ name: "Alarm / Siren",
7740
+ icon: "🚨"
7741
+ },
7742
+ {
7743
+ id: "doorbell",
7744
+ name: "Doorbell / Knock",
7745
+ icon: "🔔"
7746
+ },
7747
+ {
7748
+ id: "glass_breaking",
7749
+ name: "Glass Breaking",
7750
+ icon: "💥"
7751
+ },
7752
+ {
7753
+ id: "gunshot",
7754
+ name: "Gunshot / Explosion",
7755
+ icon: "💣"
7756
+ },
7757
+ {
7758
+ id: "vehicle",
7759
+ name: "Vehicle",
7760
+ icon: "🚗"
7761
+ },
7762
+ {
7763
+ id: "siren",
7764
+ name: "Emergency Siren",
7765
+ icon: "🚑"
7766
+ },
7767
+ {
7768
+ id: "fire",
7769
+ name: "Fire / Smoke",
7770
+ icon: "🔥"
7771
+ },
7772
+ {
7773
+ id: "water",
7774
+ name: "Water",
7775
+ icon: "💧"
7776
+ },
7777
+ {
7778
+ id: "wind",
7779
+ name: "Wind / Weather",
7780
+ icon: "🌬️"
7781
+ },
7782
+ {
7783
+ id: "door",
7784
+ name: "Door",
7785
+ icon: "🚪"
7786
+ },
7787
+ {
7788
+ id: "footsteps",
7789
+ name: "Footsteps",
7790
+ icon: "👣"
7791
+ },
7792
+ {
7793
+ id: "crowd",
7794
+ name: "Crowd / Chatter",
7795
+ icon: "👥"
7796
+ },
7797
+ {
7798
+ id: "telephone",
7799
+ name: "Telephone",
7800
+ icon: "📞"
7801
+ },
7802
+ {
7803
+ id: "engine",
7804
+ name: "Engine / Motor",
7805
+ icon: "⚙️"
7806
+ },
7807
+ {
7808
+ id: "tools",
7809
+ name: "Tools / Construction",
7810
+ icon: "🔨"
7811
+ },
7812
+ {
7813
+ id: "silence",
7814
+ name: "Silence",
7815
+ icon: "🤫"
7816
+ }
7817
+ ];
7608
7818
  var YAMNET_TO_MACRO = {
7609
7819
  mapping: {
7610
7820
  Speech: "speech",
@@ -7871,6 +8081,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7871
8081
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7872
8082
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7873
8083
  /**
8084
+ * Unified event-kind taxonomy — THE single source of truth for
8085
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8086
+ * icon }`.
8087
+ *
8088
+ * This dictionary folds together what used to be scattered across four
8089
+ * copies:
8090
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8091
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8092
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8093
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8094
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8095
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8096
+ *
8097
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8098
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8099
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8100
+ * color or an icon: they read this dictionary (server descriptors carry the
8101
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8102
+ *
8103
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8104
+ */
8105
+ var TAXONOMY_COLORS = {
8106
+ motion: "#f59e0b",
8107
+ audio: "#06b6d4",
8108
+ person: "#22c55e",
8109
+ vehicle: "#3b82f6",
8110
+ animal: "#f97316",
8111
+ package: "#a855f7",
8112
+ sensor: "#8b5cf6",
8113
+ control: "#10b981",
8114
+ genericDetection: "#64748b"
8115
+ };
8116
+ var DETECTION_SUB_COLORS = {
8117
+ car: "#f59e0b",
8118
+ truck: "#d97706",
8119
+ bus: "#b45309",
8120
+ motorcycle: "#eab308",
8121
+ bicycle: "#ca8a04",
8122
+ airplane: "#60a5fa",
8123
+ boat: "#2563eb",
8124
+ train: "#1d4ed8",
8125
+ bird: "#14b8a6",
8126
+ dog: "#84cc16",
8127
+ cat: "#f97316",
8128
+ horse: "#a16207",
8129
+ sheep: "#a3a3a3",
8130
+ cow: "#78716c",
8131
+ elephant: "#6b7280",
8132
+ bear: "#7c2d12",
8133
+ zebra: "#404040",
8134
+ giraffe: "#d4a373"
8135
+ };
8136
+ function titleCase(id) {
8137
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8138
+ }
8139
+ var entries = /* @__PURE__ */ new Map();
8140
+ function macro(kind, category, color, iconId, label) {
8141
+ entries.set(kind, {
8142
+ kind,
8143
+ parentKind: null,
8144
+ level: "macro",
8145
+ category,
8146
+ color,
8147
+ iconId,
8148
+ labelKey: `eventKind.${kind}`,
8149
+ label
8150
+ });
8151
+ }
8152
+ function sub(kind, parentKind, category, color, iconId, label) {
8153
+ entries.set(kind, {
8154
+ kind,
8155
+ parentKind,
8156
+ level: "sub",
8157
+ category,
8158
+ color,
8159
+ iconId,
8160
+ labelKey: `eventKind.${kind}`,
8161
+ label
8162
+ });
8163
+ }
8164
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8165
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8166
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8167
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8168
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8169
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8170
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8171
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8172
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8173
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8174
+ if (entries.has(cocoClass)) continue;
8175
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8176
+ }
8177
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8178
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8179
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8180
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8181
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8182
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8183
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8184
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8185
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8186
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8187
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8188
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8189
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8190
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8191
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8192
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8193
+ sub("button", "control", "control", "#10b981", "button", "Button");
8194
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8195
+ for (const l of AUDIO_MACRO_LABELS) {
8196
+ const kind = `audio-${l.id}`;
8197
+ if (entries.has(kind)) continue;
8198
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8199
+ }
8200
+ /** The complete taxonomy dictionary, keyed by kind. */
8201
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8202
+ /**
7874
8203
  * Error types for the safe expression engine. Two distinct classes so callers
7875
8204
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7876
8205
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -14825,9 +15154,10 @@ var DEVICE_LOCAL_STATE_CAPS = {
14825
15154
  * `package` backs the package-drop detector — a package zone is a
14826
15155
  * `ZoneRule` on the `'package'` stage referencing drawn polygons
14827
15156
  * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14828
- * The orchestrator provider that writes this stage lands in a later
14829
- * slice; until then the mirror carries only `{motion, detection}` and
14830
- * consumers read `package` as absent (treat as `[]`).
15157
+ * The orchestrator provider writes this stage as a first-class slice
15158
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
15159
+ * package}` shape, so consumers read the current package rules directly
15160
+ * off `device.state.zoneRules.value.package`.
14831
15161
  */
14832
15162
  runtimeState: object({
14833
15163
  motion: array(ZoneRuleSchema).readonly(),
@@ -18819,17 +19149,30 @@ var EventKindCategorySchema = _enum([
18819
19149
  "audio",
18820
19150
  "detection",
18821
19151
  "sensor",
19152
+ "control",
18822
19153
  "custom",
18823
19154
  "package"
18824
19155
  ]);
19156
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19157
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18825
19158
  var EventKindDescriptorSchema = object({
18826
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19159
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18827
19160
  kind: string(),
19161
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19162
+ labelKey: string(),
19163
+ /** English fallback label (kept for clients that don't translate). */
18828
19164
  label: string(),
18829
19165
  /** Hex color for timeline/legend rendering. */
18830
19166
  color: string(),
19167
+ /** Dictionary id → lucide component on the UI side. */
19168
+ iconId: string(),
19169
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18831
19170
  icon: EventKindIconSchema,
18832
19171
  category: EventKindCategorySchema,
19172
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19173
+ parentKind: string().nullable(),
19174
+ /** Derived from `parentKind`, explicit for the client tree. */
19175
+ level: EventKindLevelSchema,
18833
19176
  /** Which cap + device contributes this kind. For built-ins the camera
18834
19177
  * itself; for sensor kinds the LINKED source device. */
18835
19178
  source: object({
@@ -18902,11 +19245,21 @@ var TrackAudioLabelSchema = object({
18902
19245
  firstAt: number(),
18903
19246
  lastAt: number()
18904
19247
  });
19248
+ /**
19249
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19250
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19251
+ * linked sensor/control state change (no positions; carries a snapshot). The
19252
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19253
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19254
+ */
19255
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18905
19256
  var TrackSchema = object({
18906
19257
  trackId: string(),
18907
19258
  deviceId: number(),
18908
19259
  className: string(),
18909
19260
  label: string().optional(),
19261
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19262
+ source: TrackSourceSchema.optional(),
18910
19263
  firstSeen: number(),
18911
19264
  lastSeen: number(),
18912
19265
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19161,6 +19514,26 @@ var TrackCascadeCountsSchema = object({
19161
19514
  /** Per-track CLIP search vectors removed (best-effort). */
19162
19515
  embeddings: number().int()
19163
19516
  });
19517
+ /** Event-store footprint for one camera. */
19518
+ var EventStoreDeviceFootprintSchema = object({
19519
+ deviceId: number(),
19520
+ /** Persisted event rows (motion + object + audio) for the camera. */
19521
+ rows: number().int(),
19522
+ /** Event-owned media bytes on disk for the camera. */
19523
+ bytes: number().int()
19524
+ });
19525
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19526
+ var EventStoreFootprintSchema = object({
19527
+ totalRows: number().int(),
19528
+ totalBytes: number().int(),
19529
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19530
+ });
19531
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19532
+ var EventPruneCountsSchema = object({
19533
+ motion: number().int(),
19534
+ object: number().int(),
19535
+ audio: number().int()
19536
+ });
19164
19537
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19165
19538
  deviceId: number(),
19166
19539
  trackId: string()
@@ -19224,6 +19597,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19224
19597
  }), {
19225
19598
  kind: "mutation",
19226
19599
  auth: "admin"
19600
+ }), method(object({}), EventStoreFootprintSchema, {
19601
+ kind: "query",
19602
+ auth: "admin"
19603
+ }), method(object({
19604
+ olderThanMs: number(),
19605
+ reason: OpsLogReasonSchema.optional()
19606
+ }), EventPruneCountsSchema, {
19607
+ kind: "mutation",
19608
+ auth: "admin"
19609
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19610
+ kind: "mutation",
19611
+ auth: "admin"
19612
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19613
+ kind: "query",
19614
+ auth: "admin"
19227
19615
  }), method(object({
19228
19616
  eventId: string(),
19229
19617
  kind: MediaFileKindEnum.optional()
@@ -19248,6 +19636,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19248
19636
  eventId: string(),
19249
19637
  timestamp: number()
19250
19638
  });
19639
+ /**
19640
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19641
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19642
+ * caps into per-camera event-kind descriptors.
19643
+ *
19644
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19645
+ * is NOT duplicated here — every entry is derived from the single
19646
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19647
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19648
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19649
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19650
+ * eventful cap is missing.
19651
+ */
19652
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19653
+ var LEGACY_ICON = {
19654
+ motion: "motion",
19655
+ audio: "audio",
19656
+ person: "person",
19657
+ vehicle: "vehicle",
19658
+ animal: "animal",
19659
+ package: "package",
19660
+ door: "door",
19661
+ pir: "pir",
19662
+ smoke: "smoke",
19663
+ water: "water",
19664
+ button: "button",
19665
+ generic: "generic",
19666
+ gas: "smoke",
19667
+ vibration: "generic",
19668
+ tamper: "generic",
19669
+ presence: "person",
19670
+ lock: "generic",
19671
+ siren: "generic",
19672
+ switch: "generic",
19673
+ doorbell: "button"
19674
+ };
19675
+ function legacyIcon(iconId) {
19676
+ return LEGACY_ICON[iconId] ?? "generic";
19677
+ }
19678
+ /**
19679
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19680
+ * The anti-drift guard cross-checks this against the eventful caps declared
19681
+ * in `packages/types/src/capabilities/*.cap.ts`.
19682
+ */
19683
+ var CAP_TO_KIND = {
19684
+ contact: "contact",
19685
+ motion: "motion-sensor",
19686
+ smoke: "smoke",
19687
+ flood: "flood",
19688
+ gas: "gas",
19689
+ "carbon-monoxide": "carbon-monoxide",
19690
+ vibration: "vibration",
19691
+ tamper: "tamper",
19692
+ presence: "presence",
19693
+ "enum-sensor": "enum-sensor",
19694
+ "event-emitter": "device-event",
19695
+ "lock-control": "lock",
19696
+ switch: "switch",
19697
+ button: "button",
19698
+ doorbell: "doorbell"
19699
+ };
19700
+ function buildDescriptor(capName, kind) {
19701
+ const t = EVENT_TAXONOMY[kind];
19702
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19703
+ return {
19704
+ ...t,
19705
+ icon: legacyIcon(t.iconId)
19706
+ };
19707
+ }
19708
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19251
19709
  var CameraPipelineConfigSchema = object({
19252
19710
  engine: PipelineEngineChoiceSchema.optional(),
19253
19711
  steps: array(PipelineStepInputSchema).readonly(),
@@ -22457,13 +22915,29 @@ method(object({
22457
22915
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22458
22916
  kind: "mutation",
22459
22917
  auth: "admin"
22460
- }), method(object({ deviceId: number() }), object({
22918
+ }), method(object({
22919
+ deviceId: number(),
22920
+ reason: OpsLogReasonSchema.optional()
22921
+ }), object({
22461
22922
  floorMs: number().nullable(),
22462
22923
  deletedBuckets: number().int(),
22463
22924
  reclaimedBytes: number().int()
22464
22925
  }), {
22465
22926
  kind: "mutation",
22466
22927
  auth: "admin"
22928
+ }), method(object({
22929
+ deviceId: number(),
22930
+ fromMs: number().optional(),
22931
+ toMs: number().optional()
22932
+ }), object({
22933
+ deletedBuckets: number().int(),
22934
+ reclaimedBytes: number().int()
22935
+ }), {
22936
+ kind: "mutation",
22937
+ auth: "admin"
22938
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
22939
+ kind: "query",
22940
+ auth: "admin"
22467
22941
  });
22468
22942
  /**
22469
22943
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -25585,6 +26059,12 @@ Object.freeze({
25585
26059
  addonId: null,
25586
26060
  access: "delete"
25587
26061
  },
26062
+ "pipelineAnalytics.deleteDeviceEvents": {
26063
+ capName: "pipeline-analytics",
26064
+ capScope: "device",
26065
+ addonId: null,
26066
+ access: "delete"
26067
+ },
25588
26068
  "pipelineAnalytics.deleteTracks": {
25589
26069
  capName: "pipeline-analytics",
25590
26070
  capScope: "device",
@@ -25615,6 +26095,12 @@ Object.freeze({
25615
26095
  addonId: null,
25616
26096
  access: "view"
25617
26097
  },
26098
+ "pipelineAnalytics.getEventStoreFootprint": {
26099
+ capName: "pipeline-analytics",
26100
+ capScope: "device",
26101
+ addonId: null,
26102
+ access: "view"
26103
+ },
25618
26104
  "pipelineAnalytics.getKeyEvents": {
25619
26105
  capName: "pipeline-analytics",
25620
26106
  capScope: "device",
@@ -25657,6 +26143,12 @@ Object.freeze({
25657
26143
  addonId: null,
25658
26144
  access: "view"
25659
26145
  },
26146
+ "pipelineAnalytics.listOpsLog": {
26147
+ capName: "pipeline-analytics",
26148
+ capScope: "device",
26149
+ addonId: null,
26150
+ access: "view"
26151
+ },
25660
26152
  "pipelineAnalytics.listRecentTracks": {
25661
26153
  capName: "pipeline-analytics",
25662
26154
  capScope: "device",
@@ -25669,6 +26161,12 @@ Object.freeze({
25669
26161
  addonId: null,
25670
26162
  access: "view"
25671
26163
  },
26164
+ "pipelineAnalytics.pruneEvents": {
26165
+ capName: "pipeline-analytics",
26166
+ capScope: "device",
26167
+ addonId: null,
26168
+ access: "create"
26169
+ },
25672
26170
  "pipelineAnalytics.pruneEventsBefore": {
25673
26171
  capName: "pipeline-analytics",
25674
26172
  capScope: "device",
@@ -26431,6 +26929,12 @@ Object.freeze({
26431
26929
  addonId: null,
26432
26930
  access: "create"
26433
26931
  },
26932
+ "recording.deleteFootprint": {
26933
+ capName: "recording",
26934
+ capScope: "system",
26935
+ addonId: null,
26936
+ access: "delete"
26937
+ },
26434
26938
  "recording.getAvailability": {
26435
26939
  capName: "recording",
26436
26940
  capScope: "system",
@@ -26461,6 +26965,12 @@ Object.freeze({
26461
26965
  addonId: null,
26462
26966
  access: "view"
26463
26967
  },
26968
+ "recording.listOpsLog": {
26969
+ capName: "recording",
26970
+ capScope: "system",
26971
+ addonId: null,
26972
+ access: "view"
26973
+ },
26464
26974
  "recording.locateSegment": {
26465
26975
  capName: "recording",
26466
26976
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -7361,6 +7361,62 @@ var RecordingConfigSchema = object({
7361
7361
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7362
7362
  });
7363
7363
  /**
7364
+ * Ops-log — the durable, append-only operations audit shared by the
7365
+ * recordings and events management surfaces.
7366
+ *
7367
+ * ONE row shape is reused for both domains so a single "Activity" view can
7368
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7369
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7370
+ * management operation, WHY it ran (reason), and its measurable effect
7371
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7372
+ * never fail the operation it records.
7373
+ */
7374
+ /** Which management domain the operation belongs to. */
7375
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7376
+ /** The kind of management operation performed. */
7377
+ var OpsLogOpSchema = _enum([
7378
+ "prune",
7379
+ "manual-delete",
7380
+ "rescan",
7381
+ "retention-run"
7382
+ ]);
7383
+ /** Why the operation ran. */
7384
+ var OpsLogReasonSchema = _enum([
7385
+ "retention",
7386
+ "quota",
7387
+ "manual",
7388
+ "operator"
7389
+ ]);
7390
+ /** One audit row, shared verbatim by both domains. */
7391
+ var OpsLogEntrySchema = object({
7392
+ /** Unique row id. */
7393
+ id: string(),
7394
+ /** Epoch ms the operation completed. */
7395
+ at: number(),
7396
+ domain: OpsLogDomainSchema,
7397
+ op: OpsLogOpSchema,
7398
+ reason: OpsLogReasonSchema,
7399
+ /** The camera the op targeted; null for a cluster/global op. */
7400
+ deviceId: number().nullable(),
7401
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7402
+ nodeId: string(),
7403
+ /** Buckets / rows deleted (op-specific unit). */
7404
+ itemsAffected: number(),
7405
+ /** Bytes reclaimed by the op (0 when not measurable). */
7406
+ bytesReclaimed: number(),
7407
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7408
+ detail: string().nullable(),
7409
+ /** Who/what triggered the op. */
7410
+ actor: string()
7411
+ });
7412
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7413
+ var OpsLogQueryInputSchema = object({
7414
+ /** Restrict to a single camera; omit for every row. */
7415
+ deviceId: number().optional(),
7416
+ /** Max rows returned, newest-first. */
7417
+ limit: number().int().min(1).max(1e3).optional()
7418
+ });
7419
+ /**
7364
7420
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7365
7421
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7366
7422
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7604,6 +7660,160 @@ var EncodeProfileSchema = object({
7604
7660
  */
7605
7661
  outputArgs: array(string()).optional()
7606
7662
  });
7663
+ var COCO_TO_MACRO = {
7664
+ mapping: {
7665
+ person: "person",
7666
+ bicycle: "vehicle",
7667
+ car: "vehicle",
7668
+ motorcycle: "vehicle",
7669
+ airplane: "vehicle",
7670
+ bus: "vehicle",
7671
+ train: "vehicle",
7672
+ truck: "vehicle",
7673
+ boat: "vehicle",
7674
+ bird: "animal",
7675
+ cat: "animal",
7676
+ dog: "animal",
7677
+ horse: "animal",
7678
+ sheep: "animal",
7679
+ cow: "animal",
7680
+ elephant: "animal",
7681
+ bear: "animal",
7682
+ zebra: "animal",
7683
+ giraffe: "animal",
7684
+ suitcase: "package",
7685
+ backpack: "package",
7686
+ handbag: "package"
7687
+ },
7688
+ preserveOriginal: false
7689
+ };
7690
+ var AUDIO_MACRO_LABELS = [
7691
+ {
7692
+ id: "speech",
7693
+ name: "Speech",
7694
+ icon: "🗣️"
7695
+ },
7696
+ {
7697
+ id: "scream",
7698
+ name: "Scream / Shout",
7699
+ icon: "😱"
7700
+ },
7701
+ {
7702
+ id: "crying",
7703
+ name: "Crying / Baby",
7704
+ icon: "😢"
7705
+ },
7706
+ {
7707
+ id: "laughter",
7708
+ name: "Laughter",
7709
+ icon: "😂"
7710
+ },
7711
+ {
7712
+ id: "music",
7713
+ name: "Music",
7714
+ icon: "🎵"
7715
+ },
7716
+ {
7717
+ id: "dog",
7718
+ name: "Dog",
7719
+ icon: "🐕"
7720
+ },
7721
+ {
7722
+ id: "cat",
7723
+ name: "Cat",
7724
+ icon: "🐈"
7725
+ },
7726
+ {
7727
+ id: "bird",
7728
+ name: "Bird",
7729
+ icon: "🐦"
7730
+ },
7731
+ {
7732
+ id: "animal",
7733
+ name: "Animal (other)",
7734
+ icon: "🐾"
7735
+ },
7736
+ {
7737
+ id: "alarm",
7738
+ name: "Alarm / Siren",
7739
+ icon: "🚨"
7740
+ },
7741
+ {
7742
+ id: "doorbell",
7743
+ name: "Doorbell / Knock",
7744
+ icon: "🔔"
7745
+ },
7746
+ {
7747
+ id: "glass_breaking",
7748
+ name: "Glass Breaking",
7749
+ icon: "💥"
7750
+ },
7751
+ {
7752
+ id: "gunshot",
7753
+ name: "Gunshot / Explosion",
7754
+ icon: "💣"
7755
+ },
7756
+ {
7757
+ id: "vehicle",
7758
+ name: "Vehicle",
7759
+ icon: "🚗"
7760
+ },
7761
+ {
7762
+ id: "siren",
7763
+ name: "Emergency Siren",
7764
+ icon: "🚑"
7765
+ },
7766
+ {
7767
+ id: "fire",
7768
+ name: "Fire / Smoke",
7769
+ icon: "🔥"
7770
+ },
7771
+ {
7772
+ id: "water",
7773
+ name: "Water",
7774
+ icon: "💧"
7775
+ },
7776
+ {
7777
+ id: "wind",
7778
+ name: "Wind / Weather",
7779
+ icon: "🌬️"
7780
+ },
7781
+ {
7782
+ id: "door",
7783
+ name: "Door",
7784
+ icon: "🚪"
7785
+ },
7786
+ {
7787
+ id: "footsteps",
7788
+ name: "Footsteps",
7789
+ icon: "👣"
7790
+ },
7791
+ {
7792
+ id: "crowd",
7793
+ name: "Crowd / Chatter",
7794
+ icon: "👥"
7795
+ },
7796
+ {
7797
+ id: "telephone",
7798
+ name: "Telephone",
7799
+ icon: "📞"
7800
+ },
7801
+ {
7802
+ id: "engine",
7803
+ name: "Engine / Motor",
7804
+ icon: "⚙️"
7805
+ },
7806
+ {
7807
+ id: "tools",
7808
+ name: "Tools / Construction",
7809
+ icon: "🔨"
7810
+ },
7811
+ {
7812
+ id: "silence",
7813
+ name: "Silence",
7814
+ icon: "🤫"
7815
+ }
7816
+ ];
7607
7817
  var YAMNET_TO_MACRO = {
7608
7818
  mapping: {
7609
7819
  Speech: "speech",
@@ -7870,6 +8080,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7870
8080
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7871
8081
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7872
8082
  /**
8083
+ * Unified event-kind taxonomy — THE single source of truth for
8084
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8085
+ * icon }`.
8086
+ *
8087
+ * This dictionary folds together what used to be scattered across four
8088
+ * copies:
8089
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8090
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8091
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8092
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8093
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8094
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8095
+ *
8096
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8097
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8098
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8099
+ * color or an icon: they read this dictionary (server descriptors carry the
8100
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8101
+ *
8102
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8103
+ */
8104
+ var TAXONOMY_COLORS = {
8105
+ motion: "#f59e0b",
8106
+ audio: "#06b6d4",
8107
+ person: "#22c55e",
8108
+ vehicle: "#3b82f6",
8109
+ animal: "#f97316",
8110
+ package: "#a855f7",
8111
+ sensor: "#8b5cf6",
8112
+ control: "#10b981",
8113
+ genericDetection: "#64748b"
8114
+ };
8115
+ var DETECTION_SUB_COLORS = {
8116
+ car: "#f59e0b",
8117
+ truck: "#d97706",
8118
+ bus: "#b45309",
8119
+ motorcycle: "#eab308",
8120
+ bicycle: "#ca8a04",
8121
+ airplane: "#60a5fa",
8122
+ boat: "#2563eb",
8123
+ train: "#1d4ed8",
8124
+ bird: "#14b8a6",
8125
+ dog: "#84cc16",
8126
+ cat: "#f97316",
8127
+ horse: "#a16207",
8128
+ sheep: "#a3a3a3",
8129
+ cow: "#78716c",
8130
+ elephant: "#6b7280",
8131
+ bear: "#7c2d12",
8132
+ zebra: "#404040",
8133
+ giraffe: "#d4a373"
8134
+ };
8135
+ function titleCase(id) {
8136
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8137
+ }
8138
+ var entries = /* @__PURE__ */ new Map();
8139
+ function macro(kind, category, color, iconId, label) {
8140
+ entries.set(kind, {
8141
+ kind,
8142
+ parentKind: null,
8143
+ level: "macro",
8144
+ category,
8145
+ color,
8146
+ iconId,
8147
+ labelKey: `eventKind.${kind}`,
8148
+ label
8149
+ });
8150
+ }
8151
+ function sub(kind, parentKind, category, color, iconId, label) {
8152
+ entries.set(kind, {
8153
+ kind,
8154
+ parentKind,
8155
+ level: "sub",
8156
+ category,
8157
+ color,
8158
+ iconId,
8159
+ labelKey: `eventKind.${kind}`,
8160
+ label
8161
+ });
8162
+ }
8163
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8164
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8165
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8166
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8167
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8168
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8169
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8170
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8171
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8172
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8173
+ if (entries.has(cocoClass)) continue;
8174
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8175
+ }
8176
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8177
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8178
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8179
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8180
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8181
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8182
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8183
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8184
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8185
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8186
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8187
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8188
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8189
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8190
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8191
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8192
+ sub("button", "control", "control", "#10b981", "button", "Button");
8193
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8194
+ for (const l of AUDIO_MACRO_LABELS) {
8195
+ const kind = `audio-${l.id}`;
8196
+ if (entries.has(kind)) continue;
8197
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8198
+ }
8199
+ /** The complete taxonomy dictionary, keyed by kind. */
8200
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8201
+ /**
7873
8202
  * Error types for the safe expression engine. Two distinct classes so callers
7874
8203
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7875
8204
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -14824,9 +15153,10 @@ var DEVICE_LOCAL_STATE_CAPS = {
14824
15153
  * `package` backs the package-drop detector — a package zone is a
14825
15154
  * `ZoneRule` on the `'package'` stage referencing drawn polygons
14826
15155
  * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14827
- * The orchestrator provider that writes this stage lands in a later
14828
- * slice; until then the mirror carries only `{motion, detection}` and
14829
- * consumers read `package` as absent (treat as `[]`).
15156
+ * The orchestrator provider writes this stage as a first-class slice
15157
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
15158
+ * package}` shape, so consumers read the current package rules directly
15159
+ * off `device.state.zoneRules.value.package`.
14830
15160
  */
14831
15161
  runtimeState: object({
14832
15162
  motion: array(ZoneRuleSchema).readonly(),
@@ -18818,17 +19148,30 @@ var EventKindCategorySchema = _enum([
18818
19148
  "audio",
18819
19149
  "detection",
18820
19150
  "sensor",
19151
+ "control",
18821
19152
  "custom",
18822
19153
  "package"
18823
19154
  ]);
19155
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19156
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18824
19157
  var EventKindDescriptorSchema = object({
18825
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19158
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18826
19159
  kind: string(),
19160
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19161
+ labelKey: string(),
19162
+ /** English fallback label (kept for clients that don't translate). */
18827
19163
  label: string(),
18828
19164
  /** Hex color for timeline/legend rendering. */
18829
19165
  color: string(),
19166
+ /** Dictionary id → lucide component on the UI side. */
19167
+ iconId: string(),
19168
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18830
19169
  icon: EventKindIconSchema,
18831
19170
  category: EventKindCategorySchema,
19171
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19172
+ parentKind: string().nullable(),
19173
+ /** Derived from `parentKind`, explicit for the client tree. */
19174
+ level: EventKindLevelSchema,
18832
19175
  /** Which cap + device contributes this kind. For built-ins the camera
18833
19176
  * itself; for sensor kinds the LINKED source device. */
18834
19177
  source: object({
@@ -18901,11 +19244,21 @@ var TrackAudioLabelSchema = object({
18901
19244
  firstAt: number(),
18902
19245
  lastAt: number()
18903
19246
  });
19247
+ /**
19248
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19249
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19250
+ * linked sensor/control state change (no positions; carries a snapshot). The
19251
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19252
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19253
+ */
19254
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18904
19255
  var TrackSchema = object({
18905
19256
  trackId: string(),
18906
19257
  deviceId: number(),
18907
19258
  className: string(),
18908
19259
  label: string().optional(),
19260
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19261
+ source: TrackSourceSchema.optional(),
18909
19262
  firstSeen: number(),
18910
19263
  lastSeen: number(),
18911
19264
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19160,6 +19513,26 @@ var TrackCascadeCountsSchema = object({
19160
19513
  /** Per-track CLIP search vectors removed (best-effort). */
19161
19514
  embeddings: number().int()
19162
19515
  });
19516
+ /** Event-store footprint for one camera. */
19517
+ var EventStoreDeviceFootprintSchema = object({
19518
+ deviceId: number(),
19519
+ /** Persisted event rows (motion + object + audio) for the camera. */
19520
+ rows: number().int(),
19521
+ /** Event-owned media bytes on disk for the camera. */
19522
+ bytes: number().int()
19523
+ });
19524
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19525
+ var EventStoreFootprintSchema = object({
19526
+ totalRows: number().int(),
19527
+ totalBytes: number().int(),
19528
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19529
+ });
19530
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19531
+ var EventPruneCountsSchema = object({
19532
+ motion: number().int(),
19533
+ object: number().int(),
19534
+ audio: number().int()
19535
+ });
19163
19536
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19164
19537
  deviceId: number(),
19165
19538
  trackId: string()
@@ -19223,6 +19596,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19223
19596
  }), {
19224
19597
  kind: "mutation",
19225
19598
  auth: "admin"
19599
+ }), method(object({}), EventStoreFootprintSchema, {
19600
+ kind: "query",
19601
+ auth: "admin"
19602
+ }), method(object({
19603
+ olderThanMs: number(),
19604
+ reason: OpsLogReasonSchema.optional()
19605
+ }), EventPruneCountsSchema, {
19606
+ kind: "mutation",
19607
+ auth: "admin"
19608
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19609
+ kind: "mutation",
19610
+ auth: "admin"
19611
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19612
+ kind: "query",
19613
+ auth: "admin"
19226
19614
  }), method(object({
19227
19615
  eventId: string(),
19228
19616
  kind: MediaFileKindEnum.optional()
@@ -19247,6 +19635,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19247
19635
  eventId: string(),
19248
19636
  timestamp: number()
19249
19637
  });
19638
+ /**
19639
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19640
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19641
+ * caps into per-camera event-kind descriptors.
19642
+ *
19643
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19644
+ * is NOT duplicated here — every entry is derived from the single
19645
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19646
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19647
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19648
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19649
+ * eventful cap is missing.
19650
+ */
19651
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19652
+ var LEGACY_ICON = {
19653
+ motion: "motion",
19654
+ audio: "audio",
19655
+ person: "person",
19656
+ vehicle: "vehicle",
19657
+ animal: "animal",
19658
+ package: "package",
19659
+ door: "door",
19660
+ pir: "pir",
19661
+ smoke: "smoke",
19662
+ water: "water",
19663
+ button: "button",
19664
+ generic: "generic",
19665
+ gas: "smoke",
19666
+ vibration: "generic",
19667
+ tamper: "generic",
19668
+ presence: "person",
19669
+ lock: "generic",
19670
+ siren: "generic",
19671
+ switch: "generic",
19672
+ doorbell: "button"
19673
+ };
19674
+ function legacyIcon(iconId) {
19675
+ return LEGACY_ICON[iconId] ?? "generic";
19676
+ }
19677
+ /**
19678
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19679
+ * The anti-drift guard cross-checks this against the eventful caps declared
19680
+ * in `packages/types/src/capabilities/*.cap.ts`.
19681
+ */
19682
+ var CAP_TO_KIND = {
19683
+ contact: "contact",
19684
+ motion: "motion-sensor",
19685
+ smoke: "smoke",
19686
+ flood: "flood",
19687
+ gas: "gas",
19688
+ "carbon-monoxide": "carbon-monoxide",
19689
+ vibration: "vibration",
19690
+ tamper: "tamper",
19691
+ presence: "presence",
19692
+ "enum-sensor": "enum-sensor",
19693
+ "event-emitter": "device-event",
19694
+ "lock-control": "lock",
19695
+ switch: "switch",
19696
+ button: "button",
19697
+ doorbell: "doorbell"
19698
+ };
19699
+ function buildDescriptor(capName, kind) {
19700
+ const t = EVENT_TAXONOMY[kind];
19701
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19702
+ return {
19703
+ ...t,
19704
+ icon: legacyIcon(t.iconId)
19705
+ };
19706
+ }
19707
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19250
19708
  var CameraPipelineConfigSchema = object({
19251
19709
  engine: PipelineEngineChoiceSchema.optional(),
19252
19710
  steps: array(PipelineStepInputSchema).readonly(),
@@ -22456,13 +22914,29 @@ method(object({
22456
22914
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22457
22915
  kind: "mutation",
22458
22916
  auth: "admin"
22459
- }), method(object({ deviceId: number() }), object({
22917
+ }), method(object({
22918
+ deviceId: number(),
22919
+ reason: OpsLogReasonSchema.optional()
22920
+ }), object({
22460
22921
  floorMs: number().nullable(),
22461
22922
  deletedBuckets: number().int(),
22462
22923
  reclaimedBytes: number().int()
22463
22924
  }), {
22464
22925
  kind: "mutation",
22465
22926
  auth: "admin"
22927
+ }), method(object({
22928
+ deviceId: number(),
22929
+ fromMs: number().optional(),
22930
+ toMs: number().optional()
22931
+ }), object({
22932
+ deletedBuckets: number().int(),
22933
+ reclaimedBytes: number().int()
22934
+ }), {
22935
+ kind: "mutation",
22936
+ auth: "admin"
22937
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
22938
+ kind: "query",
22939
+ auth: "admin"
22466
22940
  });
22467
22941
  /**
22468
22942
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -25584,6 +26058,12 @@ Object.freeze({
25584
26058
  addonId: null,
25585
26059
  access: "delete"
25586
26060
  },
26061
+ "pipelineAnalytics.deleteDeviceEvents": {
26062
+ capName: "pipeline-analytics",
26063
+ capScope: "device",
26064
+ addonId: null,
26065
+ access: "delete"
26066
+ },
25587
26067
  "pipelineAnalytics.deleteTracks": {
25588
26068
  capName: "pipeline-analytics",
25589
26069
  capScope: "device",
@@ -25614,6 +26094,12 @@ Object.freeze({
25614
26094
  addonId: null,
25615
26095
  access: "view"
25616
26096
  },
26097
+ "pipelineAnalytics.getEventStoreFootprint": {
26098
+ capName: "pipeline-analytics",
26099
+ capScope: "device",
26100
+ addonId: null,
26101
+ access: "view"
26102
+ },
25617
26103
  "pipelineAnalytics.getKeyEvents": {
25618
26104
  capName: "pipeline-analytics",
25619
26105
  capScope: "device",
@@ -25656,6 +26142,12 @@ Object.freeze({
25656
26142
  addonId: null,
25657
26143
  access: "view"
25658
26144
  },
26145
+ "pipelineAnalytics.listOpsLog": {
26146
+ capName: "pipeline-analytics",
26147
+ capScope: "device",
26148
+ addonId: null,
26149
+ access: "view"
26150
+ },
25659
26151
  "pipelineAnalytics.listRecentTracks": {
25660
26152
  capName: "pipeline-analytics",
25661
26153
  capScope: "device",
@@ -25668,6 +26160,12 @@ Object.freeze({
25668
26160
  addonId: null,
25669
26161
  access: "view"
25670
26162
  },
26163
+ "pipelineAnalytics.pruneEvents": {
26164
+ capName: "pipeline-analytics",
26165
+ capScope: "device",
26166
+ addonId: null,
26167
+ access: "create"
26168
+ },
25671
26169
  "pipelineAnalytics.pruneEventsBefore": {
25672
26170
  capName: "pipeline-analytics",
25673
26171
  capScope: "device",
@@ -26430,6 +26928,12 @@ Object.freeze({
26430
26928
  addonId: null,
26431
26929
  access: "create"
26432
26930
  },
26931
+ "recording.deleteFootprint": {
26932
+ capName: "recording",
26933
+ capScope: "system",
26934
+ addonId: null,
26935
+ access: "delete"
26936
+ },
26433
26937
  "recording.getAvailability": {
26434
26938
  capName: "recording",
26435
26939
  capScope: "system",
@@ -26460,6 +26964,12 @@ Object.freeze({
26460
26964
  addonId: null,
26461
26965
  access: "view"
26462
26966
  },
26967
+ "recording.listOpsLog": {
26968
+ capName: "recording",
26969
+ capScope: "system",
26970
+ addonId: null,
26971
+ access: "view"
26972
+ },
26463
26973
  "recording.locateSegment": {
26464
26974
  capName: "recording",
26465
26975
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-tuya",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Tuya / Smart Life device-provider addon for CamStack — account-onboarded (Tuya IoT cloud fetch of device localKeys) + LOCAL DP control via the @apocaliss92/nodetuya encrypted-LAN client, exposing switch / water-heater-family kettle entities",
5
5
  "keywords": [
6
6
  "camstack",