@camstack/addon-provider-unraid 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.js CHANGED
@@ -7358,6 +7358,62 @@ var RecordingConfigSchema = object({
7358
7358
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7359
7359
  });
7360
7360
  /**
7361
+ * Ops-log — the durable, append-only operations audit shared by the
7362
+ * recordings and events management surfaces.
7363
+ *
7364
+ * ONE row shape is reused for both domains so a single "Activity" view can
7365
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7366
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7367
+ * management operation, WHY it ran (reason), and its measurable effect
7368
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7369
+ * never fail the operation it records.
7370
+ */
7371
+ /** Which management domain the operation belongs to. */
7372
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7373
+ /** The kind of management operation performed. */
7374
+ var OpsLogOpSchema = _enum([
7375
+ "prune",
7376
+ "manual-delete",
7377
+ "rescan",
7378
+ "retention-run"
7379
+ ]);
7380
+ /** Why the operation ran. */
7381
+ var OpsLogReasonSchema = _enum([
7382
+ "retention",
7383
+ "quota",
7384
+ "manual",
7385
+ "operator"
7386
+ ]);
7387
+ /** One audit row, shared verbatim by both domains. */
7388
+ var OpsLogEntrySchema = object({
7389
+ /** Unique row id. */
7390
+ id: string(),
7391
+ /** Epoch ms the operation completed. */
7392
+ at: number(),
7393
+ domain: OpsLogDomainSchema,
7394
+ op: OpsLogOpSchema,
7395
+ reason: OpsLogReasonSchema,
7396
+ /** The camera the op targeted; null for a cluster/global op. */
7397
+ deviceId: number().nullable(),
7398
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7399
+ nodeId: string(),
7400
+ /** Buckets / rows deleted (op-specific unit). */
7401
+ itemsAffected: number(),
7402
+ /** Bytes reclaimed by the op (0 when not measurable). */
7403
+ bytesReclaimed: number(),
7404
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7405
+ detail: string().nullable(),
7406
+ /** Who/what triggered the op. */
7407
+ actor: string()
7408
+ });
7409
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7410
+ var OpsLogQueryInputSchema = object({
7411
+ /** Restrict to a single camera; omit for every row. */
7412
+ deviceId: number().optional(),
7413
+ /** Max rows returned, newest-first. */
7414
+ limit: number().int().min(1).max(1e3).optional()
7415
+ });
7416
+ /**
7361
7417
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7362
7418
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7363
7419
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7601,6 +7657,160 @@ var EncodeProfileSchema = object({
7601
7657
  */
7602
7658
  outputArgs: array(string()).optional()
7603
7659
  });
7660
+ var COCO_TO_MACRO = {
7661
+ mapping: {
7662
+ person: "person",
7663
+ bicycle: "vehicle",
7664
+ car: "vehicle",
7665
+ motorcycle: "vehicle",
7666
+ airplane: "vehicle",
7667
+ bus: "vehicle",
7668
+ train: "vehicle",
7669
+ truck: "vehicle",
7670
+ boat: "vehicle",
7671
+ bird: "animal",
7672
+ cat: "animal",
7673
+ dog: "animal",
7674
+ horse: "animal",
7675
+ sheep: "animal",
7676
+ cow: "animal",
7677
+ elephant: "animal",
7678
+ bear: "animal",
7679
+ zebra: "animal",
7680
+ giraffe: "animal",
7681
+ suitcase: "package",
7682
+ backpack: "package",
7683
+ handbag: "package"
7684
+ },
7685
+ preserveOriginal: false
7686
+ };
7687
+ var AUDIO_MACRO_LABELS = [
7688
+ {
7689
+ id: "speech",
7690
+ name: "Speech",
7691
+ icon: "🗣️"
7692
+ },
7693
+ {
7694
+ id: "scream",
7695
+ name: "Scream / Shout",
7696
+ icon: "😱"
7697
+ },
7698
+ {
7699
+ id: "crying",
7700
+ name: "Crying / Baby",
7701
+ icon: "😢"
7702
+ },
7703
+ {
7704
+ id: "laughter",
7705
+ name: "Laughter",
7706
+ icon: "😂"
7707
+ },
7708
+ {
7709
+ id: "music",
7710
+ name: "Music",
7711
+ icon: "🎵"
7712
+ },
7713
+ {
7714
+ id: "dog",
7715
+ name: "Dog",
7716
+ icon: "🐕"
7717
+ },
7718
+ {
7719
+ id: "cat",
7720
+ name: "Cat",
7721
+ icon: "🐈"
7722
+ },
7723
+ {
7724
+ id: "bird",
7725
+ name: "Bird",
7726
+ icon: "🐦"
7727
+ },
7728
+ {
7729
+ id: "animal",
7730
+ name: "Animal (other)",
7731
+ icon: "🐾"
7732
+ },
7733
+ {
7734
+ id: "alarm",
7735
+ name: "Alarm / Siren",
7736
+ icon: "🚨"
7737
+ },
7738
+ {
7739
+ id: "doorbell",
7740
+ name: "Doorbell / Knock",
7741
+ icon: "🔔"
7742
+ },
7743
+ {
7744
+ id: "glass_breaking",
7745
+ name: "Glass Breaking",
7746
+ icon: "💥"
7747
+ },
7748
+ {
7749
+ id: "gunshot",
7750
+ name: "Gunshot / Explosion",
7751
+ icon: "💣"
7752
+ },
7753
+ {
7754
+ id: "vehicle",
7755
+ name: "Vehicle",
7756
+ icon: "🚗"
7757
+ },
7758
+ {
7759
+ id: "siren",
7760
+ name: "Emergency Siren",
7761
+ icon: "🚑"
7762
+ },
7763
+ {
7764
+ id: "fire",
7765
+ name: "Fire / Smoke",
7766
+ icon: "🔥"
7767
+ },
7768
+ {
7769
+ id: "water",
7770
+ name: "Water",
7771
+ icon: "💧"
7772
+ },
7773
+ {
7774
+ id: "wind",
7775
+ name: "Wind / Weather",
7776
+ icon: "🌬️"
7777
+ },
7778
+ {
7779
+ id: "door",
7780
+ name: "Door",
7781
+ icon: "🚪"
7782
+ },
7783
+ {
7784
+ id: "footsteps",
7785
+ name: "Footsteps",
7786
+ icon: "👣"
7787
+ },
7788
+ {
7789
+ id: "crowd",
7790
+ name: "Crowd / Chatter",
7791
+ icon: "👥"
7792
+ },
7793
+ {
7794
+ id: "telephone",
7795
+ name: "Telephone",
7796
+ icon: "📞"
7797
+ },
7798
+ {
7799
+ id: "engine",
7800
+ name: "Engine / Motor",
7801
+ icon: "⚙️"
7802
+ },
7803
+ {
7804
+ id: "tools",
7805
+ name: "Tools / Construction",
7806
+ icon: "🔨"
7807
+ },
7808
+ {
7809
+ id: "silence",
7810
+ name: "Silence",
7811
+ icon: "🤫"
7812
+ }
7813
+ ];
7604
7814
  var YAMNET_TO_MACRO = {
7605
7815
  mapping: {
7606
7816
  Speech: "speech",
@@ -7867,6 +8077,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7867
8077
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7868
8078
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7869
8079
  /**
8080
+ * Unified event-kind taxonomy — THE single source of truth for
8081
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8082
+ * icon }`.
8083
+ *
8084
+ * This dictionary folds together what used to be scattered across four
8085
+ * copies:
8086
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8087
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8088
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8089
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8090
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8091
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8092
+ *
8093
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8094
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8095
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8096
+ * color or an icon: they read this dictionary (server descriptors carry the
8097
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8098
+ *
8099
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8100
+ */
8101
+ var TAXONOMY_COLORS = {
8102
+ motion: "#f59e0b",
8103
+ audio: "#06b6d4",
8104
+ person: "#22c55e",
8105
+ vehicle: "#3b82f6",
8106
+ animal: "#f97316",
8107
+ package: "#a855f7",
8108
+ sensor: "#8b5cf6",
8109
+ control: "#10b981",
8110
+ genericDetection: "#64748b"
8111
+ };
8112
+ var DETECTION_SUB_COLORS = {
8113
+ car: "#f59e0b",
8114
+ truck: "#d97706",
8115
+ bus: "#b45309",
8116
+ motorcycle: "#eab308",
8117
+ bicycle: "#ca8a04",
8118
+ airplane: "#60a5fa",
8119
+ boat: "#2563eb",
8120
+ train: "#1d4ed8",
8121
+ bird: "#14b8a6",
8122
+ dog: "#84cc16",
8123
+ cat: "#f97316",
8124
+ horse: "#a16207",
8125
+ sheep: "#a3a3a3",
8126
+ cow: "#78716c",
8127
+ elephant: "#6b7280",
8128
+ bear: "#7c2d12",
8129
+ zebra: "#404040",
8130
+ giraffe: "#d4a373"
8131
+ };
8132
+ function titleCase(id) {
8133
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8134
+ }
8135
+ var entries = /* @__PURE__ */ new Map();
8136
+ function macro(kind, category, color, iconId, label) {
8137
+ entries.set(kind, {
8138
+ kind,
8139
+ parentKind: null,
8140
+ level: "macro",
8141
+ category,
8142
+ color,
8143
+ iconId,
8144
+ labelKey: `eventKind.${kind}`,
8145
+ label
8146
+ });
8147
+ }
8148
+ function sub(kind, parentKind, category, color, iconId, label) {
8149
+ entries.set(kind, {
8150
+ kind,
8151
+ parentKind,
8152
+ level: "sub",
8153
+ category,
8154
+ color,
8155
+ iconId,
8156
+ labelKey: `eventKind.${kind}`,
8157
+ label
8158
+ });
8159
+ }
8160
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8161
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8162
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8163
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8164
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8165
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8166
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8167
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8168
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8169
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8170
+ if (entries.has(cocoClass)) continue;
8171
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8172
+ }
8173
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8174
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8175
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8176
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8177
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8178
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8179
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8180
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8181
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8182
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8183
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8184
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8185
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8186
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8187
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8188
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8189
+ sub("button", "control", "control", "#10b981", "button", "Button");
8190
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8191
+ for (const l of AUDIO_MACRO_LABELS) {
8192
+ const kind = `audio-${l.id}`;
8193
+ if (entries.has(kind)) continue;
8194
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8195
+ }
8196
+ /** The complete taxonomy dictionary, keyed by kind. */
8197
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8198
+ /**
7870
8199
  * Error types for the safe expression engine. Two distinct classes so callers
7871
8200
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7872
8201
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -14821,9 +15150,10 @@ var DEVICE_LOCAL_STATE_CAPS = {
14821
15150
  * `package` backs the package-drop detector — a package zone is a
14822
15151
  * `ZoneRule` on the `'package'` stage referencing drawn polygons
14823
15152
  * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14824
- * The orchestrator provider that writes this stage lands in a later
14825
- * slice; until then the mirror carries only `{motion, detection}` and
14826
- * consumers read `package` as absent (treat as `[]`).
15153
+ * The orchestrator provider writes this stage as a first-class slice
15154
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
15155
+ * package}` shape, so consumers read the current package rules directly
15156
+ * off `device.state.zoneRules.value.package`.
14827
15157
  */
14828
15158
  runtimeState: object({
14829
15159
  motion: array(ZoneRuleSchema).readonly(),
@@ -18798,17 +19128,30 @@ var EventKindCategorySchema = _enum([
18798
19128
  "audio",
18799
19129
  "detection",
18800
19130
  "sensor",
19131
+ "control",
18801
19132
  "custom",
18802
19133
  "package"
18803
19134
  ]);
19135
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19136
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18804
19137
  var EventKindDescriptorSchema = object({
18805
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19138
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18806
19139
  kind: string(),
19140
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19141
+ labelKey: string(),
19142
+ /** English fallback label (kept for clients that don't translate). */
18807
19143
  label: string(),
18808
19144
  /** Hex color for timeline/legend rendering. */
18809
19145
  color: string(),
19146
+ /** Dictionary id → lucide component on the UI side. */
19147
+ iconId: string(),
19148
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18810
19149
  icon: EventKindIconSchema,
18811
19150
  category: EventKindCategorySchema,
19151
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19152
+ parentKind: string().nullable(),
19153
+ /** Derived from `parentKind`, explicit for the client tree. */
19154
+ level: EventKindLevelSchema,
18812
19155
  /** Which cap + device contributes this kind. For built-ins the camera
18813
19156
  * itself; for sensor kinds the LINKED source device. */
18814
19157
  source: object({
@@ -18881,11 +19224,21 @@ var TrackAudioLabelSchema = object({
18881
19224
  firstAt: number(),
18882
19225
  lastAt: number()
18883
19226
  });
19227
+ /**
19228
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19229
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19230
+ * linked sensor/control state change (no positions; carries a snapshot). The
19231
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19232
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19233
+ */
19234
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18884
19235
  var TrackSchema = object({
18885
19236
  trackId: string(),
18886
19237
  deviceId: number(),
18887
19238
  className: string(),
18888
19239
  label: string().optional(),
19240
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19241
+ source: TrackSourceSchema.optional(),
18889
19242
  firstSeen: number(),
18890
19243
  lastSeen: number(),
18891
19244
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19140,6 +19493,26 @@ var TrackCascadeCountsSchema = object({
19140
19493
  /** Per-track CLIP search vectors removed (best-effort). */
19141
19494
  embeddings: number().int()
19142
19495
  });
19496
+ /** Event-store footprint for one camera. */
19497
+ var EventStoreDeviceFootprintSchema = object({
19498
+ deviceId: number(),
19499
+ /** Persisted event rows (motion + object + audio) for the camera. */
19500
+ rows: number().int(),
19501
+ /** Event-owned media bytes on disk for the camera. */
19502
+ bytes: number().int()
19503
+ });
19504
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19505
+ var EventStoreFootprintSchema = object({
19506
+ totalRows: number().int(),
19507
+ totalBytes: number().int(),
19508
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19509
+ });
19510
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19511
+ var EventPruneCountsSchema = object({
19512
+ motion: number().int(),
19513
+ object: number().int(),
19514
+ audio: number().int()
19515
+ });
19143
19516
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19144
19517
  deviceId: number(),
19145
19518
  trackId: string()
@@ -19203,6 +19576,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19203
19576
  }), {
19204
19577
  kind: "mutation",
19205
19578
  auth: "admin"
19579
+ }), method(object({}), EventStoreFootprintSchema, {
19580
+ kind: "query",
19581
+ auth: "admin"
19582
+ }), method(object({
19583
+ olderThanMs: number(),
19584
+ reason: OpsLogReasonSchema.optional()
19585
+ }), EventPruneCountsSchema, {
19586
+ kind: "mutation",
19587
+ auth: "admin"
19588
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19589
+ kind: "mutation",
19590
+ auth: "admin"
19591
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19592
+ kind: "query",
19593
+ auth: "admin"
19206
19594
  }), method(object({
19207
19595
  eventId: string(),
19208
19596
  kind: MediaFileKindEnum.optional()
@@ -19227,6 +19615,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19227
19615
  eventId: string(),
19228
19616
  timestamp: number()
19229
19617
  });
19618
+ /**
19619
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19620
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19621
+ * caps into per-camera event-kind descriptors.
19622
+ *
19623
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19624
+ * is NOT duplicated here — every entry is derived from the single
19625
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19626
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19627
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19628
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19629
+ * eventful cap is missing.
19630
+ */
19631
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19632
+ var LEGACY_ICON = {
19633
+ motion: "motion",
19634
+ audio: "audio",
19635
+ person: "person",
19636
+ vehicle: "vehicle",
19637
+ animal: "animal",
19638
+ package: "package",
19639
+ door: "door",
19640
+ pir: "pir",
19641
+ smoke: "smoke",
19642
+ water: "water",
19643
+ button: "button",
19644
+ generic: "generic",
19645
+ gas: "smoke",
19646
+ vibration: "generic",
19647
+ tamper: "generic",
19648
+ presence: "person",
19649
+ lock: "generic",
19650
+ siren: "generic",
19651
+ switch: "generic",
19652
+ doorbell: "button"
19653
+ };
19654
+ function legacyIcon(iconId) {
19655
+ return LEGACY_ICON[iconId] ?? "generic";
19656
+ }
19657
+ /**
19658
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19659
+ * The anti-drift guard cross-checks this against the eventful caps declared
19660
+ * in `packages/types/src/capabilities/*.cap.ts`.
19661
+ */
19662
+ var CAP_TO_KIND = {
19663
+ contact: "contact",
19664
+ motion: "motion-sensor",
19665
+ smoke: "smoke",
19666
+ flood: "flood",
19667
+ gas: "gas",
19668
+ "carbon-monoxide": "carbon-monoxide",
19669
+ vibration: "vibration",
19670
+ tamper: "tamper",
19671
+ presence: "presence",
19672
+ "enum-sensor": "enum-sensor",
19673
+ "event-emitter": "device-event",
19674
+ "lock-control": "lock",
19675
+ switch: "switch",
19676
+ button: "button",
19677
+ doorbell: "doorbell"
19678
+ };
19679
+ function buildDescriptor(capName, kind) {
19680
+ const t = EVENT_TAXONOMY[kind];
19681
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19682
+ return {
19683
+ ...t,
19684
+ icon: legacyIcon(t.iconId)
19685
+ };
19686
+ }
19687
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19230
19688
  var CameraPipelineConfigSchema = object({
19231
19689
  engine: PipelineEngineChoiceSchema.optional(),
19232
19690
  steps: array(PipelineStepInputSchema).readonly(),
@@ -22453,13 +22911,29 @@ method(object({
22453
22911
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22454
22912
  kind: "mutation",
22455
22913
  auth: "admin"
22456
- }), method(object({ deviceId: number() }), object({
22914
+ }), method(object({
22915
+ deviceId: number(),
22916
+ reason: OpsLogReasonSchema.optional()
22917
+ }), object({
22457
22918
  floorMs: number().nullable(),
22458
22919
  deletedBuckets: number().int(),
22459
22920
  reclaimedBytes: number().int()
22460
22921
  }), {
22461
22922
  kind: "mutation",
22462
22923
  auth: "admin"
22924
+ }), method(object({
22925
+ deviceId: number(),
22926
+ fromMs: number().optional(),
22927
+ toMs: number().optional()
22928
+ }), object({
22929
+ deletedBuckets: number().int(),
22930
+ reclaimedBytes: number().int()
22931
+ }), {
22932
+ kind: "mutation",
22933
+ auth: "admin"
22934
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
22935
+ kind: "query",
22936
+ auth: "admin"
22463
22937
  });
22464
22938
  /**
22465
22939
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -25581,6 +26055,12 @@ Object.freeze({
25581
26055
  addonId: null,
25582
26056
  access: "delete"
25583
26057
  },
26058
+ "pipelineAnalytics.deleteDeviceEvents": {
26059
+ capName: "pipeline-analytics",
26060
+ capScope: "device",
26061
+ addonId: null,
26062
+ access: "delete"
26063
+ },
25584
26064
  "pipelineAnalytics.deleteTracks": {
25585
26065
  capName: "pipeline-analytics",
25586
26066
  capScope: "device",
@@ -25611,6 +26091,12 @@ Object.freeze({
25611
26091
  addonId: null,
25612
26092
  access: "view"
25613
26093
  },
26094
+ "pipelineAnalytics.getEventStoreFootprint": {
26095
+ capName: "pipeline-analytics",
26096
+ capScope: "device",
26097
+ addonId: null,
26098
+ access: "view"
26099
+ },
25614
26100
  "pipelineAnalytics.getKeyEvents": {
25615
26101
  capName: "pipeline-analytics",
25616
26102
  capScope: "device",
@@ -25653,6 +26139,12 @@ Object.freeze({
25653
26139
  addonId: null,
25654
26140
  access: "view"
25655
26141
  },
26142
+ "pipelineAnalytics.listOpsLog": {
26143
+ capName: "pipeline-analytics",
26144
+ capScope: "device",
26145
+ addonId: null,
26146
+ access: "view"
26147
+ },
25656
26148
  "pipelineAnalytics.listRecentTracks": {
25657
26149
  capName: "pipeline-analytics",
25658
26150
  capScope: "device",
@@ -25665,6 +26157,12 @@ Object.freeze({
25665
26157
  addonId: null,
25666
26158
  access: "view"
25667
26159
  },
26160
+ "pipelineAnalytics.pruneEvents": {
26161
+ capName: "pipeline-analytics",
26162
+ capScope: "device",
26163
+ addonId: null,
26164
+ access: "create"
26165
+ },
25668
26166
  "pipelineAnalytics.pruneEventsBefore": {
25669
26167
  capName: "pipeline-analytics",
25670
26168
  capScope: "device",
@@ -26427,6 +26925,12 @@ Object.freeze({
26427
26925
  addonId: null,
26428
26926
  access: "create"
26429
26927
  },
26928
+ "recording.deleteFootprint": {
26929
+ capName: "recording",
26930
+ capScope: "system",
26931
+ addonId: null,
26932
+ access: "delete"
26933
+ },
26430
26934
  "recording.getAvailability": {
26431
26935
  capName: "recording",
26432
26936
  capScope: "system",
@@ -26457,6 +26961,12 @@ Object.freeze({
26457
26961
  addonId: null,
26458
26962
  access: "view"
26459
26963
  },
26964
+ "recording.listOpsLog": {
26965
+ capName: "recording",
26966
+ capScope: "system",
26967
+ addonId: null,
26968
+ access: "view"
26969
+ },
26460
26970
  "recording.locateSegment": {
26461
26971
  capName: "recording",
26462
26972
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -7357,6 +7357,62 @@ var RecordingConfigSchema = object({
7357
7357
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7358
7358
  });
7359
7359
  /**
7360
+ * Ops-log — the durable, append-only operations audit shared by the
7361
+ * recordings and events management surfaces.
7362
+ *
7363
+ * ONE row shape is reused for both domains so a single "Activity" view can
7364
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7365
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7366
+ * management operation, WHY it ran (reason), and its measurable effect
7367
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7368
+ * never fail the operation it records.
7369
+ */
7370
+ /** Which management domain the operation belongs to. */
7371
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7372
+ /** The kind of management operation performed. */
7373
+ var OpsLogOpSchema = _enum([
7374
+ "prune",
7375
+ "manual-delete",
7376
+ "rescan",
7377
+ "retention-run"
7378
+ ]);
7379
+ /** Why the operation ran. */
7380
+ var OpsLogReasonSchema = _enum([
7381
+ "retention",
7382
+ "quota",
7383
+ "manual",
7384
+ "operator"
7385
+ ]);
7386
+ /** One audit row, shared verbatim by both domains. */
7387
+ var OpsLogEntrySchema = object({
7388
+ /** Unique row id. */
7389
+ id: string(),
7390
+ /** Epoch ms the operation completed. */
7391
+ at: number(),
7392
+ domain: OpsLogDomainSchema,
7393
+ op: OpsLogOpSchema,
7394
+ reason: OpsLogReasonSchema,
7395
+ /** The camera the op targeted; null for a cluster/global op. */
7396
+ deviceId: number().nullable(),
7397
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7398
+ nodeId: string(),
7399
+ /** Buckets / rows deleted (op-specific unit). */
7400
+ itemsAffected: number(),
7401
+ /** Bytes reclaimed by the op (0 when not measurable). */
7402
+ bytesReclaimed: number(),
7403
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7404
+ detail: string().nullable(),
7405
+ /** Who/what triggered the op. */
7406
+ actor: string()
7407
+ });
7408
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7409
+ var OpsLogQueryInputSchema = object({
7410
+ /** Restrict to a single camera; omit for every row. */
7411
+ deviceId: number().optional(),
7412
+ /** Max rows returned, newest-first. */
7413
+ limit: number().int().min(1).max(1e3).optional()
7414
+ });
7415
+ /**
7360
7416
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7361
7417
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7362
7418
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7600,6 +7656,160 @@ var EncodeProfileSchema = object({
7600
7656
  */
7601
7657
  outputArgs: array(string()).optional()
7602
7658
  });
7659
+ var COCO_TO_MACRO = {
7660
+ mapping: {
7661
+ person: "person",
7662
+ bicycle: "vehicle",
7663
+ car: "vehicle",
7664
+ motorcycle: "vehicle",
7665
+ airplane: "vehicle",
7666
+ bus: "vehicle",
7667
+ train: "vehicle",
7668
+ truck: "vehicle",
7669
+ boat: "vehicle",
7670
+ bird: "animal",
7671
+ cat: "animal",
7672
+ dog: "animal",
7673
+ horse: "animal",
7674
+ sheep: "animal",
7675
+ cow: "animal",
7676
+ elephant: "animal",
7677
+ bear: "animal",
7678
+ zebra: "animal",
7679
+ giraffe: "animal",
7680
+ suitcase: "package",
7681
+ backpack: "package",
7682
+ handbag: "package"
7683
+ },
7684
+ preserveOriginal: false
7685
+ };
7686
+ var AUDIO_MACRO_LABELS = [
7687
+ {
7688
+ id: "speech",
7689
+ name: "Speech",
7690
+ icon: "🗣️"
7691
+ },
7692
+ {
7693
+ id: "scream",
7694
+ name: "Scream / Shout",
7695
+ icon: "😱"
7696
+ },
7697
+ {
7698
+ id: "crying",
7699
+ name: "Crying / Baby",
7700
+ icon: "😢"
7701
+ },
7702
+ {
7703
+ id: "laughter",
7704
+ name: "Laughter",
7705
+ icon: "😂"
7706
+ },
7707
+ {
7708
+ id: "music",
7709
+ name: "Music",
7710
+ icon: "🎵"
7711
+ },
7712
+ {
7713
+ id: "dog",
7714
+ name: "Dog",
7715
+ icon: "🐕"
7716
+ },
7717
+ {
7718
+ id: "cat",
7719
+ name: "Cat",
7720
+ icon: "🐈"
7721
+ },
7722
+ {
7723
+ id: "bird",
7724
+ name: "Bird",
7725
+ icon: "🐦"
7726
+ },
7727
+ {
7728
+ id: "animal",
7729
+ name: "Animal (other)",
7730
+ icon: "🐾"
7731
+ },
7732
+ {
7733
+ id: "alarm",
7734
+ name: "Alarm / Siren",
7735
+ icon: "🚨"
7736
+ },
7737
+ {
7738
+ id: "doorbell",
7739
+ name: "Doorbell / Knock",
7740
+ icon: "🔔"
7741
+ },
7742
+ {
7743
+ id: "glass_breaking",
7744
+ name: "Glass Breaking",
7745
+ icon: "💥"
7746
+ },
7747
+ {
7748
+ id: "gunshot",
7749
+ name: "Gunshot / Explosion",
7750
+ icon: "💣"
7751
+ },
7752
+ {
7753
+ id: "vehicle",
7754
+ name: "Vehicle",
7755
+ icon: "🚗"
7756
+ },
7757
+ {
7758
+ id: "siren",
7759
+ name: "Emergency Siren",
7760
+ icon: "🚑"
7761
+ },
7762
+ {
7763
+ id: "fire",
7764
+ name: "Fire / Smoke",
7765
+ icon: "🔥"
7766
+ },
7767
+ {
7768
+ id: "water",
7769
+ name: "Water",
7770
+ icon: "💧"
7771
+ },
7772
+ {
7773
+ id: "wind",
7774
+ name: "Wind / Weather",
7775
+ icon: "🌬️"
7776
+ },
7777
+ {
7778
+ id: "door",
7779
+ name: "Door",
7780
+ icon: "🚪"
7781
+ },
7782
+ {
7783
+ id: "footsteps",
7784
+ name: "Footsteps",
7785
+ icon: "👣"
7786
+ },
7787
+ {
7788
+ id: "crowd",
7789
+ name: "Crowd / Chatter",
7790
+ icon: "👥"
7791
+ },
7792
+ {
7793
+ id: "telephone",
7794
+ name: "Telephone",
7795
+ icon: "📞"
7796
+ },
7797
+ {
7798
+ id: "engine",
7799
+ name: "Engine / Motor",
7800
+ icon: "⚙️"
7801
+ },
7802
+ {
7803
+ id: "tools",
7804
+ name: "Tools / Construction",
7805
+ icon: "🔨"
7806
+ },
7807
+ {
7808
+ id: "silence",
7809
+ name: "Silence",
7810
+ icon: "🤫"
7811
+ }
7812
+ ];
7603
7813
  var YAMNET_TO_MACRO = {
7604
7814
  mapping: {
7605
7815
  Speech: "speech",
@@ -7866,6 +8076,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7866
8076
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7867
8077
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7868
8078
  /**
8079
+ * Unified event-kind taxonomy — THE single source of truth for
8080
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8081
+ * icon }`.
8082
+ *
8083
+ * This dictionary folds together what used to be scattered across four
8084
+ * copies:
8085
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8086
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8087
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8088
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8089
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8090
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8091
+ *
8092
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8093
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8094
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8095
+ * color or an icon: they read this dictionary (server descriptors carry the
8096
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8097
+ *
8098
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8099
+ */
8100
+ var TAXONOMY_COLORS = {
8101
+ motion: "#f59e0b",
8102
+ audio: "#06b6d4",
8103
+ person: "#22c55e",
8104
+ vehicle: "#3b82f6",
8105
+ animal: "#f97316",
8106
+ package: "#a855f7",
8107
+ sensor: "#8b5cf6",
8108
+ control: "#10b981",
8109
+ genericDetection: "#64748b"
8110
+ };
8111
+ var DETECTION_SUB_COLORS = {
8112
+ car: "#f59e0b",
8113
+ truck: "#d97706",
8114
+ bus: "#b45309",
8115
+ motorcycle: "#eab308",
8116
+ bicycle: "#ca8a04",
8117
+ airplane: "#60a5fa",
8118
+ boat: "#2563eb",
8119
+ train: "#1d4ed8",
8120
+ bird: "#14b8a6",
8121
+ dog: "#84cc16",
8122
+ cat: "#f97316",
8123
+ horse: "#a16207",
8124
+ sheep: "#a3a3a3",
8125
+ cow: "#78716c",
8126
+ elephant: "#6b7280",
8127
+ bear: "#7c2d12",
8128
+ zebra: "#404040",
8129
+ giraffe: "#d4a373"
8130
+ };
8131
+ function titleCase(id) {
8132
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8133
+ }
8134
+ var entries = /* @__PURE__ */ new Map();
8135
+ function macro(kind, category, color, iconId, label) {
8136
+ entries.set(kind, {
8137
+ kind,
8138
+ parentKind: null,
8139
+ level: "macro",
8140
+ category,
8141
+ color,
8142
+ iconId,
8143
+ labelKey: `eventKind.${kind}`,
8144
+ label
8145
+ });
8146
+ }
8147
+ function sub(kind, parentKind, category, color, iconId, label) {
8148
+ entries.set(kind, {
8149
+ kind,
8150
+ parentKind,
8151
+ level: "sub",
8152
+ category,
8153
+ color,
8154
+ iconId,
8155
+ labelKey: `eventKind.${kind}`,
8156
+ label
8157
+ });
8158
+ }
8159
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8160
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8161
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8162
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8163
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8164
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8165
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8166
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8167
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8168
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8169
+ if (entries.has(cocoClass)) continue;
8170
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8171
+ }
8172
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8173
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8174
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8175
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8176
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8177
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8178
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8179
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8180
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8181
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8182
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8183
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8184
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8185
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8186
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8187
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8188
+ sub("button", "control", "control", "#10b981", "button", "Button");
8189
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8190
+ for (const l of AUDIO_MACRO_LABELS) {
8191
+ const kind = `audio-${l.id}`;
8192
+ if (entries.has(kind)) continue;
8193
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8194
+ }
8195
+ /** The complete taxonomy dictionary, keyed by kind. */
8196
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8197
+ /**
7869
8198
  * Error types for the safe expression engine. Two distinct classes so callers
7870
8199
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7871
8200
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -14820,9 +15149,10 @@ var DEVICE_LOCAL_STATE_CAPS = {
14820
15149
  * `package` backs the package-drop detector — a package zone is a
14821
15150
  * `ZoneRule` on the `'package'` stage referencing drawn polygons
14822
15151
  * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14823
- * The orchestrator provider that writes this stage lands in a later
14824
- * slice; until then the mirror carries only `{motion, detection}` and
14825
- * consumers read `package` as absent (treat as `[]`).
15152
+ * The orchestrator provider writes this stage as a first-class slice
15153
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
15154
+ * package}` shape, so consumers read the current package rules directly
15155
+ * off `device.state.zoneRules.value.package`.
14826
15156
  */
14827
15157
  runtimeState: object({
14828
15158
  motion: array(ZoneRuleSchema).readonly(),
@@ -18797,17 +19127,30 @@ var EventKindCategorySchema = _enum([
18797
19127
  "audio",
18798
19128
  "detection",
18799
19129
  "sensor",
19130
+ "control",
18800
19131
  "custom",
18801
19132
  "package"
18802
19133
  ]);
19134
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19135
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18803
19136
  var EventKindDescriptorSchema = object({
18804
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19137
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18805
19138
  kind: string(),
19139
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19140
+ labelKey: string(),
19141
+ /** English fallback label (kept for clients that don't translate). */
18806
19142
  label: string(),
18807
19143
  /** Hex color for timeline/legend rendering. */
18808
19144
  color: string(),
19145
+ /** Dictionary id → lucide component on the UI side. */
19146
+ iconId: string(),
19147
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18809
19148
  icon: EventKindIconSchema,
18810
19149
  category: EventKindCategorySchema,
19150
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19151
+ parentKind: string().nullable(),
19152
+ /** Derived from `parentKind`, explicit for the client tree. */
19153
+ level: EventKindLevelSchema,
18811
19154
  /** Which cap + device contributes this kind. For built-ins the camera
18812
19155
  * itself; for sensor kinds the LINKED source device. */
18813
19156
  source: object({
@@ -18880,11 +19223,21 @@ var TrackAudioLabelSchema = object({
18880
19223
  firstAt: number(),
18881
19224
  lastAt: number()
18882
19225
  });
19226
+ /**
19227
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19228
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19229
+ * linked sensor/control state change (no positions; carries a snapshot). The
19230
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19231
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19232
+ */
19233
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18883
19234
  var TrackSchema = object({
18884
19235
  trackId: string(),
18885
19236
  deviceId: number(),
18886
19237
  className: string(),
18887
19238
  label: string().optional(),
19239
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19240
+ source: TrackSourceSchema.optional(),
18888
19241
  firstSeen: number(),
18889
19242
  lastSeen: number(),
18890
19243
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19139,6 +19492,26 @@ var TrackCascadeCountsSchema = object({
19139
19492
  /** Per-track CLIP search vectors removed (best-effort). */
19140
19493
  embeddings: number().int()
19141
19494
  });
19495
+ /** Event-store footprint for one camera. */
19496
+ var EventStoreDeviceFootprintSchema = object({
19497
+ deviceId: number(),
19498
+ /** Persisted event rows (motion + object + audio) for the camera. */
19499
+ rows: number().int(),
19500
+ /** Event-owned media bytes on disk for the camera. */
19501
+ bytes: number().int()
19502
+ });
19503
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19504
+ var EventStoreFootprintSchema = object({
19505
+ totalRows: number().int(),
19506
+ totalBytes: number().int(),
19507
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19508
+ });
19509
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19510
+ var EventPruneCountsSchema = object({
19511
+ motion: number().int(),
19512
+ object: number().int(),
19513
+ audio: number().int()
19514
+ });
19142
19515
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19143
19516
  deviceId: number(),
19144
19517
  trackId: string()
@@ -19202,6 +19575,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19202
19575
  }), {
19203
19576
  kind: "mutation",
19204
19577
  auth: "admin"
19578
+ }), method(object({}), EventStoreFootprintSchema, {
19579
+ kind: "query",
19580
+ auth: "admin"
19581
+ }), method(object({
19582
+ olderThanMs: number(),
19583
+ reason: OpsLogReasonSchema.optional()
19584
+ }), EventPruneCountsSchema, {
19585
+ kind: "mutation",
19586
+ auth: "admin"
19587
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19588
+ kind: "mutation",
19589
+ auth: "admin"
19590
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19591
+ kind: "query",
19592
+ auth: "admin"
19205
19593
  }), method(object({
19206
19594
  eventId: string(),
19207
19595
  kind: MediaFileKindEnum.optional()
@@ -19226,6 +19614,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19226
19614
  eventId: string(),
19227
19615
  timestamp: number()
19228
19616
  });
19617
+ /**
19618
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19619
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19620
+ * caps into per-camera event-kind descriptors.
19621
+ *
19622
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19623
+ * is NOT duplicated here — every entry is derived from the single
19624
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19625
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19626
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19627
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19628
+ * eventful cap is missing.
19629
+ */
19630
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19631
+ var LEGACY_ICON = {
19632
+ motion: "motion",
19633
+ audio: "audio",
19634
+ person: "person",
19635
+ vehicle: "vehicle",
19636
+ animal: "animal",
19637
+ package: "package",
19638
+ door: "door",
19639
+ pir: "pir",
19640
+ smoke: "smoke",
19641
+ water: "water",
19642
+ button: "button",
19643
+ generic: "generic",
19644
+ gas: "smoke",
19645
+ vibration: "generic",
19646
+ tamper: "generic",
19647
+ presence: "person",
19648
+ lock: "generic",
19649
+ siren: "generic",
19650
+ switch: "generic",
19651
+ doorbell: "button"
19652
+ };
19653
+ function legacyIcon(iconId) {
19654
+ return LEGACY_ICON[iconId] ?? "generic";
19655
+ }
19656
+ /**
19657
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19658
+ * The anti-drift guard cross-checks this against the eventful caps declared
19659
+ * in `packages/types/src/capabilities/*.cap.ts`.
19660
+ */
19661
+ var CAP_TO_KIND = {
19662
+ contact: "contact",
19663
+ motion: "motion-sensor",
19664
+ smoke: "smoke",
19665
+ flood: "flood",
19666
+ gas: "gas",
19667
+ "carbon-monoxide": "carbon-monoxide",
19668
+ vibration: "vibration",
19669
+ tamper: "tamper",
19670
+ presence: "presence",
19671
+ "enum-sensor": "enum-sensor",
19672
+ "event-emitter": "device-event",
19673
+ "lock-control": "lock",
19674
+ switch: "switch",
19675
+ button: "button",
19676
+ doorbell: "doorbell"
19677
+ };
19678
+ function buildDescriptor(capName, kind) {
19679
+ const t = EVENT_TAXONOMY[kind];
19680
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19681
+ return {
19682
+ ...t,
19683
+ icon: legacyIcon(t.iconId)
19684
+ };
19685
+ }
19686
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19229
19687
  var CameraPipelineConfigSchema = object({
19230
19688
  engine: PipelineEngineChoiceSchema.optional(),
19231
19689
  steps: array(PipelineStepInputSchema).readonly(),
@@ -22452,13 +22910,29 @@ method(object({
22452
22910
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22453
22911
  kind: "mutation",
22454
22912
  auth: "admin"
22455
- }), method(object({ deviceId: number() }), object({
22913
+ }), method(object({
22914
+ deviceId: number(),
22915
+ reason: OpsLogReasonSchema.optional()
22916
+ }), object({
22456
22917
  floorMs: number().nullable(),
22457
22918
  deletedBuckets: number().int(),
22458
22919
  reclaimedBytes: number().int()
22459
22920
  }), {
22460
22921
  kind: "mutation",
22461
22922
  auth: "admin"
22923
+ }), method(object({
22924
+ deviceId: number(),
22925
+ fromMs: number().optional(),
22926
+ toMs: number().optional()
22927
+ }), object({
22928
+ deletedBuckets: number().int(),
22929
+ reclaimedBytes: number().int()
22930
+ }), {
22931
+ kind: "mutation",
22932
+ auth: "admin"
22933
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
22934
+ kind: "query",
22935
+ auth: "admin"
22462
22936
  });
22463
22937
  /**
22464
22938
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -25580,6 +26054,12 @@ Object.freeze({
25580
26054
  addonId: null,
25581
26055
  access: "delete"
25582
26056
  },
26057
+ "pipelineAnalytics.deleteDeviceEvents": {
26058
+ capName: "pipeline-analytics",
26059
+ capScope: "device",
26060
+ addonId: null,
26061
+ access: "delete"
26062
+ },
25583
26063
  "pipelineAnalytics.deleteTracks": {
25584
26064
  capName: "pipeline-analytics",
25585
26065
  capScope: "device",
@@ -25610,6 +26090,12 @@ Object.freeze({
25610
26090
  addonId: null,
25611
26091
  access: "view"
25612
26092
  },
26093
+ "pipelineAnalytics.getEventStoreFootprint": {
26094
+ capName: "pipeline-analytics",
26095
+ capScope: "device",
26096
+ addonId: null,
26097
+ access: "view"
26098
+ },
25613
26099
  "pipelineAnalytics.getKeyEvents": {
25614
26100
  capName: "pipeline-analytics",
25615
26101
  capScope: "device",
@@ -25652,6 +26138,12 @@ Object.freeze({
25652
26138
  addonId: null,
25653
26139
  access: "view"
25654
26140
  },
26141
+ "pipelineAnalytics.listOpsLog": {
26142
+ capName: "pipeline-analytics",
26143
+ capScope: "device",
26144
+ addonId: null,
26145
+ access: "view"
26146
+ },
25655
26147
  "pipelineAnalytics.listRecentTracks": {
25656
26148
  capName: "pipeline-analytics",
25657
26149
  capScope: "device",
@@ -25664,6 +26156,12 @@ Object.freeze({
25664
26156
  addonId: null,
25665
26157
  access: "view"
25666
26158
  },
26159
+ "pipelineAnalytics.pruneEvents": {
26160
+ capName: "pipeline-analytics",
26161
+ capScope: "device",
26162
+ addonId: null,
26163
+ access: "create"
26164
+ },
25667
26165
  "pipelineAnalytics.pruneEventsBefore": {
25668
26166
  capName: "pipeline-analytics",
25669
26167
  capScope: "device",
@@ -26426,6 +26924,12 @@ Object.freeze({
26426
26924
  addonId: null,
26427
26925
  access: "create"
26428
26926
  },
26927
+ "recording.deleteFootprint": {
26928
+ capName: "recording",
26929
+ capScope: "system",
26930
+ addonId: null,
26931
+ access: "delete"
26932
+ },
26429
26933
  "recording.getAvailability": {
26430
26934
  capName: "recording",
26431
26935
  capScope: "system",
@@ -26456,6 +26960,12 @@ Object.freeze({
26456
26960
  addonId: null,
26457
26961
  access: "view"
26458
26962
  },
26963
+ "recording.listOpsLog": {
26964
+ capName: "recording",
26965
+ capScope: "system",
26966
+ addonId: null,
26967
+ access: "view"
26968
+ },
26459
26969
  "recording.locateSegment": {
26460
26970
  capName: "recording",
26461
26971
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-unraid",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Unraid device-provider addon for CamStack — one Container per Unraid instance fanning out array, disk, docker and notification entities",
5
5
  "keywords": [
6
6
  "camstack",