@camstack/addon-osd-manager 0.1.151 → 0.1.153

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 (18) hide show
  1. package/dist/{MotionZonesSettings-C5JP-D9r.mjs → MotionZonesSettings-Bi_uB8oT.mjs} +2 -2
  2. package/dist/{PrivacyMaskSettings-BhVDaMHE.mjs → PrivacyMaskSettings-DuzJnDoQ.mjs} +4 -4
  3. package/dist/{SceneMonitorEditor-Bt7UBGiu.mjs → SceneMonitorEditor-CnpHHB8l.mjs} +3 -3
  4. package/dist/_stub.js +2418 -2417
  5. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-BdJcTI3r.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-BD9qu2T3.mjs} +4 -4
  6. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DhxFiL0z.mjs +26 -0
  7. package/dist/{hostInit-tyNFvZo9.mjs → hostInit-Bo6e-m_F.mjs} +3 -3
  8. package/dist/index.js +571 -389
  9. package/dist/index.mjs +571 -389
  10. package/dist/{player-overlays-qwCKS5Oy.mjs → player-overlays-CPVNj3Th.mjs} +1 -1
  11. package/dist/remoteEntry.js +1 -1
  12. package/dist/{responsive-D-UTdp-i.mjs → responsive-CmW26rtV.mjs} +1 -1
  13. package/dist/{scene-monitor-copy-BWmGHVvh.mjs → scene-monitor-copy-BP0Z6F7z.mjs} +1 -1
  14. package/dist/{square-DIs3wUiy.mjs → square-CaTP7VKX.mjs} +1 -1
  15. package/dist/{trash-2-DzfMGb1n.mjs → trash-2-IrsDpmSJ.mjs} +1 -1
  16. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-CHKQMC7P.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-DLXGJNFv.mjs} +1 -1
  17. package/package.json +2 -2
  18. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BC1x5E1q.mjs +0 -26
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../types/dist/event-category-C5xZWqz6.mjs
1
+ //#region ../types/dist/event-category-BGmz_oxW.mjs
2
2
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
3
3
  EventCategory["SystemBoot"] = "system.boot";
4
4
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -531,6 +531,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
531
531
  */
532
532
  EventCategory["PipelineAudioInferenceResult"] = "pipeline.audio-inference-result";
533
533
  EventCategory["DetectionPhaseTransition"] = "detection.phase-transition";
534
+ /**
535
+ * A camera provider's RAW onboard motion push (D673): the `MotionOnMotionChanged`
536
+ * data shape without `triggeredBy`, built by `providerMotionEvent`. Its one
537
+ * consumer is the orchestrator's camera-sensors bridge, which re-emits the
538
+ * camera's EFFECTIVE onboard motion as `MotionOnMotionChanged` (a pass-through
539
+ * for a camera with no attached sensor). Providers must not emit
540
+ * `MotionOnMotionChanged` themselves; `scripts/check-onboard-motion-emitters.ts`
541
+ * keeps it so (camera-grid is a named, deferred exception).
542
+ */
534
543
  EventCategory["ProviderMotion"] = "provider.motion";
535
544
  EventCategory["ProviderDetection"] = "provider.detection";
536
545
  EventCategory["EnrichmentEmbeddingStored"] = "enrichment.embedding.stored";
@@ -5369,7 +5378,7 @@ var ZodIssueCode = {
5369
5378
  var ZodFirstPartyTypeKind;
5370
5379
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5371
5380
  //#endregion
5372
- //#region ../types/dist/sleep-gU6hqv4_.mjs
5381
+ //#region ../types/dist/sleep-CDCONfkt.mjs
5373
5382
  /**
5374
5383
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5375
5384
  * window to float samples (D455).
@@ -7510,7 +7519,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7510
7519
  return DeviceRole;
7511
7520
  }({});
7512
7521
  //#endregion
7513
- //#region ../types/dist/composition-Dq42XWp0.mjs
7522
+ //#region ../types/dist/composition-43aqsZQj.mjs
7514
7523
  /**
7515
7524
  * The ffmpeg build every CamStack node downloads, per platform and arch.
7516
7525
  *
@@ -7567,13 +7576,12 @@ portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac
7567
7576
  * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
7568
7577
  * valutatore puro del suo FRONTE.
7569
7578
  *
7570
- * Viveva dentro il builtin virtual-doorbell
7571
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
7572
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
7573
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
7574
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
7575
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
7576
- * SPOSTA qui e il doorbell la ri-esporta.
7579
+ * UNA tabella per tutti quelli che chiedono "questo device è ALTO?": il
7580
+ * trigger `RecordingTriggers.sensorDeviceIds` del recorder, i marker dei
7581
+ * sensori della post-analysis, il bridge camera-sensors dell'orchestratore e
7582
+ * le sorgenti di un campanello composto (`doorbellFeatureSources`, D671).
7583
+ * Una seconda copia divergerebbe alla prima cap aggiunta, e il sintomo — "il
7584
+ * sensore fa suonare il campanello ma non registra" — è esattamente D62.
7577
7585
  *
7578
7586
  * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
7579
7587
  * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
@@ -7599,8 +7607,6 @@ var SOURCE_CAP_ACTIVE_FIELD = {
7599
7607
  vibration: "detected",
7600
7608
  tamper: "tampered"
7601
7609
  };
7602
- /** Cap names whose presence in a device's bindings qualify it as a source. */
7603
- var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
7604
7610
  /**
7605
7611
  * Error types for the safe expression engine. Two distinct classes so callers
7606
7612
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
@@ -9310,7 +9316,7 @@ var RecordingTriggersSchema = object({
9310
9316
  *
9311
9317
  * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
9312
9318
  * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
9313
- * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
9319
+ * la stessa del campanello composto (D671). Ed è il FRONTE, non
9314
9320
  * il livello: un contatto trovato già aperto al riavvio del runner non fa
9315
9321
  * registrare.
9316
9322
  */
@@ -11897,6 +11903,103 @@ var authProviderCapability = {
11897
11903
  mount: { kind: "skip" }
11898
11904
  };
11899
11905
  /**
11906
+ * How long one snapshot may take end to end: the pinned copy of the whole
11907
+ * database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
11908
+ * disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
11909
+ * generous because a timeout fails the whole backup run.
11910
+ */
11911
+ var DATABASE_SNAPSHOT_TIMEOUT_MS = 30 * 6e4;
11912
+ /**
11913
+ * The databases an owner snapshots — declared by the OWNER, so a caller never
11914
+ * guesses which file is live from what sits beside it (a cleanly closed
11915
+ * database has no sidecars and is just as owned). Paths are absolute on the
11916
+ * owner's host.
11917
+ */
11918
+ var DatabaseSnapshotTargetsSchema = object({ databases: array(object({ livePath: string() })) });
11919
+ /** One b-tree table of the snapshot and the rows it holds. */
11920
+ var DatabaseSnapshotTableSchema = object({
11921
+ name: string(),
11922
+ rows: number().int().nonnegative()
11923
+ });
11924
+ /**
11925
+ * What the owner wrote. Every path is ABSOLUTE on the owner's host — the
11926
+ * caller pins the call to its own node, so it can read the file; a caller
11927
+ * that finds the path outside its own data root refuses it rather than
11928
+ * archiving something it cannot place.
11929
+ */
11930
+ var DatabaseSnapshotResultSchema = object({
11931
+ /** The live database the snapshot copies. Never to be copied as a file. */
11932
+ livePath: string(),
11933
+ /** The verified copy: `<livePath>` + {@link DATABASE_SNAPSHOT_SUFFIX}. */
11934
+ snapshotPath: string(),
11935
+ sizeBytes: number().int().nonnegative(),
11936
+ pageCount: number().int().nonnegative(),
11937
+ pageSize: number().int().positive(),
11938
+ /**
11939
+ * Every b-tree table with its row count. Read inside the SAME read
11940
+ * transaction the copy was taken from, and found EQUAL on the copy — so
11941
+ * this is the content of the snapshot, not an estimate of the source.
11942
+ */
11943
+ tables: array(DatabaseSnapshotTableSchema),
11944
+ /** Wall time of the pinned copy (row counts included). */
11945
+ copyMs: number().nonnegative(),
11946
+ /** Wall time of the checks on the copy (`integrity_check`, row counts). */
11947
+ verifyMs: number().nonnegative(),
11948
+ /** When the pinned read transaction began (ms epoch) — the snapshot's instant. */
11949
+ takenAt: number()
11950
+ });
11951
+ /**
11952
+ * A snapshot as an ARCHIVE records it (`ArchiveManifest.sqliteSnapshots`):
11953
+ * the same facts, with both paths relative to the archive root (the node's
11954
+ * data dir), because an archive outlives the host that made it.
11955
+ */
11956
+ var ArchiveSqliteSnapshotSchema = DatabaseSnapshotResultSchema.extend({
11957
+ /** Archive-relative path of the live database the archive does NOT carry. */
11958
+ livePath: string(),
11959
+ /** Archive-relative path of the verified copy it carries in its place. */
11960
+ snapshotPath: string()
11961
+ });
11962
+ /**
11963
+ * database-snapshot — the OWNER of a live SQLite database writes a consistent,
11964
+ * verified copy of it (D693).
11965
+ *
11966
+ * A live database cannot be copied as files: three files written by a live
11967
+ * process cannot be read at one instant from outside it, and a tar of the
11968
+ * `.db` / `-wal` / `-shm` trio was measured torn in 6/6 archives (D679). Nor may
11969
+ * another process open it (D679 rule 2). So the process that owns the
11970
+ * connection writes the copy — through its own connection, on a thread,
11971
+ * pinned to one read transaction — and checks it before handing it out.
11972
+ *
11973
+ * Hub-only and internal: `sqlite-settings` is the registrant, and its consumer
11974
+ * is `backup-orchestrator`, which calls it pinned to its own node so the path
11975
+ * it gets back is on its own host. `auth: 'admin'` explicitly — `internal`
11976
+ * does not gate the mount (see `data-store-provider`).
11977
+ */
11978
+ var databaseSnapshotCapability = {
11979
+ name: "database-snapshot",
11980
+ scope: "system",
11981
+ mode: "singleton",
11982
+ internal: true,
11983
+ methods: {
11984
+ /**
11985
+ * Which databases this owner snapshots. Answered from memory — no file is
11986
+ * touched — so a backup can ask it before deciding anything.
11987
+ */
11988
+ listDatabases: method(object({}), DatabaseSnapshotTargetsSchema, { auth: "admin" }),
11989
+ /**
11990
+ * Write `<db>.backup-snapshot` and return what it holds. Throws — and
11991
+ * leaves no file under the final name — when the copy fails
11992
+ * `integrity_check` or its row counts differ from the pinned source's.
11993
+ * A second call while one is running joins it.
11994
+ */
11995
+ writeSnapshot: method(object({}), DatabaseSnapshotResultSchema, {
11996
+ kind: "mutation",
11997
+ auth: "admin",
11998
+ timeoutMs: DATABASE_SNAPSHOT_TIMEOUT_MS
11999
+ })
12000
+ }
12001
+ };
12002
+ /**
11900
12003
  * Orchestrator-side destination metadata. The orchestrator computes
11901
12004
  * `id = <addonId>:<subId>` from its provider lookup so consumers
11902
12005
  * (admin UI, restore flow) see one canonical key.
@@ -12007,7 +12110,12 @@ var ArchiveManifestSchema = object({
12007
12110
  locations: array(string()),
12008
12111
  entries: array(ArchiveEntrySchema),
12009
12112
  totalBytes: number(),
12010
- totalFiles: number()
12113
+ totalFiles: number(),
12114
+ /**
12115
+ * Live SQLite databases this archive carries as their OWNER's verified
12116
+ * snapshot instead of as files (D693). Absent on archives made before.
12117
+ */
12118
+ sqliteSnapshots: array(ArchiveSqliteSnapshotSchema).optional()
12011
12119
  });
12012
12120
  var LocationStatSchema = object({
12013
12121
  name: string(),
@@ -13975,6 +14083,65 @@ var CompositionBlockStateSchema = object({
13975
14083
  reason: string().optional(),
13976
14084
  fields: array(CompositionFieldStateSchema)
13977
14085
  });
14086
+ var ComposerBlockSchema = object({
14087
+ id: string().min(1),
14088
+ name: string().min(1).max(120),
14089
+ enabled: boolean(),
14090
+ updatedAt: number(),
14091
+ composition: CompositionSchema
14092
+ });
14093
+ /**
14094
+ * A stored composition row that no longer PARSES — a schema a release
14095
+ * tightened, a row written by a newer build. Sent by id so the composer keeps
14096
+ * its device as a placeholder and reports the block `failed` naming the parse
14097
+ * error. Leaving it out would read, twice, exactly like a delete (D49).
14098
+ */
14099
+ var ComposerUnreadableBlockSchema = object({
14100
+ id: string().min(1),
14101
+ /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
14102
+ name: string().nullable(),
14103
+ /** The parse error, in the operator's words. */
14104
+ error: string()
14105
+ });
14106
+ var composerCapability = {
14107
+ name: "composer",
14108
+ scope: "system",
14109
+ mode: "singleton",
14110
+ internal: true,
14111
+ methods: {
14112
+ /**
14113
+ * Not `apply`: tRPC reserves `apply`, `call` and `then` as router keys, and
14114
+ * `router({})` throws on one — every cap router is built at boot.
14115
+ */
14116
+ applyBlocks: method(object({
14117
+ /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
14118
+ integrationId: string().nullable(),
14119
+ /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
14120
+ storeLoaded: boolean(),
14121
+ blocks: array(ComposerBlockSchema),
14122
+ /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
14123
+ restartBlockIds: array(string()),
14124
+ /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
14125
+ unreadableBlocks: array(ComposerUnreadableBlockSchema)
14126
+ }), object({
14127
+ blocks: array(object({
14128
+ blockId: string(),
14129
+ status: CompositionRunStatusSchema,
14130
+ reason: string().optional()
14131
+ })),
14132
+ /**
14133
+ * False when the composer declared and withdrew NOTHING (store not loaded,
14134
+ * integration unknown, its own rows unread or read empty once). An empty
14135
+ * apply the caller owes is paid off only by one the composer acted on (D49).
14136
+ */
14137
+ acted: boolean()
14138
+ }), {
14139
+ kind: "mutation",
14140
+ auth: "admin"
14141
+ }),
14142
+ getStates: method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" })
14143
+ }
14144
+ };
13978
14145
  var NUMBER = {
13979
14146
  kind: "fixed",
13980
14147
  result: ["number"]
@@ -14290,65 +14457,6 @@ var coreBlocksCapability = {
14290
14457
  })
14291
14458
  }
14292
14459
  };
14293
- var ComposerBlockSchema = object({
14294
- id: string().min(1),
14295
- name: string().min(1).max(120),
14296
- enabled: boolean(),
14297
- updatedAt: number(),
14298
- composition: CompositionSchema
14299
- });
14300
- /**
14301
- * A stored composition row that no longer PARSES — a schema a release
14302
- * tightened, a row written by a newer build. Sent by id so the composer keeps
14303
- * its device as a placeholder and reports the block `failed` naming the parse
14304
- * error. Leaving it out would read, twice, exactly like a delete (D49).
14305
- */
14306
- var ComposerUnreadableBlockSchema = object({
14307
- id: string().min(1),
14308
- /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
14309
- name: string().nullable(),
14310
- /** The parse error, in the operator's words. */
14311
- error: string()
14312
- });
14313
- var composerCapability = {
14314
- name: "composer",
14315
- scope: "system",
14316
- mode: "singleton",
14317
- internal: true,
14318
- methods: {
14319
- /**
14320
- * Not `apply`: tRPC reserves `apply`, `call` and `then` as router keys, and
14321
- * `router({})` throws on one — every cap router is built at boot.
14322
- */
14323
- applyBlocks: method(object({
14324
- /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
14325
- integrationId: string().nullable(),
14326
- /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
14327
- storeLoaded: boolean(),
14328
- blocks: array(ComposerBlockSchema),
14329
- /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
14330
- restartBlockIds: array(string()),
14331
- /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
14332
- unreadableBlocks: array(ComposerUnreadableBlockSchema)
14333
- }), object({
14334
- blocks: array(object({
14335
- blockId: string(),
14336
- status: CompositionRunStatusSchema,
14337
- reason: string().optional()
14338
- })),
14339
- /**
14340
- * False when the composer declared and withdrew NOTHING (store not loaded,
14341
- * integration unknown, its own rows unread or read empty once). An empty
14342
- * apply the caller owes is paid off only by one the composer acted on (D49).
14343
- */
14344
- acted: boolean()
14345
- }), {
14346
- kind: "mutation",
14347
- auth: "admin"
14348
- }),
14349
- getStates: method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" })
14350
- }
14351
- };
14352
14460
  /**
14353
14461
  * `custom-model-registry` — collection cap exposing operator-registered
14354
14462
  * custom detection models. Each provider (today: `addon-model-studio`)
@@ -17092,8 +17200,8 @@ var deviceManagerCapability = {
17092
17200
  * (`value` / `missing` / `failed`, see {@link WrapperActivationReadSchema}).
17093
17201
  *
17094
17202
  * The narrow read of the durable authority behind `getBindings`: a
17095
- * consumer that must know what the operator PERSISTED (virtual-doorbell,
17096
- * before it drops a press) asks this instead of pulling device-manager's
17203
+ * consumer that must know what the operator PERSISTED (before it drops
17204
+ * work on the strength of an unbind) asks this instead of pulling device-manager's
17097
17205
  * whole addon store through `addonSettingsRaw.getGlobal` — which answered
17098
17206
  * `{}` on every isolated-engine hub and so never worked (D675). It reads
17099
17207
  * ONE row (the activation map, ~1.6 KB), never the ~625 KB store.
@@ -17383,6 +17491,153 @@ var deviceManagerCapability = {
17383
17491
  }), record(string(), record(string(), unknown().nullable())))
17384
17492
  }
17385
17493
  };
17494
+ var ExtensionSlotIdSchema = _enum(["linked-devices"]);
17495
+ DeviceType.Camera;
17496
+ /** A slot's editable value, discriminated on `slot`. */
17497
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
17498
+ /** Every device type at least one slot is offered on — `device-extension`'s `deviceTypes`. */
17499
+ var EXTENSION_HOST_DEVICE_TYPES = [DeviceType.Camera];
17500
+ var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
17501
+ state: literal("unreachable"),
17502
+ reason: string()
17503
+ })]);
17504
+ /** One provider of slots — the D554 source-listing row. */
17505
+ var ExtensionSourceSchema = object({
17506
+ /** The routing prefix of every `slotRef` this provider serves. */
17507
+ source: string(),
17508
+ label: string(),
17509
+ /** Stamped by the dispatcher from the registry (D557). */
17510
+ addonId: string().optional(),
17511
+ availability: ExtensionSourceAvailabilitySchema
17512
+ });
17513
+ /**
17514
+ * How one picked source stands. `missing` — no such device (deleted, or an id
17515
+ * that never existed); `foreign` — a device the slot's owner cannot read from
17516
+ * (a source owned by another addon); `unavailable` — it exists but is not a
17517
+ * valid source now (a container, which is never a pick). A source in any of
17518
+ * these states is SHOWN, never silently dropped or re-pointed.
17519
+ */
17520
+ var ExtensionSourceHealthSchema = _enum([
17521
+ "ok",
17522
+ "missing",
17523
+ "foreign",
17524
+ "unavailable"
17525
+ ]);
17526
+ var ExtensionSlotSourceSchema = object({
17527
+ deviceId: number().int(),
17528
+ /** The device's name, or null when it could not be resolved (`missing`). */
17529
+ name: string().nullable(),
17530
+ health: ExtensionSourceHealthSchema,
17531
+ detail: string().optional()
17532
+ });
17533
+ /**
17534
+ * A DIFFERENT authority that gates whether the slot's sources do anything —
17535
+ * reported read-only, named, never written through this contract (D62) — e.g.
17536
+ * a slot whose sources act only while a wrapper is bound to the host, a
17537
+ * binding that belongs to `deviceManager.setWrapperActive`. No slot reports
17538
+ * one today (`linked-devices` answers `null`). `unknown` means the gate could
17539
+ * not be read; it is not "inactive" (D315).
17540
+ */
17541
+ var ExtensionSlotActivationSchema = object({
17542
+ state: _enum([
17543
+ "active",
17544
+ "inactive",
17545
+ "unknown"
17546
+ ]),
17547
+ authority: string(),
17548
+ detail: string().optional()
17549
+ });
17550
+ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
17551
+ state: literal("ok"),
17552
+ /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
17553
+ slotRef: string(),
17554
+ slot: ExtensionSlotIdSchema,
17555
+ /** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
17556
+ authority: string(),
17557
+ activation: ExtensionSlotActivationSchema.nullable(),
17558
+ value: ExtensionSlotValueSchema,
17559
+ sources: array(ExtensionSlotSourceSchema),
17560
+ /**
17561
+ * Devices the owner links to the host ON ITS OWN, by structure, and that
17562
+ * are therefore not in `value` (D655): a camera's device-tree children, and
17563
+ * the child a picked container stands for (D356 — a container is never a
17564
+ * pick, its children are). Read-only; the editor shows them and may offer
17565
+ * per-device options on them (the linked-devices tracked-event opt-in).
17566
+ * Absent when the owner links nothing beyond the picks, and from an owner
17567
+ * older than D655.
17568
+ */
17569
+ impliedSources: array(ExtensionSlotSourceSchema).optional()
17570
+ }), object({
17571
+ state: literal("unreachable"),
17572
+ addonId: string(),
17573
+ reason: string()
17574
+ })]);
17575
+ var ExtensionCandidatesSchema = object({ candidates: array(object({
17576
+ deviceId: number().int(),
17577
+ name: string(),
17578
+ type: string(),
17579
+ location: string().nullable(),
17580
+ /** The container a child belongs to — "Spotlight 2" alone does not say which. */
17581
+ parentName: string().nullable(),
17582
+ /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
17583
+ suggested: boolean(),
17584
+ /** Why it is suggested ("same location"), null when it is not. */
17585
+ reason: string().nullable()
17586
+ })) });
17587
+ /**
17588
+ * What a write did. `none` — applied in place. `host` / `parent` — the owner
17589
+ * reloaded the host (or, for an accessory child, its parent) because the
17590
+ * write changed what the host REGISTERS. A slot never adds a capability to its
17591
+ * host — that is a composition (D663) — so today's owners answer `none`.
17592
+ */
17593
+ var ExtensionSetResultSchema = object({
17594
+ applied: literal(true),
17595
+ reload: _enum([
17596
+ "none",
17597
+ "host",
17598
+ "parent"
17599
+ ])
17600
+ });
17601
+ var ExtensionSlotRefInputSchema = object({
17602
+ deviceId: number().int(),
17603
+ slotRef: string().min(1)
17604
+ });
17605
+ var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
17606
+ var deviceExtensionCapability = {
17607
+ name: "device-extension",
17608
+ scope: "device",
17609
+ mode: "collection",
17610
+ kind: "wrapper",
17611
+ defaultActive: true,
17612
+ deviceTypes: EXTENSION_HOST_DEVICE_TYPES,
17613
+ deviceConfig: { ui: {
17614
+ kind: "widget",
17615
+ widgetId: "host/extensions-panel",
17616
+ tab: "general",
17617
+ label: "Extensions",
17618
+ order: 72
17619
+ } },
17620
+ methods: {
17621
+ /** One row per slot owner — the D554 source listing `slotRef` routes by. */
17622
+ listSources: method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)),
17623
+ /**
17624
+ * Every slot this device is offered, read by each owner from its own
17625
+ * store. A provider that throws is ONE `unreachable` row (D554.4).
17626
+ */
17627
+ listSlots: method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)),
17628
+ /** The devices the slot's editor may offer, suggestions pre-marked (D356). */
17629
+ listCandidates: method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema),
17630
+ /**
17631
+ * Write one slot through its owner's EXISTING write path. The owner
17632
+ * validates (a container is never a linked device, a camera is never its
17633
+ * own source) and refuses by name before persisting.
17634
+ */
17635
+ setSlot: method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
17636
+ kind: "mutation",
17637
+ auth: "admin"
17638
+ })
17639
+ }
17640
+ };
17386
17641
  /**
17387
17642
  * Per-field ownership (D663). A composition may CLAIM fields of a native
17388
17643
  * cap's runtime-state slice on an existing device: `replace` overlays the
@@ -17482,8 +17737,8 @@ var deviceStateCapability = {
17482
17737
  * Canonical cross-layer WRITE for one cap-keyed slice. Used by
17483
17738
  * everyone who needs to publish runtime state for a device:
17484
17739
  * device providers (via `BaseDevice.runtimeState.setCapState`
17485
- * which delegates here), system-scope addons (e.g. the pipeline
17486
- * runner writing the `motion` slice on phase transitions), and
17740
+ * which delegates here), system-scope addons (e.g. the orchestrator
17741
+ * writing a camera's effective `motion` slice, D696), and
17487
17742
  * direct cap-router callers in tests.
17488
17743
  *
17489
17744
  * Behavior on the hub:
@@ -20871,17 +21126,25 @@ var NcScheduleSchema = object({
20871
21126
  */
20872
21127
  var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
20873
21128
  /**
21129
+ * How a summary window is SENT (D698): `rule` (absent) = ONE notification with
21130
+ * every section; `section` = one notification per section with something to
21131
+ * say (an unavailable section included), each titled by its section.
21132
+ */
21133
+ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
21134
+ /**
20874
21135
  * `summary`: the rule sends NOTHING per event. When a window of `schedule`
20875
21136
  * CLOSES, it sends one notification with the current state of its kinds
20876
21137
  * (low batteries, consumables to replace, devices offline, updates
20877
- * available, ...), after its own filters. Nothing to report sends nothing.
21138
+ * available, ...), after its own filters — or, with `split: 'section'`
21139
+ * (D698), one notification per section. Nothing to report sends nothing.
20878
21140
  * The schedule is the ordinary `NcSchedule` (weekly windows, IANA timezone,
20879
21141
  * midnight crossing); the send time is each window's END. Refused on the
20880
21142
  * `alarm` family, which stays instant (`systemEventDeliveryProblems`).
20881
21143
  */
20882
21144
  var NcSystemEventDeliverySchema = discriminatedUnion("mode", [object({ mode: literal("instant") }), object({
20883
21145
  mode: literal("summary"),
20884
- schedule: NcScheduleSchema
21146
+ schedule: NcScheduleSchema,
21147
+ split: NcStateSummarySplitSchema.optional()
20885
21148
  })]);
20886
21149
  /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
20887
21150
  var NcPlateMatcherSchema = object({
@@ -21532,10 +21795,12 @@ var NcMediaPolicySchema = object({
21532
21795
  /**
21533
21796
  * Cooldown GRANULARITY over the subject's class — how much a fired
21534
21797
  * notification suppresses.
21535
- * - `shared` (default, and the absent value) — one window for the whole
21536
- * rule/scope: a cat silences the next dog for `cooldownSec`.
21537
- * - `per-class` — an independent window per detected class, so cat→dog fires
21538
- * at once and cat→cat still waits.
21798
+ * - `per-class` (default, and the absent value since 2026-10-01 — D36) — an
21799
+ * independent window per detected class: cat→dog fires at once, cat→cat
21800
+ * still waits.
21801
+ * - `shared` — one window for the whole rule/scope: a cat silences the next
21802
+ * dog for `cooldownSec`. Only written when an operator picks it; it is no
21803
+ * longer what an unset rule means.
21539
21804
  *
21540
21805
  * AUDIO subjects are ALWAYS per-class regardless of this setting: a scream
21541
21806
  * must not be swallowed by a bark's window (the precedent this generalizes —
@@ -21550,8 +21815,11 @@ var NcThrottleSchema = object({
21550
21815
  /**
21551
21816
  * Class granularity of the cooldown key. Optional rather than defaulted:
21552
21817
  * a Zod default does NOT run on the addon→addon cap path, so a persisted
21553
- * rule authored before this field simply carries none — and the engine
21554
- * reads absent as `shared`, the pre-existing behaviour.
21818
+ * rule authored before this field simply carries none. The engine used to
21819
+ * read absent as `shared` (D36); since 2026-10-01 it reads absent as
21820
+ * `per-class` — the operator's default — and only an explicit `shared`
21821
+ * still means `shared`. See `cooldownKey` / `keysPerClass` in the rule
21822
+ * engine, and D36's dated note.
21555
21823
  */
21556
21824
  granularity: NcThrottleGranularitySchema.optional()
21557
21825
  });
@@ -21875,11 +22143,23 @@ var NcStateSummaryPreviewSectionSchema = object({
21875
22143
  reason: string().optional()
21876
22144
  });
21877
22145
  /**
22146
+ * One notification a previewed summary would send (D698): the whole summary on
22147
+ * a `rule` split (no `section`), one section's on a `section` split.
22148
+ */
22149
+ var NcStateSummaryPreviewRowSchema = object({
22150
+ section: string().optional(),
22151
+ /** The section's name on a per-section row; every reported section's, joined, on a combined one. */
22152
+ title: string(),
22153
+ text: string(),
22154
+ count: number().int().nonnegative()
22155
+ });
22156
+ /**
21878
22157
  * The summary a rule would send now. `empty` = nothing to report and every
21879
22158
  * section read: such a summary is NOT sent. `dropped` counts the open states
21880
22159
  * the rule's own filters (or a camera mute) left out, by reason.
21881
22160
  * `excludedGroups` names the kind groups selected that have no state to report
21882
- * (backups & exports).
22161
+ * (backups & exports). `split` and `rows` (D698) say how it would be sent —
22162
+ * optional, so an older hub's answer still parses.
21883
22163
  */
21884
22164
  var NcStateSummaryPreviewSchema = object({
21885
22165
  empty: boolean(),
@@ -21887,7 +22167,9 @@ var NcStateSummaryPreviewSchema = object({
21887
22167
  text: string(),
21888
22168
  sections: array(NcStateSummaryPreviewSectionSchema),
21889
22169
  dropped: record(string(), number().int().nonnegative()),
21890
- excludedGroups: array(string())
22170
+ excludedGroups: array(string()),
22171
+ split: NcStateSummarySplitSchema.optional(),
22172
+ rows: array(NcStateSummaryPreviewRowSchema).optional()
21891
22173
  });
21892
22174
  var NcTestResultSchema = object({
21893
22175
  recordId: string(),
@@ -23616,12 +23898,26 @@ var CameraSensorRefSchema = object({
23616
23898
  function cameraSensorRefKey(ref) {
23617
23899
  return `${ref.addonId}/${ref.stableId}`;
23618
23900
  }
23619
- /** CS-1 accepts exactly one mode; CS-2 (D673) widens it to confirm / replace. */
23620
- var CameraSensorsModeSchema = _enum(["in-addition"]);
23621
- var CameraSensorsConfigSchema = object({
23622
- mode: CameraSensorsModeSchema,
23623
- sensors: array(CameraSensorRefSchema).min(1).max(8)
23624
- }).superRefine((value, ctx) => {
23901
+ /**
23902
+ * A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
23903
+ * `replace`: its motion is the camera's, and while one is READY the camera's
23904
+ * own motion no longer counts on its own. `confirm`: while one is READY the
23905
+ * camera's own motion counts only while a confirm sensor is active — with or
23906
+ * without a replace sensor (spec C2, the controller's ruling on Q1).
23907
+ */
23908
+ var CameraSensorModeSchema = _enum([
23909
+ "in-addition",
23910
+ "confirm",
23911
+ "replace"
23912
+ ]);
23913
+ /** A stored sensor with no mode — every CS-1 row — is in addition. */
23914
+ var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
23915
+ /**
23916
+ * A camera's attached sensors. A CS-1 row carried an envelope
23917
+ * `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
23918
+ * what the write stores (D672 rule 3), so it is never written again.
23919
+ */
23920
+ var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
23625
23921
  const seen = /* @__PURE__ */ new Set();
23626
23922
  value.sensors.forEach((ref, index) => {
23627
23923
  const key = cameraSensorRefKey(ref);
@@ -23633,39 +23929,41 @@ var CameraSensorsConfigSchema = object({
23633
23929
  seen.add(key);
23634
23930
  });
23635
23931
  });
23636
- var RefFields = {
23932
+ /** Every attachment names its mode; an older orchestrator that does not is in addition. */
23933
+ var AttachmentFields = {
23637
23934
  addonId: string(),
23638
- stableId: string()
23935
+ stableId: string(),
23936
+ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
23639
23937
  };
23640
23938
  var CameraSensorAttachmentSchema = discriminatedUnion("state", [
23641
23939
  object({
23642
- ...RefFields,
23940
+ ...AttachmentFields,
23643
23941
  state: literal("ready"),
23644
23942
  deviceId: number(),
23645
23943
  name: string(),
23646
23944
  caps: array(string()).readonly()
23647
23945
  }),
23648
23946
  object({
23649
- ...RefFields,
23947
+ ...AttachmentFields,
23650
23948
  state: literal("offline"),
23651
23949
  deviceId: number(),
23652
23950
  name: string(),
23653
23951
  reason: _enum(["offline", "disabled"])
23654
23952
  }),
23655
23953
  object({
23656
- ...RefFields,
23954
+ ...AttachmentFields,
23657
23955
  state: literal("missing"),
23658
23956
  reason: string()
23659
23957
  }),
23660
23958
  object({
23661
- ...RefFields,
23959
+ ...AttachmentFields,
23662
23960
  state: literal("unsupported"),
23663
23961
  deviceId: number(),
23664
23962
  name: string(),
23665
23963
  reason: string()
23666
23964
  }),
23667
23965
  object({
23668
- ...RefFields,
23966
+ ...AttachmentFields,
23669
23967
  state: literal("unreadable"),
23670
23968
  reason: string()
23671
23969
  })
@@ -23678,17 +23976,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
23678
23976
  * say.
23679
23977
  */
23680
23978
  var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
23979
+ /** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
23980
+ var CameraOwnMotionSchema = _enum([
23981
+ "always",
23982
+ "when-confirmed",
23983
+ "never"
23984
+ ]);
23985
+ /** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
23986
+ var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
23987
+ /**
23988
+ * The camera's OWN onboard motion (D696): the raw input the bridge combines,
23989
+ * never the effective value. The camera's `motion` slice is the effective one,
23990
+ * so a view of the camera's own row reads this.
23991
+ * - `atMs`: when the bridge received the camera's last own edge.
23992
+ * - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
23993
+ * AND it is younger than the window the bridge counts the camera's own motion
23994
+ * for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
23995
+ * sends a clear (heartbeats only) therefore reads `false` once no push came
23996
+ * within the window; a status read is a snapshot, so a live view re-asks.
23997
+ * Absent = this orchestrator has not received the camera's own motion since it
23998
+ * started (unknown, never "quiet"), or an orchestrator older than D696.
23999
+ */
24000
+ var CameraRawLevelSchema = object({
24001
+ detected: boolean(),
24002
+ atMs: number()
24003
+ });
23681
24004
  var CameraSensorsStatusSchema = discriminatedUnion("state", [
23682
- object({ state: literal("not-configured") }),
24005
+ object({
24006
+ state: literal("not-configured"),
24007
+ cameraLevel: CameraRawLevelSchema.optional()
24008
+ }),
23683
24009
  object({
23684
24010
  state: literal("unreadable"),
23685
- reason: string()
24011
+ reason: string(),
24012
+ cameraLevel: CameraRawLevelSchema.optional()
23686
24013
  }),
23687
24014
  object({
23688
24015
  state: literal("configured"),
23689
- mode: CameraSensorsModeSchema,
24016
+ cameraLevel: CameraRawLevelSchema.optional(),
23690
24017
  sensors: array(CameraSensorAttachmentSchema).readonly(),
23691
- notForwarded: CameraSensorsNotForwardedSchema.optional()
24018
+ /** Absent = an orchestrator older than CS-2: it does not say (D315). */
24019
+ cameraMotion: CameraOwnMotionSchema.optional(),
24020
+ notForwarded: CameraSensorsNotForwardedSchema.optional(),
24021
+ notEnforced: CameraSensorsNotEnforcedSchema.optional()
23692
24022
  })
23693
24023
  ]);
23694
24024
  Object.freeze({
@@ -27775,8 +28105,10 @@ var RunnerCameraConfigSchema = object({
27775
28105
  * - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
27776
28106
  * analyzer providers) running on decoded frames in this runner.
27777
28107
  * - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
27778
- * analytics). The provider emits ProviderMotion
27779
- * events; the orchestrator forwards to `reportMotion`.
28108
+ * analytics). The provider emits its raw push as `ProviderMotion`
28109
+ * (D673); the orchestrator's camera-sensors bridge re-emits the camera's
28110
+ * effective motion as `MotionOnMotionChanged`, which is what reaches
28111
+ * `reportMotion`.
27780
28112
  */
27781
28113
  motionSources: MotionSourcesSchema.default(["analyzer"]),
27782
28114
  /**
@@ -27953,7 +28285,15 @@ var RunnerLocalLoadSchema = object({
27953
28285
  hasGpu: boolean(),
27954
28286
  inferenceBackend: string().optional(),
27955
28287
  cpuCores: number().optional()
27956
- })
28288
+ }),
28289
+ /**
28290
+ * Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
28291
+ * runner never writes it. ABSENT = a runner older than D696, which still
28292
+ * writes the slice from its phase machine; the orchestrator does not write
28293
+ * while any runner node is absent-or-unanswered, so one slice never has two
28294
+ * writers.
28295
+ */
28296
+ motionSliceWriter: literal("orchestrator").optional()
27957
28297
  });
27958
28298
  /**
27959
28299
  * Aggregate runtime metrics for the runner's whole local pool. Mirrors the
@@ -32225,251 +32565,6 @@ var videoclipsCapability = {
32225
32565
  }
32226
32566
  };
32227
32567
  /**
32228
- * Doorbell button cap. Two kinds of providers coexist behind this cap
32229
- * name (same pattern as `snapshot`):
32230
- *
32231
- * - **Native** providers: registered per-device by device-driver
32232
- * addons via `ctx.registerNativeCap` — either on a
32233
- * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
32234
- * or directly on the camera (Reolink registers at camera level).
32235
- * Emits an `onPressed` event every time the firmware pushes a
32236
- * ring; status tracks the last press and a pressCount since start
32237
- * (diagnostic).
32238
- *
32239
- * - **Wrapper** provider: the `virtual-doorbell` system builtin
32240
- * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
32241
- * device (contact / switch / event-emitter …) into a doorbell for
32242
- * a camera. `defaultActive: false` — the operator explicitly binds
32243
- * it per camera in the device-bindings UI, then picks the source
32244
- * device + trigger in the per-device settings.
32245
- *
32246
- * The DeviceEventPropagator re-emits `onPressed` on the camera parent
32247
- * — subscribers listening at the camera level receive ring events
32248
- * with `via[]` populated. No code on the parent needed.
32249
- */
32250
- var DoorbellStatusSchema = object({
32251
- /** Ms epoch of the last press. null = never observed since this provider started. */
32252
- lastPressedAt: number().nullable(),
32253
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
32254
- pressCountSinceStart: number()
32255
- });
32256
- var DoorbellPressEventSchema = object({
32257
- deviceId: number(),
32258
- timestamp: number()
32259
- });
32260
- /**
32261
- * The `doorbell-source` extension slot's editable value (D648): the camera's
32262
- * virtual-doorbell trigger devices, exactly what the wrapper's
32263
- * `doorbellSources` persists (as `{ deviceId }` records).
32264
- */
32265
- var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
32266
- /**
32267
- * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
32268
- * doorbell, owned by the `virtual-doorbell` wrapper over its
32269
- * `doorbellSources` store (D648). A source rings when one of its
32270
- * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
32271
- * different authority (`deviceManager.setWrapperActive`, D62) — the slot
32272
- * reports it, it never writes it.
32273
- */
32274
- var DOORBELL_SOURCE_SLOT = {
32275
- id: "doorbell-source",
32276
- label: "Doorbell trigger devices",
32277
- description: "Any of these becoming active rings this camera's virtual doorbell: a binary sensor when it goes active, a switch when it turns on.",
32278
- shape: "association",
32279
- hostDeviceTypes: [DeviceType.Camera],
32280
- sourceCaps: SOURCE_CAPS,
32281
- cardinality: "many",
32282
- value: DoorbellSourceSlotValueSchema
32283
- };
32284
- var doorbellCapability = {
32285
- name: "doorbell",
32286
- scope: "device",
32287
- deviceNative: true,
32288
- mode: "singleton",
32289
- kind: "wrapper",
32290
- defaultActive: false,
32291
- deviceTypes: [DeviceType.Button, DeviceType.Camera],
32292
- extensionSlots: [DOORBELL_SOURCE_SLOT],
32293
- methods: {},
32294
- events: {
32295
- /**
32296
- * Fires once per physical press. Reolink delivers via Baichuan
32297
- * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
32298
- * release/duration — it's a pulse.
32299
- */
32300
- onPressed: {
32301
- data: DoorbellPressEventSchema,
32302
- fromState: {
32303
- field: "lastPressedAt",
32304
- on: "advance"
32305
- }
32306
- } },
32307
- status: {
32308
- schema: DoorbellStatusSchema,
32309
- kind: "push"
32310
- },
32311
- /**
32312
- * Runtime-state slice — last press timestamp + lifetime press count.
32313
- * Mirrored by the kernel and readable via
32314
- * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
32315
- * without subscribing.
32316
- */
32317
- runtimeState: DoorbellStatusSchema,
32318
- /**
32319
- * Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
32320
- *
32321
- * See `RuntimeStateDurability`. Enforced by
32322
- * `scripts/check-runtime-state-durability.ts`.
32323
- */
32324
- durability: "restored"
32325
- };
32326
- var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
32327
- DeviceType.Camera, DeviceType.Camera;
32328
- /** A slot's editable value, discriminated on `slot`. */
32329
- var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
32330
- /** Every device type at least one slot is offered on — `device-extension`'s `deviceTypes`. */
32331
- var EXTENSION_HOST_DEVICE_TYPES = [DeviceType.Camera];
32332
- var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
32333
- state: literal("unreachable"),
32334
- reason: string()
32335
- })]);
32336
- /** One provider of slots — the D554 source-listing row. */
32337
- var ExtensionSourceSchema = object({
32338
- /** The routing prefix of every `slotRef` this provider serves. */
32339
- source: string(),
32340
- label: string(),
32341
- /** Stamped by the dispatcher from the registry (D557). */
32342
- addonId: string().optional(),
32343
- availability: ExtensionSourceAvailabilitySchema
32344
- });
32345
- /**
32346
- * How one picked source stands. `missing` — no such device (deleted, or an id
32347
- * that never existed); `foreign` — a device the slot's owner cannot read from
32348
- * (a source owned by another addon); `unavailable` — it exists but is not a
32349
- * valid source now (a container, which is never a pick). A source in any of
32350
- * these states is SHOWN, never silently dropped or re-pointed.
32351
- */
32352
- var ExtensionSourceHealthSchema = _enum([
32353
- "ok",
32354
- "missing",
32355
- "foreign",
32356
- "unavailable"
32357
- ]);
32358
- var ExtensionSlotSourceSchema = object({
32359
- deviceId: number().int(),
32360
- /** The device's name, or null when it could not be resolved (`missing`). */
32361
- name: string().nullable(),
32362
- health: ExtensionSourceHealthSchema,
32363
- detail: string().optional()
32364
- });
32365
- /**
32366
- * A DIFFERENT authority that gates whether the slot's sources do anything —
32367
- * reported read-only, named, never written through this contract (D62). The
32368
- * virtual doorbell's sources ring only while the wrapper is bound to the
32369
- * camera, and that binding belongs to `deviceManager.setWrapperActive`.
32370
- * `unknown` means the gate could not be read; it is not "inactive" (D315).
32371
- */
32372
- var ExtensionSlotActivationSchema = object({
32373
- state: _enum([
32374
- "active",
32375
- "inactive",
32376
- "unknown"
32377
- ]),
32378
- authority: string(),
32379
- detail: string().optional()
32380
- });
32381
- var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
32382
- state: literal("ok"),
32383
- /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
32384
- slotRef: string(),
32385
- slot: ExtensionSlotIdSchema,
32386
- /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
32387
- authority: string(),
32388
- activation: ExtensionSlotActivationSchema.nullable(),
32389
- value: ExtensionSlotValueSchema,
32390
- sources: array(ExtensionSlotSourceSchema),
32391
- /**
32392
- * Devices the owner links to the host ON ITS OWN, by structure, and that
32393
- * are therefore not in `value` (D655): a camera's device-tree children, and
32394
- * the child a picked container stands for (D356 — a container is never a
32395
- * pick, its children are). Read-only; the editor shows them and may offer
32396
- * per-device options on them (the linked-devices tracked-event opt-in).
32397
- * Absent when the owner links nothing beyond the picks, and from an owner
32398
- * older than D655.
32399
- */
32400
- impliedSources: array(ExtensionSlotSourceSchema).optional()
32401
- }), object({
32402
- state: literal("unreachable"),
32403
- addonId: string(),
32404
- reason: string()
32405
- })]);
32406
- var ExtensionCandidatesSchema = object({ candidates: array(object({
32407
- deviceId: number().int(),
32408
- name: string(),
32409
- type: string(),
32410
- location: string().nullable(),
32411
- /** The container a child belongs to — "Spotlight 2" alone does not say which. */
32412
- parentName: string().nullable(),
32413
- /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
32414
- suggested: boolean(),
32415
- /** Why it is suggested ("same location"), null when it is not. */
32416
- reason: string().nullable()
32417
- })) });
32418
- /**
32419
- * What a write did. `none` — applied in place. `host` / `parent` — the owner
32420
- * reloaded the host (or, for an accessory child, its parent) because the
32421
- * write changed what the host REGISTERS. A slot never adds a capability to its
32422
- * host — that is a composition (D663) — so today's owners answer `none`.
32423
- */
32424
- var ExtensionSetResultSchema = object({
32425
- applied: literal(true),
32426
- reload: _enum([
32427
- "none",
32428
- "host",
32429
- "parent"
32430
- ])
32431
- });
32432
- var ExtensionSlotRefInputSchema = object({
32433
- deviceId: number().int(),
32434
- slotRef: string().min(1)
32435
- });
32436
- var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
32437
- var deviceExtensionCapability = {
32438
- name: "device-extension",
32439
- scope: "device",
32440
- mode: "collection",
32441
- kind: "wrapper",
32442
- defaultActive: true,
32443
- deviceTypes: EXTENSION_HOST_DEVICE_TYPES,
32444
- deviceConfig: { ui: {
32445
- kind: "widget",
32446
- widgetId: "host/extensions-panel",
32447
- tab: "general",
32448
- label: "Extensions",
32449
- order: 72
32450
- } },
32451
- methods: {
32452
- /** One row per slot owner — the D554 source listing `slotRef` routes by. */
32453
- listSources: method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)),
32454
- /**
32455
- * Every slot this device is offered, read by each owner from its own
32456
- * store. A provider that throws is ONE `unreachable` row (D554.4).
32457
- */
32458
- listSlots: method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)),
32459
- /** The devices the slot's editor may offer, suggestions pre-marked (D356). */
32460
- listCandidates: method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema),
32461
- /**
32462
- * Write one slot through its owner's EXISTING write path. The owner
32463
- * validates (a container is never a linked device, a camera is never its
32464
- * own source) and refuses by name before persisting.
32465
- */
32466
- setSlot: method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
32467
- kind: "mutation",
32468
- auth: "admin"
32469
- })
32470
- }
32471
- };
32472
- /**
32473
32568
  * Optional client-side hints sent at session creation to help the provider
32474
32569
  * pick the best native source. All fields optional — a viewer that knows
32475
32570
  * nothing still gets a sane default. (Relocated from the retired `webrtc`
@@ -35355,6 +35450,70 @@ onStatusChanged: { data: object({
35355
35450
  * whether persisting is worth a SQLite commit. */
35356
35451
  volatileStateFields: ["lastChangedAt"]
35357
35452
  };
35453
+ var DoorbellStatusSchema = object({
35454
+ /** Ms epoch of the last press. null = never observed since this provider started. */
35455
+ lastPressedAt: number().nullable(),
35456
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
35457
+ pressCountSinceStart: number()
35458
+ });
35459
+ var DoorbellPressEventSchema = object({
35460
+ deviceId: number(),
35461
+ timestamp: number()
35462
+ });
35463
+ /**
35464
+ * Doorbell button cap. Two kinds of provider serve it, and to every consumer
35465
+ * they are the same cap:
35466
+ *
35467
+ * - **Native** providers, registered per device by a driver addon through
35468
+ * `ctx.registerNativeCap` — a `DeviceType.Button` accessory with
35469
+ * `role: DeviceRole.Doorbell`, or the camera itself (Reolink registers at
35470
+ * camera level). They emit `onPressed` on every firmware ring.
35471
+ * - **A composed doorbell** (D670, D671): a camera's customization gives it
35472
+ * the cap, its `lastPressedAt` rising from the sources the operator
35473
+ * assigned in Customize → Doorbell, and the composer emits `onPressed`
35474
+ * from that field's advance (`fromState`).
35475
+ *
35476
+ * The DeviceEventPropagator re-emits `onPressed` on the camera parent.
35477
+ */
35478
+ var doorbellCapability = {
35479
+ name: "doorbell",
35480
+ scope: "device",
35481
+ deviceNative: true,
35482
+ mode: "singleton",
35483
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
35484
+ methods: {},
35485
+ events: {
35486
+ /**
35487
+ * Fires once per physical press. Reolink delivers via Baichuan
35488
+ * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
35489
+ * release/duration — it's a pulse.
35490
+ */
35491
+ onPressed: {
35492
+ data: DoorbellPressEventSchema,
35493
+ fromState: {
35494
+ field: "lastPressedAt",
35495
+ on: "advance"
35496
+ }
35497
+ } },
35498
+ status: {
35499
+ schema: DoorbellStatusSchema,
35500
+ kind: "push"
35501
+ },
35502
+ /**
35503
+ * Runtime-state slice — last press timestamp + lifetime press count.
35504
+ * Mirrored by the kernel and readable via
35505
+ * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
35506
+ * without subscribing.
35507
+ */
35508
+ runtimeState: DoorbellStatusSchema,
35509
+ /**
35510
+ * Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
35511
+ *
35512
+ * See `RuntimeStateDurability`. Enforced by
35513
+ * `scripts/check-runtime-state-durability.ts`.
35514
+ */
35515
+ durability: "restored"
35516
+ };
35358
35517
  /**
35359
35518
  * Enum-state sensor — a string value picked from a finite option set.
35360
35519
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -37734,9 +37893,9 @@ var MotionStatusSchema = object({
37734
37893
  /** Ms epoch of the last detected-true observation. Null if never detected. */
37735
37894
  lastDetectedAt: number().nullable(),
37736
37895
  /**
37737
- * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
37738
- * `null` while false and on every `Sensor` device (D475) — see that
37739
- * constant's doc for the one-authority rule.
37896
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
37897
+ * orchestrator writes it, D696), `null` while false and on every `Sensor`
37898
+ * device (D475) — see that constant's doc for the one-authority rule.
37740
37899
  *
37741
37900
  * ## Reading this field still arms nothing
37742
37901
  *
@@ -37754,34 +37913,31 @@ var MotionStatusSchema = object({
37754
37913
  * `addon-export-alexa/src/motion-clear-hold.ts` and
37755
37914
  * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
37756
37915
  *
37757
- * ## Who writes it
37758
- *
37759
- * - **Cameras** — the runner's phase machine, `active → watching` on
37760
- * `cooldown_expired`, which then writes this slice with
37761
- * `detected: false` (`handlePhaseChanged` in
37762
- * `pipeline-runner/index.ts`). It produces the FALLING edge, which
37763
- * matters most for the sources that only ever push a rising one:
37764
- * Reolink emits `MotionOnMotionChanged { detected: true }` and never
37765
- * a false.
37766
- * - **Sensors** (Home Assistant binary sensors, Homematic) — the
37767
- * provider pushes the false itself, from the upstream system's own
37768
- * state change. No phase machine is involved.
37769
- *
37770
- * ### The phase machine is CANONICAL, not sole — and that is a defect
37771
- *
37772
- * An earlier revision of this docblock (mine, 2026-09-12) claimed the
37773
- * phase machine is the sole writer for a camera. It is not.
37774
- * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
37775
- * `setCapSlice(motionCapability, …)` on their own rising edge, and
37776
- * Hikvision's comment says why: it read THIS docblock, agreed the
37777
- * runner is canonical, and wrote anyway to avoid per-tick churn. So
37778
- * two authorities can disagree about one slice, which this repo
37779
- * forbids, and the doc said otherwise — which is worse than saying
37780
- * nothing, because it reads as verification.
37781
- *
37782
- * This predates D475 and is not fixed there: the fix touches every
37783
- * camera provider. Recorded in D475's Consequences. Do not restore the
37784
- * "sole writer" wording without also removing the other writers.
37916
+ * ## Who writes it (D696)
37917
+ *
37918
+ * - **Cameras** — the orchestrator, and nothing else. It writes the camera's
37919
+ * EFFECTIVE motion (`addon-pipeline-orchestrator`
37920
+ * `camera-sensors/motion-slice.ts`), alongside the effective
37921
+ * `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
37922
+ * for a split camera, an unsplit emitter's direct event, the analyzer and
37923
+ * device activity, as the camera's `motionSources` counts them. A source
37924
+ * that never sends a clear falls one window after its last `true`.
37925
+ * `lastDetectedAt` moves only on an effective rise. No camera provider
37926
+ * writes this slice (not even a boot seed), and neither does the runner's
37927
+ * phase machine: its phase is "a session is attached" for every on-motion
37928
+ * session, not motion, and it now has its own `DetectionPhaseTransition`.
37929
+ * A provider's `isDetected` answers from the hub's slice.
37930
+ * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
37931
+ * imports) — the provider pushes both edges itself, from the upstream
37932
+ * system's own state change. That is the sensor's own fact.
37933
+ *
37934
+ * `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
37935
+ * `motion` slice; each sensor writer is a named exemption.
37936
+ *
37937
+ * This replaces the D475 §4 rule ("the phase machine is the sole writer").
37938
+ * That rule was never true: Hikvision and Amcrest wrote the slice raw beside
37939
+ * it, every provider seeded it at boot, and every session left it
37940
+ * `detected: true` after its detach.
37785
37941
  */
37786
37942
  autoClearAfterMs: number().nullable()
37787
37943
  });
@@ -37853,11 +38009,12 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
37853
38009
  */
37854
38010
  runtimeState: MotionStatusSchema,
37855
38011
  /**
37856
- * Runtime-state durability: **session** — every writer of this slice
38012
+ * Runtime-state durability: **session** — the writer of this slice
37857
38013
  * writes only on an EDGE, so a restored `detected: true` would stay
37858
38014
  * frozen until the next one instead of being corrected. The next edge
37859
- * re-publishes the real state. (On who the writers are, and why there
37860
- * is more than one, see `autoClearAfterMs` above.)
38015
+ * re-publishes the real state, and the orchestrator re-publishes every
38016
+ * camera when it starts writing (D696; on who writes it, see
38017
+ * `autoClearAfterMs` above).
37861
38018
  *
37862
38019
  * See `RuntimeStateDurability`. Enforced by
37863
38020
  * `scripts/check-runtime-state-durability.ts`.
@@ -40528,8 +40685,7 @@ var ptzAutotrackCapability = {
40528
40685
  deviceNative: true,
40529
40686
  mode: "singleton",
40530
40687
  /**
40531
- * Two kinds of provider behind one name, the same shape `snapshot` and
40532
- * `doorbell` use:
40688
+ * Two kinds of provider behind one name, the same shape `snapshot` uses:
40533
40689
  *
40534
40690
  * - **Native**: the camera's own firmware autotrack, registered per device by
40535
40691
  * the driver when the probe says it exists (Reolink: yes; Hikvision:
@@ -40537,7 +40693,7 @@ var ptzAutotrackCapability = {
40537
40693
  * - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
40538
40694
  * which follows a subject with `ptz.move` pulses driven by the detection
40539
40695
  * pipeline. `defaultActive: false` — the operator binds it per camera in
40540
- * the bindings UI, exactly as `virtual-doorbell` is bound.
40696
+ * the bindings UI.
40541
40697
  *
40542
40698
  * The binding chooses WHICH implementation answers; `setEnabled` stays the
40543
40699
  * one switch for the function either way. A camera never has both driving its
@@ -46535,6 +46691,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
46535
46691
  coverCapability,
46536
46692
  customModelRegistryCapability,
46537
46693
  dataStoreProviderCapability,
46694
+ databaseSnapshotCapability,
46538
46695
  dayNightCapability,
46539
46696
  decoderCapability,
46540
46697
  detectionPipelineCapability,
@@ -47797,6 +47954,18 @@ Object.freeze({
47797
47954
  addonId: null,
47798
47955
  access: "view"
47799
47956
  },
47957
+ "databaseSnapshot.listDatabases": {
47958
+ capName: "database-snapshot",
47959
+ capScope: "system",
47960
+ addonId: null,
47961
+ access: "view"
47962
+ },
47963
+ "databaseSnapshot.writeSnapshot": {
47964
+ capName: "database-snapshot",
47965
+ capScope: "system",
47966
+ addonId: null,
47967
+ access: "create"
47968
+ },
47800
47969
  "dataStoreProvider.aggregate": {
47801
47970
  capName: "data-store-provider",
47802
47971
  capScope: "system",
@@ -56405,6 +56574,18 @@ var STATE_SUMMARY_VARS = [
56405
56574
  systemEventKinds: [...SUMMARISABLE],
56406
56575
  systemEventDeliveries: ["summary"]
56407
56576
  },
56577
+ {
56578
+ name: "summarySection",
56579
+ label: "Summary: this section",
56580
+ description: "The section a per-section summary row is about (D698); on a summary sent as one message, every section it reports, comma-separated.",
56581
+ example: "Batterie scariche",
56582
+ group: "system",
56583
+ families: ["rule"],
56584
+ fields: [...RULE_TEXT],
56585
+ kinds: ["system"],
56586
+ systemEventKinds: [...SUMMARISABLE],
56587
+ systemEventDeliveries: ["summary"]
56588
+ },
56408
56589
  ...STATE_SUMMARY_SECTION_VARS.map((v) => ({
56409
56590
  name: v.name,
56410
56591
  label: v.label,
@@ -56743,6 +56924,7 @@ TimelapseRuleInputSchema.extend({
56743
56924
  createdAt: number(),
56744
56925
  updatedAt: number()
56745
56926
  });
56927
+ MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
56746
56928
  object({
56747
56929
  /**
56748
56930
  * Fraction of the box's own size added on EACH side before cutting.