@camstack/addon-post-analysis 1.2.24 → 1.2.26

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.
@@ -20,7 +20,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
20
20
  enumerable: true
21
21
  }) : target, mod));
22
22
  //#endregion
23
- //#region ../types/dist/event-category-Bz24uP1U.mjs
23
+ //#region ../types/dist/event-category-41fKf-q9.mjs
24
24
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
25
25
  EventCategory["SystemBoot"] = "system.boot";
26
26
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -80,6 +80,26 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
80
80
  */
81
81
  EventCategory["AddonRetryScheduled"] = "addon.retry-scheduled";
82
82
  /**
83
+ * A liveness invariant of this node is false — it has no devices, every
84
+ * camera is offline, or a camera that was recording has stopped producing
85
+ * segments. Emitted by the `liveness-monitor` builtin, once per fault (the
86
+ * `findingId` is stable across ticks), only after its boot grace period.
87
+ * AlertCenter raises a persistent operator-visible alert.
88
+ *
89
+ * It exists because on 2026-08-03 the hub ran four hours with zero devices
90
+ * and zero recordings while every surface stayed quiet.
91
+ *
92
+ * Payload: `{ findingId, severity, title, message, deviceId? }`.
93
+ */
94
+ EventCategory["SystemLivenessFailed"] = "system.liveness-failed";
95
+ /**
96
+ * A previously reported liveness fault is true again. AlertCenter dismisses
97
+ * the matching `SystemLivenessFailed` alert.
98
+ *
99
+ * Payload: `{ findingId }`.
100
+ */
101
+ EventCategory["SystemLivenessRecovered"] = "system.liveness-recovered";
102
+ /**
83
103
  * Monitor is attempting to reload a failed addon NOW. UI uses this
84
104
  * to show a spinner during the retry attempt. Same transient nature
85
105
  * as AddonRetryScheduled.
@@ -8394,6 +8414,60 @@ function buildNcTaxonomy() {
8394
8414
  /** The frozen NC taxonomy, derived once from the taxonomy dictionary. */
8395
8415
  var NC_TAXONOMY = Object.freeze(buildNcTaxonomy());
8396
8416
  /**
8417
+ * Most specific first. Extending this list is how a new device kind becomes
8418
+ * gateable; nothing else needs to change.
8419
+ */
8420
+ var DEVICE_STATE_READERS = [
8421
+ {
8422
+ cap: "alarm-panel",
8423
+ field: "state"
8424
+ },
8425
+ {
8426
+ cap: "cover",
8427
+ field: "state"
8428
+ },
8429
+ {
8430
+ cap: "presence",
8431
+ field: "state"
8432
+ },
8433
+ {
8434
+ cap: "lock",
8435
+ field: "locked",
8436
+ booleanWords: ["locked", "unlocked"]
8437
+ },
8438
+ {
8439
+ cap: "contact",
8440
+ field: "entryOpen",
8441
+ booleanWords: ["open", "closed"]
8442
+ },
8443
+ {
8444
+ cap: "switch",
8445
+ field: "on",
8446
+ booleanWords: ["on", "off"]
8447
+ },
8448
+ {
8449
+ cap: "binary",
8450
+ field: "on",
8451
+ booleanWords: ["on", "off"]
8452
+ }
8453
+ ];
8454
+ /**
8455
+ * Collapse a device's full runtime state to the one string a rule compares
8456
+ * against, or `undefined` when nothing in the table applies.
8457
+ *
8458
+ * `undefined` is the safe answer everywhere: the gate treats it as "does not
8459
+ * match", so a device whose kind we cannot read simply never arms a rule.
8460
+ */
8461
+ function readDeviceStateFrom(runtimeState) {
8462
+ for (const reader of DEVICE_STATE_READERS) {
8463
+ const slice = runtimeState[reader.cap];
8464
+ if (slice === null || typeof slice !== "object") continue;
8465
+ const value = slice[reader.field];
8466
+ if (typeof value === "string" && value.length > 0) return value;
8467
+ if (typeof value === "boolean" && reader.booleanWords !== void 0) return value ? reader.booleanWords[0] : reader.booleanWords[1];
8468
+ }
8469
+ }
8470
+ /**
8397
8471
  * Error types for the safe expression engine. Two distinct classes so callers
8398
8472
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
8399
8473
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -9216,11 +9290,13 @@ var NcZoneConditionSchema = object({
9216
9290
  /** Quantifier over `ids` — at least one / every one visited. */
9217
9291
  match: _enum(["any", "all"]).default("any")
9218
9292
  });
9219
- /**
9220
- * The P1 condition set — a flat AND of groups; absent group = pass;
9221
- * membership lists are OR within the list (spec §2.3).
9222
- */
9223
9293
  var NcConditionsSchema = object({
9294
+ /** Gate on ANOTHER device's current state (the alarm armed, a switch on). */
9295
+ deviceState: object({
9296
+ deviceId: number().int(),
9297
+ /** Any of these matches. */
9298
+ states: array(string().min(1)).min(1)
9299
+ }).optional(),
9224
9300
  /** Device scope — absent = all devices. */
9225
9301
  devices: array(number()).optional(),
9226
9302
  /** Detector class names (any overlap with the record's class set). */
@@ -9421,6 +9497,14 @@ var NcMediaPolicySchema = object({
9421
9497
  clipPreRollSec: number().int().min(0).max(30).optional(),
9422
9498
  clipPostRollSec: number().int().min(0).max(30).optional(),
9423
9499
  /**
9500
+ * Playback rate of the attached gif / clip. Absent = 2x.
9501
+ *
9502
+ * A notification clip is GLANCED at on a lock screen, not watched: at real
9503
+ * time an eight-second passage is eight seconds of the recipient's attention
9504
+ * and twice the bytes. 1 is real time for the operator who wants it.
9505
+ */
9506
+ clipSpeed: number().min(1).max(8).optional(),
9507
+ /**
9424
9508
  * Which stream profile the footage is cut from. Absent = the CHEAPEST
9425
9509
  * assigned profile: a notification is watched on a phone, so the 4K
9426
9510
  * rendition would burn CPU to produce a file the client downscales anyway.
@@ -9492,7 +9576,21 @@ var NcRuleInputSchema = object({
9492
9576
  * behaviour, visible to all, read-only in the viewer). Present = personal
9493
9577
  * rule owned by this userId. Server-stamped; never trusted from a client.
9494
9578
  */
9495
- ownerUserId: string().optional()
9579
+ ownerUserId: string().optional(),
9580
+ /**
9581
+ * May a non-admin snooze this rule for EVERYONE, not just themselves?
9582
+ *
9583
+ * A snooze is personal by default — it silences the person who set it. This
9584
+ * opts THIS rule into the "the gardener is here all afternoon" case, where
9585
+ * silencing the camera for the whole household is legitimate. It silences
9586
+ * other people, so it is off unless a rule deliberately allows it.
9587
+ *
9588
+ * `.optional()`, deliberately NOT `.default()`: a Zod default does not run on
9589
+ * the addon cap path (three production failures in one day), so absent is
9590
+ * read as `false` by {@link canSetGlobal} in the engine. Admins are not bound
9591
+ * by this flag — see the scope rules on that function.
9592
+ */
9593
+ snoozeAllowGlobal: boolean().optional()
9496
9594
  });
9497
9595
  /**
9498
9596
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -9563,7 +9661,8 @@ var NcConditionDescriptorSchema = object({
9563
9661
  "packagePhase",
9564
9662
  "crossingSelect",
9565
9663
  "polygonDraw",
9566
- "occupancy"
9664
+ "occupancy",
9665
+ "deviceState"
9567
9666
  ]),
9568
9667
  operator: _enum([
9569
9668
  "in",
@@ -9577,7 +9676,28 @@ var NcConditionDescriptorSchema = object({
9577
9676
  /** Which delivery kinds the condition applies to. */
9578
9677
  appliesTo: array(NcDeliverySchema),
9579
9678
  phase: string(),
9580
- description: string().optional()
9679
+ description: string().optional(),
9680
+ /**
9681
+ * The CHOICES for a single-choice widget (`sourceSelect`, `crossingSelect`,
9682
+ * `packagePhase`, …), served with the descriptor.
9683
+ *
9684
+ * Before this the descriptor said which widget to render and not what to put
9685
+ * in it, so every option list lived in three places: this file's enums, the
9686
+ * admin's `NC_*_OPTIONS` and the viewer's `NC_*_VALUES`. That triple mirror
9687
+ * is the drift that emptied the viewer's rule editor on 2026-08-04 — the app
9688
+ * mirrors the cap by hand, so it is only ever as current as its last build.
9689
+ *
9690
+ * With the options on the wire, a condition of an EXISTING `valueType` costs
9691
+ * zero client changes. Clients keep a local fallback for an older hub that
9692
+ * does not send them; absent here is "use your own list", not "no choices".
9693
+ */
9694
+ options: array(object({
9695
+ /** Written to the rule verbatim. `''` means the ABSENT state. */
9696
+ value: string(),
9697
+ label: string(),
9698
+ /** What THIS choice matches — shown one at a time, under the control. */
9699
+ hint: string().optional()
9700
+ })).readonly().optional()
9581
9701
  });
9582
9702
  /**
9583
9703
  * The P1 condition surface as data — served by `getConditionCatalog` so
@@ -9671,6 +9791,28 @@ var NC_CONDITION_CATALOG = [
9671
9791
  group: "zones",
9672
9792
  label: "Zone crossing",
9673
9793
  valueType: "crossingSelect",
9794
+ options: [
9795
+ {
9796
+ value: "",
9797
+ label: "Not set — entering",
9798
+ hint: "Entries, and every detection that is not a crossing at all. Exits are excluded. This is what a rule without a crossing condition already does, and choosing it writes nothing to the rule."
9799
+ },
9800
+ {
9801
+ value: "enter",
9802
+ label: "Entered a zone",
9803
+ hint: "The same matches as \"not set\", stated explicitly: entries and non-crossing detections pass, exits do not."
9804
+ },
9805
+ {
9806
+ value: "exit",
9807
+ label: "Left a zone",
9808
+ hint: "ONLY an exit crossing. A detection that is not a crossing fails, so this rule cannot fire on ordinary movement — pair it with the zones the subject must have left. Also matches a tripwire crossed against its drawn direction."
9809
+ },
9810
+ {
9811
+ value: "any",
9812
+ label: "Entered or left",
9813
+ hint: "No direction filter: entries, exits and non-crossing detections alike. This is the only choice that adds exits to what the rule already matched."
9814
+ }
9815
+ ],
9674
9816
  operator: "in",
9675
9817
  appliesTo: ["immediate"],
9676
9818
  phase: "P1",
@@ -9751,6 +9893,24 @@ var NC_CONDITION_CATALOG = [
9751
9893
  group: "scope",
9752
9894
  label: "Detection source",
9753
9895
  valueType: "sourceSelect",
9896
+ options: [
9897
+ {
9898
+ value: "any",
9899
+ label: "Any source"
9900
+ },
9901
+ {
9902
+ value: "pipeline",
9903
+ label: "Pipeline"
9904
+ },
9905
+ {
9906
+ value: "onboard",
9907
+ label: "Onboard (camera)"
9908
+ },
9909
+ {
9910
+ value: "sensor",
9911
+ label: "Sensor"
9912
+ }
9913
+ ],
9754
9914
  operator: "in",
9755
9915
  appliesTo: [
9756
9916
  "immediate",
@@ -9761,6 +9921,21 @@ var NC_CONDITION_CATALOG = [
9761
9921
  phase: "P1",
9762
9922
  description: "pipeline / onboard / sensor; a record with no stamped source counts as pipeline."
9763
9923
  },
9924
+ {
9925
+ id: "deviceState",
9926
+ group: "scope",
9927
+ label: "Device state",
9928
+ valueType: "deviceState",
9929
+ operator: "in",
9930
+ appliesTo: [
9931
+ "immediate",
9932
+ "track-end",
9933
+ "device-event",
9934
+ "package-event"
9935
+ ],
9936
+ phase: "P2",
9937
+ description: "Only fire while another device is in one of the chosen states — the alarm armed, a switch on, a contact closed. A state that cannot be read does NOT fire."
9938
+ },
9764
9939
  {
9765
9940
  id: "sensorKinds",
9766
9941
  group: "device",
@@ -9786,6 +9961,20 @@ var NC_CONDITION_CATALOG = [
9786
9961
  group: "package",
9787
9962
  label: "Package phase",
9788
9963
  valueType: "packagePhase",
9964
+ options: [
9965
+ {
9966
+ value: "delivered",
9967
+ label: "Delivered"
9968
+ },
9969
+ {
9970
+ value: "picked-up",
9971
+ label: "Picked up"
9972
+ },
9973
+ {
9974
+ value: "both",
9975
+ label: "Both"
9976
+ }
9977
+ ],
9789
9978
  operator: "in",
9790
9979
  appliesTo: ["package-event"],
9791
9980
  phase: "P1",
@@ -9914,6 +10103,75 @@ var NcHistoryFilterSchema = object({
9914
10103
  until: number().optional(),
9915
10104
  limit: number().int().min(1).max(500).default(100)
9916
10105
  });
10106
+ /**
10107
+ * What a snooze covers. Broader scopes win when several overlap, so one window
10108
+ * leaves ONE digest rather than a rule snooze and a whole-feed snooze both
10109
+ * summarising the same silence.
10110
+ */
10111
+ var NcSnoozeScopeSchema = _enum([
10112
+ "rule",
10113
+ "device",
10114
+ "all"
10115
+ ]);
10116
+ /**
10117
+ * Client-authored snooze. The server stamps `userId`, `startedAt` and
10118
+ * `expiresAt` — a DURATION is sent rather than an instant so a client with a
10119
+ * skewed clock cannot author a window that is already over, or never ends.
10120
+ */
10121
+ var NcSnoozeInputSchema = object({
10122
+ scope: NcSnoozeScopeSchema,
10123
+ /** Required when `scope: 'rule'` — a scoped snooze with no id matches
10124
+ * NOTHING rather than degrading to "everything". */
10125
+ ruleId: string().optional(),
10126
+ /** Required when `scope: 'device'`. */
10127
+ deviceId: number().int().optional(),
10128
+ durationMinutes: number().int().min(1).max(1440),
10129
+ /**
10130
+ * Silence this for EVERY recipient, not just the caller. Permission is
10131
+ * checked server-side (the rule's `snoozeAllowGlobal`, or admin for the
10132
+ * broader scopes). Absent = personal.
10133
+ */
10134
+ global: boolean().optional(),
10135
+ /**
10136
+ * Deliver a summary of what was suppressed when the window ends. Absent =
10137
+ * ON: someone silencing a nuisance camera wants it off, someone silencing a
10138
+ * SECURITY camera wants to know what they missed, and choosing "off" for
10139
+ * everybody is how a snooze becomes an outage. Resolved to a concrete
10140
+ * boolean by the server at create time — never left to a Zod default, which
10141
+ * does not run on the addon cap path.
10142
+ */
10143
+ summary: boolean().optional()
10144
+ });
10145
+ /** A persisted snooze window. */
10146
+ var NcSnoozeSchema = object({
10147
+ id: string(),
10148
+ /** Who set it. Also who it silences, unless `global`. */
10149
+ userId: string(),
10150
+ scope: NcSnoozeScopeSchema,
10151
+ ruleId: string().optional(),
10152
+ deviceId: number().int().optional(),
10153
+ startedAt: number(),
10154
+ /** Exclusive: at exactly this instant the snooze is over. Expiry is a
10155
+ * COMPARISON, not a job — no sweeper can leave the operator silenced. */
10156
+ expiresAt: number(),
10157
+ global: boolean(),
10158
+ summary: boolean(),
10159
+ /** When the end-of-window digest went out. Absent = not sent (yet, or the
10160
+ * window has not closed, or `summary` is false). */
10161
+ digestSentAt: number().optional()
10162
+ });
10163
+ /** One line of an end-of-window digest: what one rule hid on one camera. */
10164
+ var NcSnoozeSuppressedSchema = object({
10165
+ snoozeId: string(),
10166
+ targetId: string(),
10167
+ ruleId: string(),
10168
+ ruleName: string(),
10169
+ deviceId: number().int(),
10170
+ /** How many notifications this snooze hid for that pair. */
10171
+ count: number().int(),
10172
+ firstAt: number(),
10173
+ lastAt: number()
10174
+ });
9917
10175
  var notificationRulesCapability = {
9918
10176
  name: "notification-rules",
9919
10177
  scope: "system",
@@ -9980,7 +10238,36 @@ var notificationRulesCapability = {
9980
10238
  * P1 (no user dimension); the P2 viewer History screen adds per-caller
9981
10239
  * scoping on the same method.
9982
10240
  */
9983
- getHistory: method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" })
10241
+ getHistory: method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }),
10242
+ /**
10243
+ * Snooze windows currently in effect, plus any whose digest has not yet
10244
+ * gone out. `caller: 'required'`: a user sees their OWN windows and the
10245
+ * global ones that silence them, never another person's private silence.
10246
+ * An admin sees every window — a household-wide silence is exactly the
10247
+ * thing an operator has to be able to find and cancel.
10248
+ */
10249
+ listSnoozes: method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }),
10250
+ /**
10251
+ * Open a window. `userId` is stamped from the caller; a GLOBAL window is
10252
+ * permission-checked server-side (the rule's `snoozeAllowGlobal` for a
10253
+ * rule-scoped one, admin for a camera or the whole feed) — a client asking
10254
+ * for one it may not have is rejected, never silently downgraded, because
10255
+ * a snooze the operator believes is in effect and is not is the same
10256
+ * failure as one they cannot end.
10257
+ */
10258
+ createSnooze: method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
10259
+ kind: "mutation",
10260
+ caller: "required"
10261
+ }),
10262
+ /**
10263
+ * End a window NOW. The digest still goes out (what was hidden while it
10264
+ * was open is still what the operator missed); only the silence stops.
10265
+ * A user may cancel their own; an admin may cancel any.
10266
+ */
10267
+ cancelSnooze: method(object({ snoozeId: string() }), object({ success: literal(true) }), {
10268
+ kind: "mutation",
10269
+ caller: "required"
10270
+ })
9984
10271
  }
9985
10272
  };
9986
10273
  /**
@@ -10760,7 +11047,15 @@ method(object({
10760
11047
  format: _enum(["gif", "mp4"]).default("gif"),
10761
11048
  maxWidth: number().int().min(120).max(1920).default(480),
10762
11049
  /** GIF only — MP4 keeps the source cadence. */
10763
- fps: number().int().min(1).max(15).default(5)
11050
+ fps: number().int().min(1).max(15).default(5),
11051
+ /**
11052
+ * Playback rate. A notification clip is GLANCED at on a lock screen,
11053
+ * not watched, so 2x is the default: the recipient sees the whole
11054
+ * passage in half the time and the GIF is half the bytes. `1` is real
11055
+ * time. Applies to MP4 as well — the operator set a speed, not a GIF
11056
+ * speed.
11057
+ */
11058
+ speed: number().min(1).max(8).default(2)
10764
11059
  }), object({
10765
11060
  base64: string(),
10766
11061
  mime: string(),
@@ -25159,12 +25454,24 @@ Object.freeze({
25159
25454
  addonId: null,
25160
25455
  access: "create"
25161
25456
  },
25457
+ "notificationRules.cancelSnooze": {
25458
+ capName: "notification-rules",
25459
+ capScope: "system",
25460
+ addonId: null,
25461
+ access: "create"
25462
+ },
25162
25463
  "notificationRules.createRule": {
25163
25464
  capName: "notification-rules",
25164
25465
  capScope: "system",
25165
25466
  addonId: null,
25166
25467
  access: "create"
25167
25468
  },
25469
+ "notificationRules.createSnooze": {
25470
+ capName: "notification-rules",
25471
+ capScope: "system",
25472
+ addonId: null,
25473
+ access: "create"
25474
+ },
25168
25475
  "notificationRules.deleteRule": {
25169
25476
  capName: "notification-rules",
25170
25477
  capScope: "system",
@@ -25195,6 +25502,12 @@ Object.freeze({
25195
25502
  addonId: null,
25196
25503
  access: "view"
25197
25504
  },
25505
+ "notificationRules.listSnoozes": {
25506
+ capName: "notification-rules",
25507
+ capScope: "system",
25508
+ addonId: null,
25509
+ access: "view"
25510
+ },
25198
25511
  "notificationRules.setRuleEnabled": {
25199
25512
  capName: "notification-rules",
25200
25513
  capScope: "system",
@@ -27600,6 +27913,24 @@ Object.defineProperty(exports, "NcRuleSchema", {
27600
27913
  return NcRuleSchema;
27601
27914
  }
27602
27915
  });
27916
+ Object.defineProperty(exports, "NcSnoozeInputSchema", {
27917
+ enumerable: true,
27918
+ get: function() {
27919
+ return NcSnoozeInputSchema;
27920
+ }
27921
+ });
27922
+ Object.defineProperty(exports, "NcSnoozeSchema", {
27923
+ enumerable: true,
27924
+ get: function() {
27925
+ return NcSnoozeSchema;
27926
+ }
27927
+ });
27928
+ Object.defineProperty(exports, "NcSnoozeSuppressedSchema", {
27929
+ enumerable: true,
27930
+ get: function() {
27931
+ return NcSnoozeSuppressedSchema;
27932
+ }
27933
+ });
27603
27934
  Object.defineProperty(exports, "NcTaxonomySchema", {
27604
27935
  enumerable: true,
27605
27936
  get: function() {
@@ -27762,6 +28093,12 @@ Object.defineProperty(exports, "plateGalleryCapability", {
27762
28093
  return plateGalleryCapability;
27763
28094
  }
27764
28095
  });
28096
+ Object.defineProperty(exports, "readDeviceStateFrom", {
28097
+ enumerable: true,
28098
+ get: function() {
28099
+ return readDeviceStateFrom;
28100
+ }
28101
+ });
27765
28102
  Object.defineProperty(exports, "string", {
27766
28103
  enumerable: true,
27767
28104
  get: function() {