@camstack/addon-osd-manager 0.1.152 → 0.1.154

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.
Files changed (18) hide show
  1. package/dist/{MotionZonesSettings-D5c6b4QP.mjs → MotionZonesSettings-DHyaxzBi.mjs} +2 -2
  2. package/dist/{PrivacyMaskSettings-DMve7K-c.mjs → PrivacyMaskSettings-D7EH_wl3.mjs} +4 -4
  3. package/dist/{SceneMonitorEditor-e1z_C79o.mjs → SceneMonitorEditor-CO6VwdkE.mjs} +3 -3
  4. package/dist/_stub.js +2352 -2351
  5. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-C8rKpVdZ.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-Cj3lK2is.mjs} +3 -3
  6. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-1qxETV_o.mjs +26 -0
  7. package/dist/{hostInit-B8_o5hJj.mjs → hostInit-CE3gFb67.mjs} +2 -2
  8. package/dist/index.js +302 -196
  9. package/dist/index.mjs +302 -196
  10. package/dist/{player-overlays-BchlNvHO.mjs → player-overlays-CTsQBdl8.mjs} +1 -1
  11. package/dist/remoteEntry.js +1 -1
  12. package/dist/{responsive-DRZ6VoYV.mjs → responsive-BPw6Y2I0.mjs} +1 -1
  13. package/dist/{scene-monitor-copy-CmtMsrJb.mjs → scene-monitor-copy-DNkKk6vF.mjs} +1 -1
  14. package/dist/{square-BYLYL5VB.mjs → square-BPzhX8Pc.mjs} +1 -1
  15. package/dist/{trash-2-BdEqSrHt.mjs → trash-2-DemFUbcB.mjs} +1 -1
  16. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-p2S4DkBF.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-BLAGk27g.mjs} +1 -1
  17. package/package.json +1 -1
  18. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DQC5oc2I.mjs +0 -26
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- //#region ../types/dist/event-category-C5xZWqz6.mjs
5
+ //#region ../types/dist/event-category-BGmz_oxW.mjs
6
6
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
7
7
  EventCategory["SystemBoot"] = "system.boot";
8
8
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -535,6 +535,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
535
535
  */
536
536
  EventCategory["PipelineAudioInferenceResult"] = "pipeline.audio-inference-result";
537
537
  EventCategory["DetectionPhaseTransition"] = "detection.phase-transition";
538
+ /**
539
+ * A camera provider's RAW onboard motion push (D673): the `MotionOnMotionChanged`
540
+ * data shape without `triggeredBy`, built by `providerMotionEvent`. Its one
541
+ * consumer is the orchestrator's camera-sensors bridge, which re-emits the
542
+ * camera's EFFECTIVE onboard motion as `MotionOnMotionChanged` (a pass-through
543
+ * for a camera with no attached sensor). Providers must not emit
544
+ * `MotionOnMotionChanged` themselves; `scripts/check-onboard-motion-emitters.ts`
545
+ * keeps it so (camera-grid is a named, deferred exception).
546
+ */
538
547
  EventCategory["ProviderMotion"] = "provider.motion";
539
548
  EventCategory["ProviderDetection"] = "provider.detection";
540
549
  EventCategory["EnrichmentEmbeddingStored"] = "enrichment.embedding.stored";
@@ -5373,7 +5382,7 @@ var ZodIssueCode = {
5373
5382
  var ZodFirstPartyTypeKind;
5374
5383
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5375
5384
  //#endregion
5376
- //#region ../types/dist/sleep-gU6hqv4_.mjs
5385
+ //#region ../types/dist/sleep-CDCONfkt.mjs
5377
5386
  /**
5378
5387
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5379
5388
  * window to float samples (D455).
@@ -7514,7 +7523,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7514
7523
  return DeviceRole;
7515
7524
  }({});
7516
7525
  //#endregion
7517
- //#region ../types/dist/composition-Dq42XWp0.mjs
7526
+ //#region ../types/dist/composition-43aqsZQj.mjs
7518
7527
  /**
7519
7528
  * The ffmpeg build every CamStack node downloads, per platform and arch.
7520
7529
  *
@@ -7571,13 +7580,12 @@ portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac
7571
7580
  * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
7572
7581
  * valutatore puro del suo FRONTE.
7573
7582
  *
7574
- * Viveva dentro il builtin virtual-doorbell
7575
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
7576
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
7577
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
7578
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
7579
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
7580
- * SPOSTA qui e il doorbell la ri-esporta.
7583
+ * UNA tabella per tutti quelli che chiedono "questo device è ALTO?": il
7584
+ * trigger `RecordingTriggers.sensorDeviceIds` del recorder, i marker dei
7585
+ * sensori della post-analysis, il bridge camera-sensors dell'orchestratore e
7586
+ * le sorgenti di un campanello composto (`doorbellFeatureSources`, D671).
7587
+ * Una seconda copia divergerebbe alla prima cap aggiunta, e il sintomo — "il
7588
+ * sensore fa suonare il campanello ma non registra" — è esattamente D62.
7581
7589
  *
7582
7590
  * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
7583
7591
  * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
@@ -7603,8 +7611,6 @@ var SOURCE_CAP_ACTIVE_FIELD = {
7603
7611
  vibration: "detected",
7604
7612
  tamper: "tampered"
7605
7613
  };
7606
- /** Cap names whose presence in a device's bindings qualify it as a source. */
7607
- var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
7608
7614
  /**
7609
7615
  * Error types for the safe expression engine. Two distinct classes so callers
7610
7616
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
@@ -9314,7 +9320,7 @@ var RecordingTriggersSchema = object({
9314
9320
  *
9315
9321
  * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
9316
9322
  * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
9317
- * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
9323
+ * la stessa del campanello composto (D671). Ed è il FRONTE, non
9318
9324
  * il livello: un contatto trovato già aperto al riavvio del runner non fa
9319
9325
  * registrare.
9320
9326
  */
@@ -17198,8 +17204,8 @@ var deviceManagerCapability = {
17198
17204
  * (`value` / `missing` / `failed`, see {@link WrapperActivationReadSchema}).
17199
17205
  *
17200
17206
  * The narrow read of the durable authority behind `getBindings`: a
17201
- * consumer that must know what the operator PERSISTED (virtual-doorbell,
17202
- * before it drops a press) asks this instead of pulling device-manager's
17207
+ * consumer that must know what the operator PERSISTED (before it drops
17208
+ * work on the strength of an unbind) asks this instead of pulling device-manager's
17203
17209
  * whole addon store through `addonSettingsRaw.getGlobal` — which answered
17204
17210
  * `{}` on every isolated-engine hub and so never worked (D675). It reads
17205
17211
  * ONE row (the activation map, ~1.6 KB), never the ~625 KB store.
@@ -17489,109 +17495,10 @@ var deviceManagerCapability = {
17489
17495
  }), record(string(), record(string(), unknown().nullable())))
17490
17496
  }
17491
17497
  };
17492
- /**
17493
- * Doorbell button cap. Two kinds of providers coexist behind this cap
17494
- * name (same pattern as `snapshot`):
17495
- *
17496
- * - **Native** providers: registered per-device by device-driver
17497
- * addons via `ctx.registerNativeCap` — either on a
17498
- * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
17499
- * or directly on the camera (Reolink registers at camera level).
17500
- * Emits an `onPressed` event every time the firmware pushes a
17501
- * ring; status tracks the last press and a pressCount since start
17502
- * (diagnostic).
17503
- *
17504
- * - **Wrapper** provider: the `virtual-doorbell` system builtin
17505
- * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
17506
- * device (contact / switch / event-emitter …) into a doorbell for
17507
- * a camera. `defaultActive: false` — the operator explicitly binds
17508
- * it per camera in the device-bindings UI, then picks the source
17509
- * device + trigger in the per-device settings.
17510
- *
17511
- * The DeviceEventPropagator re-emits `onPressed` on the camera parent
17512
- * — subscribers listening at the camera level receive ring events
17513
- * with `via[]` populated. No code on the parent needed.
17514
- */
17515
- var DoorbellStatusSchema = object({
17516
- /** Ms epoch of the last press. null = never observed since this provider started. */
17517
- lastPressedAt: number().nullable(),
17518
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
17519
- pressCountSinceStart: number()
17520
- });
17521
- var DoorbellPressEventSchema = object({
17522
- deviceId: number(),
17523
- timestamp: number()
17524
- });
17525
- /**
17526
- * The `doorbell-source` extension slot's editable value (D648): the camera's
17527
- * virtual-doorbell trigger devices, exactly what the wrapper's
17528
- * `doorbellSources` persists (as `{ deviceId }` records).
17529
- */
17530
- var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
17531
- /**
17532
- * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
17533
- * doorbell, owned by the `virtual-doorbell` wrapper over its
17534
- * `doorbellSources` store (D648). A source rings when one of its
17535
- * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
17536
- * different authority (`deviceManager.setWrapperActive`, D62) — the slot
17537
- * reports it, it never writes it.
17538
- */
17539
- var DOORBELL_SOURCE_SLOT = {
17540
- id: "doorbell-source",
17541
- label: "Doorbell trigger devices",
17542
- description: "Any of these becoming active rings this camera's virtual doorbell: a binary sensor when it goes active, a switch when it turns on.",
17543
- shape: "association",
17544
- hostDeviceTypes: [DeviceType.Camera],
17545
- sourceCaps: SOURCE_CAPS,
17546
- cardinality: "many",
17547
- value: DoorbellSourceSlotValueSchema
17548
- };
17549
- var doorbellCapability = {
17550
- name: "doorbell",
17551
- scope: "device",
17552
- deviceNative: true,
17553
- mode: "singleton",
17554
- kind: "wrapper",
17555
- defaultActive: false,
17556
- deviceTypes: [DeviceType.Button, DeviceType.Camera],
17557
- extensionSlots: [DOORBELL_SOURCE_SLOT],
17558
- methods: {},
17559
- events: {
17560
- /**
17561
- * Fires once per physical press. Reolink delivers via Baichuan
17562
- * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
17563
- * release/duration — it's a pulse.
17564
- */
17565
- onPressed: {
17566
- data: DoorbellPressEventSchema,
17567
- fromState: {
17568
- field: "lastPressedAt",
17569
- on: "advance"
17570
- }
17571
- } },
17572
- status: {
17573
- schema: DoorbellStatusSchema,
17574
- kind: "push"
17575
- },
17576
- /**
17577
- * Runtime-state slice — last press timestamp + lifetime press count.
17578
- * Mirrored by the kernel and readable via
17579
- * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
17580
- * without subscribing.
17581
- */
17582
- runtimeState: DoorbellStatusSchema,
17583
- /**
17584
- * Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
17585
- *
17586
- * See `RuntimeStateDurability`. Enforced by
17587
- * `scripts/check-runtime-state-durability.ts`.
17588
- */
17589
- durability: "restored"
17590
- };
17591
- var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
17592
- DeviceType.Camera, DeviceType.Camera;
17498
+ var ExtensionSlotIdSchema = _enum(["linked-devices"]);
17499
+ DeviceType.Camera;
17593
17500
  /** A slot's editable value, discriminated on `slot`. */
17594
- var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
17501
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
17595
17502
  /** Every device type at least one slot is offered on — `device-extension`'s `deviceTypes`. */
17596
17503
  var EXTENSION_HOST_DEVICE_TYPES = [DeviceType.Camera];
17597
17504
  var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
@@ -17629,10 +17536,11 @@ var ExtensionSlotSourceSchema = object({
17629
17536
  });
17630
17537
  /**
17631
17538
  * A DIFFERENT authority that gates whether the slot's sources do anything —
17632
- * reported read-only, named, never written through this contract (D62). The
17633
- * virtual doorbell's sources ring only while the wrapper is bound to the
17634
- * camera, and that binding belongs to `deviceManager.setWrapperActive`.
17635
- * `unknown` means the gate could not be read; it is not "inactive" (D315).
17539
+ * reported read-only, named, never written through this contract (D62) — e.g.
17540
+ * a slot whose sources act only while a wrapper is bound to the host, a
17541
+ * binding that belongs to `deviceManager.setWrapperActive`. No slot reports
17542
+ * one today (`linked-devices` answers `null`). `unknown` means the gate could
17543
+ * not be read; it is not "inactive" (D315).
17636
17544
  */
17637
17545
  var ExtensionSlotActivationSchema = object({
17638
17546
  state: _enum([
@@ -17648,7 +17556,7 @@ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
17648
17556
  /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
17649
17557
  slotRef: string(),
17650
17558
  slot: ExtensionSlotIdSchema,
17651
- /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
17559
+ /** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
17652
17560
  authority: string(),
17653
17561
  activation: ExtensionSlotActivationSchema.nullable(),
17654
17562
  value: ExtensionSlotValueSchema,
@@ -17833,8 +17741,8 @@ var deviceStateCapability = {
17833
17741
  * Canonical cross-layer WRITE for one cap-keyed slice. Used by
17834
17742
  * everyone who needs to publish runtime state for a device:
17835
17743
  * device providers (via `BaseDevice.runtimeState.setCapState`
17836
- * which delegates here), system-scope addons (e.g. the pipeline
17837
- * runner writing the `motion` slice on phase transitions), and
17744
+ * which delegates here), system-scope addons (e.g. the orchestrator
17745
+ * writing a camera's effective `motion` slice, D696), and
17838
17746
  * direct cap-router callers in tests.
17839
17747
  *
17840
17748
  * Behavior on the hub:
@@ -23216,6 +23124,29 @@ object({
23216
23124
  firstAt: number(),
23217
23125
  lastAt: number()
23218
23126
  });
23127
+ var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
23128
+ var NcAlarmDelaySecSchema = number().int().min(0).max(600);
23129
+ var NcAlarmTriggeredSecSchema = number().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
23130
+ var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
23131
+ var NcAlarmModeDelaysListSchema = array(object({
23132
+ mode: AlarmArmModeSchema,
23133
+ exitDelaySec: NcAlarmDelaySecSchema.optional(),
23134
+ entryDelaySec: NcAlarmDelaySecSchema.optional(),
23135
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.optional()
23136
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
23137
+ var NcAlarmModeDelaysEditListSchema = array(object({
23138
+ mode: AlarmArmModeSchema,
23139
+ exitDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
23140
+ entryDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
23141
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.nullable().optional()
23142
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
23143
+ /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
23144
+ var NcAlarmNonBlockingEditSchema = object({
23145
+ mode: AlarmArmModeSchema,
23146
+ deviceId: number().int().positive(),
23147
+ /** true = on the list (may be open, does not block); false = off the list (blocks). */
23148
+ nonBlocking: boolean()
23149
+ });
23219
23150
  /**
23220
23151
  * The per-mode lists, at most one per mode. Two lists for one mode have no
23221
23152
  * meaning a reader could agree on (union? the last one?), so they are refused
@@ -23224,10 +23155,10 @@ object({
23224
23155
  var NcAlarmNonBlockingListSchema = array(object({
23225
23156
  mode: AlarmArmModeSchema,
23226
23157
  deviceIds: array(number().int()).max(200)
23227
- })).max(8).refine((lists) => new Set(lists.map((l) => l.mode)).size === lists.length, { message: "nonBlocking: at most one list per arm mode" });
23158
+ })).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
23228
23159
  /**
23229
- * The three durations the panel's state machine runs on, who hears about its
23230
- * transitions, and which openings each mode tolerates.
23160
+ * The three durations — global, and per mode since D697 — the panel's state
23161
+ * machine runs on, who hears about its transitions, and which openings each mode tolerates.
23231
23162
  *
23232
23163
  * They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
23233
23164
  * `alarm-panel` is `deviceNative` and its other provider mirrors somebody
@@ -23237,15 +23168,15 @@ var NcAlarmNonBlockingListSchema = array(object({
23237
23168
  */
23238
23169
  var NcAlarmSettingsSchema = object({
23239
23170
  /** Grace period between arming and the mode taking effect. 0 = immediate. */
23240
- exitDelaySec: number().int().min(0).max(600),
23171
+ exitDelaySec: NcAlarmDelaySecSchema,
23241
23172
  /** Grace period between a trigger and the alarm firing. 0 = immediate. */
23242
- entryDelaySec: number().int().min(0).max(600),
23173
+ entryDelaySec: NcAlarmDelaySecSchema,
23243
23174
  /**
23244
23175
  * How long `triggered` lasts before the panel re-arms itself.
23245
23176
  * **0 = until an operator disarms it** — the behaviour before this field
23246
23177
  * existed, and therefore what an untouched install keeps doing.
23247
23178
  */
23248
- triggeredDurationSec: number().int().min(0).max(3600),
23179
+ triggeredDurationSec: NcAlarmTriggeredSecSchema,
23249
23180
  /**
23250
23181
  * Deprecated by D630 — every transition is announced. Parsed, never read;
23251
23182
  * remove after one release. Optional so an older admin's patch (which still
@@ -23268,17 +23199,30 @@ var NcAlarmSettingsSchema = object({
23268
23199
  * per mode is meaningful. Defaulted to `[]` so a blob stored before D630
23269
23200
  * parses as "every opening blocks" — the behaviour it was written under.
23270
23201
  */
23271
- nonBlocking: NcAlarmNonBlockingListSchema.default([])
23202
+ nonBlocking: NcAlarmNonBlockingListSchema.default([]),
23203
+ /**
23204
+ * Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
23205
+ * without a field, uses the global value above — so `[]`, the default, is exactly the
23206
+ * behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
23207
+ */
23208
+ modeDelays: NcAlarmModeDelaysListSchema.default([])
23272
23209
  });
23273
23210
  /**
23274
23211
  * Every field optional — a tab edits one control at a time.
23275
23212
  *
23276
- * `nonBlocking` is re-declared WITHOUT its default: `.partial()` does not
23277
- * remove an inner `.default()`, so a patch that never named the field would
23278
- * parse to `nonBlocking: []` and wipe every mode's list on an unrelated edit
23279
- * (the same trap {@link NcRulePatchSchema} documents).
23213
+ * `nonBlocking` and `modeDelays` are re-declared WITHOUT their defaults:
23214
+ * `.partial()` does not remove an inner `.default()`, so a patch that never
23215
+ * named the field would parse to `[]` and wipe every mode's list on an
23216
+ * unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
23217
+ * `modeDelays` means EDITS, not the stored overrides.
23280
23218
  */
23281
- var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({ nonBlocking: NcAlarmNonBlockingListSchema }).partial();
23219
+ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
23220
+ nonBlocking: NcAlarmNonBlockingListSchema,
23221
+ /** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
23222
+ modeDelays: NcAlarmModeDelaysEditListSchema,
23223
+ /** ONE membership change; the panel applies it to the list it holds at its turn. */
23224
+ nonBlockingEdit: NcAlarmNonBlockingEditSchema
23225
+ }).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" });
23282
23226
  /**
23283
23227
  * What one arm mode actually arms, DERIVED from the enabled rules gated on it.
23284
23228
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
@@ -23378,6 +23322,28 @@ var NcAlarmConfigSchema = object({
23378
23322
  */
23379
23323
  live: NcAlarmLiveSchema.optional()
23380
23324
  });
23325
+ var NcAlarmSensorReadingSchema = _enum([
23326
+ "open",
23327
+ "closed",
23328
+ "unknown",
23329
+ "not-opening"
23330
+ ]);
23331
+ /** One device's state as the alarm reads it — the classifier the arm check uses. */
23332
+ var NcAlarmSensorStateSchema = object({
23333
+ deviceId: number().int().positive(),
23334
+ reading: NcAlarmSensorReadingSchema,
23335
+ /** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
23336
+ state: string().nullable(),
23337
+ /** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
23338
+ unknownWhy: _enum(["read-failed", "unknown-word"]).nullable(),
23339
+ /** The device manager's liveness as the centre mirrors it; null = not known. */
23340
+ online: boolean().nullable()
23341
+ });
23342
+ var NcAlarmSensorsInputSchema = object({ deviceIds: array(number().int().positive()).max(500) });
23343
+ var NcAlarmSensorsSchema = object({
23344
+ sensors: array(NcAlarmSensorStateSchema),
23345
+ readAt: number().int().nonnegative()
23346
+ });
23381
23347
  /**
23382
23348
  * ONE rule's demand on ONE camera's clip ring.
23383
23349
  *
@@ -23619,8 +23585,9 @@ var notificationRulesCapability = {
23619
23585
  */
23620
23586
  getAlarmConfig: method(object({}), NcAlarmConfigSchema, { auth: "admin" }),
23621
23587
  /**
23622
- * Patch the settings (durations, recipients, per-mode non-blocking lists;
23623
- * `announceArm` is accepted and ignored — D630). Returns the WHOLE config,
23588
+ * Patch the settings (durations — global and per mode —, recipients,
23589
+ * per-mode non-blocking lists or one membership edit; `announceArm` is
23590
+ * accepted and ignored — D630). Returns the WHOLE config,
23624
23591
  * coverage and `live` included, so a
23625
23592
  * client never has to guess what the server settled on — the panel clamps
23626
23593
  * and normalises, and a form that re-rendered from its own input would
@@ -23629,7 +23596,15 @@ var notificationRulesCapability = {
23629
23596
  setAlarmConfig: method(object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
23630
23597
  kind: "mutation",
23631
23598
  auth: "admin"
23632
- })
23599
+ }),
23600
+ /**
23601
+ * The CURRENT state of each asked device as the alarm reads it (D697) — open, closed,
23602
+ * unknown (why) or not an opening, plus liveness. Classified by the same table the arm
23603
+ * check uses (`alarm-openings.ts`), so the editor and the arm can never disagree. The
23604
+ * caller names the ids (the household openings it already holds); at most
23605
+ * `NC_ALARM_SENSORS_MAX`.
23606
+ */
23607
+ getAlarmSensors: method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" })
23633
23608
  }
23634
23609
  };
23635
23610
  /**
@@ -23994,12 +23969,26 @@ var CameraSensorRefSchema = object({
23994
23969
  function cameraSensorRefKey(ref) {
23995
23970
  return `${ref.addonId}/${ref.stableId}`;
23996
23971
  }
23997
- /** CS-1 accepts exactly one mode; CS-2 (D673) widens it to confirm / replace. */
23998
- var CameraSensorsModeSchema = _enum(["in-addition"]);
23999
- var CameraSensorsConfigSchema = object({
24000
- mode: CameraSensorsModeSchema,
24001
- sensors: array(CameraSensorRefSchema).min(1).max(8)
24002
- }).superRefine((value, ctx) => {
23972
+ /**
23973
+ * A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
23974
+ * `replace`: its motion is the camera's, and while one is READY the camera's
23975
+ * own motion no longer counts on its own. `confirm`: while one is READY the
23976
+ * camera's own motion counts only while a confirm sensor is active — with or
23977
+ * without a replace sensor (spec C2, the controller's ruling on Q1).
23978
+ */
23979
+ var CameraSensorModeSchema = _enum([
23980
+ "in-addition",
23981
+ "confirm",
23982
+ "replace"
23983
+ ]);
23984
+ /** A stored sensor with no mode — every CS-1 row — is in addition. */
23985
+ var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
23986
+ /**
23987
+ * A camera's attached sensors. A CS-1 row carried an envelope
23988
+ * `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
23989
+ * what the write stores (D672 rule 3), so it is never written again.
23990
+ */
23991
+ var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
24003
23992
  const seen = /* @__PURE__ */ new Set();
24004
23993
  value.sensors.forEach((ref, index) => {
24005
23994
  const key = cameraSensorRefKey(ref);
@@ -24011,39 +24000,41 @@ var CameraSensorsConfigSchema = object({
24011
24000
  seen.add(key);
24012
24001
  });
24013
24002
  });
24014
- var RefFields = {
24003
+ /** Every attachment names its mode; an older orchestrator that does not is in addition. */
24004
+ var AttachmentFields = {
24015
24005
  addonId: string(),
24016
- stableId: string()
24006
+ stableId: string(),
24007
+ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
24017
24008
  };
24018
24009
  var CameraSensorAttachmentSchema = discriminatedUnion("state", [
24019
24010
  object({
24020
- ...RefFields,
24011
+ ...AttachmentFields,
24021
24012
  state: literal("ready"),
24022
24013
  deviceId: number(),
24023
24014
  name: string(),
24024
24015
  caps: array(string()).readonly()
24025
24016
  }),
24026
24017
  object({
24027
- ...RefFields,
24018
+ ...AttachmentFields,
24028
24019
  state: literal("offline"),
24029
24020
  deviceId: number(),
24030
24021
  name: string(),
24031
24022
  reason: _enum(["offline", "disabled"])
24032
24023
  }),
24033
24024
  object({
24034
- ...RefFields,
24025
+ ...AttachmentFields,
24035
24026
  state: literal("missing"),
24036
24027
  reason: string()
24037
24028
  }),
24038
24029
  object({
24039
- ...RefFields,
24030
+ ...AttachmentFields,
24040
24031
  state: literal("unsupported"),
24041
24032
  deviceId: number(),
24042
24033
  name: string(),
24043
24034
  reason: string()
24044
24035
  }),
24045
24036
  object({
24046
- ...RefFields,
24037
+ ...AttachmentFields,
24047
24038
  state: literal("unreadable"),
24048
24039
  reason: string()
24049
24040
  })
@@ -24056,17 +24047,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
24056
24047
  * say.
24057
24048
  */
24058
24049
  var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
24050
+ /** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
24051
+ var CameraOwnMotionSchema = _enum([
24052
+ "always",
24053
+ "when-confirmed",
24054
+ "never"
24055
+ ]);
24056
+ /** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
24057
+ var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
24058
+ /**
24059
+ * The camera's OWN onboard motion (D696): the raw input the bridge combines,
24060
+ * never the effective value. The camera's `motion` slice is the effective one,
24061
+ * so a view of the camera's own row reads this.
24062
+ * - `atMs`: when the bridge received the camera's last own edge.
24063
+ * - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
24064
+ * AND it is younger than the window the bridge counts the camera's own motion
24065
+ * for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
24066
+ * sends a clear (heartbeats only) therefore reads `false` once no push came
24067
+ * within the window; a status read is a snapshot, so a live view re-asks.
24068
+ * Absent = this orchestrator has not received the camera's own motion since it
24069
+ * started (unknown, never "quiet"), or an orchestrator older than D696.
24070
+ */
24071
+ var CameraRawLevelSchema = object({
24072
+ detected: boolean(),
24073
+ atMs: number()
24074
+ });
24059
24075
  var CameraSensorsStatusSchema = discriminatedUnion("state", [
24060
- object({ state: literal("not-configured") }),
24076
+ object({
24077
+ state: literal("not-configured"),
24078
+ cameraLevel: CameraRawLevelSchema.optional()
24079
+ }),
24061
24080
  object({
24062
24081
  state: literal("unreadable"),
24063
- reason: string()
24082
+ reason: string(),
24083
+ cameraLevel: CameraRawLevelSchema.optional()
24064
24084
  }),
24065
24085
  object({
24066
24086
  state: literal("configured"),
24067
- mode: CameraSensorsModeSchema,
24087
+ cameraLevel: CameraRawLevelSchema.optional(),
24068
24088
  sensors: array(CameraSensorAttachmentSchema).readonly(),
24069
- notForwarded: CameraSensorsNotForwardedSchema.optional()
24089
+ /** Absent = an orchestrator older than CS-2: it does not say (D315). */
24090
+ cameraMotion: CameraOwnMotionSchema.optional(),
24091
+ notForwarded: CameraSensorsNotForwardedSchema.optional(),
24092
+ notEnforced: CameraSensorsNotEnforcedSchema.optional()
24070
24093
  })
24071
24094
  ]);
24072
24095
  Object.freeze({
@@ -28153,8 +28176,10 @@ var RunnerCameraConfigSchema = object({
28153
28176
  * - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
28154
28177
  * analyzer providers) running on decoded frames in this runner.
28155
28178
  * - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
28156
- * analytics). The provider emits ProviderMotion
28157
- * events; the orchestrator forwards to `reportMotion`.
28179
+ * analytics). The provider emits its raw push as `ProviderMotion`
28180
+ * (D673); the orchestrator's camera-sensors bridge re-emits the camera's
28181
+ * effective motion as `MotionOnMotionChanged`, which is what reaches
28182
+ * `reportMotion`.
28158
28183
  */
28159
28184
  motionSources: MotionSourcesSchema.default(["analyzer"]),
28160
28185
  /**
@@ -28331,7 +28356,15 @@ var RunnerLocalLoadSchema = object({
28331
28356
  hasGpu: boolean(),
28332
28357
  inferenceBackend: string().optional(),
28333
28358
  cpuCores: number().optional()
28334
- })
28359
+ }),
28360
+ /**
28361
+ * Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
28362
+ * runner never writes it. ABSENT = a runner older than D696, which still
28363
+ * writes the slice from its phase machine; the orchestrator does not write
28364
+ * while any runner node is absent-or-unanswered, so one slice never has two
28365
+ * writers.
28366
+ */
28367
+ motionSliceWriter: literal("orchestrator").optional()
28335
28368
  });
28336
28369
  /**
28337
28370
  * Aggregate runtime metrics for the runner's whole local pool. Mirrors the
@@ -35488,6 +35521,70 @@ onStatusChanged: { data: object({
35488
35521
  * whether persisting is worth a SQLite commit. */
35489
35522
  volatileStateFields: ["lastChangedAt"]
35490
35523
  };
35524
+ var DoorbellStatusSchema = object({
35525
+ /** Ms epoch of the last press. null = never observed since this provider started. */
35526
+ lastPressedAt: number().nullable(),
35527
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
35528
+ pressCountSinceStart: number()
35529
+ });
35530
+ var DoorbellPressEventSchema = object({
35531
+ deviceId: number(),
35532
+ timestamp: number()
35533
+ });
35534
+ /**
35535
+ * Doorbell button cap. Two kinds of provider serve it, and to every consumer
35536
+ * they are the same cap:
35537
+ *
35538
+ * - **Native** providers, registered per device by a driver addon through
35539
+ * `ctx.registerNativeCap` — a `DeviceType.Button` accessory with
35540
+ * `role: DeviceRole.Doorbell`, or the camera itself (Reolink registers at
35541
+ * camera level). They emit `onPressed` on every firmware ring.
35542
+ * - **A composed doorbell** (D670, D671): a camera's customization gives it
35543
+ * the cap, its `lastPressedAt` rising from the sources the operator
35544
+ * assigned in Customize → Doorbell, and the composer emits `onPressed`
35545
+ * from that field's advance (`fromState`).
35546
+ *
35547
+ * The DeviceEventPropagator re-emits `onPressed` on the camera parent.
35548
+ */
35549
+ var doorbellCapability = {
35550
+ name: "doorbell",
35551
+ scope: "device",
35552
+ deviceNative: true,
35553
+ mode: "singleton",
35554
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
35555
+ methods: {},
35556
+ events: {
35557
+ /**
35558
+ * Fires once per physical press. Reolink delivers via Baichuan
35559
+ * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
35560
+ * release/duration — it's a pulse.
35561
+ */
35562
+ onPressed: {
35563
+ data: DoorbellPressEventSchema,
35564
+ fromState: {
35565
+ field: "lastPressedAt",
35566
+ on: "advance"
35567
+ }
35568
+ } },
35569
+ status: {
35570
+ schema: DoorbellStatusSchema,
35571
+ kind: "push"
35572
+ },
35573
+ /**
35574
+ * Runtime-state slice — last press timestamp + lifetime press count.
35575
+ * Mirrored by the kernel and readable via
35576
+ * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
35577
+ * without subscribing.
35578
+ */
35579
+ runtimeState: DoorbellStatusSchema,
35580
+ /**
35581
+ * Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
35582
+ *
35583
+ * See `RuntimeStateDurability`. Enforced by
35584
+ * `scripts/check-runtime-state-durability.ts`.
35585
+ */
35586
+ durability: "restored"
35587
+ };
35491
35588
  /**
35492
35589
  * Enum-state sensor — a string value picked from a finite option set.
35493
35590
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -37867,9 +37964,9 @@ var MotionStatusSchema = object({
37867
37964
  /** Ms epoch of the last detected-true observation. Null if never detected. */
37868
37965
  lastDetectedAt: number().nullable(),
37869
37966
  /**
37870
- * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
37871
- * `null` while false and on every `Sensor` device (D475) — see that
37872
- * constant's doc for the one-authority rule.
37967
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
37968
+ * orchestrator writes it, D696), `null` while false and on every `Sensor`
37969
+ * device (D475) — see that constant's doc for the one-authority rule.
37873
37970
  *
37874
37971
  * ## Reading this field still arms nothing
37875
37972
  *
@@ -37887,34 +37984,31 @@ var MotionStatusSchema = object({
37887
37984
  * `addon-export-alexa/src/motion-clear-hold.ts` and
37888
37985
  * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
37889
37986
  *
37890
- * ## Who writes it
37891
- *
37892
- * - **Cameras** — the runner's phase machine, `active → watching` on
37893
- * `cooldown_expired`, which then writes this slice with
37894
- * `detected: false` (`handlePhaseChanged` in
37895
- * `pipeline-runner/index.ts`). It produces the FALLING edge, which
37896
- * matters most for the sources that only ever push a rising one:
37897
- * Reolink emits `MotionOnMotionChanged { detected: true }` and never
37898
- * a false.
37899
- * - **Sensors** (Home Assistant binary sensors, Homematic) — the
37900
- * provider pushes the false itself, from the upstream system's own
37901
- * state change. No phase machine is involved.
37902
- *
37903
- * ### The phase machine is CANONICAL, not sole — and that is a defect
37904
- *
37905
- * An earlier revision of this docblock (mine, 2026-09-12) claimed the
37906
- * phase machine is the sole writer for a camera. It is not.
37907
- * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
37908
- * `setCapSlice(motionCapability, …)` on their own rising edge, and
37909
- * Hikvision's comment says why: it read THIS docblock, agreed the
37910
- * runner is canonical, and wrote anyway to avoid per-tick churn. So
37911
- * two authorities can disagree about one slice, which this repo
37912
- * forbids, and the doc said otherwise — which is worse than saying
37913
- * nothing, because it reads as verification.
37914
- *
37915
- * This predates D475 and is not fixed there: the fix touches every
37916
- * camera provider. Recorded in D475's Consequences. Do not restore the
37917
- * "sole writer" wording without also removing the other writers.
37987
+ * ## Who writes it (D696)
37988
+ *
37989
+ * - **Cameras** — the orchestrator, and nothing else. It writes the camera's
37990
+ * EFFECTIVE motion (`addon-pipeline-orchestrator`
37991
+ * `camera-sensors/motion-slice.ts`), alongside the effective
37992
+ * `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
37993
+ * for a split camera, an unsplit emitter's direct event, the analyzer and
37994
+ * device activity, as the camera's `motionSources` counts them. A source
37995
+ * that never sends a clear falls one window after its last `true`.
37996
+ * `lastDetectedAt` moves only on an effective rise. No camera provider
37997
+ * writes this slice (not even a boot seed), and neither does the runner's
37998
+ * phase machine: its phase is "a session is attached" for every on-motion
37999
+ * session, not motion, and it now has its own `DetectionPhaseTransition`.
38000
+ * A provider's `isDetected` answers from the hub's slice.
38001
+ * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
38002
+ * imports) — the provider pushes both edges itself, from the upstream
38003
+ * system's own state change. That is the sensor's own fact.
38004
+ *
38005
+ * `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
38006
+ * `motion` slice; each sensor writer is a named exemption.
38007
+ *
38008
+ * This replaces the D475 §4 rule ("the phase machine is the sole writer").
38009
+ * That rule was never true: Hikvision and Amcrest wrote the slice raw beside
38010
+ * it, every provider seeded it at boot, and every session left it
38011
+ * `detected: true` after its detach.
37918
38012
  */
37919
38013
  autoClearAfterMs: number().nullable()
37920
38014
  });
@@ -37986,11 +38080,12 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
37986
38080
  */
37987
38081
  runtimeState: MotionStatusSchema,
37988
38082
  /**
37989
- * Runtime-state durability: **session** — every writer of this slice
38083
+ * Runtime-state durability: **session** — the writer of this slice
37990
38084
  * writes only on an EDGE, so a restored `detected: true` would stay
37991
38085
  * frozen until the next one instead of being corrected. The next edge
37992
- * re-publishes the real state. (On who the writers are, and why there
37993
- * is more than one, see `autoClearAfterMs` above.)
38086
+ * re-publishes the real state, and the orchestrator re-publishes every
38087
+ * camera when it starts writing (D696; on who writes it, see
38088
+ * `autoClearAfterMs` above).
37994
38089
  *
37995
38090
  * See `RuntimeStateDurability`. Enforced by
37996
38091
  * `scripts/check-runtime-state-durability.ts`.
@@ -40661,8 +40756,7 @@ var ptzAutotrackCapability = {
40661
40756
  deviceNative: true,
40662
40757
  mode: "singleton",
40663
40758
  /**
40664
- * Two kinds of provider behind one name, the same shape `snapshot` and
40665
- * `doorbell` use:
40759
+ * Two kinds of provider behind one name, the same shape `snapshot` uses:
40666
40760
  *
40667
40761
  * - **Native**: the camera's own firmware autotrack, registered per device by
40668
40762
  * the driver when the probe says it exists (Reolink: yes; Hikvision:
@@ -40670,7 +40764,7 @@ var ptzAutotrackCapability = {
40670
40764
  * - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
40671
40765
  * which follows a subject with `ptz.move` pulses driven by the detection
40672
40766
  * pipeline. `defaultActive: false` — the operator binds it per camera in
40673
- * the bindings UI, exactly as `virtual-doorbell` is bound.
40767
+ * the bindings UI.
40674
40768
  *
40675
40769
  * The binding chooses WHICH implementation answers; `setEnabled` stays the
40676
40770
  * one switch for the function either way. A camera never has both driving its
@@ -50403,6 +50497,12 @@ Object.freeze({
50403
50497
  addonId: null,
50404
50498
  access: "view"
50405
50499
  },
50500
+ "notificationRules.getAlarmSensors": {
50501
+ capName: "notification-rules",
50502
+ capScope: "system",
50503
+ addonId: null,
50504
+ access: "view"
50505
+ },
50406
50506
  "notificationRules.getClipRetentionAsks": {
50407
50507
  capName: "notification-rules",
50408
50508
  capScope: "system",
@@ -54886,6 +54986,11 @@ Object.freeze({
54886
54986
  form: "single",
54887
54987
  optional: false
54888
54988
  }],
54989
+ "notificationRules.getAlarmSensors": [{
54990
+ name: "deviceIds",
54991
+ form: "array",
54992
+ optional: false
54993
+ }],
54889
54994
  "notificationRules.setDeviceMuted": [{
54890
54995
  name: "deviceId",
54891
54996
  form: "single",
@@ -56901,6 +57006,7 @@ TimelapseRuleInputSchema.extend({
56901
57006
  createdAt: number(),
56902
57007
  updatedAt: number()
56903
57008
  });
57009
+ MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
56904
57010
  object({
56905
57011
  /**
56906
57012
  * Fraction of the box's own size added on EACH side before cutting.