@camstack/addon-provider-rtsp 1.1.26 → 1.1.28

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
@@ -7370,6 +7370,62 @@ var RecordingConfigSchema = object({
7370
7370
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7371
7371
  });
7372
7372
  /**
7373
+ * Ops-log — the durable, append-only operations audit shared by the
7374
+ * recordings and events management surfaces.
7375
+ *
7376
+ * ONE row shape is reused for both domains so a single "Activity" view can
7377
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7378
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7379
+ * management operation, WHY it ran (reason), and its measurable effect
7380
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7381
+ * never fail the operation it records.
7382
+ */
7383
+ /** Which management domain the operation belongs to. */
7384
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7385
+ /** The kind of management operation performed. */
7386
+ var OpsLogOpSchema = _enum([
7387
+ "prune",
7388
+ "manual-delete",
7389
+ "rescan",
7390
+ "retention-run"
7391
+ ]);
7392
+ /** Why the operation ran. */
7393
+ var OpsLogReasonSchema = _enum([
7394
+ "retention",
7395
+ "quota",
7396
+ "manual",
7397
+ "operator"
7398
+ ]);
7399
+ /** One audit row, shared verbatim by both domains. */
7400
+ var OpsLogEntrySchema = object({
7401
+ /** Unique row id. */
7402
+ id: string(),
7403
+ /** Epoch ms the operation completed. */
7404
+ at: number(),
7405
+ domain: OpsLogDomainSchema,
7406
+ op: OpsLogOpSchema,
7407
+ reason: OpsLogReasonSchema,
7408
+ /** The camera the op targeted; null for a cluster/global op. */
7409
+ deviceId: number().nullable(),
7410
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7411
+ nodeId: string(),
7412
+ /** Buckets / rows deleted (op-specific unit). */
7413
+ itemsAffected: number(),
7414
+ /** Bytes reclaimed by the op (0 when not measurable). */
7415
+ bytesReclaimed: number(),
7416
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7417
+ detail: string().nullable(),
7418
+ /** Who/what triggered the op. */
7419
+ actor: string()
7420
+ });
7421
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7422
+ var OpsLogQueryInputSchema = object({
7423
+ /** Restrict to a single camera; omit for every row. */
7424
+ deviceId: number().optional(),
7425
+ /** Max rows returned, newest-first. */
7426
+ limit: number().int().min(1).max(1e3).optional()
7427
+ });
7428
+ /**
7373
7429
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7374
7430
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7375
7431
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7645,6 +7701,160 @@ var EncodeProfileSchema = object({
7645
7701
  */
7646
7702
  outputArgs: array(string()).optional()
7647
7703
  });
7704
+ var COCO_TO_MACRO = {
7705
+ mapping: {
7706
+ person: "person",
7707
+ bicycle: "vehicle",
7708
+ car: "vehicle",
7709
+ motorcycle: "vehicle",
7710
+ airplane: "vehicle",
7711
+ bus: "vehicle",
7712
+ train: "vehicle",
7713
+ truck: "vehicle",
7714
+ boat: "vehicle",
7715
+ bird: "animal",
7716
+ cat: "animal",
7717
+ dog: "animal",
7718
+ horse: "animal",
7719
+ sheep: "animal",
7720
+ cow: "animal",
7721
+ elephant: "animal",
7722
+ bear: "animal",
7723
+ zebra: "animal",
7724
+ giraffe: "animal",
7725
+ suitcase: "package",
7726
+ backpack: "package",
7727
+ handbag: "package"
7728
+ },
7729
+ preserveOriginal: false
7730
+ };
7731
+ var AUDIO_MACRO_LABELS = [
7732
+ {
7733
+ id: "speech",
7734
+ name: "Speech",
7735
+ icon: "🗣️"
7736
+ },
7737
+ {
7738
+ id: "scream",
7739
+ name: "Scream / Shout",
7740
+ icon: "😱"
7741
+ },
7742
+ {
7743
+ id: "crying",
7744
+ name: "Crying / Baby",
7745
+ icon: "😢"
7746
+ },
7747
+ {
7748
+ id: "laughter",
7749
+ name: "Laughter",
7750
+ icon: "😂"
7751
+ },
7752
+ {
7753
+ id: "music",
7754
+ name: "Music",
7755
+ icon: "🎵"
7756
+ },
7757
+ {
7758
+ id: "dog",
7759
+ name: "Dog",
7760
+ icon: "🐕"
7761
+ },
7762
+ {
7763
+ id: "cat",
7764
+ name: "Cat",
7765
+ icon: "🐈"
7766
+ },
7767
+ {
7768
+ id: "bird",
7769
+ name: "Bird",
7770
+ icon: "🐦"
7771
+ },
7772
+ {
7773
+ id: "animal",
7774
+ name: "Animal (other)",
7775
+ icon: "🐾"
7776
+ },
7777
+ {
7778
+ id: "alarm",
7779
+ name: "Alarm / Siren",
7780
+ icon: "🚨"
7781
+ },
7782
+ {
7783
+ id: "doorbell",
7784
+ name: "Doorbell / Knock",
7785
+ icon: "🔔"
7786
+ },
7787
+ {
7788
+ id: "glass_breaking",
7789
+ name: "Glass Breaking",
7790
+ icon: "💥"
7791
+ },
7792
+ {
7793
+ id: "gunshot",
7794
+ name: "Gunshot / Explosion",
7795
+ icon: "💣"
7796
+ },
7797
+ {
7798
+ id: "vehicle",
7799
+ name: "Vehicle",
7800
+ icon: "🚗"
7801
+ },
7802
+ {
7803
+ id: "siren",
7804
+ name: "Emergency Siren",
7805
+ icon: "🚑"
7806
+ },
7807
+ {
7808
+ id: "fire",
7809
+ name: "Fire / Smoke",
7810
+ icon: "🔥"
7811
+ },
7812
+ {
7813
+ id: "water",
7814
+ name: "Water",
7815
+ icon: "💧"
7816
+ },
7817
+ {
7818
+ id: "wind",
7819
+ name: "Wind / Weather",
7820
+ icon: "🌬️"
7821
+ },
7822
+ {
7823
+ id: "door",
7824
+ name: "Door",
7825
+ icon: "🚪"
7826
+ },
7827
+ {
7828
+ id: "footsteps",
7829
+ name: "Footsteps",
7830
+ icon: "👣"
7831
+ },
7832
+ {
7833
+ id: "crowd",
7834
+ name: "Crowd / Chatter",
7835
+ icon: "👥"
7836
+ },
7837
+ {
7838
+ id: "telephone",
7839
+ name: "Telephone",
7840
+ icon: "📞"
7841
+ },
7842
+ {
7843
+ id: "engine",
7844
+ name: "Engine / Motor",
7845
+ icon: "⚙️"
7846
+ },
7847
+ {
7848
+ id: "tools",
7849
+ name: "Tools / Construction",
7850
+ icon: "🔨"
7851
+ },
7852
+ {
7853
+ id: "silence",
7854
+ name: "Silence",
7855
+ icon: "🤫"
7856
+ }
7857
+ ];
7648
7858
  var YAMNET_TO_MACRO = {
7649
7859
  mapping: {
7650
7860
  Speech: "speech",
@@ -7911,6 +8121,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7911
8121
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7912
8122
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7913
8123
  /**
8124
+ * Unified event-kind taxonomy — THE single source of truth for
8125
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8126
+ * icon }`.
8127
+ *
8128
+ * This dictionary folds together what used to be scattered across four
8129
+ * copies:
8130
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8131
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8132
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8133
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8134
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8135
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8136
+ *
8137
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8138
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8139
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8140
+ * color or an icon: they read this dictionary (server descriptors carry the
8141
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8142
+ *
8143
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8144
+ */
8145
+ var TAXONOMY_COLORS = {
8146
+ motion: "#f59e0b",
8147
+ audio: "#06b6d4",
8148
+ person: "#22c55e",
8149
+ vehicle: "#3b82f6",
8150
+ animal: "#f97316",
8151
+ package: "#a855f7",
8152
+ sensor: "#8b5cf6",
8153
+ control: "#10b981",
8154
+ genericDetection: "#64748b"
8155
+ };
8156
+ var DETECTION_SUB_COLORS = {
8157
+ car: "#f59e0b",
8158
+ truck: "#d97706",
8159
+ bus: "#b45309",
8160
+ motorcycle: "#eab308",
8161
+ bicycle: "#ca8a04",
8162
+ airplane: "#60a5fa",
8163
+ boat: "#2563eb",
8164
+ train: "#1d4ed8",
8165
+ bird: "#14b8a6",
8166
+ dog: "#84cc16",
8167
+ cat: "#f97316",
8168
+ horse: "#a16207",
8169
+ sheep: "#a3a3a3",
8170
+ cow: "#78716c",
8171
+ elephant: "#6b7280",
8172
+ bear: "#7c2d12",
8173
+ zebra: "#404040",
8174
+ giraffe: "#d4a373"
8175
+ };
8176
+ function titleCase(id) {
8177
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8178
+ }
8179
+ var entries = /* @__PURE__ */ new Map();
8180
+ function macro(kind, category, color, iconId, label) {
8181
+ entries.set(kind, {
8182
+ kind,
8183
+ parentKind: null,
8184
+ level: "macro",
8185
+ category,
8186
+ color,
8187
+ iconId,
8188
+ labelKey: `eventKind.${kind}`,
8189
+ label
8190
+ });
8191
+ }
8192
+ function sub(kind, parentKind, category, color, iconId, label) {
8193
+ entries.set(kind, {
8194
+ kind,
8195
+ parentKind,
8196
+ level: "sub",
8197
+ category,
8198
+ color,
8199
+ iconId,
8200
+ labelKey: `eventKind.${kind}`,
8201
+ label
8202
+ });
8203
+ }
8204
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8205
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8206
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8207
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8208
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8209
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8210
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8211
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8212
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8213
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8214
+ if (entries.has(cocoClass)) continue;
8215
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8216
+ }
8217
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8218
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8219
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8220
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8221
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8222
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8223
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8224
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8225
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8226
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8227
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8228
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8229
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8230
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8231
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8232
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8233
+ sub("button", "control", "control", "#10b981", "button", "Button");
8234
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8235
+ for (const l of AUDIO_MACRO_LABELS) {
8236
+ const kind = `audio-${l.id}`;
8237
+ if (entries.has(kind)) continue;
8238
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8239
+ }
8240
+ /** The complete taxonomy dictionary, keyed by kind. */
8241
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8242
+ /**
7914
8243
  * Error types for the safe expression engine. Two distinct classes so callers
7915
8244
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7916
8245
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -14931,9 +15260,10 @@ var DEVICE_LOCAL_STATE_CAPS = {
14931
15260
  * `package` backs the package-drop detector — a package zone is a
14932
15261
  * `ZoneRule` on the `'package'` stage referencing drawn polygons
14933
15262
  * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14934
- * The orchestrator provider that writes this stage lands in a later
14935
- * slice; until then the mirror carries only `{motion, detection}` and
14936
- * consumers read `package` as absent (treat as `[]`).
15263
+ * The orchestrator provider writes this stage as a first-class slice
15264
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
15265
+ * package}` shape, so consumers read the current package rules directly
15266
+ * off `device.state.zoneRules.value.package`.
14937
15267
  */
14938
15268
  runtimeState: object({
14939
15269
  motion: array(ZoneRuleSchema).readonly(),
@@ -18908,17 +19238,30 @@ var EventKindCategorySchema = _enum([
18908
19238
  "audio",
18909
19239
  "detection",
18910
19240
  "sensor",
19241
+ "control",
18911
19242
  "custom",
18912
19243
  "package"
18913
19244
  ]);
19245
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19246
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18914
19247
  var EventKindDescriptorSchema = object({
18915
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19248
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18916
19249
  kind: string(),
19250
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19251
+ labelKey: string(),
19252
+ /** English fallback label (kept for clients that don't translate). */
18917
19253
  label: string(),
18918
19254
  /** Hex color for timeline/legend rendering. */
18919
19255
  color: string(),
19256
+ /** Dictionary id → lucide component on the UI side. */
19257
+ iconId: string(),
19258
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18920
19259
  icon: EventKindIconSchema,
18921
19260
  category: EventKindCategorySchema,
19261
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19262
+ parentKind: string().nullable(),
19263
+ /** Derived from `parentKind`, explicit for the client tree. */
19264
+ level: EventKindLevelSchema,
18922
19265
  /** Which cap + device contributes this kind. For built-ins the camera
18923
19266
  * itself; for sensor kinds the LINKED source device. */
18924
19267
  source: object({
@@ -18991,11 +19334,21 @@ var TrackAudioLabelSchema = object({
18991
19334
  firstAt: number(),
18992
19335
  lastAt: number()
18993
19336
  });
19337
+ /**
19338
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19339
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19340
+ * linked sensor/control state change (no positions; carries a snapshot). The
19341
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19342
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19343
+ */
19344
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18994
19345
  var TrackSchema = object({
18995
19346
  trackId: string(),
18996
19347
  deviceId: number(),
18997
19348
  className: string(),
18998
19349
  label: string().optional(),
19350
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19351
+ source: TrackSourceSchema.optional(),
18999
19352
  firstSeen: number(),
19000
19353
  lastSeen: number(),
19001
19354
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19250,6 +19603,26 @@ var TrackCascadeCountsSchema = object({
19250
19603
  /** Per-track CLIP search vectors removed (best-effort). */
19251
19604
  embeddings: number().int()
19252
19605
  });
19606
+ /** Event-store footprint for one camera. */
19607
+ var EventStoreDeviceFootprintSchema = object({
19608
+ deviceId: number(),
19609
+ /** Persisted event rows (motion + object + audio) for the camera. */
19610
+ rows: number().int(),
19611
+ /** Event-owned media bytes on disk for the camera. */
19612
+ bytes: number().int()
19613
+ });
19614
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19615
+ var EventStoreFootprintSchema = object({
19616
+ totalRows: number().int(),
19617
+ totalBytes: number().int(),
19618
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19619
+ });
19620
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19621
+ var EventPruneCountsSchema = object({
19622
+ motion: number().int(),
19623
+ object: number().int(),
19624
+ audio: number().int()
19625
+ });
19253
19626
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19254
19627
  deviceId: number(),
19255
19628
  trackId: string()
@@ -19313,6 +19686,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19313
19686
  }), {
19314
19687
  kind: "mutation",
19315
19688
  auth: "admin"
19689
+ }), method(object({}), EventStoreFootprintSchema, {
19690
+ kind: "query",
19691
+ auth: "admin"
19692
+ }), method(object({
19693
+ olderThanMs: number(),
19694
+ reason: OpsLogReasonSchema.optional()
19695
+ }), EventPruneCountsSchema, {
19696
+ kind: "mutation",
19697
+ auth: "admin"
19698
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19699
+ kind: "mutation",
19700
+ auth: "admin"
19701
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19702
+ kind: "query",
19703
+ auth: "admin"
19316
19704
  }), method(object({
19317
19705
  eventId: string(),
19318
19706
  kind: MediaFileKindEnum.optional()
@@ -19337,6 +19725,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19337
19725
  eventId: string(),
19338
19726
  timestamp: number()
19339
19727
  });
19728
+ /**
19729
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19730
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19731
+ * caps into per-camera event-kind descriptors.
19732
+ *
19733
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19734
+ * is NOT duplicated here — every entry is derived from the single
19735
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19736
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19737
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19738
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19739
+ * eventful cap is missing.
19740
+ */
19741
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19742
+ var LEGACY_ICON = {
19743
+ motion: "motion",
19744
+ audio: "audio",
19745
+ person: "person",
19746
+ vehicle: "vehicle",
19747
+ animal: "animal",
19748
+ package: "package",
19749
+ door: "door",
19750
+ pir: "pir",
19751
+ smoke: "smoke",
19752
+ water: "water",
19753
+ button: "button",
19754
+ generic: "generic",
19755
+ gas: "smoke",
19756
+ vibration: "generic",
19757
+ tamper: "generic",
19758
+ presence: "person",
19759
+ lock: "generic",
19760
+ siren: "generic",
19761
+ switch: "generic",
19762
+ doorbell: "button"
19763
+ };
19764
+ function legacyIcon(iconId) {
19765
+ return LEGACY_ICON[iconId] ?? "generic";
19766
+ }
19767
+ /**
19768
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19769
+ * The anti-drift guard cross-checks this against the eventful caps declared
19770
+ * in `packages/types/src/capabilities/*.cap.ts`.
19771
+ */
19772
+ var CAP_TO_KIND = {
19773
+ contact: "contact",
19774
+ motion: "motion-sensor",
19775
+ smoke: "smoke",
19776
+ flood: "flood",
19777
+ gas: "gas",
19778
+ "carbon-monoxide": "carbon-monoxide",
19779
+ vibration: "vibration",
19780
+ tamper: "tamper",
19781
+ presence: "presence",
19782
+ "enum-sensor": "enum-sensor",
19783
+ "event-emitter": "device-event",
19784
+ "lock-control": "lock",
19785
+ switch: "switch",
19786
+ button: "button",
19787
+ doorbell: "doorbell"
19788
+ };
19789
+ function buildDescriptor(capName, kind) {
19790
+ const t = EVENT_TAXONOMY[kind];
19791
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19792
+ return {
19793
+ ...t,
19794
+ icon: legacyIcon(t.iconId)
19795
+ };
19796
+ }
19797
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19340
19798
  var CameraPipelineConfigSchema = object({
19341
19799
  engine: PipelineEngineChoiceSchema.optional(),
19342
19800
  steps: array(PipelineStepInputSchema).readonly(),
@@ -22597,13 +23055,29 @@ method(object({
22597
23055
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22598
23056
  kind: "mutation",
22599
23057
  auth: "admin"
22600
- }), method(object({ deviceId: number() }), object({
23058
+ }), method(object({
23059
+ deviceId: number(),
23060
+ reason: OpsLogReasonSchema.optional()
23061
+ }), object({
22601
23062
  floorMs: number().nullable(),
22602
23063
  deletedBuckets: number().int(),
22603
23064
  reclaimedBytes: number().int()
22604
23065
  }), {
22605
23066
  kind: "mutation",
22606
23067
  auth: "admin"
23068
+ }), method(object({
23069
+ deviceId: number(),
23070
+ fromMs: number().optional(),
23071
+ toMs: number().optional()
23072
+ }), object({
23073
+ deletedBuckets: number().int(),
23074
+ reclaimedBytes: number().int()
23075
+ }), {
23076
+ kind: "mutation",
23077
+ auth: "admin"
23078
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
23079
+ kind: "query",
23080
+ auth: "admin"
22607
23081
  });
22608
23082
  /**
22609
23083
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -25738,6 +26212,12 @@ Object.freeze({
25738
26212
  addonId: null,
25739
26213
  access: "delete"
25740
26214
  },
26215
+ "pipelineAnalytics.deleteDeviceEvents": {
26216
+ capName: "pipeline-analytics",
26217
+ capScope: "device",
26218
+ addonId: null,
26219
+ access: "delete"
26220
+ },
25741
26221
  "pipelineAnalytics.deleteTracks": {
25742
26222
  capName: "pipeline-analytics",
25743
26223
  capScope: "device",
@@ -25768,6 +26248,12 @@ Object.freeze({
25768
26248
  addonId: null,
25769
26249
  access: "view"
25770
26250
  },
26251
+ "pipelineAnalytics.getEventStoreFootprint": {
26252
+ capName: "pipeline-analytics",
26253
+ capScope: "device",
26254
+ addonId: null,
26255
+ access: "view"
26256
+ },
25771
26257
  "pipelineAnalytics.getKeyEvents": {
25772
26258
  capName: "pipeline-analytics",
25773
26259
  capScope: "device",
@@ -25810,6 +26296,12 @@ Object.freeze({
25810
26296
  addonId: null,
25811
26297
  access: "view"
25812
26298
  },
26299
+ "pipelineAnalytics.listOpsLog": {
26300
+ capName: "pipeline-analytics",
26301
+ capScope: "device",
26302
+ addonId: null,
26303
+ access: "view"
26304
+ },
25813
26305
  "pipelineAnalytics.listRecentTracks": {
25814
26306
  capName: "pipeline-analytics",
25815
26307
  capScope: "device",
@@ -25822,6 +26314,12 @@ Object.freeze({
25822
26314
  addonId: null,
25823
26315
  access: "view"
25824
26316
  },
26317
+ "pipelineAnalytics.pruneEvents": {
26318
+ capName: "pipeline-analytics",
26319
+ capScope: "device",
26320
+ addonId: null,
26321
+ access: "create"
26322
+ },
25825
26323
  "pipelineAnalytics.pruneEventsBefore": {
25826
26324
  capName: "pipeline-analytics",
25827
26325
  capScope: "device",
@@ -26584,6 +27082,12 @@ Object.freeze({
26584
27082
  addonId: null,
26585
27083
  access: "create"
26586
27084
  },
27085
+ "recording.deleteFootprint": {
27086
+ capName: "recording",
27087
+ capScope: "system",
27088
+ addonId: null,
27089
+ access: "delete"
27090
+ },
26587
27091
  "recording.getAvailability": {
26588
27092
  capName: "recording",
26589
27093
  capScope: "system",
@@ -26614,6 +27118,12 @@ Object.freeze({
26614
27118
  addonId: null,
26615
27119
  access: "view"
26616
27120
  },
27121
+ "recording.listOpsLog": {
27122
+ capName: "recording",
27123
+ capScope: "system",
27124
+ addonId: null,
27125
+ access: "view"
27126
+ },
26617
27127
  "recording.locateSegment": {
26618
27128
  capName: "recording",
26619
27129
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -7346,6 +7346,62 @@ var RecordingConfigSchema = object({
7346
7346
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7347
7347
  });
7348
7348
  /**
7349
+ * Ops-log — the durable, append-only operations audit shared by the
7350
+ * recordings and events management surfaces.
7351
+ *
7352
+ * ONE row shape is reused for both domains so a single "Activity" view can
7353
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7354
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7355
+ * management operation, WHY it ran (reason), and its measurable effect
7356
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7357
+ * never fail the operation it records.
7358
+ */
7359
+ /** Which management domain the operation belongs to. */
7360
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7361
+ /** The kind of management operation performed. */
7362
+ var OpsLogOpSchema = _enum([
7363
+ "prune",
7364
+ "manual-delete",
7365
+ "rescan",
7366
+ "retention-run"
7367
+ ]);
7368
+ /** Why the operation ran. */
7369
+ var OpsLogReasonSchema = _enum([
7370
+ "retention",
7371
+ "quota",
7372
+ "manual",
7373
+ "operator"
7374
+ ]);
7375
+ /** One audit row, shared verbatim by both domains. */
7376
+ var OpsLogEntrySchema = object({
7377
+ /** Unique row id. */
7378
+ id: string(),
7379
+ /** Epoch ms the operation completed. */
7380
+ at: number(),
7381
+ domain: OpsLogDomainSchema,
7382
+ op: OpsLogOpSchema,
7383
+ reason: OpsLogReasonSchema,
7384
+ /** The camera the op targeted; null for a cluster/global op. */
7385
+ deviceId: number().nullable(),
7386
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7387
+ nodeId: string(),
7388
+ /** Buckets / rows deleted (op-specific unit). */
7389
+ itemsAffected: number(),
7390
+ /** Bytes reclaimed by the op (0 when not measurable). */
7391
+ bytesReclaimed: number(),
7392
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7393
+ detail: string().nullable(),
7394
+ /** Who/what triggered the op. */
7395
+ actor: string()
7396
+ });
7397
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7398
+ var OpsLogQueryInputSchema = object({
7399
+ /** Restrict to a single camera; omit for every row. */
7400
+ deviceId: number().optional(),
7401
+ /** Max rows returned, newest-first. */
7402
+ limit: number().int().min(1).max(1e3).optional()
7403
+ });
7404
+ /**
7349
7405
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7350
7406
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7351
7407
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7621,6 +7677,160 @@ var EncodeProfileSchema = object({
7621
7677
  */
7622
7678
  outputArgs: array(string()).optional()
7623
7679
  });
7680
+ var COCO_TO_MACRO = {
7681
+ mapping: {
7682
+ person: "person",
7683
+ bicycle: "vehicle",
7684
+ car: "vehicle",
7685
+ motorcycle: "vehicle",
7686
+ airplane: "vehicle",
7687
+ bus: "vehicle",
7688
+ train: "vehicle",
7689
+ truck: "vehicle",
7690
+ boat: "vehicle",
7691
+ bird: "animal",
7692
+ cat: "animal",
7693
+ dog: "animal",
7694
+ horse: "animal",
7695
+ sheep: "animal",
7696
+ cow: "animal",
7697
+ elephant: "animal",
7698
+ bear: "animal",
7699
+ zebra: "animal",
7700
+ giraffe: "animal",
7701
+ suitcase: "package",
7702
+ backpack: "package",
7703
+ handbag: "package"
7704
+ },
7705
+ preserveOriginal: false
7706
+ };
7707
+ var AUDIO_MACRO_LABELS = [
7708
+ {
7709
+ id: "speech",
7710
+ name: "Speech",
7711
+ icon: "🗣️"
7712
+ },
7713
+ {
7714
+ id: "scream",
7715
+ name: "Scream / Shout",
7716
+ icon: "😱"
7717
+ },
7718
+ {
7719
+ id: "crying",
7720
+ name: "Crying / Baby",
7721
+ icon: "😢"
7722
+ },
7723
+ {
7724
+ id: "laughter",
7725
+ name: "Laughter",
7726
+ icon: "😂"
7727
+ },
7728
+ {
7729
+ id: "music",
7730
+ name: "Music",
7731
+ icon: "🎵"
7732
+ },
7733
+ {
7734
+ id: "dog",
7735
+ name: "Dog",
7736
+ icon: "🐕"
7737
+ },
7738
+ {
7739
+ id: "cat",
7740
+ name: "Cat",
7741
+ icon: "🐈"
7742
+ },
7743
+ {
7744
+ id: "bird",
7745
+ name: "Bird",
7746
+ icon: "🐦"
7747
+ },
7748
+ {
7749
+ id: "animal",
7750
+ name: "Animal (other)",
7751
+ icon: "🐾"
7752
+ },
7753
+ {
7754
+ id: "alarm",
7755
+ name: "Alarm / Siren",
7756
+ icon: "🚨"
7757
+ },
7758
+ {
7759
+ id: "doorbell",
7760
+ name: "Doorbell / Knock",
7761
+ icon: "🔔"
7762
+ },
7763
+ {
7764
+ id: "glass_breaking",
7765
+ name: "Glass Breaking",
7766
+ icon: "💥"
7767
+ },
7768
+ {
7769
+ id: "gunshot",
7770
+ name: "Gunshot / Explosion",
7771
+ icon: "💣"
7772
+ },
7773
+ {
7774
+ id: "vehicle",
7775
+ name: "Vehicle",
7776
+ icon: "🚗"
7777
+ },
7778
+ {
7779
+ id: "siren",
7780
+ name: "Emergency Siren",
7781
+ icon: "🚑"
7782
+ },
7783
+ {
7784
+ id: "fire",
7785
+ name: "Fire / Smoke",
7786
+ icon: "🔥"
7787
+ },
7788
+ {
7789
+ id: "water",
7790
+ name: "Water",
7791
+ icon: "💧"
7792
+ },
7793
+ {
7794
+ id: "wind",
7795
+ name: "Wind / Weather",
7796
+ icon: "🌬️"
7797
+ },
7798
+ {
7799
+ id: "door",
7800
+ name: "Door",
7801
+ icon: "🚪"
7802
+ },
7803
+ {
7804
+ id: "footsteps",
7805
+ name: "Footsteps",
7806
+ icon: "👣"
7807
+ },
7808
+ {
7809
+ id: "crowd",
7810
+ name: "Crowd / Chatter",
7811
+ icon: "👥"
7812
+ },
7813
+ {
7814
+ id: "telephone",
7815
+ name: "Telephone",
7816
+ icon: "📞"
7817
+ },
7818
+ {
7819
+ id: "engine",
7820
+ name: "Engine / Motor",
7821
+ icon: "⚙️"
7822
+ },
7823
+ {
7824
+ id: "tools",
7825
+ name: "Tools / Construction",
7826
+ icon: "🔨"
7827
+ },
7828
+ {
7829
+ id: "silence",
7830
+ name: "Silence",
7831
+ icon: "🤫"
7832
+ }
7833
+ ];
7624
7834
  var YAMNET_TO_MACRO = {
7625
7835
  mapping: {
7626
7836
  Speech: "speech",
@@ -7887,6 +8097,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7887
8097
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7888
8098
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7889
8099
  /**
8100
+ * Unified event-kind taxonomy — THE single source of truth for
8101
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8102
+ * icon }`.
8103
+ *
8104
+ * This dictionary folds together what used to be scattered across four
8105
+ * copies:
8106
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8107
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8108
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8109
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8110
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8111
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8112
+ *
8113
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8114
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8115
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8116
+ * color or an icon: they read this dictionary (server descriptors carry the
8117
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8118
+ *
8119
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8120
+ */
8121
+ var TAXONOMY_COLORS = {
8122
+ motion: "#f59e0b",
8123
+ audio: "#06b6d4",
8124
+ person: "#22c55e",
8125
+ vehicle: "#3b82f6",
8126
+ animal: "#f97316",
8127
+ package: "#a855f7",
8128
+ sensor: "#8b5cf6",
8129
+ control: "#10b981",
8130
+ genericDetection: "#64748b"
8131
+ };
8132
+ var DETECTION_SUB_COLORS = {
8133
+ car: "#f59e0b",
8134
+ truck: "#d97706",
8135
+ bus: "#b45309",
8136
+ motorcycle: "#eab308",
8137
+ bicycle: "#ca8a04",
8138
+ airplane: "#60a5fa",
8139
+ boat: "#2563eb",
8140
+ train: "#1d4ed8",
8141
+ bird: "#14b8a6",
8142
+ dog: "#84cc16",
8143
+ cat: "#f97316",
8144
+ horse: "#a16207",
8145
+ sheep: "#a3a3a3",
8146
+ cow: "#78716c",
8147
+ elephant: "#6b7280",
8148
+ bear: "#7c2d12",
8149
+ zebra: "#404040",
8150
+ giraffe: "#d4a373"
8151
+ };
8152
+ function titleCase(id) {
8153
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8154
+ }
8155
+ var entries = /* @__PURE__ */ new Map();
8156
+ function macro(kind, category, color, iconId, label) {
8157
+ entries.set(kind, {
8158
+ kind,
8159
+ parentKind: null,
8160
+ level: "macro",
8161
+ category,
8162
+ color,
8163
+ iconId,
8164
+ labelKey: `eventKind.${kind}`,
8165
+ label
8166
+ });
8167
+ }
8168
+ function sub(kind, parentKind, category, color, iconId, label) {
8169
+ entries.set(kind, {
8170
+ kind,
8171
+ parentKind,
8172
+ level: "sub",
8173
+ category,
8174
+ color,
8175
+ iconId,
8176
+ labelKey: `eventKind.${kind}`,
8177
+ label
8178
+ });
8179
+ }
8180
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8181
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8182
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8183
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8184
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8185
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8186
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8187
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8188
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8189
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8190
+ if (entries.has(cocoClass)) continue;
8191
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8192
+ }
8193
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8194
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8195
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8196
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8197
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8198
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8199
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8200
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8201
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8202
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8203
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8204
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8205
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8206
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8207
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8208
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8209
+ sub("button", "control", "control", "#10b981", "button", "Button");
8210
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8211
+ for (const l of AUDIO_MACRO_LABELS) {
8212
+ const kind = `audio-${l.id}`;
8213
+ if (entries.has(kind)) continue;
8214
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8215
+ }
8216
+ /** The complete taxonomy dictionary, keyed by kind. */
8217
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8218
+ /**
7890
8219
  * Error types for the safe expression engine. Two distinct classes so callers
7891
8220
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7892
8221
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -14907,9 +15236,10 @@ var DEVICE_LOCAL_STATE_CAPS = {
14907
15236
  * `package` backs the package-drop detector — a package zone is a
14908
15237
  * `ZoneRule` on the `'package'` stage referencing drawn polygons
14909
15238
  * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14910
- * The orchestrator provider that writes this stage lands in a later
14911
- * slice; until then the mirror carries only `{motion, detection}` and
14912
- * consumers read `package` as absent (treat as `[]`).
15239
+ * The orchestrator provider writes this stage as a first-class slice
15240
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
15241
+ * package}` shape, so consumers read the current package rules directly
15242
+ * off `device.state.zoneRules.value.package`.
14913
15243
  */
14914
15244
  runtimeState: object({
14915
15245
  motion: array(ZoneRuleSchema).readonly(),
@@ -18884,17 +19214,30 @@ var EventKindCategorySchema = _enum([
18884
19214
  "audio",
18885
19215
  "detection",
18886
19216
  "sensor",
19217
+ "control",
18887
19218
  "custom",
18888
19219
  "package"
18889
19220
  ]);
19221
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19222
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18890
19223
  var EventKindDescriptorSchema = object({
18891
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19224
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18892
19225
  kind: string(),
19226
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19227
+ labelKey: string(),
19228
+ /** English fallback label (kept for clients that don't translate). */
18893
19229
  label: string(),
18894
19230
  /** Hex color for timeline/legend rendering. */
18895
19231
  color: string(),
19232
+ /** Dictionary id → lucide component on the UI side. */
19233
+ iconId: string(),
19234
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18896
19235
  icon: EventKindIconSchema,
18897
19236
  category: EventKindCategorySchema,
19237
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19238
+ parentKind: string().nullable(),
19239
+ /** Derived from `parentKind`, explicit for the client tree. */
19240
+ level: EventKindLevelSchema,
18898
19241
  /** Which cap + device contributes this kind. For built-ins the camera
18899
19242
  * itself; for sensor kinds the LINKED source device. */
18900
19243
  source: object({
@@ -18967,11 +19310,21 @@ var TrackAudioLabelSchema = object({
18967
19310
  firstAt: number(),
18968
19311
  lastAt: number()
18969
19312
  });
19313
+ /**
19314
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19315
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19316
+ * linked sensor/control state change (no positions; carries a snapshot). The
19317
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19318
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19319
+ */
19320
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18970
19321
  var TrackSchema = object({
18971
19322
  trackId: string(),
18972
19323
  deviceId: number(),
18973
19324
  className: string(),
18974
19325
  label: string().optional(),
19326
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19327
+ source: TrackSourceSchema.optional(),
18975
19328
  firstSeen: number(),
18976
19329
  lastSeen: number(),
18977
19330
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19226,6 +19579,26 @@ var TrackCascadeCountsSchema = object({
19226
19579
  /** Per-track CLIP search vectors removed (best-effort). */
19227
19580
  embeddings: number().int()
19228
19581
  });
19582
+ /** Event-store footprint for one camera. */
19583
+ var EventStoreDeviceFootprintSchema = object({
19584
+ deviceId: number(),
19585
+ /** Persisted event rows (motion + object + audio) for the camera. */
19586
+ rows: number().int(),
19587
+ /** Event-owned media bytes on disk for the camera. */
19588
+ bytes: number().int()
19589
+ });
19590
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19591
+ var EventStoreFootprintSchema = object({
19592
+ totalRows: number().int(),
19593
+ totalBytes: number().int(),
19594
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19595
+ });
19596
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19597
+ var EventPruneCountsSchema = object({
19598
+ motion: number().int(),
19599
+ object: number().int(),
19600
+ audio: number().int()
19601
+ });
19229
19602
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19230
19603
  deviceId: number(),
19231
19604
  trackId: string()
@@ -19289,6 +19662,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19289
19662
  }), {
19290
19663
  kind: "mutation",
19291
19664
  auth: "admin"
19665
+ }), method(object({}), EventStoreFootprintSchema, {
19666
+ kind: "query",
19667
+ auth: "admin"
19668
+ }), method(object({
19669
+ olderThanMs: number(),
19670
+ reason: OpsLogReasonSchema.optional()
19671
+ }), EventPruneCountsSchema, {
19672
+ kind: "mutation",
19673
+ auth: "admin"
19674
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19675
+ kind: "mutation",
19676
+ auth: "admin"
19677
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19678
+ kind: "query",
19679
+ auth: "admin"
19292
19680
  }), method(object({
19293
19681
  eventId: string(),
19294
19682
  kind: MediaFileKindEnum.optional()
@@ -19313,6 +19701,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19313
19701
  eventId: string(),
19314
19702
  timestamp: number()
19315
19703
  });
19704
+ /**
19705
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19706
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19707
+ * caps into per-camera event-kind descriptors.
19708
+ *
19709
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19710
+ * is NOT duplicated here — every entry is derived from the single
19711
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19712
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19713
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19714
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19715
+ * eventful cap is missing.
19716
+ */
19717
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19718
+ var LEGACY_ICON = {
19719
+ motion: "motion",
19720
+ audio: "audio",
19721
+ person: "person",
19722
+ vehicle: "vehicle",
19723
+ animal: "animal",
19724
+ package: "package",
19725
+ door: "door",
19726
+ pir: "pir",
19727
+ smoke: "smoke",
19728
+ water: "water",
19729
+ button: "button",
19730
+ generic: "generic",
19731
+ gas: "smoke",
19732
+ vibration: "generic",
19733
+ tamper: "generic",
19734
+ presence: "person",
19735
+ lock: "generic",
19736
+ siren: "generic",
19737
+ switch: "generic",
19738
+ doorbell: "button"
19739
+ };
19740
+ function legacyIcon(iconId) {
19741
+ return LEGACY_ICON[iconId] ?? "generic";
19742
+ }
19743
+ /**
19744
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19745
+ * The anti-drift guard cross-checks this against the eventful caps declared
19746
+ * in `packages/types/src/capabilities/*.cap.ts`.
19747
+ */
19748
+ var CAP_TO_KIND = {
19749
+ contact: "contact",
19750
+ motion: "motion-sensor",
19751
+ smoke: "smoke",
19752
+ flood: "flood",
19753
+ gas: "gas",
19754
+ "carbon-monoxide": "carbon-monoxide",
19755
+ vibration: "vibration",
19756
+ tamper: "tamper",
19757
+ presence: "presence",
19758
+ "enum-sensor": "enum-sensor",
19759
+ "event-emitter": "device-event",
19760
+ "lock-control": "lock",
19761
+ switch: "switch",
19762
+ button: "button",
19763
+ doorbell: "doorbell"
19764
+ };
19765
+ function buildDescriptor(capName, kind) {
19766
+ const t = EVENT_TAXONOMY[kind];
19767
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19768
+ return {
19769
+ ...t,
19770
+ icon: legacyIcon(t.iconId)
19771
+ };
19772
+ }
19773
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19316
19774
  var CameraPipelineConfigSchema = object({
19317
19775
  engine: PipelineEngineChoiceSchema.optional(),
19318
19776
  steps: array(PipelineStepInputSchema).readonly(),
@@ -22573,13 +23031,29 @@ method(object({
22573
23031
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22574
23032
  kind: "mutation",
22575
23033
  auth: "admin"
22576
- }), method(object({ deviceId: number() }), object({
23034
+ }), method(object({
23035
+ deviceId: number(),
23036
+ reason: OpsLogReasonSchema.optional()
23037
+ }), object({
22577
23038
  floorMs: number().nullable(),
22578
23039
  deletedBuckets: number().int(),
22579
23040
  reclaimedBytes: number().int()
22580
23041
  }), {
22581
23042
  kind: "mutation",
22582
23043
  auth: "admin"
23044
+ }), method(object({
23045
+ deviceId: number(),
23046
+ fromMs: number().optional(),
23047
+ toMs: number().optional()
23048
+ }), object({
23049
+ deletedBuckets: number().int(),
23050
+ reclaimedBytes: number().int()
23051
+ }), {
23052
+ kind: "mutation",
23053
+ auth: "admin"
23054
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
23055
+ kind: "query",
23056
+ auth: "admin"
22583
23057
  });
22584
23058
  /**
22585
23059
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -25714,6 +26188,12 @@ Object.freeze({
25714
26188
  addonId: null,
25715
26189
  access: "delete"
25716
26190
  },
26191
+ "pipelineAnalytics.deleteDeviceEvents": {
26192
+ capName: "pipeline-analytics",
26193
+ capScope: "device",
26194
+ addonId: null,
26195
+ access: "delete"
26196
+ },
25717
26197
  "pipelineAnalytics.deleteTracks": {
25718
26198
  capName: "pipeline-analytics",
25719
26199
  capScope: "device",
@@ -25744,6 +26224,12 @@ Object.freeze({
25744
26224
  addonId: null,
25745
26225
  access: "view"
25746
26226
  },
26227
+ "pipelineAnalytics.getEventStoreFootprint": {
26228
+ capName: "pipeline-analytics",
26229
+ capScope: "device",
26230
+ addonId: null,
26231
+ access: "view"
26232
+ },
25747
26233
  "pipelineAnalytics.getKeyEvents": {
25748
26234
  capName: "pipeline-analytics",
25749
26235
  capScope: "device",
@@ -25786,6 +26272,12 @@ Object.freeze({
25786
26272
  addonId: null,
25787
26273
  access: "view"
25788
26274
  },
26275
+ "pipelineAnalytics.listOpsLog": {
26276
+ capName: "pipeline-analytics",
26277
+ capScope: "device",
26278
+ addonId: null,
26279
+ access: "view"
26280
+ },
25789
26281
  "pipelineAnalytics.listRecentTracks": {
25790
26282
  capName: "pipeline-analytics",
25791
26283
  capScope: "device",
@@ -25798,6 +26290,12 @@ Object.freeze({
25798
26290
  addonId: null,
25799
26291
  access: "view"
25800
26292
  },
26293
+ "pipelineAnalytics.pruneEvents": {
26294
+ capName: "pipeline-analytics",
26295
+ capScope: "device",
26296
+ addonId: null,
26297
+ access: "create"
26298
+ },
25801
26299
  "pipelineAnalytics.pruneEventsBefore": {
25802
26300
  capName: "pipeline-analytics",
25803
26301
  capScope: "device",
@@ -26560,6 +27058,12 @@ Object.freeze({
26560
27058
  addonId: null,
26561
27059
  access: "create"
26562
27060
  },
27061
+ "recording.deleteFootprint": {
27062
+ capName: "recording",
27063
+ capScope: "system",
27064
+ addonId: null,
27065
+ access: "delete"
27066
+ },
26563
27067
  "recording.getAvailability": {
26564
27068
  capName: "recording",
26565
27069
  capScope: "system",
@@ -26590,6 +27094,12 @@ Object.freeze({
26590
27094
  addonId: null,
26591
27095
  access: "view"
26592
27096
  },
27097
+ "recording.listOpsLog": {
27098
+ capName: "recording",
27099
+ capScope: "system",
27100
+ addonId: null,
27101
+ access: "view"
27102
+ },
26593
27103
  "recording.locateSegment": {
26594
27104
  capName: "recording",
26595
27105
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-rtsp",
3
- "version": "1.1.26",
3
+ "version": "1.1.28",
4
4
  "description": "Generic RTSP camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",