@camstack/addon-provider-amcrest 0.1.13 → 0.1.15

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
@@ -7337,6 +7337,62 @@ var RecordingConfigSchema = object({
7337
7337
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7338
7338
  });
7339
7339
  /**
7340
+ * Ops-log — the durable, append-only operations audit shared by the
7341
+ * recordings and events management surfaces.
7342
+ *
7343
+ * ONE row shape is reused for both domains so a single "Activity" view can
7344
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7345
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7346
+ * management operation, WHY it ran (reason), and its measurable effect
7347
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7348
+ * never fail the operation it records.
7349
+ */
7350
+ /** Which management domain the operation belongs to. */
7351
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7352
+ /** The kind of management operation performed. */
7353
+ var OpsLogOpSchema = _enum([
7354
+ "prune",
7355
+ "manual-delete",
7356
+ "rescan",
7357
+ "retention-run"
7358
+ ]);
7359
+ /** Why the operation ran. */
7360
+ var OpsLogReasonSchema = _enum([
7361
+ "retention",
7362
+ "quota",
7363
+ "manual",
7364
+ "operator"
7365
+ ]);
7366
+ /** One audit row, shared verbatim by both domains. */
7367
+ var OpsLogEntrySchema = object({
7368
+ /** Unique row id. */
7369
+ id: string(),
7370
+ /** Epoch ms the operation completed. */
7371
+ at: number(),
7372
+ domain: OpsLogDomainSchema,
7373
+ op: OpsLogOpSchema,
7374
+ reason: OpsLogReasonSchema,
7375
+ /** The camera the op targeted; null for a cluster/global op. */
7376
+ deviceId: number().nullable(),
7377
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7378
+ nodeId: string(),
7379
+ /** Buckets / rows deleted (op-specific unit). */
7380
+ itemsAffected: number(),
7381
+ /** Bytes reclaimed by the op (0 when not measurable). */
7382
+ bytesReclaimed: number(),
7383
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7384
+ detail: string().nullable(),
7385
+ /** Who/what triggered the op. */
7386
+ actor: string()
7387
+ });
7388
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7389
+ var OpsLogQueryInputSchema = object({
7390
+ /** Restrict to a single camera; omit for every row. */
7391
+ deviceId: number().optional(),
7392
+ /** Max rows returned, newest-first. */
7393
+ limit: number().int().min(1).max(1e3).optional()
7394
+ });
7395
+ /**
7340
7396
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7341
7397
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7342
7398
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7580,6 +7636,160 @@ var EncodeProfileSchema = object({
7580
7636
  */
7581
7637
  outputArgs: array(string()).optional()
7582
7638
  });
7639
+ var COCO_TO_MACRO = {
7640
+ mapping: {
7641
+ person: "person",
7642
+ bicycle: "vehicle",
7643
+ car: "vehicle",
7644
+ motorcycle: "vehicle",
7645
+ airplane: "vehicle",
7646
+ bus: "vehicle",
7647
+ train: "vehicle",
7648
+ truck: "vehicle",
7649
+ boat: "vehicle",
7650
+ bird: "animal",
7651
+ cat: "animal",
7652
+ dog: "animal",
7653
+ horse: "animal",
7654
+ sheep: "animal",
7655
+ cow: "animal",
7656
+ elephant: "animal",
7657
+ bear: "animal",
7658
+ zebra: "animal",
7659
+ giraffe: "animal",
7660
+ suitcase: "package",
7661
+ backpack: "package",
7662
+ handbag: "package"
7663
+ },
7664
+ preserveOriginal: false
7665
+ };
7666
+ var AUDIO_MACRO_LABELS = [
7667
+ {
7668
+ id: "speech",
7669
+ name: "Speech",
7670
+ icon: "🗣️"
7671
+ },
7672
+ {
7673
+ id: "scream",
7674
+ name: "Scream / Shout",
7675
+ icon: "😱"
7676
+ },
7677
+ {
7678
+ id: "crying",
7679
+ name: "Crying / Baby",
7680
+ icon: "😢"
7681
+ },
7682
+ {
7683
+ id: "laughter",
7684
+ name: "Laughter",
7685
+ icon: "😂"
7686
+ },
7687
+ {
7688
+ id: "music",
7689
+ name: "Music",
7690
+ icon: "🎵"
7691
+ },
7692
+ {
7693
+ id: "dog",
7694
+ name: "Dog",
7695
+ icon: "🐕"
7696
+ },
7697
+ {
7698
+ id: "cat",
7699
+ name: "Cat",
7700
+ icon: "🐈"
7701
+ },
7702
+ {
7703
+ id: "bird",
7704
+ name: "Bird",
7705
+ icon: "🐦"
7706
+ },
7707
+ {
7708
+ id: "animal",
7709
+ name: "Animal (other)",
7710
+ icon: "🐾"
7711
+ },
7712
+ {
7713
+ id: "alarm",
7714
+ name: "Alarm / Siren",
7715
+ icon: "🚨"
7716
+ },
7717
+ {
7718
+ id: "doorbell",
7719
+ name: "Doorbell / Knock",
7720
+ icon: "🔔"
7721
+ },
7722
+ {
7723
+ id: "glass_breaking",
7724
+ name: "Glass Breaking",
7725
+ icon: "💥"
7726
+ },
7727
+ {
7728
+ id: "gunshot",
7729
+ name: "Gunshot / Explosion",
7730
+ icon: "💣"
7731
+ },
7732
+ {
7733
+ id: "vehicle",
7734
+ name: "Vehicle",
7735
+ icon: "🚗"
7736
+ },
7737
+ {
7738
+ id: "siren",
7739
+ name: "Emergency Siren",
7740
+ icon: "🚑"
7741
+ },
7742
+ {
7743
+ id: "fire",
7744
+ name: "Fire / Smoke",
7745
+ icon: "🔥"
7746
+ },
7747
+ {
7748
+ id: "water",
7749
+ name: "Water",
7750
+ icon: "💧"
7751
+ },
7752
+ {
7753
+ id: "wind",
7754
+ name: "Wind / Weather",
7755
+ icon: "🌬️"
7756
+ },
7757
+ {
7758
+ id: "door",
7759
+ name: "Door",
7760
+ icon: "🚪"
7761
+ },
7762
+ {
7763
+ id: "footsteps",
7764
+ name: "Footsteps",
7765
+ icon: "👣"
7766
+ },
7767
+ {
7768
+ id: "crowd",
7769
+ name: "Crowd / Chatter",
7770
+ icon: "👥"
7771
+ },
7772
+ {
7773
+ id: "telephone",
7774
+ name: "Telephone",
7775
+ icon: "📞"
7776
+ },
7777
+ {
7778
+ id: "engine",
7779
+ name: "Engine / Motor",
7780
+ icon: "⚙️"
7781
+ },
7782
+ {
7783
+ id: "tools",
7784
+ name: "Tools / Construction",
7785
+ icon: "🔨"
7786
+ },
7787
+ {
7788
+ id: "silence",
7789
+ name: "Silence",
7790
+ icon: "🤫"
7791
+ }
7792
+ ];
7583
7793
  var YAMNET_TO_MACRO = {
7584
7794
  mapping: {
7585
7795
  Speech: "speech",
@@ -7846,6 +8056,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7846
8056
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7847
8057
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7848
8058
  /**
8059
+ * Unified event-kind taxonomy — THE single source of truth for
8060
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8061
+ * icon }`.
8062
+ *
8063
+ * This dictionary folds together what used to be scattered across four
8064
+ * copies:
8065
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8066
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8067
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8068
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8069
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8070
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8071
+ *
8072
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8073
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8074
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8075
+ * color or an icon: they read this dictionary (server descriptors carry the
8076
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8077
+ *
8078
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8079
+ */
8080
+ var TAXONOMY_COLORS = {
8081
+ motion: "#f59e0b",
8082
+ audio: "#06b6d4",
8083
+ person: "#22c55e",
8084
+ vehicle: "#3b82f6",
8085
+ animal: "#f97316",
8086
+ package: "#a855f7",
8087
+ sensor: "#8b5cf6",
8088
+ control: "#10b981",
8089
+ genericDetection: "#64748b"
8090
+ };
8091
+ var DETECTION_SUB_COLORS = {
8092
+ car: "#f59e0b",
8093
+ truck: "#d97706",
8094
+ bus: "#b45309",
8095
+ motorcycle: "#eab308",
8096
+ bicycle: "#ca8a04",
8097
+ airplane: "#60a5fa",
8098
+ boat: "#2563eb",
8099
+ train: "#1d4ed8",
8100
+ bird: "#14b8a6",
8101
+ dog: "#84cc16",
8102
+ cat: "#f97316",
8103
+ horse: "#a16207",
8104
+ sheep: "#a3a3a3",
8105
+ cow: "#78716c",
8106
+ elephant: "#6b7280",
8107
+ bear: "#7c2d12",
8108
+ zebra: "#404040",
8109
+ giraffe: "#d4a373"
8110
+ };
8111
+ function titleCase(id) {
8112
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8113
+ }
8114
+ var entries = /* @__PURE__ */ new Map();
8115
+ function macro(kind, category, color, iconId, label) {
8116
+ entries.set(kind, {
8117
+ kind,
8118
+ parentKind: null,
8119
+ level: "macro",
8120
+ category,
8121
+ color,
8122
+ iconId,
8123
+ labelKey: `eventKind.${kind}`,
8124
+ label
8125
+ });
8126
+ }
8127
+ function sub(kind, parentKind, category, color, iconId, label) {
8128
+ entries.set(kind, {
8129
+ kind,
8130
+ parentKind,
8131
+ level: "sub",
8132
+ category,
8133
+ color,
8134
+ iconId,
8135
+ labelKey: `eventKind.${kind}`,
8136
+ label
8137
+ });
8138
+ }
8139
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8140
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8141
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8142
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8143
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8144
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8145
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8146
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8147
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8148
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8149
+ if (entries.has(cocoClass)) continue;
8150
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8151
+ }
8152
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8153
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8154
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8155
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8156
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8157
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8158
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8159
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8160
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8161
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8162
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8163
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8164
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8165
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8166
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8167
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8168
+ sub("button", "control", "control", "#10b981", "button", "Button");
8169
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8170
+ for (const l of AUDIO_MACRO_LABELS) {
8171
+ const kind = `audio-${l.id}`;
8172
+ if (entries.has(kind)) continue;
8173
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8174
+ }
8175
+ /** The complete taxonomy dictionary, keyed by kind. */
8176
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8177
+ /**
7849
8178
  * Error types for the safe expression engine. Two distinct classes so callers
7850
8179
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7851
8180
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -14890,9 +15219,10 @@ var DEVICE_LOCAL_STATE_CAPS = {
14890
15219
  * `package` backs the package-drop detector — a package zone is a
14891
15220
  * `ZoneRule` on the `'package'` stage referencing drawn polygons
14892
15221
  * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14893
- * The orchestrator provider that writes this stage lands in a later
14894
- * slice; until then the mirror carries only `{motion, detection}` and
14895
- * consumers read `package` as absent (treat as `[]`).
15222
+ * The orchestrator provider writes this stage as a first-class slice
15223
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
15224
+ * package}` shape, so consumers read the current package rules directly
15225
+ * off `device.state.zoneRules.value.package`.
14896
15226
  */
14897
15227
  runtimeState: object({
14898
15228
  motion: array(ZoneRuleSchema).readonly(),
@@ -18867,17 +19197,30 @@ var EventKindCategorySchema = _enum([
18867
19197
  "audio",
18868
19198
  "detection",
18869
19199
  "sensor",
19200
+ "control",
18870
19201
  "custom",
18871
19202
  "package"
18872
19203
  ]);
19204
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19205
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18873
19206
  var EventKindDescriptorSchema = object({
18874
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19207
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18875
19208
  kind: string(),
19209
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19210
+ labelKey: string(),
19211
+ /** English fallback label (kept for clients that don't translate). */
18876
19212
  label: string(),
18877
19213
  /** Hex color for timeline/legend rendering. */
18878
19214
  color: string(),
19215
+ /** Dictionary id → lucide component on the UI side. */
19216
+ iconId: string(),
19217
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18879
19218
  icon: EventKindIconSchema,
18880
19219
  category: EventKindCategorySchema,
19220
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19221
+ parentKind: string().nullable(),
19222
+ /** Derived from `parentKind`, explicit for the client tree. */
19223
+ level: EventKindLevelSchema,
18881
19224
  /** Which cap + device contributes this kind. For built-ins the camera
18882
19225
  * itself; for sensor kinds the LINKED source device. */
18883
19226
  source: object({
@@ -18950,11 +19293,21 @@ var TrackAudioLabelSchema = object({
18950
19293
  firstAt: number(),
18951
19294
  lastAt: number()
18952
19295
  });
19296
+ /**
19297
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19298
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19299
+ * linked sensor/control state change (no positions; carries a snapshot). The
19300
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19301
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19302
+ */
19303
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18953
19304
  var TrackSchema = object({
18954
19305
  trackId: string(),
18955
19306
  deviceId: number(),
18956
19307
  className: string(),
18957
19308
  label: string().optional(),
19309
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19310
+ source: TrackSourceSchema.optional(),
18958
19311
  firstSeen: number(),
18959
19312
  lastSeen: number(),
18960
19313
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19209,6 +19562,26 @@ var TrackCascadeCountsSchema = object({
19209
19562
  /** Per-track CLIP search vectors removed (best-effort). */
19210
19563
  embeddings: number().int()
19211
19564
  });
19565
+ /** Event-store footprint for one camera. */
19566
+ var EventStoreDeviceFootprintSchema = object({
19567
+ deviceId: number(),
19568
+ /** Persisted event rows (motion + object + audio) for the camera. */
19569
+ rows: number().int(),
19570
+ /** Event-owned media bytes on disk for the camera. */
19571
+ bytes: number().int()
19572
+ });
19573
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19574
+ var EventStoreFootprintSchema = object({
19575
+ totalRows: number().int(),
19576
+ totalBytes: number().int(),
19577
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19578
+ });
19579
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19580
+ var EventPruneCountsSchema = object({
19581
+ motion: number().int(),
19582
+ object: number().int(),
19583
+ audio: number().int()
19584
+ });
19212
19585
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19213
19586
  deviceId: number(),
19214
19587
  trackId: string()
@@ -19272,6 +19645,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19272
19645
  }), {
19273
19646
  kind: "mutation",
19274
19647
  auth: "admin"
19648
+ }), method(object({}), EventStoreFootprintSchema, {
19649
+ kind: "query",
19650
+ auth: "admin"
19651
+ }), method(object({
19652
+ olderThanMs: number(),
19653
+ reason: OpsLogReasonSchema.optional()
19654
+ }), EventPruneCountsSchema, {
19655
+ kind: "mutation",
19656
+ auth: "admin"
19657
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19658
+ kind: "mutation",
19659
+ auth: "admin"
19660
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19661
+ kind: "query",
19662
+ auth: "admin"
19275
19663
  }), method(object({
19276
19664
  eventId: string(),
19277
19665
  kind: MediaFileKindEnum.optional()
@@ -19296,6 +19684,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19296
19684
  eventId: string(),
19297
19685
  timestamp: number()
19298
19686
  });
19687
+ /**
19688
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19689
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19690
+ * caps into per-camera event-kind descriptors.
19691
+ *
19692
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19693
+ * is NOT duplicated here — every entry is derived from the single
19694
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19695
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19696
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19697
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19698
+ * eventful cap is missing.
19699
+ */
19700
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19701
+ var LEGACY_ICON = {
19702
+ motion: "motion",
19703
+ audio: "audio",
19704
+ person: "person",
19705
+ vehicle: "vehicle",
19706
+ animal: "animal",
19707
+ package: "package",
19708
+ door: "door",
19709
+ pir: "pir",
19710
+ smoke: "smoke",
19711
+ water: "water",
19712
+ button: "button",
19713
+ generic: "generic",
19714
+ gas: "smoke",
19715
+ vibration: "generic",
19716
+ tamper: "generic",
19717
+ presence: "person",
19718
+ lock: "generic",
19719
+ siren: "generic",
19720
+ switch: "generic",
19721
+ doorbell: "button"
19722
+ };
19723
+ function legacyIcon(iconId) {
19724
+ return LEGACY_ICON[iconId] ?? "generic";
19725
+ }
19726
+ /**
19727
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19728
+ * The anti-drift guard cross-checks this against the eventful caps declared
19729
+ * in `packages/types/src/capabilities/*.cap.ts`.
19730
+ */
19731
+ var CAP_TO_KIND = {
19732
+ contact: "contact",
19733
+ motion: "motion-sensor",
19734
+ smoke: "smoke",
19735
+ flood: "flood",
19736
+ gas: "gas",
19737
+ "carbon-monoxide": "carbon-monoxide",
19738
+ vibration: "vibration",
19739
+ tamper: "tamper",
19740
+ presence: "presence",
19741
+ "enum-sensor": "enum-sensor",
19742
+ "event-emitter": "device-event",
19743
+ "lock-control": "lock",
19744
+ switch: "switch",
19745
+ button: "button",
19746
+ doorbell: "doorbell"
19747
+ };
19748
+ function buildDescriptor(capName, kind) {
19749
+ const t = EVENT_TAXONOMY[kind];
19750
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19751
+ return {
19752
+ ...t,
19753
+ icon: legacyIcon(t.iconId)
19754
+ };
19755
+ }
19756
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19299
19757
  var CameraPipelineConfigSchema = object({
19300
19758
  engine: PipelineEngineChoiceSchema.optional(),
19301
19759
  steps: array(PipelineStepInputSchema).readonly(),
@@ -22644,13 +23102,29 @@ method(object({
22644
23102
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22645
23103
  kind: "mutation",
22646
23104
  auth: "admin"
22647
- }), method(object({ deviceId: number() }), object({
23105
+ }), method(object({
23106
+ deviceId: number(),
23107
+ reason: OpsLogReasonSchema.optional()
23108
+ }), object({
22648
23109
  floorMs: number().nullable(),
22649
23110
  deletedBuckets: number().int(),
22650
23111
  reclaimedBytes: number().int()
22651
23112
  }), {
22652
23113
  kind: "mutation",
22653
23114
  auth: "admin"
23115
+ }), method(object({
23116
+ deviceId: number(),
23117
+ fromMs: number().optional(),
23118
+ toMs: number().optional()
23119
+ }), object({
23120
+ deletedBuckets: number().int(),
23121
+ reclaimedBytes: number().int()
23122
+ }), {
23123
+ kind: "mutation",
23124
+ auth: "admin"
23125
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
23126
+ kind: "query",
23127
+ auth: "admin"
22654
23128
  });
22655
23129
  /**
22656
23130
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -25983,6 +26457,12 @@ Object.freeze({
25983
26457
  addonId: null,
25984
26458
  access: "delete"
25985
26459
  },
26460
+ "pipelineAnalytics.deleteDeviceEvents": {
26461
+ capName: "pipeline-analytics",
26462
+ capScope: "device",
26463
+ addonId: null,
26464
+ access: "delete"
26465
+ },
25986
26466
  "pipelineAnalytics.deleteTracks": {
25987
26467
  capName: "pipeline-analytics",
25988
26468
  capScope: "device",
@@ -26013,6 +26493,12 @@ Object.freeze({
26013
26493
  addonId: null,
26014
26494
  access: "view"
26015
26495
  },
26496
+ "pipelineAnalytics.getEventStoreFootprint": {
26497
+ capName: "pipeline-analytics",
26498
+ capScope: "device",
26499
+ addonId: null,
26500
+ access: "view"
26501
+ },
26016
26502
  "pipelineAnalytics.getKeyEvents": {
26017
26503
  capName: "pipeline-analytics",
26018
26504
  capScope: "device",
@@ -26055,6 +26541,12 @@ Object.freeze({
26055
26541
  addonId: null,
26056
26542
  access: "view"
26057
26543
  },
26544
+ "pipelineAnalytics.listOpsLog": {
26545
+ capName: "pipeline-analytics",
26546
+ capScope: "device",
26547
+ addonId: null,
26548
+ access: "view"
26549
+ },
26058
26550
  "pipelineAnalytics.listRecentTracks": {
26059
26551
  capName: "pipeline-analytics",
26060
26552
  capScope: "device",
@@ -26067,6 +26559,12 @@ Object.freeze({
26067
26559
  addonId: null,
26068
26560
  access: "view"
26069
26561
  },
26562
+ "pipelineAnalytics.pruneEvents": {
26563
+ capName: "pipeline-analytics",
26564
+ capScope: "device",
26565
+ addonId: null,
26566
+ access: "create"
26567
+ },
26070
26568
  "pipelineAnalytics.pruneEventsBefore": {
26071
26569
  capName: "pipeline-analytics",
26072
26570
  capScope: "device",
@@ -26829,6 +27327,12 @@ Object.freeze({
26829
27327
  addonId: null,
26830
27328
  access: "create"
26831
27329
  },
27330
+ "recording.deleteFootprint": {
27331
+ capName: "recording",
27332
+ capScope: "system",
27333
+ addonId: null,
27334
+ access: "delete"
27335
+ },
26832
27336
  "recording.getAvailability": {
26833
27337
  capName: "recording",
26834
27338
  capScope: "system",
@@ -26859,6 +27363,12 @@ Object.freeze({
26859
27363
  addonId: null,
26860
27364
  access: "view"
26861
27365
  },
27366
+ "recording.listOpsLog": {
27367
+ capName: "recording",
27368
+ capScope: "system",
27369
+ addonId: null,
27370
+ access: "view"
27371
+ },
26862
27372
  "recording.locateSegment": {
26863
27373
  capName: "recording",
26864
27374
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -7338,6 +7338,62 @@ var RecordingConfigSchema = object({
7338
7338
  scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7339
7339
  });
7340
7340
  /**
7341
+ * Ops-log — the durable, append-only operations audit shared by the
7342
+ * recordings and events management surfaces.
7343
+ *
7344
+ * ONE row shape is reused for both domains so a single "Activity" view can
7345
+ * merge the recorder's DurableState ring (recordings ops-log) and the
7346
+ * pipeline-analytics SQLite collection (events ops-log). Each row records a
7347
+ * management operation, WHY it ran (reason), and its measurable effect
7348
+ * (itemsAffected + bytesReclaimed). Writes are best-effort — a failed log must
7349
+ * never fail the operation it records.
7350
+ */
7351
+ /** Which management domain the operation belongs to. */
7352
+ var OpsLogDomainSchema = _enum(["recording", "events"]);
7353
+ /** The kind of management operation performed. */
7354
+ var OpsLogOpSchema = _enum([
7355
+ "prune",
7356
+ "manual-delete",
7357
+ "rescan",
7358
+ "retention-run"
7359
+ ]);
7360
+ /** Why the operation ran. */
7361
+ var OpsLogReasonSchema = _enum([
7362
+ "retention",
7363
+ "quota",
7364
+ "manual",
7365
+ "operator"
7366
+ ]);
7367
+ /** One audit row, shared verbatim by both domains. */
7368
+ var OpsLogEntrySchema = object({
7369
+ /** Unique row id. */
7370
+ id: string(),
7371
+ /** Epoch ms the operation completed. */
7372
+ at: number(),
7373
+ domain: OpsLogDomainSchema,
7374
+ op: OpsLogOpSchema,
7375
+ reason: OpsLogReasonSchema,
7376
+ /** The camera the op targeted; null for a cluster/global op. */
7377
+ deviceId: number().nullable(),
7378
+ /** Node that performed the op (the log carries nodeId — no cross-node aggregation). */
7379
+ nodeId: string(),
7380
+ /** Buckets / rows deleted (op-specific unit). */
7381
+ itemsAffected: number(),
7382
+ /** Bytes reclaimed by the op (0 when not measurable). */
7383
+ bytesReclaimed: number(),
7384
+ /** Free-text detail (e.g. "floor moved to <ts>"); null when none. */
7385
+ detail: string().nullable(),
7386
+ /** Who/what triggered the op. */
7387
+ actor: string()
7388
+ });
7389
+ /** Shared query input for the per-domain `listOpsLog` cap methods. */
7390
+ var OpsLogQueryInputSchema = object({
7391
+ /** Restrict to a single camera; omit for every row. */
7392
+ deviceId: number().optional(),
7393
+ /** Max rows returned, newest-first. */
7394
+ limit: number().int().min(1).max(1e3).optional()
7395
+ });
7396
+ /**
7341
7397
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7342
7398
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7343
7399
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7581,6 +7637,160 @@ var EncodeProfileSchema = object({
7581
7637
  */
7582
7638
  outputArgs: array(string()).optional()
7583
7639
  });
7640
+ var COCO_TO_MACRO = {
7641
+ mapping: {
7642
+ person: "person",
7643
+ bicycle: "vehicle",
7644
+ car: "vehicle",
7645
+ motorcycle: "vehicle",
7646
+ airplane: "vehicle",
7647
+ bus: "vehicle",
7648
+ train: "vehicle",
7649
+ truck: "vehicle",
7650
+ boat: "vehicle",
7651
+ bird: "animal",
7652
+ cat: "animal",
7653
+ dog: "animal",
7654
+ horse: "animal",
7655
+ sheep: "animal",
7656
+ cow: "animal",
7657
+ elephant: "animal",
7658
+ bear: "animal",
7659
+ zebra: "animal",
7660
+ giraffe: "animal",
7661
+ suitcase: "package",
7662
+ backpack: "package",
7663
+ handbag: "package"
7664
+ },
7665
+ preserveOriginal: false
7666
+ };
7667
+ var AUDIO_MACRO_LABELS = [
7668
+ {
7669
+ id: "speech",
7670
+ name: "Speech",
7671
+ icon: "🗣️"
7672
+ },
7673
+ {
7674
+ id: "scream",
7675
+ name: "Scream / Shout",
7676
+ icon: "😱"
7677
+ },
7678
+ {
7679
+ id: "crying",
7680
+ name: "Crying / Baby",
7681
+ icon: "😢"
7682
+ },
7683
+ {
7684
+ id: "laughter",
7685
+ name: "Laughter",
7686
+ icon: "😂"
7687
+ },
7688
+ {
7689
+ id: "music",
7690
+ name: "Music",
7691
+ icon: "🎵"
7692
+ },
7693
+ {
7694
+ id: "dog",
7695
+ name: "Dog",
7696
+ icon: "🐕"
7697
+ },
7698
+ {
7699
+ id: "cat",
7700
+ name: "Cat",
7701
+ icon: "🐈"
7702
+ },
7703
+ {
7704
+ id: "bird",
7705
+ name: "Bird",
7706
+ icon: "🐦"
7707
+ },
7708
+ {
7709
+ id: "animal",
7710
+ name: "Animal (other)",
7711
+ icon: "🐾"
7712
+ },
7713
+ {
7714
+ id: "alarm",
7715
+ name: "Alarm / Siren",
7716
+ icon: "🚨"
7717
+ },
7718
+ {
7719
+ id: "doorbell",
7720
+ name: "Doorbell / Knock",
7721
+ icon: "🔔"
7722
+ },
7723
+ {
7724
+ id: "glass_breaking",
7725
+ name: "Glass Breaking",
7726
+ icon: "💥"
7727
+ },
7728
+ {
7729
+ id: "gunshot",
7730
+ name: "Gunshot / Explosion",
7731
+ icon: "💣"
7732
+ },
7733
+ {
7734
+ id: "vehicle",
7735
+ name: "Vehicle",
7736
+ icon: "🚗"
7737
+ },
7738
+ {
7739
+ id: "siren",
7740
+ name: "Emergency Siren",
7741
+ icon: "🚑"
7742
+ },
7743
+ {
7744
+ id: "fire",
7745
+ name: "Fire / Smoke",
7746
+ icon: "🔥"
7747
+ },
7748
+ {
7749
+ id: "water",
7750
+ name: "Water",
7751
+ icon: "💧"
7752
+ },
7753
+ {
7754
+ id: "wind",
7755
+ name: "Wind / Weather",
7756
+ icon: "🌬️"
7757
+ },
7758
+ {
7759
+ id: "door",
7760
+ name: "Door",
7761
+ icon: "🚪"
7762
+ },
7763
+ {
7764
+ id: "footsteps",
7765
+ name: "Footsteps",
7766
+ icon: "👣"
7767
+ },
7768
+ {
7769
+ id: "crowd",
7770
+ name: "Crowd / Chatter",
7771
+ icon: "👥"
7772
+ },
7773
+ {
7774
+ id: "telephone",
7775
+ name: "Telephone",
7776
+ icon: "📞"
7777
+ },
7778
+ {
7779
+ id: "engine",
7780
+ name: "Engine / Motor",
7781
+ icon: "⚙️"
7782
+ },
7783
+ {
7784
+ id: "tools",
7785
+ name: "Tools / Construction",
7786
+ icon: "🔨"
7787
+ },
7788
+ {
7789
+ id: "silence",
7790
+ name: "Silence",
7791
+ icon: "🤫"
7792
+ }
7793
+ ];
7584
7794
  var YAMNET_TO_MACRO = {
7585
7795
  mapping: {
7586
7796
  Speech: "speech",
@@ -7847,6 +8057,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7847
8057
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7848
8058
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7849
8059
  /**
8060
+ * Unified event-kind taxonomy — THE single source of truth for
8061
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8062
+ * icon }`.
8063
+ *
8064
+ * This dictionary folds together what used to be scattered across four
8065
+ * copies:
8066
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8067
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8068
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8069
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8070
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8071
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8072
+ *
8073
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8074
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8075
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8076
+ * color or an icon: they read this dictionary (server descriptors carry the
8077
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8078
+ *
8079
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8080
+ */
8081
+ var TAXONOMY_COLORS = {
8082
+ motion: "#f59e0b",
8083
+ audio: "#06b6d4",
8084
+ person: "#22c55e",
8085
+ vehicle: "#3b82f6",
8086
+ animal: "#f97316",
8087
+ package: "#a855f7",
8088
+ sensor: "#8b5cf6",
8089
+ control: "#10b981",
8090
+ genericDetection: "#64748b"
8091
+ };
8092
+ var DETECTION_SUB_COLORS = {
8093
+ car: "#f59e0b",
8094
+ truck: "#d97706",
8095
+ bus: "#b45309",
8096
+ motorcycle: "#eab308",
8097
+ bicycle: "#ca8a04",
8098
+ airplane: "#60a5fa",
8099
+ boat: "#2563eb",
8100
+ train: "#1d4ed8",
8101
+ bird: "#14b8a6",
8102
+ dog: "#84cc16",
8103
+ cat: "#f97316",
8104
+ horse: "#a16207",
8105
+ sheep: "#a3a3a3",
8106
+ cow: "#78716c",
8107
+ elephant: "#6b7280",
8108
+ bear: "#7c2d12",
8109
+ zebra: "#404040",
8110
+ giraffe: "#d4a373"
8111
+ };
8112
+ function titleCase(id) {
8113
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8114
+ }
8115
+ var entries = /* @__PURE__ */ new Map();
8116
+ function macro(kind, category, color, iconId, label) {
8117
+ entries.set(kind, {
8118
+ kind,
8119
+ parentKind: null,
8120
+ level: "macro",
8121
+ category,
8122
+ color,
8123
+ iconId,
8124
+ labelKey: `eventKind.${kind}`,
8125
+ label
8126
+ });
8127
+ }
8128
+ function sub(kind, parentKind, category, color, iconId, label) {
8129
+ entries.set(kind, {
8130
+ kind,
8131
+ parentKind,
8132
+ level: "sub",
8133
+ category,
8134
+ color,
8135
+ iconId,
8136
+ labelKey: `eventKind.${kind}`,
8137
+ label
8138
+ });
8139
+ }
8140
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8141
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8142
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8143
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8144
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8145
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8146
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8147
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8148
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8149
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8150
+ if (entries.has(cocoClass)) continue;
8151
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8152
+ }
8153
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8154
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8155
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8156
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8157
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8158
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8159
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8160
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8161
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8162
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8163
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8164
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8165
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8166
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8167
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8168
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8169
+ sub("button", "control", "control", "#10b981", "button", "Button");
8170
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8171
+ for (const l of AUDIO_MACRO_LABELS) {
8172
+ const kind = `audio-${l.id}`;
8173
+ if (entries.has(kind)) continue;
8174
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8175
+ }
8176
+ /** The complete taxonomy dictionary, keyed by kind. */
8177
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8178
+ /**
7850
8179
  * Error types for the safe expression engine. Two distinct classes so callers
7851
8180
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7852
8181
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -14891,9 +15220,10 @@ var DEVICE_LOCAL_STATE_CAPS = {
14891
15220
  * `package` backs the package-drop detector — a package zone is a
14892
15221
  * `ZoneRule` on the `'package'` stage referencing drawn polygons
14893
15222
  * (see docs/superpowers/specs/2026-07-17-package-zones-design.md §3.1).
14894
- * The orchestrator provider that writes this stage lands in a later
14895
- * slice; until then the mirror carries only `{motion, detection}` and
14896
- * consumers read `package` as absent (treat as `[]`).
15223
+ * The orchestrator provider writes this stage as a first-class slice
15224
+ * (Phase 4): every mutation mirrors the full `{motion, detection,
15225
+ * package}` shape, so consumers read the current package rules directly
15226
+ * off `device.state.zoneRules.value.package`.
14897
15227
  */
14898
15228
  runtimeState: object({
14899
15229
  motion: array(ZoneRuleSchema).readonly(),
@@ -18868,17 +19198,30 @@ var EventKindCategorySchema = _enum([
18868
19198
  "audio",
18869
19199
  "detection",
18870
19200
  "sensor",
19201
+ "control",
18871
19202
  "custom",
18872
19203
  "package"
18873
19204
  ]);
19205
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19206
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18874
19207
  var EventKindDescriptorSchema = object({
18875
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19208
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18876
19209
  kind: string(),
19210
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19211
+ labelKey: string(),
19212
+ /** English fallback label (kept for clients that don't translate). */
18877
19213
  label: string(),
18878
19214
  /** Hex color for timeline/legend rendering. */
18879
19215
  color: string(),
19216
+ /** Dictionary id → lucide component on the UI side. */
19217
+ iconId: string(),
19218
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18880
19219
  icon: EventKindIconSchema,
18881
19220
  category: EventKindCategorySchema,
19221
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19222
+ parentKind: string().nullable(),
19223
+ /** Derived from `parentKind`, explicit for the client tree. */
19224
+ level: EventKindLevelSchema,
18882
19225
  /** Which cap + device contributes this kind. For built-ins the camera
18883
19226
  * itself; for sensor kinds the LINKED source device. */
18884
19227
  source: object({
@@ -18951,11 +19294,21 @@ var TrackAudioLabelSchema = object({
18951
19294
  firstAt: number(),
18952
19295
  lastAt: number()
18953
19296
  });
19297
+ /**
19298
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19299
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19300
+ * linked sensor/control state change (no positions; carries a snapshot). The
19301
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19302
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19303
+ */
19304
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18954
19305
  var TrackSchema = object({
18955
19306
  trackId: string(),
18956
19307
  deviceId: number(),
18957
19308
  className: string(),
18958
19309
  label: string().optional(),
19310
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19311
+ source: TrackSourceSchema.optional(),
18959
19312
  firstSeen: number(),
18960
19313
  lastSeen: number(),
18961
19314
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19210,6 +19563,26 @@ var TrackCascadeCountsSchema = object({
19210
19563
  /** Per-track CLIP search vectors removed (best-effort). */
19211
19564
  embeddings: number().int()
19212
19565
  });
19566
+ /** Event-store footprint for one camera. */
19567
+ var EventStoreDeviceFootprintSchema = object({
19568
+ deviceId: number(),
19569
+ /** Persisted event rows (motion + object + audio) for the camera. */
19570
+ rows: number().int(),
19571
+ /** Event-owned media bytes on disk for the camera. */
19572
+ bytes: number().int()
19573
+ });
19574
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19575
+ var EventStoreFootprintSchema = object({
19576
+ totalRows: number().int(),
19577
+ totalBytes: number().int(),
19578
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19579
+ });
19580
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19581
+ var EventPruneCountsSchema = object({
19582
+ motion: number().int(),
19583
+ object: number().int(),
19584
+ audio: number().int()
19585
+ });
19213
19586
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19214
19587
  deviceId: number(),
19215
19588
  trackId: string()
@@ -19273,6 +19646,21 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19273
19646
  }), {
19274
19647
  kind: "mutation",
19275
19648
  auth: "admin"
19649
+ }), method(object({}), EventStoreFootprintSchema, {
19650
+ kind: "query",
19651
+ auth: "admin"
19652
+ }), method(object({
19653
+ olderThanMs: number(),
19654
+ reason: OpsLogReasonSchema.optional()
19655
+ }), EventPruneCountsSchema, {
19656
+ kind: "mutation",
19657
+ auth: "admin"
19658
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19659
+ kind: "mutation",
19660
+ auth: "admin"
19661
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19662
+ kind: "query",
19663
+ auth: "admin"
19276
19664
  }), method(object({
19277
19665
  eventId: string(),
19278
19666
  kind: MediaFileKindEnum.optional()
@@ -19297,6 +19685,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19297
19685
  eventId: string(),
19298
19686
  timestamp: number()
19299
19687
  });
19688
+ /**
19689
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19690
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19691
+ * caps into per-camera event-kind descriptors.
19692
+ *
19693
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19694
+ * is NOT duplicated here — every entry is derived from the single
19695
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19696
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19697
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19698
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19699
+ * eventful cap is missing.
19700
+ */
19701
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19702
+ var LEGACY_ICON = {
19703
+ motion: "motion",
19704
+ audio: "audio",
19705
+ person: "person",
19706
+ vehicle: "vehicle",
19707
+ animal: "animal",
19708
+ package: "package",
19709
+ door: "door",
19710
+ pir: "pir",
19711
+ smoke: "smoke",
19712
+ water: "water",
19713
+ button: "button",
19714
+ generic: "generic",
19715
+ gas: "smoke",
19716
+ vibration: "generic",
19717
+ tamper: "generic",
19718
+ presence: "person",
19719
+ lock: "generic",
19720
+ siren: "generic",
19721
+ switch: "generic",
19722
+ doorbell: "button"
19723
+ };
19724
+ function legacyIcon(iconId) {
19725
+ return LEGACY_ICON[iconId] ?? "generic";
19726
+ }
19727
+ /**
19728
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19729
+ * The anti-drift guard cross-checks this against the eventful caps declared
19730
+ * in `packages/types/src/capabilities/*.cap.ts`.
19731
+ */
19732
+ var CAP_TO_KIND = {
19733
+ contact: "contact",
19734
+ motion: "motion-sensor",
19735
+ smoke: "smoke",
19736
+ flood: "flood",
19737
+ gas: "gas",
19738
+ "carbon-monoxide": "carbon-monoxide",
19739
+ vibration: "vibration",
19740
+ tamper: "tamper",
19741
+ presence: "presence",
19742
+ "enum-sensor": "enum-sensor",
19743
+ "event-emitter": "device-event",
19744
+ "lock-control": "lock",
19745
+ switch: "switch",
19746
+ button: "button",
19747
+ doorbell: "doorbell"
19748
+ };
19749
+ function buildDescriptor(capName, kind) {
19750
+ const t = EVENT_TAXONOMY[kind];
19751
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19752
+ return {
19753
+ ...t,
19754
+ icon: legacyIcon(t.iconId)
19755
+ };
19756
+ }
19757
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19300
19758
  var CameraPipelineConfigSchema = object({
19301
19759
  engine: PipelineEngineChoiceSchema.optional(),
19302
19760
  steps: array(PipelineStepInputSchema).readonly(),
@@ -22645,13 +23103,29 @@ method(object({
22645
23103
  }), method(object({ deviceId: number() }), RecordingStatusSchema, {
22646
23104
  kind: "mutation",
22647
23105
  auth: "admin"
22648
- }), method(object({ deviceId: number() }), object({
23106
+ }), method(object({
23107
+ deviceId: number(),
23108
+ reason: OpsLogReasonSchema.optional()
23109
+ }), object({
22649
23110
  floorMs: number().nullable(),
22650
23111
  deletedBuckets: number().int(),
22651
23112
  reclaimedBytes: number().int()
22652
23113
  }), {
22653
23114
  kind: "mutation",
22654
23115
  auth: "admin"
23116
+ }), method(object({
23117
+ deviceId: number(),
23118
+ fromMs: number().optional(),
23119
+ toMs: number().optional()
23120
+ }), object({
23121
+ deletedBuckets: number().int(),
23122
+ reclaimedBytes: number().int()
23123
+ }), {
23124
+ kind: "mutation",
23125
+ auth: "admin"
23126
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
23127
+ kind: "query",
23128
+ auth: "admin"
22655
23129
  });
22656
23130
  /**
22657
23131
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -25984,6 +26458,12 @@ Object.freeze({
25984
26458
  addonId: null,
25985
26459
  access: "delete"
25986
26460
  },
26461
+ "pipelineAnalytics.deleteDeviceEvents": {
26462
+ capName: "pipeline-analytics",
26463
+ capScope: "device",
26464
+ addonId: null,
26465
+ access: "delete"
26466
+ },
25987
26467
  "pipelineAnalytics.deleteTracks": {
25988
26468
  capName: "pipeline-analytics",
25989
26469
  capScope: "device",
@@ -26014,6 +26494,12 @@ Object.freeze({
26014
26494
  addonId: null,
26015
26495
  access: "view"
26016
26496
  },
26497
+ "pipelineAnalytics.getEventStoreFootprint": {
26498
+ capName: "pipeline-analytics",
26499
+ capScope: "device",
26500
+ addonId: null,
26501
+ access: "view"
26502
+ },
26017
26503
  "pipelineAnalytics.getKeyEvents": {
26018
26504
  capName: "pipeline-analytics",
26019
26505
  capScope: "device",
@@ -26056,6 +26542,12 @@ Object.freeze({
26056
26542
  addonId: null,
26057
26543
  access: "view"
26058
26544
  },
26545
+ "pipelineAnalytics.listOpsLog": {
26546
+ capName: "pipeline-analytics",
26547
+ capScope: "device",
26548
+ addonId: null,
26549
+ access: "view"
26550
+ },
26059
26551
  "pipelineAnalytics.listRecentTracks": {
26060
26552
  capName: "pipeline-analytics",
26061
26553
  capScope: "device",
@@ -26068,6 +26560,12 @@ Object.freeze({
26068
26560
  addonId: null,
26069
26561
  access: "view"
26070
26562
  },
26563
+ "pipelineAnalytics.pruneEvents": {
26564
+ capName: "pipeline-analytics",
26565
+ capScope: "device",
26566
+ addonId: null,
26567
+ access: "create"
26568
+ },
26071
26569
  "pipelineAnalytics.pruneEventsBefore": {
26072
26570
  capName: "pipeline-analytics",
26073
26571
  capScope: "device",
@@ -26830,6 +27328,12 @@ Object.freeze({
26830
27328
  addonId: null,
26831
27329
  access: "create"
26832
27330
  },
27331
+ "recording.deleteFootprint": {
27332
+ capName: "recording",
27333
+ capScope: "system",
27334
+ addonId: null,
27335
+ access: "delete"
27336
+ },
26833
27337
  "recording.getAvailability": {
26834
27338
  capName: "recording",
26835
27339
  capScope: "system",
@@ -26860,6 +27364,12 @@ Object.freeze({
26860
27364
  addonId: null,
26861
27365
  access: "view"
26862
27366
  },
27367
+ "recording.listOpsLog": {
27368
+ capName: "recording",
27369
+ capScope: "system",
27370
+ addonId: null,
27371
+ access: "view"
27372
+ },
26863
27373
  "recording.locateSegment": {
26864
27374
  capName: "recording",
26865
27375
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-amcrest",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Amcrest/Dahua camera device provider addon for CamStack — Dahua CGI over HTTP(S) with digest auth (snapshot, RTSP catalog, PTZ, image/day-night config)",
5
5
  "keywords": [
6
6
  "camstack",