@camstack/addon-decoder-nodeav 1.1.16 → 1.1.18

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/index.js 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".
@@ -15932,17 +16261,30 @@ var EventKindCategorySchema = _enum([
15932
16261
  "audio",
15933
16262
  "detection",
15934
16263
  "sensor",
16264
+ "control",
15935
16265
  "custom",
15936
16266
  "package"
15937
16267
  ]);
16268
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16269
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15938
16270
  var EventKindDescriptorSchema = object({
15939
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16271
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15940
16272
  kind: string(),
16273
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16274
+ labelKey: string(),
16275
+ /** English fallback label (kept for clients that don't translate). */
15941
16276
  label: string(),
15942
16277
  /** Hex color for timeline/legend rendering. */
15943
16278
  color: string(),
16279
+ /** Dictionary id → lucide component on the UI side. */
16280
+ iconId: string(),
16281
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15944
16282
  icon: EventKindIconSchema,
15945
16283
  category: EventKindCategorySchema,
16284
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16285
+ parentKind: string().nullable(),
16286
+ /** Derived from `parentKind`, explicit for the client tree. */
16287
+ level: EventKindLevelSchema,
15946
16288
  /** Which cap + device contributes this kind. For built-ins the camera
15947
16289
  * itself; for sensor kinds the LINKED source device. */
15948
16290
  source: object({
@@ -16015,11 +16357,21 @@ var TrackAudioLabelSchema = object({
16015
16357
  firstAt: number(),
16016
16358
  lastAt: number()
16017
16359
  });
16360
+ /**
16361
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16362
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16363
+ * linked sensor/control state change (no positions; carries a snapshot). The
16364
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16365
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16366
+ */
16367
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16018
16368
  var TrackSchema = object({
16019
16369
  trackId: string(),
16020
16370
  deviceId: number(),
16021
16371
  className: string(),
16022
16372
  label: string().optional(),
16373
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16374
+ source: TrackSourceSchema.optional(),
16023
16375
  firstSeen: number(),
16024
16376
  lastSeen: number(),
16025
16377
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16274,6 +16626,26 @@ var TrackCascadeCountsSchema = object({
16274
16626
  /** Per-track CLIP search vectors removed (best-effort). */
16275
16627
  embeddings: number().int()
16276
16628
  });
16629
+ /** Event-store footprint for one camera. */
16630
+ var EventStoreDeviceFootprintSchema = object({
16631
+ deviceId: number(),
16632
+ /** Persisted event rows (motion + object + audio) for the camera. */
16633
+ rows: number().int(),
16634
+ /** Event-owned media bytes on disk for the camera. */
16635
+ bytes: number().int()
16636
+ });
16637
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
16638
+ var EventStoreFootprintSchema = object({
16639
+ totalRows: number().int(),
16640
+ totalBytes: number().int(),
16641
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
16642
+ });
16643
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
16644
+ var EventPruneCountsSchema = object({
16645
+ motion: number().int(),
16646
+ object: number().int(),
16647
+ audio: number().int()
16648
+ });
16277
16649
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
16278
16650
  deviceId: number(),
16279
16651
  trackId: string()
@@ -16337,6 +16709,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16337
16709
  }), {
16338
16710
  kind: "mutation",
16339
16711
  auth: "admin"
16712
+ }), method(object({}), EventStoreFootprintSchema, {
16713
+ kind: "query",
16714
+ auth: "admin"
16715
+ }), method(object({
16716
+ olderThanMs: number(),
16717
+ reason: OpsLogReasonSchema.optional()
16718
+ }), EventPruneCountsSchema, {
16719
+ kind: "mutation",
16720
+ auth: "admin"
16721
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
16722
+ kind: "mutation",
16723
+ auth: "admin"
16724
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
16725
+ kind: "query",
16726
+ auth: "admin"
16340
16727
  }), method(object({
16341
16728
  eventId: string(),
16342
16729
  kind: MediaFileKindEnum.optional()
@@ -16361,6 +16748,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16361
16748
  eventId: string(),
16362
16749
  timestamp: number()
16363
16750
  });
16751
+ /**
16752
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16753
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16754
+ * caps into per-camera event-kind descriptors.
16755
+ *
16756
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16757
+ * is NOT duplicated here — every entry is derived from the single
16758
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16759
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16760
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16761
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16762
+ * eventful cap is missing.
16763
+ */
16764
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16765
+ var LEGACY_ICON = {
16766
+ motion: "motion",
16767
+ audio: "audio",
16768
+ person: "person",
16769
+ vehicle: "vehicle",
16770
+ animal: "animal",
16771
+ package: "package",
16772
+ door: "door",
16773
+ pir: "pir",
16774
+ smoke: "smoke",
16775
+ water: "water",
16776
+ button: "button",
16777
+ generic: "generic",
16778
+ gas: "smoke",
16779
+ vibration: "generic",
16780
+ tamper: "generic",
16781
+ presence: "person",
16782
+ lock: "generic",
16783
+ siren: "generic",
16784
+ switch: "generic",
16785
+ doorbell: "button"
16786
+ };
16787
+ function legacyIcon(iconId) {
16788
+ return LEGACY_ICON[iconId] ?? "generic";
16789
+ }
16790
+ /**
16791
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16792
+ * The anti-drift guard cross-checks this against the eventful caps declared
16793
+ * in `packages/types/src/capabilities/*.cap.ts`.
16794
+ */
16795
+ var CAP_TO_KIND = {
16796
+ contact: "contact",
16797
+ motion: "motion-sensor",
16798
+ smoke: "smoke",
16799
+ flood: "flood",
16800
+ gas: "gas",
16801
+ "carbon-monoxide": "carbon-monoxide",
16802
+ vibration: "vibration",
16803
+ tamper: "tamper",
16804
+ presence: "presence",
16805
+ "enum-sensor": "enum-sensor",
16806
+ "event-emitter": "device-event",
16807
+ "lock-control": "lock",
16808
+ switch: "switch",
16809
+ button: "button",
16810
+ doorbell: "doorbell"
16811
+ };
16812
+ function buildDescriptor(capName, kind) {
16813
+ const t = EVENT_TAXONOMY[kind];
16814
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16815
+ return {
16816
+ ...t,
16817
+ icon: legacyIcon(t.iconId)
16818
+ };
16819
+ }
16820
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16364
16821
  var CameraPipelineConfigSchema = object({
16365
16822
  engine: PipelineEngineChoiceSchema.optional(),
16366
16823
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19570,13 +20027,29 @@ method(object({
19570
20027
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
19571
20028
  kind: "mutation",
19572
20029
  auth: "admin"
19573
- }), method(object({ deviceId: number() }), object({
20030
+ }), method(object({
20031
+ deviceId: number(),
20032
+ reason: OpsLogReasonSchema.optional()
20033
+ }), object({
19574
20034
  floorMs: number().nullable(),
19575
20035
  deletedBuckets: number().int(),
19576
20036
  reclaimedBytes: number().int()
19577
20037
  }), {
19578
20038
  kind: "mutation",
19579
20039
  auth: "admin"
20040
+ }), method(object({
20041
+ deviceId: number(),
20042
+ fromMs: number().optional(),
20043
+ toMs: number().optional()
20044
+ }), object({
20045
+ deletedBuckets: number().int(),
20046
+ reclaimedBytes: number().int()
20047
+ }), {
20048
+ kind: "mutation",
20049
+ auth: "admin"
20050
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
20051
+ kind: "query",
20052
+ auth: "admin"
19580
20053
  });
19581
20054
  /**
19582
20055
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -22698,6 +23171,12 @@ Object.freeze({
22698
23171
  addonId: null,
22699
23172
  access: "delete"
22700
23173
  },
23174
+ "pipelineAnalytics.deleteDeviceEvents": {
23175
+ capName: "pipeline-analytics",
23176
+ capScope: "device",
23177
+ addonId: null,
23178
+ access: "delete"
23179
+ },
22701
23180
  "pipelineAnalytics.deleteTracks": {
22702
23181
  capName: "pipeline-analytics",
22703
23182
  capScope: "device",
@@ -22728,6 +23207,12 @@ Object.freeze({
22728
23207
  addonId: null,
22729
23208
  access: "view"
22730
23209
  },
23210
+ "pipelineAnalytics.getEventStoreFootprint": {
23211
+ capName: "pipeline-analytics",
23212
+ capScope: "device",
23213
+ addonId: null,
23214
+ access: "view"
23215
+ },
22731
23216
  "pipelineAnalytics.getKeyEvents": {
22732
23217
  capName: "pipeline-analytics",
22733
23218
  capScope: "device",
@@ -22770,6 +23255,12 @@ Object.freeze({
22770
23255
  addonId: null,
22771
23256
  access: "view"
22772
23257
  },
23258
+ "pipelineAnalytics.listOpsLog": {
23259
+ capName: "pipeline-analytics",
23260
+ capScope: "device",
23261
+ addonId: null,
23262
+ access: "view"
23263
+ },
22773
23264
  "pipelineAnalytics.listRecentTracks": {
22774
23265
  capName: "pipeline-analytics",
22775
23266
  capScope: "device",
@@ -22782,6 +23273,12 @@ Object.freeze({
22782
23273
  addonId: null,
22783
23274
  access: "view"
22784
23275
  },
23276
+ "pipelineAnalytics.pruneEvents": {
23277
+ capName: "pipeline-analytics",
23278
+ capScope: "device",
23279
+ addonId: null,
23280
+ access: "create"
23281
+ },
22785
23282
  "pipelineAnalytics.pruneEventsBefore": {
22786
23283
  capName: "pipeline-analytics",
22787
23284
  capScope: "device",
@@ -23544,6 +24041,12 @@ Object.freeze({
23544
24041
  addonId: null,
23545
24042
  access: "create"
23546
24043
  },
24044
+ "recording.deleteFootprint": {
24045
+ capName: "recording",
24046
+ capScope: "system",
24047
+ addonId: null,
24048
+ access: "delete"
24049
+ },
23547
24050
  "recording.getAvailability": {
23548
24051
  capName: "recording",
23549
24052
  capScope: "system",
@@ -23574,6 +24077,12 @@ Object.freeze({
23574
24077
  addonId: null,
23575
24078
  access: "view"
23576
24079
  },
24080
+ "recording.listOpsLog": {
24081
+ capName: "recording",
24082
+ capScope: "system",
24083
+ addonId: null,
24084
+ access: "view"
24085
+ },
23577
24086
  "recording.locateSegment": {
23578
24087
  capName: "recording",
23579
24088
  capScope: "system",
package/dist/index.mjs CHANGED
@@ -7340,6 +7340,62 @@ var RecordingConfigSchema = object({
7340
7340
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7341
7341
  });
7342
7342
  /**
7343
+ * Ops-log — the durable, append-only operations audit shared by the
7344
+ * recordings and events management surfaces.
7345
+ *
7346
+ * ONE row shape is reused for both domains so a single "Activity" view can
7347
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7348
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7349
+ * management operation, WHY it ran (reason), and its measurable effect
7350
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7351
+ * never fail the operation it records.
7352
+ */
7353
+ /** Which management domain the operation belongs to. */
7354
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7355
+ /** The kind of management operation performed. */
7356
+ var OpsLogOpSchema = _enum([
7357
+ "prune",
7358
+ "manual-delete",
7359
+ "rescan",
7360
+ "retention-run"
7361
+ ]);
7362
+ /** Why the operation ran. */
7363
+ var OpsLogReasonSchema = _enum([
7364
+ "retention",
7365
+ "quota",
7366
+ "manual",
7367
+ "operator"
7368
+ ]);
7369
+ /** One audit row, shared verbatim by both domains. */
7370
+ var OpsLogEntrySchema = object({
7371
+ /** Unique row id. */
7372
+ id: string(),
7373
+ /** Epoch ms the operation completed. */
7374
+ at: number(),
7375
+ domain: OpsLogDomainSchema,
7376
+ op: OpsLogOpSchema,
7377
+ reason: OpsLogReasonSchema,
7378
+ /** The camera the op targeted; null for a cluster/global op. */
7379
+ deviceId: number().nullable(),
7380
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7381
+ nodeId: string(),
7382
+ /** Buckets / rows deleted (op-specific unit). */
7383
+ itemsAffected: number(),
7384
+ /** Bytes reclaimed by the op (0 when not measurable). */
7385
+ bytesReclaimed: number(),
7386
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7387
+ detail: string().nullable(),
7388
+ /** Who/what triggered the op. */
7389
+ actor: string()
7390
+ });
7391
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7392
+ var OpsLogQueryInputSchema = object({
7393
+ /** Restrict to a single camera; omit for every row. */
7394
+ deviceId: number().optional(),
7395
+ /** Max rows returned, newest-first. */
7396
+ limit: number().int().min(1).max(1e3).optional()
7397
+ });
7398
+ /**
7343
7399
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7344
7400
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7345
7401
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7583,6 +7639,160 @@ var EncodeProfileSchema = object({
7583
7639
  */
7584
7640
  outputArgs: array(string()).optional()
7585
7641
  });
7642
+ var COCO_TO_MACRO = {
7643
+ mapping: {
7644
+ person: "person",
7645
+ bicycle: "vehicle",
7646
+ car: "vehicle",
7647
+ motorcycle: "vehicle",
7648
+ airplane: "vehicle",
7649
+ bus: "vehicle",
7650
+ train: "vehicle",
7651
+ truck: "vehicle",
7652
+ boat: "vehicle",
7653
+ bird: "animal",
7654
+ cat: "animal",
7655
+ dog: "animal",
7656
+ horse: "animal",
7657
+ sheep: "animal",
7658
+ cow: "animal",
7659
+ elephant: "animal",
7660
+ bear: "animal",
7661
+ zebra: "animal",
7662
+ giraffe: "animal",
7663
+ suitcase: "package",
7664
+ backpack: "package",
7665
+ handbag: "package"
7666
+ },
7667
+ preserveOriginal: false
7668
+ };
7669
+ var AUDIO_MACRO_LABELS = [
7670
+ {
7671
+ id: "speech",
7672
+ name: "Speech",
7673
+ icon: "🗣️"
7674
+ },
7675
+ {
7676
+ id: "scream",
7677
+ name: "Scream / Shout",
7678
+ icon: "😱"
7679
+ },
7680
+ {
7681
+ id: "crying",
7682
+ name: "Crying / Baby",
7683
+ icon: "😢"
7684
+ },
7685
+ {
7686
+ id: "laughter",
7687
+ name: "Laughter",
7688
+ icon: "😂"
7689
+ },
7690
+ {
7691
+ id: "music",
7692
+ name: "Music",
7693
+ icon: "🎵"
7694
+ },
7695
+ {
7696
+ id: "dog",
7697
+ name: "Dog",
7698
+ icon: "🐕"
7699
+ },
7700
+ {
7701
+ id: "cat",
7702
+ name: "Cat",
7703
+ icon: "🐈"
7704
+ },
7705
+ {
7706
+ id: "bird",
7707
+ name: "Bird",
7708
+ icon: "🐦"
7709
+ },
7710
+ {
7711
+ id: "animal",
7712
+ name: "Animal (other)",
7713
+ icon: "🐾"
7714
+ },
7715
+ {
7716
+ id: "alarm",
7717
+ name: "Alarm / Siren",
7718
+ icon: "🚨"
7719
+ },
7720
+ {
7721
+ id: "doorbell",
7722
+ name: "Doorbell / Knock",
7723
+ icon: "🔔"
7724
+ },
7725
+ {
7726
+ id: "glass_breaking",
7727
+ name: "Glass Breaking",
7728
+ icon: "💥"
7729
+ },
7730
+ {
7731
+ id: "gunshot",
7732
+ name: "Gunshot / Explosion",
7733
+ icon: "💣"
7734
+ },
7735
+ {
7736
+ id: "vehicle",
7737
+ name: "Vehicle",
7738
+ icon: "🚗"
7739
+ },
7740
+ {
7741
+ id: "siren",
7742
+ name: "Emergency Siren",
7743
+ icon: "🚑"
7744
+ },
7745
+ {
7746
+ id: "fire",
7747
+ name: "Fire / Smoke",
7748
+ icon: "🔥"
7749
+ },
7750
+ {
7751
+ id: "water",
7752
+ name: "Water",
7753
+ icon: "💧"
7754
+ },
7755
+ {
7756
+ id: "wind",
7757
+ name: "Wind / Weather",
7758
+ icon: "🌬️"
7759
+ },
7760
+ {
7761
+ id: "door",
7762
+ name: "Door",
7763
+ icon: "🚪"
7764
+ },
7765
+ {
7766
+ id: "footsteps",
7767
+ name: "Footsteps",
7768
+ icon: "👣"
7769
+ },
7770
+ {
7771
+ id: "crowd",
7772
+ name: "Crowd / Chatter",
7773
+ icon: "👥"
7774
+ },
7775
+ {
7776
+ id: "telephone",
7777
+ name: "Telephone",
7778
+ icon: "📞"
7779
+ },
7780
+ {
7781
+ id: "engine",
7782
+ name: "Engine / Motor",
7783
+ icon: "⚙️"
7784
+ },
7785
+ {
7786
+ id: "tools",
7787
+ name: "Tools / Construction",
7788
+ icon: "🔨"
7789
+ },
7790
+ {
7791
+ id: "silence",
7792
+ name: "Silence",
7793
+ icon: "🤫"
7794
+ }
7795
+ ];
7586
7796
  var YAMNET_TO_MACRO = {
7587
7797
  mapping: {
7588
7798
  Speech: "speech",
@@ -7849,6 +8059,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7849
8059
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7850
8060
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7851
8061
  /**
8062
+ * Unified event-kind taxonomy — THE single source of truth for
8063
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8064
+ * icon }`.
8065
+ *
8066
+ * This dictionary folds together what used to be scattered across four
8067
+ * copies:
8068
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8069
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8070
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8071
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8072
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8073
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8074
+ *
8075
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8076
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8077
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8078
+ * color or an icon: they read this dictionary (server descriptors carry the
8079
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8080
+ *
8081
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8082
+ */
8083
+ var TAXONOMY_COLORS = {
8084
+ motion: "#f59e0b",
8085
+ audio: "#06b6d4",
8086
+ person: "#22c55e",
8087
+ vehicle: "#3b82f6",
8088
+ animal: "#f97316",
8089
+ package: "#a855f7",
8090
+ sensor: "#8b5cf6",
8091
+ control: "#10b981",
8092
+ genericDetection: "#64748b"
8093
+ };
8094
+ var DETECTION_SUB_COLORS = {
8095
+ car: "#f59e0b",
8096
+ truck: "#d97706",
8097
+ bus: "#b45309",
8098
+ motorcycle: "#eab308",
8099
+ bicycle: "#ca8a04",
8100
+ airplane: "#60a5fa",
8101
+ boat: "#2563eb",
8102
+ train: "#1d4ed8",
8103
+ bird: "#14b8a6",
8104
+ dog: "#84cc16",
8105
+ cat: "#f97316",
8106
+ horse: "#a16207",
8107
+ sheep: "#a3a3a3",
8108
+ cow: "#78716c",
8109
+ elephant: "#6b7280",
8110
+ bear: "#7c2d12",
8111
+ zebra: "#404040",
8112
+ giraffe: "#d4a373"
8113
+ };
8114
+ function titleCase(id) {
8115
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8116
+ }
8117
+ var entries = /* @__PURE__ */ new Map();
8118
+ function macro(kind, category, color, iconId, label) {
8119
+ entries.set(kind, {
8120
+ kind,
8121
+ parentKind: null,
8122
+ level: "macro",
8123
+ category,
8124
+ color,
8125
+ iconId,
8126
+ labelKey: `eventKind.${kind}`,
8127
+ label
8128
+ });
8129
+ }
8130
+ function sub(kind, parentKind, category, color, iconId, label) {
8131
+ entries.set(kind, {
8132
+ kind,
8133
+ parentKind,
8134
+ level: "sub",
8135
+ category,
8136
+ color,
8137
+ iconId,
8138
+ labelKey: `eventKind.${kind}`,
8139
+ label
8140
+ });
8141
+ }
8142
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8143
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8144
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8145
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8146
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8147
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8148
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8149
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8150
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8151
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8152
+ if (entries.has(cocoClass)) continue;
8153
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8154
+ }
8155
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8156
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8157
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8158
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8159
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8160
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8161
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8162
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8163
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8164
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8165
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8166
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8167
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8168
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8169
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8170
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8171
+ sub("button", "control", "control", "#10b981", "button", "Button");
8172
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8173
+ for (const l of AUDIO_MACRO_LABELS) {
8174
+ const kind = `audio-${l.id}`;
8175
+ if (entries.has(kind)) continue;
8176
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8177
+ }
8178
+ /** The complete taxonomy dictionary, keyed by kind. */
8179
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8180
+ /**
7852
8181
  * Error types for the safe expression engine. Two distinct classes so callers
7853
8182
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7854
8183
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -15928,17 +16257,30 @@ var EventKindCategorySchema = _enum([
15928
16257
  "audio",
15929
16258
  "detection",
15930
16259
  "sensor",
16260
+ "control",
15931
16261
  "custom",
15932
16262
  "package"
15933
16263
  ]);
16264
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16265
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15934
16266
  var EventKindDescriptorSchema = object({
15935
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16267
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15936
16268
  kind: string(),
16269
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16270
+ labelKey: string(),
16271
+ /** English fallback label (kept for clients that don't translate). */
15937
16272
  label: string(),
15938
16273
  /** Hex color for timeline/legend rendering. */
15939
16274
  color: string(),
16275
+ /** Dictionary id → lucide component on the UI side. */
16276
+ iconId: string(),
16277
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15940
16278
  icon: EventKindIconSchema,
15941
16279
  category: EventKindCategorySchema,
16280
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16281
+ parentKind: string().nullable(),
16282
+ /** Derived from `parentKind`, explicit for the client tree. */
16283
+ level: EventKindLevelSchema,
15942
16284
  /** Which cap + device contributes this kind. For built-ins the camera
15943
16285
  * itself; for sensor kinds the LINKED source device. */
15944
16286
  source: object({
@@ -16011,11 +16353,21 @@ var TrackAudioLabelSchema = object({
16011
16353
  firstAt: number(),
16012
16354
  lastAt: number()
16013
16355
  });
16356
+ /**
16357
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16358
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16359
+ * linked sensor/control state change (no positions; carries a snapshot). The
16360
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16361
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16362
+ */
16363
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16014
16364
  var TrackSchema = object({
16015
16365
  trackId: string(),
16016
16366
  deviceId: number(),
16017
16367
  className: string(),
16018
16368
  label: string().optional(),
16369
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16370
+ source: TrackSourceSchema.optional(),
16019
16371
  firstSeen: number(),
16020
16372
  lastSeen: number(),
16021
16373
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16270,6 +16622,26 @@ var TrackCascadeCountsSchema = object({
16270
16622
  /** Per-track CLIP search vectors removed (best-effort). */
16271
16623
  embeddings: number().int()
16272
16624
  });
16625
+ /** Event-store footprint for one camera. */
16626
+ var EventStoreDeviceFootprintSchema = object({
16627
+ deviceId: number(),
16628
+ /** Persisted event rows (motion + object + audio) for the camera. */
16629
+ rows: number().int(),
16630
+ /** Event-owned media bytes on disk for the camera. */
16631
+ bytes: number().int()
16632
+ });
16633
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
16634
+ var EventStoreFootprintSchema = object({
16635
+ totalRows: number().int(),
16636
+ totalBytes: number().int(),
16637
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
16638
+ });
16639
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
16640
+ var EventPruneCountsSchema = object({
16641
+ motion: number().int(),
16642
+ object: number().int(),
16643
+ audio: number().int()
16644
+ });
16273
16645
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
16274
16646
  deviceId: number(),
16275
16647
  trackId: string()
@@ -16333,6 +16705,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16333
16705
  }), {
16334
16706
  kind: "mutation",
16335
16707
  auth: "admin"
16708
+ }), method(object({}), EventStoreFootprintSchema, {
16709
+ kind: "query",
16710
+ auth: "admin"
16711
+ }), method(object({
16712
+ olderThanMs: number(),
16713
+ reason: OpsLogReasonSchema.optional()
16714
+ }), EventPruneCountsSchema, {
16715
+ kind: "mutation",
16716
+ auth: "admin"
16717
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
16718
+ kind: "mutation",
16719
+ auth: "admin"
16720
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
16721
+ kind: "query",
16722
+ auth: "admin"
16336
16723
  }), method(object({
16337
16724
  eventId: string(),
16338
16725
  kind: MediaFileKindEnum.optional()
@@ -16357,6 +16744,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16357
16744
  eventId: string(),
16358
16745
  timestamp: number()
16359
16746
  });
16747
+ /**
16748
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16749
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16750
+ * caps into per-camera event-kind descriptors.
16751
+ *
16752
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16753
+ * is NOT duplicated here — every entry is derived from the single
16754
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16755
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16756
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16757
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16758
+ * eventful cap is missing.
16759
+ */
16760
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16761
+ var LEGACY_ICON = {
16762
+ motion: "motion",
16763
+ audio: "audio",
16764
+ person: "person",
16765
+ vehicle: "vehicle",
16766
+ animal: "animal",
16767
+ package: "package",
16768
+ door: "door",
16769
+ pir: "pir",
16770
+ smoke: "smoke",
16771
+ water: "water",
16772
+ button: "button",
16773
+ generic: "generic",
16774
+ gas: "smoke",
16775
+ vibration: "generic",
16776
+ tamper: "generic",
16777
+ presence: "person",
16778
+ lock: "generic",
16779
+ siren: "generic",
16780
+ switch: "generic",
16781
+ doorbell: "button"
16782
+ };
16783
+ function legacyIcon(iconId) {
16784
+ return LEGACY_ICON[iconId] ?? "generic";
16785
+ }
16786
+ /**
16787
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16788
+ * The anti-drift guard cross-checks this against the eventful caps declared
16789
+ * in `packages/types/src/capabilities/*.cap.ts`.
16790
+ */
16791
+ var CAP_TO_KIND = {
16792
+ contact: "contact",
16793
+ motion: "motion-sensor",
16794
+ smoke: "smoke",
16795
+ flood: "flood",
16796
+ gas: "gas",
16797
+ "carbon-monoxide": "carbon-monoxide",
16798
+ vibration: "vibration",
16799
+ tamper: "tamper",
16800
+ presence: "presence",
16801
+ "enum-sensor": "enum-sensor",
16802
+ "event-emitter": "device-event",
16803
+ "lock-control": "lock",
16804
+ switch: "switch",
16805
+ button: "button",
16806
+ doorbell: "doorbell"
16807
+ };
16808
+ function buildDescriptor(capName, kind) {
16809
+ const t = EVENT_TAXONOMY[kind];
16810
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16811
+ return {
16812
+ ...t,
16813
+ icon: legacyIcon(t.iconId)
16814
+ };
16815
+ }
16816
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16360
16817
  var CameraPipelineConfigSchema = object({
16361
16818
  engine: PipelineEngineChoiceSchema.optional(),
16362
16819
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19566,13 +20023,29 @@ method(object({
19566
20023
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
19567
20024
  kind: "mutation",
19568
20025
  auth: "admin"
19569
- }), method(object({ deviceId: number() }), object({
20026
+ }), method(object({
20027
+ deviceId: number(),
20028
+ reason: OpsLogReasonSchema.optional()
20029
+ }), object({
19570
20030
  floorMs: number().nullable(),
19571
20031
  deletedBuckets: number().int(),
19572
20032
  reclaimedBytes: number().int()
19573
20033
  }), {
19574
20034
  kind: "mutation",
19575
20035
  auth: "admin"
20036
+ }), method(object({
20037
+ deviceId: number(),
20038
+ fromMs: number().optional(),
20039
+ toMs: number().optional()
20040
+ }), object({
20041
+ deletedBuckets: number().int(),
20042
+ reclaimedBytes: number().int()
20043
+ }), {
20044
+ kind: "mutation",
20045
+ auth: "admin"
20046
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
20047
+ kind: "query",
20048
+ auth: "admin"
19576
20049
  });
19577
20050
  /**
19578
20051
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -22694,6 +23167,12 @@ Object.freeze({
22694
23167
  addonId: null,
22695
23168
  access: "delete"
22696
23169
  },
23170
+ "pipelineAnalytics.deleteDeviceEvents": {
23171
+ capName: "pipeline-analytics",
23172
+ capScope: "device",
23173
+ addonId: null,
23174
+ access: "delete"
23175
+ },
22697
23176
  "pipelineAnalytics.deleteTracks": {
22698
23177
  capName: "pipeline-analytics",
22699
23178
  capScope: "device",
@@ -22724,6 +23203,12 @@ Object.freeze({
22724
23203
  addonId: null,
22725
23204
  access: "view"
22726
23205
  },
23206
+ "pipelineAnalytics.getEventStoreFootprint": {
23207
+ capName: "pipeline-analytics",
23208
+ capScope: "device",
23209
+ addonId: null,
23210
+ access: "view"
23211
+ },
22727
23212
  "pipelineAnalytics.getKeyEvents": {
22728
23213
  capName: "pipeline-analytics",
22729
23214
  capScope: "device",
@@ -22766,6 +23251,12 @@ Object.freeze({
22766
23251
  addonId: null,
22767
23252
  access: "view"
22768
23253
  },
23254
+ "pipelineAnalytics.listOpsLog": {
23255
+ capName: "pipeline-analytics",
23256
+ capScope: "device",
23257
+ addonId: null,
23258
+ access: "view"
23259
+ },
22769
23260
  "pipelineAnalytics.listRecentTracks": {
22770
23261
  capName: "pipeline-analytics",
22771
23262
  capScope: "device",
@@ -22778,6 +23269,12 @@ Object.freeze({
22778
23269
  addonId: null,
22779
23270
  access: "view"
22780
23271
  },
23272
+ "pipelineAnalytics.pruneEvents": {
23273
+ capName: "pipeline-analytics",
23274
+ capScope: "device",
23275
+ addonId: null,
23276
+ access: "create"
23277
+ },
22781
23278
  "pipelineAnalytics.pruneEventsBefore": {
22782
23279
  capName: "pipeline-analytics",
22783
23280
  capScope: "device",
@@ -23540,6 +24037,12 @@ Object.freeze({
23540
24037
  addonId: null,
23541
24038
  access: "create"
23542
24039
  },
24040
+ "recording.deleteFootprint": {
24041
+ capName: "recording",
24042
+ capScope: "system",
24043
+ addonId: null,
24044
+ access: "delete"
24045
+ },
23543
24046
  "recording.getAvailability": {
23544
24047
  capName: "recording",
23545
24048
  capScope: "system",
@@ -23570,6 +24073,12 @@ Object.freeze({
23570
24073
  addonId: null,
23571
24074
  access: "view"
23572
24075
  },
24076
+ "recording.listOpsLog": {
24077
+ capName: "recording",
24078
+ capScope: "system",
24079
+ addonId: null,
24080
+ access: "view"
24081
+ },
23573
24082
  "recording.locateSegment": {
23574
24083
  capName: "recording",
23575
24084
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-decoder-nodeav",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "description": "Standalone in-process node-av decoder addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",