@camstack/addon-pipeline 1.2.314 → 1.2.316

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 (32) hide show
  1. package/dist/audio-analyzer/index.js +2 -2
  2. package/dist/audio-analyzer/index.mjs +2 -2
  3. package/dist/{default-detection-model-Es1-dvFU.mjs → default-detection-model-Ct7dlbBe.mjs} +1 -1
  4. package/dist/{default-detection-model-BvxtQEcb.js → default-detection-model-DD9hOZ4u.js} +1 -1
  5. package/dist/detection-pipeline/index.js +4 -4
  6. package/dist/detection-pipeline/index.mjs +4 -4
  7. package/dist/{dist-Jvi2SOxI.js → dist-BB9ZzZuv.js} +321 -200
  8. package/dist/{dist-E1Z_K22_.mjs → dist-D1CYfnNk.mjs} +316 -195
  9. package/dist/motion-wasm/index.js +1 -1
  10. package/dist/motion-wasm/index.mjs +1 -1
  11. package/dist/{node-DHe-9_tm.mjs → node-CQWOX--t.mjs} +1 -1
  12. package/dist/{node-EjcZQh8D.js → node-bfUE4LH0.js} +1 -1
  13. package/dist/pipeline-runner/index.js +19 -58
  14. package/dist/pipeline-runner/index.mjs +17 -56
  15. package/dist/{process-memory-IQcwHauP.mjs → process-memory-Dh7ICwL3.mjs} +1 -1
  16. package/dist/{process-memory-BUtnSPYK.js → process-memory-MNz63KR5.js} +1 -1
  17. package/dist/recorder/index.js +108 -108
  18. package/dist/recorder/index.mjs +108 -108
  19. package/dist/{segment-demux-js-CR58wpzs.mjs → segment-demux-js-Be5IUrly.mjs} +1 -1
  20. package/dist/{segment-demux-js-Il0EkSOb.js → segment-demux-js-CFIkvV42.js} +1 -1
  21. package/dist/stream-broker/_stub.js +2 -2
  22. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-CBvGGDX_.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-Cjam0v1J.mjs} +2 -2
  23. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-D6PDbSB9.mjs +26 -0
  24. package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DddXyc17.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DHNf76xj.mjs} +1 -1
  25. package/dist/stream-broker/demux-worker-child.js +1 -1
  26. package/dist/stream-broker/demux-worker-child.mjs +1 -1
  27. package/dist/stream-broker/{hostInit-CjvrBwfh.mjs → hostInit-CEJvMnrH.mjs} +2 -2
  28. package/dist/stream-broker/index.js +6 -6
  29. package/dist/stream-broker/index.mjs +6 -6
  30. package/dist/stream-broker/remoteEntry.js +1 -1
  31. package/package.json +1 -1
  32. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-D0BR9vFO.mjs +0 -26
@@ -1,5 +1,5 @@
1
1
  let node_crypto = require("node:crypto");
2
- //#region ../types/dist/event-category-C5xZWqz6.mjs
2
+ //#region ../types/dist/event-category-BGmz_oxW.mjs
3
3
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4
4
  EventCategory["SystemBoot"] = "system.boot";
5
5
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -532,6 +532,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
532
532
  */
533
533
  EventCategory["PipelineAudioInferenceResult"] = "pipeline.audio-inference-result";
534
534
  EventCategory["DetectionPhaseTransition"] = "detection.phase-transition";
535
+ /**
536
+ * A camera provider's RAW onboard motion push (D673): the `MotionOnMotionChanged`
537
+ * data shape without `triggeredBy`, built by `providerMotionEvent`. Its one
538
+ * consumer is the orchestrator's camera-sensors bridge, which re-emits the
539
+ * camera's EFFECTIVE onboard motion as `MotionOnMotionChanged` (a pass-through
540
+ * for a camera with no attached sensor). Providers must not emit
541
+ * `MotionOnMotionChanged` themselves; `scripts/check-onboard-motion-emitters.ts`
542
+ * keeps it so (camera-grid is a named, deferred exception).
543
+ */
535
544
  EventCategory["ProviderMotion"] = "provider.motion";
536
545
  EventCategory["ProviderDetection"] = "provider.detection";
537
546
  EventCategory["EnrichmentEmbeddingStored"] = "enrichment.embedding.stored";
@@ -5370,7 +5379,7 @@ var ZodIssueCode = {
5370
5379
  var ZodFirstPartyTypeKind;
5371
5380
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5372
5381
  //#endregion
5373
- //#region ../types/dist/sleep-gU6hqv4_.mjs
5382
+ //#region ../types/dist/sleep-CDCONfkt.mjs
5374
5383
  /**
5375
5384
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5376
5385
  * window to float samples (D455).
@@ -7684,7 +7693,7 @@ function errMsg(err) {
7684
7693
  return String(err);
7685
7694
  }
7686
7695
  //#endregion
7687
- //#region ../types/dist/composition-Dq42XWp0.mjs
7696
+ //#region ../types/dist/composition-D7ULvLdD.mjs
7688
7697
  var AUDIO_ENCODER_BY_CODEC = {
7689
7698
  opus: "libopus",
7690
7699
  aac: "aac",
@@ -8445,21 +8454,20 @@ function portable(target) {
8445
8454
  }
8446
8455
  portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac64");
8447
8456
  /**
8448
- * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
8449
- * valutatore puro del suo FRONTE.
8457
+ * THE table "which boolean of this device type counts as HIGH", and the
8458
+ * pure evaluator of its EDGE.
8450
8459
  *
8451
- * Viveva dentro il builtin virtual-doorbell
8452
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
8453
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
8454
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
8455
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
8456
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
8457
- * SPOSTA qui e il doorbell la ri-esporta.
8460
+ * ONE table for everyone who asks "is this device HIGH?": the
8461
+ * recorder's `RecordingTriggers.sensorDeviceIds` trigger, the post-analysis
8462
+ * sensor markers, the orchestrator's camera-sensors bridge and
8463
+ * the sources of a composite doorbell (`doorbellFeatureSources`, D671).
8464
+ * A second copy would diverge at the first cap added, and the symptom — "the
8465
+ * sensor rings the doorbell but does not record" — is exactly D62.
8458
8466
  *
8459
- * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
8460
- * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
8461
- * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
8462
- * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
8467
+ * ⚠ NOT `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), and the
8468
+ * two must not be unified: that one answers "what is the state WORD for a
8469
+ * rule" (and includes `presence`, `cover`, `alarm-panel`), this one "which
8470
+ * boolean's EDGE counts". Deliberately different vocabularies.
8463
8471
  */
8464
8472
  /**
8465
8473
  * Known binary / switch source caps → the boolean slice field whose
@@ -8551,17 +8559,17 @@ function evaluateSensorLevelEdge(input) {
8551
8559
  };
8552
8560
  }
8553
8561
  /**
8554
- * IL fronte. Puro: nessun orologio proprio, nessuna memoria — il chiamante
8555
- * porta `prior`, `nowMs` e il proprio `startedAtMs`.
8562
+ * THE edge. Pure: no clock of its own, no memory — the caller
8563
+ * brings `prior`, `nowMs` and its own `startedAtMs`.
8556
8564
  *
8557
- * Il caso della PRIMA slice già attiva è trattato esplicitamente e vale come
8558
- * fronte solo se il timestamp UPSTREAM della transizione è posteriore a
8559
- * `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
8560
- * servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
8561
- * stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
8562
- * iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
8563
- * adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
8564
- * SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
8565
+ * The case of the FIRST slice already active is treated explicitly and counts as an
8566
+ * edge only if the UPSTREAM timestamp of the transition is later than
8567
+ * `startedAtMs` **and** within `firstSightingFreshnessMs`. Both halves
8568
+ * are needed: freshness alone would fire on a boot-time hydration of a
8569
+ * state flipped a few seconds before the restart, and "after we started"
8570
+ * alone would fire, on a long-lived process, for a source
8571
+ * adopted today whose state changed yesterday. The ambiguous case ERRS TOWARD
8572
+ * SILENCE and declares it (`baseline-seeded-stale-active`).
8565
8573
  */
8566
8574
  function evaluateSensorEdge(input) {
8567
8575
  const value = sliceActiveValue(input.capName, input.slice);
@@ -10529,22 +10537,22 @@ var CLASS_MAP_MACRO_TARGETS = [
10529
10537
  "package"
10530
10538
  ];
10531
10539
  /**
10532
- * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
10533
- * un operatore può selezionare.
10540
+ * The FIRST-LEVEL macro classes: those an object detector emits and that
10541
+ * an operator can select.
10534
10542
  *
10535
- * Sono le tre offerte dallo step `object-detection`
10543
+ * They are the three offered by the `object-detection` step
10536
10544
  * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
10537
- * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
10538
- * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
10539
- * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
10540
- * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
10545
+ * `enabledMacroClasses`). `package` is in {@link CLASS_MAP_MACRO_TARGETS} and in
10546
+ * `MACRO_LABELS` — it is a true macro — but NOT here: it belongs to the step
10547
+ * `package-detection`, whose enablement is driven by zones, and offering the
10548
+ * same word twice has already made an operator turn on the COCO proxy
10541
10549
  * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
10542
10550
  *
10543
- * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
10544
- * dello step e una seconda volta come union `FirstLevelMacro`
10545
- * (`types/detection.ts`); una terza copia per il trigger di registrazione
10546
- * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
10547
- * successiva.
10551
+ * ONE list. Before today the same three were hand-written in the step's offer
10552
+ * and a second time as the union `FirstLevelMacro`
10553
+ * (`types/detection.ts`); a third copy for the recording trigger
10554
+ * (`RecordingTriggers.objectClasses`) would have made the later divergence
10555
+ * invisible.
10548
10556
  */
10549
10557
  var FIRST_LEVEL_MACRO_CLASSES = [
10550
10558
  "person",
@@ -10552,8 +10560,8 @@ var FIRST_LEVEL_MACRO_CLASSES = [
10552
10560
  "animal"
10553
10561
  ];
10554
10562
  /**
10555
- * True quando `value` è una macro di primo livello. Type guard, non cast: un
10556
- * `className` che arriva dal bus è una stringa qualunque finché non passa di
10563
+ * True when `value` is a first-level macro. Type guard, not cast: a
10564
+ * `className` coming from the bus is any string until it passes through
10557
10565
  * qui.
10558
10566
  */
10559
10567
  function isFirstLevelMacroClass(value) {
@@ -10635,17 +10643,17 @@ var RecordingStorageModeSchema = _enum([
10635
10643
  "on-device-decision"
10636
10644
  ]);
10637
10645
  /**
10638
- * Le macro classi che possono aprire una finestra di registrazione — le stesse
10639
- * tre offerte dallo step `object-detection`, da UNA lista
10646
+ * The macro classes that can open a recording window — the same
10647
+ * three offered by the `object-detection` step, from ONE list
10640
10648
  * ({@link FIRST_LEVEL_MACRO_CLASSES}).
10641
10649
  */
10642
10650
  var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
10643
10651
  /**
10644
- * True quando `values` non ripete un elemento.
10652
+ * True when `values` does not repeat an element.
10645
10653
  *
10646
- * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
10647
- * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
10648
- * conterebbe due volte le sue finestre in `segmentMissedByMs`.
10654
+ * A duplicate is not harmless: every entry of `objectClasses` / `sensorDeviceIds`
10655
+ * becomes a SOURCE in `bandTriggerSources`, and the same source twice
10656
+ * would count its windows twice in `segmentMissedByMs`.
10649
10657
  */
10650
10658
  var noDuplicates = (values) => new Set(values).size === values.length;
10651
10659
  /** Which detectors trigger an `events`-mode band. */
@@ -10653,34 +10661,34 @@ var RecordingTriggersSchema = object({
10653
10661
  motion: boolean().optional(),
10654
10662
  audioThresholdDbfs: number().optional(),
10655
10663
  /**
10656
- * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
10657
- * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
10658
- * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
10659
- * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
10664
+ * The macro classes whose detection opens a window. ABSENT = the source
10665
+ * is not listened to; an EMPTY array is rejected, because "events band, object
10666
+ * trigger on, no class" is the same shape "enabled and records
10667
+ * nothing, forever" that `eventsBandCanEverDemand` is written against.
10660
10668
  *
10661
- * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
10662
- * quelle che hanno attraversato `enabledMacroClasses`, i
10663
- * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
10664
- * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
10665
- * finestre — vedi `recorder/object-trigger.ts`.
10669
+ * The signal read is ALREADY FILTERED: only `source: 'pipeline'` detections, i.e.
10670
+ * those that went through `enabledMacroClasses`, the
10671
+ * `minConfidence<Macro>` and the full-frame guard. The camera's onboard AI
10672
+ * (`source: 'onboard'`) goes through none of those gates and does NOT open
10673
+ * windows — see `recorder/object-trigger.ts`.
10666
10674
  */
10667
10675
  objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
10668
10676
  /**
10669
- * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
10670
- * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
10677
+ * The LINKED devices whose RISING EDGE opens a window. Absent = the source
10678
+ * is not listened to; an empty array is rejected for the same reason as
10671
10679
  * `objectClasses`.
10672
10680
  *
10673
- * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
10674
- * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
10675
- * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
10676
- * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
10677
- * device (D12) — mai un elenco globale di cap.
10681
+ * These are SOURCE device ids, not cameras: the band names them, so the
10682
+ * hot path (`DeviceStateChanged`, at bus rate across the whole fleet)
10683
+ * does no RPC. The OFFER from which the operator picks them is another question, and
10684
+ * is resolved with `deviceManager.getLinkedDevices` + `getBindingsBatch` per
10685
+ * device (D12) — never a global list of caps.
10678
10686
  *
10679
- * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
10680
- * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
10681
- * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
10682
- * il livello: un contatto trovato già aperto al riavvio del runner non fa
10683
- * registrare.
10687
+ * What "high" means depends on the device TYPE and is not decided here:
10688
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) is THE table,
10689
+ * the same one as the composite doorbell (D671). And it is the EDGE, not
10690
+ * the level: a contact found already open at runner restart does not
10691
+ * record.
10684
10692
  */
10685
10693
  sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
10686
10694
  });
@@ -12060,7 +12068,7 @@ var DecoderSessionConfigSchema = object({
12060
12068
  * - **VALUE** — at which level, for which scope, until when. That stays ONE
12061
12069
  * thing: the logging settings document on the `system` cap. Two authorities
12062
12070
  * over the values is the exact defect
12063
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
12071
+ * `docs/design/plans/2026-08-26-per-component-logging.md` was written to
12064
12072
  * remove; re-introducing it from the cure side would be grotesque.
12065
12073
  *
12066
12074
  * Nothing in this file reads a clock, an env var or a store. The registry is
@@ -16363,7 +16371,7 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
16363
16371
  *
16364
16372
  * ⚠ An earlier version of this comment blamed Zod stripping, and that
16365
16373
  * was wrong — corrected 2026-08-26 after the hop map
16366
- * (`docs/design/2026-08-26-mappa-hop-argomenti.md`) traced the path.
16374
+ * (`docs/design/2026-08-26-topic-hop-map.md`) traced the path.
16367
16375
  * There is **no Zod parse at all** between the door and the engine: the
16368
16376
  * dispatcher forwards the payload verbatim and UDS carries it whole. A
16369
16377
  * field declared here reaches `SqliteSettingsBackend` either way.
@@ -17150,7 +17158,17 @@ var SiteZoneSchema = object({
17150
17158
  var ProviderStatusSchema = object({
17151
17159
  connected: boolean(),
17152
17160
  deviceCount: number(),
17153
- error: string().optional()
17161
+ error: string().optional(),
17162
+ /**
17163
+ * `'orchestrator'`: this provider writes NO camera's `motion` runtime slice
17164
+ * — the orchestrator is its only writer (D696). Set by `BaseDeviceProvider`,
17165
+ * which every provider bundles, so only a provider BUILT from D696-amended
17166
+ * code says it. ABSENT means an older provider that may still write it (raw
17167
+ * VMD writes, a boot seed), and the orchestrator's provider gate keeps that
17168
+ * provider's cameras unwritten (`camera-sensors/motion-slice-provider-gate.ts`)
17169
+ * — the provider twin of the runner's `getLocalLoad().motionSliceWriter`.
17170
+ */
17171
+ motionSliceWriter: literal("orchestrator").optional()
17154
17172
  });
17155
17173
  object({
17156
17174
  externalId: string(),
@@ -17948,28 +17966,10 @@ method(object({
17948
17966
  deviceIds: array(number()).readonly(),
17949
17967
  caps: array(string()).readonly().optional()
17950
17968
  }), record(string(), record(string(), unknown().nullable())));
17951
- object({
17952
- /** Ms epoch of the last press. null = never observed since this provider started. */
17953
- lastPressedAt: number().nullable(),
17954
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
17955
- pressCountSinceStart: number()
17956
- });
17957
- object({
17958
- deviceId: number(),
17959
- timestamp: number()
17960
- });
17961
- /**
17962
- * The `doorbell-source` extension slot's editable value (D648): the camera's
17963
- * virtual-doorbell trigger devices, exactly what the wrapper's
17964
- * `doorbellSources` persists (as `{ deviceId }` records).
17965
- */
17966
- var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
17969
+ var ExtensionSlotIdSchema = _enum(["linked-devices"]);
17967
17970
  DeviceType.Camera;
17968
- DeviceType.Button, DeviceType.Camera;
17969
- var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
17970
- DeviceType.Camera, DeviceType.Camera;
17971
17971
  /** A slot's editable value, discriminated on `slot`. */
17972
- var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
17972
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
17973
17973
  DeviceType.Camera;
17974
17974
  var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
17975
17975
  state: literal("unreachable"),
@@ -18006,10 +18006,11 @@ var ExtensionSlotSourceSchema = object({
18006
18006
  });
18007
18007
  /**
18008
18008
  * A DIFFERENT authority that gates whether the slot's sources do anything —
18009
- * reported read-only, named, never written through this contract (D62). The
18010
- * virtual doorbell's sources ring only while the wrapper is bound to the
18011
- * camera, and that binding belongs to `deviceManager.setWrapperActive`.
18012
- * `unknown` means the gate could not be read; it is not "inactive" (D315).
18009
+ * reported read-only, named, never written through this contract (D62) — e.g.
18010
+ * a slot whose sources act only while a wrapper is bound to the host, a
18011
+ * binding that belongs to `deviceManager.setWrapperActive`. No slot reports
18012
+ * one today (`linked-devices` answers `null`). `unknown` means the gate could
18013
+ * not be read; it is not "inactive" (D315).
18013
18014
  */
18014
18015
  var ExtensionSlotActivationSchema = object({
18015
18016
  state: _enum([
@@ -18025,7 +18026,7 @@ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
18025
18026
  /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
18026
18027
  slotRef: string(),
18027
18028
  slot: ExtensionSlotIdSchema,
18028
- /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
18029
+ /** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
18029
18030
  authority: string(),
18030
18031
  activation: ExtensionSlotActivationSchema.nullable(),
18031
18032
  value: ExtensionSlotValueSchema,
@@ -18303,7 +18304,7 @@ method(object({
18303
18304
  * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
18304
18305
  * ends in a log line, and a log line is the thing the operator asked to stop
18305
18306
  * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
18306
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
18307
+ * 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
18307
18308
  * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
18308
18309
  * media blackout were both diagnosed. The counters stay; this is where they can
18309
18310
  * be READ.
@@ -22907,6 +22908,29 @@ object({
22907
22908
  firstAt: number(),
22908
22909
  lastAt: number()
22909
22910
  });
22911
+ var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
22912
+ var NcAlarmDelaySecSchema = number().int().min(0).max(600);
22913
+ var NcAlarmTriggeredSecSchema = number().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
22914
+ var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
22915
+ var NcAlarmModeDelaysListSchema = array(object({
22916
+ mode: AlarmArmModeSchema,
22917
+ exitDelaySec: NcAlarmDelaySecSchema.optional(),
22918
+ entryDelaySec: NcAlarmDelaySecSchema.optional(),
22919
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.optional()
22920
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
22921
+ var NcAlarmModeDelaysEditListSchema = array(object({
22922
+ mode: AlarmArmModeSchema,
22923
+ exitDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
22924
+ entryDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
22925
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.nullable().optional()
22926
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
22927
+ /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
22928
+ var NcAlarmNonBlockingEditSchema = object({
22929
+ mode: AlarmArmModeSchema,
22930
+ deviceId: number().int().positive(),
22931
+ /** true = on the list (may be open, does not block); false = off the list (blocks). */
22932
+ nonBlocking: boolean()
22933
+ });
22910
22934
  /**
22911
22935
  * The per-mode lists, at most one per mode. Two lists for one mode have no
22912
22936
  * meaning a reader could agree on (union? the last one?), so they are refused
@@ -22915,10 +22939,10 @@ object({
22915
22939
  var NcAlarmNonBlockingListSchema = array(object({
22916
22940
  mode: AlarmArmModeSchema,
22917
22941
  deviceIds: array(number().int()).max(200)
22918
- })).max(8).refine((lists) => new Set(lists.map((l) => l.mode)).size === lists.length, { message: "nonBlocking: at most one list per arm mode" });
22942
+ })).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
22919
22943
  /**
22920
- * The three durations the panel's state machine runs on, who hears about its
22921
- * transitions, and which openings each mode tolerates.
22944
+ * The three durations — global, and per mode since D697 — the panel's state
22945
+ * machine runs on, who hears about its transitions, and which openings each mode tolerates.
22922
22946
  *
22923
22947
  * They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
22924
22948
  * `alarm-panel` is `deviceNative` and its other provider mirrors somebody
@@ -22928,15 +22952,15 @@ var NcAlarmNonBlockingListSchema = array(object({
22928
22952
  */
22929
22953
  var NcAlarmSettingsSchema = object({
22930
22954
  /** Grace period between arming and the mode taking effect. 0 = immediate. */
22931
- exitDelaySec: number().int().min(0).max(600),
22955
+ exitDelaySec: NcAlarmDelaySecSchema,
22932
22956
  /** Grace period between a trigger and the alarm firing. 0 = immediate. */
22933
- entryDelaySec: number().int().min(0).max(600),
22957
+ entryDelaySec: NcAlarmDelaySecSchema,
22934
22958
  /**
22935
22959
  * How long `triggered` lasts before the panel re-arms itself.
22936
22960
  * **0 = until an operator disarms it** — the behaviour before this field
22937
22961
  * existed, and therefore what an untouched install keeps doing.
22938
22962
  */
22939
- triggeredDurationSec: number().int().min(0).max(3600),
22963
+ triggeredDurationSec: NcAlarmTriggeredSecSchema,
22940
22964
  /**
22941
22965
  * Deprecated by D630 — every transition is announced. Parsed, never read;
22942
22966
  * remove after one release. Optional so an older admin's patch (which still
@@ -22959,17 +22983,30 @@ var NcAlarmSettingsSchema = object({
22959
22983
  * per mode is meaningful. Defaulted to `[]` so a blob stored before D630
22960
22984
  * parses as "every opening blocks" — the behaviour it was written under.
22961
22985
  */
22962
- nonBlocking: NcAlarmNonBlockingListSchema.default([])
22986
+ nonBlocking: NcAlarmNonBlockingListSchema.default([]),
22987
+ /**
22988
+ * Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
22989
+ * without a field, uses the global value above — so `[]`, the default, is exactly the
22990
+ * behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
22991
+ */
22992
+ modeDelays: NcAlarmModeDelaysListSchema.default([])
22963
22993
  });
22964
22994
  /**
22965
22995
  * Every field optional — a tab edits one control at a time.
22966
22996
  *
22967
- * `nonBlocking` is re-declared WITHOUT its default: `.partial()` does not
22968
- * remove an inner `.default()`, so a patch that never named the field would
22969
- * parse to `nonBlocking: []` and wipe every mode's list on an unrelated edit
22970
- * (the same trap {@link NcRulePatchSchema} documents).
22997
+ * `nonBlocking` and `modeDelays` are re-declared WITHOUT their defaults:
22998
+ * `.partial()` does not remove an inner `.default()`, so a patch that never
22999
+ * named the field would parse to `[]` and wipe every mode's list on an
23000
+ * unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
23001
+ * `modeDelays` means EDITS, not the stored overrides.
22971
23002
  */
22972
- var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({ nonBlocking: NcAlarmNonBlockingListSchema }).partial();
23003
+ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
23004
+ nonBlocking: NcAlarmNonBlockingListSchema,
23005
+ /** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
23006
+ modeDelays: NcAlarmModeDelaysEditListSchema,
23007
+ /** ONE membership change; the panel applies it to the list it holds at its turn. */
23008
+ nonBlockingEdit: NcAlarmNonBlockingEditSchema
23009
+ }).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" });
22973
23010
  /**
22974
23011
  * What one arm mode actually arms, DERIVED from the enabled rules gated on it.
22975
23012
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
@@ -23069,6 +23106,28 @@ var NcAlarmConfigSchema = object({
23069
23106
  */
23070
23107
  live: NcAlarmLiveSchema.optional()
23071
23108
  });
23109
+ var NcAlarmSensorReadingSchema = _enum([
23110
+ "open",
23111
+ "closed",
23112
+ "unknown",
23113
+ "not-opening"
23114
+ ]);
23115
+ /** One device's state as the alarm reads it — the classifier the arm check uses. */
23116
+ var NcAlarmSensorStateSchema = object({
23117
+ deviceId: number().int().positive(),
23118
+ reading: NcAlarmSensorReadingSchema,
23119
+ /** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
23120
+ state: string().nullable(),
23121
+ /** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
23122
+ unknownWhy: _enum(["read-failed", "unknown-word"]).nullable(),
23123
+ /** The device manager's liveness as the centre mirrors it; null = not known. */
23124
+ online: boolean().nullable()
23125
+ });
23126
+ var NcAlarmSensorsInputSchema = object({ deviceIds: array(number().int().positive()).max(500) });
23127
+ var NcAlarmSensorsSchema = object({
23128
+ sensors: array(NcAlarmSensorStateSchema),
23129
+ readAt: number().int().nonnegative()
23130
+ });
23072
23131
  /**
23073
23132
  * ONE rule's demand on ONE camera's clip ring.
23074
23133
  *
@@ -23159,7 +23218,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
23159
23218
  }), method(object({}), NcAlarmConfigSchema, { auth: "admin" }), method(object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
23160
23219
  kind: "mutation",
23161
23220
  auth: "admin"
23162
- });
23221
+ }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
23163
23222
  /**
23164
23223
  * Zod schemas for persisted record types.
23165
23224
  *
@@ -23506,12 +23565,26 @@ var CameraSensorRefSchema = object({
23506
23565
  function cameraSensorRefKey(ref) {
23507
23566
  return `${ref.addonId}/${ref.stableId}`;
23508
23567
  }
23509
- /** CS-1 accepts exactly one mode; CS-2 (D673) widens it to confirm / replace. */
23510
- var CameraSensorsModeSchema = _enum(["in-addition"]);
23511
- var CameraSensorsConfigSchema = object({
23512
- mode: CameraSensorsModeSchema,
23513
- sensors: array(CameraSensorRefSchema).min(1).max(8)
23514
- }).superRefine((value, ctx) => {
23568
+ /**
23569
+ * A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
23570
+ * `replace`: its motion is the camera's, and while one is READY the camera's
23571
+ * own motion no longer counts on its own. `confirm`: while one is READY the
23572
+ * camera's own motion counts only while a confirm sensor is active — with or
23573
+ * without a replace sensor (spec C2, the controller's ruling on Q1).
23574
+ */
23575
+ var CameraSensorModeSchema = _enum([
23576
+ "in-addition",
23577
+ "confirm",
23578
+ "replace"
23579
+ ]);
23580
+ /** A stored sensor with no mode — every CS-1 row — is in addition. */
23581
+ var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
23582
+ /**
23583
+ * A camera's attached sensors. A CS-1 row carried an envelope
23584
+ * `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
23585
+ * what the write stores (D672 rule 3), so it is never written again.
23586
+ */
23587
+ var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
23515
23588
  const seen = /* @__PURE__ */ new Set();
23516
23589
  value.sensors.forEach((ref, index) => {
23517
23590
  const key = cameraSensorRefKey(ref);
@@ -23523,39 +23596,41 @@ var CameraSensorsConfigSchema = object({
23523
23596
  seen.add(key);
23524
23597
  });
23525
23598
  });
23526
- var RefFields = {
23599
+ /** Every attachment names its mode; an older orchestrator that does not is in addition. */
23600
+ var AttachmentFields = {
23527
23601
  addonId: string(),
23528
- stableId: string()
23602
+ stableId: string(),
23603
+ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
23529
23604
  };
23530
23605
  var CameraSensorAttachmentSchema = discriminatedUnion("state", [
23531
23606
  object({
23532
- ...RefFields,
23607
+ ...AttachmentFields,
23533
23608
  state: literal("ready"),
23534
23609
  deviceId: number(),
23535
23610
  name: string(),
23536
23611
  caps: array(string()).readonly()
23537
23612
  }),
23538
23613
  object({
23539
- ...RefFields,
23614
+ ...AttachmentFields,
23540
23615
  state: literal("offline"),
23541
23616
  deviceId: number(),
23542
23617
  name: string(),
23543
23618
  reason: _enum(["offline", "disabled"])
23544
23619
  }),
23545
23620
  object({
23546
- ...RefFields,
23621
+ ...AttachmentFields,
23547
23622
  state: literal("missing"),
23548
23623
  reason: string()
23549
23624
  }),
23550
23625
  object({
23551
- ...RefFields,
23626
+ ...AttachmentFields,
23552
23627
  state: literal("unsupported"),
23553
23628
  deviceId: number(),
23554
23629
  name: string(),
23555
23630
  reason: string()
23556
23631
  }),
23557
23632
  object({
23558
- ...RefFields,
23633
+ ...AttachmentFields,
23559
23634
  state: literal("unreadable"),
23560
23635
  reason: string()
23561
23636
  })
@@ -23568,17 +23643,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
23568
23643
  * say.
23569
23644
  */
23570
23645
  var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
23646
+ /** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
23647
+ var CameraOwnMotionSchema = _enum([
23648
+ "always",
23649
+ "when-confirmed",
23650
+ "never"
23651
+ ]);
23652
+ /** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
23653
+ var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
23654
+ /**
23655
+ * The camera's OWN onboard motion (D696): the raw input the bridge combines,
23656
+ * never the effective value. The camera's `motion` slice is the effective one,
23657
+ * so a view of the camera's own row reads this.
23658
+ * - `atMs`: when the bridge received the camera's last own edge.
23659
+ * - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
23660
+ * AND it is younger than the window the bridge counts the camera's own motion
23661
+ * for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
23662
+ * sends a clear (heartbeats only) therefore reads `false` once no push came
23663
+ * within the window; a status read is a snapshot, so a live view re-asks.
23664
+ * Absent = this orchestrator has not received the camera's own motion since it
23665
+ * started (unknown, never "quiet"), or an orchestrator older than D696.
23666
+ */
23667
+ var CameraRawLevelSchema = object({
23668
+ detected: boolean(),
23669
+ atMs: number()
23670
+ });
23571
23671
  var CameraSensorsStatusSchema = discriminatedUnion("state", [
23572
- object({ state: literal("not-configured") }),
23672
+ object({
23673
+ state: literal("not-configured"),
23674
+ cameraLevel: CameraRawLevelSchema.optional()
23675
+ }),
23573
23676
  object({
23574
23677
  state: literal("unreadable"),
23575
- reason: string()
23678
+ reason: string(),
23679
+ cameraLevel: CameraRawLevelSchema.optional()
23576
23680
  }),
23577
23681
  object({
23578
23682
  state: literal("configured"),
23579
- mode: CameraSensorsModeSchema,
23683
+ cameraLevel: CameraRawLevelSchema.optional(),
23580
23684
  sensors: array(CameraSensorAttachmentSchema).readonly(),
23581
- notForwarded: CameraSensorsNotForwardedSchema.optional()
23685
+ /** Absent = an orchestrator older than CS-2: it does not say (D315). */
23686
+ cameraMotion: CameraOwnMotionSchema.optional(),
23687
+ notForwarded: CameraSensorsNotForwardedSchema.optional(),
23688
+ notEnforced: CameraSensorsNotEnforcedSchema.optional()
23582
23689
  })
23583
23690
  ]);
23584
23691
  Object.freeze({
@@ -24310,14 +24417,14 @@ var TrackSchema = object({
24310
24417
  * `derive-returned-null tile=standin`,
24311
24418
  * `native-tile tile=native no-key-frame-at-close`, …) written at close and
24312
24419
  * CLEARED by the late-keyFrame upgrade when a native tile lands after all.
24313
- * The operator-facing answer to "perché manca l'immagine?" on a track whose
24420
+ * The operator-facing answer to "perché manca l'immagine?" [why is the image missing?] on a track whose
24314
24421
  * tile is a face/plate stand-in, a raster crop, or an icon.
24315
24422
  *
24316
24423
  * **`no-key-frame-at-close` (D400).** The line used to be written ONLY when
24317
24424
  * the TILE ranked below native, so a track whose thumbnail landed natively
24318
24425
  * while its key frame missed carried no reason at all — three of the four
24319
24426
  * `MISSING_KEYFRAME` tracks in the 2026-09-07 operator audit were exactly
24320
- * that shape, and their "niente ultimo" had no cause anywhere on the row.
24427
+ * that shape, and their "niente ultimo" [no last frame] had no cause anywhere on the row.
24321
24428
  * The key frame is the head of a cascade (`keyFrame ⇒ keyFrameSmall ⇒ the
24322
24429
  * lastFrame copy source`), so its absence is now on this line whatever the
24323
24430
  * tile ended up being.
@@ -24404,7 +24511,7 @@ var MotionEventSchema = object({
24404
24511
  /**
24405
24512
  * Ms offsets from `timestamp` (the episode's own first rising edge, so the
24406
24513
  * first entry is always `0`) of every genuine off→on transition the
24407
- * episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
24514
+ * episode saw — "ogni evento on si deve salvare" [every ON event must be saved] (D475). NOT one entry per
24408
24515
  * push: a firmware source that keepalives at ~1 Hz for the whole burst
24409
24516
  * (Reolink, Hikvision) produces exactly one edge; a source that reports an
24410
24517
  * explicit `false` mid-episode and then resumes before the quiet window
@@ -27012,8 +27119,10 @@ var RunnerCameraConfigSchema = object({
27012
27119
  * - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
27013
27120
  * analyzer providers) running on decoded frames in this runner.
27014
27121
  * - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
27015
- * analytics). The provider emits ProviderMotion
27016
- * events; the orchestrator forwards to `reportMotion`.
27122
+ * analytics). The provider emits its raw push as `ProviderMotion`
27123
+ * (D673); the orchestrator's camera-sensors bridge re-emits the camera's
27124
+ * effective motion as `MotionOnMotionChanged`, which is what reaches
27125
+ * `reportMotion`.
27017
27126
  */
27018
27127
  motionSources: MotionSourcesSchema.default(["analyzer"]),
27019
27128
  /**
@@ -27190,7 +27299,15 @@ var RunnerLocalLoadSchema = object({
27190
27299
  hasGpu: boolean(),
27191
27300
  inferenceBackend: string().optional(),
27192
27301
  cpuCores: number().optional()
27193
- })
27302
+ }),
27303
+ /**
27304
+ * Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
27305
+ * runner never writes it. ABSENT = a runner older than D696, which still
27306
+ * writes the slice from its phase machine; the orchestrator does not write
27307
+ * while any runner node is absent-or-unanswered, so one slice never has two
27308
+ * writers.
27309
+ */
27310
+ motionSliceWriter: literal("orchestrator").optional()
27194
27311
  });
27195
27312
  /**
27196
27313
  * Aggregate runtime metrics for the runner's whole local pool. Mirrors the
@@ -30073,7 +30190,7 @@ var ClipPlaybackSchema = object({
30073
30190
  * **One authorised yes is one wake.** `next-natural` — take the clip the next
30074
30191
  * time the camera is awake for its own reasons — is deliberately not a member:
30075
30192
  * it was proposed, it is free on the battery, and the operator declined it on
30076
- * 2026-09-20 (*"Quando un export viene richiesto si sveglia la camera."*,
30193
+ * 2026-09-20 (*"Quando un export viene richiesto si sveglia la camera."* [When an export is requested the camera wakes up],
30077
30194
  * D558 "Considered and not taken").
30078
30195
  */
30079
30196
  var ClipWakeSchema = _enum(["authorised"]);
@@ -30388,7 +30505,7 @@ var videoclipsCapability = {
30388
30505
  * **It is a SECTION of the Recording tab, at the end of it — not a tab of
30389
30506
  * its own.** It shipped as a `clips` top-tab and the operator rejected the
30390
30507
  * placement: *"utilizzerei la stessa tab recordings, lì abbiamo già tutto il
30391
- * necessario, una nuova sezione alla fine per le clips"*. The Recording tab
30508
+ * necessario, una nuova sezione alla fine per le clips"* [I would use the same recordings tab, there we already have everything necessary, a new section at the end for the clips]. The Recording tab
30392
30509
  * already holds the recorder's panel, the schedule bands and the unified
30393
30510
  * retention policy; footage the camera itself holds is the same question,
30394
30511
  * asked of a different store. `order: 100` puts it after all of them with
@@ -30449,7 +30566,7 @@ var videoclipsCapability = {
30449
30566
  * It replaced `sources?: string[]`, a VIEW filter over source ids that
30450
30567
  * assumed the answer was a fan-out over everything a camera has. The
30451
30568
  * operator settled otherwise on 2026-09-20 — *"l'utilizzatore è uno
30452
- * solo"* — so the list is asked of one provider at a time and there is
30569
+ * solo"* [there is only one user] — so the list is asked of one provider at a time and there is
30453
30570
  * nothing to filter out of it.
30454
30571
  */
30455
30572
  provider: string().min(1)
@@ -32698,6 +32815,17 @@ object({
32698
32815
  deviceId: number(),
32699
32816
  status: DeviceStatusSchema
32700
32817
  });
32818
+ object({
32819
+ /** Ms epoch of the last press. null = never observed since this provider started. */
32820
+ lastPressedAt: number().nullable(),
32821
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
32822
+ pressCountSinceStart: number()
32823
+ });
32824
+ object({
32825
+ deviceId: number(),
32826
+ timestamp: number()
32827
+ });
32828
+ DeviceType.Button, DeviceType.Camera;
32701
32829
  /**
32702
32830
  * Enum-state sensor — a string value picked from a finite option set.
32703
32831
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -34337,39 +34465,14 @@ authKey: string().optional() }), object({
34337
34465
  /** Human-readable error when `ok: false`. */
34338
34466
  error: string().optional()
34339
34467
  }), { kind: "mutation" });
34340
- /**
34341
- * Hardware / firmware motion sensor cap — binary detected state plus
34342
- * a timestamp of the last observation. Distinct from
34343
- * `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
34344
- * `motion` is the lightweight readout from on-camera motion (Reolink
34345
- * `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
34346
- *
34347
- * Native-motion providers also fan out to `detection.camera-native`
34348
- * with `source: 'onboard'` so cross-cutting system services
34349
- * (alert-center, advanced-notifier) can subscribe once and receive
34350
- * motion from every camera.
34351
- */
34352
- /**
34353
- * How long after a camera's last rising edge `pipeline-analytics` closes the
34354
- * motion EPISODE row it kept open for it (D475) — "il delay della cap", in
34355
- * the operator's words. One authority for the whole system: every provider
34356
- * that seeds `autoClearAfterMs` on a `Camera` device writes this SAME
34357
- * constant while `detected: true` (never its own number — Hikvision used to
34358
- * seed its internal 3 s inactivity timer here, which is a different clock for
34359
- * a different purpose), and `MotionEpisodeTracker` imports it directly rather
34360
- * than reading the live cap value on the hot path. A `Sensor` device (HA
34361
- * binary sensor, Homematic) gets a genuine push both ways and has no episode
34362
- * to close on a timer, so it writes `null`, never this constant.
34363
- */
34364
- var MOTION_CLOSE_AFTER_MS = 15e3;
34365
34468
  object({
34366
34469
  detected: boolean(),
34367
34470
  /** Ms epoch of the last detected-true observation. Null if never detected. */
34368
34471
  lastDetectedAt: number().nullable(),
34369
34472
  /**
34370
- * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
34371
- * `null` while false and on every `Sensor` device (D475) — see that
34372
- * constant's doc for the one-authority rule.
34473
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
34474
+ * orchestrator writes it, D696), `null` while false and on every `Sensor`
34475
+ * device (D475) — see that constant's doc for the one-authority rule.
34373
34476
  *
34374
34477
  * ## Reading this field still arms nothing
34375
34478
  *
@@ -34387,38 +34490,41 @@ object({
34387
34490
  * `addon-export-alexa/src/motion-clear-hold.ts` and
34388
34491
  * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
34389
34492
  *
34390
- * ## Who writes it
34391
- *
34392
- * - **Cameras** — the runner's phase machine, `active → watching` on
34393
- * `cooldown_expired`, which then writes this slice with
34394
- * `detected: false` (`handlePhaseChanged` in
34395
- * `pipeline-runner/index.ts`). It produces the FALLING edge, which
34396
- * matters most for the sources that only ever push a rising one:
34397
- * Reolink emits `MotionOnMotionChanged { detected: true }` and never
34398
- * a false.
34399
- * - **Sensors** (Home Assistant binary sensors, Homematic) — the
34400
- * provider pushes the false itself, from the upstream system's own
34401
- * state change. No phase machine is involved.
34402
- *
34403
- * ### The phase machine is CANONICAL, not sole — and that is a defect
34404
- *
34405
- * An earlier revision of this docblock (mine, 2026-09-12) claimed the
34406
- * phase machine is the sole writer for a camera. It is not.
34407
- * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
34408
- * `setCapSlice(motionCapability, …)` on their own rising edge, and
34409
- * Hikvision's comment says why: it read THIS docblock, agreed the
34410
- * runner is canonical, and wrote anyway to avoid per-tick churn. So
34411
- * two authorities can disagree about one slice, which this repo
34412
- * forbids, and the doc said otherwise — which is worse than saying
34413
- * nothing, because it reads as verification.
34414
- *
34415
- * This predates D475 and is not fixed there: the fix touches every
34416
- * camera provider. Recorded in D475's Consequences. Do not restore the
34417
- * "sole writer" wording without also removing the other writers.
34493
+ * ## Who writes it (D696)
34494
+ *
34495
+ * - **Cameras** — the orchestrator, and nothing else. It writes the camera's
34496
+ * EFFECTIVE motion (`addon-pipeline-orchestrator`
34497
+ * `camera-sensors/motion-slice.ts`), alongside the effective
34498
+ * `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
34499
+ * for a split camera, an unsplit emitter's direct event, the analyzer and
34500
+ * device activity, as the camera's `motionSources` counts them. A source
34501
+ * that never sends a clear falls one window after its last `true`.
34502
+ * `lastDetectedAt` moves only on an effective rise. No camera provider
34503
+ * writes this slice (not even a boot seed), and neither does the runner's
34504
+ * phase machine: its phase is "a session is attached" for every on-motion
34505
+ * session, not motion, and it now has its own `DetectionPhaseTransition`.
34506
+ * A provider's `isDetected` answers from the hub's slice.
34507
+ * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
34508
+ * imports) — the provider pushes both edges itself, from the upstream
34509
+ * system's own state change. That is the sensor's own fact.
34510
+ *
34511
+ * `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
34512
+ * `motion` slice; each sensor writer is a named exemption.
34513
+ *
34514
+ * This replaces the D475 §4 rule ("the phase machine is the sole writer").
34515
+ * That rule was never true: Hikvision and Amcrest wrote the slice raw beside
34516
+ * it, every provider seeded it at boot, and every session left it
34517
+ * `detected: true` after its detach.
34418
34518
  */
34419
34519
  autoClearAfterMs: number().nullable()
34420
34520
  });
34421
- object({
34521
+ /**
34522
+ * Payload of `motion.onMotionChanged` event + the corresponding bus
34523
+ * event `EventCategory.MotionOnMotionChanged`. Single source of truth
34524
+ * — both the cap event surface and the bus payload type alias to this
34525
+ * schema.
34526
+ */
34527
+ var MotionOnMotionChangedDataSchema = object({
34422
34528
  deviceId: number(),
34423
34529
  detected: boolean(),
34424
34530
  timestamp: number(),
@@ -37001,7 +37107,7 @@ var ReadGopBytesResultSchema = object({
37001
37107
  /**
37002
37108
  * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
37003
37109
  * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
37004
- * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
37110
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-clip-replay-on-pipeline.md`):
37005
37111
  * a replay needs several seconds of native pixels, not one frame.
37006
37112
  *
37007
37113
  * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
@@ -45016,6 +45122,12 @@ Object.freeze({
45016
45122
  addonId: null,
45017
45123
  access: "view"
45018
45124
  },
45125
+ "notificationRules.getAlarmSensors": {
45126
+ capName: "notification-rules",
45127
+ capScope: "system",
45128
+ addonId: null,
45129
+ access: "view"
45130
+ },
45019
45131
  "notificationRules.getClipRetentionAsks": {
45020
45132
  capName: "notification-rules",
45021
45133
  capScope: "system",
@@ -49499,6 +49611,11 @@ Object.freeze({
49499
49611
  form: "single",
49500
49612
  optional: false
49501
49613
  }],
49614
+ "notificationRules.getAlarmSensors": [{
49615
+ name: "deviceIds",
49616
+ form: "array",
49617
+ optional: false
49618
+ }],
49502
49619
  "notificationRules.setDeviceMuted": [{
49503
49620
  name: "deviceId",
49504
49621
  form: "single",
@@ -51346,7 +51463,7 @@ var PreviewTextField = string().max(200);
51346
51463
  * Whether the notification's preview is a STILL or a short animation.
51347
51464
  *
51348
51465
  * The operator's ask, verbatim: *"inviato come gif o video (come per le altre
51349
- * rule)"* — the other rules already offer an animated preview, and a ten-hour
51466
+ * rule)"* [sent as a gif or video (as for the other rules)] — the other rules already offer an animated preview, and a ten-hour
51350
51467
  * night reads better as three seconds of motion than as one frame of it. Both
51351
51468
  * modes get the SAME treatment (blurred frame, large centred title); `'gif'`
51352
51469
  * simply applies it to a dozen frames sampled across the render and assembles
@@ -51484,6 +51601,10 @@ TimelapseRuleInputSchema.extend({
51484
51601
  createdAt: number(),
51485
51602
  updatedAt: number()
51486
51603
  });
51604
+ function cameraOwnsMotionViaSensor(motionSources) {
51605
+ return motionSources.some((s) => s !== "analyzer");
51606
+ }
51607
+ MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
51487
51608
  /** True when `model` ships a build for `format`. */
51488
51609
  function hasBuild(model, format) {
51489
51610
  return Boolean(model.formats[format]);
@@ -52915,12 +53036,6 @@ Object.defineProperty(exports, "HF_BASE_URL", {
52915
53036
  return HF_BASE_URL;
52916
53037
  }
52917
53038
  });
52918
- Object.defineProperty(exports, "MOTION_CLOSE_AFTER_MS", {
52919
- enumerable: true,
52920
- get: function() {
52921
- return MOTION_CLOSE_AFTER_MS;
52922
- }
52923
- });
52924
53039
  Object.defineProperty(exports, "NativeLeaseAdmissionSchema", {
52925
53040
  enumerable: true,
52926
53041
  get: function() {
@@ -53071,6 +53186,12 @@ Object.defineProperty(exports, "buildFfmpegArgs", {
53071
53186
  return buildFfmpegArgs;
53072
53187
  }
53073
53188
  });
53189
+ Object.defineProperty(exports, "cameraOwnsMotionViaSensor", {
53190
+ enumerable: true,
53191
+ get: function() {
53192
+ return cameraOwnsMotionViaSensor;
53193
+ }
53194
+ });
53074
53195
  Object.defineProperty(exports, "cameraStreamsCapability", {
53075
53196
  enumerable: true,
53076
53197
  get: function() {