@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
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "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";
@@ -901,7 +910,7 @@ var NUMBER_FORMAT_RANGES = {
901
910
  float32: [-34028234663852886e22, 34028234663852886e22],
902
911
  float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
903
912
  };
904
- function pick(schema, mask) {
913
+ function pick$1(schema, mask) {
905
914
  const currDef = schema._zod.def;
906
915
  const checks = currDef.checks;
907
916
  if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
@@ -4971,7 +4980,7 @@ var ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
4971
4980
  return merge(this, other);
4972
4981
  },
4973
4982
  pick(mask) {
4974
- return pick(this, mask);
4983
+ return pick$1(this, mask);
4975
4984
  },
4976
4985
  omit(mask) {
4977
4986
  return omit(this, mask);
@@ -5378,7 +5387,7 @@ var ZodIssueCode = {
5378
5387
  var ZodFirstPartyTypeKind;
5379
5388
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5380
5389
  //#endregion
5381
- //#region ../types/dist/sleep-gU6hqv4_.mjs
5390
+ //#region ../types/dist/sleep-CDCONfkt.mjs
5382
5391
  /**
5383
5392
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5384
5393
  * window to float samples (D455).
@@ -7637,7 +7646,7 @@ function errMsg(err) {
7637
7646
  return String(err);
7638
7647
  }
7639
7648
  //#endregion
7640
- //#region ../types/dist/composition-Dq42XWp0.mjs
7649
+ //#region ../types/dist/composition-43aqsZQj.mjs
7641
7650
  /**
7642
7651
  * Deterministic SHA-256 hash of an arbitrary serialisable value. The
7643
7652
  * canonical form sorts object keys alphabetically at every depth so two
@@ -7725,13 +7734,12 @@ portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac
7725
7734
  * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
7726
7735
  * valutatore puro del suo FRONTE.
7727
7736
  *
7728
- * Viveva dentro il builtin virtual-doorbell
7729
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
7730
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
7731
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
7732
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
7733
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
7734
- * SPOSTA qui e il doorbell la ri-esporta.
7737
+ * UNA tabella per tutti quelli che chiedono "questo device è ALTO?": il
7738
+ * trigger `RecordingTriggers.sensorDeviceIds` del recorder, i marker dei
7739
+ * sensori della post-analysis, il bridge camera-sensors dell'orchestratore e
7740
+ * le sorgenti di un campanello composto (`doorbellFeatureSources`, D671).
7741
+ * Una seconda copia divergerebbe alla prima cap aggiunta, e il sintomo — "il
7742
+ * sensore fa suonare il campanello ma non registra" — è esattamente D62.
7735
7743
  *
7736
7744
  * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
7737
7745
  * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
@@ -7781,8 +7789,6 @@ var SOURCE_CAP_CHANGED_AT_FIELD = {
7781
7789
  vibration: "lastChangedAt",
7782
7790
  tamper: "lastChangedAt"
7783
7791
  };
7784
- /** Cap names whose presence in a device's bindings qualify it as a source. */
7785
- var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
7786
7792
  /** True when a cap is a recognised binary/switch source. */
7787
7793
  function isSourceCap(capName) {
7788
7794
  return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
@@ -9863,7 +9869,7 @@ var RecordingTriggersSchema = object({
9863
9869
  *
9864
9870
  * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
9865
9871
  * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
9866
- * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
9872
+ * la stessa del campanello composto (D671). Ed è il FRONTE, non
9867
9873
  * il livello: un contatto trovato già aperto al riavvio del runner non fa
9868
9874
  * registrare.
9869
9875
  */
@@ -16423,109 +16429,10 @@ method(object({
16423
16429
  deviceIds: array(number()).readonly(),
16424
16430
  caps: array(string()).readonly().optional()
16425
16431
  }), record(string(), record(string(), unknown().nullable())));
16426
- /**
16427
- * Doorbell button cap. Two kinds of providers coexist behind this cap
16428
- * name (same pattern as `snapshot`):
16429
- *
16430
- * - **Native** providers: registered per-device by device-driver
16431
- * addons via `ctx.registerNativeCap` — either on a
16432
- * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
16433
- * or directly on the camera (Reolink registers at camera level).
16434
- * Emits an `onPressed` event every time the firmware pushes a
16435
- * ring; status tracks the last press and a pressCount since start
16436
- * (diagnostic).
16437
- *
16438
- * - **Wrapper** provider: the `virtual-doorbell` system builtin
16439
- * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
16440
- * device (contact / switch / event-emitter …) into a doorbell for
16441
- * a camera. `defaultActive: false` — the operator explicitly binds
16442
- * it per camera in the device-bindings UI, then picks the source
16443
- * device + trigger in the per-device settings.
16444
- *
16445
- * The DeviceEventPropagator re-emits `onPressed` on the camera parent
16446
- * — subscribers listening at the camera level receive ring events
16447
- * with `via[]` populated. No code on the parent needed.
16448
- */
16449
- var DoorbellStatusSchema = object({
16450
- /** Ms epoch of the last press. null = never observed since this provider started. */
16451
- lastPressedAt: number().nullable(),
16452
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
16453
- pressCountSinceStart: number()
16454
- });
16455
- var DoorbellPressEventSchema = object({
16456
- deviceId: number(),
16457
- timestamp: number()
16458
- });
16459
- /**
16460
- * The `doorbell-source` extension slot's editable value (D648): the camera's
16461
- * virtual-doorbell trigger devices, exactly what the wrapper's
16462
- * `doorbellSources` persists (as `{ deviceId }` records).
16463
- */
16464
- var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
16465
- /**
16466
- * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
16467
- * doorbell, owned by the `virtual-doorbell` wrapper over its
16468
- * `doorbellSources` store (D648). A source rings when one of its
16469
- * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
16470
- * different authority (`deviceManager.setWrapperActive`, D62) — the slot
16471
- * reports it, it never writes it.
16472
- */
16473
- var DOORBELL_SOURCE_SLOT = {
16474
- id: "doorbell-source",
16475
- label: "Doorbell trigger devices",
16476
- 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.",
16477
- shape: "association",
16478
- hostDeviceTypes: [DeviceType.Camera],
16479
- sourceCaps: SOURCE_CAPS,
16480
- cardinality: "many",
16481
- value: DoorbellSourceSlotValueSchema
16482
- };
16483
- var doorbellCapability = {
16484
- name: "doorbell",
16485
- scope: "device",
16486
- deviceNative: true,
16487
- mode: "singleton",
16488
- kind: "wrapper",
16489
- defaultActive: false,
16490
- deviceTypes: [DeviceType.Button, DeviceType.Camera],
16491
- extensionSlots: [DOORBELL_SOURCE_SLOT],
16492
- methods: {},
16493
- events: {
16494
- /**
16495
- * Fires once per physical press. Reolink delivers via Baichuan
16496
- * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
16497
- * release/duration — it's a pulse.
16498
- */
16499
- onPressed: {
16500
- data: DoorbellPressEventSchema,
16501
- fromState: {
16502
- field: "lastPressedAt",
16503
- on: "advance"
16504
- }
16505
- } },
16506
- status: {
16507
- schema: DoorbellStatusSchema,
16508
- kind: "push"
16509
- },
16510
- /**
16511
- * Runtime-state slice — last press timestamp + lifetime press count.
16512
- * Mirrored by the kernel and readable via
16513
- * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
16514
- * without subscribing.
16515
- */
16516
- runtimeState: DoorbellStatusSchema,
16517
- /**
16518
- * 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.
16519
- *
16520
- * See `RuntimeStateDurability`. Enforced by
16521
- * `scripts/check-runtime-state-durability.ts`.
16522
- */
16523
- durability: "restored"
16524
- };
16525
- var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
16526
- DeviceType.Camera, DeviceType.Camera;
16432
+ var ExtensionSlotIdSchema = _enum(["linked-devices"]);
16433
+ DeviceType.Camera;
16527
16434
  /** A slot's editable value, discriminated on `slot`. */
16528
- var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
16435
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
16529
16436
  DeviceType.Camera;
16530
16437
  var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
16531
16438
  state: literal("unreachable"),
@@ -16562,10 +16469,11 @@ var ExtensionSlotSourceSchema = object({
16562
16469
  });
16563
16470
  /**
16564
16471
  * A DIFFERENT authority that gates whether the slot's sources do anything —
16565
- * reported read-only, named, never written through this contract (D62). The
16566
- * virtual doorbell's sources ring only while the wrapper is bound to the
16567
- * camera, and that binding belongs to `deviceManager.setWrapperActive`.
16568
- * `unknown` means the gate could not be read; it is not "inactive" (D315).
16472
+ * reported read-only, named, never written through this contract (D62) — e.g.
16473
+ * a slot whose sources act only while a wrapper is bound to the host, a
16474
+ * binding that belongs to `deviceManager.setWrapperActive`. No slot reports
16475
+ * one today (`linked-devices` answers `null`). `unknown` means the gate could
16476
+ * not be read; it is not "inactive" (D315).
16569
16477
  */
16570
16478
  var ExtensionSlotActivationSchema = object({
16571
16479
  state: _enum([
@@ -16581,7 +16489,7 @@ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
16581
16489
  /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
16582
16490
  slotRef: string(),
16583
16491
  slot: ExtensionSlotIdSchema,
16584
- /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
16492
+ /** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
16585
16493
  authority: string(),
16586
16494
  activation: ExtensionSlotActivationSchema.nullable(),
16587
16495
  value: ExtensionSlotValueSchema,
@@ -21819,6 +21727,31 @@ var NcSnoozeSuppressedSchema = object({
21819
21727
  firstAt: number(),
21820
21728
  lastAt: number()
21821
21729
  });
21730
+ /** The bounds every alarm delay field carries — settings, per-mode overrides, both editors. */
21731
+ var NC_ALARM_DELAY_MAX_SEC = 600;
21732
+ var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
21733
+ var NcAlarmDelaySecSchema = number().int().min(0).max(600);
21734
+ var NcAlarmTriggeredSecSchema = number().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
21735
+ var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
21736
+ var NcAlarmModeDelaysListSchema = array(object({
21737
+ mode: AlarmArmModeSchema,
21738
+ exitDelaySec: NcAlarmDelaySecSchema.optional(),
21739
+ entryDelaySec: NcAlarmDelaySecSchema.optional(),
21740
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.optional()
21741
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
21742
+ var NcAlarmModeDelaysEditListSchema = array(object({
21743
+ mode: AlarmArmModeSchema,
21744
+ exitDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
21745
+ entryDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
21746
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.nullable().optional()
21747
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
21748
+ /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
21749
+ var NcAlarmNonBlockingEditSchema = object({
21750
+ mode: AlarmArmModeSchema,
21751
+ deviceId: number().int().positive(),
21752
+ /** true = on the list (may be open, does not block); false = off the list (blocks). */
21753
+ nonBlocking: boolean()
21754
+ });
21822
21755
  /**
21823
21756
  * The per-mode lists, at most one per mode. Two lists for one mode have no
21824
21757
  * meaning a reader could agree on (union? the last one?), so they are refused
@@ -21827,10 +21760,10 @@ var NcSnoozeSuppressedSchema = object({
21827
21760
  var NcAlarmNonBlockingListSchema = array(object({
21828
21761
  mode: AlarmArmModeSchema,
21829
21762
  deviceIds: array(number().int()).max(200)
21830
- })).max(8).refine((lists) => new Set(lists.map((l) => l.mode)).size === lists.length, { message: "nonBlocking: at most one list per arm mode" });
21763
+ })).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
21831
21764
  /**
21832
- * The three durations the panel's state machine runs on, who hears about its
21833
- * transitions, and which openings each mode tolerates.
21765
+ * The three durations — global, and per mode since D697 — the panel's state
21766
+ * machine runs on, who hears about its transitions, and which openings each mode tolerates.
21834
21767
  *
21835
21768
  * They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
21836
21769
  * `alarm-panel` is `deviceNative` and its other provider mirrors somebody
@@ -21840,15 +21773,15 @@ var NcAlarmNonBlockingListSchema = array(object({
21840
21773
  */
21841
21774
  var NcAlarmSettingsSchema = object({
21842
21775
  /** Grace period between arming and the mode taking effect. 0 = immediate. */
21843
- exitDelaySec: number().int().min(0).max(600),
21776
+ exitDelaySec: NcAlarmDelaySecSchema,
21844
21777
  /** Grace period between a trigger and the alarm firing. 0 = immediate. */
21845
- entryDelaySec: number().int().min(0).max(600),
21778
+ entryDelaySec: NcAlarmDelaySecSchema,
21846
21779
  /**
21847
21780
  * How long `triggered` lasts before the panel re-arms itself.
21848
21781
  * **0 = until an operator disarms it** — the behaviour before this field
21849
21782
  * existed, and therefore what an untouched install keeps doing.
21850
21783
  */
21851
- triggeredDurationSec: number().int().min(0).max(3600),
21784
+ triggeredDurationSec: NcAlarmTriggeredSecSchema,
21852
21785
  /**
21853
21786
  * Deprecated by D630 — every transition is announced. Parsed, never read;
21854
21787
  * remove after one release. Optional so an older admin's patch (which still
@@ -21871,17 +21804,30 @@ var NcAlarmSettingsSchema = object({
21871
21804
  * per mode is meaningful. Defaulted to `[]` so a blob stored before D630
21872
21805
  * parses as "every opening blocks" — the behaviour it was written under.
21873
21806
  */
21874
- nonBlocking: NcAlarmNonBlockingListSchema.default([])
21807
+ nonBlocking: NcAlarmNonBlockingListSchema.default([]),
21808
+ /**
21809
+ * Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
21810
+ * without a field, uses the global value above — so `[]`, the default, is exactly the
21811
+ * behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
21812
+ */
21813
+ modeDelays: NcAlarmModeDelaysListSchema.default([])
21875
21814
  });
21876
21815
  /**
21877
21816
  * Every field optional — a tab edits one control at a time.
21878
21817
  *
21879
- * `nonBlocking` is re-declared WITHOUT its default: `.partial()` does not
21880
- * remove an inner `.default()`, so a patch that never named the field would
21881
- * parse to `nonBlocking: []` and wipe every mode's list on an unrelated edit
21882
- * (the same trap {@link NcRulePatchSchema} documents).
21818
+ * `nonBlocking` and `modeDelays` are re-declared WITHOUT their defaults:
21819
+ * `.partial()` does not remove an inner `.default()`, so a patch that never
21820
+ * named the field would parse to `[]` and wipe every mode's list on an
21821
+ * unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
21822
+ * `modeDelays` means EDITS, not the stored overrides.
21883
21823
  */
21884
- var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({ nonBlocking: NcAlarmNonBlockingListSchema }).partial();
21824
+ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
21825
+ nonBlocking: NcAlarmNonBlockingListSchema,
21826
+ /** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
21827
+ modeDelays: NcAlarmModeDelaysEditListSchema,
21828
+ /** ONE membership change; the panel applies it to the list it holds at its turn. */
21829
+ nonBlockingEdit: NcAlarmNonBlockingEditSchema
21830
+ }).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" });
21885
21831
  /**
21886
21832
  * What one arm mode actually arms, DERIVED from the enabled rules gated on it.
21887
21833
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
@@ -21981,6 +21927,28 @@ var NcAlarmConfigSchema = object({
21981
21927
  */
21982
21928
  live: NcAlarmLiveSchema.optional()
21983
21929
  });
21930
+ var NcAlarmSensorReadingSchema = _enum([
21931
+ "open",
21932
+ "closed",
21933
+ "unknown",
21934
+ "not-opening"
21935
+ ]);
21936
+ /** One device's state as the alarm reads it — the classifier the arm check uses. */
21937
+ var NcAlarmSensorStateSchema = object({
21938
+ deviceId: number().int().positive(),
21939
+ reading: NcAlarmSensorReadingSchema,
21940
+ /** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
21941
+ state: string().nullable(),
21942
+ /** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
21943
+ unknownWhy: _enum(["read-failed", "unknown-word"]).nullable(),
21944
+ /** The device manager's liveness as the centre mirrors it; null = not known. */
21945
+ online: boolean().nullable()
21946
+ });
21947
+ var NcAlarmSensorsInputSchema = object({ deviceIds: array(number().int().positive()).max(500) });
21948
+ var NcAlarmSensorsSchema = object({
21949
+ sensors: array(NcAlarmSensorStateSchema),
21950
+ readAt: number().int().nonnegative()
21951
+ });
21984
21952
  /**
21985
21953
  * The most seconds of footage any notification rule may ask a camera to retain.
21986
21954
  *
@@ -22240,8 +22208,9 @@ var notificationRulesCapability = {
22240
22208
  */
22241
22209
  getAlarmConfig: method(object({}), NcAlarmConfigSchema, { auth: "admin" }),
22242
22210
  /**
22243
- * Patch the settings (durations, recipients, per-mode non-blocking lists;
22244
- * `announceArm` is accepted and ignored — D630). Returns the WHOLE config,
22211
+ * Patch the settings (durations — global and per mode —, recipients,
22212
+ * per-mode non-blocking lists or one membership edit; `announceArm` is
22213
+ * accepted and ignored — D630). Returns the WHOLE config,
22245
22214
  * coverage and `live` included, so a
22246
22215
  * client never has to guess what the server settled on — the panel clamps
22247
22216
  * and normalises, and a form that re-rendered from its own input would
@@ -22250,7 +22219,15 @@ var notificationRulesCapability = {
22250
22219
  setAlarmConfig: method(object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
22251
22220
  kind: "mutation",
22252
22221
  auth: "admin"
22253
- })
22222
+ }),
22223
+ /**
22224
+ * The CURRENT state of each asked device as the alarm reads it (D697) — open, closed,
22225
+ * unknown (why) or not an opening, plus liveness. Classified by the same table the arm
22226
+ * check uses (`alarm-openings.ts`), so the editor and the arm can never disagree. The
22227
+ * caller names the ids (the household openings it already holds); at most
22228
+ * `NC_ALARM_SENSORS_MAX`.
22229
+ */
22230
+ getAlarmSensors: method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" })
22254
22231
  }
22255
22232
  };
22256
22233
  /**
@@ -22613,12 +22590,26 @@ var CameraSensorRefSchema = object({
22613
22590
  function cameraSensorRefKey(ref) {
22614
22591
  return `${ref.addonId}/${ref.stableId}`;
22615
22592
  }
22616
- /** CS-1 accepts exactly one mode; CS-2 (D673) widens it to confirm / replace. */
22617
- var CameraSensorsModeSchema = _enum(["in-addition"]);
22618
- var CameraSensorsConfigSchema = object({
22619
- mode: CameraSensorsModeSchema,
22620
- sensors: array(CameraSensorRefSchema).min(1).max(8)
22621
- }).superRefine((value, ctx) => {
22593
+ /**
22594
+ * A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
22595
+ * `replace`: its motion is the camera's, and while one is READY the camera's
22596
+ * own motion no longer counts on its own. `confirm`: while one is READY the
22597
+ * camera's own motion counts only while a confirm sensor is active — with or
22598
+ * without a replace sensor (spec C2, the controller's ruling on Q1).
22599
+ */
22600
+ var CameraSensorModeSchema = _enum([
22601
+ "in-addition",
22602
+ "confirm",
22603
+ "replace"
22604
+ ]);
22605
+ /** A stored sensor with no mode — every CS-1 row — is in addition. */
22606
+ var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
22607
+ /**
22608
+ * A camera's attached sensors. A CS-1 row carried an envelope
22609
+ * `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
22610
+ * what the write stores (D672 rule 3), so it is never written again.
22611
+ */
22612
+ var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
22622
22613
  const seen = /* @__PURE__ */ new Set();
22623
22614
  value.sensors.forEach((ref, index) => {
22624
22615
  const key = cameraSensorRefKey(ref);
@@ -22630,39 +22621,41 @@ var CameraSensorsConfigSchema = object({
22630
22621
  seen.add(key);
22631
22622
  });
22632
22623
  });
22633
- var RefFields = {
22624
+ /** Every attachment names its mode; an older orchestrator that does not is in addition. */
22625
+ var AttachmentFields = {
22634
22626
  addonId: string(),
22635
- stableId: string()
22627
+ stableId: string(),
22628
+ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
22636
22629
  };
22637
22630
  var CameraSensorAttachmentSchema = discriminatedUnion("state", [
22638
22631
  object({
22639
- ...RefFields,
22632
+ ...AttachmentFields,
22640
22633
  state: literal("ready"),
22641
22634
  deviceId: number(),
22642
22635
  name: string(),
22643
22636
  caps: array(string()).readonly()
22644
22637
  }),
22645
22638
  object({
22646
- ...RefFields,
22639
+ ...AttachmentFields,
22647
22640
  state: literal("offline"),
22648
22641
  deviceId: number(),
22649
22642
  name: string(),
22650
22643
  reason: _enum(["offline", "disabled"])
22651
22644
  }),
22652
22645
  object({
22653
- ...RefFields,
22646
+ ...AttachmentFields,
22654
22647
  state: literal("missing"),
22655
22648
  reason: string()
22656
22649
  }),
22657
22650
  object({
22658
- ...RefFields,
22651
+ ...AttachmentFields,
22659
22652
  state: literal("unsupported"),
22660
22653
  deviceId: number(),
22661
22654
  name: string(),
22662
22655
  reason: string()
22663
22656
  }),
22664
22657
  object({
22665
- ...RefFields,
22658
+ ...AttachmentFields,
22666
22659
  state: literal("unreadable"),
22667
22660
  reason: string()
22668
22661
  })
@@ -22675,17 +22668,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
22675
22668
  * say.
22676
22669
  */
22677
22670
  var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
22671
+ /** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
22672
+ var CameraOwnMotionSchema = _enum([
22673
+ "always",
22674
+ "when-confirmed",
22675
+ "never"
22676
+ ]);
22677
+ /** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
22678
+ var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
22679
+ /**
22680
+ * The camera's OWN onboard motion (D696): the raw input the bridge combines,
22681
+ * never the effective value. The camera's `motion` slice is the effective one,
22682
+ * so a view of the camera's own row reads this.
22683
+ * - `atMs`: when the bridge received the camera's last own edge.
22684
+ * - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
22685
+ * AND it is younger than the window the bridge counts the camera's own motion
22686
+ * for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
22687
+ * sends a clear (heartbeats only) therefore reads `false` once no push came
22688
+ * within the window; a status read is a snapshot, so a live view re-asks.
22689
+ * Absent = this orchestrator has not received the camera's own motion since it
22690
+ * started (unknown, never "quiet"), or an orchestrator older than D696.
22691
+ */
22692
+ var CameraRawLevelSchema = object({
22693
+ detected: boolean(),
22694
+ atMs: number()
22695
+ });
22678
22696
  var CameraSensorsStatusSchema = discriminatedUnion("state", [
22679
- object({ state: literal("not-configured") }),
22697
+ object({
22698
+ state: literal("not-configured"),
22699
+ cameraLevel: CameraRawLevelSchema.optional()
22700
+ }),
22680
22701
  object({
22681
22702
  state: literal("unreadable"),
22682
- reason: string()
22703
+ reason: string(),
22704
+ cameraLevel: CameraRawLevelSchema.optional()
22683
22705
  }),
22684
22706
  object({
22685
22707
  state: literal("configured"),
22686
- mode: CameraSensorsModeSchema,
22708
+ cameraLevel: CameraRawLevelSchema.optional(),
22687
22709
  sensors: array(CameraSensorAttachmentSchema).readonly(),
22688
- notForwarded: CameraSensorsNotForwardedSchema.optional()
22710
+ /** Absent = an orchestrator older than CS-2: it does not say (D315). */
22711
+ cameraMotion: CameraOwnMotionSchema.optional(),
22712
+ notForwarded: CameraSensorsNotForwardedSchema.optional(),
22713
+ notEnforced: CameraSensorsNotEnforcedSchema.optional()
22689
22714
  })
22690
22715
  ]);
22691
22716
  Object.freeze({
@@ -26678,8 +26703,10 @@ var RunnerCameraConfigSchema = object({
26678
26703
  * - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
26679
26704
  * analyzer providers) running on decoded frames in this runner.
26680
26705
  * - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
26681
- * analytics). The provider emits ProviderMotion
26682
- * events; the orchestrator forwards to `reportMotion`.
26706
+ * analytics). The provider emits its raw push as `ProviderMotion`
26707
+ * (D673); the orchestrator's camera-sensors bridge re-emits the camera's
26708
+ * effective motion as `MotionOnMotionChanged`, which is what reaches
26709
+ * `reportMotion`.
26683
26710
  */
26684
26711
  motionSources: MotionSourcesSchema.default(["analyzer"]),
26685
26712
  /**
@@ -26856,7 +26883,15 @@ var RunnerLocalLoadSchema = object({
26856
26883
  hasGpu: boolean(),
26857
26884
  inferenceBackend: string().optional(),
26858
26885
  cpuCores: number().optional()
26859
- })
26886
+ }),
26887
+ /**
26888
+ * Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
26889
+ * runner never writes it. ABSENT = a runner older than D696, which still
26890
+ * writes the slice from its phase machine; the orchestrator does not write
26891
+ * while any runner node is absent-or-unanswered, so one slice never has two
26892
+ * writers.
26893
+ */
26894
+ motionSliceWriter: literal("orchestrator").optional()
26860
26895
  });
26861
26896
  /**
26862
26897
  * Aggregate runtime metrics for the runner's whole local pool. Mirrors the
@@ -32461,6 +32496,70 @@ onStatusChanged: { data: object({
32461
32496
  * whether persisting is worth a SQLite commit. */
32462
32497
  volatileStateFields: ["lastChangedAt"]
32463
32498
  };
32499
+ var DoorbellStatusSchema = object({
32500
+ /** Ms epoch of the last press. null = never observed since this provider started. */
32501
+ lastPressedAt: number().nullable(),
32502
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
32503
+ pressCountSinceStart: number()
32504
+ });
32505
+ var DoorbellPressEventSchema = object({
32506
+ deviceId: number(),
32507
+ timestamp: number()
32508
+ });
32509
+ /**
32510
+ * Doorbell button cap. Two kinds of provider serve it, and to every consumer
32511
+ * they are the same cap:
32512
+ *
32513
+ * - **Native** providers, registered per device by a driver addon through
32514
+ * `ctx.registerNativeCap` — a `DeviceType.Button` accessory with
32515
+ * `role: DeviceRole.Doorbell`, or the camera itself (Reolink registers at
32516
+ * camera level). They emit `onPressed` on every firmware ring.
32517
+ * - **A composed doorbell** (D670, D671): a camera's customization gives it
32518
+ * the cap, its `lastPressedAt` rising from the sources the operator
32519
+ * assigned in Customize → Doorbell, and the composer emits `onPressed`
32520
+ * from that field's advance (`fromState`).
32521
+ *
32522
+ * The DeviceEventPropagator re-emits `onPressed` on the camera parent.
32523
+ */
32524
+ var doorbellCapability = {
32525
+ name: "doorbell",
32526
+ scope: "device",
32527
+ deviceNative: true,
32528
+ mode: "singleton",
32529
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
32530
+ methods: {},
32531
+ events: {
32532
+ /**
32533
+ * Fires once per physical press. Reolink delivers via Baichuan
32534
+ * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
32535
+ * release/duration — it's a pulse.
32536
+ */
32537
+ onPressed: {
32538
+ data: DoorbellPressEventSchema,
32539
+ fromState: {
32540
+ field: "lastPressedAt",
32541
+ on: "advance"
32542
+ }
32543
+ } },
32544
+ status: {
32545
+ schema: DoorbellStatusSchema,
32546
+ kind: "push"
32547
+ },
32548
+ /**
32549
+ * Runtime-state slice — last press timestamp + lifetime press count.
32550
+ * Mirrored by the kernel and readable via
32551
+ * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
32552
+ * without subscribing.
32553
+ */
32554
+ runtimeState: DoorbellStatusSchema,
32555
+ /**
32556
+ * 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.
32557
+ *
32558
+ * See `RuntimeStateDurability`. Enforced by
32559
+ * `scripts/check-runtime-state-durability.ts`.
32560
+ */
32561
+ durability: "restored"
32562
+ };
32464
32563
  /**
32465
32564
  * Enum-state sensor — a string value picked from a finite option set.
32466
32565
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -34675,11 +34774,11 @@ authKey: string().optional() }), object({
34675
34774
  /**
34676
34775
  * How long after a camera's last rising edge `pipeline-analytics` closes the
34677
34776
  * motion EPISODE row it kept open for it (D475) — "il delay della cap", in
34678
- * the operator's words. One authority for the whole system: every provider
34679
- * that seeds `autoClearAfterMs` on a `Camera` device writes this SAME
34680
- * constant while `detected: true` (never its own number — Hikvision used to
34681
- * seed its internal 3 s inactivity timer here, which is a different clock for
34682
- * a different purpose), and `MotionEpisodeTracker` imports it directly rather
34777
+ * the operator's words. One authority for the whole system: the writer of a
34778
+ * `Camera` device's slice (the orchestrator, D696) writes this SAME constant
34779
+ * in `autoClearAfterMs` while `detected: true` (never a camera's own clock —
34780
+ * Hikvision used to seed its internal 3 s inactivity timer here, a different
34781
+ * clock for a different purpose), and `MotionEpisodeTracker` imports it directly rather
34683
34782
  * than reading the live cap value on the hot path. A `Sensor` device (HA
34684
34783
  * binary sensor, Homematic) gets a genuine push both ways and has no episode
34685
34784
  * to close on a timer, so it writes `null`, never this constant.
@@ -34690,9 +34789,9 @@ var MotionStatusSchema = object({
34690
34789
  /** Ms epoch of the last detected-true observation. Null if never detected. */
34691
34790
  lastDetectedAt: number().nullable(),
34692
34791
  /**
34693
- * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
34694
- * `null` while false and on every `Sensor` device (D475) — see that
34695
- * constant's doc for the one-authority rule.
34792
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
34793
+ * orchestrator writes it, D696), `null` while false and on every `Sensor`
34794
+ * device (D475) — see that constant's doc for the one-authority rule.
34696
34795
  *
34697
34796
  * ## Reading this field still arms nothing
34698
34797
  *
@@ -34710,34 +34809,31 @@ var MotionStatusSchema = object({
34710
34809
  * `addon-export-alexa/src/motion-clear-hold.ts` and
34711
34810
  * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
34712
34811
  *
34713
- * ## Who writes it
34714
- *
34715
- * - **Cameras** — the runner's phase machine, `active → watching` on
34716
- * `cooldown_expired`, which then writes this slice with
34717
- * `detected: false` (`handlePhaseChanged` in
34718
- * `pipeline-runner/index.ts`). It produces the FALLING edge, which
34719
- * matters most for the sources that only ever push a rising one:
34720
- * Reolink emits `MotionOnMotionChanged { detected: true }` and never
34721
- * a false.
34722
- * - **Sensors** (Home Assistant binary sensors, Homematic) — the
34723
- * provider pushes the false itself, from the upstream system's own
34724
- * state change. No phase machine is involved.
34725
- *
34726
- * ### The phase machine is CANONICAL, not sole — and that is a defect
34727
- *
34728
- * An earlier revision of this docblock (mine, 2026-09-12) claimed the
34729
- * phase machine is the sole writer for a camera. It is not.
34730
- * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
34731
- * `setCapSlice(motionCapability, …)` on their own rising edge, and
34732
- * Hikvision's comment says why: it read THIS docblock, agreed the
34733
- * runner is canonical, and wrote anyway to avoid per-tick churn. So
34734
- * two authorities can disagree about one slice, which this repo
34735
- * forbids, and the doc said otherwise — which is worse than saying
34736
- * nothing, because it reads as verification.
34737
- *
34738
- * This predates D475 and is not fixed there: the fix touches every
34739
- * camera provider. Recorded in D475's Consequences. Do not restore the
34740
- * "sole writer" wording without also removing the other writers.
34812
+ * ## Who writes it (D696)
34813
+ *
34814
+ * - **Cameras** — the orchestrator, and nothing else. It writes the camera's
34815
+ * EFFECTIVE motion (`addon-pipeline-orchestrator`
34816
+ * `camera-sensors/motion-slice.ts`), alongside the effective
34817
+ * `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
34818
+ * for a split camera, an unsplit emitter's direct event, the analyzer and
34819
+ * device activity, as the camera's `motionSources` counts them. A source
34820
+ * that never sends a clear falls one window after its last `true`.
34821
+ * `lastDetectedAt` moves only on an effective rise. No camera provider
34822
+ * writes this slice (not even a boot seed), and neither does the runner's
34823
+ * phase machine: its phase is "a session is attached" for every on-motion
34824
+ * session, not motion, and it now has its own `DetectionPhaseTransition`.
34825
+ * A provider's `isDetected` answers from the hub's slice.
34826
+ * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
34827
+ * imports) — the provider pushes both edges itself, from the upstream
34828
+ * system's own state change. That is the sensor's own fact.
34829
+ *
34830
+ * `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
34831
+ * `motion` slice; each sensor writer is a named exemption.
34832
+ *
34833
+ * This replaces the D475 §4 rule ("the phase machine is the sole writer").
34834
+ * That rule was never true: Hikvision and Amcrest wrote the slice raw beside
34835
+ * it, every provider seeded it at boot, and every session left it
34836
+ * `detected: true` after its detach.
34741
34837
  */
34742
34838
  autoClearAfterMs: number().nullable()
34743
34839
  });
@@ -34809,11 +34905,12 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
34809
34905
  */
34810
34906
  runtimeState: MotionStatusSchema,
34811
34907
  /**
34812
- * Runtime-state durability: **session** — every writer of this slice
34908
+ * Runtime-state durability: **session** — the writer of this slice
34813
34909
  * writes only on an EDGE, so a restored `detected: true` would stay
34814
34910
  * frozen until the next one instead of being corrected. The next edge
34815
- * re-publishes the real state. (On who the writers are, and why there
34816
- * is more than one, see `autoClearAfterMs` above.)
34911
+ * re-publishes the real state, and the orchestrator re-publishes every
34912
+ * camera when it starts writing (D696; on who writes it, see
34913
+ * `autoClearAfterMs` above).
34817
34914
  *
34818
34915
  * See `RuntimeStateDurability`. Enforced by
34819
34916
  * `scripts/check-runtime-state-durability.ts`.
@@ -37230,8 +37327,7 @@ var ptzAutotrackCapability = {
37230
37327
  deviceNative: true,
37231
37328
  mode: "singleton",
37232
37329
  /**
37233
- * Two kinds of provider behind one name, the same shape `snapshot` and
37234
- * `doorbell` use:
37330
+ * Two kinds of provider behind one name, the same shape `snapshot` uses:
37235
37331
  *
37236
37332
  * - **Native**: the camera's own firmware autotrack, registered per device by
37237
37333
  * the driver when the probe says it exists (Reolink: yes; Hikvision:
@@ -37239,7 +37335,7 @@ var ptzAutotrackCapability = {
37239
37335
  * - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
37240
37336
  * which follows a subject with `ptz.move` pulses driven by the detection
37241
37337
  * pipeline. `defaultActive: false` — the operator binds it per camera in
37242
- * the bindings UI, exactly as `virtual-doorbell` is bound.
37338
+ * the bindings UI.
37243
37339
  *
37244
37340
  * The binding chooses WHICH implementation answers; `setEnabled` stays the
37245
37341
  * one switch for the function either way. A camera never has both driving its
@@ -47406,6 +47502,12 @@ Object.freeze({
47406
47502
  addonId: null,
47407
47503
  access: "view"
47408
47504
  },
47505
+ "notificationRules.getAlarmSensors": {
47506
+ capName: "notification-rules",
47507
+ capScope: "system",
47508
+ addonId: null,
47509
+ access: "view"
47510
+ },
47409
47511
  "notificationRules.getClipRetentionAsks": {
47410
47512
  capName: "notification-rules",
47411
47513
  capScope: "system",
@@ -51889,6 +51991,11 @@ Object.freeze({
51889
51991
  form: "single",
51890
51992
  optional: false
51891
51993
  }],
51994
+ "notificationRules.getAlarmSensors": [{
51995
+ name: "deviceIds",
51996
+ form: "array",
51997
+ optional: false
51998
+ }],
51892
51999
  "notificationRules.setDeviceMuted": [{
51893
52000
  name: "deviceId",
51894
52001
  form: "single",
@@ -53671,6 +53778,107 @@ function ruleBelongsToAlarm(rule) {
53671
53778
  if ((rule.conditions.deviceState?.states ?? []).some((s) => s.trim().toLowerCase().startsWith(ARMED_WORD_PREFIX))) return true;
53672
53779
  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));
53673
53780
  }
53781
+ var NC_ALARM_DELAY_FIELDS = [
53782
+ "exitDelaySec",
53783
+ "entryDelaySec",
53784
+ "triggeredDurationSec"
53785
+ ];
53786
+ /** The mode's value when it overrides the field, else the global one. */
53787
+ function pick(override, global) {
53788
+ return override === void 0 ? {
53789
+ value: global,
53790
+ source: "default"
53791
+ } : {
53792
+ value: override,
53793
+ source: "mode"
53794
+ };
53795
+ }
53796
+ /** What `mode` actually runs on: its own overrides, the global value for every other field. */
53797
+ function resolveModeDelays(settings, mode) {
53798
+ const entry = (settings.modeDelays ?? []).find((e) => e.mode === mode);
53799
+ const exit = pick(entry?.exitDelaySec, settings.exitDelaySec);
53800
+ const entryDelay = pick(entry?.entryDelaySec, settings.entryDelaySec);
53801
+ const triggered = pick(entry?.triggeredDurationSec, settings.triggeredDurationSec);
53802
+ return {
53803
+ exitDelaySec: exit.value,
53804
+ entryDelaySec: entryDelay.value,
53805
+ triggeredDurationSec: triggered.value,
53806
+ source: {
53807
+ exitDelaySec: exit.source,
53808
+ entryDelaySec: entryDelay.source,
53809
+ triggeredDurationSec: triggered.source
53810
+ }
53811
+ };
53812
+ }
53813
+ /** One field of an entry after an edit: number sets, null clears, undefined keeps. */
53814
+ function edited(current, edit) {
53815
+ if (edit === void 0) return current;
53816
+ return edit === null ? void 0 : edit;
53817
+ }
53818
+ /**
53819
+ * Apply per-field edits to the stored overrides. Returns new arrays, never mutates the input;
53820
+ * an entry with no field left is dropped (the mode inherits everything again).
53821
+ */
53822
+ function applyModeDelaysEdits(current, edits) {
53823
+ const out = current.map((e) => ({ ...e }));
53824
+ for (const edit of edits) {
53825
+ const at = out.findIndex((e) => e.mode === edit.mode);
53826
+ const base = at >= 0 ? out[at] ?? { mode: edit.mode } : { mode: edit.mode };
53827
+ const next = { mode: edit.mode };
53828
+ const exit = edited(base.exitDelaySec, edit.exitDelaySec);
53829
+ const entry = edited(base.entryDelaySec, edit.entryDelaySec);
53830
+ const triggered = edited(base.triggeredDurationSec, edit.triggeredDurationSec);
53831
+ if (exit !== void 0) next.exitDelaySec = exit;
53832
+ if (entry !== void 0) next.entryDelaySec = entry;
53833
+ if (triggered !== void 0) next.triggeredDurationSec = triggered;
53834
+ if (at >= 0) out[at] = next;
53835
+ else out.push(next);
53836
+ }
53837
+ return out.filter((e) => e.exitDelaySec !== void 0 || e.entryDelaySec !== void 0 || e.triggeredDurationSec !== void 0);
53838
+ }
53839
+ /**
53840
+ * Put ONE device on, or take it off, ONE mode's list. A no-op answers `changed: false`; an add
53841
+ * to a full list is REFUSED by reason (never silently dropped); an emptied list drops its entry.
53842
+ */
53843
+ function applyNonBlockingEdit(lists, edit) {
53844
+ const copy = lists.map((l) => ({
53845
+ mode: l.mode,
53846
+ deviceIds: [...l.deviceIds]
53847
+ }));
53848
+ const at = copy.findIndex((l) => l.mode === edit.mode);
53849
+ const held = at >= 0 ? copy[at]?.deviceIds ?? [] : [];
53850
+ const present = held.includes(edit.deviceId);
53851
+ if (edit.nonBlocking === present) return {
53852
+ kind: "applied",
53853
+ lists: copy,
53854
+ changed: false
53855
+ };
53856
+ if (edit.nonBlocking) {
53857
+ if (held.length >= 200) return {
53858
+ kind: "refused",
53859
+ reason: "list-full",
53860
+ mode: edit.mode,
53861
+ max: 200
53862
+ };
53863
+ const next = {
53864
+ mode: edit.mode,
53865
+ deviceIds: [...held, edit.deviceId]
53866
+ };
53867
+ if (at >= 0) copy[at] = next;
53868
+ else copy.push(next);
53869
+ } else {
53870
+ const next = {
53871
+ mode: edit.mode,
53872
+ deviceIds: held.filter((id) => id !== edit.deviceId)
53873
+ };
53874
+ if (at >= 0) copy[at] = next;
53875
+ }
53876
+ return {
53877
+ kind: "applied",
53878
+ lists: copy.filter((l) => l.deviceIds.length > 0),
53879
+ changed: true
53880
+ };
53881
+ }
53674
53882
  /**
53675
53883
  * WHICH WAY A BOOLEAN SENSOR MOVED — read off the one slice a sensor event
53676
53884
  * persists (D640 "a sensor rule fires on the raise, the clear, or both").
@@ -55114,6 +55322,7 @@ function readTimelapseGeneratedAt(rule, deviceId) {
55114
55322
  if (map !== void 0) return map[String(deviceId)] ?? 0;
55115
55323
  return rule.lastGeneratedAt ?? 0;
55116
55324
  }
55325
+ MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
55117
55326
  object({
55118
55327
  /**
55119
55328
  * Fraction of the box's own size added on EACH side before cutting.
@@ -56087,4 +56296,4 @@ function buildClipModelRegistry(entries) {
56087
56296
  /** The built-in catalog's registry. */
56088
56297
  var BUILTIN_CLIP_MODELS = buildClipModelRegistry(CLIP_IMAGE_MODELS);
56089
56298
  //#endregion
56090
- export { NC_AUDIO_CONFIRM_WINDOW_SEC_DEFAULT as $, ruleDeviceCompatCapQueries as $n, TimelapseRuleInputSchema as $t, EMBEDDING_REQUIREMENTS_FAILED as A, isDetectionMacroClass as An, sleep as Ar, NcTemplateVarDescriptorSchema as At, ListTrackRelationsInputSchema as B, memoizePinnedFfmpeg as Bn, partialRecord as Br, SCENE_DEFAULT_ANCHOR_THRESHOLD as Bt, DEFAULT_EVENT_COLOR as C, encodeVectorBase64 as Cn, createEvent as Cr, NcSnoozeInputSchema as Ct, DeclaredDevices as D, gifDeriveSpeed as Dn, isDeviceScopedCap as Dr, NcTaxonomySchema as Dt, DETECTION_PIPELINE_CAP_NAME as E, failureContributionCapability as En, hydrateSchema as Er, NcSystemEventKindSchema as Et, EXPORT_DENSE_MAX_RANGES as F, isSystemDelivery as Fn, discriminatedUnion as Fr, RECORDING_SOURCE_CAMSTACK_ADDON as Ft, MAX_BIRTH_LATENCY_PROXY_MS as G, plateGalleryCapability as Gn, union as Gr, SCENE_DIVERGED as Gt, LockStateSchema as H, occupancyScope as Hn, strictObject as Hr, SCENE_DEFAULT_OBSERVATION_SPACING_SEC as Ht, FIRST_LEVEL_MACRO_CLASSES as I, isSystemEventSummaryRule as In, literal as Ir, RebuildObjectEmbeddingsRefusalSchema as It, MOTION_CLOSE_AFTER_MS as J, readTimelapseGeneratedAt as Jn, SetTrackPurityInputSchema as Jt, MAX_TRACK_PURITIES as K, readDeviceStateFrom as Kn, unknown as Kr, SCENE_RESET_RECAPTURES as Kt, FULL_IMAGE_BBOX as L, isVectorIndexDimConflict as Ln, looseObject as Lr, RetrainStatusSchema as Lt, EVENT_DENSITY_BATCH_MAX as M, isKnownTemplateVar as Mn, _enum as Mr, OpsLogEntrySchema as Mt, EVENT_KIND_BY_CAP as N, isMediaOwnerType as Nn, array as Nr, PoolMemoryWatchdog as Nt, DetectionSourceSchema as O, gifFromMp4Args as On, nodePin as Or, NcTemplatePreviewInputSchema as Ot, EVENT_OWNER_TYPES as P, isScheduleActive as Pn, boolean as Pr, RECORDING_EXPORT_MAX_READ_BYTES as Pt, NC_AUDIO_CONFIRM_HITS_DEFAULT as Q, ruleBelongsToAlarm as Qn, TRACK_RELATIONS_DEFAULT_LIMIT as Qt, FailureCounters as R, kebabToCamel as Rn, number as Rr, SCENE_CONFIRM_DEFAULT_MAX_IMAGE_PX as Rt, CoverStateSchema as S, embeddingRequirementsUnavailableError as Sn, CamProfileSchema as Sr, NcScheduleSchema as St, DETECTION_MACRO_CLASSES as T, faceGalleryCapability as Tn, defineCustomActions as Tr, NcSnoozeSuppressedSchema as Tt, MAX_ARCHIVED_DEBUG_NOTES as U, parseProcStatus as Un, string as Ur, SCENE_DEFAULT_QUIET_SECONDS as Ut, ListTrackRelationsResultSchema as V, notificationRulesCapability as Vn, record as Vr, SCENE_DEFAULT_CHECK_INTERVAL_SEC as Vt, MAX_BIRTH_DECISION_RECORDS as W, pipelineAnalyticsCapability as Wn, tuple as Wr, SCENE_DEFAULT_UNCOVERED_POLICY as Wt, MotionTriggeredBySchema as X, resolveLocationMode as Xn, SetTrackRelationInputSchema as Xt, MediaFileKindEnum as Y, resolveClipSearchMinScore as Yn, SetTrackPurityResultSchema as Yt, NC_ALARM_SYSTEM_EVENT_KINDS as Z, resolvePoolMemoryPolicy as Zn, TIMELAPSE_DENSE_FLOOR_SEC as Zt, BaseDevice as _, describeSystemEventFamilyProblem as _n, evaluateSensorEdge as _r, NcRuleInputSchema as _t, CLIP_EMBEDDING_STEP_ID as a, TrackSideSchema as an, subKindsOf as ar, NC_CONSUMABLE_SYSTEM_EVENT_KINDS as at, ClearTrackRelationInputSchema as b, embeddingRefusalOf as bn, errMsg as br, NcRuleTargetSchema as bt, resolveClusterModelPin as c, alarmPanelCapability as cn, systemEventFilterApplies as cr, NC_SNOOZE_MAX_MINUTES as ct, APPEARANCE_RESOLVES_AMBIGUITY_DEFAULT as d, audioModeOf as dn, templateCarriesSummary as dr, NC_TAXONOMY as dt, TimelapseRulePatchSchema as en, ruleKindOf as er, NC_CLIP_POST_ROLL_DEFAULT_SEC as et, ARCHIVED_DEBUG_NOTES_DEFAULT_LIMIT as f, buildEventKindDescriptor as fn, templateVarsFor as fr, NC_TEMPLATE_VARS as ft, BIRTH_DECISION_DEFAULT_LIMIT as g, describeSystemEventDeliveryProblem as gn, canonicalHash as gr, NcConditionsSchema as gt, ArchivedDebugNoteSchema as h, deriveRecordingMode as hn, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS as hr, NcConditionDescriptorSchema as ht, CLIP_TEXT_MODELS as i, TrackRelationSchema as in, storageOccupancyCapability as ir, NC_CONSUMABLE_LOW_PERCENT_DEFAULT as it, EMBEDDING_REQUIREMENTS_UNAVAILABLE as j, isEventOwnerType as jn, ZodObject as jr, OPS_LOG_DEFAULT_LIMIT as jt, EMBEDDING_MODEL_FAILED as k, isAudioClassName as kn, normalizeNodeId as kr, NcTemplatePreviewSchema as kt, APPEARANCE_BIN_COUNT as l, assertTimelapseCadences as ln, systemEventSummaryScheduleOf as lr, NC_SYSTEM_EVENT_KIND_GROUP_SPECS as lt, AlarmArmModeSchema as m, cosineSimilarity as mn, zoneAnalyticsCapability as mr, NcAlarmSettingsPatchSchema as mt, DEFAULT_CLIP_MODEL as n, TrackPuritySchema as nn, sensorRaisedOf as nr, NC_CLIP_RETENTION_MAX_SEC as nt, FACE_EMBEDDING_STEP_ID as o, TrackSourceSchema as on, systemEventDeliveryProblems as or, NC_DEFAULT_SNOOZE_MINUTES as ot, AUDIO_MACRO_LABELS as p, consumableLowPercentOf as pn, vectorDimFromBase64 as pr, NcAlarmConfigSchema as pt, MAX_TRACK_RELATIONS as q, readMotionTriggeredBy as qn, EventCategory as qr, SceneMonitorSchema as qt, CLIP_IMAGE_MODELS as r, TrackRelationKindSchema as rn, servedTemplateVars as rr, NC_CONDITION_CATALOG as rt, readClusterModelPinStrict as s, addonWidgetsSourceCapability as sn, systemEventFamilyProblems as sr, NC_SENSOR_TRANSITION_KINDS as st, BUILTIN_CLIP_MODELS as t, TimelapseRuleSchema as tn, sceneMonitorCapability as tr, NC_CLIP_PRE_ROLL_DEFAULT_SEC as tt, APPEARANCE_BLOCKS as u, audioMetricsCapability as un, systemEventSummarySplitOf as ur, NC_TANK_SYSTEM_EVENT_KINDS as ut, BirthDecisionRecordSchema as v, embeddingEncoderCapability as vn, isSourceCap as vr, NcRulePatchSchema as vt, DEFAULT_TIMELAPSE_PREVIEW_TEXT as w, evictionPolicyOfLocation as wn, customAction as wr, NcSnoozeSchema as wt, ClearTrackRelationResultSchema as x, embeddingRequirementsFailedError as xn, BaseAddon as xr, NcRuleUpdateInputSchema as xt, COCO_TO_MACRO as y, embeddingModelFailedError as yn, DeviceType as yr, NcRuleSchema as yt, LabelAttributionSchema as z, mayWriteToLocation as zn, object as zr, SCENE_CONFIRM_DEFAULT_TIMEOUT_MS as zt };
56299
+ export { NC_ALARM_SYSTEM_EVENT_KINDS as $, readDeviceStateFrom as $n, union as $r, SetTrackPurityInputSchema as $t, EMBEDDING_REQUIREMENTS_FAILED as A, encodeVectorBase64 as An, CamProfileSchema as Ar, NcSnoozeSuppressedSchema as At, ListTrackRelationsInputSchema as B, isMediaOwnerType as Bn, _enum as Br, RECORDING_SOURCE_CAMSTACK_ADDON as Bt, DEFAULT_EVENT_COLOR as C, describeSystemEventDeliveryProblem as Cn, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS as Cr, NcRulePatchSchema as Ct, DeclaredDevices as D, embeddingRefusalOf as Dn, DeviceType as Dr, NcScheduleSchema as Dt, DETECTION_PIPELINE_CAP_NAME as E, embeddingModelFailedError as En, isSourceCap as Er, NcRuleUpdateInputSchema as Et, EXPORT_DENSE_MAX_RANGES as F, gifFromMp4Args as Fn, isDeviceScopedCap as Fr, NcTemplateVarDescriptorSchema as Ft, MAX_BIRTH_LATENCY_PROXY_MS as G, kebabToCamel as Gn, looseObject as Gr, SCENE_DEFAULT_ANCHOR_THRESHOLD as Gt, LockStateSchema as H, isSystemDelivery as Hn, boolean as Hr, RetrainStatusSchema as Ht, FIRST_LEVEL_MACRO_CLASSES as I, isAudioClassName as In, nodePin as Ir, OPS_LOG_DEFAULT_LIMIT as It, MOTION_CLOSE_AFTER_MS as J, notificationRulesCapability as Jn, partialRecord as Jr, SCENE_DEFAULT_QUIET_SECONDS as Jt, MAX_TRACK_PURITIES as K, mayWriteToLocation as Kn, number as Kr, SCENE_DEFAULT_CHECK_INTERVAL_SEC as Kt, FULL_IMAGE_BBOX as L, isDetectionMacroClass as Ln, normalizeNodeId as Lr, OpsLogEntrySchema as Lt, EVENT_DENSITY_BATCH_MAX as M, faceGalleryCapability as Mn, customAction as Mr, NcTaxonomySchema as Mt, EVENT_KIND_BY_CAP as N, failureContributionCapability as Nn, defineCustomActions as Nr, NcTemplatePreviewInputSchema as Nt, DetectionSourceSchema as O, embeddingRequirementsFailedError as On, errMsg as Or, NcSnoozeInputSchema as Ot, EVENT_OWNER_TYPES as P, gifDeriveSpeed as Pn, hydrateSchema as Pr, NcTemplatePreviewSchema as Pt, NC_ALARM_DELAY_MAX_SEC as Q, plateGalleryCapability as Qn, tuple as Qr, SceneMonitorSchema as Qt, FailureCounters as R, isEventOwnerType as Rn, sleep as Rr, PoolMemoryWatchdog as Rt, CoverStateSchema as S, deriveRecordingMode as Sn, zoneAnalyticsCapability as Sr, NcRuleInputSchema as St, DETECTION_MACRO_CLASSES as T, embeddingEncoderCapability as Tn, evaluateSensorEdge as Tr, NcRuleTargetSchema as Tt, MAX_ARCHIVED_DEBUG_NOTES as U, isSystemEventSummaryRule as Un, discriminatedUnion as Ur, SCENE_CONFIRM_DEFAULT_MAX_IMAGE_PX as Ut, ListTrackRelationsResultSchema as V, isScheduleActive as Vn, array as Vr, RebuildObjectEmbeddingsRefusalSchema as Vt, MAX_BIRTH_DECISION_RECORDS as W, isVectorIndexDimConflict as Wn, literal as Wr, SCENE_CONFIRM_DEFAULT_TIMEOUT_MS as Wt, MotionTriggeredBySchema as X, parseProcStatus as Xn, strictObject as Xr, SCENE_DIVERGED as Xt, MediaFileKindEnum as Y, occupancyScope as Yn, record as Yr, SCENE_DEFAULT_UNCOVERED_POLICY as Yt, NC_ALARM_DELAY_FIELDS as Z, pipelineAnalyticsCapability as Zn, string as Zr, SCENE_RESET_RECAPTURES as Zt, BaseDevice as _, audioMetricsCapability as _n, systemEventSummaryScheduleOf as _r, NcAlarmSensorsInputSchema as _t, CLIP_EMBEDDING_STEP_ID as a, TimelapseRulePatchSchema as an, resolvePoolMemoryPolicy as ar, NC_CLIP_RETENTION_MAX_SEC as at, ClearTrackRelationInputSchema as b, consumableLowPercentOf as bn, templateVarsFor as br, NcConditionDescriptorSchema as bt, resolveClusterModelPin as c, TrackRelationKindSchema as cn, ruleKindOf as cr, NC_CONSUMABLE_SYSTEM_EVENT_KINDS as ct, APPEARANCE_RESOLVES_AMBIGUITY_DEFAULT as d, TrackSourceSchema as dn, servedTemplateVars as dr, NC_SNOOZE_MAX_MINUTES as dt, unknown as ei, SetTrackPurityResultSchema as en, readMotionTriggeredBy as er, NC_ALARM_TRIGGERED_MAX_SEC as et, ARCHIVED_DEBUG_NOTES_DEFAULT_LIMIT as f, addonWidgetsSourceCapability as fn, storageOccupancyCapability as fr, NC_SYSTEM_EVENT_KIND_GROUP_SPECS as ft, BIRTH_DECISION_DEFAULT_LIMIT as g, assertTimelapseCadences as gn, systemEventFilterApplies as gr, NcAlarmConfigSchema as gt, ArchivedDebugNoteSchema as h, applyNonBlockingEdit as hn, systemEventFamilyProblems as hr, NC_TEMPLATE_VARS as ht, CLIP_TEXT_MODELS as i, TimelapseRuleInputSchema as in, resolveModeDelays as ir, NC_CLIP_PRE_ROLL_DEFAULT_SEC as it, EMBEDDING_REQUIREMENTS_UNAVAILABLE as j, evictionPolicyOfLocation as jn, createEvent as jr, NcSystemEventKindSchema as jt, EMBEDDING_MODEL_FAILED as k, embeddingRequirementsUnavailableError as kn, BaseAddon as kr, NcSnoozeSchema as kt, APPEARANCE_BIN_COUNT as l, TrackRelationSchema as ln, sceneMonitorCapability as lr, NC_DEFAULT_SNOOZE_MINUTES as lt, AlarmArmModeSchema as m, applyModeDelaysEdits as mn, systemEventDeliveryProblems as mr, NC_TAXONOMY as mt, DEFAULT_CLIP_MODEL as n, TIMELAPSE_DENSE_FLOOR_SEC as nn, resolveClipSearchMinScore as nr, NC_AUDIO_CONFIRM_WINDOW_SEC_DEFAULT as nt, FACE_EMBEDDING_STEP_ID as o, TimelapseRuleSchema as on, ruleBelongsToAlarm as or, NC_CONDITION_CATALOG as ot, AUDIO_MACRO_LABELS as p, alarmPanelCapability as pn, subKindsOf as pr, NC_TANK_SYSTEM_EVENT_KINDS as pt, MAX_TRACK_RELATIONS as q, memoizePinnedFfmpeg as qn, object as qr, SCENE_DEFAULT_OBSERVATION_SPACING_SEC as qt, CLIP_IMAGE_MODELS as r, TRACK_RELATIONS_DEFAULT_LIMIT as rn, resolveLocationMode as rr, NC_CLIP_POST_ROLL_DEFAULT_SEC as rt, readClusterModelPinStrict as s, TrackPuritySchema as sn, ruleDeviceCompatCapQueries as sr, NC_CONSUMABLE_LOW_PERCENT_DEFAULT as st, BUILTIN_CLIP_MODELS as t, EventCategory as ti, SetTrackRelationInputSchema as tn, readTimelapseGeneratedAt as tr, NC_AUDIO_CONFIRM_HITS_DEFAULT as tt, APPEARANCE_BLOCKS as u, TrackSideSchema as un, sensorRaisedOf as ur, NC_SENSOR_TRANSITION_KINDS as ut, BirthDecisionRecordSchema as v, audioModeOf as vn, systemEventSummarySplitOf as vr, NcAlarmSensorsSchema as vt, DEFAULT_TIMELAPSE_PREVIEW_TEXT as w, describeSystemEventFamilyProblem as wn, canonicalHash as wr, NcRuleSchema as wt, ClearTrackRelationResultSchema as x, cosineSimilarity as xn, vectorDimFromBase64 as xr, NcConditionsSchema as xt, COCO_TO_MACRO as y, buildEventKindDescriptor as yn, templateCarriesSummary as yr, NcAlarmSettingsPatchSchema as yt, LabelAttributionSchema as z, isKnownTemplateVar as zn, ZodObject as zr, RECORDING_EXPORT_MAX_READ_BYTES as zt };