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