@camstack/addon-post-analysis 1.2.309 → 1.2.311

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 (14) hide show
  1. package/dist/{clip-model-registry-CrBn6Qvt.mjs → clip-model-registry-DPqDIZrG.mjs} +409 -200
  2. package/dist/{clip-model-registry-B3M4ZI17.js → clip-model-registry-X457TLXn.js} +456 -199
  3. package/dist/embedding-encoder/index.js +1 -1
  4. package/dist/embedding-encoder/index.mjs +1 -1
  5. package/dist/pipeline-analytics/_stub.js +2 -2
  6. package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-Bkf0-pki.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-D0JVXXRd.mjs} +2 -2
  7. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Ds6vT2FJ.mjs +26 -0
  8. package/dist/pipeline-analytics/{_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-B8qeS8Da.mjs → _virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-B_KS96RA.mjs} +1 -1
  9. package/dist/pipeline-analytics/{hostInit-Dj0aaMhv.mjs → hostInit-Da_2XVg_.mjs} +2 -2
  10. package/dist/pipeline-analytics/index.js +411 -34
  11. package/dist/pipeline-analytics/index.mjs +411 -34
  12. package/dist/pipeline-analytics/remoteEntry.js +1 -1
  13. package/package.json +1 -1
  14. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DWg2WU0a.mjs +0 -26
@@ -30,7 +30,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  }) : target, mod));
31
31
  //#endregion
32
32
  let node_crypto = require("node:crypto");
33
- //#region ../types/dist/event-category-C5xZWqz6.mjs
33
+ //#region ../types/dist/event-category-BGmz_oxW.mjs
34
34
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
35
35
  EventCategory["SystemBoot"] = "system.boot";
36
36
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -563,6 +563,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
563
563
  */
564
564
  EventCategory["PipelineAudioInferenceResult"] = "pipeline.audio-inference-result";
565
565
  EventCategory["DetectionPhaseTransition"] = "detection.phase-transition";
566
+ /**
567
+ * A camera provider's RAW onboard motion push (D673): the `MotionOnMotionChanged`
568
+ * data shape without `triggeredBy`, built by `providerMotionEvent`. Its one
569
+ * consumer is the orchestrator's camera-sensors bridge, which re-emits the
570
+ * camera's EFFECTIVE onboard motion as `MotionOnMotionChanged` (a pass-through
571
+ * for a camera with no attached sensor). Providers must not emit
572
+ * `MotionOnMotionChanged` themselves; `scripts/check-onboard-motion-emitters.ts`
573
+ * keeps it so (camera-grid is a named, deferred exception).
574
+ */
566
575
  EventCategory["ProviderMotion"] = "provider.motion";
567
576
  EventCategory["ProviderDetection"] = "provider.detection";
568
577
  EventCategory["EnrichmentEmbeddingStored"] = "enrichment.embedding.stored";
@@ -932,7 +941,7 @@ var NUMBER_FORMAT_RANGES = {
932
941
  float32: [-34028234663852886e22, 34028234663852886e22],
933
942
  float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
934
943
  };
935
- function pick(schema, mask) {
944
+ function pick$1(schema, mask) {
936
945
  const currDef = schema._zod.def;
937
946
  const checks = currDef.checks;
938
947
  if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
@@ -5002,7 +5011,7 @@ var ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
5002
5011
  return merge(this, other);
5003
5012
  },
5004
5013
  pick(mask) {
5005
- return pick(this, mask);
5014
+ return pick$1(this, mask);
5006
5015
  },
5007
5016
  omit(mask) {
5008
5017
  return omit(this, mask);
@@ -5409,7 +5418,7 @@ var ZodIssueCode = {
5409
5418
  var ZodFirstPartyTypeKind;
5410
5419
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5411
5420
  //#endregion
5412
- //#region ../types/dist/sleep-gU6hqv4_.mjs
5421
+ //#region ../types/dist/sleep-CDCONfkt.mjs
5413
5422
  /**
5414
5423
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5415
5424
  * window to float samples (D455).
@@ -7668,7 +7677,7 @@ function errMsg(err) {
7668
7677
  return String(err);
7669
7678
  }
7670
7679
  //#endregion
7671
- //#region ../types/dist/composition-Dq42XWp0.mjs
7680
+ //#region ../types/dist/composition-43aqsZQj.mjs
7672
7681
  /**
7673
7682
  * Deterministic SHA-256 hash of an arbitrary serialisable value. The
7674
7683
  * canonical form sorts object keys alphabetically at every depth so two
@@ -7756,13 +7765,12 @@ portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac
7756
7765
  * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
7757
7766
  * valutatore puro del suo FRONTE.
7758
7767
  *
7759
- * Viveva dentro il builtin virtual-doorbell
7760
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
7761
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
7762
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
7763
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
7764
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
7765
- * SPOSTA qui e il doorbell la ri-esporta.
7768
+ * UNA tabella per tutti quelli che chiedono "questo device è ALTO?": il
7769
+ * trigger `RecordingTriggers.sensorDeviceIds` del recorder, i marker dei
7770
+ * sensori della post-analysis, il bridge camera-sensors dell'orchestratore e
7771
+ * le sorgenti di un campanello composto (`doorbellFeatureSources`, D671).
7772
+ * Una seconda copia divergerebbe alla prima cap aggiunta, e il sintomo — "il
7773
+ * sensore fa suonare il campanello ma non registra" — è esattamente D62.
7766
7774
  *
7767
7775
  * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
7768
7776
  * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
@@ -7812,8 +7820,6 @@ var SOURCE_CAP_CHANGED_AT_FIELD = {
7812
7820
  vibration: "lastChangedAt",
7813
7821
  tamper: "lastChangedAt"
7814
7822
  };
7815
- /** Cap names whose presence in a device's bindings qualify it as a source. */
7816
- var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
7817
7823
  /** True when a cap is a recognised binary/switch source. */
7818
7824
  function isSourceCap(capName) {
7819
7825
  return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
@@ -9894,7 +9900,7 @@ var RecordingTriggersSchema = object({
9894
9900
  *
9895
9901
  * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
9896
9902
  * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
9897
- * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
9903
+ * la stessa del campanello composto (D671). Ed è il FRONTE, non
9898
9904
  * il livello: un contatto trovato già aperto al riavvio del runner non fa
9899
9905
  * registrare.
9900
9906
  */
@@ -16454,109 +16460,10 @@ method(object({
16454
16460
  deviceIds: array(number()).readonly(),
16455
16461
  caps: array(string()).readonly().optional()
16456
16462
  }), record(string(), record(string(), unknown().nullable())));
16457
- /**
16458
- * Doorbell button cap. Two kinds of providers coexist behind this cap
16459
- * name (same pattern as `snapshot`):
16460
- *
16461
- * - **Native** providers: registered per-device by device-driver
16462
- * addons via `ctx.registerNativeCap` — either on a
16463
- * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
16464
- * or directly on the camera (Reolink registers at camera level).
16465
- * Emits an `onPressed` event every time the firmware pushes a
16466
- * ring; status tracks the last press and a pressCount since start
16467
- * (diagnostic).
16468
- *
16469
- * - **Wrapper** provider: the `virtual-doorbell` system builtin
16470
- * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
16471
- * device (contact / switch / event-emitter …) into a doorbell for
16472
- * a camera. `defaultActive: false` — the operator explicitly binds
16473
- * it per camera in the device-bindings UI, then picks the source
16474
- * device + trigger in the per-device settings.
16475
- *
16476
- * The DeviceEventPropagator re-emits `onPressed` on the camera parent
16477
- * — subscribers listening at the camera level receive ring events
16478
- * with `via[]` populated. No code on the parent needed.
16479
- */
16480
- var DoorbellStatusSchema = object({
16481
- /** Ms epoch of the last press. null = never observed since this provider started. */
16482
- lastPressedAt: number().nullable(),
16483
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
16484
- pressCountSinceStart: number()
16485
- });
16486
- var DoorbellPressEventSchema = object({
16487
- deviceId: number(),
16488
- timestamp: number()
16489
- });
16490
- /**
16491
- * The `doorbell-source` extension slot's editable value (D648): the camera's
16492
- * virtual-doorbell trigger devices, exactly what the wrapper's
16493
- * `doorbellSources` persists (as `{ deviceId }` records).
16494
- */
16495
- var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
16496
- /**
16497
- * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
16498
- * doorbell, owned by the `virtual-doorbell` wrapper over its
16499
- * `doorbellSources` store (D648). A source rings when one of its
16500
- * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
16501
- * different authority (`deviceManager.setWrapperActive`, D62) — the slot
16502
- * reports it, it never writes it.
16503
- */
16504
- var DOORBELL_SOURCE_SLOT = {
16505
- id: "doorbell-source",
16506
- label: "Doorbell trigger devices",
16507
- 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.",
16508
- shape: "association",
16509
- hostDeviceTypes: [DeviceType.Camera],
16510
- sourceCaps: SOURCE_CAPS,
16511
- cardinality: "many",
16512
- value: DoorbellSourceSlotValueSchema
16513
- };
16514
- var doorbellCapability = {
16515
- name: "doorbell",
16516
- scope: "device",
16517
- deviceNative: true,
16518
- mode: "singleton",
16519
- kind: "wrapper",
16520
- defaultActive: false,
16521
- deviceTypes: [DeviceType.Button, DeviceType.Camera],
16522
- extensionSlots: [DOORBELL_SOURCE_SLOT],
16523
- methods: {},
16524
- events: {
16525
- /**
16526
- * Fires once per physical press. Reolink delivers via Baichuan
16527
- * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
16528
- * release/duration — it's a pulse.
16529
- */
16530
- onPressed: {
16531
- data: DoorbellPressEventSchema,
16532
- fromState: {
16533
- field: "lastPressedAt",
16534
- on: "advance"
16535
- }
16536
- } },
16537
- status: {
16538
- schema: DoorbellStatusSchema,
16539
- kind: "push"
16540
- },
16541
- /**
16542
- * Runtime-state slice — last press timestamp + lifetime press count.
16543
- * Mirrored by the kernel and readable via
16544
- * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
16545
- * without subscribing.
16546
- */
16547
- runtimeState: DoorbellStatusSchema,
16548
- /**
16549
- * 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.
16550
- *
16551
- * See `RuntimeStateDurability`. Enforced by
16552
- * `scripts/check-runtime-state-durability.ts`.
16553
- */
16554
- durability: "restored"
16555
- };
16556
- var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
16557
- DeviceType.Camera, DeviceType.Camera;
16463
+ var ExtensionSlotIdSchema = _enum(["linked-devices"]);
16464
+ DeviceType.Camera;
16558
16465
  /** A slot's editable value, discriminated on `slot`. */
16559
- var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
16466
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
16560
16467
  DeviceType.Camera;
16561
16468
  var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
16562
16469
  state: literal("unreachable"),
@@ -16593,10 +16500,11 @@ var ExtensionSlotSourceSchema = object({
16593
16500
  });
16594
16501
  /**
16595
16502
  * A DIFFERENT authority that gates whether the slot's sources do anything —
16596
- * reported read-only, named, never written through this contract (D62). The
16597
- * virtual doorbell's sources ring only while the wrapper is bound to the
16598
- * camera, and that binding belongs to `deviceManager.setWrapperActive`.
16599
- * `unknown` means the gate could not be read; it is not "inactive" (D315).
16503
+ * reported read-only, named, never written through this contract (D62) — e.g.
16504
+ * a slot whose sources act only while a wrapper is bound to the host, a
16505
+ * binding that belongs to `deviceManager.setWrapperActive`. No slot reports
16506
+ * one today (`linked-devices` answers `null`). `unknown` means the gate could
16507
+ * not be read; it is not "inactive" (D315).
16600
16508
  */
16601
16509
  var ExtensionSlotActivationSchema = object({
16602
16510
  state: _enum([
@@ -16612,7 +16520,7 @@ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
16612
16520
  /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
16613
16521
  slotRef: string(),
16614
16522
  slot: ExtensionSlotIdSchema,
16615
- /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
16523
+ /** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
16616
16524
  authority: string(),
16617
16525
  activation: ExtensionSlotActivationSchema.nullable(),
16618
16526
  value: ExtensionSlotValueSchema,
@@ -21850,6 +21758,31 @@ var NcSnoozeSuppressedSchema = object({
21850
21758
  firstAt: number(),
21851
21759
  lastAt: number()
21852
21760
  });
21761
+ /** The bounds every alarm delay field carries — settings, per-mode overrides, both editors. */
21762
+ var NC_ALARM_DELAY_MAX_SEC = 600;
21763
+ var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
21764
+ var NcAlarmDelaySecSchema = number().int().min(0).max(600);
21765
+ var NcAlarmTriggeredSecSchema = number().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
21766
+ var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
21767
+ var NcAlarmModeDelaysListSchema = array(object({
21768
+ mode: AlarmArmModeSchema,
21769
+ exitDelaySec: NcAlarmDelaySecSchema.optional(),
21770
+ entryDelaySec: NcAlarmDelaySecSchema.optional(),
21771
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.optional()
21772
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
21773
+ var NcAlarmModeDelaysEditListSchema = array(object({
21774
+ mode: AlarmArmModeSchema,
21775
+ exitDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
21776
+ entryDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
21777
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.nullable().optional()
21778
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
21779
+ /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
21780
+ var NcAlarmNonBlockingEditSchema = object({
21781
+ mode: AlarmArmModeSchema,
21782
+ deviceId: number().int().positive(),
21783
+ /** true = on the list (may be open, does not block); false = off the list (blocks). */
21784
+ nonBlocking: boolean()
21785
+ });
21853
21786
  /**
21854
21787
  * The per-mode lists, at most one per mode. Two lists for one mode have no
21855
21788
  * meaning a reader could agree on (union? the last one?), so they are refused
@@ -21858,10 +21791,10 @@ var NcSnoozeSuppressedSchema = object({
21858
21791
  var NcAlarmNonBlockingListSchema = array(object({
21859
21792
  mode: AlarmArmModeSchema,
21860
21793
  deviceIds: array(number().int()).max(200)
21861
- })).max(8).refine((lists) => new Set(lists.map((l) => l.mode)).size === lists.length, { message: "nonBlocking: at most one list per arm mode" });
21794
+ })).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
21862
21795
  /**
21863
- * The three durations the panel's state machine runs on, who hears about its
21864
- * transitions, and which openings each mode tolerates.
21796
+ * The three durations — global, and per mode since D697 — the panel's state
21797
+ * machine runs on, who hears about its transitions, and which openings each mode tolerates.
21865
21798
  *
21866
21799
  * They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
21867
21800
  * `alarm-panel` is `deviceNative` and its other provider mirrors somebody
@@ -21871,15 +21804,15 @@ var NcAlarmNonBlockingListSchema = array(object({
21871
21804
  */
21872
21805
  var NcAlarmSettingsSchema = object({
21873
21806
  /** Grace period between arming and the mode taking effect. 0 = immediate. */
21874
- exitDelaySec: number().int().min(0).max(600),
21807
+ exitDelaySec: NcAlarmDelaySecSchema,
21875
21808
  /** Grace period between a trigger and the alarm firing. 0 = immediate. */
21876
- entryDelaySec: number().int().min(0).max(600),
21809
+ entryDelaySec: NcAlarmDelaySecSchema,
21877
21810
  /**
21878
21811
  * How long `triggered` lasts before the panel re-arms itself.
21879
21812
  * **0 = until an operator disarms it** — the behaviour before this field
21880
21813
  * existed, and therefore what an untouched install keeps doing.
21881
21814
  */
21882
- triggeredDurationSec: number().int().min(0).max(3600),
21815
+ triggeredDurationSec: NcAlarmTriggeredSecSchema,
21883
21816
  /**
21884
21817
  * Deprecated by D630 — every transition is announced. Parsed, never read;
21885
21818
  * remove after one release. Optional so an older admin's patch (which still
@@ -21902,17 +21835,30 @@ var NcAlarmSettingsSchema = object({
21902
21835
  * per mode is meaningful. Defaulted to `[]` so a blob stored before D630
21903
21836
  * parses as "every opening blocks" — the behaviour it was written under.
21904
21837
  */
21905
- nonBlocking: NcAlarmNonBlockingListSchema.default([])
21838
+ nonBlocking: NcAlarmNonBlockingListSchema.default([]),
21839
+ /**
21840
+ * Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
21841
+ * without a field, uses the global value above — so `[]`, the default, is exactly the
21842
+ * behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
21843
+ */
21844
+ modeDelays: NcAlarmModeDelaysListSchema.default([])
21906
21845
  });
21907
21846
  /**
21908
21847
  * Every field optional — a tab edits one control at a time.
21909
21848
  *
21910
- * `nonBlocking` is re-declared WITHOUT its default: `.partial()` does not
21911
- * remove an inner `.default()`, so a patch that never named the field would
21912
- * parse to `nonBlocking: []` and wipe every mode's list on an unrelated edit
21913
- * (the same trap {@link NcRulePatchSchema} documents).
21849
+ * `nonBlocking` and `modeDelays` are re-declared WITHOUT their defaults:
21850
+ * `.partial()` does not remove an inner `.default()`, so a patch that never
21851
+ * named the field would parse to `[]` and wipe every mode's list on an
21852
+ * unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
21853
+ * `modeDelays` means EDITS, not the stored overrides.
21914
21854
  */
21915
- var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({ nonBlocking: NcAlarmNonBlockingListSchema }).partial();
21855
+ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
21856
+ nonBlocking: NcAlarmNonBlockingListSchema,
21857
+ /** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
21858
+ modeDelays: NcAlarmModeDelaysEditListSchema,
21859
+ /** ONE membership change; the panel applies it to the list it holds at its turn. */
21860
+ nonBlockingEdit: NcAlarmNonBlockingEditSchema
21861
+ }).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" });
21916
21862
  /**
21917
21863
  * What one arm mode actually arms, DERIVED from the enabled rules gated on it.
21918
21864
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
@@ -22012,6 +21958,28 @@ var NcAlarmConfigSchema = object({
22012
21958
  */
22013
21959
  live: NcAlarmLiveSchema.optional()
22014
21960
  });
21961
+ var NcAlarmSensorReadingSchema = _enum([
21962
+ "open",
21963
+ "closed",
21964
+ "unknown",
21965
+ "not-opening"
21966
+ ]);
21967
+ /** One device's state as the alarm reads it — the classifier the arm check uses. */
21968
+ var NcAlarmSensorStateSchema = object({
21969
+ deviceId: number().int().positive(),
21970
+ reading: NcAlarmSensorReadingSchema,
21971
+ /** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
21972
+ state: string().nullable(),
21973
+ /** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
21974
+ unknownWhy: _enum(["read-failed", "unknown-word"]).nullable(),
21975
+ /** The device manager's liveness as the centre mirrors it; null = not known. */
21976
+ online: boolean().nullable()
21977
+ });
21978
+ var NcAlarmSensorsInputSchema = object({ deviceIds: array(number().int().positive()).max(500) });
21979
+ var NcAlarmSensorsSchema = object({
21980
+ sensors: array(NcAlarmSensorStateSchema),
21981
+ readAt: number().int().nonnegative()
21982
+ });
22015
21983
  /**
22016
21984
  * The most seconds of footage any notification rule may ask a camera to retain.
22017
21985
  *
@@ -22271,8 +22239,9 @@ var notificationRulesCapability = {
22271
22239
  */
22272
22240
  getAlarmConfig: method(object({}), NcAlarmConfigSchema, { auth: "admin" }),
22273
22241
  /**
22274
- * Patch the settings (durations, recipients, per-mode non-blocking lists;
22275
- * `announceArm` is accepted and ignored — D630). Returns the WHOLE config,
22242
+ * Patch the settings (durations — global and per mode —, recipients,
22243
+ * per-mode non-blocking lists or one membership edit; `announceArm` is
22244
+ * accepted and ignored — D630). Returns the WHOLE config,
22276
22245
  * coverage and `live` included, so a
22277
22246
  * client never has to guess what the server settled on — the panel clamps
22278
22247
  * and normalises, and a form that re-rendered from its own input would
@@ -22281,7 +22250,15 @@ var notificationRulesCapability = {
22281
22250
  setAlarmConfig: method(object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
22282
22251
  kind: "mutation",
22283
22252
  auth: "admin"
22284
- })
22253
+ }),
22254
+ /**
22255
+ * The CURRENT state of each asked device as the alarm reads it (D697) — open, closed,
22256
+ * unknown (why) or not an opening, plus liveness. Classified by the same table the arm
22257
+ * check uses (`alarm-openings.ts`), so the editor and the arm can never disagree. The
22258
+ * caller names the ids (the household openings it already holds); at most
22259
+ * `NC_ALARM_SENSORS_MAX`.
22260
+ */
22261
+ getAlarmSensors: method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" })
22285
22262
  }
22286
22263
  };
22287
22264
  /**
@@ -22644,12 +22621,26 @@ var CameraSensorRefSchema = object({
22644
22621
  function cameraSensorRefKey(ref) {
22645
22622
  return `${ref.addonId}/${ref.stableId}`;
22646
22623
  }
22647
- /** CS-1 accepts exactly one mode; CS-2 (D673) widens it to confirm / replace. */
22648
- var CameraSensorsModeSchema = _enum(["in-addition"]);
22649
- var CameraSensorsConfigSchema = object({
22650
- mode: CameraSensorsModeSchema,
22651
- sensors: array(CameraSensorRefSchema).min(1).max(8)
22652
- }).superRefine((value, ctx) => {
22624
+ /**
22625
+ * A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
22626
+ * `replace`: its motion is the camera's, and while one is READY the camera's
22627
+ * own motion no longer counts on its own. `confirm`: while one is READY the
22628
+ * camera's own motion counts only while a confirm sensor is active — with or
22629
+ * without a replace sensor (spec C2, the controller's ruling on Q1).
22630
+ */
22631
+ var CameraSensorModeSchema = _enum([
22632
+ "in-addition",
22633
+ "confirm",
22634
+ "replace"
22635
+ ]);
22636
+ /** A stored sensor with no mode — every CS-1 row — is in addition. */
22637
+ var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
22638
+ /**
22639
+ * A camera's attached sensors. A CS-1 row carried an envelope
22640
+ * `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
22641
+ * what the write stores (D672 rule 3), so it is never written again.
22642
+ */
22643
+ var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
22653
22644
  const seen = /* @__PURE__ */ new Set();
22654
22645
  value.sensors.forEach((ref, index) => {
22655
22646
  const key = cameraSensorRefKey(ref);
@@ -22661,39 +22652,41 @@ var CameraSensorsConfigSchema = object({
22661
22652
  seen.add(key);
22662
22653
  });
22663
22654
  });
22664
- var RefFields = {
22655
+ /** Every attachment names its mode; an older orchestrator that does not is in addition. */
22656
+ var AttachmentFields = {
22665
22657
  addonId: string(),
22666
- stableId: string()
22658
+ stableId: string(),
22659
+ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
22667
22660
  };
22668
22661
  var CameraSensorAttachmentSchema = discriminatedUnion("state", [
22669
22662
  object({
22670
- ...RefFields,
22663
+ ...AttachmentFields,
22671
22664
  state: literal("ready"),
22672
22665
  deviceId: number(),
22673
22666
  name: string(),
22674
22667
  caps: array(string()).readonly()
22675
22668
  }),
22676
22669
  object({
22677
- ...RefFields,
22670
+ ...AttachmentFields,
22678
22671
  state: literal("offline"),
22679
22672
  deviceId: number(),
22680
22673
  name: string(),
22681
22674
  reason: _enum(["offline", "disabled"])
22682
22675
  }),
22683
22676
  object({
22684
- ...RefFields,
22677
+ ...AttachmentFields,
22685
22678
  state: literal("missing"),
22686
22679
  reason: string()
22687
22680
  }),
22688
22681
  object({
22689
- ...RefFields,
22682
+ ...AttachmentFields,
22690
22683
  state: literal("unsupported"),
22691
22684
  deviceId: number(),
22692
22685
  name: string(),
22693
22686
  reason: string()
22694
22687
  }),
22695
22688
  object({
22696
- ...RefFields,
22689
+ ...AttachmentFields,
22697
22690
  state: literal("unreadable"),
22698
22691
  reason: string()
22699
22692
  })
@@ -22706,17 +22699,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
22706
22699
  * say.
22707
22700
  */
22708
22701
  var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
22702
+ /** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
22703
+ var CameraOwnMotionSchema = _enum([
22704
+ "always",
22705
+ "when-confirmed",
22706
+ "never"
22707
+ ]);
22708
+ /** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
22709
+ var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
22710
+ /**
22711
+ * The camera's OWN onboard motion (D696): the raw input the bridge combines,
22712
+ * never the effective value. The camera's `motion` slice is the effective one,
22713
+ * so a view of the camera's own row reads this.
22714
+ * - `atMs`: when the bridge received the camera's last own edge.
22715
+ * - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
22716
+ * AND it is younger than the window the bridge counts the camera's own motion
22717
+ * for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
22718
+ * sends a clear (heartbeats only) therefore reads `false` once no push came
22719
+ * within the window; a status read is a snapshot, so a live view re-asks.
22720
+ * Absent = this orchestrator has not received the camera's own motion since it
22721
+ * started (unknown, never "quiet"), or an orchestrator older than D696.
22722
+ */
22723
+ var CameraRawLevelSchema = object({
22724
+ detected: boolean(),
22725
+ atMs: number()
22726
+ });
22709
22727
  var CameraSensorsStatusSchema = discriminatedUnion("state", [
22710
- object({ state: literal("not-configured") }),
22728
+ object({
22729
+ state: literal("not-configured"),
22730
+ cameraLevel: CameraRawLevelSchema.optional()
22731
+ }),
22711
22732
  object({
22712
22733
  state: literal("unreadable"),
22713
- reason: string()
22734
+ reason: string(),
22735
+ cameraLevel: CameraRawLevelSchema.optional()
22714
22736
  }),
22715
22737
  object({
22716
22738
  state: literal("configured"),
22717
- mode: CameraSensorsModeSchema,
22739
+ cameraLevel: CameraRawLevelSchema.optional(),
22718
22740
  sensors: array(CameraSensorAttachmentSchema).readonly(),
22719
- notForwarded: CameraSensorsNotForwardedSchema.optional()
22741
+ /** Absent = an orchestrator older than CS-2: it does not say (D315). */
22742
+ cameraMotion: CameraOwnMotionSchema.optional(),
22743
+ notForwarded: CameraSensorsNotForwardedSchema.optional(),
22744
+ notEnforced: CameraSensorsNotEnforcedSchema.optional()
22720
22745
  })
22721
22746
  ]);
22722
22747
  Object.freeze({
@@ -26709,8 +26734,10 @@ var RunnerCameraConfigSchema = object({
26709
26734
  * - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
26710
26735
  * analyzer providers) running on decoded frames in this runner.
26711
26736
  * - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
26712
- * analytics). The provider emits ProviderMotion
26713
- * events; the orchestrator forwards to `reportMotion`.
26737
+ * analytics). The provider emits its raw push as `ProviderMotion`
26738
+ * (D673); the orchestrator's camera-sensors bridge re-emits the camera's
26739
+ * effective motion as `MotionOnMotionChanged`, which is what reaches
26740
+ * `reportMotion`.
26714
26741
  */
26715
26742
  motionSources: MotionSourcesSchema.default(["analyzer"]),
26716
26743
  /**
@@ -26887,7 +26914,15 @@ var RunnerLocalLoadSchema = object({
26887
26914
  hasGpu: boolean(),
26888
26915
  inferenceBackend: string().optional(),
26889
26916
  cpuCores: number().optional()
26890
- })
26917
+ }),
26918
+ /**
26919
+ * Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
26920
+ * runner never writes it. ABSENT = a runner older than D696, which still
26921
+ * writes the slice from its phase machine; the orchestrator does not write
26922
+ * while any runner node is absent-or-unanswered, so one slice never has two
26923
+ * writers.
26924
+ */
26925
+ motionSliceWriter: literal("orchestrator").optional()
26891
26926
  });
26892
26927
  /**
26893
26928
  * Aggregate runtime metrics for the runner's whole local pool. Mirrors the
@@ -32492,6 +32527,70 @@ onStatusChanged: { data: object({
32492
32527
  * whether persisting is worth a SQLite commit. */
32493
32528
  volatileStateFields: ["lastChangedAt"]
32494
32529
  };
32530
+ var DoorbellStatusSchema = object({
32531
+ /** Ms epoch of the last press. null = never observed since this provider started. */
32532
+ lastPressedAt: number().nullable(),
32533
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
32534
+ pressCountSinceStart: number()
32535
+ });
32536
+ var DoorbellPressEventSchema = object({
32537
+ deviceId: number(),
32538
+ timestamp: number()
32539
+ });
32540
+ /**
32541
+ * Doorbell button cap. Two kinds of provider serve it, and to every consumer
32542
+ * they are the same cap:
32543
+ *
32544
+ * - **Native** providers, registered per device by a driver addon through
32545
+ * `ctx.registerNativeCap` — a `DeviceType.Button` accessory with
32546
+ * `role: DeviceRole.Doorbell`, or the camera itself (Reolink registers at
32547
+ * camera level). They emit `onPressed` on every firmware ring.
32548
+ * - **A composed doorbell** (D670, D671): a camera's customization gives it
32549
+ * the cap, its `lastPressedAt` rising from the sources the operator
32550
+ * assigned in Customize → Doorbell, and the composer emits `onPressed`
32551
+ * from that field's advance (`fromState`).
32552
+ *
32553
+ * The DeviceEventPropagator re-emits `onPressed` on the camera parent.
32554
+ */
32555
+ var doorbellCapability = {
32556
+ name: "doorbell",
32557
+ scope: "device",
32558
+ deviceNative: true,
32559
+ mode: "singleton",
32560
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
32561
+ methods: {},
32562
+ events: {
32563
+ /**
32564
+ * Fires once per physical press. Reolink delivers via Baichuan
32565
+ * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
32566
+ * release/duration — it's a pulse.
32567
+ */
32568
+ onPressed: {
32569
+ data: DoorbellPressEventSchema,
32570
+ fromState: {
32571
+ field: "lastPressedAt",
32572
+ on: "advance"
32573
+ }
32574
+ } },
32575
+ status: {
32576
+ schema: DoorbellStatusSchema,
32577
+ kind: "push"
32578
+ },
32579
+ /**
32580
+ * Runtime-state slice — last press timestamp + lifetime press count.
32581
+ * Mirrored by the kernel and readable via
32582
+ * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
32583
+ * without subscribing.
32584
+ */
32585
+ runtimeState: DoorbellStatusSchema,
32586
+ /**
32587
+ * 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.
32588
+ *
32589
+ * See `RuntimeStateDurability`. Enforced by
32590
+ * `scripts/check-runtime-state-durability.ts`.
32591
+ */
32592
+ durability: "restored"
32593
+ };
32495
32594
  /**
32496
32595
  * Enum-state sensor — a string value picked from a finite option set.
32497
32596
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -34706,11 +34805,11 @@ authKey: string().optional() }), object({
34706
34805
  /**
34707
34806
  * How long after a camera's last rising edge `pipeline-analytics` closes the
34708
34807
  * motion EPISODE row it kept open for it (D475) — "il delay della cap", in
34709
- * the operator's words. One authority for the whole system: every provider
34710
- * that seeds `autoClearAfterMs` on a `Camera` device writes this SAME
34711
- * constant while `detected: true` (never its own number — Hikvision used to
34712
- * seed its internal 3 s inactivity timer here, which is a different clock for
34713
- * a different purpose), and `MotionEpisodeTracker` imports it directly rather
34808
+ * the operator's words. One authority for the whole system: the writer of a
34809
+ * `Camera` device's slice (the orchestrator, D696) writes this SAME constant
34810
+ * in `autoClearAfterMs` while `detected: true` (never a camera's own clock —
34811
+ * Hikvision used to seed its internal 3 s inactivity timer here, a different
34812
+ * clock for a different purpose), and `MotionEpisodeTracker` imports it directly rather
34714
34813
  * than reading the live cap value on the hot path. A `Sensor` device (HA
34715
34814
  * binary sensor, Homematic) gets a genuine push both ways and has no episode
34716
34815
  * to close on a timer, so it writes `null`, never this constant.
@@ -34721,9 +34820,9 @@ var MotionStatusSchema = object({
34721
34820
  /** Ms epoch of the last detected-true observation. Null if never detected. */
34722
34821
  lastDetectedAt: number().nullable(),
34723
34822
  /**
34724
- * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
34725
- * `null` while false and on every `Sensor` device (D475) — see that
34726
- * constant's doc for the one-authority rule.
34823
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
34824
+ * orchestrator writes it, D696), `null` while false and on every `Sensor`
34825
+ * device (D475) — see that constant's doc for the one-authority rule.
34727
34826
  *
34728
34827
  * ## Reading this field still arms nothing
34729
34828
  *
@@ -34741,34 +34840,31 @@ var MotionStatusSchema = object({
34741
34840
  * `addon-export-alexa/src/motion-clear-hold.ts` and
34742
34841
  * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
34743
34842
  *
34744
- * ## Who writes it
34745
- *
34746
- * - **Cameras** — the runner's phase machine, `active → watching` on
34747
- * `cooldown_expired`, which then writes this slice with
34748
- * `detected: false` (`handlePhaseChanged` in
34749
- * `pipeline-runner/index.ts`). It produces the FALLING edge, which
34750
- * matters most for the sources that only ever push a rising one:
34751
- * Reolink emits `MotionOnMotionChanged { detected: true }` and never
34752
- * a false.
34753
- * - **Sensors** (Home Assistant binary sensors, Homematic) — the
34754
- * provider pushes the false itself, from the upstream system's own
34755
- * state change. No phase machine is involved.
34756
- *
34757
- * ### The phase machine is CANONICAL, not sole — and that is a defect
34758
- *
34759
- * An earlier revision of this docblock (mine, 2026-09-12) claimed the
34760
- * phase machine is the sole writer for a camera. It is not.
34761
- * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
34762
- * `setCapSlice(motionCapability, …)` on their own rising edge, and
34763
- * Hikvision's comment says why: it read THIS docblock, agreed the
34764
- * runner is canonical, and wrote anyway to avoid per-tick churn. So
34765
- * two authorities can disagree about one slice, which this repo
34766
- * forbids, and the doc said otherwise — which is worse than saying
34767
- * nothing, because it reads as verification.
34768
- *
34769
- * This predates D475 and is not fixed there: the fix touches every
34770
- * camera provider. Recorded in D475's Consequences. Do not restore the
34771
- * "sole writer" wording without also removing the other writers.
34843
+ * ## Who writes it (D696)
34844
+ *
34845
+ * - **Cameras** — the orchestrator, and nothing else. It writes the camera's
34846
+ * EFFECTIVE motion (`addon-pipeline-orchestrator`
34847
+ * `camera-sensors/motion-slice.ts`), alongside the effective
34848
+ * `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
34849
+ * for a split camera, an unsplit emitter's direct event, the analyzer and
34850
+ * device activity, as the camera's `motionSources` counts them. A source
34851
+ * that never sends a clear falls one window after its last `true`.
34852
+ * `lastDetectedAt` moves only on an effective rise. No camera provider
34853
+ * writes this slice (not even a boot seed), and neither does the runner's
34854
+ * phase machine: its phase is "a session is attached" for every on-motion
34855
+ * session, not motion, and it now has its own `DetectionPhaseTransition`.
34856
+ * A provider's `isDetected` answers from the hub's slice.
34857
+ * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
34858
+ * imports) — the provider pushes both edges itself, from the upstream
34859
+ * system's own state change. That is the sensor's own fact.
34860
+ *
34861
+ * `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
34862
+ * `motion` slice; each sensor writer is a named exemption.
34863
+ *
34864
+ * This replaces the D475 §4 rule ("the phase machine is the sole writer").
34865
+ * That rule was never true: Hikvision and Amcrest wrote the slice raw beside
34866
+ * it, every provider seeded it at boot, and every session left it
34867
+ * `detected: true` after its detach.
34772
34868
  */
34773
34869
  autoClearAfterMs: number().nullable()
34774
34870
  });
@@ -34840,11 +34936,12 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
34840
34936
  */
34841
34937
  runtimeState: MotionStatusSchema,
34842
34938
  /**
34843
- * Runtime-state durability: **session** — every writer of this slice
34939
+ * Runtime-state durability: **session** — the writer of this slice
34844
34940
  * writes only on an EDGE, so a restored `detected: true` would stay
34845
34941
  * frozen until the next one instead of being corrected. The next edge
34846
- * re-publishes the real state. (On who the writers are, and why there
34847
- * is more than one, see `autoClearAfterMs` above.)
34942
+ * re-publishes the real state, and the orchestrator re-publishes every
34943
+ * camera when it starts writing (D696; on who writes it, see
34944
+ * `autoClearAfterMs` above).
34848
34945
  *
34849
34946
  * See `RuntimeStateDurability`. Enforced by
34850
34947
  * `scripts/check-runtime-state-durability.ts`.
@@ -37261,8 +37358,7 @@ var ptzAutotrackCapability = {
37261
37358
  deviceNative: true,
37262
37359
  mode: "singleton",
37263
37360
  /**
37264
- * Two kinds of provider behind one name, the same shape `snapshot` and
37265
- * `doorbell` use:
37361
+ * Two kinds of provider behind one name, the same shape `snapshot` uses:
37266
37362
  *
37267
37363
  * - **Native**: the camera's own firmware autotrack, registered per device by
37268
37364
  * the driver when the probe says it exists (Reolink: yes; Hikvision:
@@ -37270,7 +37366,7 @@ var ptzAutotrackCapability = {
37270
37366
  * - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
37271
37367
  * which follows a subject with `ptz.move` pulses driven by the detection
37272
37368
  * pipeline. `defaultActive: false` — the operator binds it per camera in
37273
- * the bindings UI, exactly as `virtual-doorbell` is bound.
37369
+ * the bindings UI.
37274
37370
  *
37275
37371
  * The binding chooses WHICH implementation answers; `setEnabled` stays the
37276
37372
  * one switch for the function either way. A camera never has both driving its
@@ -47437,6 +47533,12 @@ Object.freeze({
47437
47533
  addonId: null,
47438
47534
  access: "view"
47439
47535
  },
47536
+ "notificationRules.getAlarmSensors": {
47537
+ capName: "notification-rules",
47538
+ capScope: "system",
47539
+ addonId: null,
47540
+ access: "view"
47541
+ },
47440
47542
  "notificationRules.getClipRetentionAsks": {
47441
47543
  capName: "notification-rules",
47442
47544
  capScope: "system",
@@ -51920,6 +52022,11 @@ Object.freeze({
51920
52022
  form: "single",
51921
52023
  optional: false
51922
52024
  }],
52025
+ "notificationRules.getAlarmSensors": [{
52026
+ name: "deviceIds",
52027
+ form: "array",
52028
+ optional: false
52029
+ }],
51923
52030
  "notificationRules.setDeviceMuted": [{
51924
52031
  name: "deviceId",
51925
52032
  form: "single",
@@ -53702,6 +53809,107 @@ function ruleBelongsToAlarm(rule) {
53702
53809
  if ((rule.conditions.deviceState?.states ?? []).some((s) => s.trim().toLowerCase().startsWith(ARMED_WORD_PREFIX))) return true;
53703
53810
  return (rule.onTrigger ?? []).some((sequence) => sequence.enabled && sequence.actions.some((step) => step.kind === "cap" && step.cap === ALARM_PANEL_CAP && step.method === ALARM_PANEL_TRIGGER_METHOD));
53704
53811
  }
53812
+ var NC_ALARM_DELAY_FIELDS = [
53813
+ "exitDelaySec",
53814
+ "entryDelaySec",
53815
+ "triggeredDurationSec"
53816
+ ];
53817
+ /** The mode's value when it overrides the field, else the global one. */
53818
+ function pick(override, global) {
53819
+ return override === void 0 ? {
53820
+ value: global,
53821
+ source: "default"
53822
+ } : {
53823
+ value: override,
53824
+ source: "mode"
53825
+ };
53826
+ }
53827
+ /** What `mode` actually runs on: its own overrides, the global value for every other field. */
53828
+ function resolveModeDelays(settings, mode) {
53829
+ const entry = (settings.modeDelays ?? []).find((e) => e.mode === mode);
53830
+ const exit = pick(entry?.exitDelaySec, settings.exitDelaySec);
53831
+ const entryDelay = pick(entry?.entryDelaySec, settings.entryDelaySec);
53832
+ const triggered = pick(entry?.triggeredDurationSec, settings.triggeredDurationSec);
53833
+ return {
53834
+ exitDelaySec: exit.value,
53835
+ entryDelaySec: entryDelay.value,
53836
+ triggeredDurationSec: triggered.value,
53837
+ source: {
53838
+ exitDelaySec: exit.source,
53839
+ entryDelaySec: entryDelay.source,
53840
+ triggeredDurationSec: triggered.source
53841
+ }
53842
+ };
53843
+ }
53844
+ /** One field of an entry after an edit: number sets, null clears, undefined keeps. */
53845
+ function edited(current, edit) {
53846
+ if (edit === void 0) return current;
53847
+ return edit === null ? void 0 : edit;
53848
+ }
53849
+ /**
53850
+ * Apply per-field edits to the stored overrides. Returns new arrays, never mutates the input;
53851
+ * an entry with no field left is dropped (the mode inherits everything again).
53852
+ */
53853
+ function applyModeDelaysEdits(current, edits) {
53854
+ const out = current.map((e) => ({ ...e }));
53855
+ for (const edit of edits) {
53856
+ const at = out.findIndex((e) => e.mode === edit.mode);
53857
+ const base = at >= 0 ? out[at] ?? { mode: edit.mode } : { mode: edit.mode };
53858
+ const next = { mode: edit.mode };
53859
+ const exit = edited(base.exitDelaySec, edit.exitDelaySec);
53860
+ const entry = edited(base.entryDelaySec, edit.entryDelaySec);
53861
+ const triggered = edited(base.triggeredDurationSec, edit.triggeredDurationSec);
53862
+ if (exit !== void 0) next.exitDelaySec = exit;
53863
+ if (entry !== void 0) next.entryDelaySec = entry;
53864
+ if (triggered !== void 0) next.triggeredDurationSec = triggered;
53865
+ if (at >= 0) out[at] = next;
53866
+ else out.push(next);
53867
+ }
53868
+ return out.filter((e) => e.exitDelaySec !== void 0 || e.entryDelaySec !== void 0 || e.triggeredDurationSec !== void 0);
53869
+ }
53870
+ /**
53871
+ * Put ONE device on, or take it off, ONE mode's list. A no-op answers `changed: false`; an add
53872
+ * to a full list is REFUSED by reason (never silently dropped); an emptied list drops its entry.
53873
+ */
53874
+ function applyNonBlockingEdit(lists, edit) {
53875
+ const copy = lists.map((l) => ({
53876
+ mode: l.mode,
53877
+ deviceIds: [...l.deviceIds]
53878
+ }));
53879
+ const at = copy.findIndex((l) => l.mode === edit.mode);
53880
+ const held = at >= 0 ? copy[at]?.deviceIds ?? [] : [];
53881
+ const present = held.includes(edit.deviceId);
53882
+ if (edit.nonBlocking === present) return {
53883
+ kind: "applied",
53884
+ lists: copy,
53885
+ changed: false
53886
+ };
53887
+ if (edit.nonBlocking) {
53888
+ if (held.length >= 200) return {
53889
+ kind: "refused",
53890
+ reason: "list-full",
53891
+ mode: edit.mode,
53892
+ max: 200
53893
+ };
53894
+ const next = {
53895
+ mode: edit.mode,
53896
+ deviceIds: [...held, edit.deviceId]
53897
+ };
53898
+ if (at >= 0) copy[at] = next;
53899
+ else copy.push(next);
53900
+ } else {
53901
+ const next = {
53902
+ mode: edit.mode,
53903
+ deviceIds: held.filter((id) => id !== edit.deviceId)
53904
+ };
53905
+ if (at >= 0) copy[at] = next;
53906
+ }
53907
+ return {
53908
+ kind: "applied",
53909
+ lists: copy.filter((l) => l.deviceIds.length > 0),
53910
+ changed: true
53911
+ };
53912
+ }
53705
53913
  /**
53706
53914
  * WHICH WAY A BOOLEAN SENSOR MOVED — read off the one slice a sensor event
53707
53915
  * persists (D640 "a sensor rule fires on the raise, the clear, or both").
@@ -55145,6 +55353,7 @@ function readTimelapseGeneratedAt(rule, deviceId) {
55145
55353
  if (map !== void 0) return map[String(deviceId)] ?? 0;
55146
55354
  return rule.lastGeneratedAt ?? 0;
55147
55355
  }
55356
+ MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
55148
55357
  object({
55149
55358
  /**
55150
55359
  * Fraction of the box's own size added on EACH side before cutting.
@@ -56436,12 +56645,30 @@ Object.defineProperty(exports, "MotionTriggeredBySchema", {
56436
56645
  return MotionTriggeredBySchema;
56437
56646
  }
56438
56647
  });
56648
+ Object.defineProperty(exports, "NC_ALARM_DELAY_FIELDS", {
56649
+ enumerable: true,
56650
+ get: function() {
56651
+ return NC_ALARM_DELAY_FIELDS;
56652
+ }
56653
+ });
56654
+ Object.defineProperty(exports, "NC_ALARM_DELAY_MAX_SEC", {
56655
+ enumerable: true,
56656
+ get: function() {
56657
+ return NC_ALARM_DELAY_MAX_SEC;
56658
+ }
56659
+ });
56439
56660
  Object.defineProperty(exports, "NC_ALARM_SYSTEM_EVENT_KINDS", {
56440
56661
  enumerable: true,
56441
56662
  get: function() {
56442
56663
  return NC_ALARM_SYSTEM_EVENT_KINDS;
56443
56664
  }
56444
56665
  });
56666
+ Object.defineProperty(exports, "NC_ALARM_TRIGGERED_MAX_SEC", {
56667
+ enumerable: true,
56668
+ get: function() {
56669
+ return NC_ALARM_TRIGGERED_MAX_SEC;
56670
+ }
56671
+ });
56445
56672
  Object.defineProperty(exports, "NC_AUDIO_CONFIRM_HITS_DEFAULT", {
56446
56673
  enumerable: true,
56447
56674
  get: function() {
@@ -56538,6 +56765,18 @@ Object.defineProperty(exports, "NcAlarmConfigSchema", {
56538
56765
  return NcAlarmConfigSchema;
56539
56766
  }
56540
56767
  });
56768
+ Object.defineProperty(exports, "NcAlarmSensorsInputSchema", {
56769
+ enumerable: true,
56770
+ get: function() {
56771
+ return NcAlarmSensorsInputSchema;
56772
+ }
56773
+ });
56774
+ Object.defineProperty(exports, "NcAlarmSensorsSchema", {
56775
+ enumerable: true,
56776
+ get: function() {
56777
+ return NcAlarmSensorsSchema;
56778
+ }
56779
+ });
56541
56780
  Object.defineProperty(exports, "NcAlarmSettingsPatchSchema", {
56542
56781
  enumerable: true,
56543
56782
  get: function() {
@@ -56856,6 +57095,18 @@ Object.defineProperty(exports, "alarmPanelCapability", {
56856
57095
  return alarmPanelCapability;
56857
57096
  }
56858
57097
  });
57098
+ Object.defineProperty(exports, "applyModeDelaysEdits", {
57099
+ enumerable: true,
57100
+ get: function() {
57101
+ return applyModeDelaysEdits;
57102
+ }
57103
+ });
57104
+ Object.defineProperty(exports, "applyNonBlockingEdit", {
57105
+ enumerable: true,
57106
+ get: function() {
57107
+ return applyNonBlockingEdit;
57108
+ }
57109
+ });
56859
57110
  Object.defineProperty(exports, "array", {
56860
57111
  enumerable: true,
56861
57112
  get: function() {
@@ -57240,6 +57491,12 @@ Object.defineProperty(exports, "resolveLocationMode", {
57240
57491
  return resolveLocationMode;
57241
57492
  }
57242
57493
  });
57494
+ Object.defineProperty(exports, "resolveModeDelays", {
57495
+ enumerable: true,
57496
+ get: function() {
57497
+ return resolveModeDelays;
57498
+ }
57499
+ });
57243
57500
  Object.defineProperty(exports, "resolvePoolMemoryPolicy", {
57244
57501
  enumerable: true,
57245
57502
  get: function() {