@camstack/addon-provider-homeassistant 1.2.150 → 1.2.152

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.
@@ -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).
@@ -7471,7 +7480,7 @@ function errMsg(err) {
7471
7480
  return String(err);
7472
7481
  }
7473
7482
  //#endregion
7474
- //#region ../types/dist/composition-Dq42XWp0.mjs
7483
+ //#region ../types/dist/composition-D7ULvLdD.mjs
7475
7484
  /**
7476
7485
  * The ffmpeg build every CamStack node downloads, per platform and arch.
7477
7486
  *
@@ -7525,21 +7534,20 @@ function portable(target) {
7525
7534
  }
7526
7535
  portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac64");
7527
7536
  /**
7528
- * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
7529
- * valutatore puro del suo FRONTE.
7537
+ * THE table "which boolean of this device type counts as HIGH", and the
7538
+ * pure evaluator of its EDGE.
7530
7539
  *
7531
- * Viveva dentro il builtin virtual-doorbell
7532
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
7533
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
7534
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
7535
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
7536
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
7537
- * SPOSTA qui e il doorbell la ri-esporta.
7540
+ * ONE table for everyone who asks "is this device HIGH?": the
7541
+ * recorder's `RecordingTriggers.sensorDeviceIds` trigger, the post-analysis
7542
+ * sensor markers, the orchestrator's camera-sensors bridge and
7543
+ * the sources of a composite doorbell (`doorbellFeatureSources`, D671).
7544
+ * A second copy would diverge at the first cap added, and the symptom — "the
7545
+ * sensor rings the doorbell but does not record" — is exactly D62.
7538
7546
  *
7539
- * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
7540
- * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
7541
- * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
7542
- * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
7547
+ * ⚠ NOT `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), and the
7548
+ * two must not be unified: that one answers "what is the state WORD for a
7549
+ * rule" (and includes `presence`, `cover`, `alarm-panel`), this one "which
7550
+ * boolean's EDGE counts". Deliberately different vocabularies.
7543
7551
  */
7544
7552
  /**
7545
7553
  * Known binary / switch source caps → the boolean slice field whose
@@ -7560,8 +7568,6 @@ var SOURCE_CAP_ACTIVE_FIELD = {
7560
7568
  vibration: "detected",
7561
7569
  tamper: "tampered"
7562
7570
  };
7563
- /** Cap names whose presence in a device's bindings qualify it as a source. */
7564
- var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
7565
7571
  /**
7566
7572
  * Error types for the safe expression engine. Two distinct classes so callers
7567
7573
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
@@ -9292,22 +9298,22 @@ var CLASS_MAP_MACRO_TARGETS = [
9292
9298
  "package"
9293
9299
  ];
9294
9300
  /**
9295
- * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
9296
- * un operatore può selezionare.
9301
+ * The FIRST-LEVEL macro classes: those an object detector emits and that
9302
+ * an operator can select.
9297
9303
  *
9298
- * Sono le tre offerte dallo step `object-detection`
9304
+ * They are the three offered by the `object-detection` step
9299
9305
  * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
9300
- * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
9301
- * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
9302
- * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
9303
- * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
9306
+ * `enabledMacroClasses`). `package` is in {@link CLASS_MAP_MACRO_TARGETS} and in
9307
+ * `MACRO_LABELS` — it is a true macro — but NOT here: it belongs to the step
9308
+ * `package-detection`, whose enablement is driven by zones, and offering the
9309
+ * same word twice has already made an operator turn on the COCO proxy
9304
9310
  * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
9305
9311
  *
9306
- * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
9307
- * dello step e una seconda volta come union `FirstLevelMacro`
9308
- * (`types/detection.ts`); una terza copia per il trigger di registrazione
9309
- * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
9310
- * successiva.
9312
+ * ONE list. Before today the same three were hand-written in the step's offer
9313
+ * and a second time as the union `FirstLevelMacro`
9314
+ * (`types/detection.ts`); a third copy for the recording trigger
9315
+ * (`RecordingTriggers.objectClasses`) would have made the later divergence
9316
+ * invisible.
9311
9317
  */
9312
9318
  var FIRST_LEVEL_MACRO_CLASSES = [
9313
9319
  "person",
@@ -9372,17 +9378,17 @@ var RecordingStorageModeSchema = _enum([
9372
9378
  "on-device-decision"
9373
9379
  ]);
9374
9380
  /**
9375
- * Le macro classi che possono aprire una finestra di registrazione — le stesse
9376
- * tre offerte dallo step `object-detection`, da UNA lista
9381
+ * The macro classes that can open a recording window — the same
9382
+ * three offered by the `object-detection` step, from ONE list
9377
9383
  * ({@link FIRST_LEVEL_MACRO_CLASSES}).
9378
9384
  */
9379
9385
  var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
9380
9386
  /**
9381
- * True quando `values` non ripete un elemento.
9387
+ * True when `values` does not repeat an element.
9382
9388
  *
9383
- * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
9384
- * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
9385
- * conterebbe due volte le sue finestre in `segmentMissedByMs`.
9389
+ * A duplicate is not harmless: every entry of `objectClasses` / `sensorDeviceIds`
9390
+ * becomes a SOURCE in `bandTriggerSources`, and the same source twice
9391
+ * would count its windows twice in `segmentMissedByMs`.
9386
9392
  */
9387
9393
  var noDuplicates = (values) => new Set(values).size === values.length;
9388
9394
  /** Which detectors trigger an `events`-mode band. */
@@ -9390,34 +9396,34 @@ var RecordingTriggersSchema = object({
9390
9396
  motion: boolean().optional(),
9391
9397
  audioThresholdDbfs: number().optional(),
9392
9398
  /**
9393
- * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
9394
- * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
9395
- * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
9396
- * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
9399
+ * The macro classes whose detection opens a window. ABSENT = the source
9400
+ * is not listened to; an EMPTY array is rejected, because "events band, object
9401
+ * trigger on, no class" is the same shape "enabled and records
9402
+ * nothing, forever" that `eventsBandCanEverDemand` is written against.
9397
9403
  *
9398
- * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
9399
- * quelle che hanno attraversato `enabledMacroClasses`, i
9400
- * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
9401
- * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
9402
- * finestre — vedi `recorder/object-trigger.ts`.
9404
+ * The signal read is ALREADY FILTERED: only `source: 'pipeline'` detections, i.e.
9405
+ * those that went through `enabledMacroClasses`, the
9406
+ * `minConfidence<Macro>` and the full-frame guard. The camera's onboard AI
9407
+ * (`source: 'onboard'`) goes through none of those gates and does NOT open
9408
+ * windows — see `recorder/object-trigger.ts`.
9403
9409
  */
9404
9410
  objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
9405
9411
  /**
9406
- * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
9407
- * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
9412
+ * The LINKED devices whose RISING EDGE opens a window. Absent = the source
9413
+ * is not listened to; an empty array is rejected for the same reason as
9408
9414
  * `objectClasses`.
9409
9415
  *
9410
- * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
9411
- * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
9412
- * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
9413
- * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
9414
- * device (D12) — mai un elenco globale di cap.
9416
+ * These are SOURCE device ids, not cameras: the band names them, so the
9417
+ * hot path (`DeviceStateChanged`, at bus rate across the whole fleet)
9418
+ * does no RPC. The OFFER from which the operator picks them is another question, and
9419
+ * is resolved with `deviceManager.getLinkedDevices` + `getBindingsBatch` per
9420
+ * device (D12) — never a global list of caps.
9415
9421
  *
9416
- * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
9417
- * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
9418
- * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
9419
- * il livello: un contatto trovato già aperto al riavvio del runner non fa
9420
- * registrare.
9422
+ * What "high" means depends on the device TYPE and is not decided here:
9423
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) is THE table,
9424
+ * the same one as the composite doorbell (D671). And it is the EDGE, not
9425
+ * the level: a contact found already open at runner restart does not
9426
+ * record.
9421
9427
  */
9422
9428
  sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
9423
9429
  });
@@ -10494,7 +10500,7 @@ var DecoderSessionConfigSchema = object({
10494
10500
  * - **VALUE** — at which level, for which scope, until when. That stays ONE
10495
10501
  * thing: the logging settings document on the `system` cap. Two authorities
10496
10502
  * over the values is the exact defect
10497
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
10503
+ * `docs/design/plans/2026-08-26-per-component-logging.md` was written to
10498
10504
  * remove; re-introducing it from the cure side would be grotesque.
10499
10505
  *
10500
10506
  * Nothing in this file reads a clock, an env var or a store. The registry is
@@ -14117,7 +14123,7 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
14117
14123
  *
14118
14124
  * ⚠ An earlier version of this comment blamed Zod stripping, and that
14119
14125
  * was wrong — corrected 2026-08-26 after the hop map
14120
- * (`docs/design/2026-08-26-mappa-hop-argomenti.md`) traced the path.
14126
+ * (`docs/design/2026-08-26-topic-hop-map.md`) traced the path.
14121
14127
  * There is **no Zod parse at all** between the door and the engine: the
14122
14128
  * dispatcher forwards the payload verbatim and UDS carries it whole. A
14123
14129
  * field declared here reaches `SqliteSettingsBackend` either way.
@@ -15214,7 +15220,17 @@ var SiteZoneSchema = object({
15214
15220
  var ProviderStatusSchema = object({
15215
15221
  connected: boolean(),
15216
15222
  deviceCount: number(),
15217
- error: string().optional()
15223
+ error: string().optional(),
15224
+ /**
15225
+ * `'orchestrator'`: this provider writes NO camera's `motion` runtime slice
15226
+ * — the orchestrator is its only writer (D696). Set by `BaseDeviceProvider`,
15227
+ * which every provider bundles, so only a provider BUILT from D696-amended
15228
+ * code says it. ABSENT means an older provider that may still write it (raw
15229
+ * VMD writes, a boot seed), and the orchestrator's provider gate keeps that
15230
+ * provider's cameras unwritten (`camera-sensors/motion-slice-provider-gate.ts`)
15231
+ * — the provider twin of the runner's `getLocalLoad().motionSliceWriter`.
15232
+ */
15233
+ motionSliceWriter: literal("orchestrator").optional()
15218
15234
  });
15219
15235
  object({
15220
15236
  externalId: string(),
@@ -16093,109 +16109,10 @@ method(object({
16093
16109
  deviceIds: array(number()).readonly(),
16094
16110
  caps: array(string()).readonly().optional()
16095
16111
  }), record(string(), record(string(), unknown().nullable())));
16096
- /**
16097
- * Doorbell button cap. Two kinds of providers coexist behind this cap
16098
- * name (same pattern as `snapshot`):
16099
- *
16100
- * - **Native** providers: registered per-device by device-driver
16101
- * addons via `ctx.registerNativeCap` — either on a
16102
- * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
16103
- * or directly on the camera (Reolink registers at camera level).
16104
- * Emits an `onPressed` event every time the firmware pushes a
16105
- * ring; status tracks the last press and a pressCount since start
16106
- * (diagnostic).
16107
- *
16108
- * - **Wrapper** provider: the `virtual-doorbell` system builtin
16109
- * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
16110
- * device (contact / switch / event-emitter …) into a doorbell for
16111
- * a camera. `defaultActive: false` — the operator explicitly binds
16112
- * it per camera in the device-bindings UI, then picks the source
16113
- * device + trigger in the per-device settings.
16114
- *
16115
- * The DeviceEventPropagator re-emits `onPressed` on the camera parent
16116
- * — subscribers listening at the camera level receive ring events
16117
- * with `via[]` populated. No code on the parent needed.
16118
- */
16119
- var DoorbellStatusSchema = object({
16120
- /** Ms epoch of the last press. null = never observed since this provider started. */
16121
- lastPressedAt: number().nullable(),
16122
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
16123
- pressCountSinceStart: number()
16124
- });
16125
- var DoorbellPressEventSchema = object({
16126
- deviceId: number(),
16127
- timestamp: number()
16128
- });
16129
- /**
16130
- * The `doorbell-source` extension slot's editable value (D648): the camera's
16131
- * virtual-doorbell trigger devices, exactly what the wrapper's
16132
- * `doorbellSources` persists (as `{ deviceId }` records).
16133
- */
16134
- var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
16135
- /**
16136
- * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
16137
- * doorbell, owned by the `virtual-doorbell` wrapper over its
16138
- * `doorbellSources` store (D648). A source rings when one of its
16139
- * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
16140
- * different authority (`deviceManager.setWrapperActive`, D62) — the slot
16141
- * reports it, it never writes it.
16142
- */
16143
- var DOORBELL_SOURCE_SLOT = {
16144
- id: "doorbell-source",
16145
- label: "Doorbell trigger devices",
16146
- 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.",
16147
- shape: "association",
16148
- hostDeviceTypes: [DeviceType.Camera],
16149
- sourceCaps: SOURCE_CAPS,
16150
- cardinality: "many",
16151
- value: DoorbellSourceSlotValueSchema
16152
- };
16153
- var doorbellCapability = {
16154
- name: "doorbell",
16155
- scope: "device",
16156
- deviceNative: true,
16157
- mode: "singleton",
16158
- kind: "wrapper",
16159
- defaultActive: false,
16160
- deviceTypes: [DeviceType.Button, DeviceType.Camera],
16161
- extensionSlots: [DOORBELL_SOURCE_SLOT],
16162
- methods: {},
16163
- events: {
16164
- /**
16165
- * Fires once per physical press. Reolink delivers via Baichuan
16166
- * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
16167
- * release/duration — it's a pulse.
16168
- */
16169
- onPressed: {
16170
- data: DoorbellPressEventSchema,
16171
- fromState: {
16172
- field: "lastPressedAt",
16173
- on: "advance"
16174
- }
16175
- } },
16176
- status: {
16177
- schema: DoorbellStatusSchema,
16178
- kind: "push"
16179
- },
16180
- /**
16181
- * Runtime-state slice — last press timestamp + lifetime press count.
16182
- * Mirrored by the kernel and readable via
16183
- * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
16184
- * without subscribing.
16185
- */
16186
- runtimeState: DoorbellStatusSchema,
16187
- /**
16188
- * 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.
16189
- *
16190
- * See `RuntimeStateDurability`. Enforced by
16191
- * `scripts/check-runtime-state-durability.ts`.
16192
- */
16193
- durability: "restored"
16194
- };
16195
- var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
16196
- DeviceType.Camera, DeviceType.Camera;
16112
+ var ExtensionSlotIdSchema = _enum(["linked-devices"]);
16113
+ DeviceType.Camera;
16197
16114
  /** A slot's editable value, discriminated on `slot`. */
16198
- var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
16115
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
16199
16116
  DeviceType.Camera;
16200
16117
  var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
16201
16118
  state: literal("unreachable"),
@@ -16232,10 +16149,11 @@ var ExtensionSlotSourceSchema = object({
16232
16149
  });
16233
16150
  /**
16234
16151
  * A DIFFERENT authority that gates whether the slot's sources do anything —
16235
- * reported read-only, named, never written through this contract (D62). The
16236
- * virtual doorbell's sources ring only while the wrapper is bound to the
16237
- * camera, and that binding belongs to `deviceManager.setWrapperActive`.
16238
- * `unknown` means the gate could not be read; it is not "inactive" (D315).
16152
+ * reported read-only, named, never written through this contract (D62) — e.g.
16153
+ * a slot whose sources act only while a wrapper is bound to the host, a
16154
+ * binding that belongs to `deviceManager.setWrapperActive`. No slot reports
16155
+ * one today (`linked-devices` answers `null`). `unknown` means the gate could
16156
+ * not be read; it is not "inactive" (D315).
16239
16157
  */
16240
16158
  var ExtensionSlotActivationSchema = object({
16241
16159
  state: _enum([
@@ -16251,7 +16169,7 @@ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
16251
16169
  /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
16252
16170
  slotRef: string(),
16253
16171
  slot: ExtensionSlotIdSchema,
16254
- /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
16172
+ /** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
16255
16173
  authority: string(),
16256
16174
  activation: ExtensionSlotActivationSchema.nullable(),
16257
16175
  value: ExtensionSlotValueSchema,
@@ -16529,7 +16447,7 @@ method(object({
16529
16447
  * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
16530
16448
  * ends in a log line, and a log line is the thing the operator asked to stop
16531
16449
  * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
16532
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
16450
+ * ricontrolliamo tutti questi punti"* [can we instrument these errors in the meantime? That way next round we recheck all these points]. Reading them meant grepping Loki and
16533
16451
  * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
16534
16452
  * media blackout were both diagnosed. The counters stay; this is where they can
16535
16453
  * be READ.
@@ -20788,6 +20706,29 @@ object({
20788
20706
  firstAt: number(),
20789
20707
  lastAt: number()
20790
20708
  });
20709
+ var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
20710
+ var NcAlarmDelaySecSchema = number().int().min(0).max(600);
20711
+ var NcAlarmTriggeredSecSchema = number().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
20712
+ var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
20713
+ var NcAlarmModeDelaysListSchema = array(object({
20714
+ mode: AlarmArmModeSchema,
20715
+ exitDelaySec: NcAlarmDelaySecSchema.optional(),
20716
+ entryDelaySec: NcAlarmDelaySecSchema.optional(),
20717
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.optional()
20718
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
20719
+ var NcAlarmModeDelaysEditListSchema = array(object({
20720
+ mode: AlarmArmModeSchema,
20721
+ exitDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
20722
+ entryDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
20723
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.nullable().optional()
20724
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
20725
+ /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
20726
+ var NcAlarmNonBlockingEditSchema = object({
20727
+ mode: AlarmArmModeSchema,
20728
+ deviceId: number().int().positive(),
20729
+ /** true = on the list (may be open, does not block); false = off the list (blocks). */
20730
+ nonBlocking: boolean()
20731
+ });
20791
20732
  /**
20792
20733
  * The per-mode lists, at most one per mode. Two lists for one mode have no
20793
20734
  * meaning a reader could agree on (union? the last one?), so they are refused
@@ -20796,10 +20737,10 @@ object({
20796
20737
  var NcAlarmNonBlockingListSchema = array(object({
20797
20738
  mode: AlarmArmModeSchema,
20798
20739
  deviceIds: array(number().int()).max(200)
20799
- })).max(8).refine((lists) => new Set(lists.map((l) => l.mode)).size === lists.length, { message: "nonBlocking: at most one list per arm mode" });
20740
+ })).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
20800
20741
  /**
20801
- * The three durations the panel's state machine runs on, who hears about its
20802
- * transitions, and which openings each mode tolerates.
20742
+ * The three durations — global, and per mode since D697 — the panel's state
20743
+ * machine runs on, who hears about its transitions, and which openings each mode tolerates.
20803
20744
  *
20804
20745
  * They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
20805
20746
  * `alarm-panel` is `deviceNative` and its other provider mirrors somebody
@@ -20809,15 +20750,15 @@ var NcAlarmNonBlockingListSchema = array(object({
20809
20750
  */
20810
20751
  var NcAlarmSettingsSchema = object({
20811
20752
  /** Grace period between arming and the mode taking effect. 0 = immediate. */
20812
- exitDelaySec: number().int().min(0).max(600),
20753
+ exitDelaySec: NcAlarmDelaySecSchema,
20813
20754
  /** Grace period between a trigger and the alarm firing. 0 = immediate. */
20814
- entryDelaySec: number().int().min(0).max(600),
20755
+ entryDelaySec: NcAlarmDelaySecSchema,
20815
20756
  /**
20816
20757
  * How long `triggered` lasts before the panel re-arms itself.
20817
20758
  * **0 = until an operator disarms it** — the behaviour before this field
20818
20759
  * existed, and therefore what an untouched install keeps doing.
20819
20760
  */
20820
- triggeredDurationSec: number().int().min(0).max(3600),
20761
+ triggeredDurationSec: NcAlarmTriggeredSecSchema,
20821
20762
  /**
20822
20763
  * Deprecated by D630 — every transition is announced. Parsed, never read;
20823
20764
  * remove after one release. Optional so an older admin's patch (which still
@@ -20840,17 +20781,30 @@ var NcAlarmSettingsSchema = object({
20840
20781
  * per mode is meaningful. Defaulted to `[]` so a blob stored before D630
20841
20782
  * parses as "every opening blocks" — the behaviour it was written under.
20842
20783
  */
20843
- nonBlocking: NcAlarmNonBlockingListSchema.default([])
20784
+ nonBlocking: NcAlarmNonBlockingListSchema.default([]),
20785
+ /**
20786
+ * Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
20787
+ * without a field, uses the global value above — so `[]`, the default, is exactly the
20788
+ * behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
20789
+ */
20790
+ modeDelays: NcAlarmModeDelaysListSchema.default([])
20844
20791
  });
20845
20792
  /**
20846
20793
  * Every field optional — a tab edits one control at a time.
20847
20794
  *
20848
- * `nonBlocking` is re-declared WITHOUT its default: `.partial()` does not
20849
- * remove an inner `.default()`, so a patch that never named the field would
20850
- * parse to `nonBlocking: []` and wipe every mode's list on an unrelated edit
20851
- * (the same trap {@link NcRulePatchSchema} documents).
20795
+ * `nonBlocking` and `modeDelays` are re-declared WITHOUT their defaults:
20796
+ * `.partial()` does not remove an inner `.default()`, so a patch that never
20797
+ * named the field would parse to `[]` and wipe every mode's list on an
20798
+ * unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
20799
+ * `modeDelays` means EDITS, not the stored overrides.
20852
20800
  */
20853
- var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({ nonBlocking: NcAlarmNonBlockingListSchema }).partial();
20801
+ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
20802
+ nonBlocking: NcAlarmNonBlockingListSchema,
20803
+ /** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
20804
+ modeDelays: NcAlarmModeDelaysEditListSchema,
20805
+ /** ONE membership change; the panel applies it to the list it holds at its turn. */
20806
+ nonBlockingEdit: NcAlarmNonBlockingEditSchema
20807
+ }).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" });
20854
20808
  /**
20855
20809
  * What one arm mode actually arms, DERIVED from the enabled rules gated on it.
20856
20810
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
@@ -20950,6 +20904,28 @@ var NcAlarmConfigSchema = object({
20950
20904
  */
20951
20905
  live: NcAlarmLiveSchema.optional()
20952
20906
  });
20907
+ var NcAlarmSensorReadingSchema = _enum([
20908
+ "open",
20909
+ "closed",
20910
+ "unknown",
20911
+ "not-opening"
20912
+ ]);
20913
+ /** One device's state as the alarm reads it — the classifier the arm check uses. */
20914
+ var NcAlarmSensorStateSchema = object({
20915
+ deviceId: number().int().positive(),
20916
+ reading: NcAlarmSensorReadingSchema,
20917
+ /** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
20918
+ state: string().nullable(),
20919
+ /** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
20920
+ unknownWhy: _enum(["read-failed", "unknown-word"]).nullable(),
20921
+ /** The device manager's liveness as the centre mirrors it; null = not known. */
20922
+ online: boolean().nullable()
20923
+ });
20924
+ var NcAlarmSensorsInputSchema = object({ deviceIds: array(number().int().positive()).max(500) });
20925
+ var NcAlarmSensorsSchema = object({
20926
+ sensors: array(NcAlarmSensorStateSchema),
20927
+ readAt: number().int().nonnegative()
20928
+ });
20953
20929
  /**
20954
20930
  * ONE rule's demand on ONE camera's clip ring.
20955
20931
  *
@@ -21040,7 +21016,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21040
21016
  }), method(object({}), NcAlarmConfigSchema, { auth: "admin" }), method(object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
21041
21017
  kind: "mutation",
21042
21018
  auth: "admin"
21043
- });
21019
+ }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
21044
21020
  /**
21045
21021
  * Zod schemas for persisted record types.
21046
21022
  *
@@ -21403,12 +21379,26 @@ var CameraSensorRefSchema = object({
21403
21379
  function cameraSensorRefKey(ref) {
21404
21380
  return `${ref.addonId}/${ref.stableId}`;
21405
21381
  }
21406
- /** CS-1 accepts exactly one mode; CS-2 (D673) widens it to confirm / replace. */
21407
- var CameraSensorsModeSchema = _enum(["in-addition"]);
21408
- var CameraSensorsConfigSchema = object({
21409
- mode: CameraSensorsModeSchema,
21410
- sensors: array(CameraSensorRefSchema).min(1).max(8)
21411
- }).superRefine((value, ctx) => {
21382
+ /**
21383
+ * A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
21384
+ * `replace`: its motion is the camera's, and while one is READY the camera's
21385
+ * own motion no longer counts on its own. `confirm`: while one is READY the
21386
+ * camera's own motion counts only while a confirm sensor is active — with or
21387
+ * without a replace sensor (spec C2, the controller's ruling on Q1).
21388
+ */
21389
+ var CameraSensorModeSchema = _enum([
21390
+ "in-addition",
21391
+ "confirm",
21392
+ "replace"
21393
+ ]);
21394
+ /** A stored sensor with no mode — every CS-1 row — is in addition. */
21395
+ var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
21396
+ /**
21397
+ * A camera's attached sensors. A CS-1 row carried an envelope
21398
+ * `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
21399
+ * what the write stores (D672 rule 3), so it is never written again.
21400
+ */
21401
+ var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
21412
21402
  const seen = /* @__PURE__ */ new Set();
21413
21403
  value.sensors.forEach((ref, index) => {
21414
21404
  const key = cameraSensorRefKey(ref);
@@ -21420,39 +21410,41 @@ var CameraSensorsConfigSchema = object({
21420
21410
  seen.add(key);
21421
21411
  });
21422
21412
  });
21423
- var RefFields = {
21413
+ /** Every attachment names its mode; an older orchestrator that does not is in addition. */
21414
+ var AttachmentFields = {
21424
21415
  addonId: string(),
21425
- stableId: string()
21416
+ stableId: string(),
21417
+ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
21426
21418
  };
21427
21419
  var CameraSensorAttachmentSchema = discriminatedUnion("state", [
21428
21420
  object({
21429
- ...RefFields,
21421
+ ...AttachmentFields,
21430
21422
  state: literal("ready"),
21431
21423
  deviceId: number(),
21432
21424
  name: string(),
21433
21425
  caps: array(string()).readonly()
21434
21426
  }),
21435
21427
  object({
21436
- ...RefFields,
21428
+ ...AttachmentFields,
21437
21429
  state: literal("offline"),
21438
21430
  deviceId: number(),
21439
21431
  name: string(),
21440
21432
  reason: _enum(["offline", "disabled"])
21441
21433
  }),
21442
21434
  object({
21443
- ...RefFields,
21435
+ ...AttachmentFields,
21444
21436
  state: literal("missing"),
21445
21437
  reason: string()
21446
21438
  }),
21447
21439
  object({
21448
- ...RefFields,
21440
+ ...AttachmentFields,
21449
21441
  state: literal("unsupported"),
21450
21442
  deviceId: number(),
21451
21443
  name: string(),
21452
21444
  reason: string()
21453
21445
  }),
21454
21446
  object({
21455
- ...RefFields,
21447
+ ...AttachmentFields,
21456
21448
  state: literal("unreadable"),
21457
21449
  reason: string()
21458
21450
  })
@@ -21465,17 +21457,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
21465
21457
  * say.
21466
21458
  */
21467
21459
  var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
21460
+ /** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
21461
+ var CameraOwnMotionSchema = _enum([
21462
+ "always",
21463
+ "when-confirmed",
21464
+ "never"
21465
+ ]);
21466
+ /** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
21467
+ var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
21468
+ /**
21469
+ * The camera's OWN onboard motion (D696): the raw input the bridge combines,
21470
+ * never the effective value. The camera's `motion` slice is the effective one,
21471
+ * so a view of the camera's own row reads this.
21472
+ * - `atMs`: when the bridge received the camera's last own edge.
21473
+ * - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
21474
+ * AND it is younger than the window the bridge counts the camera's own motion
21475
+ * for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
21476
+ * sends a clear (heartbeats only) therefore reads `false` once no push came
21477
+ * within the window; a status read is a snapshot, so a live view re-asks.
21478
+ * Absent = this orchestrator has not received the camera's own motion since it
21479
+ * started (unknown, never "quiet"), or an orchestrator older than D696.
21480
+ */
21481
+ var CameraRawLevelSchema = object({
21482
+ detected: boolean(),
21483
+ atMs: number()
21484
+ });
21468
21485
  var CameraSensorsStatusSchema = discriminatedUnion("state", [
21469
- object({ state: literal("not-configured") }),
21486
+ object({
21487
+ state: literal("not-configured"),
21488
+ cameraLevel: CameraRawLevelSchema.optional()
21489
+ }),
21470
21490
  object({
21471
21491
  state: literal("unreadable"),
21472
- reason: string()
21492
+ reason: string(),
21493
+ cameraLevel: CameraRawLevelSchema.optional()
21473
21494
  }),
21474
21495
  object({
21475
21496
  state: literal("configured"),
21476
- mode: CameraSensorsModeSchema,
21497
+ cameraLevel: CameraRawLevelSchema.optional(),
21477
21498
  sensors: array(CameraSensorAttachmentSchema).readonly(),
21478
- notForwarded: CameraSensorsNotForwardedSchema.optional()
21499
+ /** Absent = an orchestrator older than CS-2: it does not say (D315). */
21500
+ cameraMotion: CameraOwnMotionSchema.optional(),
21501
+ notForwarded: CameraSensorsNotForwardedSchema.optional(),
21502
+ notEnforced: CameraSensorsNotEnforcedSchema.optional()
21479
21503
  })
21480
21504
  ]);
21481
21505
  Object.freeze({
@@ -22160,14 +22184,14 @@ var TrackSchema = object({
22160
22184
  * `derive-returned-null tile=standin`,
22161
22185
  * `native-tile tile=native no-key-frame-at-close`, …) written at close and
22162
22186
  * CLEARED by the late-keyFrame upgrade when a native tile lands after all.
22163
- * The operator-facing answer to "perché manca l'immagine?" on a track whose
22187
+ * The operator-facing answer to "perché manca l'immagine?" [why is the image missing?] on a track whose
22164
22188
  * tile is a face/plate stand-in, a raster crop, or an icon.
22165
22189
  *
22166
22190
  * **`no-key-frame-at-close` (D400).** The line used to be written ONLY when
22167
22191
  * the TILE ranked below native, so a track whose thumbnail landed natively
22168
22192
  * while its key frame missed carried no reason at all — three of the four
22169
22193
  * `MISSING_KEYFRAME` tracks in the 2026-09-07 operator audit were exactly
22170
- * that shape, and their "niente ultimo" had no cause anywhere on the row.
22194
+ * that shape, and their "niente ultimo" [no last frame] had no cause anywhere on the row.
22171
22195
  * The key frame is the head of a cascade (`keyFrame ⇒ keyFrameSmall ⇒ the
22172
22196
  * lastFrame copy source`), so its absence is now on this line whatever the
22173
22197
  * tile ended up being.
@@ -22254,7 +22278,7 @@ var MotionEventSchema = object({
22254
22278
  /**
22255
22279
  * Ms offsets from `timestamp` (the episode's own first rising edge, so the
22256
22280
  * first entry is always `0`) of every genuine off→on transition the
22257
- * episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
22281
+ * episode saw — "ogni evento on si deve salvare" [every ON event must be saved] (D475). NOT one entry per
22258
22282
  * push: a firmware source that keepalives at ~1 Hz for the whole burst
22259
22283
  * (Reolink, Hikvision) produces exactly one edge; a source that reports an
22260
22284
  * explicit `false` mid-episode and then resumes before the quiet window
@@ -24706,8 +24730,10 @@ var RunnerCameraConfigSchema = object({
24706
24730
  * - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
24707
24731
  * analyzer providers) running on decoded frames in this runner.
24708
24732
  * - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
24709
- * analytics). The provider emits ProviderMotion
24710
- * events; the orchestrator forwards to `reportMotion`.
24733
+ * analytics). The provider emits its raw push as `ProviderMotion`
24734
+ * (D673); the orchestrator's camera-sensors bridge re-emits the camera's
24735
+ * effective motion as `MotionOnMotionChanged`, which is what reaches
24736
+ * `reportMotion`.
24711
24737
  */
24712
24738
  motionSources: MotionSourcesSchema.default(["analyzer"]),
24713
24739
  /**
@@ -24884,7 +24910,15 @@ var RunnerLocalLoadSchema = object({
24884
24910
  hasGpu: boolean(),
24885
24911
  inferenceBackend: string().optional(),
24886
24912
  cpuCores: number().optional()
24887
- })
24913
+ }),
24914
+ /**
24915
+ * Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
24916
+ * runner never writes it. ABSENT = a runner older than D696, which still
24917
+ * writes the slice from its phase machine; the orchestrator does not write
24918
+ * while any runner node is absent-or-unanswered, so one slice never has two
24919
+ * writers.
24920
+ */
24921
+ motionSliceWriter: literal("orchestrator").optional()
24888
24922
  });
24889
24923
  /**
24890
24924
  * Aggregate runtime metrics for the runner's whole local pool. Mirrors the
@@ -27549,7 +27583,7 @@ var ClipPlaybackSchema = object({
27549
27583
  * **One authorised yes is one wake.** `next-natural` — take the clip the next
27550
27584
  * time the camera is awake for its own reasons — is deliberately not a member:
27551
27585
  * it was proposed, it is free on the battery, and the operator declined it on
27552
- * 2026-09-20 (*"Quando un export viene richiesto si sveglia la camera."*,
27586
+ * 2026-09-20 (*"Quando un export viene richiesto si sveglia la camera."* [When an export is requested the camera wakes up],
27553
27587
  * D558 "Considered and not taken").
27554
27588
  */
27555
27589
  var ClipWakeSchema = _enum(["authorised"]);
@@ -27810,7 +27844,7 @@ DeviceType.Camera, method(object({
27810
27844
  * It replaced `sources?: string[]`, a VIEW filter over source ids that
27811
27845
  * assumed the answer was a fan-out over everything a camera has. The
27812
27846
  * operator settled otherwise on 2026-09-20 — *"l'utilizzatore è uno
27813
- * solo"* — so the list is asked of one provider at a time and there is
27847
+ * solo"* [there is only one user] — so the list is asked of one provider at a time and there is
27814
27848
  * nothing to filter out of it.
27815
27849
  */
27816
27850
  provider: string().min(1)
@@ -30494,6 +30528,70 @@ onStatusChanged: { data: object({
30494
30528
  * whether persisting is worth a SQLite commit. */
30495
30529
  volatileStateFields: ["lastChangedAt"]
30496
30530
  };
30531
+ var DoorbellStatusSchema = object({
30532
+ /** Ms epoch of the last press. null = never observed since this provider started. */
30533
+ lastPressedAt: number().nullable(),
30534
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
30535
+ pressCountSinceStart: number()
30536
+ });
30537
+ var DoorbellPressEventSchema = object({
30538
+ deviceId: number(),
30539
+ timestamp: number()
30540
+ });
30541
+ /**
30542
+ * Doorbell button cap. Two kinds of provider serve it, and to every consumer
30543
+ * they are the same cap:
30544
+ *
30545
+ * - **Native** providers, registered per device by a driver addon through
30546
+ * `ctx.registerNativeCap` — a `DeviceType.Button` accessory with
30547
+ * `role: DeviceRole.Doorbell`, or the camera itself (Reolink registers at
30548
+ * camera level). They emit `onPressed` on every firmware ring.
30549
+ * - **A composed doorbell** (D670, D671): a camera's customization gives it
30550
+ * the cap, its `lastPressedAt` rising from the sources the operator
30551
+ * assigned in Customize → Doorbell, and the composer emits `onPressed`
30552
+ * from that field's advance (`fromState`).
30553
+ *
30554
+ * The DeviceEventPropagator re-emits `onPressed` on the camera parent.
30555
+ */
30556
+ var doorbellCapability = {
30557
+ name: "doorbell",
30558
+ scope: "device",
30559
+ deviceNative: true,
30560
+ mode: "singleton",
30561
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
30562
+ methods: {},
30563
+ events: {
30564
+ /**
30565
+ * Fires once per physical press. Reolink delivers via Baichuan
30566
+ * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
30567
+ * release/duration — it's a pulse.
30568
+ */
30569
+ onPressed: {
30570
+ data: DoorbellPressEventSchema,
30571
+ fromState: {
30572
+ field: "lastPressedAt",
30573
+ on: "advance"
30574
+ }
30575
+ } },
30576
+ status: {
30577
+ schema: DoorbellStatusSchema,
30578
+ kind: "push"
30579
+ },
30580
+ /**
30581
+ * Runtime-state slice — last press timestamp + lifetime press count.
30582
+ * Mirrored by the kernel and readable via
30583
+ * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
30584
+ * without subscribing.
30585
+ */
30586
+ runtimeState: DoorbellStatusSchema,
30587
+ /**
30588
+ * 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.
30589
+ *
30590
+ * See `RuntimeStateDurability`. Enforced by
30591
+ * `scripts/check-runtime-state-durability.ts`.
30592
+ */
30593
+ durability: "restored"
30594
+ };
30497
30595
  /**
30498
30596
  * Enum-state sensor — a string value picked from a finite option set.
30499
30597
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -32638,9 +32736,9 @@ var MotionStatusSchema = object({
32638
32736
  /** Ms epoch of the last detected-true observation. Null if never detected. */
32639
32737
  lastDetectedAt: number().nullable(),
32640
32738
  /**
32641
- * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
32642
- * `null` while false and on every `Sensor` device (D475) — see that
32643
- * constant's doc for the one-authority rule.
32739
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
32740
+ * orchestrator writes it, D696), `null` while false and on every `Sensor`
32741
+ * device (D475) — see that constant's doc for the one-authority rule.
32644
32742
  *
32645
32743
  * ## Reading this field still arms nothing
32646
32744
  *
@@ -32658,34 +32756,31 @@ var MotionStatusSchema = object({
32658
32756
  * `addon-export-alexa/src/motion-clear-hold.ts` and
32659
32757
  * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
32660
32758
  *
32661
- * ## Who writes it
32662
- *
32663
- * - **Cameras** — the runner's phase machine, `active → watching` on
32664
- * `cooldown_expired`, which then writes this slice with
32665
- * `detected: false` (`handlePhaseChanged` in
32666
- * `pipeline-runner/index.ts`). It produces the FALLING edge, which
32667
- * matters most for the sources that only ever push a rising one:
32668
- * Reolink emits `MotionOnMotionChanged { detected: true }` and never
32669
- * a false.
32670
- * - **Sensors** (Home Assistant binary sensors, Homematic) — the
32671
- * provider pushes the false itself, from the upstream system's own
32672
- * state change. No phase machine is involved.
32673
- *
32674
- * ### The phase machine is CANONICAL, not sole — and that is a defect
32675
- *
32676
- * An earlier revision of this docblock (mine, 2026-09-12) claimed the
32677
- * phase machine is the sole writer for a camera. It is not.
32678
- * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
32679
- * `setCapSlice(motionCapability, …)` on their own rising edge, and
32680
- * Hikvision's comment says why: it read THIS docblock, agreed the
32681
- * runner is canonical, and wrote anyway to avoid per-tick churn. So
32682
- * two authorities can disagree about one slice, which this repo
32683
- * forbids, and the doc said otherwise — which is worse than saying
32684
- * nothing, because it reads as verification.
32685
- *
32686
- * This predates D475 and is not fixed there: the fix touches every
32687
- * camera provider. Recorded in D475's Consequences. Do not restore the
32688
- * "sole writer" wording without also removing the other writers.
32759
+ * ## Who writes it (D696)
32760
+ *
32761
+ * - **Cameras** — the orchestrator, and nothing else. It writes the camera's
32762
+ * EFFECTIVE motion (`addon-pipeline-orchestrator`
32763
+ * `camera-sensors/motion-slice.ts`), alongside the effective
32764
+ * `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
32765
+ * for a split camera, an unsplit emitter's direct event, the analyzer and
32766
+ * device activity, as the camera's `motionSources` counts them. A source
32767
+ * that never sends a clear falls one window after its last `true`.
32768
+ * `lastDetectedAt` moves only on an effective rise. No camera provider
32769
+ * writes this slice (not even a boot seed), and neither does the runner's
32770
+ * phase machine: its phase is "a session is attached" for every on-motion
32771
+ * session, not motion, and it now has its own `DetectionPhaseTransition`.
32772
+ * A provider's `isDetected` answers from the hub's slice.
32773
+ * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
32774
+ * imports) — the provider pushes both edges itself, from the upstream
32775
+ * system's own state change. That is the sensor's own fact.
32776
+ *
32777
+ * `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
32778
+ * `motion` slice; each sensor writer is a named exemption.
32779
+ *
32780
+ * This replaces the D475 §4 rule ("the phase machine is the sole writer").
32781
+ * That rule was never true: Hikvision and Amcrest wrote the slice raw beside
32782
+ * it, every provider seeded it at boot, and every session left it
32783
+ * `detected: true` after its detach.
32689
32784
  */
32690
32785
  autoClearAfterMs: number().nullable()
32691
32786
  });
@@ -32757,11 +32852,12 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
32757
32852
  */
32758
32853
  runtimeState: MotionStatusSchema,
32759
32854
  /**
32760
- * Runtime-state durability: **session** — every writer of this slice
32855
+ * Runtime-state durability: **session** — the writer of this slice
32761
32856
  * writes only on an EDGE, so a restored `detected: true` would stay
32762
32857
  * frozen until the next one instead of being corrected. The next edge
32763
- * re-publishes the real state. (On who the writers are, and why there
32764
- * is more than one, see `autoClearAfterMs` above.)
32858
+ * re-publishes the real state, and the orchestrator re-publishes every
32859
+ * camera when it starts writing (D696; on who writes it, see
32860
+ * `autoClearAfterMs` above).
32765
32861
  *
32766
32862
  * See `RuntimeStateDurability`. Enforced by
32767
32863
  * `scripts/check-runtime-state-durability.ts`.
@@ -35144,8 +35240,7 @@ var ptzAutotrackCapability = {
35144
35240
  deviceNative: true,
35145
35241
  mode: "singleton",
35146
35242
  /**
35147
- * Two kinds of provider behind one name, the same shape `snapshot` and
35148
- * `doorbell` use:
35243
+ * Two kinds of provider behind one name, the same shape `snapshot` uses:
35149
35244
  *
35150
35245
  * - **Native**: the camera's own firmware autotrack, registered per device by
35151
35246
  * the driver when the probe says it exists (Reolink: yes; Hikvision:
@@ -35153,7 +35248,7 @@ var ptzAutotrackCapability = {
35153
35248
  * - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
35154
35249
  * which follows a subject with `ptz.move` pulses driven by the detection
35155
35250
  * pipeline. `defaultActive: false` — the operator binds it per camera in
35156
- * the bindings UI, exactly as `virtual-doorbell` is bound.
35251
+ * the bindings UI.
35157
35252
  *
35158
35253
  * The binding chooses WHICH implementation answers; `setEnabled` stays the
35159
35254
  * one switch for the function either way. A camera never has both driving its
@@ -35828,7 +35923,7 @@ var ReadGopBytesResultSchema = object({
35828
35923
  /**
35829
35924
  * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
35830
35925
  * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
35831
- * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
35926
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-clip-replay-on-pipeline.md`):
35832
35927
  * a replay needs several seconds of native pixels, not one frame.
35833
35928
  *
35834
35929
  * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
@@ -40251,13 +40346,14 @@ var BaseDeviceProvider = class extends BaseAddon {
40251
40346
  async getStatus() {
40252
40347
  const all = await this.ctx.kernel.devices?.getAll() ?? [];
40253
40348
  const summary = this.restoreFailureSummary();
40254
- if (summary === null) return {
40349
+ const base = {
40255
40350
  connected: true,
40256
- deviceCount: all.length
40351
+ deviceCount: all.length,
40352
+ motionSliceWriter: "orchestrator"
40257
40353
  };
40354
+ if (summary === null) return base;
40258
40355
  return {
40259
- connected: true,
40260
- deviceCount: all.length,
40356
+ ...base,
40261
40357
  error: summary
40262
40358
  };
40263
40359
  }
@@ -45693,6 +45789,12 @@ Object.freeze({
45693
45789
  addonId: null,
45694
45790
  access: "view"
45695
45791
  },
45792
+ "notificationRules.getAlarmSensors": {
45793
+ capName: "notification-rules",
45794
+ capScope: "system",
45795
+ addonId: null,
45796
+ access: "view"
45797
+ },
45696
45798
  "notificationRules.getClipRetentionAsks": {
45697
45799
  capName: "notification-rules",
45698
45800
  capScope: "system",
@@ -50176,6 +50278,11 @@ Object.freeze({
50176
50278
  form: "single",
50177
50279
  optional: false
50178
50280
  }],
50281
+ "notificationRules.getAlarmSensors": [{
50282
+ name: "deviceIds",
50283
+ form: "array",
50284
+ optional: false
50285
+ }],
50179
50286
  "notificationRules.setDeviceMuted": [{
50180
50287
  name: "deviceId",
50181
50288
  form: "single",
@@ -52180,7 +52287,7 @@ var PreviewTextField = string().max(200);
52180
52287
  * Whether the notification's preview is a STILL or a short animation.
52181
52288
  *
52182
52289
  * The operator's ask, verbatim: *"inviato come gif o video (come per le altre
52183
- * rule)"* — the other rules already offer an animated preview, and a ten-hour
52290
+ * rule)"* [sent as a gif or video (as for the other rules)] — the other rules already offer an animated preview, and a ten-hour
52184
52291
  * night reads better as three seconds of motion than as one frame of it. Both
52185
52292
  * modes get the SAME treatment (blurred frame, large centred title); `'gif'`
52186
52293
  * simply applies it to a dozen frames sampled across the render and assembles
@@ -52318,6 +52425,7 @@ TimelapseRuleInputSchema.extend({
52318
52425
  createdAt: number(),
52319
52426
  updatedAt: number()
52320
52427
  });
52428
+ MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
52321
52429
  object({
52322
52430
  /**
52323
52431
  * Fraction of the box's own size added on EACH side before cutting.