@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.js CHANGED
@@ -17,7 +17,7 @@ let node_fs_promises = require("node:fs/promises");
17
17
  node_fs_promises = require_chunk.__toESM(node_fs_promises);
18
18
  let node_child_process = require("node:child_process");
19
19
  let node_readline = require("node:readline");
20
- //#region ../types/dist/event-category-C5xZWqz6.mjs
20
+ //#region ../types/dist/event-category-BGmz_oxW.mjs
21
21
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
22
22
  EventCategory["SystemBoot"] = "system.boot";
23
23
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -550,6 +550,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
550
550
  */
551
551
  EventCategory["PipelineAudioInferenceResult"] = "pipeline.audio-inference-result";
552
552
  EventCategory["DetectionPhaseTransition"] = "detection.phase-transition";
553
+ /**
554
+ * A camera provider's RAW onboard motion push (D673): the `MotionOnMotionChanged`
555
+ * data shape without `triggeredBy`, built by `providerMotionEvent`. Its one
556
+ * consumer is the orchestrator's camera-sensors bridge, which re-emits the
557
+ * camera's EFFECTIVE onboard motion as `MotionOnMotionChanged` (a pass-through
558
+ * for a camera with no attached sensor). Providers must not emit
559
+ * `MotionOnMotionChanged` themselves; `scripts/check-onboard-motion-emitters.ts`
560
+ * keeps it so (camera-grid is a named, deferred exception).
561
+ */
553
562
  EventCategory["ProviderMotion"] = "provider.motion";
554
563
  EventCategory["ProviderDetection"] = "provider.detection";
555
564
  EventCategory["EnrichmentEmbeddingStored"] = "enrichment.embedding.stored";
@@ -5535,7 +5544,7 @@ function number(params) {
5535
5544
  return /* @__PURE__ */ _coercedNumber(ZodNumber, params);
5536
5545
  }
5537
5546
  //#endregion
5538
- //#region ../types/dist/sleep-DlrgY4Qb.mjs
5547
+ //#region ../types/dist/sleep-CDCONfkt.mjs
5539
5548
  /**
5540
5549
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5541
5550
  * window to float samples (D455).
@@ -7623,23 +7632,74 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7623
7632
  return DeviceRole;
7624
7633
  }({});
7625
7634
  //#endregion
7626
- //#region ../types/dist/composition-BK-GTFYb.mjs
7627
- /**
7628
- * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
7629
- * valutatore puro del suo FRONTE.
7630
- *
7631
- * Viveva dentro il builtin virtual-doorbell
7632
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
7633
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
7634
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
7635
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
7636
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
7637
- * SPOSTA qui e il doorbell la ri-esporta.
7638
- *
7639
- * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
7640
- * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
7641
- * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
7642
- * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
7635
+ //#region ../types/dist/composition-D7ULvLdD.mjs
7636
+ /**
7637
+ * The ffmpeg build every CamStack node downloads, per platform and arch.
7638
+ *
7639
+ * ## Why a download, on every node, including the container
7640
+ *
7641
+ * The version of ffmpeg used to be CODE: baked into the image, changeable only
7642
+ * by rebuilding and rolling it. Now it is DATA — this file states the release,
7643
+ * and a node that boots with a different one downloads it. Changing ffmpeg is a
7644
+ * framework bump, not an image rebuild.
7645
+ *
7646
+ * It also settles the licence question by removing it. FFmpeg's licence is
7647
+ * chosen at compile time: the core is LGPL 2.1+, `--enable-gpl` makes it GPL
7648
+ * (for x264/x265), `--enable-version3` makes that v3, and `--enable-nonfree`
7649
+ * makes the result undistributable. These are GPL v3 builds, and we do not
7650
+ * distribute them: the user's own node fetches the archive from the project
7651
+ * that publishes it, so we convey no GPL work and inherit none of the
7652
+ * obligations that come with conveying one. That is the whole reason the image
7653
+ * no longer installs ffmpeg at all — not a technical preference.
7654
+ *
7655
+ * ## Why jellyfin-ffmpeg
7656
+ *
7657
+ * One vendor covering linux-amd64, linux-arm64, darwin-arm64 and darwin-x64
7658
+ * from one release, with the widest hardware surface of anything maintained:
7659
+ * VAAPI, QSV, NVENC/NVDEC, AMF, Vulkan, OpenCL and DRM on amd64, plus Rockchip
7660
+ * MPP on arm64. It reaches the vendor libraries through dlopen trampolines,
7661
+ * so the binary is not linked against a driver stack it may not find.
7662
+ *
7663
+ * **What it still needs from the host, measured 2026-09-19.** On the Unraid
7664
+ * HOST, which has no libva, `-vaapi_device` aborts the process outright —
7665
+ * `implib-gen: libva-drm.so.2: failed to load library ... Assertion '0 &&
7666
+ * "Assertion in generated code"' failed`. Inside our container, which installs
7667
+ * libva plus the iHD driver, the same command encodes: verified end to end with
7668
+ * `testsrc → format=nv12,hwupload → h264_vaapi`. So the image drops ffmpeg and
7669
+ * KEEPS the Intel media stack; the drivers are the part a binary cannot bring.
7670
+ *
7671
+ * ## Why each artifact carries a checksum and a claim
7672
+ *
7673
+ * The download is now the only source, so `sha256` is verified before anything
7674
+ * is extracted — jellyfin publishes no checksums on its release assets, so
7675
+ * these are ours, taken at the version bump. And `expectedHwaccels` is what the
7676
+ * build is supposed to be able to do: a binary that probes short of its own
7677
+ * claim is a source that changed under us, which is precisely what went
7678
+ * unnoticed for months when a static build turned out to carry no VAAPI at all
7679
+ * (D536).
7680
+ */
7681
+ /** The pinned jellyfin-ffmpeg release. Changing this is the version change. */
7682
+ var FFMPEG_RELEASE = "8.1.2-5";
7683
+ var BASE = `https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v${FFMPEG_RELEASE}`;
7684
+ function portable(target) {
7685
+ return `${BASE}/jellyfin-ffmpeg_${FFMPEG_RELEASE}_portable_${target}-gpl.tar.xz`;
7686
+ }
7687
+ portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac64");
7688
+ /**
7689
+ * THE table "which boolean of this device type counts as HIGH", and the
7690
+ * pure evaluator of its EDGE.
7691
+ *
7692
+ * ONE table for everyone who asks "is this device HIGH?": the
7693
+ * recorder's `RecordingTriggers.sensorDeviceIds` trigger, the post-analysis
7694
+ * sensor markers, the orchestrator's camera-sensors bridge and
7695
+ * the sources of a composite doorbell (`doorbellFeatureSources`, D671).
7696
+ * A second copy would diverge at the first cap added, and the symptom — "the
7697
+ * sensor rings the doorbell but does not record" — is exactly D62.
7698
+ *
7699
+ * ⚠ NOT `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), and the
7700
+ * two must not be unified: that one answers "what is the state WORD for a
7701
+ * rule" (and includes `presence`, `cover`, `alarm-panel`), this one "which
7702
+ * boolean's EDGE counts". Deliberately different vocabularies.
7643
7703
  */
7644
7704
  /**
7645
7705
  * Known binary / switch source caps → the boolean slice field whose
@@ -8427,7 +8487,6 @@ var CompositionSchema = object({
8427
8487
  });
8428
8488
  new Set([
8429
8489
  "track",
8430
- "summary",
8431
8490
  "face",
8432
8491
  "identity",
8433
8492
  "plate",
@@ -9096,6 +9155,82 @@ var ArchivedDebugNoteQueryInputSchema = object({
9096
9155
  /** Max rows returned, newest-first. */
9097
9156
  limit: number$1().int().min(1).max(1e3).optional()
9098
9157
  });
9158
+ var TrackRelationKindSchema = _enum(["same-subject", "different-subjects"]);
9159
+ var TrackSideSchema = _enum(["before", "after"]);
9160
+ var TrackPurityValueSchema = _enum(["mixed", "not-a-subject"]);
9161
+ var TrackRelationSchema = object({
9162
+ id: string(),
9163
+ deviceId: number$1().int(),
9164
+ leftTrackId: string(),
9165
+ rightTrackId: string(),
9166
+ leftSide: TrackSideSchema.nullable(),
9167
+ rightSide: TrackSideSchema.nullable(),
9168
+ relation: TrackRelationKindSchema,
9169
+ presence: literal("continuous").nullable(),
9170
+ leftStartedAt: number$1().int().nullable(),
9171
+ rightStartedAt: number$1().int().nullable(),
9172
+ createdAt: number$1().int(),
9173
+ updatedAt: number$1().int(),
9174
+ author: string().nullable()
9175
+ });
9176
+ var TrackPuritySchema = object({
9177
+ id: string(),
9178
+ deviceId: number$1().int(),
9179
+ sourceTrackId: string(),
9180
+ purity: TrackPurityValueSchema,
9181
+ switchAtMs: number$1().int().nullable(),
9182
+ startedAt: number$1().int().nullable(),
9183
+ createdAt: number$1().int(),
9184
+ updatedAt: number$1().int(),
9185
+ author: string().nullable()
9186
+ });
9187
+ var SetTrackRelationInputSchema = object({
9188
+ deviceId: number$1().int(),
9189
+ trackId: string().min(1),
9190
+ otherTrackId: string().min(1),
9191
+ relation: TrackRelationKindSchema,
9192
+ presence: literal("continuous").optional(),
9193
+ trackSide: TrackSideSchema.optional(),
9194
+ otherSide: TrackSideSchema.optional()
9195
+ });
9196
+ var ClearTrackRelationInputSchema = object({
9197
+ deviceId: number$1().int(),
9198
+ trackId: string().min(1),
9199
+ otherTrackId: string().min(1)
9200
+ });
9201
+ var ClearTrackRelationResultSchema = object({ cleared: boolean() });
9202
+ var SetTrackPurityInputSchema = object({
9203
+ deviceId: number$1().int(),
9204
+ trackId: string().min(1),
9205
+ purity: _enum([
9206
+ "pure",
9207
+ "mixed",
9208
+ "not-a-subject"
9209
+ ]),
9210
+ switchAtMs: number$1().int().optional()
9211
+ });
9212
+ /** `null` when `pure` cleared the row. */
9213
+ var SetTrackPurityResultSchema = object({ purity: TrackPuritySchema.nullable() });
9214
+ var ListTrackRelationsInputSchema = object({
9215
+ deviceId: number$1().int(),
9216
+ trackId: string().optional(),
9217
+ since: number$1().int().optional(),
9218
+ until: number$1().int().optional(),
9219
+ limit: number$1().int().min(1).max(5e3).optional()
9220
+ });
9221
+ var ListTrackRelationsResultSchema = object({
9222
+ relations: array(TrackRelationSchema).readonly(),
9223
+ purities: array(TrackPuritySchema).readonly(),
9224
+ truncated: boolean()
9225
+ });
9226
+ _enum([
9227
+ "unknown-track",
9228
+ "cross-device",
9229
+ "self-relation",
9230
+ "contradiction",
9231
+ "switch-outside-track",
9232
+ "switch-needs-mixed"
9233
+ ]);
9099
9234
  /**
9100
9235
  * Ops-log — the durable, append-only operations audit shared by the
9101
9236
  * recordings and events management surfaces.
@@ -9171,22 +9306,22 @@ var CLASS_MAP_MACRO_TARGETS = [
9171
9306
  "package"
9172
9307
  ];
9173
9308
  /**
9174
- * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
9175
- * un operatore può selezionare.
9309
+ * The FIRST-LEVEL macro classes: those an object detector emits and that
9310
+ * an operator can select.
9176
9311
  *
9177
- * Sono le tre offerte dallo step `object-detection`
9312
+ * They are the three offered by the `object-detection` step
9178
9313
  * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
9179
- * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
9180
- * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
9181
- * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
9182
- * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
9314
+ * `enabledMacroClasses`). `package` is in {@link CLASS_MAP_MACRO_TARGETS} and in
9315
+ * `MACRO_LABELS` — it is a true macro — but NOT here: it belongs to the step
9316
+ * `package-detection`, whose enablement is driven by zones, and offering the
9317
+ * same word twice has already made an operator turn on the COCO proxy
9183
9318
  * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
9184
9319
  *
9185
- * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
9186
- * dello step e una seconda volta come union `FirstLevelMacro`
9187
- * (`types/detection.ts`); una terza copia per il trigger di registrazione
9188
- * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
9189
- * successiva.
9320
+ * ONE list. Before today the same three were hand-written in the step's offer
9321
+ * and a second time as the union `FirstLevelMacro`
9322
+ * (`types/detection.ts`); a third copy for the recording trigger
9323
+ * (`RecordingTriggers.objectClasses`) would have made the later divergence
9324
+ * invisible.
9190
9325
  */
9191
9326
  var FIRST_LEVEL_MACRO_CLASSES = [
9192
9327
  "person",
@@ -9251,17 +9386,17 @@ var RecordingStorageModeSchema = _enum([
9251
9386
  "on-device-decision"
9252
9387
  ]);
9253
9388
  /**
9254
- * Le macro classi che possono aprire una finestra di registrazione — le stesse
9255
- * tre offerte dallo step `object-detection`, da UNA lista
9389
+ * The macro classes that can open a recording window — the same
9390
+ * three offered by the `object-detection` step, from ONE list
9256
9391
  * ({@link FIRST_LEVEL_MACRO_CLASSES}).
9257
9392
  */
9258
9393
  var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
9259
9394
  /**
9260
- * True quando `values` non ripete un elemento.
9395
+ * True when `values` does not repeat an element.
9261
9396
  *
9262
- * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
9263
- * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
9264
- * conterebbe due volte le sue finestre in `segmentMissedByMs`.
9397
+ * A duplicate is not harmless: every entry of `objectClasses` / `sensorDeviceIds`
9398
+ * becomes a SOURCE in `bandTriggerSources`, and the same source twice
9399
+ * would count its windows twice in `segmentMissedByMs`.
9265
9400
  */
9266
9401
  var noDuplicates = (values) => new Set(values).size === values.length;
9267
9402
  /** Which detectors trigger an `events`-mode band. */
@@ -9269,34 +9404,34 @@ var RecordingTriggersSchema = object({
9269
9404
  motion: boolean().optional(),
9270
9405
  audioThresholdDbfs: number$1().optional(),
9271
9406
  /**
9272
- * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
9273
- * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
9274
- * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
9275
- * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
9407
+ * The macro classes whose detection opens a window. ABSENT = the source
9408
+ * is not listened to; an EMPTY array is rejected, because "events band, object
9409
+ * trigger on, no class" is the same shape "enabled and records
9410
+ * nothing, forever" that `eventsBandCanEverDemand` is written against.
9276
9411
  *
9277
- * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
9278
- * quelle che hanno attraversato `enabledMacroClasses`, i
9279
- * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
9280
- * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
9281
- * finestre — vedi `recorder/object-trigger.ts`.
9412
+ * The signal read is ALREADY FILTERED: only `source: 'pipeline'` detections, i.e.
9413
+ * those that went through `enabledMacroClasses`, the
9414
+ * `minConfidence<Macro>` and the full-frame guard. The camera's onboard AI
9415
+ * (`source: 'onboard'`) goes through none of those gates and does NOT open
9416
+ * windows — see `recorder/object-trigger.ts`.
9282
9417
  */
9283
9418
  objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
9284
9419
  /**
9285
- * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
9286
- * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
9420
+ * The LINKED devices whose RISING EDGE opens a window. Absent = the source
9421
+ * is not listened to; an empty array is rejected for the same reason as
9287
9422
  * `objectClasses`.
9288
9423
  *
9289
- * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
9290
- * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
9291
- * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
9292
- * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
9293
- * device (D12) — mai un elenco globale di cap.
9424
+ * These are SOURCE device ids, not cameras: the band names them, so the
9425
+ * hot path (`DeviceStateChanged`, at bus rate across the whole fleet)
9426
+ * does no RPC. The OFFER from which the operator picks them is another question, and
9427
+ * is resolved with `deviceManager.getLinkedDevices` + `getBindingsBatch` per
9428
+ * device (D12) — never a global list of caps.
9294
9429
  *
9295
- * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
9296
- * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
9297
- * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
9298
- * il livello: un contatto trovato già aperto al riavvio del runner non fa
9299
- * registrare.
9430
+ * What "high" means depends on the device TYPE and is not decided here:
9431
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) is THE table,
9432
+ * the same one as the composite doorbell (D671). And it is the EDGE, not
9433
+ * the level: a contact found already open at runner restart does not
9434
+ * record.
9300
9435
  */
9301
9436
  sensorDeviceIds: array(number$1().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
9302
9437
  });
@@ -10373,7 +10508,7 @@ var DecoderSessionConfigSchema = object({
10373
10508
  * - **VALUE** — at which level, for which scope, until when. That stays ONE
10374
10509
  * thing: the logging settings document on the `system` cap. Two authorities
10375
10510
  * over the values is the exact defect
10376
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
10511
+ * `docs/design/plans/2026-08-26-per-component-logging.md` was written to
10377
10512
  * remove; re-introducing it from the cure side would be grotesque.
10378
10513
  *
10379
10514
  * Nothing in this file reads a clock, an env var or a store. The registry is
@@ -11649,6 +11784,68 @@ method(object({
11649
11784
  password: string()
11650
11785
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
11651
11786
  /**
11787
+ * How long one snapshot may take end to end: the pinned copy of the whole
11788
+ * database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
11789
+ * disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
11790
+ * generous because a timeout fails the whole backup run.
11791
+ */
11792
+ var DATABASE_SNAPSHOT_TIMEOUT_MS = 30 * 6e4;
11793
+ /**
11794
+ * The databases an owner snapshots — declared by the OWNER, so a caller never
11795
+ * guesses which file is live from what sits beside it (a cleanly closed
11796
+ * database has no sidecars and is just as owned). Paths are absolute on the
11797
+ * owner's host.
11798
+ */
11799
+ var DatabaseSnapshotTargetsSchema = object({ databases: array(object({ livePath: string() })) });
11800
+ /** One b-tree table of the snapshot and the rows it holds. */
11801
+ var DatabaseSnapshotTableSchema = object({
11802
+ name: string(),
11803
+ rows: number$1().int().nonnegative()
11804
+ });
11805
+ /**
11806
+ * What the owner wrote. Every path is ABSOLUTE on the owner's host — the
11807
+ * caller pins the call to its own node, so it can read the file; a caller
11808
+ * that finds the path outside its own data root refuses it rather than
11809
+ * archiving something it cannot place.
11810
+ */
11811
+ var DatabaseSnapshotResultSchema = object({
11812
+ /** The live database the snapshot copies. Never to be copied as a file. */
11813
+ livePath: string(),
11814
+ /** The verified copy: `<livePath>` + {@link DATABASE_SNAPSHOT_SUFFIX}. */
11815
+ snapshotPath: string(),
11816
+ sizeBytes: number$1().int().nonnegative(),
11817
+ pageCount: number$1().int().nonnegative(),
11818
+ pageSize: number$1().int().positive(),
11819
+ /**
11820
+ * Every b-tree table with its row count. Read inside the SAME read
11821
+ * transaction the copy was taken from, and found EQUAL on the copy — so
11822
+ * this is the content of the snapshot, not an estimate of the source.
11823
+ */
11824
+ tables: array(DatabaseSnapshotTableSchema),
11825
+ /** Wall time of the pinned copy (row counts included). */
11826
+ copyMs: number$1().nonnegative(),
11827
+ /** Wall time of the checks on the copy (`integrity_check`, row counts). */
11828
+ verifyMs: number$1().nonnegative(),
11829
+ /** When the pinned read transaction began (ms epoch) — the snapshot's instant. */
11830
+ takenAt: number$1()
11831
+ });
11832
+ /**
11833
+ * A snapshot as an ARCHIVE records it (`ArchiveManifest.sqliteSnapshots`):
11834
+ * the same facts, with both paths relative to the archive root (the node's
11835
+ * data dir), because an archive outlives the host that made it.
11836
+ */
11837
+ var ArchiveSqliteSnapshotSchema = DatabaseSnapshotResultSchema.extend({
11838
+ /** Archive-relative path of the live database the archive does NOT carry. */
11839
+ livePath: string(),
11840
+ /** Archive-relative path of the verified copy it carries in its place. */
11841
+ snapshotPath: string()
11842
+ });
11843
+ method(object({}), DatabaseSnapshotTargetsSchema, { auth: "admin" }), method(object({}), DatabaseSnapshotResultSchema, {
11844
+ kind: "mutation",
11845
+ auth: "admin",
11846
+ timeoutMs: DATABASE_SNAPSHOT_TIMEOUT_MS
11847
+ });
11848
+ /**
11652
11849
  * Orchestrator-side destination metadata. The orchestrator computes
11653
11850
  * `id = <addonId>:<subId>` from its provider lookup so consumers
11654
11851
  * (admin UI, restore flow) see one canonical key.
@@ -11759,7 +11956,12 @@ var ArchiveManifestSchema = object({
11759
11956
  locations: array(string()),
11760
11957
  entries: array(ArchiveEntrySchema),
11761
11958
  totalBytes: number$1(),
11762
- totalFiles: number$1()
11959
+ totalFiles: number$1(),
11960
+ /**
11961
+ * Live SQLite databases this archive carries as their OWNER's verified
11962
+ * snapshot instead of as files (D693). Absent on archives made before.
11963
+ */
11964
+ sqliteSnapshots: array(ArchiveSqliteSnapshotSchema).optional()
11763
11965
  });
11764
11966
  var LocationStatSchema = object({
11765
11967
  name: string(),
@@ -13183,6 +13385,116 @@ var CompositionBlockStateSchema = object({
13183
13385
  reason: string().optional(),
13184
13386
  fields: array(CompositionFieldStateSchema)
13185
13387
  });
13388
+ var ComposerBlockSchema = object({
13389
+ id: string().min(1),
13390
+ name: string().min(1).max(120),
13391
+ enabled: boolean(),
13392
+ updatedAt: number$1(),
13393
+ composition: CompositionSchema
13394
+ });
13395
+ /**
13396
+ * A stored composition row that no longer PARSES — a schema a release
13397
+ * tightened, a row written by a newer build. Sent by id so the composer keeps
13398
+ * its device as a placeholder and reports the block `failed` naming the parse
13399
+ * error. Leaving it out would read, twice, exactly like a delete (D49).
13400
+ */
13401
+ var ComposerUnreadableBlockSchema = object({
13402
+ id: string().min(1),
13403
+ /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
13404
+ name: string().nullable(),
13405
+ /** The parse error, in the operator's words. */
13406
+ error: string()
13407
+ });
13408
+ method(object({
13409
+ /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
13410
+ integrationId: string().nullable(),
13411
+ /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
13412
+ storeLoaded: boolean(),
13413
+ blocks: array(ComposerBlockSchema),
13414
+ /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
13415
+ restartBlockIds: array(string()),
13416
+ /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
13417
+ unreadableBlocks: array(ComposerUnreadableBlockSchema)
13418
+ }), object({
13419
+ blocks: array(object({
13420
+ blockId: string(),
13421
+ status: CompositionRunStatusSchema,
13422
+ reason: string().optional()
13423
+ })),
13424
+ /**
13425
+ * False when the composer declared and withdrew NOTHING (store not loaded,
13426
+ * integration unknown, its own rows unread or read empty once). An empty
13427
+ * apply the caller owes is paid off only by one the composer acted on (D49).
13428
+ */
13429
+ acted: boolean()
13430
+ }), {
13431
+ kind: "mutation",
13432
+ auth: "admin"
13433
+ }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
13434
+ var NUMBER = {
13435
+ kind: "fixed",
13436
+ result: ["number"]
13437
+ };
13438
+ var BOOLEAN = {
13439
+ kind: "fixed",
13440
+ result: ["boolean"]
13441
+ };
13442
+ Object.freeze({
13443
+ min: NUMBER,
13444
+ max: NUMBER,
13445
+ abs: NUMBER,
13446
+ floor: NUMBER,
13447
+ ceil: NUMBER,
13448
+ sqrt: NUMBER,
13449
+ round: NUMBER,
13450
+ pow: NUMBER,
13451
+ clamp: NUMBER,
13452
+ avg: NUMBER,
13453
+ sum: NUMBER,
13454
+ age: NUMBER,
13455
+ convert: NUMBER,
13456
+ coalesce: { kind: "coalesce" },
13457
+ any: BOOLEAN,
13458
+ all: BOOLEAN,
13459
+ within: BOOLEAN,
13460
+ latest: {
13461
+ kind: "fixed",
13462
+ result: ["number", "null"]
13463
+ },
13464
+ number: {
13465
+ kind: "fixed",
13466
+ result: ["number", "null"]
13467
+ },
13468
+ rose: {
13469
+ kind: "fixed",
13470
+ result: ["number", "null"]
13471
+ },
13472
+ count: NUMBER
13473
+ });
13474
+ `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
13475
+ /**
13476
+ * What a composition may BUILD on a device type (G2, D676): the caps a new
13477
+ * device of that type, or an existing one that lacks them, can be given. The
13478
+ * blockers are the validator's own refusal codes, and a spec compares this
13479
+ * listing with `planComposition` for every capability — the editor can never
13480
+ * offer a feature the save would refuse for the same reason.
13481
+ */
13482
+ var ComposableFieldSchema = object({
13483
+ path: string(),
13484
+ kind: CompositionFieldKindSchema,
13485
+ nullable: boolean(),
13486
+ required: boolean(),
13487
+ enumValues: array(string()).optional()
13488
+ });
13489
+ var ComposableCapabilitiesSchema = object({ caps: array(object({
13490
+ cap: string(),
13491
+ fields: array(ComposableFieldSchema),
13492
+ /** Present for an item-array cap (`consumables.items`). */
13493
+ itemArray: object({
13494
+ path: string(),
13495
+ keyField: string()
13496
+ }).optional()
13497
+ })) });
13186
13498
  /** Where a block runs. The operator chooses — a block driving a device on an
13187
13499
  * agent is the reason placement is not fixed to the hub. */
13188
13500
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -13347,7 +13659,7 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
13347
13659
  }), method(object({ blockId: string() }), CompositionGetReadSchema, { auth: "admin" }), method(object({}), CompositionListReadSchema, { auth: "admin" }), method(object({
13348
13660
  addonId: string().min(1),
13349
13661
  stableId: string().min(1)
13350
- }), CompositionCustomizationReadSchema, { auth: "admin" }), method(object({
13662
+ }), CompositionCustomizationReadSchema, { auth: "admin" }), method(object({ deviceType: _enum(DeviceType) }), ComposableCapabilitiesSchema, { auth: "admin" }), method(object({
13351
13663
  composition: CompositionSchema,
13352
13664
  blockId: string().optional()
13353
13665
  }), CompositionValidationSchema, {
@@ -13355,52 +13667,6 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
13355
13667
  auth: "admin",
13356
13668
  access: "view"
13357
13669
  });
13358
- var ComposerBlockSchema = object({
13359
- id: string().min(1),
13360
- name: string().min(1).max(120),
13361
- enabled: boolean(),
13362
- updatedAt: number$1(),
13363
- composition: CompositionSchema
13364
- });
13365
- /**
13366
- * A stored composition row that no longer PARSES — a schema a release
13367
- * tightened, a row written by a newer build. Sent by id so the composer keeps
13368
- * its device as a placeholder and reports the block `failed` naming the parse
13369
- * error. Leaving it out would read, twice, exactly like a delete (D49).
13370
- */
13371
- var ComposerUnreadableBlockSchema = object({
13372
- id: string().min(1),
13373
- /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
13374
- name: string().nullable(),
13375
- /** The parse error, in the operator's words. */
13376
- error: string()
13377
- });
13378
- method(object({
13379
- /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
13380
- integrationId: string().nullable(),
13381
- /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
13382
- storeLoaded: boolean(),
13383
- blocks: array(ComposerBlockSchema),
13384
- /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
13385
- restartBlockIds: array(string()),
13386
- /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
13387
- unreadableBlocks: array(ComposerUnreadableBlockSchema)
13388
- }), object({
13389
- blocks: array(object({
13390
- blockId: string(),
13391
- status: CompositionRunStatusSchema,
13392
- reason: string().optional()
13393
- })),
13394
- /**
13395
- * False when the composer declared and withdrew NOTHING (store not loaded,
13396
- * integration unknown, its own rows unread or read empty once). An empty
13397
- * apply the caller owes is paid off only by one the composer acted on (D49).
13398
- */
13399
- acted: boolean()
13400
- }), {
13401
- kind: "mutation",
13402
- auth: "admin"
13403
- }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
13404
13670
  /**
13405
13671
  * `custom-model-registry` — collection cap exposing operator-registered
13406
13672
  * custom detection models. Each provider (today: `addon-model-studio`)
@@ -13695,7 +13961,7 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
13695
13961
  *
13696
13962
  * ⚠ An earlier version of this comment blamed Zod stripping, and that
13697
13963
  * was wrong — corrected 2026-08-26 after the hop map
13698
- * (`docs/design/2026-08-26-mappa-hop-argomenti.md`) traced the path.
13964
+ * (`docs/design/2026-08-26-topic-hop-map.md`) traced the path.
13699
13965
  * There is **no Zod parse at all** between the door and the engine: the
13700
13966
  * dispatcher forwards the payload verbatim and UDS carries it whole. A
13701
13967
  * field declared here reaches `SqliteSettingsBackend` either way.
@@ -14451,7 +14717,17 @@ var SiteZoneSchema = object({
14451
14717
  var ProviderStatusSchema = object({
14452
14718
  connected: boolean(),
14453
14719
  deviceCount: number$1(),
14454
- error: string().optional()
14720
+ error: string().optional(),
14721
+ /**
14722
+ * `'orchestrator'`: this provider writes NO camera's `motion` runtime slice
14723
+ * — the orchestrator is its only writer (D696). Set by `BaseDeviceProvider`,
14724
+ * which every provider bundles, so only a provider BUILT from D696-amended
14725
+ * code says it. ABSENT means an older provider that may still write it (raw
14726
+ * VMD writes, a boot seed), and the orchestrator's provider gate keeps that
14727
+ * provider's cameras unwritten (`camera-sensors/motion-slice-provider-gate.ts`)
14728
+ * — the provider twin of the runner's `getLocalLoad().motionSliceWriter`.
14729
+ */
14730
+ motionSliceWriter: literal("orchestrator").optional()
14455
14731
  });
14456
14732
  object({
14457
14733
  externalId: string(),
@@ -15249,6 +15525,121 @@ method(object({
15249
15525
  deviceIds: array(number$1()).readonly(),
15250
15526
  caps: array(string()).readonly().optional()
15251
15527
  }), record(string(), record(string(), unknown().nullable())));
15528
+ var ExtensionSlotIdSchema = _enum(["linked-devices"]);
15529
+ DeviceType.Camera;
15530
+ /** A slot's editable value, discriminated on `slot`. */
15531
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
15532
+ DeviceType.Camera;
15533
+ var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
15534
+ state: literal("unreachable"),
15535
+ reason: string()
15536
+ })]);
15537
+ /** One provider of slots — the D554 source-listing row. */
15538
+ var ExtensionSourceSchema = object({
15539
+ /** The routing prefix of every `slotRef` this provider serves. */
15540
+ source: string(),
15541
+ label: string(),
15542
+ /** Stamped by the dispatcher from the registry (D557). */
15543
+ addonId: string().optional(),
15544
+ availability: ExtensionSourceAvailabilitySchema
15545
+ });
15546
+ /**
15547
+ * How one picked source stands. `missing` — no such device (deleted, or an id
15548
+ * that never existed); `foreign` — a device the slot's owner cannot read from
15549
+ * (a source owned by another addon); `unavailable` — it exists but is not a
15550
+ * valid source now (a container, which is never a pick). A source in any of
15551
+ * these states is SHOWN, never silently dropped or re-pointed.
15552
+ */
15553
+ var ExtensionSourceHealthSchema = _enum([
15554
+ "ok",
15555
+ "missing",
15556
+ "foreign",
15557
+ "unavailable"
15558
+ ]);
15559
+ var ExtensionSlotSourceSchema = object({
15560
+ deviceId: number$1().int(),
15561
+ /** The device's name, or null when it could not be resolved (`missing`). */
15562
+ name: string().nullable(),
15563
+ health: ExtensionSourceHealthSchema,
15564
+ detail: string().optional()
15565
+ });
15566
+ /**
15567
+ * A DIFFERENT authority that gates whether the slot's sources do anything —
15568
+ * reported read-only, named, never written through this contract (D62) — e.g.
15569
+ * a slot whose sources act only while a wrapper is bound to the host, a
15570
+ * binding that belongs to `deviceManager.setWrapperActive`. No slot reports
15571
+ * one today (`linked-devices` answers `null`). `unknown` means the gate could
15572
+ * not be read; it is not "inactive" (D315).
15573
+ */
15574
+ var ExtensionSlotActivationSchema = object({
15575
+ state: _enum([
15576
+ "active",
15577
+ "inactive",
15578
+ "unknown"
15579
+ ]),
15580
+ authority: string(),
15581
+ detail: string().optional()
15582
+ });
15583
+ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
15584
+ state: literal("ok"),
15585
+ /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
15586
+ slotRef: string(),
15587
+ slot: ExtensionSlotIdSchema,
15588
+ /** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
15589
+ authority: string(),
15590
+ activation: ExtensionSlotActivationSchema.nullable(),
15591
+ value: ExtensionSlotValueSchema,
15592
+ sources: array(ExtensionSlotSourceSchema),
15593
+ /**
15594
+ * Devices the owner links to the host ON ITS OWN, by structure, and that
15595
+ * are therefore not in `value` (D655): a camera's device-tree children, and
15596
+ * the child a picked container stands for (D356 — a container is never a
15597
+ * pick, its children are). Read-only; the editor shows them and may offer
15598
+ * per-device options on them (the linked-devices tracked-event opt-in).
15599
+ * Absent when the owner links nothing beyond the picks, and from an owner
15600
+ * older than D655.
15601
+ */
15602
+ impliedSources: array(ExtensionSlotSourceSchema).optional()
15603
+ }), object({
15604
+ state: literal("unreachable"),
15605
+ addonId: string(),
15606
+ reason: string()
15607
+ })]);
15608
+ var ExtensionCandidatesSchema = object({ candidates: array(object({
15609
+ deviceId: number$1().int(),
15610
+ name: string(),
15611
+ type: string(),
15612
+ location: string().nullable(),
15613
+ /** The container a child belongs to — "Spotlight 2" alone does not say which. */
15614
+ parentName: string().nullable(),
15615
+ /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
15616
+ suggested: boolean(),
15617
+ /** Why it is suggested ("same location"), null when it is not. */
15618
+ reason: string().nullable()
15619
+ })) });
15620
+ /**
15621
+ * What a write did. `none` — applied in place. `host` / `parent` — the owner
15622
+ * reloaded the host (or, for an accessory child, its parent) because the
15623
+ * write changed what the host REGISTERS. A slot never adds a capability to its
15624
+ * host — that is a composition (D663) — so today's owners answer `none`.
15625
+ */
15626
+ var ExtensionSetResultSchema = object({
15627
+ applied: literal(true),
15628
+ reload: _enum([
15629
+ "none",
15630
+ "host",
15631
+ "parent"
15632
+ ])
15633
+ });
15634
+ var ExtensionSlotRefInputSchema = object({
15635
+ deviceId: number$1().int(),
15636
+ slotRef: string().min(1)
15637
+ });
15638
+ var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
15639
+ method(object({ deviceId: number$1().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number$1().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
15640
+ kind: "mutation",
15641
+ auth: "admin"
15642
+ });
15252
15643
  /**
15253
15644
  * Per-field ownership (D663). A composition may CLAIM fields of a native
15254
15645
  * cap's runtime-state slice on an existing device: `replace` overlays the
@@ -15472,7 +15863,7 @@ method(object({
15472
15863
  * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
15473
15864
  * ends in a log line, and a log line is the thing the operator asked to stop
15474
15865
  * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
15475
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
15866
+ * 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
15476
15867
  * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
15477
15868
  * media blackout were both diagnosed. The counters stay; this is where they can
15478
15869
  * be READ.
@@ -18329,17 +18720,25 @@ var NcScheduleSchema = object({
18329
18720
  */
18330
18721
  var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
18331
18722
  /**
18723
+ * How a summary window is SENT (D698): `rule` (absent) = ONE notification with
18724
+ * every section; `section` = one notification per section with something to
18725
+ * say (an unavailable section included), each titled by its section.
18726
+ */
18727
+ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
18728
+ /**
18332
18729
  * `summary`: the rule sends NOTHING per event. When a window of `schedule`
18333
18730
  * CLOSES, it sends one notification with the current state of its kinds
18334
18731
  * (low batteries, consumables to replace, devices offline, updates
18335
- * available, ...), after its own filters. Nothing to report sends nothing.
18732
+ * available, ...), after its own filters — or, with `split: 'section'`
18733
+ * (D698), one notification per section. Nothing to report sends nothing.
18336
18734
  * The schedule is the ordinary `NcSchedule` (weekly windows, IANA timezone,
18337
18735
  * midnight crossing); the send time is each window's END. Refused on the
18338
18736
  * `alarm` family, which stays instant (`systemEventDeliveryProblems`).
18339
18737
  */
18340
18738
  var NcSystemEventDeliverySchema = discriminatedUnion("mode", [object({ mode: literal("instant") }), object({
18341
18739
  mode: literal("summary"),
18342
- schedule: NcScheduleSchema
18740
+ schedule: NcScheduleSchema,
18741
+ split: NcStateSummarySplitSchema.optional()
18343
18742
  })]);
18344
18743
  /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
18345
18744
  var NcPlateMatcherSchema = object({
@@ -18479,8 +18878,14 @@ var NcSensorTransitionSchema = _enum(["raised", "cleared"]);
18479
18878
  /** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
18480
18879
  var NcZoneConditionSchema = object({
18481
18880
  ids: array(string().min(1)).min(1),
18482
- /** Quantifier over `ids` — at least one / every one visited. */
18483
- match: _enum(["any", "all"]).default("any")
18881
+ /**
18882
+ * LEGACY quantifier over `ids`. Absent = `any` (at least one visited), which
18883
+ * is what both editors mean and all they write since D690: "all of" was
18884
+ * removed from the editors because on an immediate rule it asked one
18885
+ * detection to stand in every zone at once. Still ACCEPTED, and `all` still
18886
+ * evaluated, so a stored rule keeps parsing and meaning what it meant.
18887
+ */
18888
+ match: _enum(["any", "all"]).optional()
18484
18889
  });
18485
18890
  /**
18486
18891
  * The P1 condition set — a flat AND of groups; absent group = pass;
@@ -18984,10 +19389,12 @@ var NcMediaPolicySchema = object({
18984
19389
  /**
18985
19390
  * Cooldown GRANULARITY over the subject's class — how much a fired
18986
19391
  * notification suppresses.
18987
- * - `shared` (default, and the absent value) — one window for the whole
18988
- * rule/scope: a cat silences the next dog for `cooldownSec`.
18989
- * - `per-class` — an independent window per detected class, so cat→dog fires
18990
- * at once and cat→cat still waits.
19392
+ * - `per-class` (default, and the absent value since 2026-10-01 — D36) — an
19393
+ * independent window per detected class: cat→dog fires at once, cat→cat
19394
+ * still waits.
19395
+ * - `shared` — one window for the whole rule/scope: a cat silences the next
19396
+ * dog for `cooldownSec`. Only written when an operator picks it; it is no
19397
+ * longer what an unset rule means.
18991
19398
  *
18992
19399
  * AUDIO subjects are ALWAYS per-class regardless of this setting: a scream
18993
19400
  * must not be swallowed by a bark's window (the precedent this generalizes —
@@ -19002,8 +19409,11 @@ var NcThrottleSchema = object({
19002
19409
  /**
19003
19410
  * Class granularity of the cooldown key. Optional rather than defaulted:
19004
19411
  * a Zod default does NOT run on the addon→addon cap path, so a persisted
19005
- * rule authored before this field simply carries none — and the engine
19006
- * reads absent as `shared`, the pre-existing behaviour.
19412
+ * rule authored before this field simply carries none. The engine used to
19413
+ * read absent as `shared` (D36); since 2026-10-01 it reads absent as
19414
+ * `per-class` — the operator's default — and only an explicit `shared`
19415
+ * still means `shared`. See `cooldownKey` / `keysPerClass` in the rule
19416
+ * engine, and D36's dated note.
19007
19417
  */
19008
19418
  granularity: NcThrottleGranularitySchema.optional()
19009
19419
  });
@@ -19327,11 +19737,23 @@ var NcStateSummaryPreviewSectionSchema = object({
19327
19737
  reason: string().optional()
19328
19738
  });
19329
19739
  /**
19740
+ * One notification a previewed summary would send (D698): the whole summary on
19741
+ * a `rule` split (no `section`), one section's on a `section` split.
19742
+ */
19743
+ var NcStateSummaryPreviewRowSchema = object({
19744
+ section: string().optional(),
19745
+ /** The section's name on a per-section row; every reported section's, joined, on a combined one. */
19746
+ title: string(),
19747
+ text: string(),
19748
+ count: number$1().int().nonnegative()
19749
+ });
19750
+ /**
19330
19751
  * The summary a rule would send now. `empty` = nothing to report and every
19331
19752
  * section read: such a summary is NOT sent. `dropped` counts the open states
19332
19753
  * the rule's own filters (or a camera mute) left out, by reason.
19333
19754
  * `excludedGroups` names the kind groups selected that have no state to report
19334
- * (backups & exports).
19755
+ * (backups & exports). `split` and `rows` (D698) say how it would be sent —
19756
+ * optional, so an older hub's answer still parses.
19335
19757
  */
19336
19758
  var NcStateSummaryPreviewSchema = object({
19337
19759
  empty: boolean(),
@@ -19339,7 +19761,9 @@ var NcStateSummaryPreviewSchema = object({
19339
19761
  text: string(),
19340
19762
  sections: array(NcStateSummaryPreviewSectionSchema),
19341
19763
  dropped: record(string(), number$1().int().nonnegative()),
19342
- excludedGroups: array(string())
19764
+ excludedGroups: array(string()),
19765
+ split: NcStateSummarySplitSchema.optional(),
19766
+ rows: array(NcStateSummaryPreviewRowSchema).optional()
19343
19767
  });
19344
19768
  var NcTestResultSchema = object({
19345
19769
  recordId: string(),
@@ -19754,6 +20178,29 @@ object({
19754
20178
  firstAt: number$1(),
19755
20179
  lastAt: number$1()
19756
20180
  });
20181
+ var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
20182
+ var NcAlarmDelaySecSchema = number$1().int().min(0).max(600);
20183
+ var NcAlarmTriggeredSecSchema = number$1().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
20184
+ var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
20185
+ var NcAlarmModeDelaysListSchema = array(object({
20186
+ mode: AlarmArmModeSchema,
20187
+ exitDelaySec: NcAlarmDelaySecSchema.optional(),
20188
+ entryDelaySec: NcAlarmDelaySecSchema.optional(),
20189
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.optional()
20190
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
20191
+ var NcAlarmModeDelaysEditListSchema = array(object({
20192
+ mode: AlarmArmModeSchema,
20193
+ exitDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
20194
+ entryDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
20195
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.nullable().optional()
20196
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
20197
+ /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
20198
+ var NcAlarmNonBlockingEditSchema = object({
20199
+ mode: AlarmArmModeSchema,
20200
+ deviceId: number$1().int().positive(),
20201
+ /** true = on the list (may be open, does not block); false = off the list (blocks). */
20202
+ nonBlocking: boolean()
20203
+ });
19757
20204
  /**
19758
20205
  * The per-mode lists, at most one per mode. Two lists for one mode have no
19759
20206
  * meaning a reader could agree on (union? the last one?), so they are refused
@@ -19762,10 +20209,10 @@ object({
19762
20209
  var NcAlarmNonBlockingListSchema = array(object({
19763
20210
  mode: AlarmArmModeSchema,
19764
20211
  deviceIds: array(number$1().int()).max(200)
19765
- })).max(8).refine((lists) => new Set(lists.map((l) => l.mode)).size === lists.length, { message: "nonBlocking: at most one list per arm mode" });
20212
+ })).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
19766
20213
  /**
19767
- * The three durations the panel's state machine runs on, who hears about its
19768
- * transitions, and which openings each mode tolerates.
20214
+ * The three durations — global, and per mode since D697 — the panel's state
20215
+ * machine runs on, who hears about its transitions, and which openings each mode tolerates.
19769
20216
  *
19770
20217
  * They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
19771
20218
  * `alarm-panel` is `deviceNative` and its other provider mirrors somebody
@@ -19775,15 +20222,15 @@ var NcAlarmNonBlockingListSchema = array(object({
19775
20222
  */
19776
20223
  var NcAlarmSettingsSchema = object({
19777
20224
  /** Grace period between arming and the mode taking effect. 0 = immediate. */
19778
- exitDelaySec: number$1().int().min(0).max(600),
20225
+ exitDelaySec: NcAlarmDelaySecSchema,
19779
20226
  /** Grace period between a trigger and the alarm firing. 0 = immediate. */
19780
- entryDelaySec: number$1().int().min(0).max(600),
20227
+ entryDelaySec: NcAlarmDelaySecSchema,
19781
20228
  /**
19782
20229
  * How long `triggered` lasts before the panel re-arms itself.
19783
20230
  * **0 = until an operator disarms it** — the behaviour before this field
19784
20231
  * existed, and therefore what an untouched install keeps doing.
19785
20232
  */
19786
- triggeredDurationSec: number$1().int().min(0).max(3600),
20233
+ triggeredDurationSec: NcAlarmTriggeredSecSchema,
19787
20234
  /**
19788
20235
  * Deprecated by D630 — every transition is announced. Parsed, never read;
19789
20236
  * remove after one release. Optional so an older admin's patch (which still
@@ -19806,17 +20253,30 @@ var NcAlarmSettingsSchema = object({
19806
20253
  * per mode is meaningful. Defaulted to `[]` so a blob stored before D630
19807
20254
  * parses as "every opening blocks" — the behaviour it was written under.
19808
20255
  */
19809
- nonBlocking: NcAlarmNonBlockingListSchema.default([])
20256
+ nonBlocking: NcAlarmNonBlockingListSchema.default([]),
20257
+ /**
20258
+ * Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
20259
+ * without a field, uses the global value above — so `[]`, the default, is exactly the
20260
+ * behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
20261
+ */
20262
+ modeDelays: NcAlarmModeDelaysListSchema.default([])
19810
20263
  });
19811
20264
  /**
19812
20265
  * Every field optional — a tab edits one control at a time.
19813
20266
  *
19814
- * `nonBlocking` is re-declared WITHOUT its default: `.partial()` does not
19815
- * remove an inner `.default()`, so a patch that never named the field would
19816
- * parse to `nonBlocking: []` and wipe every mode's list on an unrelated edit
19817
- * (the same trap {@link NcRulePatchSchema} documents).
20267
+ * `nonBlocking` and `modeDelays` are re-declared WITHOUT their defaults:
20268
+ * `.partial()` does not remove an inner `.default()`, so a patch that never
20269
+ * named the field would parse to `[]` and wipe every mode's list on an
20270
+ * unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
20271
+ * `modeDelays` means EDITS, not the stored overrides.
19818
20272
  */
19819
- var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({ nonBlocking: NcAlarmNonBlockingListSchema }).partial();
20273
+ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
20274
+ nonBlocking: NcAlarmNonBlockingListSchema,
20275
+ /** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
20276
+ modeDelays: NcAlarmModeDelaysEditListSchema,
20277
+ /** ONE membership change; the panel applies it to the list it holds at its turn. */
20278
+ nonBlockingEdit: NcAlarmNonBlockingEditSchema
20279
+ }).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" });
19820
20280
  /**
19821
20281
  * What one arm mode actually arms, DERIVED from the enabled rules gated on it.
19822
20282
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
@@ -19916,6 +20376,28 @@ var NcAlarmConfigSchema = object({
19916
20376
  */
19917
20377
  live: NcAlarmLiveSchema.optional()
19918
20378
  });
20379
+ var NcAlarmSensorReadingSchema = _enum([
20380
+ "open",
20381
+ "closed",
20382
+ "unknown",
20383
+ "not-opening"
20384
+ ]);
20385
+ /** One device's state as the alarm reads it — the classifier the arm check uses. */
20386
+ var NcAlarmSensorStateSchema = object({
20387
+ deviceId: number$1().int().positive(),
20388
+ reading: NcAlarmSensorReadingSchema,
20389
+ /** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
20390
+ state: string().nullable(),
20391
+ /** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
20392
+ unknownWhy: _enum(["read-failed", "unknown-word"]).nullable(),
20393
+ /** The device manager's liveness as the centre mirrors it; null = not known. */
20394
+ online: boolean().nullable()
20395
+ });
20396
+ var NcAlarmSensorsInputSchema = object({ deviceIds: array(number$1().int().positive()).max(500) });
20397
+ var NcAlarmSensorsSchema = object({
20398
+ sensors: array(NcAlarmSensorStateSchema),
20399
+ readAt: number$1().int().nonnegative()
20400
+ });
19919
20401
  /**
19920
20402
  * ONE rule's demand on ONE camera's clip ring.
19921
20403
  *
@@ -20006,7 +20488,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
20006
20488
  }), method(object({}), NcAlarmConfigSchema, { auth: "admin" }), method(object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
20007
20489
  kind: "mutation",
20008
20490
  auth: "admin"
20009
- });
20491
+ }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
20010
20492
  /**
20011
20493
  * Zod schemas for persisted record types.
20012
20494
  *
@@ -20353,12 +20835,26 @@ var CameraSensorRefSchema = object({
20353
20835
  function cameraSensorRefKey(ref) {
20354
20836
  return `${ref.addonId}/${ref.stableId}`;
20355
20837
  }
20356
- /** CS-1 accepts exactly one mode; CS-2 (D673) widens it to confirm / replace. */
20357
- var CameraSensorsModeSchema = _enum(["in-addition"]);
20358
- object({
20359
- mode: CameraSensorsModeSchema,
20360
- sensors: array(CameraSensorRefSchema).min(1).max(8)
20361
- }).superRefine((value, ctx) => {
20838
+ /**
20839
+ * A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
20840
+ * `replace`: its motion is the camera's, and while one is READY the camera's
20841
+ * own motion no longer counts on its own. `confirm`: while one is READY the
20842
+ * camera's own motion counts only while a confirm sensor is active — with or
20843
+ * without a replace sensor (spec C2, the controller's ruling on Q1).
20844
+ */
20845
+ var CameraSensorModeSchema = _enum([
20846
+ "in-addition",
20847
+ "confirm",
20848
+ "replace"
20849
+ ]);
20850
+ /** A stored sensor with no mode — every CS-1 row — is in addition. */
20851
+ var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
20852
+ /**
20853
+ * A camera's attached sensors. A CS-1 row carried an envelope
20854
+ * `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
20855
+ * what the write stores (D672 rule 3), so it is never written again.
20856
+ */
20857
+ var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
20362
20858
  const seen = /* @__PURE__ */ new Set();
20363
20859
  value.sensors.forEach((ref, index) => {
20364
20860
  const key = cameraSensorRefKey(ref);
@@ -20370,39 +20866,41 @@ object({
20370
20866
  seen.add(key);
20371
20867
  });
20372
20868
  });
20373
- var RefFields = {
20869
+ /** Every attachment names its mode; an older orchestrator that does not is in addition. */
20870
+ var AttachmentFields = {
20374
20871
  addonId: string(),
20375
- stableId: string()
20872
+ stableId: string(),
20873
+ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
20376
20874
  };
20377
20875
  var CameraSensorAttachmentSchema = discriminatedUnion("state", [
20378
20876
  object({
20379
- ...RefFields,
20877
+ ...AttachmentFields,
20380
20878
  state: literal("ready"),
20381
20879
  deviceId: number$1(),
20382
20880
  name: string(),
20383
20881
  caps: array(string()).readonly()
20384
20882
  }),
20385
20883
  object({
20386
- ...RefFields,
20884
+ ...AttachmentFields,
20387
20885
  state: literal("offline"),
20388
20886
  deviceId: number$1(),
20389
20887
  name: string(),
20390
20888
  reason: _enum(["offline", "disabled"])
20391
20889
  }),
20392
20890
  object({
20393
- ...RefFields,
20891
+ ...AttachmentFields,
20394
20892
  state: literal("missing"),
20395
20893
  reason: string()
20396
20894
  }),
20397
20895
  object({
20398
- ...RefFields,
20896
+ ...AttachmentFields,
20399
20897
  state: literal("unsupported"),
20400
20898
  deviceId: number$1(),
20401
20899
  name: string(),
20402
20900
  reason: string()
20403
20901
  }),
20404
20902
  object({
20405
- ...RefFields,
20903
+ ...AttachmentFields,
20406
20904
  state: literal("unreadable"),
20407
20905
  reason: string()
20408
20906
  })
@@ -20415,17 +20913,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
20415
20913
  * say.
20416
20914
  */
20417
20915
  var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
20916
+ /** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
20917
+ var CameraOwnMotionSchema = _enum([
20918
+ "always",
20919
+ "when-confirmed",
20920
+ "never"
20921
+ ]);
20922
+ /** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
20923
+ var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
20924
+ /**
20925
+ * The camera's OWN onboard motion (D696): the raw input the bridge combines,
20926
+ * never the effective value. The camera's `motion` slice is the effective one,
20927
+ * so a view of the camera's own row reads this.
20928
+ * - `atMs`: when the bridge received the camera's last own edge.
20929
+ * - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
20930
+ * AND it is younger than the window the bridge counts the camera's own motion
20931
+ * for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
20932
+ * sends a clear (heartbeats only) therefore reads `false` once no push came
20933
+ * within the window; a status read is a snapshot, so a live view re-asks.
20934
+ * Absent = this orchestrator has not received the camera's own motion since it
20935
+ * started (unknown, never "quiet"), or an orchestrator older than D696.
20936
+ */
20937
+ var CameraRawLevelSchema = object({
20938
+ detected: boolean(),
20939
+ atMs: number$1()
20940
+ });
20418
20941
  var CameraSensorsStatusSchema = discriminatedUnion("state", [
20419
- object({ state: literal("not-configured") }),
20942
+ object({
20943
+ state: literal("not-configured"),
20944
+ cameraLevel: CameraRawLevelSchema.optional()
20945
+ }),
20420
20946
  object({
20421
20947
  state: literal("unreadable"),
20422
- reason: string()
20948
+ reason: string(),
20949
+ cameraLevel: CameraRawLevelSchema.optional()
20423
20950
  }),
20424
20951
  object({
20425
20952
  state: literal("configured"),
20426
- mode: CameraSensorsModeSchema,
20953
+ cameraLevel: CameraRawLevelSchema.optional(),
20427
20954
  sensors: array(CameraSensorAttachmentSchema).readonly(),
20428
- notForwarded: CameraSensorsNotForwardedSchema.optional()
20955
+ /** Absent = an orchestrator older than CS-2: it does not say (D315). */
20956
+ cameraMotion: CameraOwnMotionSchema.optional(),
20957
+ notForwarded: CameraSensorsNotForwardedSchema.optional(),
20958
+ notEnforced: CameraSensorsNotEnforcedSchema.optional()
20429
20959
  })
20430
20960
  ]);
20431
20961
  Object.freeze({
@@ -21110,14 +21640,14 @@ var TrackSchema = object({
21110
21640
  * `derive-returned-null tile=standin`,
21111
21641
  * `native-tile tile=native no-key-frame-at-close`, …) written at close and
21112
21642
  * CLEARED by the late-keyFrame upgrade when a native tile lands after all.
21113
- * The operator-facing answer to "perché manca l'immagine?" on a track whose
21643
+ * The operator-facing answer to "perché manca l'immagine?" [why is the image missing?] on a track whose
21114
21644
  * tile is a face/plate stand-in, a raster crop, or an icon.
21115
21645
  *
21116
21646
  * **`no-key-frame-at-close` (D400).** The line used to be written ONLY when
21117
21647
  * the TILE ranked below native, so a track whose thumbnail landed natively
21118
21648
  * while its key frame missed carried no reason at all — three of the four
21119
21649
  * `MISSING_KEYFRAME` tracks in the 2026-09-07 operator audit were exactly
21120
- * that shape, and their "niente ultimo" had no cause anywhere on the row.
21650
+ * that shape, and their "niente ultimo" [no last frame] had no cause anywhere on the row.
21121
21651
  * The key frame is the head of a cascade (`keyFrame ⇒ keyFrameSmall ⇒ the
21122
21652
  * lastFrame copy source`), so its absence is now on this line whatever the
21123
21653
  * tile ended up being.
@@ -21204,7 +21734,7 @@ var MotionEventSchema = object({
21204
21734
  /**
21205
21735
  * Ms offsets from `timestamp` (the episode's own first rising edge, so the
21206
21736
  * first entry is always `0`) of every genuine off→on transition the
21207
- * episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
21737
+ * episode saw — "ogni evento on si deve salvare" [every ON event must be saved] (D475). NOT one entry per
21208
21738
  * push: a firmware source that keepalives at ~1 Hz for the whole burst
21209
21739
  * (Reolink, Hikvision) produces exactly one edge; a source that reports an
21210
21740
  * explicit `false` mid-episode and then resumes before the quiet window
@@ -21345,6 +21875,21 @@ var ObjectEventSchema = object({
21345
21875
  keyFrameMediaId: number$1().int().optional(),
21346
21876
  /** Populated by B5 (recording playback URL for this event). */
21347
21877
  mediaUrl: string().optional(),
21878
+ /**
21879
+ * When the change this row records HAPPENED, epoch ms, when that is earlier
21880
+ * than {@link timestamp} and the producer could date it (D684).
21881
+ *
21882
+ * Set on a package PICK-UP row only: its `timestamp` is when the departure
21883
+ * was CONCLUDED — five minutes of unseen observed time after the parcel went
21884
+ * — and a notification's footage has to be cut around the pick-up, not the
21885
+ * empty doormat after it (D682). Stored so every path that rebuilds a
21886
+ * notification subject from the row (the boot reconcile, a dry-run) anchors
21887
+ * on the same instant the live hook did.
21888
+ *
21889
+ * `timestamp` keeps its meaning. Absent on every other row and on every
21890
+ * pick-up written before D684 — UNKNOWN, never 0 and never `timestamp`.
21891
+ */
21892
+ observedAt: number$1().optional(),
21348
21893
  /** The parent track's key-event importance [0,1], propagated to every object
21349
21894
  * event of the track (so an event row can be sorted by importance without a
21350
21895
  * track join). Absent on legacy rows / before the track was scored. */
@@ -21680,131 +22225,6 @@ var RecentTracksQueryInput = object({
21680
22225
  /** See {@link ExcludeSourcesDoc}. */
21681
22226
  excludeSources: array(TrackSourceSchema).optional()
21682
22227
  });
21683
- /**
21684
- * A Summary (D359): the per-camera session envelope that references tracks.
21685
- * `groupShotMediaId` is the media ROW id of its group shot (`ownerKind:
21686
- * 'summary'`, served by the event-media plane at `/m/<id>`), null until the
21687
- * first frame with a member visible has been materialised (D482 — it was the
21688
- * row's composite key, which embedded the owner and could name another table's
21689
- * row once event ids became per-table rowids).
21690
- */
21691
- var SummarySchema = object({
21692
- id: string(),
21693
- deviceId: number$1(),
21694
- openedAt: number$1(),
21695
- lastActiveAt: number$1(),
21696
- sealedAt: number$1().nullable(),
21697
- memberCount: number$1().int().nonnegative(),
21698
- groupShotMediaId: number$1().int().nullable()
21699
- });
21700
- var SummariesQueryInput = object({
21701
- deviceIds: array(number$1()).min(1),
21702
- since: number$1().optional(),
21703
- until: number$1().optional(),
21704
- limit: number$1().int().min(1).max(200).default(50),
21705
- /** The same member-wise filter {@link listRecentSummaries} takes — one
21706
- * meaning of "dog" on every summary surface. */
21707
- classes: array(string().min(1).max(60)).max(40).optional()
21708
- });
21709
- var SummaryDetailSchema = object({
21710
- summary: SummarySchema,
21711
- /** Members in absorption order, oldest join first. */
21712
- members: array(object({
21713
- trackId: string(),
21714
- /**
21715
- * The track's class at the time it JOINED, or `null` when it was unresolved
21716
- * and the track no longer exists to fill it.
21717
- *
21718
- * The join, not the latest opinion: class voting can re-decide a track's
21719
- * class afterwards, and a group's composition is the history of who came
21720
- * together. A consumer counts these to badge a thumbnail — "two people and a
21721
- * dog" — rather than being handed a second, denormalised tally that would
21722
- * drift from the members it claims to describe.
21723
- */
21724
- className: string().nullable(),
21725
- /** `primary` is the one member that carries the group's identity. */
21726
- role: _enum([
21727
- "primary",
21728
- "sibling",
21729
- "child"
21730
- ]).nullable(),
21731
- joinedAt: number$1(),
21732
- /** Tier 1 — the sub-class (`dog`, `van`), resolved from the member's track
21733
- * at read time. Absent when nothing resolved, never an empty string. */
21734
- label: string().optional(),
21735
- /** Tier 2 — the instance: a person's name, a plate. Absent when the pipeline
21736
- * recognised nobody, and absent for a member whose track has been pruned —
21737
- * a thumbnail that names the wrong person is worse than one naming nobody. */
21738
- subLabel: string().optional()
21739
- })).readonly()
21740
- });
21741
- /**
21742
- * What a LIST of groups carries: the envelope plus what it is MADE OF.
21743
- *
21744
- * Coarse on purpose — the operator's rule is "only the rough data on the list,
21745
- * we extend when we notice we need more". Enough to draw the card ("two people
21746
- * and a dog") and no more. The MEMBERS, their names and the per-member links
21747
- * are on {@link getSummary}: shipping every member of every group so a client
21748
- * can count them turns a page of two hundred groups into a thousand records to
21749
- * draw two hundred badges.
21750
- */
21751
- var SummaryListItemSchema = object({
21752
- summary: SummarySchema,
21753
- /** Class counts, most numerous first; `className: null` is a member whose
21754
- * class never resolved, counted so the counts add up to `memberCount`. */
21755
- classes: array(object({
21756
- className: string().nullable(),
21757
- count: number$1().int().positive()
21758
- })).readonly()
21759
- });
21760
- var SummariesPageSchema = object({ summaries: array(SummaryListItemSchema).readonly() });
21761
- /**
21762
- * The paged feed, deliberately the SAME shape as {@link RecentTracksQueryInput}.
21763
- *
21764
- * The reel on the cameras page and the Events gallery both ride a cursor, so a
21765
- * summaries feed that could only answer "the last N for these cameras"
21766
- * (`listSummaries`) would make groups available in the timeline and nowhere
21767
- * else. Two feeds with different ordering contracts would be two ideas of what
21768
- * "newest" means, on one screen.
21769
- */
21770
- var RecentSummariesQueryInput = object({
21771
- /** Devices to merge. An empty array yields an empty page. */
21772
- deviceIds: array(number$1()),
21773
- /** Window lower bound on `lastActiveAt` (inclusive). */
21774
- since: number$1().optional(),
21775
- /** Window upper bound on `lastActiveAt` (inclusive). */
21776
- until: number$1().optional(),
21777
- limit: number$1().int().min(1).max(500).default(100),
21778
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
21779
- cursor: string().optional(),
21780
- /**
21781
- * Restrict to these classes — THE SAME FIELD `listRecentTracks` takes, and
21782
- * deliberately the same name: the events filter tree emits one list of ticked
21783
- * taxonomy nodes, and a summaries feed that called it something else would
21784
- * make the operator's one filter component produce two shapes.
21785
- *
21786
- * A question about the MEMBERS: a group matches when ANY of them does. "Show
21787
- * me the arrivals with a dog" has to return the group of four people who had
21788
- * one with them; a filter on the group's own fields could only ever answer
21789
- * about its primary.
21790
- *
21791
- * Matched against all THREE tiers of a member — the class (`animal`), the
21792
- * sub-class (`dog`) and the instance (a name, a plate) — because which tier a
21793
- * ticked node lives on is the taxonomy's business, not the caller's. `dog` is
21794
- * an event kind in the tree and a tier-1 label on an `animal` track; a filter
21795
- * that read only the class would answer "animal" and never "dog".
21796
- *
21797
- * ABSENT or EMPTY means no filter — absent is not a selection of none.
21798
- */
21799
- classes: array(string().min(1).max(60)).max(40).optional()
21800
- });
21801
- var RecentSummariesPageSchema = object({
21802
- /** Ordered by (`lastActiveAt` DESC, id DESC). Same light item as
21803
- * {@link listSummaries} — one list shape, so a card renders the same
21804
- * whichever feed drew it. */
21805
- summaries: array(SummaryListItemSchema).readonly(),
21806
- nextCursor: string().nullable()
21807
- });
21808
22228
  var RecentTracksPageSchema = object({
21809
22229
  /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
21810
22230
  tracks: array(TrackSchema).readonly(),
@@ -22316,7 +22736,7 @@ DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).r
22316
22736
  classes: array(string()).optional(),
22317
22737
  /** See {@link ExcludeSourcesDoc}. */
22318
22738
  excludeSources: array(TrackSourceSchema).optional()
22319
- }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(SummariesQueryInput, SummariesPageSchema), method(RecentSummariesQueryInput, RecentSummariesPageSchema), method(object({ id: string() }), SummaryDetailSchema.nullable()), method(object({ deviceId: number$1() }), _void(), {
22739
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number$1() }), _void(), {
22320
22740
  kind: "mutation",
22321
22741
  auth: "admin"
22322
22742
  }), 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({
@@ -22370,7 +22790,8 @@ DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).r
22370
22790
  trackIds: array(string()).min(1)
22371
22791
  }), object({
22372
22792
  deleted: number$1().int(),
22373
- failed: array(string()).readonly()
22793
+ failed: array(string()).readonly(),
22794
+ sparedMediaIds: array(number$1().int()).readonly().optional()
22374
22795
  }), {
22375
22796
  kind: "mutation",
22376
22797
  auth: "admin"
@@ -22379,7 +22800,7 @@ DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).r
22379
22800
  deviceId: number$1(),
22380
22801
  trackId: string(),
22381
22802
  flags: TrackFlagsPatchSchema
22382
- }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(BirthDecisionQueryInputSchema, array(BirthDecisionRecordSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
22803
+ }), 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, {
22383
22804
  kind: "query",
22384
22805
  auth: "admin"
22385
22806
  }), method(object({ deviceId: number$1().int().optional() }), EventMediaKindBreakdownSchema, {
@@ -23725,8 +24146,10 @@ var RunnerCameraConfigSchema = object({
23725
24146
  * - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
23726
24147
  * analyzer providers) running on decoded frames in this runner.
23727
24148
  * - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
23728
- * analytics). The provider emits ProviderMotion
23729
- * events; the orchestrator forwards to `reportMotion`.
24149
+ * analytics). The provider emits its raw push as `ProviderMotion`
24150
+ * (D673); the orchestrator's camera-sensors bridge re-emits the camera's
24151
+ * effective motion as `MotionOnMotionChanged`, which is what reaches
24152
+ * `reportMotion`.
23730
24153
  */
23731
24154
  motionSources: MotionSourcesSchema.default(["analyzer"]),
23732
24155
  /**
@@ -23903,7 +24326,15 @@ var RunnerLocalLoadSchema = object({
23903
24326
  hasGpu: boolean(),
23904
24327
  inferenceBackend: string().optional(),
23905
24328
  cpuCores: number$1().optional()
23906
- })
24329
+ }),
24330
+ /**
24331
+ * Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
24332
+ * runner never writes it. ABSENT = a runner older than D696, which still
24333
+ * writes the slice from its phase machine; the orchestrator does not write
24334
+ * while any runner node is absent-or-unanswered, so one slice never has two
24335
+ * writers.
24336
+ */
24337
+ motionSliceWriter: literal("orchestrator").optional()
23907
24338
  });
23908
24339
  /**
23909
24340
  * Aggregate runtime metrics for the runner's whole local pool. Mirrors the
@@ -24537,7 +24968,64 @@ var NodeInferenceDevicesSchema = object({
24537
24968
  reachable: boolean(),
24538
24969
  devices: array(NodeInferenceDeviceSchema).readonly()
24539
24970
  });
24540
- method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
24971
+ /**
24972
+ * Pipeline Orchestrator capability — global load balancer + camera dispatcher.
24973
+ *
24974
+ * Lives on the hub. Tracks the camera-to-agent assignment map, listens to
24975
+ * device lifecycle events, queries each runner's capacity + hardware
24976
+ * profile, and dispatches `attachCamera` / `detachCamera` cap calls to the
24977
+ * appropriate runner instances. Persists assignments via the multi-level
24978
+ * settings store so they survive hub restarts.
24979
+ *
24980
+ * Strictly the control plane: never sees a frame, never calls inference,
24981
+ * never drains queues. The runner does that work locally on each agent.
24982
+ */
24983
+ /**
24984
+ * The input of `setCameraSensors` (G5, D676): the ONE typed write path of a
24985
+ * camera's attached sensors (D672). `config: null` removes the attachment —
24986
+ * the camera reads `not-configured` again, never `unreadable`.
24987
+ */
24988
+ var SetCameraSensorsInputSchema = object({
24989
+ deviceId: number$1().int().nonnegative(),
24990
+ /** `null` removes the attachment: the camera goes back to `not-configured`. */
24991
+ config: CameraSensorsConfigSchema.nullable()
24992
+ });
24993
+ /**
24994
+ * Why an early occupancy look (D691) was not scheduled.
24995
+ *
24996
+ * - `unknown-camera` — no session was ever dispatched for it, so there is no
24997
+ * node and no config to attach a burst with.
24998
+ * - `out-of-range` — the ask is negative or further out than the orchestrator
24999
+ * will hold a timer for; the parked-object cadence is the answer there.
25000
+ * - `no-burst-producer` — this build has no burst producer at all.
25001
+ * - `already-looked` — this camera's ONE early look since its last session has
25002
+ * been spent. A look's own burst can re-arm a flickering flip, and a look
25003
+ * per arm would chain a burst every ~30 s forever (review H2); the next
25004
+ * real session re-arms the budget.
25005
+ */
25006
+ var OccupancyLookRefusalSchema = _enum([
25007
+ "unknown-camera",
25008
+ "out-of-range",
25009
+ "no-burst-producer",
25010
+ "already-looked"
25011
+ ]);
25012
+ method(object({
25013
+ deviceId: number$1().int().nonnegative(),
25014
+ /** How long from NOW until the pending flip's sustain window ends. RELATIVE,
25015
+ * so the caller's clock and the orchestrator's never have to agree. */
25016
+ afterMs: number$1().finite(),
25017
+ /** Why, for the log. */
25018
+ reason: string()
25019
+ }), object({
25020
+ scheduled: boolean(),
25021
+ /** When `scheduled`: how long until the burst is dialled. */
25022
+ dueInMs: number$1().optional(),
25023
+ /** When not `scheduled`: why. */
25024
+ refusedBecause: OccupancyLookRefusalSchema.optional()
25025
+ }), {
25026
+ kind: "mutation",
25027
+ auth: "admin"
25028
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
24541
25029
  kind: "mutation",
24542
25030
  auth: "admin"
24543
25031
  }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
@@ -24691,7 +25179,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
24691
25179
  }), CameraSwitchGroupSchema, {
24692
25180
  kind: "mutation",
24693
25181
  auth: "admin"
24694
- }), method(object({ deviceId: number$1() }), CameraStatusSchema), method(object({ deviceIds: array(number$1()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
25182
+ }), method(object({ deviceId: number$1() }), CameraStatusSchema), method(object({ deviceIds: array(number$1()).optional() }), array(CameraStatusSchema).readonly()), method(SetCameraSensorsInputSchema, object({ success: literal(true) }), {
25183
+ kind: "mutation",
25184
+ auth: "admin"
25185
+ }), method(_void(), DiskReconcileJobSchema, {
24695
25186
  kind: "mutation",
24696
25187
  auth: "admin"
24697
25188
  }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
@@ -26479,7 +26970,7 @@ var ClipPlaybackSchema = object({
26479
26970
  * **One authorised yes is one wake.** `next-natural` — take the clip the next
26480
26971
  * time the camera is awake for its own reasons — is deliberately not a member:
26481
26972
  * it was proposed, it is free on the battery, and the operator declined it on
26482
- * 2026-09-20 (*"Quando un export viene richiesto si sveglia la camera."*,
26973
+ * 2026-09-20 (*"Quando un export viene richiesto si sveglia la camera."* [When an export is requested the camera wakes up],
26483
26974
  * D558 "Considered and not taken").
26484
26975
  */
26485
26976
  var ClipWakeSchema = _enum(["authorised"]);
@@ -26740,7 +27231,7 @@ DeviceType.Camera, method(object({
26740
27231
  * It replaced `sources?: string[]`, a VIEW filter over source ids that
26741
27232
  * assumed the answer was a fan-out over everything a camera has. The
26742
27233
  * operator settled otherwise on 2026-09-20 — *"l'utilizzatore è uno
26743
- * solo"* — so the list is asked of one provider at a time and there is
27234
+ * solo"* [there is only one user] — so the list is asked of one provider at a time and there is
26744
27235
  * nothing to filter out of it.
26745
27236
  */
26746
27237
  provider: string().min(1)
@@ -26867,138 +27358,6 @@ DeviceType.Camera, method(object({
26867
27358
  kind: "query",
26868
27359
  auth: "protected"
26869
27360
  });
26870
- object({
26871
- /** Ms epoch of the last press. null = never observed since this provider started. */
26872
- lastPressedAt: number$1().nullable(),
26873
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
26874
- pressCountSinceStart: number$1()
26875
- });
26876
- object({
26877
- deviceId: number$1(),
26878
- timestamp: number$1()
26879
- });
26880
- /**
26881
- * The `doorbell-source` extension slot's editable value (D648): the camera's
26882
- * virtual-doorbell trigger devices, exactly what the wrapper's
26883
- * `doorbellSources` persists (as `{ deviceId }` records).
26884
- */
26885
- var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number$1().int().positive()) });
26886
- DeviceType.Camera;
26887
- DeviceType.Button, DeviceType.Camera;
26888
- var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
26889
- DeviceType.Camera, DeviceType.Camera;
26890
- /** A slot's editable value, discriminated on `slot`. */
26891
- var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
26892
- DeviceType.Camera;
26893
- var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
26894
- state: literal("unreachable"),
26895
- reason: string()
26896
- })]);
26897
- /** One provider of slots — the D554 source-listing row. */
26898
- var ExtensionSourceSchema = object({
26899
- /** The routing prefix of every `slotRef` this provider serves. */
26900
- source: string(),
26901
- label: string(),
26902
- /** Stamped by the dispatcher from the registry (D557). */
26903
- addonId: string().optional(),
26904
- availability: ExtensionSourceAvailabilitySchema
26905
- });
26906
- /**
26907
- * How one picked source stands. `missing` — no such device (deleted, or an id
26908
- * that never existed); `foreign` — a device the slot's owner cannot read from
26909
- * (a source owned by another addon); `unavailable` — it exists but is not a
26910
- * valid source now (a container, which is never a pick). A source in any of
26911
- * these states is SHOWN, never silently dropped or re-pointed.
26912
- */
26913
- var ExtensionSourceHealthSchema = _enum([
26914
- "ok",
26915
- "missing",
26916
- "foreign",
26917
- "unavailable"
26918
- ]);
26919
- var ExtensionSlotSourceSchema = object({
26920
- deviceId: number$1().int(),
26921
- /** The device's name, or null when it could not be resolved (`missing`). */
26922
- name: string().nullable(),
26923
- health: ExtensionSourceHealthSchema,
26924
- detail: string().optional()
26925
- });
26926
- /**
26927
- * A DIFFERENT authority that gates whether the slot's sources do anything —
26928
- * reported read-only, named, never written through this contract (D62). The
26929
- * virtual doorbell's sources ring only while the wrapper is bound to the
26930
- * camera, and that binding belongs to `deviceManager.setWrapperActive`.
26931
- * `unknown` means the gate could not be read; it is not "inactive" (D315).
26932
- */
26933
- var ExtensionSlotActivationSchema = object({
26934
- state: _enum([
26935
- "active",
26936
- "inactive",
26937
- "unknown"
26938
- ]),
26939
- authority: string(),
26940
- detail: string().optional()
26941
- });
26942
- var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
26943
- state: literal("ok"),
26944
- /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
26945
- slotRef: string(),
26946
- slot: ExtensionSlotIdSchema,
26947
- /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
26948
- authority: string(),
26949
- activation: ExtensionSlotActivationSchema.nullable(),
26950
- value: ExtensionSlotValueSchema,
26951
- sources: array(ExtensionSlotSourceSchema),
26952
- /**
26953
- * Devices the owner links to the host ON ITS OWN, by structure, and that
26954
- * are therefore not in `value` (D655): a camera's device-tree children, and
26955
- * the child a picked container stands for (D356 — a container is never a
26956
- * pick, its children are). Read-only; the editor shows them and may offer
26957
- * per-device options on them (the linked-devices tracked-event opt-in).
26958
- * Absent when the owner links nothing beyond the picks, and from an owner
26959
- * older than D655.
26960
- */
26961
- impliedSources: array(ExtensionSlotSourceSchema).optional()
26962
- }), object({
26963
- state: literal("unreachable"),
26964
- addonId: string(),
26965
- reason: string()
26966
- })]);
26967
- var ExtensionCandidatesSchema = object({ candidates: array(object({
26968
- deviceId: number$1().int(),
26969
- name: string(),
26970
- type: string(),
26971
- location: string().nullable(),
26972
- /** The container a child belongs to — "Spotlight 2" alone does not say which. */
26973
- parentName: string().nullable(),
26974
- /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
26975
- suggested: boolean(),
26976
- /** Why it is suggested ("same location"), null when it is not. */
26977
- reason: string().nullable()
26978
- })) });
26979
- /**
26980
- * What a write did. `none` — applied in place. `host` / `parent` — the owner
26981
- * reloaded the host (or, for an accessory child, its parent) because the
26982
- * write changed what the host REGISTERS. A slot never adds a capability to its
26983
- * host — that is a composition (D663) — so today's owners answer `none`.
26984
- */
26985
- var ExtensionSetResultSchema = object({
26986
- applied: literal(true),
26987
- reload: _enum([
26988
- "none",
26989
- "host",
26990
- "parent"
26991
- ])
26992
- });
26993
- var ExtensionSlotRefInputSchema = object({
26994
- deviceId: number$1().int(),
26995
- slotRef: string().min(1)
26996
- });
26997
- var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
26998
- method(object({ deviceId: number$1().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number$1().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
26999
- kind: "mutation",
27000
- auth: "admin"
27001
- });
27002
27361
  /**
27003
27362
  * Optional client-side hints sent at session creation to help the provider
27004
27363
  * pick the best native source. All fields optional — a viewer that knows
@@ -28816,6 +29175,17 @@ object({
28816
29175
  deviceId: number$1(),
28817
29176
  status: DeviceStatusSchema
28818
29177
  });
29178
+ object({
29179
+ /** Ms epoch of the last press. null = never observed since this provider started. */
29180
+ lastPressedAt: number$1().nullable(),
29181
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
29182
+ pressCountSinceStart: number$1()
29183
+ });
29184
+ object({
29185
+ deviceId: number$1(),
29186
+ timestamp: number$1()
29187
+ });
29188
+ DeviceType.Button, DeviceType.Camera;
28819
29189
  /**
28820
29190
  * Enum-state sensor — a string value picked from a finite option set.
28821
29191
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -30460,9 +30830,9 @@ object({
30460
30830
  /** Ms epoch of the last detected-true observation. Null if never detected. */
30461
30831
  lastDetectedAt: number$1().nullable(),
30462
30832
  /**
30463
- * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
30464
- * `null` while false and on every `Sensor` device (D475) — see that
30465
- * constant's doc for the one-authority rule.
30833
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
30834
+ * orchestrator writes it, D696), `null` while false and on every `Sensor`
30835
+ * device (D475) — see that constant's doc for the one-authority rule.
30466
30836
  *
30467
30837
  * ## Reading this field still arms nothing
30468
30838
  *
@@ -30480,38 +30850,41 @@ object({
30480
30850
  * `addon-export-alexa/src/motion-clear-hold.ts` and
30481
30851
  * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
30482
30852
  *
30483
- * ## Who writes it
30853
+ * ## Who writes it (D696)
30484
30854
  *
30485
- * - **Cameras** — the runner's phase machine, `active → watching` on
30486
- * `cooldown_expired`, which then writes this slice with
30487
- * `detected: false` (`handlePhaseChanged` in
30488
- * `pipeline-runner/index.ts`). It produces the FALLING edge, which
30489
- * matters most for the sources that only ever push a rising one:
30490
- * Reolink emits `MotionOnMotionChanged { detected: true }` and never
30491
- * a false.
30492
- * - **Sensors** (Home Assistant binary sensors, Homematic) — the
30493
- * provider pushes the false itself, from the upstream system's own
30494
- * state change. No phase machine is involved.
30855
+ * - **Cameras** — the orchestrator, and nothing else. It writes the camera's
30856
+ * EFFECTIVE motion (`addon-pipeline-orchestrator`
30857
+ * `camera-sensors/motion-slice.ts`), alongside the effective
30858
+ * `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
30859
+ * for a split camera, an unsplit emitter's direct event, the analyzer and
30860
+ * device activity, as the camera's `motionSources` counts them. A source
30861
+ * that never sends a clear falls one window after its last `true`.
30862
+ * `lastDetectedAt` moves only on an effective rise. No camera provider
30863
+ * writes this slice (not even a boot seed), and neither does the runner's
30864
+ * phase machine: its phase is "a session is attached" for every on-motion
30865
+ * session, not motion, and it now has its own `DetectionPhaseTransition`.
30866
+ * A provider's `isDetected` answers from the hub's slice.
30867
+ * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
30868
+ * imports) — the provider pushes both edges itself, from the upstream
30869
+ * system's own state change. That is the sensor's own fact.
30495
30870
  *
30496
- * ### The phase machine is CANONICAL, not sole — and that is a defect
30871
+ * `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
30872
+ * `motion` slice; each sensor writer is a named exemption.
30497
30873
  *
30498
- * An earlier revision of this docblock (mine, 2026-09-12) claimed the
30499
- * phase machine is the sole writer for a camera. It is not.
30500
- * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
30501
- * `setCapSlice(motionCapability, …)` on their own rising edge, and
30502
- * Hikvision's comment says why: it read THIS docblock, agreed the
30503
- * runner is canonical, and wrote anyway to avoid per-tick churn. So
30504
- * two authorities can disagree about one slice, which this repo
30505
- * forbids, and the doc said otherwise — which is worse than saying
30506
- * nothing, because it reads as verification.
30507
- *
30508
- * This predates D475 and is not fixed there: the fix touches every
30509
- * camera provider. Recorded in D475's Consequences. Do not restore the
30510
- * "sole writer" wording without also removing the other writers.
30874
+ * This replaces the D475 §4 rule ("the phase machine is the sole writer").
30875
+ * That rule was never true: Hikvision and Amcrest wrote the slice raw beside
30876
+ * it, every provider seeded it at boot, and every session left it
30877
+ * `detected: true` after its detach.
30511
30878
  */
30512
30879
  autoClearAfterMs: number$1().nullable()
30513
30880
  });
30514
- object({
30881
+ /**
30882
+ * Payload of `motion.onMotionChanged` event + the corresponding bus
30883
+ * event `EventCategory.MotionOnMotionChanged`. Single source of truth
30884
+ * — both the cap event surface and the bus payload type alias to this
30885
+ * schema.
30886
+ */
30887
+ var MotionOnMotionChangedDataSchema = object({
30515
30888
  deviceId: number$1(),
30516
30889
  detected: boolean(),
30517
30890
  timestamp: number$1(),
@@ -32976,7 +33349,7 @@ var ReadGopBytesResultSchema = object({
32976
33349
  /**
32977
33350
  * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
32978
33351
  * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
32979
- * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
33352
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-clip-replay-on-pipeline.md`):
32980
33353
  * a replay needs several seconds of native pixels, not one frame.
32981
33354
  *
32982
33355
  * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
@@ -35592,47 +35965,6 @@ DeviceType.Camera, method(object({
35592
35965
  detection: array(ZoneRuleSchema).readonly(),
35593
35966
  package: array(ZoneRuleSchema).readonly()
35594
35967
  });
35595
- var NUMBER = {
35596
- kind: "fixed",
35597
- result: ["number"]
35598
- };
35599
- var BOOLEAN = {
35600
- kind: "fixed",
35601
- result: ["boolean"]
35602
- };
35603
- Object.freeze({
35604
- min: NUMBER,
35605
- max: NUMBER,
35606
- abs: NUMBER,
35607
- floor: NUMBER,
35608
- ceil: NUMBER,
35609
- sqrt: NUMBER,
35610
- round: NUMBER,
35611
- pow: NUMBER,
35612
- clamp: NUMBER,
35613
- avg: NUMBER,
35614
- sum: NUMBER,
35615
- age: NUMBER,
35616
- convert: NUMBER,
35617
- coalesce: { kind: "coalesce" },
35618
- any: BOOLEAN,
35619
- all: BOOLEAN,
35620
- within: BOOLEAN,
35621
- latest: {
35622
- kind: "fixed",
35623
- result: ["number", "null"]
35624
- },
35625
- number: {
35626
- kind: "fixed",
35627
- result: ["number", "null"]
35628
- },
35629
- rose: {
35630
- kind: "fixed",
35631
- result: ["number", "null"]
35632
- },
35633
- count: NUMBER
35634
- });
35635
- `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
35636
35968
  /**
35637
35969
  * Accessory device helpers — shared across drivers.
35638
35970
  *
@@ -38055,6 +38387,12 @@ Object.freeze({
38055
38387
  addonId: null,
38056
38388
  access: "view"
38057
38389
  },
38390
+ "coreBlocks.listComposableCaps": {
38391
+ capName: "core-blocks",
38392
+ capScope: "system",
38393
+ addonId: null,
38394
+ access: "view"
38395
+ },
38058
38396
  "coreBlocks.listCompositions": {
38059
38397
  capName: "core-blocks",
38060
38398
  capScope: "system",
@@ -38133,6 +38471,18 @@ Object.freeze({
38133
38471
  addonId: null,
38134
38472
  access: "view"
38135
38473
  },
38474
+ "databaseSnapshot.listDatabases": {
38475
+ capName: "database-snapshot",
38476
+ capScope: "system",
38477
+ addonId: null,
38478
+ access: "view"
38479
+ },
38480
+ "databaseSnapshot.writeSnapshot": {
38481
+ capName: "database-snapshot",
38482
+ capScope: "system",
38483
+ addonId: null,
38484
+ access: "create"
38485
+ },
38136
38486
  "dataStoreProvider.aggregate": {
38137
38487
  capName: "data-store-provider",
38138
38488
  capScope: "system",
@@ -40593,6 +40943,12 @@ Object.freeze({
40593
40943
  addonId: null,
40594
40944
  access: "view"
40595
40945
  },
40946
+ "notificationRules.getAlarmSensors": {
40947
+ capName: "notification-rules",
40948
+ capScope: "system",
40949
+ addonId: null,
40950
+ access: "view"
40951
+ },
40596
40952
  "notificationRules.getClipRetentionAsks": {
40597
40953
  capName: "notification-rules",
40598
40954
  capScope: "system",
@@ -40869,6 +41225,12 @@ Object.freeze({
40869
41225
  addonId: null,
40870
41226
  access: "create"
40871
41227
  },
41228
+ "pipelineAnalytics.clearTrackRelation": {
41229
+ capName: "pipeline-analytics",
41230
+ capScope: "device",
41231
+ addonId: null,
41232
+ access: "delete"
41233
+ },
40872
41234
  "pipelineAnalytics.clearTracks": {
40873
41235
  capName: "pipeline-analytics",
40874
41236
  capScope: "device",
@@ -41025,12 +41387,6 @@ Object.freeze({
41025
41387
  addonId: null,
41026
41388
  access: "view"
41027
41389
  },
41028
- "pipelineAnalytics.getSummary": {
41029
- capName: "pipeline-analytics",
41030
- capScope: "device",
41031
- addonId: null,
41032
- access: "view"
41033
- },
41034
41390
  "pipelineAnalytics.getTrack": {
41035
41391
  capName: "pipeline-analytics",
41036
41392
  capScope: "device",
@@ -41091,12 +41447,6 @@ Object.freeze({
41091
41447
  addonId: null,
41092
41448
  access: "view"
41093
41449
  },
41094
- "pipelineAnalytics.listRecentSummaries": {
41095
- capName: "pipeline-analytics",
41096
- capScope: "device",
41097
- addonId: null,
41098
- access: "view"
41099
- },
41100
41450
  "pipelineAnalytics.listRecentTracks": {
41101
41451
  capName: "pipeline-analytics",
41102
41452
  capScope: "device",
@@ -41127,13 +41477,13 @@ Object.freeze({
41127
41477
  addonId: null,
41128
41478
  access: "view"
41129
41479
  },
41130
- "pipelineAnalytics.listSummaries": {
41480
+ "pipelineAnalytics.listTrackMedia": {
41131
41481
  capName: "pipeline-analytics",
41132
41482
  capScope: "device",
41133
41483
  addonId: null,
41134
41484
  access: "view"
41135
41485
  },
41136
- "pipelineAnalytics.listTrackMedia": {
41486
+ "pipelineAnalytics.listTrackRelations": {
41137
41487
  capName: "pipeline-analytics",
41138
41488
  capScope: "device",
41139
41489
  addonId: null,
@@ -41253,6 +41603,18 @@ Object.freeze({
41253
41603
  addonId: null,
41254
41604
  access: "create"
41255
41605
  },
41606
+ "pipelineAnalytics.setTrackPurity": {
41607
+ capName: "pipeline-analytics",
41608
+ capScope: "device",
41609
+ addonId: null,
41610
+ access: "create"
41611
+ },
41612
+ "pipelineAnalytics.setTrackRelation": {
41613
+ capName: "pipeline-analytics",
41614
+ capScope: "device",
41615
+ addonId: null,
41616
+ access: "create"
41617
+ },
41256
41618
  "pipelineAnalytics.startStorageMigrationMove": {
41257
41619
  capName: "pipeline-analytics",
41258
41620
  capScope: "device",
@@ -41691,6 +42053,12 @@ Object.freeze({
41691
42053
  addonId: null,
41692
42054
  access: "delete"
41693
42055
  },
42056
+ "pipelineOrchestrator.requestOccupancyLook": {
42057
+ capName: "pipeline-orchestrator",
42058
+ capScope: "system",
42059
+ addonId: null,
42060
+ access: "create"
42061
+ },
41694
42062
  "pipelineOrchestrator.resetNodePipelineDefaults": {
41695
42063
  capName: "pipeline-orchestrator",
41696
42064
  capScope: "system",
@@ -41757,6 +42125,12 @@ Object.freeze({
41757
42125
  addonId: null,
41758
42126
  access: "create"
41759
42127
  },
42128
+ "pipelineOrchestrator.setCameraSensors": {
42129
+ capName: "pipeline-orchestrator",
42130
+ capScope: "system",
42131
+ addonId: null,
42132
+ access: "create"
42133
+ },
41760
42134
  "pipelineOrchestrator.setCameraStepOverride": {
41761
42135
  capName: "pipeline-orchestrator",
41762
42136
  capScope: "system",
@@ -45058,6 +45432,11 @@ Object.freeze({
45058
45432
  form: "single",
45059
45433
  optional: false
45060
45434
  }],
45435
+ "notificationRules.getAlarmSensors": [{
45436
+ name: "deviceIds",
45437
+ form: "array",
45438
+ optional: false
45439
+ }],
45061
45440
  "notificationRules.setDeviceMuted": [{
45062
45441
  name: "deviceId",
45063
45442
  form: "single",
@@ -45167,6 +45546,11 @@ Object.freeze({
45167
45546
  form: "single",
45168
45547
  optional: false
45169
45548
  }],
45549
+ "pipelineAnalytics.clearTrackRelation": [{
45550
+ name: "deviceId",
45551
+ form: "single",
45552
+ optional: false
45553
+ }],
45170
45554
  "pipelineAnalytics.clearTracks": [{
45171
45555
  name: "deviceId",
45172
45556
  form: "single",
@@ -45302,11 +45686,6 @@ Object.freeze({
45302
45686
  form: "single",
45303
45687
  optional: true
45304
45688
  }],
45305
- "pipelineAnalytics.listRecentSummaries": [{
45306
- name: "deviceIds",
45307
- form: "array",
45308
- optional: false
45309
- }],
45310
45689
  "pipelineAnalytics.listRecentTracks": [{
45311
45690
  name: "deviceIds",
45312
45691
  form: "array",
@@ -45317,12 +45696,12 @@ Object.freeze({
45317
45696
  form: "array",
45318
45697
  optional: true
45319
45698
  }],
45320
- "pipelineAnalytics.listSummaries": [{
45321
- name: "deviceIds",
45322
- form: "array",
45699
+ "pipelineAnalytics.listTrackMedia": [{
45700
+ name: "deviceId",
45701
+ form: "single",
45323
45702
  optional: false
45324
45703
  }],
45325
- "pipelineAnalytics.listTrackMedia": [{
45704
+ "pipelineAnalytics.listTrackRelations": [{
45326
45705
  name: "deviceId",
45327
45706
  form: "single",
45328
45707
  optional: false
@@ -45397,6 +45776,16 @@ Object.freeze({
45397
45776
  form: "single",
45398
45777
  optional: false
45399
45778
  }],
45779
+ "pipelineAnalytics.setTrackPurity": [{
45780
+ name: "deviceId",
45781
+ form: "single",
45782
+ optional: false
45783
+ }],
45784
+ "pipelineAnalytics.setTrackRelation": [{
45785
+ name: "deviceId",
45786
+ form: "single",
45787
+ optional: false
45788
+ }],
45400
45789
  "pipelineAnalytics.wipeAllAnalytics": [{
45401
45790
  name: "deviceId",
45402
45791
  form: "single",
@@ -45467,6 +45856,11 @@ Object.freeze({
45467
45856
  form: "single",
45468
45857
  optional: false
45469
45858
  }],
45859
+ "pipelineOrchestrator.requestOccupancyLook": [{
45860
+ name: "deviceId",
45861
+ form: "single",
45862
+ optional: false
45863
+ }],
45470
45864
  "pipelineOrchestrator.resolvePipeline": [{
45471
45865
  name: "deviceId",
45472
45866
  form: "single",
@@ -45477,6 +45871,11 @@ Object.freeze({
45477
45871
  form: "single",
45478
45872
  optional: false
45479
45873
  }],
45874
+ "pipelineOrchestrator.setCameraSensors": [{
45875
+ name: "deviceId",
45876
+ form: "single",
45877
+ optional: false
45878
+ }],
45480
45879
  "pipelineOrchestrator.setCameraStepOverride": [{
45481
45880
  name: "deviceId",
45482
45881
  form: "single",
@@ -46623,6 +47022,18 @@ var STATE_SUMMARY_VARS = [
46623
47022
  systemEventKinds: [...SUMMARISABLE],
46624
47023
  systemEventDeliveries: ["summary"]
46625
47024
  },
47025
+ {
47026
+ name: "summarySection",
47027
+ label: "Summary: this section",
47028
+ description: "The section a per-section summary row is about (D698); on a summary sent as one message, every section it reports, comma-separated.",
47029
+ example: "Batterie scariche",
47030
+ group: "system",
47031
+ families: ["rule"],
47032
+ fields: [...RULE_TEXT],
47033
+ kinds: ["system"],
47034
+ systemEventKinds: [...SUMMARISABLE],
47035
+ systemEventDeliveries: ["summary"]
47036
+ },
46626
47037
  ...STATE_SUMMARY_SECTION_VARS.map((v) => ({
46627
47038
  name: v.name,
46628
47039
  label: v.label,
@@ -46699,6 +47110,37 @@ var STATE_SUMMARY_VARS = [
46699
47110
  [...RULE_TEXT],
46700
47111
  ...STATE_SUMMARY_VARS
46701
47112
  ];
47113
+ new Set([
47114
+ "disarmed",
47115
+ "armed_home",
47116
+ "armed_away",
47117
+ "armed_night",
47118
+ "armed_vacation",
47119
+ "armed_custom_bypass",
47120
+ "arming",
47121
+ "disarming",
47122
+ "pending",
47123
+ "triggered",
47124
+ "open",
47125
+ "opening",
47126
+ "closing",
47127
+ "closed",
47128
+ "stopped",
47129
+ "locked",
47130
+ "unlocked",
47131
+ "locking",
47132
+ "unlocking",
47133
+ "jammed",
47134
+ "on",
47135
+ "off",
47136
+ "home",
47137
+ "not_home",
47138
+ "matched",
47139
+ "diverged",
47140
+ "unknown",
47141
+ "latched",
47142
+ "live"
47143
+ ]);
46702
47144
  /**
46703
47145
  * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
46704
47146
  *
@@ -46792,7 +47234,7 @@ var PreviewTextField = string().max(200);
46792
47234
  * Whether the notification's preview is a STILL or a short animation.
46793
47235
  *
46794
47236
  * The operator's ask, verbatim: *"inviato come gif o video (come per le altre
46795
- * rule)"* — the other rules already offer an animated preview, and a ten-hour
47237
+ * rule)"* [sent as a gif or video (as for the other rules)] — the other rules already offer an animated preview, and a ten-hour
46796
47238
  * night reads better as three seconds of motion than as one frame of it. Both
46797
47239
  * modes get the SAME treatment (blurred frame, large centred title); `'gif'`
46798
47240
  * simply applies it to a dozen frames sampled across the render and assembles
@@ -46930,6 +47372,7 @@ TimelapseRuleInputSchema.extend({
46930
47372
  createdAt: number$1(),
46931
47373
  updatedAt: number$1()
46932
47374
  });
47375
+ MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
46933
47376
  object({
46934
47377
  /**
46935
47378
  * Fraction of the box's own size added on EACH side before cutting.
@@ -82698,7 +83141,7 @@ function messagesFor(request) {
82698
83141
  * `RetryError` is the wrapper the library returns when the attempts are spent;
82699
83142
  * the interesting error is the LAST one inside it, so the envelope is unwrapped
82700
83143
  * before anything is classified (§2.3, "chi classifica gli errori deve
82701
- * scartare l'involucro").
83144
+ * scartare l'involucro" [whoever classifies errors must discard the envelope]).
82702
83145
  */
82703
83146
  function mapLibraryError(error) {
82704
83147
  if (RetryError.isInstance(error)) {