@camstack/addon-ai 0.4.127 → 0.4.129

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 (3) hide show
  1. package/dist/addon.js +962 -519
  2. package/dist/addon.mjs +962 -519
  3. package/package.json +2 -2
package/dist/addon.mjs CHANGED
@@ -43,7 +43,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
43
43
  }) : target, mod));
44
44
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
45
45
  //#endregion
46
- //#region ../types/dist/event-category-C5xZWqz6.mjs
46
+ //#region ../types/dist/event-category-BGmz_oxW.mjs
47
47
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
48
48
  EventCategory["SystemBoot"] = "system.boot";
49
49
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -576,6 +576,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
576
576
  */
577
577
  EventCategory["PipelineAudioInferenceResult"] = "pipeline.audio-inference-result";
578
578
  EventCategory["DetectionPhaseTransition"] = "detection.phase-transition";
579
+ /**
580
+ * A camera provider's RAW onboard motion push (D673): the `MotionOnMotionChanged`
581
+ * data shape without `triggeredBy`, built by `providerMotionEvent`. Its one
582
+ * consumer is the orchestrator's camera-sensors bridge, which re-emits the
583
+ * camera's EFFECTIVE onboard motion as `MotionOnMotionChanged` (a pass-through
584
+ * for a camera with no attached sensor). Providers must not emit
585
+ * `MotionOnMotionChanged` themselves; `scripts/check-onboard-motion-emitters.ts`
586
+ * keeps it so (camera-grid is a named, deferred exception).
587
+ */
579
588
  EventCategory["ProviderMotion"] = "provider.motion";
580
589
  EventCategory["ProviderDetection"] = "provider.detection";
581
590
  EventCategory["EnrichmentEmbeddingStored"] = "enrichment.embedding.stored";
@@ -5561,7 +5570,7 @@ function number(params) {
5561
5570
  return /* @__PURE__ */ _coercedNumber(ZodNumber, params);
5562
5571
  }
5563
5572
  //#endregion
5564
- //#region ../types/dist/sleep-DlrgY4Qb.mjs
5573
+ //#region ../types/dist/sleep-CDCONfkt.mjs
5565
5574
  /**
5566
5575
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5567
5576
  * window to float samples (D455).
@@ -7649,23 +7658,74 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7649
7658
  return DeviceRole;
7650
7659
  }({});
7651
7660
  //#endregion
7652
- //#region ../types/dist/composition-BK-GTFYb.mjs
7653
- /**
7654
- * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
7655
- * valutatore puro del suo FRONTE.
7656
- *
7657
- * Viveva dentro il builtin virtual-doorbell
7658
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
7659
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
7660
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
7661
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
7662
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
7663
- * SPOSTA qui e il doorbell la ri-esporta.
7664
- *
7665
- * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
7666
- * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
7667
- * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
7668
- * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
7661
+ //#region ../types/dist/composition-D7ULvLdD.mjs
7662
+ /**
7663
+ * The ffmpeg build every CamStack node downloads, per platform and arch.
7664
+ *
7665
+ * ## Why a download, on every node, including the container
7666
+ *
7667
+ * The version of ffmpeg used to be CODE: baked into the image, changeable only
7668
+ * by rebuilding and rolling it. Now it is DATA — this file states the release,
7669
+ * and a node that boots with a different one downloads it. Changing ffmpeg is a
7670
+ * framework bump, not an image rebuild.
7671
+ *
7672
+ * It also settles the licence question by removing it. FFmpeg's licence is
7673
+ * chosen at compile time: the core is LGPL 2.1+, `--enable-gpl` makes it GPL
7674
+ * (for x264/x265), `--enable-version3` makes that v3, and `--enable-nonfree`
7675
+ * makes the result undistributable. These are GPL v3 builds, and we do not
7676
+ * distribute them: the user's own node fetches the archive from the project
7677
+ * that publishes it, so we convey no GPL work and inherit none of the
7678
+ * obligations that come with conveying one. That is the whole reason the image
7679
+ * no longer installs ffmpeg at all — not a technical preference.
7680
+ *
7681
+ * ## Why jellyfin-ffmpeg
7682
+ *
7683
+ * One vendor covering linux-amd64, linux-arm64, darwin-arm64 and darwin-x64
7684
+ * from one release, with the widest hardware surface of anything maintained:
7685
+ * VAAPI, QSV, NVENC/NVDEC, AMF, Vulkan, OpenCL and DRM on amd64, plus Rockchip
7686
+ * MPP on arm64. It reaches the vendor libraries through dlopen trampolines,
7687
+ * so the binary is not linked against a driver stack it may not find.
7688
+ *
7689
+ * **What it still needs from the host, measured 2026-09-19.** On the Unraid
7690
+ * HOST, which has no libva, `-vaapi_device` aborts the process outright —
7691
+ * `implib-gen: libva-drm.so.2: failed to load library ... Assertion '0 &&
7692
+ * "Assertion in generated code"' failed`. Inside our container, which installs
7693
+ * libva plus the iHD driver, the same command encodes: verified end to end with
7694
+ * `testsrc → format=nv12,hwupload → h264_vaapi`. So the image drops ffmpeg and
7695
+ * KEEPS the Intel media stack; the drivers are the part a binary cannot bring.
7696
+ *
7697
+ * ## Why each artifact carries a checksum and a claim
7698
+ *
7699
+ * The download is now the only source, so `sha256` is verified before anything
7700
+ * is extracted — jellyfin publishes no checksums on its release assets, so
7701
+ * these are ours, taken at the version bump. And `expectedHwaccels` is what the
7702
+ * build is supposed to be able to do: a binary that probes short of its own
7703
+ * claim is a source that changed under us, which is precisely what went
7704
+ * unnoticed for months when a static build turned out to carry no VAAPI at all
7705
+ * (D536).
7706
+ */
7707
+ /** The pinned jellyfin-ffmpeg release. Changing this is the version change. */
7708
+ var FFMPEG_RELEASE = "8.1.2-5";
7709
+ var BASE = `https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v${FFMPEG_RELEASE}`;
7710
+ function portable(target) {
7711
+ return `${BASE}/jellyfin-ffmpeg_${FFMPEG_RELEASE}_portable_${target}-gpl.tar.xz`;
7712
+ }
7713
+ portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac64");
7714
+ /**
7715
+ * THE table "which boolean of this device type counts as HIGH", and the
7716
+ * pure evaluator of its EDGE.
7717
+ *
7718
+ * ONE table for everyone who asks "is this device HIGH?": the
7719
+ * recorder's `RecordingTriggers.sensorDeviceIds` trigger, the post-analysis
7720
+ * sensor markers, the orchestrator's camera-sensors bridge and
7721
+ * the sources of a composite doorbell (`doorbellFeatureSources`, D671).
7722
+ * A second copy would diverge at the first cap added, and the symptom — "the
7723
+ * sensor rings the doorbell but does not record" — is exactly D62.
7724
+ *
7725
+ * ⚠ NOT `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), and the
7726
+ * two must not be unified: that one answers "what is the state WORD for a
7727
+ * rule" (and includes `presence`, `cover`, `alarm-panel`), this one "which
7728
+ * boolean's EDGE counts". Deliberately different vocabularies.
7669
7729
  */
7670
7730
  /**
7671
7731
  * Known binary / switch source caps → the boolean slice field whose
@@ -8453,7 +8513,6 @@ var CompositionSchema = object({
8453
8513
  });
8454
8514
  new Set([
8455
8515
  "track",
8456
- "summary",
8457
8516
  "face",
8458
8517
  "identity",
8459
8518
  "plate",
@@ -9122,6 +9181,82 @@ var ArchivedDebugNoteQueryInputSchema = object({
9122
9181
  /** Max rows returned, newest-first. */
9123
9182
  limit: number$1().int().min(1).max(1e3).optional()
9124
9183
  });
9184
+ var TrackRelationKindSchema = _enum(["same-subject", "different-subjects"]);
9185
+ var TrackSideSchema = _enum(["before", "after"]);
9186
+ var TrackPurityValueSchema = _enum(["mixed", "not-a-subject"]);
9187
+ var TrackRelationSchema = object({
9188
+ id: string(),
9189
+ deviceId: number$1().int(),
9190
+ leftTrackId: string(),
9191
+ rightTrackId: string(),
9192
+ leftSide: TrackSideSchema.nullable(),
9193
+ rightSide: TrackSideSchema.nullable(),
9194
+ relation: TrackRelationKindSchema,
9195
+ presence: literal("continuous").nullable(),
9196
+ leftStartedAt: number$1().int().nullable(),
9197
+ rightStartedAt: number$1().int().nullable(),
9198
+ createdAt: number$1().int(),
9199
+ updatedAt: number$1().int(),
9200
+ author: string().nullable()
9201
+ });
9202
+ var TrackPuritySchema = object({
9203
+ id: string(),
9204
+ deviceId: number$1().int(),
9205
+ sourceTrackId: string(),
9206
+ purity: TrackPurityValueSchema,
9207
+ switchAtMs: number$1().int().nullable(),
9208
+ startedAt: number$1().int().nullable(),
9209
+ createdAt: number$1().int(),
9210
+ updatedAt: number$1().int(),
9211
+ author: string().nullable()
9212
+ });
9213
+ var SetTrackRelationInputSchema = object({
9214
+ deviceId: number$1().int(),
9215
+ trackId: string().min(1),
9216
+ otherTrackId: string().min(1),
9217
+ relation: TrackRelationKindSchema,
9218
+ presence: literal("continuous").optional(),
9219
+ trackSide: TrackSideSchema.optional(),
9220
+ otherSide: TrackSideSchema.optional()
9221
+ });
9222
+ var ClearTrackRelationInputSchema = object({
9223
+ deviceId: number$1().int(),
9224
+ trackId: string().min(1),
9225
+ otherTrackId: string().min(1)
9226
+ });
9227
+ var ClearTrackRelationResultSchema = object({ cleared: boolean() });
9228
+ var SetTrackPurityInputSchema = object({
9229
+ deviceId: number$1().int(),
9230
+ trackId: string().min(1),
9231
+ purity: _enum([
9232
+ "pure",
9233
+ "mixed",
9234
+ "not-a-subject"
9235
+ ]),
9236
+ switchAtMs: number$1().int().optional()
9237
+ });
9238
+ /** `null` when `pure` cleared the row. */
9239
+ var SetTrackPurityResultSchema = object({ purity: TrackPuritySchema.nullable() });
9240
+ var ListTrackRelationsInputSchema = object({
9241
+ deviceId: number$1().int(),
9242
+ trackId: string().optional(),
9243
+ since: number$1().int().optional(),
9244
+ until: number$1().int().optional(),
9245
+ limit: number$1().int().min(1).max(5e3).optional()
9246
+ });
9247
+ var ListTrackRelationsResultSchema = object({
9248
+ relations: array(TrackRelationSchema).readonly(),
9249
+ purities: array(TrackPuritySchema).readonly(),
9250
+ truncated: boolean()
9251
+ });
9252
+ _enum([
9253
+ "unknown-track",
9254
+ "cross-device",
9255
+ "self-relation",
9256
+ "contradiction",
9257
+ "switch-outside-track",
9258
+ "switch-needs-mixed"
9259
+ ]);
9125
9260
  /**
9126
9261
  * Ops-log — the durable, append-only operations audit shared by the
9127
9262
  * recordings and events management surfaces.
@@ -9197,22 +9332,22 @@ var CLASS_MAP_MACRO_TARGETS = [
9197
9332
  "package"
9198
9333
  ];
9199
9334
  /**
9200
- * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
9201
- * un operatore può selezionare.
9335
+ * The FIRST-LEVEL macro classes: those an object detector emits and that
9336
+ * an operator can select.
9202
9337
  *
9203
- * Sono le tre offerte dallo step `object-detection`
9338
+ * They are the three offered by the `object-detection` step
9204
9339
  * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
9205
- * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
9206
- * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
9207
- * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
9208
- * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
9340
+ * `enabledMacroClasses`). `package` is in {@link CLASS_MAP_MACRO_TARGETS} and in
9341
+ * `MACRO_LABELS` — it is a true macro — but NOT here: it belongs to the step
9342
+ * `package-detection`, whose enablement is driven by zones, and offering the
9343
+ * same word twice has already made an operator turn on the COCO proxy
9209
9344
  * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
9210
9345
  *
9211
- * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
9212
- * dello step e una seconda volta come union `FirstLevelMacro`
9213
- * (`types/detection.ts`); una terza copia per il trigger di registrazione
9214
- * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
9215
- * successiva.
9346
+ * ONE list. Before today the same three were hand-written in the step's offer
9347
+ * and a second time as the union `FirstLevelMacro`
9348
+ * (`types/detection.ts`); a third copy for the recording trigger
9349
+ * (`RecordingTriggers.objectClasses`) would have made the later divergence
9350
+ * invisible.
9216
9351
  */
9217
9352
  var FIRST_LEVEL_MACRO_CLASSES = [
9218
9353
  "person",
@@ -9277,17 +9412,17 @@ var RecordingStorageModeSchema = _enum([
9277
9412
  "on-device-decision"
9278
9413
  ]);
9279
9414
  /**
9280
- * Le macro classi che possono aprire una finestra di registrazione — le stesse
9281
- * tre offerte dallo step `object-detection`, da UNA lista
9415
+ * The macro classes that can open a recording window — the same
9416
+ * three offered by the `object-detection` step, from ONE list
9282
9417
  * ({@link FIRST_LEVEL_MACRO_CLASSES}).
9283
9418
  */
9284
9419
  var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
9285
9420
  /**
9286
- * True quando `values` non ripete un elemento.
9421
+ * True when `values` does not repeat an element.
9287
9422
  *
9288
- * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
9289
- * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
9290
- * conterebbe due volte le sue finestre in `segmentMissedByMs`.
9423
+ * A duplicate is not harmless: every entry of `objectClasses` / `sensorDeviceIds`
9424
+ * becomes a SOURCE in `bandTriggerSources`, and the same source twice
9425
+ * would count its windows twice in `segmentMissedByMs`.
9291
9426
  */
9292
9427
  var noDuplicates = (values) => new Set(values).size === values.length;
9293
9428
  /** Which detectors trigger an `events`-mode band. */
@@ -9295,34 +9430,34 @@ var RecordingTriggersSchema = object({
9295
9430
  motion: boolean().optional(),
9296
9431
  audioThresholdDbfs: number$1().optional(),
9297
9432
  /**
9298
- * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
9299
- * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
9300
- * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
9301
- * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
9433
+ * The macro classes whose detection opens a window. ABSENT = the source
9434
+ * is not listened to; an EMPTY array is rejected, because "events band, object
9435
+ * trigger on, no class" is the same shape "enabled and records
9436
+ * nothing, forever" that `eventsBandCanEverDemand` is written against.
9302
9437
  *
9303
- * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
9304
- * quelle che hanno attraversato `enabledMacroClasses`, i
9305
- * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
9306
- * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
9307
- * finestre — vedi `recorder/object-trigger.ts`.
9438
+ * The signal read is ALREADY FILTERED: only `source: 'pipeline'` detections, i.e.
9439
+ * those that went through `enabledMacroClasses`, the
9440
+ * `minConfidence<Macro>` and the full-frame guard. The camera's onboard AI
9441
+ * (`source: 'onboard'`) goes through none of those gates and does NOT open
9442
+ * windows — see `recorder/object-trigger.ts`.
9308
9443
  */
9309
9444
  objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
9310
9445
  /**
9311
- * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
9312
- * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
9446
+ * The LINKED devices whose RISING EDGE opens a window. Absent = the source
9447
+ * is not listened to; an empty array is rejected for the same reason as
9313
9448
  * `objectClasses`.
9314
9449
  *
9315
- * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
9316
- * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
9317
- * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
9318
- * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
9319
- * device (D12) — mai un elenco globale di cap.
9450
+ * These are SOURCE device ids, not cameras: the band names them, so the
9451
+ * hot path (`DeviceStateChanged`, at bus rate across the whole fleet)
9452
+ * does no RPC. The OFFER from which the operator picks them is another question, and
9453
+ * is resolved with `deviceManager.getLinkedDevices` + `getBindingsBatch` per
9454
+ * device (D12) — never a global list of caps.
9320
9455
  *
9321
- * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
9322
- * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
9323
- * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
9324
- * il livello: un contatto trovato già aperto al riavvio del runner non fa
9325
- * registrare.
9456
+ * What "high" means depends on the device TYPE and is not decided here:
9457
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) is THE table,
9458
+ * the same one as the composite doorbell (D671). And it is the EDGE, not
9459
+ * the level: a contact found already open at runner restart does not
9460
+ * record.
9326
9461
  */
9327
9462
  sensorDeviceIds: array(number$1().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
9328
9463
  });
@@ -10399,7 +10534,7 @@ var DecoderSessionConfigSchema = object({
10399
10534
  * - **VALUE** — at which level, for which scope, until when. That stays ONE
10400
10535
  * thing: the logging settings document on the `system` cap. Two authorities
10401
10536
  * over the values is the exact defect
10402
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
10537
+ * `docs/design/plans/2026-08-26-per-component-logging.md` was written to
10403
10538
  * remove; re-introducing it from the cure side would be grotesque.
10404
10539
  *
10405
10540
  * Nothing in this file reads a clock, an env var or a store. The registry is
@@ -11675,6 +11810,68 @@ method(object({
11675
11810
  password: string()
11676
11811
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
11677
11812
  /**
11813
+ * How long one snapshot may take end to end: the pinned copy of the whole
11814
+ * database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
11815
+ * disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
11816
+ * generous because a timeout fails the whole backup run.
11817
+ */
11818
+ var DATABASE_SNAPSHOT_TIMEOUT_MS = 30 * 6e4;
11819
+ /**
11820
+ * The databases an owner snapshots — declared by the OWNER, so a caller never
11821
+ * guesses which file is live from what sits beside it (a cleanly closed
11822
+ * database has no sidecars and is just as owned). Paths are absolute on the
11823
+ * owner's host.
11824
+ */
11825
+ var DatabaseSnapshotTargetsSchema = object({ databases: array(object({ livePath: string() })) });
11826
+ /** One b-tree table of the snapshot and the rows it holds. */
11827
+ var DatabaseSnapshotTableSchema = object({
11828
+ name: string(),
11829
+ rows: number$1().int().nonnegative()
11830
+ });
11831
+ /**
11832
+ * What the owner wrote. Every path is ABSOLUTE on the owner's host — the
11833
+ * caller pins the call to its own node, so it can read the file; a caller
11834
+ * that finds the path outside its own data root refuses it rather than
11835
+ * archiving something it cannot place.
11836
+ */
11837
+ var DatabaseSnapshotResultSchema = object({
11838
+ /** The live database the snapshot copies. Never to be copied as a file. */
11839
+ livePath: string(),
11840
+ /** The verified copy: `<livePath>` + {@link DATABASE_SNAPSHOT_SUFFIX}. */
11841
+ snapshotPath: string(),
11842
+ sizeBytes: number$1().int().nonnegative(),
11843
+ pageCount: number$1().int().nonnegative(),
11844
+ pageSize: number$1().int().positive(),
11845
+ /**
11846
+ * Every b-tree table with its row count. Read inside the SAME read
11847
+ * transaction the copy was taken from, and found EQUAL on the copy — so
11848
+ * this is the content of the snapshot, not an estimate of the source.
11849
+ */
11850
+ tables: array(DatabaseSnapshotTableSchema),
11851
+ /** Wall time of the pinned copy (row counts included). */
11852
+ copyMs: number$1().nonnegative(),
11853
+ /** Wall time of the checks on the copy (`integrity_check`, row counts). */
11854
+ verifyMs: number$1().nonnegative(),
11855
+ /** When the pinned read transaction began (ms epoch) — the snapshot's instant. */
11856
+ takenAt: number$1()
11857
+ });
11858
+ /**
11859
+ * A snapshot as an ARCHIVE records it (`ArchiveManifest.sqliteSnapshots`):
11860
+ * the same facts, with both paths relative to the archive root (the node's
11861
+ * data dir), because an archive outlives the host that made it.
11862
+ */
11863
+ var ArchiveSqliteSnapshotSchema = DatabaseSnapshotResultSchema.extend({
11864
+ /** Archive-relative path of the live database the archive does NOT carry. */
11865
+ livePath: string(),
11866
+ /** Archive-relative path of the verified copy it carries in its place. */
11867
+ snapshotPath: string()
11868
+ });
11869
+ method(object({}), DatabaseSnapshotTargetsSchema, { auth: "admin" }), method(object({}), DatabaseSnapshotResultSchema, {
11870
+ kind: "mutation",
11871
+ auth: "admin",
11872
+ timeoutMs: DATABASE_SNAPSHOT_TIMEOUT_MS
11873
+ });
11874
+ /**
11678
11875
  * Orchestrator-side destination metadata. The orchestrator computes
11679
11876
  * `id = <addonId>:<subId>` from its provider lookup so consumers
11680
11877
  * (admin UI, restore flow) see one canonical key.
@@ -11785,7 +11982,12 @@ var ArchiveManifestSchema = object({
11785
11982
  locations: array(string()),
11786
11983
  entries: array(ArchiveEntrySchema),
11787
11984
  totalBytes: number$1(),
11788
- totalFiles: number$1()
11985
+ totalFiles: number$1(),
11986
+ /**
11987
+ * Live SQLite databases this archive carries as their OWNER's verified
11988
+ * snapshot instead of as files (D693). Absent on archives made before.
11989
+ */
11990
+ sqliteSnapshots: array(ArchiveSqliteSnapshotSchema).optional()
11789
11991
  });
11790
11992
  var LocationStatSchema = object({
11791
11993
  name: string(),
@@ -13209,6 +13411,116 @@ var CompositionBlockStateSchema = object({
13209
13411
  reason: string().optional(),
13210
13412
  fields: array(CompositionFieldStateSchema)
13211
13413
  });
13414
+ var ComposerBlockSchema = object({
13415
+ id: string().min(1),
13416
+ name: string().min(1).max(120),
13417
+ enabled: boolean(),
13418
+ updatedAt: number$1(),
13419
+ composition: CompositionSchema
13420
+ });
13421
+ /**
13422
+ * A stored composition row that no longer PARSES — a schema a release
13423
+ * tightened, a row written by a newer build. Sent by id so the composer keeps
13424
+ * its device as a placeholder and reports the block `failed` naming the parse
13425
+ * error. Leaving it out would read, twice, exactly like a delete (D49).
13426
+ */
13427
+ var ComposerUnreadableBlockSchema = object({
13428
+ id: string().min(1),
13429
+ /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
13430
+ name: string().nullable(),
13431
+ /** The parse error, in the operator's words. */
13432
+ error: string()
13433
+ });
13434
+ method(object({
13435
+ /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
13436
+ integrationId: string().nullable(),
13437
+ /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
13438
+ storeLoaded: boolean(),
13439
+ blocks: array(ComposerBlockSchema),
13440
+ /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
13441
+ restartBlockIds: array(string()),
13442
+ /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
13443
+ unreadableBlocks: array(ComposerUnreadableBlockSchema)
13444
+ }), object({
13445
+ blocks: array(object({
13446
+ blockId: string(),
13447
+ status: CompositionRunStatusSchema,
13448
+ reason: string().optional()
13449
+ })),
13450
+ /**
13451
+ * False when the composer declared and withdrew NOTHING (store not loaded,
13452
+ * integration unknown, its own rows unread or read empty once). An empty
13453
+ * apply the caller owes is paid off only by one the composer acted on (D49).
13454
+ */
13455
+ acted: boolean()
13456
+ }), {
13457
+ kind: "mutation",
13458
+ auth: "admin"
13459
+ }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
13460
+ var NUMBER = {
13461
+ kind: "fixed",
13462
+ result: ["number"]
13463
+ };
13464
+ var BOOLEAN = {
13465
+ kind: "fixed",
13466
+ result: ["boolean"]
13467
+ };
13468
+ Object.freeze({
13469
+ min: NUMBER,
13470
+ max: NUMBER,
13471
+ abs: NUMBER,
13472
+ floor: NUMBER,
13473
+ ceil: NUMBER,
13474
+ sqrt: NUMBER,
13475
+ round: NUMBER,
13476
+ pow: NUMBER,
13477
+ clamp: NUMBER,
13478
+ avg: NUMBER,
13479
+ sum: NUMBER,
13480
+ age: NUMBER,
13481
+ convert: NUMBER,
13482
+ coalesce: { kind: "coalesce" },
13483
+ any: BOOLEAN,
13484
+ all: BOOLEAN,
13485
+ within: BOOLEAN,
13486
+ latest: {
13487
+ kind: "fixed",
13488
+ result: ["number", "null"]
13489
+ },
13490
+ number: {
13491
+ kind: "fixed",
13492
+ result: ["number", "null"]
13493
+ },
13494
+ rose: {
13495
+ kind: "fixed",
13496
+ result: ["number", "null"]
13497
+ },
13498
+ count: NUMBER
13499
+ });
13500
+ `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
13501
+ /**
13502
+ * What a composition may BUILD on a device type (G2, D676): the caps a new
13503
+ * device of that type, or an existing one that lacks them, can be given. The
13504
+ * blockers are the validator's own refusal codes, and a spec compares this
13505
+ * listing with `planComposition` for every capability — the editor can never
13506
+ * offer a feature the save would refuse for the same reason.
13507
+ */
13508
+ var ComposableFieldSchema = object({
13509
+ path: string(),
13510
+ kind: CompositionFieldKindSchema,
13511
+ nullable: boolean(),
13512
+ required: boolean(),
13513
+ enumValues: array(string()).optional()
13514
+ });
13515
+ var ComposableCapabilitiesSchema = object({ caps: array(object({
13516
+ cap: string(),
13517
+ fields: array(ComposableFieldSchema),
13518
+ /** Present for an item-array cap (`consumables.items`). */
13519
+ itemArray: object({
13520
+ path: string(),
13521
+ keyField: string()
13522
+ }).optional()
13523
+ })) });
13212
13524
  /** Where a block runs. The operator chooses — a block driving a device on an
13213
13525
  * agent is the reason placement is not fixed to the hub. */
13214
13526
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -13373,7 +13685,7 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
13373
13685
  }), method(object({ blockId: string() }), CompositionGetReadSchema, { auth: "admin" }), method(object({}), CompositionListReadSchema, { auth: "admin" }), method(object({
13374
13686
  addonId: string().min(1),
13375
13687
  stableId: string().min(1)
13376
- }), CompositionCustomizationReadSchema, { auth: "admin" }), method(object({
13688
+ }), CompositionCustomizationReadSchema, { auth: "admin" }), method(object({ deviceType: _enum(DeviceType) }), ComposableCapabilitiesSchema, { auth: "admin" }), method(object({
13377
13689
  composition: CompositionSchema,
13378
13690
  blockId: string().optional()
13379
13691
  }), CompositionValidationSchema, {
@@ -13381,52 +13693,6 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
13381
13693
  auth: "admin",
13382
13694
  access: "view"
13383
13695
  });
13384
- var ComposerBlockSchema = object({
13385
- id: string().min(1),
13386
- name: string().min(1).max(120),
13387
- enabled: boolean(),
13388
- updatedAt: number$1(),
13389
- composition: CompositionSchema
13390
- });
13391
- /**
13392
- * A stored composition row that no longer PARSES — a schema a release
13393
- * tightened, a row written by a newer build. Sent by id so the composer keeps
13394
- * its device as a placeholder and reports the block `failed` naming the parse
13395
- * error. Leaving it out would read, twice, exactly like a delete (D49).
13396
- */
13397
- var ComposerUnreadableBlockSchema = object({
13398
- id: string().min(1),
13399
- /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
13400
- name: string().nullable(),
13401
- /** The parse error, in the operator's words. */
13402
- error: string()
13403
- });
13404
- method(object({
13405
- /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
13406
- integrationId: string().nullable(),
13407
- /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
13408
- storeLoaded: boolean(),
13409
- blocks: array(ComposerBlockSchema),
13410
- /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
13411
- restartBlockIds: array(string()),
13412
- /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
13413
- unreadableBlocks: array(ComposerUnreadableBlockSchema)
13414
- }), object({
13415
- blocks: array(object({
13416
- blockId: string(),
13417
- status: CompositionRunStatusSchema,
13418
- reason: string().optional()
13419
- })),
13420
- /**
13421
- * False when the composer declared and withdrew NOTHING (store not loaded,
13422
- * integration unknown, its own rows unread or read empty once). An empty
13423
- * apply the caller owes is paid off only by one the composer acted on (D49).
13424
- */
13425
- acted: boolean()
13426
- }), {
13427
- kind: "mutation",
13428
- auth: "admin"
13429
- }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
13430
13696
  /**
13431
13697
  * `custom-model-registry` — collection cap exposing operator-registered
13432
13698
  * custom detection models. Each provider (today: `addon-model-studio`)
@@ -13721,7 +13987,7 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
13721
13987
  *
13722
13988
  * ⚠ An earlier version of this comment blamed Zod stripping, and that
13723
13989
  * was wrong — corrected 2026-08-26 after the hop map
13724
- * (`docs/design/2026-08-26-mappa-hop-argomenti.md`) traced the path.
13990
+ * (`docs/design/2026-08-26-topic-hop-map.md`) traced the path.
13725
13991
  * There is **no Zod parse at all** between the door and the engine: the
13726
13992
  * dispatcher forwards the payload verbatim and UDS carries it whole. A
13727
13993
  * field declared here reaches `SqliteSettingsBackend` either way.
@@ -14477,7 +14743,17 @@ var SiteZoneSchema = object({
14477
14743
  var ProviderStatusSchema = object({
14478
14744
  connected: boolean(),
14479
14745
  deviceCount: number$1(),
14480
- error: string().optional()
14746
+ error: string().optional(),
14747
+ /**
14748
+ * `'orchestrator'`: this provider writes NO camera's `motion` runtime slice
14749
+ * — the orchestrator is its only writer (D696). Set by `BaseDeviceProvider`,
14750
+ * which every provider bundles, so only a provider BUILT from D696-amended
14751
+ * code says it. ABSENT means an older provider that may still write it (raw
14752
+ * VMD writes, a boot seed), and the orchestrator's provider gate keeps that
14753
+ * provider's cameras unwritten (`camera-sensors/motion-slice-provider-gate.ts`)
14754
+ * — the provider twin of the runner's `getLocalLoad().motionSliceWriter`.
14755
+ */
14756
+ motionSliceWriter: literal("orchestrator").optional()
14481
14757
  });
14482
14758
  object({
14483
14759
  externalId: string(),
@@ -15275,6 +15551,121 @@ method(object({
15275
15551
  deviceIds: array(number$1()).readonly(),
15276
15552
  caps: array(string()).readonly().optional()
15277
15553
  }), record(string(), record(string(), unknown().nullable())));
15554
+ var ExtensionSlotIdSchema = _enum(["linked-devices"]);
15555
+ DeviceType.Camera;
15556
+ /** A slot's editable value, discriminated on `slot`. */
15557
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
15558
+ DeviceType.Camera;
15559
+ var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
15560
+ state: literal("unreachable"),
15561
+ reason: string()
15562
+ })]);
15563
+ /** One provider of slots — the D554 source-listing row. */
15564
+ var ExtensionSourceSchema = object({
15565
+ /** The routing prefix of every `slotRef` this provider serves. */
15566
+ source: string(),
15567
+ label: string(),
15568
+ /** Stamped by the dispatcher from the registry (D557). */
15569
+ addonId: string().optional(),
15570
+ availability: ExtensionSourceAvailabilitySchema
15571
+ });
15572
+ /**
15573
+ * How one picked source stands. `missing` — no such device (deleted, or an id
15574
+ * that never existed); `foreign` — a device the slot's owner cannot read from
15575
+ * (a source owned by another addon); `unavailable` — it exists but is not a
15576
+ * valid source now (a container, which is never a pick). A source in any of
15577
+ * these states is SHOWN, never silently dropped or re-pointed.
15578
+ */
15579
+ var ExtensionSourceHealthSchema = _enum([
15580
+ "ok",
15581
+ "missing",
15582
+ "foreign",
15583
+ "unavailable"
15584
+ ]);
15585
+ var ExtensionSlotSourceSchema = object({
15586
+ deviceId: number$1().int(),
15587
+ /** The device's name, or null when it could not be resolved (`missing`). */
15588
+ name: string().nullable(),
15589
+ health: ExtensionSourceHealthSchema,
15590
+ detail: string().optional()
15591
+ });
15592
+ /**
15593
+ * A DIFFERENT authority that gates whether the slot's sources do anything —
15594
+ * reported read-only, named, never written through this contract (D62) — e.g.
15595
+ * a slot whose sources act only while a wrapper is bound to the host, a
15596
+ * binding that belongs to `deviceManager.setWrapperActive`. No slot reports
15597
+ * one today (`linked-devices` answers `null`). `unknown` means the gate could
15598
+ * not be read; it is not "inactive" (D315).
15599
+ */
15600
+ var ExtensionSlotActivationSchema = object({
15601
+ state: _enum([
15602
+ "active",
15603
+ "inactive",
15604
+ "unknown"
15605
+ ]),
15606
+ authority: string(),
15607
+ detail: string().optional()
15608
+ });
15609
+ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
15610
+ state: literal("ok"),
15611
+ /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
15612
+ slotRef: string(),
15613
+ slot: ExtensionSlotIdSchema,
15614
+ /** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
15615
+ authority: string(),
15616
+ activation: ExtensionSlotActivationSchema.nullable(),
15617
+ value: ExtensionSlotValueSchema,
15618
+ sources: array(ExtensionSlotSourceSchema),
15619
+ /**
15620
+ * Devices the owner links to the host ON ITS OWN, by structure, and that
15621
+ * are therefore not in `value` (D655): a camera's device-tree children, and
15622
+ * the child a picked container stands for (D356 — a container is never a
15623
+ * pick, its children are). Read-only; the editor shows them and may offer
15624
+ * per-device options on them (the linked-devices tracked-event opt-in).
15625
+ * Absent when the owner links nothing beyond the picks, and from an owner
15626
+ * older than D655.
15627
+ */
15628
+ impliedSources: array(ExtensionSlotSourceSchema).optional()
15629
+ }), object({
15630
+ state: literal("unreachable"),
15631
+ addonId: string(),
15632
+ reason: string()
15633
+ })]);
15634
+ var ExtensionCandidatesSchema = object({ candidates: array(object({
15635
+ deviceId: number$1().int(),
15636
+ name: string(),
15637
+ type: string(),
15638
+ location: string().nullable(),
15639
+ /** The container a child belongs to — "Spotlight 2" alone does not say which. */
15640
+ parentName: string().nullable(),
15641
+ /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
15642
+ suggested: boolean(),
15643
+ /** Why it is suggested ("same location"), null when it is not. */
15644
+ reason: string().nullable()
15645
+ })) });
15646
+ /**
15647
+ * What a write did. `none` — applied in place. `host` / `parent` — the owner
15648
+ * reloaded the host (or, for an accessory child, its parent) because the
15649
+ * write changed what the host REGISTERS. A slot never adds a capability to its
15650
+ * host — that is a composition (D663) — so today's owners answer `none`.
15651
+ */
15652
+ var ExtensionSetResultSchema = object({
15653
+ applied: literal(true),
15654
+ reload: _enum([
15655
+ "none",
15656
+ "host",
15657
+ "parent"
15658
+ ])
15659
+ });
15660
+ var ExtensionSlotRefInputSchema = object({
15661
+ deviceId: number$1().int(),
15662
+ slotRef: string().min(1)
15663
+ });
15664
+ var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
15665
+ method(object({ deviceId: number$1().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number$1().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
15666
+ kind: "mutation",
15667
+ auth: "admin"
15668
+ });
15278
15669
  /**
15279
15670
  * Per-field ownership (D663). A composition may CLAIM fields of a native
15280
15671
  * cap's runtime-state slice on an existing device: `replace` overlays the
@@ -15498,7 +15889,7 @@ method(object({
15498
15889
  * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
15499
15890
  * ends in a log line, and a log line is the thing the operator asked to stop
15500
15891
  * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
15501
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
15892
+ * ricontrolliamo tutti questi punti"* [can we instrument these errors in the meantime? That way next round we recheck all these points]. Reading them meant grepping Loki and
15502
15893
  * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
15503
15894
  * media blackout were both diagnosed. The counters stay; this is where they can
15504
15895
  * be READ.
@@ -18355,17 +18746,25 @@ var NcScheduleSchema = object({
18355
18746
  */
18356
18747
  var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
18357
18748
  /**
18749
+ * How a summary window is SENT (D698): `rule` (absent) = ONE notification with
18750
+ * every section; `section` = one notification per section with something to
18751
+ * say (an unavailable section included), each titled by its section.
18752
+ */
18753
+ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
18754
+ /**
18358
18755
  * `summary`: the rule sends NOTHING per event. When a window of `schedule`
18359
18756
  * CLOSES, it sends one notification with the current state of its kinds
18360
18757
  * (low batteries, consumables to replace, devices offline, updates
18361
- * available, ...), after its own filters. Nothing to report sends nothing.
18758
+ * available, ...), after its own filters — or, with `split: 'section'`
18759
+ * (D698), one notification per section. Nothing to report sends nothing.
18362
18760
  * The schedule is the ordinary `NcSchedule` (weekly windows, IANA timezone,
18363
18761
  * midnight crossing); the send time is each window's END. Refused on the
18364
18762
  * `alarm` family, which stays instant (`systemEventDeliveryProblems`).
18365
18763
  */
18366
18764
  var NcSystemEventDeliverySchema = discriminatedUnion("mode", [object({ mode: literal("instant") }), object({
18367
18765
  mode: literal("summary"),
18368
- schedule: NcScheduleSchema
18766
+ schedule: NcScheduleSchema,
18767
+ split: NcStateSummarySplitSchema.optional()
18369
18768
  })]);
18370
18769
  /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
18371
18770
  var NcPlateMatcherSchema = object({
@@ -18505,8 +18904,14 @@ var NcSensorTransitionSchema = _enum(["raised", "cleared"]);
18505
18904
  /** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
18506
18905
  var NcZoneConditionSchema = object({
18507
18906
  ids: array(string().min(1)).min(1),
18508
- /** Quantifier over `ids` — at least one / every one visited. */
18509
- match: _enum(["any", "all"]).default("any")
18907
+ /**
18908
+ * LEGACY quantifier over `ids`. Absent = `any` (at least one visited), which
18909
+ * is what both editors mean and all they write since D690: "all of" was
18910
+ * removed from the editors because on an immediate rule it asked one
18911
+ * detection to stand in every zone at once. Still ACCEPTED, and `all` still
18912
+ * evaluated, so a stored rule keeps parsing and meaning what it meant.
18913
+ */
18914
+ match: _enum(["any", "all"]).optional()
18510
18915
  });
18511
18916
  /**
18512
18917
  * The P1 condition set — a flat AND of groups; absent group = pass;
@@ -19010,10 +19415,12 @@ var NcMediaPolicySchema = object({
19010
19415
  /**
19011
19416
  * Cooldown GRANULARITY over the subject's class — how much a fired
19012
19417
  * notification suppresses.
19013
- * - `shared` (default, and the absent value) — one window for the whole
19014
- * rule/scope: a cat silences the next dog for `cooldownSec`.
19015
- * - `per-class` — an independent window per detected class, so cat→dog fires
19016
- * at once and cat→cat still waits.
19418
+ * - `per-class` (default, and the absent value since 2026-10-01 — D36) — an
19419
+ * independent window per detected class: cat→dog fires at once, cat→cat
19420
+ * still waits.
19421
+ * - `shared` — one window for the whole rule/scope: a cat silences the next
19422
+ * dog for `cooldownSec`. Only written when an operator picks it; it is no
19423
+ * longer what an unset rule means.
19017
19424
  *
19018
19425
  * AUDIO subjects are ALWAYS per-class regardless of this setting: a scream
19019
19426
  * must not be swallowed by a bark's window (the precedent this generalizes —
@@ -19028,8 +19435,11 @@ var NcThrottleSchema = object({
19028
19435
  /**
19029
19436
  * Class granularity of the cooldown key. Optional rather than defaulted:
19030
19437
  * a Zod default does NOT run on the addon→addon cap path, so a persisted
19031
- * rule authored before this field simply carries none — and the engine
19032
- * reads absent as `shared`, the pre-existing behaviour.
19438
+ * rule authored before this field simply carries none. The engine used to
19439
+ * read absent as `shared` (D36); since 2026-10-01 it reads absent as
19440
+ * `per-class` — the operator's default — and only an explicit `shared`
19441
+ * still means `shared`. See `cooldownKey` / `keysPerClass` in the rule
19442
+ * engine, and D36's dated note.
19033
19443
  */
19034
19444
  granularity: NcThrottleGranularitySchema.optional()
19035
19445
  });
@@ -19353,11 +19763,23 @@ var NcStateSummaryPreviewSectionSchema = object({
19353
19763
  reason: string().optional()
19354
19764
  });
19355
19765
  /**
19766
+ * One notification a previewed summary would send (D698): the whole summary on
19767
+ * a `rule` split (no `section`), one section's on a `section` split.
19768
+ */
19769
+ var NcStateSummaryPreviewRowSchema = object({
19770
+ section: string().optional(),
19771
+ /** The section's name on a per-section row; every reported section's, joined, on a combined one. */
19772
+ title: string(),
19773
+ text: string(),
19774
+ count: number$1().int().nonnegative()
19775
+ });
19776
+ /**
19356
19777
  * The summary a rule would send now. `empty` = nothing to report and every
19357
19778
  * section read: such a summary is NOT sent. `dropped` counts the open states
19358
19779
  * the rule's own filters (or a camera mute) left out, by reason.
19359
19780
  * `excludedGroups` names the kind groups selected that have no state to report
19360
- * (backups & exports).
19781
+ * (backups & exports). `split` and `rows` (D698) say how it would be sent —
19782
+ * optional, so an older hub's answer still parses.
19361
19783
  */
19362
19784
  var NcStateSummaryPreviewSchema = object({
19363
19785
  empty: boolean(),
@@ -19365,7 +19787,9 @@ var NcStateSummaryPreviewSchema = object({
19365
19787
  text: string(),
19366
19788
  sections: array(NcStateSummaryPreviewSectionSchema),
19367
19789
  dropped: record(string(), number$1().int().nonnegative()),
19368
- excludedGroups: array(string())
19790
+ excludedGroups: array(string()),
19791
+ split: NcStateSummarySplitSchema.optional(),
19792
+ rows: array(NcStateSummaryPreviewRowSchema).optional()
19369
19793
  });
19370
19794
  var NcTestResultSchema = object({
19371
19795
  recordId: string(),
@@ -19780,6 +20204,29 @@ object({
19780
20204
  firstAt: number$1(),
19781
20205
  lastAt: number$1()
19782
20206
  });
20207
+ var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
20208
+ var NcAlarmDelaySecSchema = number$1().int().min(0).max(600);
20209
+ var NcAlarmTriggeredSecSchema = number$1().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
20210
+ var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
20211
+ var NcAlarmModeDelaysListSchema = array(object({
20212
+ mode: AlarmArmModeSchema,
20213
+ exitDelaySec: NcAlarmDelaySecSchema.optional(),
20214
+ entryDelaySec: NcAlarmDelaySecSchema.optional(),
20215
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.optional()
20216
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
20217
+ var NcAlarmModeDelaysEditListSchema = array(object({
20218
+ mode: AlarmArmModeSchema,
20219
+ exitDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
20220
+ entryDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
20221
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.nullable().optional()
20222
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
20223
+ /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
20224
+ var NcAlarmNonBlockingEditSchema = object({
20225
+ mode: AlarmArmModeSchema,
20226
+ deviceId: number$1().int().positive(),
20227
+ /** true = on the list (may be open, does not block); false = off the list (blocks). */
20228
+ nonBlocking: boolean()
20229
+ });
19783
20230
  /**
19784
20231
  * The per-mode lists, at most one per mode. Two lists for one mode have no
19785
20232
  * meaning a reader could agree on (union? the last one?), so they are refused
@@ -19788,10 +20235,10 @@ object({
19788
20235
  var NcAlarmNonBlockingListSchema = array(object({
19789
20236
  mode: AlarmArmModeSchema,
19790
20237
  deviceIds: array(number$1().int()).max(200)
19791
- })).max(8).refine((lists) => new Set(lists.map((l) => l.mode)).size === lists.length, { message: "nonBlocking: at most one list per arm mode" });
20238
+ })).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
19792
20239
  /**
19793
- * The three durations the panel's state machine runs on, who hears about its
19794
- * transitions, and which openings each mode tolerates.
20240
+ * The three durations — global, and per mode since D697 — the panel's state
20241
+ * machine runs on, who hears about its transitions, and which openings each mode tolerates.
19795
20242
  *
19796
20243
  * They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
19797
20244
  * `alarm-panel` is `deviceNative` and its other provider mirrors somebody
@@ -19801,15 +20248,15 @@ var NcAlarmNonBlockingListSchema = array(object({
19801
20248
  */
19802
20249
  var NcAlarmSettingsSchema = object({
19803
20250
  /** Grace period between arming and the mode taking effect. 0 = immediate. */
19804
- exitDelaySec: number$1().int().min(0).max(600),
20251
+ exitDelaySec: NcAlarmDelaySecSchema,
19805
20252
  /** Grace period between a trigger and the alarm firing. 0 = immediate. */
19806
- entryDelaySec: number$1().int().min(0).max(600),
20253
+ entryDelaySec: NcAlarmDelaySecSchema,
19807
20254
  /**
19808
20255
  * How long `triggered` lasts before the panel re-arms itself.
19809
20256
  * **0 = until an operator disarms it** — the behaviour before this field
19810
20257
  * existed, and therefore what an untouched install keeps doing.
19811
20258
  */
19812
- triggeredDurationSec: number$1().int().min(0).max(3600),
20259
+ triggeredDurationSec: NcAlarmTriggeredSecSchema,
19813
20260
  /**
19814
20261
  * Deprecated by D630 — every transition is announced. Parsed, never read;
19815
20262
  * remove after one release. Optional so an older admin's patch (which still
@@ -19832,17 +20279,30 @@ var NcAlarmSettingsSchema = object({
19832
20279
  * per mode is meaningful. Defaulted to `[]` so a blob stored before D630
19833
20280
  * parses as "every opening blocks" — the behaviour it was written under.
19834
20281
  */
19835
- nonBlocking: NcAlarmNonBlockingListSchema.default([])
20282
+ nonBlocking: NcAlarmNonBlockingListSchema.default([]),
20283
+ /**
20284
+ * Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
20285
+ * without a field, uses the global value above — so `[]`, the default, is exactly the
20286
+ * behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
20287
+ */
20288
+ modeDelays: NcAlarmModeDelaysListSchema.default([])
19836
20289
  });
19837
20290
  /**
19838
20291
  * Every field optional — a tab edits one control at a time.
19839
20292
  *
19840
- * `nonBlocking` is re-declared WITHOUT its default: `.partial()` does not
19841
- * remove an inner `.default()`, so a patch that never named the field would
19842
- * parse to `nonBlocking: []` and wipe every mode's list on an unrelated edit
19843
- * (the same trap {@link NcRulePatchSchema} documents).
20293
+ * `nonBlocking` and `modeDelays` are re-declared WITHOUT their defaults:
20294
+ * `.partial()` does not remove an inner `.default()`, so a patch that never
20295
+ * named the field would parse to `[]` and wipe every mode's list on an
20296
+ * unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
20297
+ * `modeDelays` means EDITS, not the stored overrides.
19844
20298
  */
19845
- var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({ nonBlocking: NcAlarmNonBlockingListSchema }).partial();
20299
+ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
20300
+ nonBlocking: NcAlarmNonBlockingListSchema,
20301
+ /** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
20302
+ modeDelays: NcAlarmModeDelaysEditListSchema,
20303
+ /** ONE membership change; the panel applies it to the list it holds at its turn. */
20304
+ nonBlockingEdit: NcAlarmNonBlockingEditSchema
20305
+ }).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" });
19846
20306
  /**
19847
20307
  * What one arm mode actually arms, DERIVED from the enabled rules gated on it.
19848
20308
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
@@ -19942,6 +20402,28 @@ var NcAlarmConfigSchema = object({
19942
20402
  */
19943
20403
  live: NcAlarmLiveSchema.optional()
19944
20404
  });
20405
+ var NcAlarmSensorReadingSchema = _enum([
20406
+ "open",
20407
+ "closed",
20408
+ "unknown",
20409
+ "not-opening"
20410
+ ]);
20411
+ /** One device's state as the alarm reads it — the classifier the arm check uses. */
20412
+ var NcAlarmSensorStateSchema = object({
20413
+ deviceId: number$1().int().positive(),
20414
+ reading: NcAlarmSensorReadingSchema,
20415
+ /** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
20416
+ state: string().nullable(),
20417
+ /** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
20418
+ unknownWhy: _enum(["read-failed", "unknown-word"]).nullable(),
20419
+ /** The device manager's liveness as the centre mirrors it; null = not known. */
20420
+ online: boolean().nullable()
20421
+ });
20422
+ var NcAlarmSensorsInputSchema = object({ deviceIds: array(number$1().int().positive()).max(500) });
20423
+ var NcAlarmSensorsSchema = object({
20424
+ sensors: array(NcAlarmSensorStateSchema),
20425
+ readAt: number$1().int().nonnegative()
20426
+ });
19945
20427
  /**
19946
20428
  * ONE rule's demand on ONE camera's clip ring.
19947
20429
  *
@@ -20032,7 +20514,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
20032
20514
  }), method(object({}), NcAlarmConfigSchema, { auth: "admin" }), method(object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
20033
20515
  kind: "mutation",
20034
20516
  auth: "admin"
20035
- });
20517
+ }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
20036
20518
  /**
20037
20519
  * Zod schemas for persisted record types.
20038
20520
  *
@@ -20379,12 +20861,26 @@ var CameraSensorRefSchema = object({
20379
20861
  function cameraSensorRefKey(ref) {
20380
20862
  return `${ref.addonId}/${ref.stableId}`;
20381
20863
  }
20382
- /** CS-1 accepts exactly one mode; CS-2 (D673) widens it to confirm / replace. */
20383
- var CameraSensorsModeSchema = _enum(["in-addition"]);
20384
- object({
20385
- mode: CameraSensorsModeSchema,
20386
- sensors: array(CameraSensorRefSchema).min(1).max(8)
20387
- }).superRefine((value, ctx) => {
20864
+ /**
20865
+ * A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
20866
+ * `replace`: its motion is the camera's, and while one is READY the camera's
20867
+ * own motion no longer counts on its own. `confirm`: while one is READY the
20868
+ * camera's own motion counts only while a confirm sensor is active — with or
20869
+ * without a replace sensor (spec C2, the controller's ruling on Q1).
20870
+ */
20871
+ var CameraSensorModeSchema = _enum([
20872
+ "in-addition",
20873
+ "confirm",
20874
+ "replace"
20875
+ ]);
20876
+ /** A stored sensor with no mode — every CS-1 row — is in addition. */
20877
+ var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
20878
+ /**
20879
+ * A camera's attached sensors. A CS-1 row carried an envelope
20880
+ * `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
20881
+ * what the write stores (D672 rule 3), so it is never written again.
20882
+ */
20883
+ var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
20388
20884
  const seen = /* @__PURE__ */ new Set();
20389
20885
  value.sensors.forEach((ref, index) => {
20390
20886
  const key = cameraSensorRefKey(ref);
@@ -20396,39 +20892,41 @@ object({
20396
20892
  seen.add(key);
20397
20893
  });
20398
20894
  });
20399
- var RefFields = {
20895
+ /** Every attachment names its mode; an older orchestrator that does not is in addition. */
20896
+ var AttachmentFields = {
20400
20897
  addonId: string(),
20401
- stableId: string()
20898
+ stableId: string(),
20899
+ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
20402
20900
  };
20403
20901
  var CameraSensorAttachmentSchema = discriminatedUnion("state", [
20404
20902
  object({
20405
- ...RefFields,
20903
+ ...AttachmentFields,
20406
20904
  state: literal("ready"),
20407
20905
  deviceId: number$1(),
20408
20906
  name: string(),
20409
20907
  caps: array(string()).readonly()
20410
20908
  }),
20411
20909
  object({
20412
- ...RefFields,
20910
+ ...AttachmentFields,
20413
20911
  state: literal("offline"),
20414
20912
  deviceId: number$1(),
20415
20913
  name: string(),
20416
20914
  reason: _enum(["offline", "disabled"])
20417
20915
  }),
20418
20916
  object({
20419
- ...RefFields,
20917
+ ...AttachmentFields,
20420
20918
  state: literal("missing"),
20421
20919
  reason: string()
20422
20920
  }),
20423
20921
  object({
20424
- ...RefFields,
20922
+ ...AttachmentFields,
20425
20923
  state: literal("unsupported"),
20426
20924
  deviceId: number$1(),
20427
20925
  name: string(),
20428
20926
  reason: string()
20429
20927
  }),
20430
20928
  object({
20431
- ...RefFields,
20929
+ ...AttachmentFields,
20432
20930
  state: literal("unreadable"),
20433
20931
  reason: string()
20434
20932
  })
@@ -20441,17 +20939,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
20441
20939
  * say.
20442
20940
  */
20443
20941
  var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
20942
+ /** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
20943
+ var CameraOwnMotionSchema = _enum([
20944
+ "always",
20945
+ "when-confirmed",
20946
+ "never"
20947
+ ]);
20948
+ /** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
20949
+ var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
20950
+ /**
20951
+ * The camera's OWN onboard motion (D696): the raw input the bridge combines,
20952
+ * never the effective value. The camera's `motion` slice is the effective one,
20953
+ * so a view of the camera's own row reads this.
20954
+ * - `atMs`: when the bridge received the camera's last own edge.
20955
+ * - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
20956
+ * AND it is younger than the window the bridge counts the camera's own motion
20957
+ * for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
20958
+ * sends a clear (heartbeats only) therefore reads `false` once no push came
20959
+ * within the window; a status read is a snapshot, so a live view re-asks.
20960
+ * Absent = this orchestrator has not received the camera's own motion since it
20961
+ * started (unknown, never "quiet"), or an orchestrator older than D696.
20962
+ */
20963
+ var CameraRawLevelSchema = object({
20964
+ detected: boolean(),
20965
+ atMs: number$1()
20966
+ });
20444
20967
  var CameraSensorsStatusSchema = discriminatedUnion("state", [
20445
- object({ state: literal("not-configured") }),
20968
+ object({
20969
+ state: literal("not-configured"),
20970
+ cameraLevel: CameraRawLevelSchema.optional()
20971
+ }),
20446
20972
  object({
20447
20973
  state: literal("unreadable"),
20448
- reason: string()
20974
+ reason: string(),
20975
+ cameraLevel: CameraRawLevelSchema.optional()
20449
20976
  }),
20450
20977
  object({
20451
20978
  state: literal("configured"),
20452
- mode: CameraSensorsModeSchema,
20979
+ cameraLevel: CameraRawLevelSchema.optional(),
20453
20980
  sensors: array(CameraSensorAttachmentSchema).readonly(),
20454
- notForwarded: CameraSensorsNotForwardedSchema.optional()
20981
+ /** Absent = an orchestrator older than CS-2: it does not say (D315). */
20982
+ cameraMotion: CameraOwnMotionSchema.optional(),
20983
+ notForwarded: CameraSensorsNotForwardedSchema.optional(),
20984
+ notEnforced: CameraSensorsNotEnforcedSchema.optional()
20455
20985
  })
20456
20986
  ]);
20457
20987
  Object.freeze({
@@ -21136,14 +21666,14 @@ var TrackSchema = object({
21136
21666
  * `derive-returned-null tile=standin`,
21137
21667
  * `native-tile tile=native no-key-frame-at-close`, …) written at close and
21138
21668
  * CLEARED by the late-keyFrame upgrade when a native tile lands after all.
21139
- * The operator-facing answer to "perché manca l'immagine?" on a track whose
21669
+ * The operator-facing answer to "perché manca l'immagine?" [why is the image missing?] on a track whose
21140
21670
  * tile is a face/plate stand-in, a raster crop, or an icon.
21141
21671
  *
21142
21672
  * **`no-key-frame-at-close` (D400).** The line used to be written ONLY when
21143
21673
  * the TILE ranked below native, so a track whose thumbnail landed natively
21144
21674
  * while its key frame missed carried no reason at all — three of the four
21145
21675
  * `MISSING_KEYFRAME` tracks in the 2026-09-07 operator audit were exactly
21146
- * that shape, and their "niente ultimo" had no cause anywhere on the row.
21676
+ * that shape, and their "niente ultimo" [no last frame] had no cause anywhere on the row.
21147
21677
  * The key frame is the head of a cascade (`keyFrame ⇒ keyFrameSmall ⇒ the
21148
21678
  * lastFrame copy source`), so its absence is now on this line whatever the
21149
21679
  * tile ended up being.
@@ -21230,7 +21760,7 @@ var MotionEventSchema = object({
21230
21760
  /**
21231
21761
  * Ms offsets from `timestamp` (the episode's own first rising edge, so the
21232
21762
  * first entry is always `0`) of every genuine off→on transition the
21233
- * episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
21763
+ * episode saw — "ogni evento on si deve salvare" [every ON event must be saved] (D475). NOT one entry per
21234
21764
  * push: a firmware source that keepalives at ~1 Hz for the whole burst
21235
21765
  * (Reolink, Hikvision) produces exactly one edge; a source that reports an
21236
21766
  * explicit `false` mid-episode and then resumes before the quiet window
@@ -21371,6 +21901,21 @@ var ObjectEventSchema = object({
21371
21901
  keyFrameMediaId: number$1().int().optional(),
21372
21902
  /** Populated by B5 (recording playback URL for this event). */
21373
21903
  mediaUrl: string().optional(),
21904
+ /**
21905
+ * When the change this row records HAPPENED, epoch ms, when that is earlier
21906
+ * than {@link timestamp} and the producer could date it (D684).
21907
+ *
21908
+ * Set on a package PICK-UP row only: its `timestamp` is when the departure
21909
+ * was CONCLUDED — five minutes of unseen observed time after the parcel went
21910
+ * — and a notification's footage has to be cut around the pick-up, not the
21911
+ * empty doormat after it (D682). Stored so every path that rebuilds a
21912
+ * notification subject from the row (the boot reconcile, a dry-run) anchors
21913
+ * on the same instant the live hook did.
21914
+ *
21915
+ * `timestamp` keeps its meaning. Absent on every other row and on every
21916
+ * pick-up written before D684 — UNKNOWN, never 0 and never `timestamp`.
21917
+ */
21918
+ observedAt: number$1().optional(),
21374
21919
  /** The parent track's key-event importance [0,1], propagated to every object
21375
21920
  * event of the track (so an event row can be sorted by importance without a
21376
21921
  * track join). Absent on legacy rows / before the track was scored. */
@@ -21706,131 +22251,6 @@ var RecentTracksQueryInput = object({
21706
22251
  /** See {@link ExcludeSourcesDoc}. */
21707
22252
  excludeSources: array(TrackSourceSchema).optional()
21708
22253
  });
21709
- /**
21710
- * A Summary (D359): the per-camera session envelope that references tracks.
21711
- * `groupShotMediaId` is the media ROW id of its group shot (`ownerKind:
21712
- * 'summary'`, served by the event-media plane at `/m/<id>`), null until the
21713
- * first frame with a member visible has been materialised (D482 — it was the
21714
- * row's composite key, which embedded the owner and could name another table's
21715
- * row once event ids became per-table rowids).
21716
- */
21717
- var SummarySchema = object({
21718
- id: string(),
21719
- deviceId: number$1(),
21720
- openedAt: number$1(),
21721
- lastActiveAt: number$1(),
21722
- sealedAt: number$1().nullable(),
21723
- memberCount: number$1().int().nonnegative(),
21724
- groupShotMediaId: number$1().int().nullable()
21725
- });
21726
- var SummariesQueryInput = object({
21727
- deviceIds: array(number$1()).min(1),
21728
- since: number$1().optional(),
21729
- until: number$1().optional(),
21730
- limit: number$1().int().min(1).max(200).default(50),
21731
- /** The same member-wise filter {@link listRecentSummaries} takes — one
21732
- * meaning of "dog" on every summary surface. */
21733
- classes: array(string().min(1).max(60)).max(40).optional()
21734
- });
21735
- var SummaryDetailSchema = object({
21736
- summary: SummarySchema,
21737
- /** Members in absorption order, oldest join first. */
21738
- members: array(object({
21739
- trackId: string(),
21740
- /**
21741
- * The track's class at the time it JOINED, or `null` when it was unresolved
21742
- * and the track no longer exists to fill it.
21743
- *
21744
- * The join, not the latest opinion: class voting can re-decide a track's
21745
- * class afterwards, and a group's composition is the history of who came
21746
- * together. A consumer counts these to badge a thumbnail — "two people and a
21747
- * dog" — rather than being handed a second, denormalised tally that would
21748
- * drift from the members it claims to describe.
21749
- */
21750
- className: string().nullable(),
21751
- /** `primary` is the one member that carries the group's identity. */
21752
- role: _enum([
21753
- "primary",
21754
- "sibling",
21755
- "child"
21756
- ]).nullable(),
21757
- joinedAt: number$1(),
21758
- /** Tier 1 — the sub-class (`dog`, `van`), resolved from the member's track
21759
- * at read time. Absent when nothing resolved, never an empty string. */
21760
- label: string().optional(),
21761
- /** Tier 2 — the instance: a person's name, a plate. Absent when the pipeline
21762
- * recognised nobody, and absent for a member whose track has been pruned —
21763
- * a thumbnail that names the wrong person is worse than one naming nobody. */
21764
- subLabel: string().optional()
21765
- })).readonly()
21766
- });
21767
- /**
21768
- * What a LIST of groups carries: the envelope plus what it is MADE OF.
21769
- *
21770
- * Coarse on purpose — the operator's rule is "only the rough data on the list,
21771
- * we extend when we notice we need more". Enough to draw the card ("two people
21772
- * and a dog") and no more. The MEMBERS, their names and the per-member links
21773
- * are on {@link getSummary}: shipping every member of every group so a client
21774
- * can count them turns a page of two hundred groups into a thousand records to
21775
- * draw two hundred badges.
21776
- */
21777
- var SummaryListItemSchema = object({
21778
- summary: SummarySchema,
21779
- /** Class counts, most numerous first; `className: null` is a member whose
21780
- * class never resolved, counted so the counts add up to `memberCount`. */
21781
- classes: array(object({
21782
- className: string().nullable(),
21783
- count: number$1().int().positive()
21784
- })).readonly()
21785
- });
21786
- var SummariesPageSchema = object({ summaries: array(SummaryListItemSchema).readonly() });
21787
- /**
21788
- * The paged feed, deliberately the SAME shape as {@link RecentTracksQueryInput}.
21789
- *
21790
- * The reel on the cameras page and the Events gallery both ride a cursor, so a
21791
- * summaries feed that could only answer "the last N for these cameras"
21792
- * (`listSummaries`) would make groups available in the timeline and nowhere
21793
- * else. Two feeds with different ordering contracts would be two ideas of what
21794
- * "newest" means, on one screen.
21795
- */
21796
- var RecentSummariesQueryInput = object({
21797
- /** Devices to merge. An empty array yields an empty page. */
21798
- deviceIds: array(number$1()),
21799
- /** Window lower bound on `lastActiveAt` (inclusive). */
21800
- since: number$1().optional(),
21801
- /** Window upper bound on `lastActiveAt` (inclusive). */
21802
- until: number$1().optional(),
21803
- limit: number$1().int().min(1).max(500).default(100),
21804
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
21805
- cursor: string().optional(),
21806
- /**
21807
- * Restrict to these classes — THE SAME FIELD `listRecentTracks` takes, and
21808
- * deliberately the same name: the events filter tree emits one list of ticked
21809
- * taxonomy nodes, and a summaries feed that called it something else would
21810
- * make the operator's one filter component produce two shapes.
21811
- *
21812
- * A question about the MEMBERS: a group matches when ANY of them does. "Show
21813
- * me the arrivals with a dog" has to return the group of four people who had
21814
- * one with them; a filter on the group's own fields could only ever answer
21815
- * about its primary.
21816
- *
21817
- * Matched against all THREE tiers of a member — the class (`animal`), the
21818
- * sub-class (`dog`) and the instance (a name, a plate) — because which tier a
21819
- * ticked node lives on is the taxonomy's business, not the caller's. `dog` is
21820
- * an event kind in the tree and a tier-1 label on an `animal` track; a filter
21821
- * that read only the class would answer "animal" and never "dog".
21822
- *
21823
- * ABSENT or EMPTY means no filter — absent is not a selection of none.
21824
- */
21825
- classes: array(string().min(1).max(60)).max(40).optional()
21826
- });
21827
- var RecentSummariesPageSchema = object({
21828
- /** Ordered by (`lastActiveAt` DESC, id DESC). Same light item as
21829
- * {@link listSummaries} — one list shape, so a card renders the same
21830
- * whichever feed drew it. */
21831
- summaries: array(SummaryListItemSchema).readonly(),
21832
- nextCursor: string().nullable()
21833
- });
21834
22254
  var RecentTracksPageSchema = object({
21835
22255
  /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
21836
22256
  tracks: array(TrackSchema).readonly(),
@@ -22342,7 +22762,7 @@ DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).r
22342
22762
  classes: array(string()).optional(),
22343
22763
  /** See {@link ExcludeSourcesDoc}. */
22344
22764
  excludeSources: array(TrackSourceSchema).optional()
22345
- }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(SummariesQueryInput, SummariesPageSchema), method(RecentSummariesQueryInput, RecentSummariesPageSchema), method(object({ id: string() }), SummaryDetailSchema.nullable()), method(object({ deviceId: number$1() }), _void(), {
22765
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number$1() }), _void(), {
22346
22766
  kind: "mutation",
22347
22767
  auth: "admin"
22348
22768
  }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number$1() }), array(EventKindDescriptorSchema).readonly()), method(object({ deviceIds: array(number$1()).min(1).max(200) }), array(EventKindsForDeviceSchema).readonly()), method(object({
@@ -22396,7 +22816,8 @@ DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).r
22396
22816
  trackIds: array(string()).min(1)
22397
22817
  }), object({
22398
22818
  deleted: number$1().int(),
22399
- failed: array(string()).readonly()
22819
+ failed: array(string()).readonly(),
22820
+ sparedMediaIds: array(number$1().int()).readonly().optional()
22400
22821
  }), {
22401
22822
  kind: "mutation",
22402
22823
  auth: "admin"
@@ -22405,7 +22826,7 @@ DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).r
22405
22826
  deviceId: number$1(),
22406
22827
  trackId: string(),
22407
22828
  flags: TrackFlagsPatchSchema
22408
- }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(BirthDecisionQueryInputSchema, array(BirthDecisionRecordSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
22829
+ }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(SetTrackRelationInputSchema, TrackRelationSchema, { kind: "mutation" }), method(ClearTrackRelationInputSchema, ClearTrackRelationResultSchema, { kind: "mutation" }), method(SetTrackPurityInputSchema, SetTrackPurityResultSchema, { kind: "mutation" }), method(ListTrackRelationsInputSchema, ListTrackRelationsResultSchema, { kind: "query" }), method(BirthDecisionQueryInputSchema, array(BirthDecisionRecordSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
22409
22830
  kind: "query",
22410
22831
  auth: "admin"
22411
22832
  }), method(object({ deviceId: number$1().int().optional() }), EventMediaKindBreakdownSchema, {
@@ -23751,8 +24172,10 @@ var RunnerCameraConfigSchema = object({
23751
24172
  * - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
23752
24173
  * analyzer providers) running on decoded frames in this runner.
23753
24174
  * - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
23754
- * analytics). The provider emits ProviderMotion
23755
- * events; the orchestrator forwards to `reportMotion`.
24175
+ * analytics). The provider emits its raw push as `ProviderMotion`
24176
+ * (D673); the orchestrator's camera-sensors bridge re-emits the camera's
24177
+ * effective motion as `MotionOnMotionChanged`, which is what reaches
24178
+ * `reportMotion`.
23756
24179
  */
23757
24180
  motionSources: MotionSourcesSchema.default(["analyzer"]),
23758
24181
  /**
@@ -23929,7 +24352,15 @@ var RunnerLocalLoadSchema = object({
23929
24352
  hasGpu: boolean(),
23930
24353
  inferenceBackend: string().optional(),
23931
24354
  cpuCores: number$1().optional()
23932
- })
24355
+ }),
24356
+ /**
24357
+ * Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
24358
+ * runner never writes it. ABSENT = a runner older than D696, which still
24359
+ * writes the slice from its phase machine; the orchestrator does not write
24360
+ * while any runner node is absent-or-unanswered, so one slice never has two
24361
+ * writers.
24362
+ */
24363
+ motionSliceWriter: literal("orchestrator").optional()
23933
24364
  });
23934
24365
  /**
23935
24366
  * Aggregate runtime metrics for the runner's whole local pool. Mirrors the
@@ -24563,7 +24994,64 @@ var NodeInferenceDevicesSchema = object({
24563
24994
  reachable: boolean(),
24564
24995
  devices: array(NodeInferenceDeviceSchema).readonly()
24565
24996
  });
24566
- method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
24997
+ /**
24998
+ * Pipeline Orchestrator capability — global load balancer + camera dispatcher.
24999
+ *
25000
+ * Lives on the hub. Tracks the camera-to-agent assignment map, listens to
25001
+ * device lifecycle events, queries each runner's capacity + hardware
25002
+ * profile, and dispatches `attachCamera` / `detachCamera` cap calls to the
25003
+ * appropriate runner instances. Persists assignments via the multi-level
25004
+ * settings store so they survive hub restarts.
25005
+ *
25006
+ * Strictly the control plane: never sees a frame, never calls inference,
25007
+ * never drains queues. The runner does that work locally on each agent.
25008
+ */
25009
+ /**
25010
+ * The input of `setCameraSensors` (G5, D676): the ONE typed write path of a
25011
+ * camera's attached sensors (D672). `config: null` removes the attachment —
25012
+ * the camera reads `not-configured` again, never `unreadable`.
25013
+ */
25014
+ var SetCameraSensorsInputSchema = object({
25015
+ deviceId: number$1().int().nonnegative(),
25016
+ /** `null` removes the attachment: the camera goes back to `not-configured`. */
25017
+ config: CameraSensorsConfigSchema.nullable()
25018
+ });
25019
+ /**
25020
+ * Why an early occupancy look (D691) was not scheduled.
25021
+ *
25022
+ * - `unknown-camera` — no session was ever dispatched for it, so there is no
25023
+ * node and no config to attach a burst with.
25024
+ * - `out-of-range` — the ask is negative or further out than the orchestrator
25025
+ * will hold a timer for; the parked-object cadence is the answer there.
25026
+ * - `no-burst-producer` — this build has no burst producer at all.
25027
+ * - `already-looked` — this camera's ONE early look since its last session has
25028
+ * been spent. A look's own burst can re-arm a flickering flip, and a look
25029
+ * per arm would chain a burst every ~30 s forever (review H2); the next
25030
+ * real session re-arms the budget.
25031
+ */
25032
+ var OccupancyLookRefusalSchema = _enum([
25033
+ "unknown-camera",
25034
+ "out-of-range",
25035
+ "no-burst-producer",
25036
+ "already-looked"
25037
+ ]);
25038
+ method(object({
25039
+ deviceId: number$1().int().nonnegative(),
25040
+ /** How long from NOW until the pending flip's sustain window ends. RELATIVE,
25041
+ * so the caller's clock and the orchestrator's never have to agree. */
25042
+ afterMs: number$1().finite(),
25043
+ /** Why, for the log. */
25044
+ reason: string()
25045
+ }), object({
25046
+ scheduled: boolean(),
25047
+ /** When `scheduled`: how long until the burst is dialled. */
25048
+ dueInMs: number$1().optional(),
25049
+ /** When not `scheduled`: why. */
25050
+ refusedBecause: OccupancyLookRefusalSchema.optional()
25051
+ }), {
25052
+ kind: "mutation",
25053
+ auth: "admin"
25054
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
24567
25055
  kind: "mutation",
24568
25056
  auth: "admin"
24569
25057
  }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
@@ -24717,7 +25205,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
24717
25205
  }), CameraSwitchGroupSchema, {
24718
25206
  kind: "mutation",
24719
25207
  auth: "admin"
24720
- }), method(object({ deviceId: number$1() }), CameraStatusSchema), method(object({ deviceIds: array(number$1()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
25208
+ }), method(object({ deviceId: number$1() }), CameraStatusSchema), method(object({ deviceIds: array(number$1()).optional() }), array(CameraStatusSchema).readonly()), method(SetCameraSensorsInputSchema, object({ success: literal(true) }), {
25209
+ kind: "mutation",
25210
+ auth: "admin"
25211
+ }), method(_void(), DiskReconcileJobSchema, {
24721
25212
  kind: "mutation",
24722
25213
  auth: "admin"
24723
25214
  }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
@@ -26505,7 +26996,7 @@ var ClipPlaybackSchema = object({
26505
26996
  * **One authorised yes is one wake.** `next-natural` — take the clip the next
26506
26997
  * time the camera is awake for its own reasons — is deliberately not a member:
26507
26998
  * it was proposed, it is free on the battery, and the operator declined it on
26508
- * 2026-09-20 (*"Quando un export viene richiesto si sveglia la camera."*,
26999
+ * 2026-09-20 (*"Quando un export viene richiesto si sveglia la camera."* [When an export is requested the camera wakes up],
26509
27000
  * D558 "Considered and not taken").
26510
27001
  */
26511
27002
  var ClipWakeSchema = _enum(["authorised"]);
@@ -26766,7 +27257,7 @@ DeviceType.Camera, method(object({
26766
27257
  * It replaced `sources?: string[]`, a VIEW filter over source ids that
26767
27258
  * assumed the answer was a fan-out over everything a camera has. The
26768
27259
  * operator settled otherwise on 2026-09-20 — *"l'utilizzatore è uno
26769
- * solo"* — so the list is asked of one provider at a time and there is
27260
+ * solo"* [there is only one user] — so the list is asked of one provider at a time and there is
26770
27261
  * nothing to filter out of it.
26771
27262
  */
26772
27263
  provider: string().min(1)
@@ -26893,138 +27384,6 @@ DeviceType.Camera, method(object({
26893
27384
  kind: "query",
26894
27385
  auth: "protected"
26895
27386
  });
26896
- object({
26897
- /** Ms epoch of the last press. null = never observed since this provider started. */
26898
- lastPressedAt: number$1().nullable(),
26899
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
26900
- pressCountSinceStart: number$1()
26901
- });
26902
- object({
26903
- deviceId: number$1(),
26904
- timestamp: number$1()
26905
- });
26906
- /**
26907
- * The `doorbell-source` extension slot's editable value (D648): the camera's
26908
- * virtual-doorbell trigger devices, exactly what the wrapper's
26909
- * `doorbellSources` persists (as `{ deviceId }` records).
26910
- */
26911
- var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number$1().int().positive()) });
26912
- DeviceType.Camera;
26913
- DeviceType.Button, DeviceType.Camera;
26914
- var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
26915
- DeviceType.Camera, DeviceType.Camera;
26916
- /** A slot's editable value, discriminated on `slot`. */
26917
- var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
26918
- DeviceType.Camera;
26919
- var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
26920
- state: literal("unreachable"),
26921
- reason: string()
26922
- })]);
26923
- /** One provider of slots — the D554 source-listing row. */
26924
- var ExtensionSourceSchema = object({
26925
- /** The routing prefix of every `slotRef` this provider serves. */
26926
- source: string(),
26927
- label: string(),
26928
- /** Stamped by the dispatcher from the registry (D557). */
26929
- addonId: string().optional(),
26930
- availability: ExtensionSourceAvailabilitySchema
26931
- });
26932
- /**
26933
- * How one picked source stands. `missing` — no such device (deleted, or an id
26934
- * that never existed); `foreign` — a device the slot's owner cannot read from
26935
- * (a source owned by another addon); `unavailable` — it exists but is not a
26936
- * valid source now (a container, which is never a pick). A source in any of
26937
- * these states is SHOWN, never silently dropped or re-pointed.
26938
- */
26939
- var ExtensionSourceHealthSchema = _enum([
26940
- "ok",
26941
- "missing",
26942
- "foreign",
26943
- "unavailable"
26944
- ]);
26945
- var ExtensionSlotSourceSchema = object({
26946
- deviceId: number$1().int(),
26947
- /** The device's name, or null when it could not be resolved (`missing`). */
26948
- name: string().nullable(),
26949
- health: ExtensionSourceHealthSchema,
26950
- detail: string().optional()
26951
- });
26952
- /**
26953
- * A DIFFERENT authority that gates whether the slot's sources do anything —
26954
- * reported read-only, named, never written through this contract (D62). The
26955
- * virtual doorbell's sources ring only while the wrapper is bound to the
26956
- * camera, and that binding belongs to `deviceManager.setWrapperActive`.
26957
- * `unknown` means the gate could not be read; it is not "inactive" (D315).
26958
- */
26959
- var ExtensionSlotActivationSchema = object({
26960
- state: _enum([
26961
- "active",
26962
- "inactive",
26963
- "unknown"
26964
- ]),
26965
- authority: string(),
26966
- detail: string().optional()
26967
- });
26968
- var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
26969
- state: literal("ok"),
26970
- /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
26971
- slotRef: string(),
26972
- slot: ExtensionSlotIdSchema,
26973
- /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
26974
- authority: string(),
26975
- activation: ExtensionSlotActivationSchema.nullable(),
26976
- value: ExtensionSlotValueSchema,
26977
- sources: array(ExtensionSlotSourceSchema),
26978
- /**
26979
- * Devices the owner links to the host ON ITS OWN, by structure, and that
26980
- * are therefore not in `value` (D655): a camera's device-tree children, and
26981
- * the child a picked container stands for (D356 — a container is never a
26982
- * pick, its children are). Read-only; the editor shows them and may offer
26983
- * per-device options on them (the linked-devices tracked-event opt-in).
26984
- * Absent when the owner links nothing beyond the picks, and from an owner
26985
- * older than D655.
26986
- */
26987
- impliedSources: array(ExtensionSlotSourceSchema).optional()
26988
- }), object({
26989
- state: literal("unreachable"),
26990
- addonId: string(),
26991
- reason: string()
26992
- })]);
26993
- var ExtensionCandidatesSchema = object({ candidates: array(object({
26994
- deviceId: number$1().int(),
26995
- name: string(),
26996
- type: string(),
26997
- location: string().nullable(),
26998
- /** The container a child belongs to — "Spotlight 2" alone does not say which. */
26999
- parentName: string().nullable(),
27000
- /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
27001
- suggested: boolean(),
27002
- /** Why it is suggested ("same location"), null when it is not. */
27003
- reason: string().nullable()
27004
- })) });
27005
- /**
27006
- * What a write did. `none` — applied in place. `host` / `parent` — the owner
27007
- * reloaded the host (or, for an accessory child, its parent) because the
27008
- * write changed what the host REGISTERS. A slot never adds a capability to its
27009
- * host — that is a composition (D663) — so today's owners answer `none`.
27010
- */
27011
- var ExtensionSetResultSchema = object({
27012
- applied: literal(true),
27013
- reload: _enum([
27014
- "none",
27015
- "host",
27016
- "parent"
27017
- ])
27018
- });
27019
- var ExtensionSlotRefInputSchema = object({
27020
- deviceId: number$1().int(),
27021
- slotRef: string().min(1)
27022
- });
27023
- var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
27024
- method(object({ deviceId: number$1().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number$1().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
27025
- kind: "mutation",
27026
- auth: "admin"
27027
- });
27028
27387
  /**
27029
27388
  * Optional client-side hints sent at session creation to help the provider
27030
27389
  * pick the best native source. All fields optional — a viewer that knows
@@ -28842,6 +29201,17 @@ object({
28842
29201
  deviceId: number$1(),
28843
29202
  status: DeviceStatusSchema
28844
29203
  });
29204
+ object({
29205
+ /** Ms epoch of the last press. null = never observed since this provider started. */
29206
+ lastPressedAt: number$1().nullable(),
29207
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
29208
+ pressCountSinceStart: number$1()
29209
+ });
29210
+ object({
29211
+ deviceId: number$1(),
29212
+ timestamp: number$1()
29213
+ });
29214
+ DeviceType.Button, DeviceType.Camera;
28845
29215
  /**
28846
29216
  * Enum-state sensor — a string value picked from a finite option set.
28847
29217
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -30486,9 +30856,9 @@ object({
30486
30856
  /** Ms epoch of the last detected-true observation. Null if never detected. */
30487
30857
  lastDetectedAt: number$1().nullable(),
30488
30858
  /**
30489
- * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
30490
- * `null` while false and on every `Sensor` device (D475) — see that
30491
- * constant's doc for the one-authority rule.
30859
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
30860
+ * orchestrator writes it, D696), `null` while false and on every `Sensor`
30861
+ * device (D475) — see that constant's doc for the one-authority rule.
30492
30862
  *
30493
30863
  * ## Reading this field still arms nothing
30494
30864
  *
@@ -30506,38 +30876,41 @@ object({
30506
30876
  * `addon-export-alexa/src/motion-clear-hold.ts` and
30507
30877
  * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
30508
30878
  *
30509
- * ## Who writes it
30879
+ * ## Who writes it (D696)
30510
30880
  *
30511
- * - **Cameras** — the runner's phase machine, `active → watching` on
30512
- * `cooldown_expired`, which then writes this slice with
30513
- * `detected: false` (`handlePhaseChanged` in
30514
- * `pipeline-runner/index.ts`). It produces the FALLING edge, which
30515
- * matters most for the sources that only ever push a rising one:
30516
- * Reolink emits `MotionOnMotionChanged { detected: true }` and never
30517
- * a false.
30518
- * - **Sensors** (Home Assistant binary sensors, Homematic) — the
30519
- * provider pushes the false itself, from the upstream system's own
30520
- * state change. No phase machine is involved.
30881
+ * - **Cameras** — the orchestrator, and nothing else. It writes the camera's
30882
+ * EFFECTIVE motion (`addon-pipeline-orchestrator`
30883
+ * `camera-sensors/motion-slice.ts`), alongside the effective
30884
+ * `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
30885
+ * for a split camera, an unsplit emitter's direct event, the analyzer and
30886
+ * device activity, as the camera's `motionSources` counts them. A source
30887
+ * that never sends a clear falls one window after its last `true`.
30888
+ * `lastDetectedAt` moves only on an effective rise. No camera provider
30889
+ * writes this slice (not even a boot seed), and neither does the runner's
30890
+ * phase machine: its phase is "a session is attached" for every on-motion
30891
+ * session, not motion, and it now has its own `DetectionPhaseTransition`.
30892
+ * A provider's `isDetected` answers from the hub's slice.
30893
+ * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
30894
+ * imports) — the provider pushes both edges itself, from the upstream
30895
+ * system's own state change. That is the sensor's own fact.
30521
30896
  *
30522
- * ### The phase machine is CANONICAL, not sole — and that is a defect
30897
+ * `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
30898
+ * `motion` slice; each sensor writer is a named exemption.
30523
30899
  *
30524
- * An earlier revision of this docblock (mine, 2026-09-12) claimed the
30525
- * phase machine is the sole writer for a camera. It is not.
30526
- * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
30527
- * `setCapSlice(motionCapability, …)` on their own rising edge, and
30528
- * Hikvision's comment says why: it read THIS docblock, agreed the
30529
- * runner is canonical, and wrote anyway to avoid per-tick churn. So
30530
- * two authorities can disagree about one slice, which this repo
30531
- * forbids, and the doc said otherwise — which is worse than saying
30532
- * nothing, because it reads as verification.
30533
- *
30534
- * This predates D475 and is not fixed there: the fix touches every
30535
- * camera provider. Recorded in D475's Consequences. Do not restore the
30536
- * "sole writer" wording without also removing the other writers.
30900
+ * This replaces the D475 §4 rule ("the phase machine is the sole writer").
30901
+ * That rule was never true: Hikvision and Amcrest wrote the slice raw beside
30902
+ * it, every provider seeded it at boot, and every session left it
30903
+ * `detected: true` after its detach.
30537
30904
  */
30538
30905
  autoClearAfterMs: number$1().nullable()
30539
30906
  });
30540
- object({
30907
+ /**
30908
+ * Payload of `motion.onMotionChanged` event + the corresponding bus
30909
+ * event `EventCategory.MotionOnMotionChanged`. Single source of truth
30910
+ * — both the cap event surface and the bus payload type alias to this
30911
+ * schema.
30912
+ */
30913
+ var MotionOnMotionChangedDataSchema = object({
30541
30914
  deviceId: number$1(),
30542
30915
  detected: boolean(),
30543
30916
  timestamp: number$1(),
@@ -33002,7 +33375,7 @@ var ReadGopBytesResultSchema = object({
33002
33375
  /**
33003
33376
  * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
33004
33377
  * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
33005
- * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
33378
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-clip-replay-on-pipeline.md`):
33006
33379
  * a replay needs several seconds of native pixels, not one frame.
33007
33380
  *
33008
33381
  * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
@@ -35618,47 +35991,6 @@ DeviceType.Camera, method(object({
35618
35991
  detection: array(ZoneRuleSchema).readonly(),
35619
35992
  package: array(ZoneRuleSchema).readonly()
35620
35993
  });
35621
- var NUMBER = {
35622
- kind: "fixed",
35623
- result: ["number"]
35624
- };
35625
- var BOOLEAN = {
35626
- kind: "fixed",
35627
- result: ["boolean"]
35628
- };
35629
- Object.freeze({
35630
- min: NUMBER,
35631
- max: NUMBER,
35632
- abs: NUMBER,
35633
- floor: NUMBER,
35634
- ceil: NUMBER,
35635
- sqrt: NUMBER,
35636
- round: NUMBER,
35637
- pow: NUMBER,
35638
- clamp: NUMBER,
35639
- avg: NUMBER,
35640
- sum: NUMBER,
35641
- age: NUMBER,
35642
- convert: NUMBER,
35643
- coalesce: { kind: "coalesce" },
35644
- any: BOOLEAN,
35645
- all: BOOLEAN,
35646
- within: BOOLEAN,
35647
- latest: {
35648
- kind: "fixed",
35649
- result: ["number", "null"]
35650
- },
35651
- number: {
35652
- kind: "fixed",
35653
- result: ["number", "null"]
35654
- },
35655
- rose: {
35656
- kind: "fixed",
35657
- result: ["number", "null"]
35658
- },
35659
- count: NUMBER
35660
- });
35661
- `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
35662
35994
  /**
35663
35995
  * Accessory device helpers — shared across drivers.
35664
35996
  *
@@ -38081,6 +38413,12 @@ Object.freeze({
38081
38413
  addonId: null,
38082
38414
  access: "view"
38083
38415
  },
38416
+ "coreBlocks.listComposableCaps": {
38417
+ capName: "core-blocks",
38418
+ capScope: "system",
38419
+ addonId: null,
38420
+ access: "view"
38421
+ },
38084
38422
  "coreBlocks.listCompositions": {
38085
38423
  capName: "core-blocks",
38086
38424
  capScope: "system",
@@ -38159,6 +38497,18 @@ Object.freeze({
38159
38497
  addonId: null,
38160
38498
  access: "view"
38161
38499
  },
38500
+ "databaseSnapshot.listDatabases": {
38501
+ capName: "database-snapshot",
38502
+ capScope: "system",
38503
+ addonId: null,
38504
+ access: "view"
38505
+ },
38506
+ "databaseSnapshot.writeSnapshot": {
38507
+ capName: "database-snapshot",
38508
+ capScope: "system",
38509
+ addonId: null,
38510
+ access: "create"
38511
+ },
38162
38512
  "dataStoreProvider.aggregate": {
38163
38513
  capName: "data-store-provider",
38164
38514
  capScope: "system",
@@ -40619,6 +40969,12 @@ Object.freeze({
40619
40969
  addonId: null,
40620
40970
  access: "view"
40621
40971
  },
40972
+ "notificationRules.getAlarmSensors": {
40973
+ capName: "notification-rules",
40974
+ capScope: "system",
40975
+ addonId: null,
40976
+ access: "view"
40977
+ },
40622
40978
  "notificationRules.getClipRetentionAsks": {
40623
40979
  capName: "notification-rules",
40624
40980
  capScope: "system",
@@ -40895,6 +41251,12 @@ Object.freeze({
40895
41251
  addonId: null,
40896
41252
  access: "create"
40897
41253
  },
41254
+ "pipelineAnalytics.clearTrackRelation": {
41255
+ capName: "pipeline-analytics",
41256
+ capScope: "device",
41257
+ addonId: null,
41258
+ access: "delete"
41259
+ },
40898
41260
  "pipelineAnalytics.clearTracks": {
40899
41261
  capName: "pipeline-analytics",
40900
41262
  capScope: "device",
@@ -41051,12 +41413,6 @@ Object.freeze({
41051
41413
  addonId: null,
41052
41414
  access: "view"
41053
41415
  },
41054
- "pipelineAnalytics.getSummary": {
41055
- capName: "pipeline-analytics",
41056
- capScope: "device",
41057
- addonId: null,
41058
- access: "view"
41059
- },
41060
41416
  "pipelineAnalytics.getTrack": {
41061
41417
  capName: "pipeline-analytics",
41062
41418
  capScope: "device",
@@ -41117,12 +41473,6 @@ Object.freeze({
41117
41473
  addonId: null,
41118
41474
  access: "view"
41119
41475
  },
41120
- "pipelineAnalytics.listRecentSummaries": {
41121
- capName: "pipeline-analytics",
41122
- capScope: "device",
41123
- addonId: null,
41124
- access: "view"
41125
- },
41126
41476
  "pipelineAnalytics.listRecentTracks": {
41127
41477
  capName: "pipeline-analytics",
41128
41478
  capScope: "device",
@@ -41153,13 +41503,13 @@ Object.freeze({
41153
41503
  addonId: null,
41154
41504
  access: "view"
41155
41505
  },
41156
- "pipelineAnalytics.listSummaries": {
41506
+ "pipelineAnalytics.listTrackMedia": {
41157
41507
  capName: "pipeline-analytics",
41158
41508
  capScope: "device",
41159
41509
  addonId: null,
41160
41510
  access: "view"
41161
41511
  },
41162
- "pipelineAnalytics.listTrackMedia": {
41512
+ "pipelineAnalytics.listTrackRelations": {
41163
41513
  capName: "pipeline-analytics",
41164
41514
  capScope: "device",
41165
41515
  addonId: null,
@@ -41279,6 +41629,18 @@ Object.freeze({
41279
41629
  addonId: null,
41280
41630
  access: "create"
41281
41631
  },
41632
+ "pipelineAnalytics.setTrackPurity": {
41633
+ capName: "pipeline-analytics",
41634
+ capScope: "device",
41635
+ addonId: null,
41636
+ access: "create"
41637
+ },
41638
+ "pipelineAnalytics.setTrackRelation": {
41639
+ capName: "pipeline-analytics",
41640
+ capScope: "device",
41641
+ addonId: null,
41642
+ access: "create"
41643
+ },
41282
41644
  "pipelineAnalytics.startStorageMigrationMove": {
41283
41645
  capName: "pipeline-analytics",
41284
41646
  capScope: "device",
@@ -41717,6 +42079,12 @@ Object.freeze({
41717
42079
  addonId: null,
41718
42080
  access: "delete"
41719
42081
  },
42082
+ "pipelineOrchestrator.requestOccupancyLook": {
42083
+ capName: "pipeline-orchestrator",
42084
+ capScope: "system",
42085
+ addonId: null,
42086
+ access: "create"
42087
+ },
41720
42088
  "pipelineOrchestrator.resetNodePipelineDefaults": {
41721
42089
  capName: "pipeline-orchestrator",
41722
42090
  capScope: "system",
@@ -41783,6 +42151,12 @@ Object.freeze({
41783
42151
  addonId: null,
41784
42152
  access: "create"
41785
42153
  },
42154
+ "pipelineOrchestrator.setCameraSensors": {
42155
+ capName: "pipeline-orchestrator",
42156
+ capScope: "system",
42157
+ addonId: null,
42158
+ access: "create"
42159
+ },
41786
42160
  "pipelineOrchestrator.setCameraStepOverride": {
41787
42161
  capName: "pipeline-orchestrator",
41788
42162
  capScope: "system",
@@ -45084,6 +45458,11 @@ Object.freeze({
45084
45458
  form: "single",
45085
45459
  optional: false
45086
45460
  }],
45461
+ "notificationRules.getAlarmSensors": [{
45462
+ name: "deviceIds",
45463
+ form: "array",
45464
+ optional: false
45465
+ }],
45087
45466
  "notificationRules.setDeviceMuted": [{
45088
45467
  name: "deviceId",
45089
45468
  form: "single",
@@ -45193,6 +45572,11 @@ Object.freeze({
45193
45572
  form: "single",
45194
45573
  optional: false
45195
45574
  }],
45575
+ "pipelineAnalytics.clearTrackRelation": [{
45576
+ name: "deviceId",
45577
+ form: "single",
45578
+ optional: false
45579
+ }],
45196
45580
  "pipelineAnalytics.clearTracks": [{
45197
45581
  name: "deviceId",
45198
45582
  form: "single",
@@ -45328,11 +45712,6 @@ Object.freeze({
45328
45712
  form: "single",
45329
45713
  optional: true
45330
45714
  }],
45331
- "pipelineAnalytics.listRecentSummaries": [{
45332
- name: "deviceIds",
45333
- form: "array",
45334
- optional: false
45335
- }],
45336
45715
  "pipelineAnalytics.listRecentTracks": [{
45337
45716
  name: "deviceIds",
45338
45717
  form: "array",
@@ -45343,12 +45722,12 @@ Object.freeze({
45343
45722
  form: "array",
45344
45723
  optional: true
45345
45724
  }],
45346
- "pipelineAnalytics.listSummaries": [{
45347
- name: "deviceIds",
45348
- form: "array",
45725
+ "pipelineAnalytics.listTrackMedia": [{
45726
+ name: "deviceId",
45727
+ form: "single",
45349
45728
  optional: false
45350
45729
  }],
45351
- "pipelineAnalytics.listTrackMedia": [{
45730
+ "pipelineAnalytics.listTrackRelations": [{
45352
45731
  name: "deviceId",
45353
45732
  form: "single",
45354
45733
  optional: false
@@ -45423,6 +45802,16 @@ Object.freeze({
45423
45802
  form: "single",
45424
45803
  optional: false
45425
45804
  }],
45805
+ "pipelineAnalytics.setTrackPurity": [{
45806
+ name: "deviceId",
45807
+ form: "single",
45808
+ optional: false
45809
+ }],
45810
+ "pipelineAnalytics.setTrackRelation": [{
45811
+ name: "deviceId",
45812
+ form: "single",
45813
+ optional: false
45814
+ }],
45426
45815
  "pipelineAnalytics.wipeAllAnalytics": [{
45427
45816
  name: "deviceId",
45428
45817
  form: "single",
@@ -45493,6 +45882,11 @@ Object.freeze({
45493
45882
  form: "single",
45494
45883
  optional: false
45495
45884
  }],
45885
+ "pipelineOrchestrator.requestOccupancyLook": [{
45886
+ name: "deviceId",
45887
+ form: "single",
45888
+ optional: false
45889
+ }],
45496
45890
  "pipelineOrchestrator.resolvePipeline": [{
45497
45891
  name: "deviceId",
45498
45892
  form: "single",
@@ -45503,6 +45897,11 @@ Object.freeze({
45503
45897
  form: "single",
45504
45898
  optional: false
45505
45899
  }],
45900
+ "pipelineOrchestrator.setCameraSensors": [{
45901
+ name: "deviceId",
45902
+ form: "single",
45903
+ optional: false
45904
+ }],
45506
45905
  "pipelineOrchestrator.setCameraStepOverride": [{
45507
45906
  name: "deviceId",
45508
45907
  form: "single",
@@ -46649,6 +47048,18 @@ var STATE_SUMMARY_VARS = [
46649
47048
  systemEventKinds: [...SUMMARISABLE],
46650
47049
  systemEventDeliveries: ["summary"]
46651
47050
  },
47051
+ {
47052
+ name: "summarySection",
47053
+ label: "Summary: this section",
47054
+ description: "The section a per-section summary row is about (D698); on a summary sent as one message, every section it reports, comma-separated.",
47055
+ example: "Batterie scariche",
47056
+ group: "system",
47057
+ families: ["rule"],
47058
+ fields: [...RULE_TEXT],
47059
+ kinds: ["system"],
47060
+ systemEventKinds: [...SUMMARISABLE],
47061
+ systemEventDeliveries: ["summary"]
47062
+ },
46652
47063
  ...STATE_SUMMARY_SECTION_VARS.map((v) => ({
46653
47064
  name: v.name,
46654
47065
  label: v.label,
@@ -46725,6 +47136,37 @@ var STATE_SUMMARY_VARS = [
46725
47136
  [...RULE_TEXT],
46726
47137
  ...STATE_SUMMARY_VARS
46727
47138
  ];
47139
+ new Set([
47140
+ "disarmed",
47141
+ "armed_home",
47142
+ "armed_away",
47143
+ "armed_night",
47144
+ "armed_vacation",
47145
+ "armed_custom_bypass",
47146
+ "arming",
47147
+ "disarming",
47148
+ "pending",
47149
+ "triggered",
47150
+ "open",
47151
+ "opening",
47152
+ "closing",
47153
+ "closed",
47154
+ "stopped",
47155
+ "locked",
47156
+ "unlocked",
47157
+ "locking",
47158
+ "unlocking",
47159
+ "jammed",
47160
+ "on",
47161
+ "off",
47162
+ "home",
47163
+ "not_home",
47164
+ "matched",
47165
+ "diverged",
47166
+ "unknown",
47167
+ "latched",
47168
+ "live"
47169
+ ]);
46728
47170
  /**
46729
47171
  * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
46730
47172
  *
@@ -46818,7 +47260,7 @@ var PreviewTextField = string().max(200);
46818
47260
  * Whether the notification's preview is a STILL or a short animation.
46819
47261
  *
46820
47262
  * The operator's ask, verbatim: *"inviato come gif o video (come per le altre
46821
- * rule)"* — the other rules already offer an animated preview, and a ten-hour
47263
+ * rule)"* [sent as a gif or video (as for the other rules)] — the other rules already offer an animated preview, and a ten-hour
46822
47264
  * night reads better as three seconds of motion than as one frame of it. Both
46823
47265
  * modes get the SAME treatment (blurred frame, large centred title); `'gif'`
46824
47266
  * simply applies it to a dozen frames sampled across the render and assembles
@@ -46956,6 +47398,7 @@ TimelapseRuleInputSchema.extend({
46956
47398
  createdAt: number$1(),
46957
47399
  updatedAt: number$1()
46958
47400
  });
47401
+ MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
46959
47402
  object({
46960
47403
  /**
46961
47404
  * Fraction of the box's own size added on EACH side before cutting.
@@ -82724,7 +83167,7 @@ function messagesFor(request) {
82724
83167
  * `RetryError` is the wrapper the library returns when the attempts are spent;
82725
83168
  * the interesting error is the LAST one inside it, so the envelope is unwrapped
82726
83169
  * before anything is classified (§2.3, "chi classifica gli errori deve
82727
- * scartare l'involucro").
83170
+ * scartare l'involucro" [whoever classifies errors must discard the envelope]).
82728
83171
  */
82729
83172
  function mapLibraryError(error) {
82730
83173
  if (RetryError.isInstance(error)) {