@camstack/addon-remote-storage 1.1.27 → 1.1.29

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/s3.addon.js CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-ChSRaxCw.js");
5
+ const require_shared = require("./shared-CZDYRlzo.js");
6
6
  let node_stream = require("node:stream");
7
7
  let _aws_sdk_client_s3 = require("@aws-sdk/client-s3");
8
8
  let _aws_sdk_lib_storage = require("@aws-sdk/lib-storage");
package/dist/s3.addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as BaseAddon, i as rearmIdleAbort, n as getOptionalBasePath, o as scheduleIdleAbort, s as storageProviderCapability, t as createSessionId } from "./shared-fXbGPtd5.mjs";
1
+ import { c as BaseAddon, i as rearmIdleAbort, n as getOptionalBasePath, o as scheduleIdleAbort, s as storageProviderCapability, t as createSessionId } from "./shared-DW5ccoQG.mjs";
2
2
  import { PassThrough } from "node:stream";
3
3
  import { DeleteObjectCommand, GetObjectCommand, HeadBucketCommand, HeadObjectCommand, ListObjectsV2Command, PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
4
4
  import { Upload } from "@aws-sdk/lib-storage";
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-ChSRaxCw.js");
5
+ const require_shared = require("./shared-CZDYRlzo.js");
6
6
  let ssh2 = require("ssh2");
7
7
  let node_path = require("node:path");
8
8
  node_path = require_shared.__toESM(node_path);
@@ -1,4 +1,4 @@
1
- import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-fXbGPtd5.mjs";
1
+ import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-DW5ccoQG.mjs";
2
2
  import { Client } from "ssh2";
3
3
  import * as path from "node:path";
4
4
  //#region src/providers/sftp/sftp-config-schema.ts
@@ -7352,6 +7352,62 @@ var RecordingConfigSchema = object({
7352
7352
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7353
7353
  });
7354
7354
  /**
7355
+ * Ops-log — the durable, append-only operations audit shared by the
7356
+ * recordings and events management surfaces.
7357
+ *
7358
+ * ONE row shape is reused for both domains so a single "Activity" view can
7359
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7360
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7361
+ * management operation, WHY it ran (reason), and its measurable effect
7362
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7363
+ * never fail the operation it records.
7364
+ */
7365
+ /** Which management domain the operation belongs to. */
7366
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7367
+ /** The kind of management operation performed. */
7368
+ var OpsLogOpSchema = _enum([
7369
+ "prune",
7370
+ "manual-delete",
7371
+ "rescan",
7372
+ "retention-run"
7373
+ ]);
7374
+ /** Why the operation ran. */
7375
+ var OpsLogReasonSchema = _enum([
7376
+ "retention",
7377
+ "quota",
7378
+ "manual",
7379
+ "operator"
7380
+ ]);
7381
+ /** One audit row, shared verbatim by both domains. */
7382
+ var OpsLogEntrySchema = object({
7383
+ /** Unique row id. */
7384
+ id: string(),
7385
+ /** Epoch ms the operation completed. */
7386
+ at: number(),
7387
+ domain: OpsLogDomainSchema,
7388
+ op: OpsLogOpSchema,
7389
+ reason: OpsLogReasonSchema,
7390
+ /** The camera the op targeted; null for a cluster/global op. */
7391
+ deviceId: number().nullable(),
7392
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7393
+ nodeId: string(),
7394
+ /** Buckets / rows deleted (op-specific unit). */
7395
+ itemsAffected: number(),
7396
+ /** Bytes reclaimed by the op (0 when not measurable). */
7397
+ bytesReclaimed: number(),
7398
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7399
+ detail: string().nullable(),
7400
+ /** Who/what triggered the op. */
7401
+ actor: string()
7402
+ });
7403
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7404
+ var OpsLogQueryInputSchema = object({
7405
+ /** Restrict to a single camera; omit for every row. */
7406
+ deviceId: number().optional(),
7407
+ /** Max rows returned, newest-first. */
7408
+ limit: number().int().min(1).max(1e3).optional()
7409
+ });
7410
+ /**
7355
7411
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7356
7412
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7357
7413
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7595,6 +7651,160 @@ var EncodeProfileSchema = object({
7595
7651
  */
7596
7652
  outputArgs: array(string()).optional()
7597
7653
  });
7654
+ var COCO_TO_MACRO = {
7655
+ mapping: {
7656
+ person: "person",
7657
+ bicycle: "vehicle",
7658
+ car: "vehicle",
7659
+ motorcycle: "vehicle",
7660
+ airplane: "vehicle",
7661
+ bus: "vehicle",
7662
+ train: "vehicle",
7663
+ truck: "vehicle",
7664
+ boat: "vehicle",
7665
+ bird: "animal",
7666
+ cat: "animal",
7667
+ dog: "animal",
7668
+ horse: "animal",
7669
+ sheep: "animal",
7670
+ cow: "animal",
7671
+ elephant: "animal",
7672
+ bear: "animal",
7673
+ zebra: "animal",
7674
+ giraffe: "animal",
7675
+ suitcase: "package",
7676
+ backpack: "package",
7677
+ handbag: "package"
7678
+ },
7679
+ preserveOriginal: false
7680
+ };
7681
+ var AUDIO_MACRO_LABELS = [
7682
+ {
7683
+ id: "speech",
7684
+ name: "Speech",
7685
+ icon: "🗣️"
7686
+ },
7687
+ {
7688
+ id: "scream",
7689
+ name: "Scream / Shout",
7690
+ icon: "😱"
7691
+ },
7692
+ {
7693
+ id: "crying",
7694
+ name: "Crying / Baby",
7695
+ icon: "😢"
7696
+ },
7697
+ {
7698
+ id: "laughter",
7699
+ name: "Laughter",
7700
+ icon: "😂"
7701
+ },
7702
+ {
7703
+ id: "music",
7704
+ name: "Music",
7705
+ icon: "🎵"
7706
+ },
7707
+ {
7708
+ id: "dog",
7709
+ name: "Dog",
7710
+ icon: "🐕"
7711
+ },
7712
+ {
7713
+ id: "cat",
7714
+ name: "Cat",
7715
+ icon: "🐈"
7716
+ },
7717
+ {
7718
+ id: "bird",
7719
+ name: "Bird",
7720
+ icon: "🐦"
7721
+ },
7722
+ {
7723
+ id: "animal",
7724
+ name: "Animal (other)",
7725
+ icon: "🐾"
7726
+ },
7727
+ {
7728
+ id: "alarm",
7729
+ name: "Alarm / Siren",
7730
+ icon: "🚨"
7731
+ },
7732
+ {
7733
+ id: "doorbell",
7734
+ name: "Doorbell / Knock",
7735
+ icon: "🔔"
7736
+ },
7737
+ {
7738
+ id: "glass_breaking",
7739
+ name: "Glass Breaking",
7740
+ icon: "💥"
7741
+ },
7742
+ {
7743
+ id: "gunshot",
7744
+ name: "Gunshot / Explosion",
7745
+ icon: "💣"
7746
+ },
7747
+ {
7748
+ id: "vehicle",
7749
+ name: "Vehicle",
7750
+ icon: "🚗"
7751
+ },
7752
+ {
7753
+ id: "siren",
7754
+ name: "Emergency Siren",
7755
+ icon: "🚑"
7756
+ },
7757
+ {
7758
+ id: "fire",
7759
+ name: "Fire / Smoke",
7760
+ icon: "🔥"
7761
+ },
7762
+ {
7763
+ id: "water",
7764
+ name: "Water",
7765
+ icon: "💧"
7766
+ },
7767
+ {
7768
+ id: "wind",
7769
+ name: "Wind / Weather",
7770
+ icon: "🌬️"
7771
+ },
7772
+ {
7773
+ id: "door",
7774
+ name: "Door",
7775
+ icon: "🚪"
7776
+ },
7777
+ {
7778
+ id: "footsteps",
7779
+ name: "Footsteps",
7780
+ icon: "👣"
7781
+ },
7782
+ {
7783
+ id: "crowd",
7784
+ name: "Crowd / Chatter",
7785
+ icon: "👥"
7786
+ },
7787
+ {
7788
+ id: "telephone",
7789
+ name: "Telephone",
7790
+ icon: "📞"
7791
+ },
7792
+ {
7793
+ id: "engine",
7794
+ name: "Engine / Motor",
7795
+ icon: "⚙️"
7796
+ },
7797
+ {
7798
+ id: "tools",
7799
+ name: "Tools / Construction",
7800
+ icon: "🔨"
7801
+ },
7802
+ {
7803
+ id: "silence",
7804
+ name: "Silence",
7805
+ icon: "🤫"
7806
+ }
7807
+ ];
7598
7808
  var YAMNET_TO_MACRO = {
7599
7809
  mapping: {
7600
7810
  Speech: "speech",
@@ -7861,6 +8071,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7861
8071
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7862
8072
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7863
8073
  /**
8074
+ * Unified event-kind taxonomy — THE single source of truth for
8075
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8076
+ * icon }`.
8077
+ *
8078
+ * This dictionary folds together what used to be scattered across four
8079
+ * copies:
8080
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8081
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8082
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8083
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8084
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8085
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8086
+ *
8087
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8088
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8089
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8090
+ * color or an icon: they read this dictionary (server descriptors carry the
8091
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8092
+ *
8093
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8094
+ */
8095
+ var TAXONOMY_COLORS = {
8096
+ motion: "#f59e0b",
8097
+ audio: "#06b6d4",
8098
+ person: "#22c55e",
8099
+ vehicle: "#3b82f6",
8100
+ animal: "#f97316",
8101
+ package: "#a855f7",
8102
+ sensor: "#8b5cf6",
8103
+ control: "#10b981",
8104
+ genericDetection: "#64748b"
8105
+ };
8106
+ var DETECTION_SUB_COLORS = {
8107
+ car: "#f59e0b",
8108
+ truck: "#d97706",
8109
+ bus: "#b45309",
8110
+ motorcycle: "#eab308",
8111
+ bicycle: "#ca8a04",
8112
+ airplane: "#60a5fa",
8113
+ boat: "#2563eb",
8114
+ train: "#1d4ed8",
8115
+ bird: "#14b8a6",
8116
+ dog: "#84cc16",
8117
+ cat: "#f97316",
8118
+ horse: "#a16207",
8119
+ sheep: "#a3a3a3",
8120
+ cow: "#78716c",
8121
+ elephant: "#6b7280",
8122
+ bear: "#7c2d12",
8123
+ zebra: "#404040",
8124
+ giraffe: "#d4a373"
8125
+ };
8126
+ function titleCase(id) {
8127
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8128
+ }
8129
+ var entries = /* @__PURE__ */ new Map();
8130
+ function macro(kind, category, color, iconId, label) {
8131
+ entries.set(kind, {
8132
+ kind,
8133
+ parentKind: null,
8134
+ level: "macro",
8135
+ category,
8136
+ color,
8137
+ iconId,
8138
+ labelKey: `eventKind.${kind}`,
8139
+ label
8140
+ });
8141
+ }
8142
+ function sub(kind, parentKind, category, color, iconId, label) {
8143
+ entries.set(kind, {
8144
+ kind,
8145
+ parentKind,
8146
+ level: "sub",
8147
+ category,
8148
+ color,
8149
+ iconId,
8150
+ labelKey: `eventKind.${kind}`,
8151
+ label
8152
+ });
8153
+ }
8154
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8155
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8156
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8157
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8158
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8159
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8160
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8161
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8162
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8163
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8164
+ if (entries.has(cocoClass)) continue;
8165
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8166
+ }
8167
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8168
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8169
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8170
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8171
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8172
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8173
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8174
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8175
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8176
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8177
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8178
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8179
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8180
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8181
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8182
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8183
+ sub("button", "control", "control", "#10b981", "button", "Button");
8184
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8185
+ for (const l of AUDIO_MACRO_LABELS) {
8186
+ const kind = `audio-${l.id}`;
8187
+ if (entries.has(kind)) continue;
8188
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8189
+ }
8190
+ /** The complete taxonomy dictionary, keyed by kind. */
8191
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8192
+ /**
7864
8193
  * Error types for the safe expression engine. Two distinct classes so callers
7865
8194
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7866
8195
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -15810,17 +16139,30 @@ var EventKindCategorySchema = _enum([
15810
16139
  "audio",
15811
16140
  "detection",
15812
16141
  "sensor",
16142
+ "control",
15813
16143
  "custom",
15814
16144
  "package"
15815
16145
  ]);
16146
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16147
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15816
16148
  var EventKindDescriptorSchema = object({
15817
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16149
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15818
16150
  kind: string(),
16151
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16152
+ labelKey: string(),
16153
+ /** English fallback label (kept for clients that don't translate). */
15819
16154
  label: string(),
15820
16155
  /** Hex color for timeline/legend rendering. */
15821
16156
  color: string(),
16157
+ /** Dictionary id → lucide component on the UI side. */
16158
+ iconId: string(),
16159
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15822
16160
  icon: EventKindIconSchema,
15823
16161
  category: EventKindCategorySchema,
16162
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16163
+ parentKind: string().nullable(),
16164
+ /** Derived from `parentKind`, explicit for the client tree. */
16165
+ level: EventKindLevelSchema,
15824
16166
  /** Which cap + device contributes this kind. For built-ins the camera
15825
16167
  * itself; for sensor kinds the LINKED source device. */
15826
16168
  source: object({
@@ -15893,11 +16235,21 @@ var TrackAudioLabelSchema = object({
15893
16235
  firstAt: number(),
15894
16236
  lastAt: number()
15895
16237
  });
16238
+ /**
16239
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16240
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16241
+ * linked sensor/control state change (no positions; carries a snapshot). The
16242
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16243
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16244
+ */
16245
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
15896
16246
  var TrackSchema = object({
15897
16247
  trackId: string(),
15898
16248
  deviceId: number(),
15899
16249
  className: string(),
15900
16250
  label: string().optional(),
16251
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16252
+ source: TrackSourceSchema.optional(),
15901
16253
  firstSeen: number(),
15902
16254
  lastSeen: number(),
15903
16255
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16152,6 +16504,26 @@ var TrackCascadeCountsSchema = object({
16152
16504
  /** Per-track CLIP search vectors removed (best-effort). */
16153
16505
  embeddings: number().int()
16154
16506
  });
16507
+ /** Event-store footprint for one camera. */
16508
+ var EventStoreDeviceFootprintSchema = object({
16509
+ deviceId: number(),
16510
+ /** Persisted event rows (motion + object + audio) for the camera. */
16511
+ rows: number().int(),
16512
+ /** Event-owned media bytes on disk for the camera. */
16513
+ bytes: number().int()
16514
+ });
16515
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
16516
+ var EventStoreFootprintSchema = object({
16517
+ totalRows: number().int(),
16518
+ totalBytes: number().int(),
16519
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
16520
+ });
16521
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
16522
+ var EventPruneCountsSchema = object({
16523
+ motion: number().int(),
16524
+ object: number().int(),
16525
+ audio: number().int()
16526
+ });
16155
16527
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
16156
16528
  deviceId: number(),
16157
16529
  trackId: string()
@@ -16215,6 +16587,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16215
16587
  }), {
16216
16588
  kind: "mutation",
16217
16589
  auth: "admin"
16590
+ }), method(object({}), EventStoreFootprintSchema, {
16591
+ kind: "query",
16592
+ auth: "admin"
16593
+ }), method(object({
16594
+ olderThanMs: number(),
16595
+ reason: OpsLogReasonSchema.optional()
16596
+ }), EventPruneCountsSchema, {
16597
+ kind: "mutation",
16598
+ auth: "admin"
16599
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
16600
+ kind: "mutation",
16601
+ auth: "admin"
16602
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
16603
+ kind: "query",
16604
+ auth: "admin"
16218
16605
  }), method(object({
16219
16606
  eventId: string(),
16220
16607
  kind: MediaFileKindEnum.optional()
@@ -16239,6 +16626,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16239
16626
  eventId: string(),
16240
16627
  timestamp: number()
16241
16628
  });
16629
+ /**
16630
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16631
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16632
+ * caps into per-camera event-kind descriptors.
16633
+ *
16634
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16635
+ * is NOT duplicated here — every entry is derived from the single
16636
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16637
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16638
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16639
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16640
+ * eventful cap is missing.
16641
+ */
16642
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16643
+ var LEGACY_ICON = {
16644
+ motion: "motion",
16645
+ audio: "audio",
16646
+ person: "person",
16647
+ vehicle: "vehicle",
16648
+ animal: "animal",
16649
+ package: "package",
16650
+ door: "door",
16651
+ pir: "pir",
16652
+ smoke: "smoke",
16653
+ water: "water",
16654
+ button: "button",
16655
+ generic: "generic",
16656
+ gas: "smoke",
16657
+ vibration: "generic",
16658
+ tamper: "generic",
16659
+ presence: "person",
16660
+ lock: "generic",
16661
+ siren: "generic",
16662
+ switch: "generic",
16663
+ doorbell: "button"
16664
+ };
16665
+ function legacyIcon(iconId) {
16666
+ return LEGACY_ICON[iconId] ?? "generic";
16667
+ }
16668
+ /**
16669
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16670
+ * The anti-drift guard cross-checks this against the eventful caps declared
16671
+ * in `packages/types/src/capabilities/*.cap.ts`.
16672
+ */
16673
+ var CAP_TO_KIND = {
16674
+ contact: "contact",
16675
+ motion: "motion-sensor",
16676
+ smoke: "smoke",
16677
+ flood: "flood",
16678
+ gas: "gas",
16679
+ "carbon-monoxide": "carbon-monoxide",
16680
+ vibration: "vibration",
16681
+ tamper: "tamper",
16682
+ presence: "presence",
16683
+ "enum-sensor": "enum-sensor",
16684
+ "event-emitter": "device-event",
16685
+ "lock-control": "lock",
16686
+ switch: "switch",
16687
+ button: "button",
16688
+ doorbell: "doorbell"
16689
+ };
16690
+ function buildDescriptor(capName, kind) {
16691
+ const t = EVENT_TAXONOMY[kind];
16692
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16693
+ return {
16694
+ ...t,
16695
+ icon: legacyIcon(t.iconId)
16696
+ };
16697
+ }
16698
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16242
16699
  var CameraPipelineConfigSchema = object({
16243
16700
  engine: PipelineEngineChoiceSchema.optional(),
16244
16701
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19493,13 +19950,29 @@ method(object({
19493
19950
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
19494
19951
  kind: "mutation",
19495
19952
  auth: "admin"
19496
- }), method(object({ deviceId: number() }), object({
19953
+ }), method(object({
19954
+ deviceId: number(),
19955
+ reason: OpsLogReasonSchema.optional()
19956
+ }), object({
19497
19957
  floorMs: number().nullable(),
19498
19958
  deletedBuckets: number().int(),
19499
19959
  reclaimedBytes: number().int()
19500
19960
  }), {
19501
19961
  kind: "mutation",
19502
19962
  auth: "admin"
19963
+ }), method(object({
19964
+ deviceId: number(),
19965
+ fromMs: number().optional(),
19966
+ toMs: number().optional()
19967
+ }), object({
19968
+ deletedBuckets: number().int(),
19969
+ reclaimedBytes: number().int()
19970
+ }), {
19971
+ kind: "mutation",
19972
+ auth: "admin"
19973
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19974
+ kind: "query",
19975
+ auth: "admin"
19503
19976
  });
19504
19977
  /**
19505
19978
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -22621,6 +23094,12 @@ Object.freeze({
22621
23094
  addonId: null,
22622
23095
  access: "delete"
22623
23096
  },
23097
+ "pipelineAnalytics.deleteDeviceEvents": {
23098
+ capName: "pipeline-analytics",
23099
+ capScope: "device",
23100
+ addonId: null,
23101
+ access: "delete"
23102
+ },
22624
23103
  "pipelineAnalytics.deleteTracks": {
22625
23104
  capName: "pipeline-analytics",
22626
23105
  capScope: "device",
@@ -22651,6 +23130,12 @@ Object.freeze({
22651
23130
  addonId: null,
22652
23131
  access: "view"
22653
23132
  },
23133
+ "pipelineAnalytics.getEventStoreFootprint": {
23134
+ capName: "pipeline-analytics",
23135
+ capScope: "device",
23136
+ addonId: null,
23137
+ access: "view"
23138
+ },
22654
23139
  "pipelineAnalytics.getKeyEvents": {
22655
23140
  capName: "pipeline-analytics",
22656
23141
  capScope: "device",
@@ -22693,6 +23178,12 @@ Object.freeze({
22693
23178
  addonId: null,
22694
23179
  access: "view"
22695
23180
  },
23181
+ "pipelineAnalytics.listOpsLog": {
23182
+ capName: "pipeline-analytics",
23183
+ capScope: "device",
23184
+ addonId: null,
23185
+ access: "view"
23186
+ },
22696
23187
  "pipelineAnalytics.listRecentTracks": {
22697
23188
  capName: "pipeline-analytics",
22698
23189
  capScope: "device",
@@ -22705,6 +23196,12 @@ Object.freeze({
22705
23196
  addonId: null,
22706
23197
  access: "view"
22707
23198
  },
23199
+ "pipelineAnalytics.pruneEvents": {
23200
+ capName: "pipeline-analytics",
23201
+ capScope: "device",
23202
+ addonId: null,
23203
+ access: "create"
23204
+ },
22708
23205
  "pipelineAnalytics.pruneEventsBefore": {
22709
23206
  capName: "pipeline-analytics",
22710
23207
  capScope: "device",
@@ -23467,6 +23964,12 @@ Object.freeze({
23467
23964
  addonId: null,
23468
23965
  access: "create"
23469
23966
  },
23967
+ "recording.deleteFootprint": {
23968
+ capName: "recording",
23969
+ capScope: "system",
23970
+ addonId: null,
23971
+ access: "delete"
23972
+ },
23470
23973
  "recording.getAvailability": {
23471
23974
  capName: "recording",
23472
23975
  capScope: "system",
@@ -23497,6 +24000,12 @@ Object.freeze({
23497
24000
  addonId: null,
23498
24001
  access: "view"
23499
24002
  },
24003
+ "recording.listOpsLog": {
24004
+ capName: "recording",
24005
+ capScope: "system",
24006
+ addonId: null,
24007
+ access: "view"
24008
+ },
23500
24009
  "recording.locateSegment": {
23501
24010
  capName: "recording",
23502
24011
  capScope: "system",
@@ -7329,6 +7329,62 @@ var RecordingConfigSchema = object({
7329
7329
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7330
7330
  });
7331
7331
  /**
7332
+ * Ops-log — the durable, append-only operations audit shared by the
7333
+ * recordings and events management surfaces.
7334
+ *
7335
+ * ONE row shape is reused for both domains so a single "Activity" view can
7336
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7337
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7338
+ * management operation, WHY it ran (reason), and its measurable effect
7339
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7340
+ * never fail the operation it records.
7341
+ */
7342
+ /** Which management domain the operation belongs to. */
7343
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7344
+ /** The kind of management operation performed. */
7345
+ var OpsLogOpSchema = _enum([
7346
+ "prune",
7347
+ "manual-delete",
7348
+ "rescan",
7349
+ "retention-run"
7350
+ ]);
7351
+ /** Why the operation ran. */
7352
+ var OpsLogReasonSchema = _enum([
7353
+ "retention",
7354
+ "quota",
7355
+ "manual",
7356
+ "operator"
7357
+ ]);
7358
+ /** One audit row, shared verbatim by both domains. */
7359
+ var OpsLogEntrySchema = object({
7360
+ /** Unique row id. */
7361
+ id: string(),
7362
+ /** Epoch ms the operation completed. */
7363
+ at: number(),
7364
+ domain: OpsLogDomainSchema,
7365
+ op: OpsLogOpSchema,
7366
+ reason: OpsLogReasonSchema,
7367
+ /** The camera the op targeted; null for a cluster/global op. */
7368
+ deviceId: number().nullable(),
7369
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7370
+ nodeId: string(),
7371
+ /** Buckets / rows deleted (op-specific unit). */
7372
+ itemsAffected: number(),
7373
+ /** Bytes reclaimed by the op (0 when not measurable). */
7374
+ bytesReclaimed: number(),
7375
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7376
+ detail: string().nullable(),
7377
+ /** Who/what triggered the op. */
7378
+ actor: string()
7379
+ });
7380
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7381
+ var OpsLogQueryInputSchema = object({
7382
+ /** Restrict to a single camera; omit for every row. */
7383
+ deviceId: number().optional(),
7384
+ /** Max rows returned, newest-first. */
7385
+ limit: number().int().min(1).max(1e3).optional()
7386
+ });
7387
+ /**
7332
7388
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7333
7389
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7334
7390
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7572,6 +7628,160 @@ var EncodeProfileSchema = object({
7572
7628
  */
7573
7629
  outputArgs: array(string()).optional()
7574
7630
  });
7631
+ var COCO_TO_MACRO = {
7632
+ mapping: {
7633
+ person: "person",
7634
+ bicycle: "vehicle",
7635
+ car: "vehicle",
7636
+ motorcycle: "vehicle",
7637
+ airplane: "vehicle",
7638
+ bus: "vehicle",
7639
+ train: "vehicle",
7640
+ truck: "vehicle",
7641
+ boat: "vehicle",
7642
+ bird: "animal",
7643
+ cat: "animal",
7644
+ dog: "animal",
7645
+ horse: "animal",
7646
+ sheep: "animal",
7647
+ cow: "animal",
7648
+ elephant: "animal",
7649
+ bear: "animal",
7650
+ zebra: "animal",
7651
+ giraffe: "animal",
7652
+ suitcase: "package",
7653
+ backpack: "package",
7654
+ handbag: "package"
7655
+ },
7656
+ preserveOriginal: false
7657
+ };
7658
+ var AUDIO_MACRO_LABELS = [
7659
+ {
7660
+ id: "speech",
7661
+ name: "Speech",
7662
+ icon: "🗣️"
7663
+ },
7664
+ {
7665
+ id: "scream",
7666
+ name: "Scream / Shout",
7667
+ icon: "😱"
7668
+ },
7669
+ {
7670
+ id: "crying",
7671
+ name: "Crying / Baby",
7672
+ icon: "😢"
7673
+ },
7674
+ {
7675
+ id: "laughter",
7676
+ name: "Laughter",
7677
+ icon: "😂"
7678
+ },
7679
+ {
7680
+ id: "music",
7681
+ name: "Music",
7682
+ icon: "🎵"
7683
+ },
7684
+ {
7685
+ id: "dog",
7686
+ name: "Dog",
7687
+ icon: "🐕"
7688
+ },
7689
+ {
7690
+ id: "cat",
7691
+ name: "Cat",
7692
+ icon: "🐈"
7693
+ },
7694
+ {
7695
+ id: "bird",
7696
+ name: "Bird",
7697
+ icon: "🐦"
7698
+ },
7699
+ {
7700
+ id: "animal",
7701
+ name: "Animal (other)",
7702
+ icon: "🐾"
7703
+ },
7704
+ {
7705
+ id: "alarm",
7706
+ name: "Alarm / Siren",
7707
+ icon: "🚨"
7708
+ },
7709
+ {
7710
+ id: "doorbell",
7711
+ name: "Doorbell / Knock",
7712
+ icon: "🔔"
7713
+ },
7714
+ {
7715
+ id: "glass_breaking",
7716
+ name: "Glass Breaking",
7717
+ icon: "💥"
7718
+ },
7719
+ {
7720
+ id: "gunshot",
7721
+ name: "Gunshot / Explosion",
7722
+ icon: "💣"
7723
+ },
7724
+ {
7725
+ id: "vehicle",
7726
+ name: "Vehicle",
7727
+ icon: "🚗"
7728
+ },
7729
+ {
7730
+ id: "siren",
7731
+ name: "Emergency Siren",
7732
+ icon: "🚑"
7733
+ },
7734
+ {
7735
+ id: "fire",
7736
+ name: "Fire / Smoke",
7737
+ icon: "🔥"
7738
+ },
7739
+ {
7740
+ id: "water",
7741
+ name: "Water",
7742
+ icon: "💧"
7743
+ },
7744
+ {
7745
+ id: "wind",
7746
+ name: "Wind / Weather",
7747
+ icon: "🌬️"
7748
+ },
7749
+ {
7750
+ id: "door",
7751
+ name: "Door",
7752
+ icon: "🚪"
7753
+ },
7754
+ {
7755
+ id: "footsteps",
7756
+ name: "Footsteps",
7757
+ icon: "👣"
7758
+ },
7759
+ {
7760
+ id: "crowd",
7761
+ name: "Crowd / Chatter",
7762
+ icon: "👥"
7763
+ },
7764
+ {
7765
+ id: "telephone",
7766
+ name: "Telephone",
7767
+ icon: "📞"
7768
+ },
7769
+ {
7770
+ id: "engine",
7771
+ name: "Engine / Motor",
7772
+ icon: "⚙️"
7773
+ },
7774
+ {
7775
+ id: "tools",
7776
+ name: "Tools / Construction",
7777
+ icon: "🔨"
7778
+ },
7779
+ {
7780
+ id: "silence",
7781
+ name: "Silence",
7782
+ icon: "🤫"
7783
+ }
7784
+ ];
7575
7785
  var YAMNET_TO_MACRO = {
7576
7786
  mapping: {
7577
7787
  Speech: "speech",
@@ -7838,6 +8048,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7838
8048
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7839
8049
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7840
8050
  /**
8051
+ * Unified event-kind taxonomy — THE single source of truth for
8052
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8053
+ * icon }`.
8054
+ *
8055
+ * This dictionary folds together what used to be scattered across four
8056
+ * copies:
8057
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8058
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8059
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8060
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8061
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8062
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8063
+ *
8064
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8065
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8066
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8067
+ * color or an icon: they read this dictionary (server descriptors carry the
8068
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8069
+ *
8070
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8071
+ */
8072
+ var TAXONOMY_COLORS = {
8073
+ motion: "#f59e0b",
8074
+ audio: "#06b6d4",
8075
+ person: "#22c55e",
8076
+ vehicle: "#3b82f6",
8077
+ animal: "#f97316",
8078
+ package: "#a855f7",
8079
+ sensor: "#8b5cf6",
8080
+ control: "#10b981",
8081
+ genericDetection: "#64748b"
8082
+ };
8083
+ var DETECTION_SUB_COLORS = {
8084
+ car: "#f59e0b",
8085
+ truck: "#d97706",
8086
+ bus: "#b45309",
8087
+ motorcycle: "#eab308",
8088
+ bicycle: "#ca8a04",
8089
+ airplane: "#60a5fa",
8090
+ boat: "#2563eb",
8091
+ train: "#1d4ed8",
8092
+ bird: "#14b8a6",
8093
+ dog: "#84cc16",
8094
+ cat: "#f97316",
8095
+ horse: "#a16207",
8096
+ sheep: "#a3a3a3",
8097
+ cow: "#78716c",
8098
+ elephant: "#6b7280",
8099
+ bear: "#7c2d12",
8100
+ zebra: "#404040",
8101
+ giraffe: "#d4a373"
8102
+ };
8103
+ function titleCase(id) {
8104
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8105
+ }
8106
+ var entries = /* @__PURE__ */ new Map();
8107
+ function macro(kind, category, color, iconId, label) {
8108
+ entries.set(kind, {
8109
+ kind,
8110
+ parentKind: null,
8111
+ level: "macro",
8112
+ category,
8113
+ color,
8114
+ iconId,
8115
+ labelKey: `eventKind.${kind}`,
8116
+ label
8117
+ });
8118
+ }
8119
+ function sub(kind, parentKind, category, color, iconId, label) {
8120
+ entries.set(kind, {
8121
+ kind,
8122
+ parentKind,
8123
+ level: "sub",
8124
+ category,
8125
+ color,
8126
+ iconId,
8127
+ labelKey: `eventKind.${kind}`,
8128
+ label
8129
+ });
8130
+ }
8131
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8132
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8133
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8134
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8135
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8136
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8137
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8138
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8139
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8140
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8141
+ if (entries.has(cocoClass)) continue;
8142
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8143
+ }
8144
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8145
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8146
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8147
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8148
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8149
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8150
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8151
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8152
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8153
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8154
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8155
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8156
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8157
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8158
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8159
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8160
+ sub("button", "control", "control", "#10b981", "button", "Button");
8161
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8162
+ for (const l of AUDIO_MACRO_LABELS) {
8163
+ const kind = `audio-${l.id}`;
8164
+ if (entries.has(kind)) continue;
8165
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8166
+ }
8167
+ /** The complete taxonomy dictionary, keyed by kind. */
8168
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8169
+ /**
7841
8170
  * Error types for the safe expression engine. Two distinct classes so callers
7842
8171
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7843
8172
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -15787,17 +16116,30 @@ var EventKindCategorySchema = _enum([
15787
16116
  "audio",
15788
16117
  "detection",
15789
16118
  "sensor",
16119
+ "control",
15790
16120
  "custom",
15791
16121
  "package"
15792
16122
  ]);
16123
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16124
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15793
16125
  var EventKindDescriptorSchema = object({
15794
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16126
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15795
16127
  kind: string(),
16128
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16129
+ labelKey: string(),
16130
+ /** English fallback label (kept for clients that don't translate). */
15796
16131
  label: string(),
15797
16132
  /** Hex color for timeline/legend rendering. */
15798
16133
  color: string(),
16134
+ /** Dictionary id → lucide component on the UI side. */
16135
+ iconId: string(),
16136
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15799
16137
  icon: EventKindIconSchema,
15800
16138
  category: EventKindCategorySchema,
16139
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16140
+ parentKind: string().nullable(),
16141
+ /** Derived from `parentKind`, explicit for the client tree. */
16142
+ level: EventKindLevelSchema,
15801
16143
  /** Which cap + device contributes this kind. For built-ins the camera
15802
16144
  * itself; for sensor kinds the LINKED source device. */
15803
16145
  source: object({
@@ -15870,11 +16212,21 @@ var TrackAudioLabelSchema = object({
15870
16212
  firstAt: number(),
15871
16213
  lastAt: number()
15872
16214
  });
16215
+ /**
16216
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16217
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16218
+ * linked sensor/control state change (no positions; carries a snapshot). The
16219
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16220
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16221
+ */
16222
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
15873
16223
  var TrackSchema = object({
15874
16224
  trackId: string(),
15875
16225
  deviceId: number(),
15876
16226
  className: string(),
15877
16227
  label: string().optional(),
16228
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16229
+ source: TrackSourceSchema.optional(),
15878
16230
  firstSeen: number(),
15879
16231
  lastSeen: number(),
15880
16232
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16129,6 +16481,26 @@ var TrackCascadeCountsSchema = object({
16129
16481
  /** Per-track CLIP search vectors removed (best-effort). */
16130
16482
  embeddings: number().int()
16131
16483
  });
16484
+ /** Event-store footprint for one camera. */
16485
+ var EventStoreDeviceFootprintSchema = object({
16486
+ deviceId: number(),
16487
+ /** Persisted event rows (motion + object + audio) for the camera. */
16488
+ rows: number().int(),
16489
+ /** Event-owned media bytes on disk for the camera. */
16490
+ bytes: number().int()
16491
+ });
16492
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
16493
+ var EventStoreFootprintSchema = object({
16494
+ totalRows: number().int(),
16495
+ totalBytes: number().int(),
16496
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
16497
+ });
16498
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
16499
+ var EventPruneCountsSchema = object({
16500
+ motion: number().int(),
16501
+ object: number().int(),
16502
+ audio: number().int()
16503
+ });
16132
16504
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
16133
16505
  deviceId: number(),
16134
16506
  trackId: string()
@@ -16192,6 +16564,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16192
16564
  }), {
16193
16565
  kind: "mutation",
16194
16566
  auth: "admin"
16567
+ }), method(object({}), EventStoreFootprintSchema, {
16568
+ kind: "query",
16569
+ auth: "admin"
16570
+ }), method(object({
16571
+ olderThanMs: number(),
16572
+ reason: OpsLogReasonSchema.optional()
16573
+ }), EventPruneCountsSchema, {
16574
+ kind: "mutation",
16575
+ auth: "admin"
16576
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
16577
+ kind: "mutation",
16578
+ auth: "admin"
16579
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
16580
+ kind: "query",
16581
+ auth: "admin"
16195
16582
  }), method(object({
16196
16583
  eventId: string(),
16197
16584
  kind: MediaFileKindEnum.optional()
@@ -16216,6 +16603,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16216
16603
  eventId: string(),
16217
16604
  timestamp: number()
16218
16605
  });
16606
+ /**
16607
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16608
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16609
+ * caps into per-camera event-kind descriptors.
16610
+ *
16611
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16612
+ * is NOT duplicated here — every entry is derived from the single
16613
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16614
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16615
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16616
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16617
+ * eventful cap is missing.
16618
+ */
16619
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16620
+ var LEGACY_ICON = {
16621
+ motion: "motion",
16622
+ audio: "audio",
16623
+ person: "person",
16624
+ vehicle: "vehicle",
16625
+ animal: "animal",
16626
+ package: "package",
16627
+ door: "door",
16628
+ pir: "pir",
16629
+ smoke: "smoke",
16630
+ water: "water",
16631
+ button: "button",
16632
+ generic: "generic",
16633
+ gas: "smoke",
16634
+ vibration: "generic",
16635
+ tamper: "generic",
16636
+ presence: "person",
16637
+ lock: "generic",
16638
+ siren: "generic",
16639
+ switch: "generic",
16640
+ doorbell: "button"
16641
+ };
16642
+ function legacyIcon(iconId) {
16643
+ return LEGACY_ICON[iconId] ?? "generic";
16644
+ }
16645
+ /**
16646
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16647
+ * The anti-drift guard cross-checks this against the eventful caps declared
16648
+ * in `packages/types/src/capabilities/*.cap.ts`.
16649
+ */
16650
+ var CAP_TO_KIND = {
16651
+ contact: "contact",
16652
+ motion: "motion-sensor",
16653
+ smoke: "smoke",
16654
+ flood: "flood",
16655
+ gas: "gas",
16656
+ "carbon-monoxide": "carbon-monoxide",
16657
+ vibration: "vibration",
16658
+ tamper: "tamper",
16659
+ presence: "presence",
16660
+ "enum-sensor": "enum-sensor",
16661
+ "event-emitter": "device-event",
16662
+ "lock-control": "lock",
16663
+ switch: "switch",
16664
+ button: "button",
16665
+ doorbell: "doorbell"
16666
+ };
16667
+ function buildDescriptor(capName, kind) {
16668
+ const t = EVENT_TAXONOMY[kind];
16669
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16670
+ return {
16671
+ ...t,
16672
+ icon: legacyIcon(t.iconId)
16673
+ };
16674
+ }
16675
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16219
16676
  var CameraPipelineConfigSchema = object({
16220
16677
  engine: PipelineEngineChoiceSchema.optional(),
16221
16678
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19470,13 +19927,29 @@ method(object({
19470
19927
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
19471
19928
  kind: "mutation",
19472
19929
  auth: "admin"
19473
- }), method(object({ deviceId: number() }), object({
19930
+ }), method(object({
19931
+ deviceId: number(),
19932
+ reason: OpsLogReasonSchema.optional()
19933
+ }), object({
19474
19934
  floorMs: number().nullable(),
19475
19935
  deletedBuckets: number().int(),
19476
19936
  reclaimedBytes: number().int()
19477
19937
  }), {
19478
19938
  kind: "mutation",
19479
19939
  auth: "admin"
19940
+ }), method(object({
19941
+ deviceId: number(),
19942
+ fromMs: number().optional(),
19943
+ toMs: number().optional()
19944
+ }), object({
19945
+ deletedBuckets: number().int(),
19946
+ reclaimedBytes: number().int()
19947
+ }), {
19948
+ kind: "mutation",
19949
+ auth: "admin"
19950
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19951
+ kind: "query",
19952
+ auth: "admin"
19480
19953
  });
19481
19954
  /**
19482
19955
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -22598,6 +23071,12 @@ Object.freeze({
22598
23071
  addonId: null,
22599
23072
  access: "delete"
22600
23073
  },
23074
+ "pipelineAnalytics.deleteDeviceEvents": {
23075
+ capName: "pipeline-analytics",
23076
+ capScope: "device",
23077
+ addonId: null,
23078
+ access: "delete"
23079
+ },
22601
23080
  "pipelineAnalytics.deleteTracks": {
22602
23081
  capName: "pipeline-analytics",
22603
23082
  capScope: "device",
@@ -22628,6 +23107,12 @@ Object.freeze({
22628
23107
  addonId: null,
22629
23108
  access: "view"
22630
23109
  },
23110
+ "pipelineAnalytics.getEventStoreFootprint": {
23111
+ capName: "pipeline-analytics",
23112
+ capScope: "device",
23113
+ addonId: null,
23114
+ access: "view"
23115
+ },
22631
23116
  "pipelineAnalytics.getKeyEvents": {
22632
23117
  capName: "pipeline-analytics",
22633
23118
  capScope: "device",
@@ -22670,6 +23155,12 @@ Object.freeze({
22670
23155
  addonId: null,
22671
23156
  access: "view"
22672
23157
  },
23158
+ "pipelineAnalytics.listOpsLog": {
23159
+ capName: "pipeline-analytics",
23160
+ capScope: "device",
23161
+ addonId: null,
23162
+ access: "view"
23163
+ },
22673
23164
  "pipelineAnalytics.listRecentTracks": {
22674
23165
  capName: "pipeline-analytics",
22675
23166
  capScope: "device",
@@ -22682,6 +23173,12 @@ Object.freeze({
22682
23173
  addonId: null,
22683
23174
  access: "view"
22684
23175
  },
23176
+ "pipelineAnalytics.pruneEvents": {
23177
+ capName: "pipeline-analytics",
23178
+ capScope: "device",
23179
+ addonId: null,
23180
+ access: "create"
23181
+ },
22685
23182
  "pipelineAnalytics.pruneEventsBefore": {
22686
23183
  capName: "pipeline-analytics",
22687
23184
  capScope: "device",
@@ -23444,6 +23941,12 @@ Object.freeze({
23444
23941
  addonId: null,
23445
23942
  access: "create"
23446
23943
  },
23944
+ "recording.deleteFootprint": {
23945
+ capName: "recording",
23946
+ capScope: "system",
23947
+ addonId: null,
23948
+ access: "delete"
23949
+ },
23447
23950
  "recording.getAvailability": {
23448
23951
  capName: "recording",
23449
23952
  capScope: "system",
@@ -23474,6 +23977,12 @@ Object.freeze({
23474
23977
  addonId: null,
23475
23978
  access: "view"
23476
23979
  },
23980
+ "recording.listOpsLog": {
23981
+ capName: "recording",
23982
+ capScope: "system",
23983
+ addonId: null,
23984
+ access: "view"
23985
+ },
23477
23986
  "recording.locateSegment": {
23478
23987
  capName: "recording",
23479
23988
  capScope: "system",
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-ChSRaxCw.js");
5
+ const require_shared = require("./shared-CZDYRlzo.js");
6
6
  let node_stream = require("node:stream");
7
7
  let webdav = require("webdav");
8
8
  //#region src/providers/webdav/webdav-config-schema.ts
@@ -1,4 +1,4 @@
1
- import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-fXbGPtd5.mjs";
1
+ import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-DW5ccoQG.mjs";
2
2
  import { PassThrough } from "node:stream";
3
3
  import { AuthType, createClient } from "webdav";
4
4
  //#region src/providers/webdav/webdav-config-schema.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-remote-storage",
3
- "version": "1.1.27",
3
+ "version": "1.1.29",
4
4
  "description": "Remote storage providers (SFTP, S3, WebDAV) — unifies remote backends behind the storage-provider cap",
5
5
  "keywords": [
6
6
  "camstack",