@camstack/addon-provider-onvif 1.1.28 → 1.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.js CHANGED
@@ -7343,6 +7343,62 @@ var RecordingConfigSchema = object({
7343
7343
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7344
7344
  });
7345
7345
  /**
7346
+ * Ops-log — the durable, append-only operations audit shared by the
7347
+ * recordings and events management surfaces.
7348
+ *
7349
+ * ONE row shape is reused for both domains so a single "Activity" view can
7350
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7351
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7352
+ * management operation, WHY it ran (reason), and its measurable effect
7353
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7354
+ * never fail the operation it records.
7355
+ */
7356
+ /** Which management domain the operation belongs to. */
7357
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7358
+ /** The kind of management operation performed. */
7359
+ var OpsLogOpSchema = _enum([
7360
+ "prune",
7361
+ "manual-delete",
7362
+ "rescan",
7363
+ "retention-run"
7364
+ ]);
7365
+ /** Why the operation ran. */
7366
+ var OpsLogReasonSchema = _enum([
7367
+ "retention",
7368
+ "quota",
7369
+ "manual",
7370
+ "operator"
7371
+ ]);
7372
+ /** One audit row, shared verbatim by both domains. */
7373
+ var OpsLogEntrySchema = object({
7374
+ /** Unique row id. */
7375
+ id: string(),
7376
+ /** Epoch ms the operation completed. */
7377
+ at: number(),
7378
+ domain: OpsLogDomainSchema,
7379
+ op: OpsLogOpSchema,
7380
+ reason: OpsLogReasonSchema,
7381
+ /** The camera the op targeted; null for a cluster/global op. */
7382
+ deviceId: number().nullable(),
7383
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7384
+ nodeId: string(),
7385
+ /** Buckets / rows deleted (op-specific unit). */
7386
+ itemsAffected: number(),
7387
+ /** Bytes reclaimed by the op (0 when not measurable). */
7388
+ bytesReclaimed: number(),
7389
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7390
+ detail: string().nullable(),
7391
+ /** Who/what triggered the op. */
7392
+ actor: string()
7393
+ });
7394
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7395
+ var OpsLogQueryInputSchema = object({
7396
+ /** Restrict to a single camera; omit for every row. */
7397
+ deviceId: number().optional(),
7398
+ /** Max rows returned, newest-first. */
7399
+ limit: number().int().min(1).max(1e3).optional()
7400
+ });
7401
+ /**
7346
7402
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7347
7403
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7348
7404
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7586,6 +7642,160 @@ var EncodeProfileSchema = object({
7586
7642
  */
7587
7643
  outputArgs: array(string()).optional()
7588
7644
  });
7645
+ var COCO_TO_MACRO = {
7646
+ mapping: {
7647
+ person: "person",
7648
+ bicycle: "vehicle",
7649
+ car: "vehicle",
7650
+ motorcycle: "vehicle",
7651
+ airplane: "vehicle",
7652
+ bus: "vehicle",
7653
+ train: "vehicle",
7654
+ truck: "vehicle",
7655
+ boat: "vehicle",
7656
+ bird: "animal",
7657
+ cat: "animal",
7658
+ dog: "animal",
7659
+ horse: "animal",
7660
+ sheep: "animal",
7661
+ cow: "animal",
7662
+ elephant: "animal",
7663
+ bear: "animal",
7664
+ zebra: "animal",
7665
+ giraffe: "animal",
7666
+ suitcase: "package",
7667
+ backpack: "package",
7668
+ handbag: "package"
7669
+ },
7670
+ preserveOriginal: false
7671
+ };
7672
+ var AUDIO_MACRO_LABELS = [
7673
+ {
7674
+ id: "speech",
7675
+ name: "Speech",
7676
+ icon: "🗣️"
7677
+ },
7678
+ {
7679
+ id: "scream",
7680
+ name: "Scream / Shout",
7681
+ icon: "😱"
7682
+ },
7683
+ {
7684
+ id: "crying",
7685
+ name: "Crying / Baby",
7686
+ icon: "😢"
7687
+ },
7688
+ {
7689
+ id: "laughter",
7690
+ name: "Laughter",
7691
+ icon: "😂"
7692
+ },
7693
+ {
7694
+ id: "music",
7695
+ name: "Music",
7696
+ icon: "🎵"
7697
+ },
7698
+ {
7699
+ id: "dog",
7700
+ name: "Dog",
7701
+ icon: "🐕"
7702
+ },
7703
+ {
7704
+ id: "cat",
7705
+ name: "Cat",
7706
+ icon: "🐈"
7707
+ },
7708
+ {
7709
+ id: "bird",
7710
+ name: "Bird",
7711
+ icon: "🐦"
7712
+ },
7713
+ {
7714
+ id: "animal",
7715
+ name: "Animal (other)",
7716
+ icon: "🐾"
7717
+ },
7718
+ {
7719
+ id: "alarm",
7720
+ name: "Alarm / Siren",
7721
+ icon: "🚨"
7722
+ },
7723
+ {
7724
+ id: "doorbell",
7725
+ name: "Doorbell / Knock",
7726
+ icon: "🔔"
7727
+ },
7728
+ {
7729
+ id: "glass_breaking",
7730
+ name: "Glass Breaking",
7731
+ icon: "💥"
7732
+ },
7733
+ {
7734
+ id: "gunshot",
7735
+ name: "Gunshot / Explosion",
7736
+ icon: "💣"
7737
+ },
7738
+ {
7739
+ id: "vehicle",
7740
+ name: "Vehicle",
7741
+ icon: "🚗"
7742
+ },
7743
+ {
7744
+ id: "siren",
7745
+ name: "Emergency Siren",
7746
+ icon: "🚑"
7747
+ },
7748
+ {
7749
+ id: "fire",
7750
+ name: "Fire / Smoke",
7751
+ icon: "🔥"
7752
+ },
7753
+ {
7754
+ id: "water",
7755
+ name: "Water",
7756
+ icon: "💧"
7757
+ },
7758
+ {
7759
+ id: "wind",
7760
+ name: "Wind / Weather",
7761
+ icon: "🌬️"
7762
+ },
7763
+ {
7764
+ id: "door",
7765
+ name: "Door",
7766
+ icon: "🚪"
7767
+ },
7768
+ {
7769
+ id: "footsteps",
7770
+ name: "Footsteps",
7771
+ icon: "👣"
7772
+ },
7773
+ {
7774
+ id: "crowd",
7775
+ name: "Crowd / Chatter",
7776
+ icon: "👥"
7777
+ },
7778
+ {
7779
+ id: "telephone",
7780
+ name: "Telephone",
7781
+ icon: "📞"
7782
+ },
7783
+ {
7784
+ id: "engine",
7785
+ name: "Engine / Motor",
7786
+ icon: "⚙️"
7787
+ },
7788
+ {
7789
+ id: "tools",
7790
+ name: "Tools / Construction",
7791
+ icon: "🔨"
7792
+ },
7793
+ {
7794
+ id: "silence",
7795
+ name: "Silence",
7796
+ icon: "🤫"
7797
+ }
7798
+ ];
7589
7799
  var YAMNET_TO_MACRO = {
7590
7800
  mapping: {
7591
7801
  Speech: "speech",
@@ -7852,6 +8062,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7852
8062
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7853
8063
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7854
8064
  /**
8065
+ * Unified event-kind taxonomy — THE single source of truth for
8066
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8067
+ * icon }`.
8068
+ *
8069
+ * This dictionary folds together what used to be scattered across four
8070
+ * copies:
8071
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8072
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8073
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8074
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8075
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8076
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8077
+ *
8078
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8079
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8080
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8081
+ * color or an icon: they read this dictionary (server descriptors carry the
8082
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8083
+ *
8084
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8085
+ */
8086
+ var TAXONOMY_COLORS = {
8087
+ motion: "#f59e0b",
8088
+ audio: "#06b6d4",
8089
+ person: "#22c55e",
8090
+ vehicle: "#3b82f6",
8091
+ animal: "#f97316",
8092
+ package: "#a855f7",
8093
+ sensor: "#8b5cf6",
8094
+ control: "#10b981",
8095
+ genericDetection: "#64748b"
8096
+ };
8097
+ var DETECTION_SUB_COLORS = {
8098
+ car: "#f59e0b",
8099
+ truck: "#d97706",
8100
+ bus: "#b45309",
8101
+ motorcycle: "#eab308",
8102
+ bicycle: "#ca8a04",
8103
+ airplane: "#60a5fa",
8104
+ boat: "#2563eb",
8105
+ train: "#1d4ed8",
8106
+ bird: "#14b8a6",
8107
+ dog: "#84cc16",
8108
+ cat: "#f97316",
8109
+ horse: "#a16207",
8110
+ sheep: "#a3a3a3",
8111
+ cow: "#78716c",
8112
+ elephant: "#6b7280",
8113
+ bear: "#7c2d12",
8114
+ zebra: "#404040",
8115
+ giraffe: "#d4a373"
8116
+ };
8117
+ function titleCase(id) {
8118
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8119
+ }
8120
+ var entries = /* @__PURE__ */ new Map();
8121
+ function macro(kind, category, color, iconId, label) {
8122
+ entries.set(kind, {
8123
+ kind,
8124
+ parentKind: null,
8125
+ level: "macro",
8126
+ category,
8127
+ color,
8128
+ iconId,
8129
+ labelKey: `eventKind.${kind}`,
8130
+ label
8131
+ });
8132
+ }
8133
+ function sub(kind, parentKind, category, color, iconId, label) {
8134
+ entries.set(kind, {
8135
+ kind,
8136
+ parentKind,
8137
+ level: "sub",
8138
+ category,
8139
+ color,
8140
+ iconId,
8141
+ labelKey: `eventKind.${kind}`,
8142
+ label
8143
+ });
8144
+ }
8145
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8146
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8147
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8148
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8149
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8150
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8151
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8152
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8153
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8154
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8155
+ if (entries.has(cocoClass)) continue;
8156
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8157
+ }
8158
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8159
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8160
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8161
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8162
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8163
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8164
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8165
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8166
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8167
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8168
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8169
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8170
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8171
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8172
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8173
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8174
+ sub("button", "control", "control", "#10b981", "button", "Button");
8175
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8176
+ for (const l of AUDIO_MACRO_LABELS) {
8177
+ const kind = `audio-${l.id}`;
8178
+ if (entries.has(kind)) continue;
8179
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8180
+ }
8181
+ /** The complete taxonomy dictionary, keyed by kind. */
8182
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8183
+ /**
7855
8184
  * Error types for the safe expression engine. Two distinct classes so callers
7856
8185
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7857
8186
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -16265,17 +16594,30 @@ var EventKindCategorySchema = _enum([
16265
16594
  "audio",
16266
16595
  "detection",
16267
16596
  "sensor",
16597
+ "control",
16268
16598
  "custom",
16269
16599
  "package"
16270
16600
  ]);
16601
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16602
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
16271
16603
  var EventKindDescriptorSchema = object({
16272
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16604
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16273
16605
  kind: string(),
16606
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16607
+ labelKey: string(),
16608
+ /** English fallback label (kept for clients that don't translate). */
16274
16609
  label: string(),
16275
16610
  /** Hex color for timeline/legend rendering. */
16276
16611
  color: string(),
16612
+ /** Dictionary id → lucide component on the UI side. */
16613
+ iconId: string(),
16614
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16277
16615
  icon: EventKindIconSchema,
16278
16616
  category: EventKindCategorySchema,
16617
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16618
+ parentKind: string().nullable(),
16619
+ /** Derived from `parentKind`, explicit for the client tree. */
16620
+ level: EventKindLevelSchema,
16279
16621
  /** Which cap + device contributes this kind. For built-ins the camera
16280
16622
  * itself; for sensor kinds the LINKED source device. */
16281
16623
  source: object({
@@ -16348,11 +16690,21 @@ var TrackAudioLabelSchema = object({
16348
16690
  firstAt: number(),
16349
16691
  lastAt: number()
16350
16692
  });
16693
+ /**
16694
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16695
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16696
+ * linked sensor/control state change (no positions; carries a snapshot). The
16697
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16698
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16699
+ */
16700
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16351
16701
  var TrackSchema = object({
16352
16702
  trackId: string(),
16353
16703
  deviceId: number(),
16354
16704
  className: string(),
16355
16705
  label: string().optional(),
16706
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16707
+ source: TrackSourceSchema.optional(),
16356
16708
  firstSeen: number(),
16357
16709
  lastSeen: number(),
16358
16710
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16607,6 +16959,26 @@ var TrackCascadeCountsSchema = object({
16607
16959
  /** Per-track CLIP search vectors removed (best-effort). */
16608
16960
  embeddings: number().int()
16609
16961
  });
16962
+ /** Event-store footprint for one camera. */
16963
+ var EventStoreDeviceFootprintSchema = object({
16964
+ deviceId: number(),
16965
+ /** Persisted event rows (motion + object + audio) for the camera. */
16966
+ rows: number().int(),
16967
+ /** Event-owned media bytes on disk for the camera. */
16968
+ bytes: number().int()
16969
+ });
16970
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
16971
+ var EventStoreFootprintSchema = object({
16972
+ totalRows: number().int(),
16973
+ totalBytes: number().int(),
16974
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
16975
+ });
16976
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
16977
+ var EventPruneCountsSchema = object({
16978
+ motion: number().int(),
16979
+ object: number().int(),
16980
+ audio: number().int()
16981
+ });
16610
16982
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
16611
16983
  deviceId: number(),
16612
16984
  trackId: string()
@@ -16670,6 +17042,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16670
17042
  }), {
16671
17043
  kind: "mutation",
16672
17044
  auth: "admin"
17045
+ }), method(object({}), EventStoreFootprintSchema, {
17046
+ kind: "query",
17047
+ auth: "admin"
17048
+ }), method(object({
17049
+ olderThanMs: number(),
17050
+ reason: OpsLogReasonSchema.optional()
17051
+ }), EventPruneCountsSchema, {
17052
+ kind: "mutation",
17053
+ auth: "admin"
17054
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17055
+ kind: "mutation",
17056
+ auth: "admin"
17057
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17058
+ kind: "query",
17059
+ auth: "admin"
16673
17060
  }), method(object({
16674
17061
  eventId: string(),
16675
17062
  kind: MediaFileKindEnum.optional()
@@ -16694,6 +17081,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16694
17081
  eventId: string(),
16695
17082
  timestamp: number()
16696
17083
  });
17084
+ /**
17085
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
17086
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
17087
+ * caps into per-camera event-kind descriptors.
17088
+ *
17089
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
17090
+ * is NOT duplicated here — every entry is derived from the single
17091
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
17092
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
17093
+ * control cap means adding one line here (and a taxonomy entry); the anti-
17094
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
17095
+ * eventful cap is missing.
17096
+ */
17097
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
17098
+ var LEGACY_ICON = {
17099
+ motion: "motion",
17100
+ audio: "audio",
17101
+ person: "person",
17102
+ vehicle: "vehicle",
17103
+ animal: "animal",
17104
+ package: "package",
17105
+ door: "door",
17106
+ pir: "pir",
17107
+ smoke: "smoke",
17108
+ water: "water",
17109
+ button: "button",
17110
+ generic: "generic",
17111
+ gas: "smoke",
17112
+ vibration: "generic",
17113
+ tamper: "generic",
17114
+ presence: "person",
17115
+ lock: "generic",
17116
+ siren: "generic",
17117
+ switch: "generic",
17118
+ doorbell: "button"
17119
+ };
17120
+ function legacyIcon(iconId) {
17121
+ return LEGACY_ICON[iconId] ?? "generic";
17122
+ }
17123
+ /**
17124
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
17125
+ * The anti-drift guard cross-checks this against the eventful caps declared
17126
+ * in `packages/types/src/capabilities/*.cap.ts`.
17127
+ */
17128
+ var CAP_TO_KIND = {
17129
+ contact: "contact",
17130
+ motion: "motion-sensor",
17131
+ smoke: "smoke",
17132
+ flood: "flood",
17133
+ gas: "gas",
17134
+ "carbon-monoxide": "carbon-monoxide",
17135
+ vibration: "vibration",
17136
+ tamper: "tamper",
17137
+ presence: "presence",
17138
+ "enum-sensor": "enum-sensor",
17139
+ "event-emitter": "device-event",
17140
+ "lock-control": "lock",
17141
+ switch: "switch",
17142
+ button: "button",
17143
+ doorbell: "doorbell"
17144
+ };
17145
+ function buildDescriptor(capName, kind) {
17146
+ const t = EVENT_TAXONOMY[kind];
17147
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
17148
+ return {
17149
+ ...t,
17150
+ icon: legacyIcon(t.iconId)
17151
+ };
17152
+ }
17153
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16697
17154
  var CameraPipelineConfigSchema = object({
16698
17155
  engine: PipelineEngineChoiceSchema.optional(),
16699
17156
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19996,13 +20453,29 @@ method(object({
19996
20453
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
19997
20454
  kind: "mutation",
19998
20455
  auth: "admin"
19999
- }), method(object({ deviceId: number() }), object({
20456
+ }), method(object({
20457
+ deviceId: number(),
20458
+ reason: OpsLogReasonSchema.optional()
20459
+ }), object({
20000
20460
  floorMs: number().nullable(),
20001
20461
  deletedBuckets: number().int(),
20002
20462
  reclaimedBytes: number().int()
20003
20463
  }), {
20004
20464
  kind: "mutation",
20005
20465
  auth: "admin"
20466
+ }), method(object({
20467
+ deviceId: number(),
20468
+ fromMs: number().optional(),
20469
+ toMs: number().optional()
20470
+ }), object({
20471
+ deletedBuckets: number().int(),
20472
+ reclaimedBytes: number().int()
20473
+ }), {
20474
+ kind: "mutation",
20475
+ auth: "admin"
20476
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
20477
+ kind: "query",
20478
+ auth: "admin"
20006
20479
  });
20007
20480
  /**
20008
20481
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -23124,6 +23597,12 @@ Object.freeze({
23124
23597
  addonId: null,
23125
23598
  access: "delete"
23126
23599
  },
23600
+ "pipelineAnalytics.deleteDeviceEvents": {
23601
+ capName: "pipeline-analytics",
23602
+ capScope: "device",
23603
+ addonId: null,
23604
+ access: "delete"
23605
+ },
23127
23606
  "pipelineAnalytics.deleteTracks": {
23128
23607
  capName: "pipeline-analytics",
23129
23608
  capScope: "device",
@@ -23154,6 +23633,12 @@ Object.freeze({
23154
23633
  addonId: null,
23155
23634
  access: "view"
23156
23635
  },
23636
+ "pipelineAnalytics.getEventStoreFootprint": {
23637
+ capName: "pipeline-analytics",
23638
+ capScope: "device",
23639
+ addonId: null,
23640
+ access: "view"
23641
+ },
23157
23642
  "pipelineAnalytics.getKeyEvents": {
23158
23643
  capName: "pipeline-analytics",
23159
23644
  capScope: "device",
@@ -23196,6 +23681,12 @@ Object.freeze({
23196
23681
  addonId: null,
23197
23682
  access: "view"
23198
23683
  },
23684
+ "pipelineAnalytics.listOpsLog": {
23685
+ capName: "pipeline-analytics",
23686
+ capScope: "device",
23687
+ addonId: null,
23688
+ access: "view"
23689
+ },
23199
23690
  "pipelineAnalytics.listRecentTracks": {
23200
23691
  capName: "pipeline-analytics",
23201
23692
  capScope: "device",
@@ -23208,6 +23699,12 @@ Object.freeze({
23208
23699
  addonId: null,
23209
23700
  access: "view"
23210
23701
  },
23702
+ "pipelineAnalytics.pruneEvents": {
23703
+ capName: "pipeline-analytics",
23704
+ capScope: "device",
23705
+ addonId: null,
23706
+ access: "create"
23707
+ },
23211
23708
  "pipelineAnalytics.pruneEventsBefore": {
23212
23709
  capName: "pipeline-analytics",
23213
23710
  capScope: "device",
@@ -23970,6 +24467,12 @@ Object.freeze({
23970
24467
  addonId: null,
23971
24468
  access: "create"
23972
24469
  },
24470
+ "recording.deleteFootprint": {
24471
+ capName: "recording",
24472
+ capScope: "system",
24473
+ addonId: null,
24474
+ access: "delete"
24475
+ },
23973
24476
  "recording.getAvailability": {
23974
24477
  capName: "recording",
23975
24478
  capScope: "system",
@@ -24000,6 +24503,12 @@ Object.freeze({
24000
24503
  addonId: null,
24001
24504
  access: "view"
24002
24505
  },
24506
+ "recording.listOpsLog": {
24507
+ capName: "recording",
24508
+ capScope: "system",
24509
+ addonId: null,
24510
+ access: "view"
24511
+ },
24003
24512
  "recording.locateSegment": {
24004
24513
  capName: "recording",
24005
24514
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -7344,6 +7344,62 @@ var RecordingConfigSchema = object({
7344
7344
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7345
7345
  });
7346
7346
  /**
7347
+ * Ops-log — the durable, append-only operations audit shared by the
7348
+ * recordings and events management surfaces.
7349
+ *
7350
+ * ONE row shape is reused for both domains so a single "Activity" view can
7351
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7352
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7353
+ * management operation, WHY it ran (reason), and its measurable effect
7354
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7355
+ * never fail the operation it records.
7356
+ */
7357
+ /** Which management domain the operation belongs to. */
7358
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7359
+ /** The kind of management operation performed. */
7360
+ var OpsLogOpSchema = _enum([
7361
+ "prune",
7362
+ "manual-delete",
7363
+ "rescan",
7364
+ "retention-run"
7365
+ ]);
7366
+ /** Why the operation ran. */
7367
+ var OpsLogReasonSchema = _enum([
7368
+ "retention",
7369
+ "quota",
7370
+ "manual",
7371
+ "operator"
7372
+ ]);
7373
+ /** One audit row, shared verbatim by both domains. */
7374
+ var OpsLogEntrySchema = object({
7375
+ /** Unique row id. */
7376
+ id: string(),
7377
+ /** Epoch ms the operation completed. */
7378
+ at: number(),
7379
+ domain: OpsLogDomainSchema,
7380
+ op: OpsLogOpSchema,
7381
+ reason: OpsLogReasonSchema,
7382
+ /** The camera the op targeted; null for a cluster/global op. */
7383
+ deviceId: number().nullable(),
7384
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7385
+ nodeId: string(),
7386
+ /** Buckets / rows deleted (op-specific unit). */
7387
+ itemsAffected: number(),
7388
+ /** Bytes reclaimed by the op (0 when not measurable). */
7389
+ bytesReclaimed: number(),
7390
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7391
+ detail: string().nullable(),
7392
+ /** Who/what triggered the op. */
7393
+ actor: string()
7394
+ });
7395
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7396
+ var OpsLogQueryInputSchema = object({
7397
+ /** Restrict to a single camera; omit for every row. */
7398
+ deviceId: number().optional(),
7399
+ /** Max rows returned, newest-first. */
7400
+ limit: number().int().min(1).max(1e3).optional()
7401
+ });
7402
+ /**
7347
7403
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7348
7404
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7349
7405
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7587,6 +7643,160 @@ var EncodeProfileSchema = object({
7587
7643
  */
7588
7644
  outputArgs: array(string()).optional()
7589
7645
  });
7646
+ var COCO_TO_MACRO = {
7647
+ mapping: {
7648
+ person: "person",
7649
+ bicycle: "vehicle",
7650
+ car: "vehicle",
7651
+ motorcycle: "vehicle",
7652
+ airplane: "vehicle",
7653
+ bus: "vehicle",
7654
+ train: "vehicle",
7655
+ truck: "vehicle",
7656
+ boat: "vehicle",
7657
+ bird: "animal",
7658
+ cat: "animal",
7659
+ dog: "animal",
7660
+ horse: "animal",
7661
+ sheep: "animal",
7662
+ cow: "animal",
7663
+ elephant: "animal",
7664
+ bear: "animal",
7665
+ zebra: "animal",
7666
+ giraffe: "animal",
7667
+ suitcase: "package",
7668
+ backpack: "package",
7669
+ handbag: "package"
7670
+ },
7671
+ preserveOriginal: false
7672
+ };
7673
+ var AUDIO_MACRO_LABELS = [
7674
+ {
7675
+ id: "speech",
7676
+ name: "Speech",
7677
+ icon: "🗣️"
7678
+ },
7679
+ {
7680
+ id: "scream",
7681
+ name: "Scream / Shout",
7682
+ icon: "😱"
7683
+ },
7684
+ {
7685
+ id: "crying",
7686
+ name: "Crying / Baby",
7687
+ icon: "😢"
7688
+ },
7689
+ {
7690
+ id: "laughter",
7691
+ name: "Laughter",
7692
+ icon: "😂"
7693
+ },
7694
+ {
7695
+ id: "music",
7696
+ name: "Music",
7697
+ icon: "🎵"
7698
+ },
7699
+ {
7700
+ id: "dog",
7701
+ name: "Dog",
7702
+ icon: "🐕"
7703
+ },
7704
+ {
7705
+ id: "cat",
7706
+ name: "Cat",
7707
+ icon: "🐈"
7708
+ },
7709
+ {
7710
+ id: "bird",
7711
+ name: "Bird",
7712
+ icon: "🐦"
7713
+ },
7714
+ {
7715
+ id: "animal",
7716
+ name: "Animal (other)",
7717
+ icon: "🐾"
7718
+ },
7719
+ {
7720
+ id: "alarm",
7721
+ name: "Alarm / Siren",
7722
+ icon: "🚨"
7723
+ },
7724
+ {
7725
+ id: "doorbell",
7726
+ name: "Doorbell / Knock",
7727
+ icon: "🔔"
7728
+ },
7729
+ {
7730
+ id: "glass_breaking",
7731
+ name: "Glass Breaking",
7732
+ icon: "💥"
7733
+ },
7734
+ {
7735
+ id: "gunshot",
7736
+ name: "Gunshot / Explosion",
7737
+ icon: "💣"
7738
+ },
7739
+ {
7740
+ id: "vehicle",
7741
+ name: "Vehicle",
7742
+ icon: "🚗"
7743
+ },
7744
+ {
7745
+ id: "siren",
7746
+ name: "Emergency Siren",
7747
+ icon: "🚑"
7748
+ },
7749
+ {
7750
+ id: "fire",
7751
+ name: "Fire / Smoke",
7752
+ icon: "🔥"
7753
+ },
7754
+ {
7755
+ id: "water",
7756
+ name: "Water",
7757
+ icon: "💧"
7758
+ },
7759
+ {
7760
+ id: "wind",
7761
+ name: "Wind / Weather",
7762
+ icon: "🌬️"
7763
+ },
7764
+ {
7765
+ id: "door",
7766
+ name: "Door",
7767
+ icon: "🚪"
7768
+ },
7769
+ {
7770
+ id: "footsteps",
7771
+ name: "Footsteps",
7772
+ icon: "👣"
7773
+ },
7774
+ {
7775
+ id: "crowd",
7776
+ name: "Crowd / Chatter",
7777
+ icon: "👥"
7778
+ },
7779
+ {
7780
+ id: "telephone",
7781
+ name: "Telephone",
7782
+ icon: "📞"
7783
+ },
7784
+ {
7785
+ id: "engine",
7786
+ name: "Engine / Motor",
7787
+ icon: "⚙️"
7788
+ },
7789
+ {
7790
+ id: "tools",
7791
+ name: "Tools / Construction",
7792
+ icon: "🔨"
7793
+ },
7794
+ {
7795
+ id: "silence",
7796
+ name: "Silence",
7797
+ icon: "🤫"
7798
+ }
7799
+ ];
7590
7800
  var YAMNET_TO_MACRO = {
7591
7801
  mapping: {
7592
7802
  Speech: "speech",
@@ -7853,6 +8063,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7853
8063
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7854
8064
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7855
8065
  /**
8066
+ * Unified event-kind taxonomy — THE single source of truth for
8067
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8068
+ * icon }`.
8069
+ *
8070
+ * This dictionary folds together what used to be scattered across four
8071
+ * copies:
8072
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8073
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8074
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8075
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8076
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8077
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8078
+ *
8079
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8080
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8081
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8082
+ * color or an icon: they read this dictionary (server descriptors carry the
8083
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8084
+ *
8085
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8086
+ */
8087
+ var TAXONOMY_COLORS = {
8088
+ motion: "#f59e0b",
8089
+ audio: "#06b6d4",
8090
+ person: "#22c55e",
8091
+ vehicle: "#3b82f6",
8092
+ animal: "#f97316",
8093
+ package: "#a855f7",
8094
+ sensor: "#8b5cf6",
8095
+ control: "#10b981",
8096
+ genericDetection: "#64748b"
8097
+ };
8098
+ var DETECTION_SUB_COLORS = {
8099
+ car: "#f59e0b",
8100
+ truck: "#d97706",
8101
+ bus: "#b45309",
8102
+ motorcycle: "#eab308",
8103
+ bicycle: "#ca8a04",
8104
+ airplane: "#60a5fa",
8105
+ boat: "#2563eb",
8106
+ train: "#1d4ed8",
8107
+ bird: "#14b8a6",
8108
+ dog: "#84cc16",
8109
+ cat: "#f97316",
8110
+ horse: "#a16207",
8111
+ sheep: "#a3a3a3",
8112
+ cow: "#78716c",
8113
+ elephant: "#6b7280",
8114
+ bear: "#7c2d12",
8115
+ zebra: "#404040",
8116
+ giraffe: "#d4a373"
8117
+ };
8118
+ function titleCase(id) {
8119
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8120
+ }
8121
+ var entries = /* @__PURE__ */ new Map();
8122
+ function macro(kind, category, color, iconId, label) {
8123
+ entries.set(kind, {
8124
+ kind,
8125
+ parentKind: null,
8126
+ level: "macro",
8127
+ category,
8128
+ color,
8129
+ iconId,
8130
+ labelKey: `eventKind.${kind}`,
8131
+ label
8132
+ });
8133
+ }
8134
+ function sub(kind, parentKind, category, color, iconId, label) {
8135
+ entries.set(kind, {
8136
+ kind,
8137
+ parentKind,
8138
+ level: "sub",
8139
+ category,
8140
+ color,
8141
+ iconId,
8142
+ labelKey: `eventKind.${kind}`,
8143
+ label
8144
+ });
8145
+ }
8146
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8147
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8148
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8149
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8150
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8151
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8152
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8153
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8154
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8155
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8156
+ if (entries.has(cocoClass)) continue;
8157
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8158
+ }
8159
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8160
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8161
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8162
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8163
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8164
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8165
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8166
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8167
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8168
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8169
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8170
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8171
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8172
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8173
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8174
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8175
+ sub("button", "control", "control", "#10b981", "button", "Button");
8176
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8177
+ for (const l of AUDIO_MACRO_LABELS) {
8178
+ const kind = `audio-${l.id}`;
8179
+ if (entries.has(kind)) continue;
8180
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8181
+ }
8182
+ /** The complete taxonomy dictionary, keyed by kind. */
8183
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8184
+ /**
7856
8185
  * Error types for the safe expression engine. Two distinct classes so callers
7857
8186
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7858
8187
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -16266,17 +16595,30 @@ var EventKindCategorySchema = _enum([
16266
16595
  "audio",
16267
16596
  "detection",
16268
16597
  "sensor",
16598
+ "control",
16269
16599
  "custom",
16270
16600
  "package"
16271
16601
  ]);
16602
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16603
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
16272
16604
  var EventKindDescriptorSchema = object({
16273
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16605
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16274
16606
  kind: string(),
16607
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16608
+ labelKey: string(),
16609
+ /** English fallback label (kept for clients that don't translate). */
16275
16610
  label: string(),
16276
16611
  /** Hex color for timeline/legend rendering. */
16277
16612
  color: string(),
16613
+ /** Dictionary id → lucide component on the UI side. */
16614
+ iconId: string(),
16615
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16278
16616
  icon: EventKindIconSchema,
16279
16617
  category: EventKindCategorySchema,
16618
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16619
+ parentKind: string().nullable(),
16620
+ /** Derived from `parentKind`, explicit for the client tree. */
16621
+ level: EventKindLevelSchema,
16280
16622
  /** Which cap + device contributes this kind. For built-ins the camera
16281
16623
  * itself; for sensor kinds the LINKED source device. */
16282
16624
  source: object({
@@ -16349,11 +16691,21 @@ var TrackAudioLabelSchema = object({
16349
16691
  firstAt: number(),
16350
16692
  lastAt: number()
16351
16693
  });
16694
+ /**
16695
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16696
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16697
+ * linked sensor/control state change (no positions; carries a snapshot). The
16698
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16699
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16700
+ */
16701
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16352
16702
  var TrackSchema = object({
16353
16703
  trackId: string(),
16354
16704
  deviceId: number(),
16355
16705
  className: string(),
16356
16706
  label: string().optional(),
16707
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16708
+ source: TrackSourceSchema.optional(),
16357
16709
  firstSeen: number(),
16358
16710
  lastSeen: number(),
16359
16711
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16608,6 +16960,26 @@ var TrackCascadeCountsSchema = object({
16608
16960
  /** Per-track CLIP search vectors removed (best-effort). */
16609
16961
  embeddings: number().int()
16610
16962
  });
16963
+ /** Event-store footprint for one camera. */
16964
+ var EventStoreDeviceFootprintSchema = object({
16965
+ deviceId: number(),
16966
+ /** Persisted event rows (motion + object + audio) for the camera. */
16967
+ rows: number().int(),
16968
+ /** Event-owned media bytes on disk for the camera. */
16969
+ bytes: number().int()
16970
+ });
16971
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
16972
+ var EventStoreFootprintSchema = object({
16973
+ totalRows: number().int(),
16974
+ totalBytes: number().int(),
16975
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
16976
+ });
16977
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
16978
+ var EventPruneCountsSchema = object({
16979
+ motion: number().int(),
16980
+ object: number().int(),
16981
+ audio: number().int()
16982
+ });
16611
16983
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
16612
16984
  deviceId: number(),
16613
16985
  trackId: string()
@@ -16671,6 +17043,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16671
17043
  }), {
16672
17044
  kind: "mutation",
16673
17045
  auth: "admin"
17046
+ }), method(object({}), EventStoreFootprintSchema, {
17047
+ kind: "query",
17048
+ auth: "admin"
17049
+ }), method(object({
17050
+ olderThanMs: number(),
17051
+ reason: OpsLogReasonSchema.optional()
17052
+ }), EventPruneCountsSchema, {
17053
+ kind: "mutation",
17054
+ auth: "admin"
17055
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17056
+ kind: "mutation",
17057
+ auth: "admin"
17058
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17059
+ kind: "query",
17060
+ auth: "admin"
16674
17061
  }), method(object({
16675
17062
  eventId: string(),
16676
17063
  kind: MediaFileKindEnum.optional()
@@ -16695,6 +17082,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16695
17082
  eventId: string(),
16696
17083
  timestamp: number()
16697
17084
  });
17085
+ /**
17086
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
17087
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
17088
+ * caps into per-camera event-kind descriptors.
17089
+ *
17090
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
17091
+ * is NOT duplicated here — every entry is derived from the single
17092
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
17093
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
17094
+ * control cap means adding one line here (and a taxonomy entry); the anti-
17095
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
17096
+ * eventful cap is missing.
17097
+ */
17098
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
17099
+ var LEGACY_ICON = {
17100
+ motion: "motion",
17101
+ audio: "audio",
17102
+ person: "person",
17103
+ vehicle: "vehicle",
17104
+ animal: "animal",
17105
+ package: "package",
17106
+ door: "door",
17107
+ pir: "pir",
17108
+ smoke: "smoke",
17109
+ water: "water",
17110
+ button: "button",
17111
+ generic: "generic",
17112
+ gas: "smoke",
17113
+ vibration: "generic",
17114
+ tamper: "generic",
17115
+ presence: "person",
17116
+ lock: "generic",
17117
+ siren: "generic",
17118
+ switch: "generic",
17119
+ doorbell: "button"
17120
+ };
17121
+ function legacyIcon(iconId) {
17122
+ return LEGACY_ICON[iconId] ?? "generic";
17123
+ }
17124
+ /**
17125
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
17126
+ * The anti-drift guard cross-checks this against the eventful caps declared
17127
+ * in `packages/types/src/capabilities/*.cap.ts`.
17128
+ */
17129
+ var CAP_TO_KIND = {
17130
+ contact: "contact",
17131
+ motion: "motion-sensor",
17132
+ smoke: "smoke",
17133
+ flood: "flood",
17134
+ gas: "gas",
17135
+ "carbon-monoxide": "carbon-monoxide",
17136
+ vibration: "vibration",
17137
+ tamper: "tamper",
17138
+ presence: "presence",
17139
+ "enum-sensor": "enum-sensor",
17140
+ "event-emitter": "device-event",
17141
+ "lock-control": "lock",
17142
+ switch: "switch",
17143
+ button: "button",
17144
+ doorbell: "doorbell"
17145
+ };
17146
+ function buildDescriptor(capName, kind) {
17147
+ const t = EVENT_TAXONOMY[kind];
17148
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
17149
+ return {
17150
+ ...t,
17151
+ icon: legacyIcon(t.iconId)
17152
+ };
17153
+ }
17154
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16698
17155
  var CameraPipelineConfigSchema = object({
16699
17156
  engine: PipelineEngineChoiceSchema.optional(),
16700
17157
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19997,13 +20454,29 @@ method(object({
19997
20454
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
19998
20455
  kind: "mutation",
19999
20456
  auth: "admin"
20000
- }), method(object({ deviceId: number() }), object({
20457
+ }), method(object({
20458
+ deviceId: number(),
20459
+ reason: OpsLogReasonSchema.optional()
20460
+ }), object({
20001
20461
  floorMs: number().nullable(),
20002
20462
  deletedBuckets: number().int(),
20003
20463
  reclaimedBytes: number().int()
20004
20464
  }), {
20005
20465
  kind: "mutation",
20006
20466
  auth: "admin"
20467
+ }), method(object({
20468
+ deviceId: number(),
20469
+ fromMs: number().optional(),
20470
+ toMs: number().optional()
20471
+ }), object({
20472
+ deletedBuckets: number().int(),
20473
+ reclaimedBytes: number().int()
20474
+ }), {
20475
+ kind: "mutation",
20476
+ auth: "admin"
20477
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
20478
+ kind: "query",
20479
+ auth: "admin"
20007
20480
  });
20008
20481
  /**
20009
20482
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -23125,6 +23598,12 @@ Object.freeze({
23125
23598
  addonId: null,
23126
23599
  access: "delete"
23127
23600
  },
23601
+ "pipelineAnalytics.deleteDeviceEvents": {
23602
+ capName: "pipeline-analytics",
23603
+ capScope: "device",
23604
+ addonId: null,
23605
+ access: "delete"
23606
+ },
23128
23607
  "pipelineAnalytics.deleteTracks": {
23129
23608
  capName: "pipeline-analytics",
23130
23609
  capScope: "device",
@@ -23155,6 +23634,12 @@ Object.freeze({
23155
23634
  addonId: null,
23156
23635
  access: "view"
23157
23636
  },
23637
+ "pipelineAnalytics.getEventStoreFootprint": {
23638
+ capName: "pipeline-analytics",
23639
+ capScope: "device",
23640
+ addonId: null,
23641
+ access: "view"
23642
+ },
23158
23643
  "pipelineAnalytics.getKeyEvents": {
23159
23644
  capName: "pipeline-analytics",
23160
23645
  capScope: "device",
@@ -23197,6 +23682,12 @@ Object.freeze({
23197
23682
  addonId: null,
23198
23683
  access: "view"
23199
23684
  },
23685
+ "pipelineAnalytics.listOpsLog": {
23686
+ capName: "pipeline-analytics",
23687
+ capScope: "device",
23688
+ addonId: null,
23689
+ access: "view"
23690
+ },
23200
23691
  "pipelineAnalytics.listRecentTracks": {
23201
23692
  capName: "pipeline-analytics",
23202
23693
  capScope: "device",
@@ -23209,6 +23700,12 @@ Object.freeze({
23209
23700
  addonId: null,
23210
23701
  access: "view"
23211
23702
  },
23703
+ "pipelineAnalytics.pruneEvents": {
23704
+ capName: "pipeline-analytics",
23705
+ capScope: "device",
23706
+ addonId: null,
23707
+ access: "create"
23708
+ },
23212
23709
  "pipelineAnalytics.pruneEventsBefore": {
23213
23710
  capName: "pipeline-analytics",
23214
23711
  capScope: "device",
@@ -23971,6 +24468,12 @@ Object.freeze({
23971
24468
  addonId: null,
23972
24469
  access: "create"
23973
24470
  },
24471
+ "recording.deleteFootprint": {
24472
+ capName: "recording",
24473
+ capScope: "system",
24474
+ addonId: null,
24475
+ access: "delete"
24476
+ },
23974
24477
  "recording.getAvailability": {
23975
24478
  capName: "recording",
23976
24479
  capScope: "system",
@@ -24001,6 +24504,12 @@ Object.freeze({
24001
24504
  addonId: null,
24002
24505
  access: "view"
24003
24506
  },
24507
+ "recording.listOpsLog": {
24508
+ capName: "recording",
24509
+ capScope: "system",
24510
+ addonId: null,
24511
+ access: "view"
24512
+ },
24004
24513
  "recording.locateSegment": {
24005
24514
  capName: "recording",
24006
24515
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-onvif",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "description": "ONVIF camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",