@camstack/addon-post-analysis 1.2.306 → 1.2.308

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.
@@ -12510,6 +12510,68 @@ method(object({
12510
12510
  password: string()
12511
12511
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
12512
12512
  /**
12513
+ * How long one snapshot may take end to end: the pinned copy of the whole
12514
+ * database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
12515
+ * disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
12516
+ * generous because a timeout fails the whole backup run.
12517
+ */
12518
+ var DATABASE_SNAPSHOT_TIMEOUT_MS = 30 * 6e4;
12519
+ /**
12520
+ * The databases an owner snapshots — declared by the OWNER, so a caller never
12521
+ * guesses which file is live from what sits beside it (a cleanly closed
12522
+ * database has no sidecars and is just as owned). Paths are absolute on the
12523
+ * owner's host.
12524
+ */
12525
+ var DatabaseSnapshotTargetsSchema = object({ databases: array(object({ livePath: string() })) });
12526
+ /** One b-tree table of the snapshot and the rows it holds. */
12527
+ var DatabaseSnapshotTableSchema = object({
12528
+ name: string(),
12529
+ rows: number().int().nonnegative()
12530
+ });
12531
+ /**
12532
+ * What the owner wrote. Every path is ABSOLUTE on the owner's host — the
12533
+ * caller pins the call to its own node, so it can read the file; a caller
12534
+ * that finds the path outside its own data root refuses it rather than
12535
+ * archiving something it cannot place.
12536
+ */
12537
+ var DatabaseSnapshotResultSchema = object({
12538
+ /** The live database the snapshot copies. Never to be copied as a file. */
12539
+ livePath: string(),
12540
+ /** The verified copy: `<livePath>` + {@link DATABASE_SNAPSHOT_SUFFIX}. */
12541
+ snapshotPath: string(),
12542
+ sizeBytes: number().int().nonnegative(),
12543
+ pageCount: number().int().nonnegative(),
12544
+ pageSize: number().int().positive(),
12545
+ /**
12546
+ * Every b-tree table with its row count. Read inside the SAME read
12547
+ * transaction the copy was taken from, and found EQUAL on the copy — so
12548
+ * this is the content of the snapshot, not an estimate of the source.
12549
+ */
12550
+ tables: array(DatabaseSnapshotTableSchema),
12551
+ /** Wall time of the pinned copy (row counts included). */
12552
+ copyMs: number().nonnegative(),
12553
+ /** Wall time of the checks on the copy (`integrity_check`, row counts). */
12554
+ verifyMs: number().nonnegative(),
12555
+ /** When the pinned read transaction began (ms epoch) — the snapshot's instant. */
12556
+ takenAt: number()
12557
+ });
12558
+ /**
12559
+ * A snapshot as an ARCHIVE records it (`ArchiveManifest.sqliteSnapshots`):
12560
+ * the same facts, with both paths relative to the archive root (the node's
12561
+ * data dir), because an archive outlives the host that made it.
12562
+ */
12563
+ var ArchiveSqliteSnapshotSchema = DatabaseSnapshotResultSchema.extend({
12564
+ /** Archive-relative path of the live database the archive does NOT carry. */
12565
+ livePath: string(),
12566
+ /** Archive-relative path of the verified copy it carries in its place. */
12567
+ snapshotPath: string()
12568
+ });
12569
+ method(object({}), DatabaseSnapshotTargetsSchema, { auth: "admin" }), method(object({}), DatabaseSnapshotResultSchema, {
12570
+ kind: "mutation",
12571
+ auth: "admin",
12572
+ timeoutMs: DATABASE_SNAPSHOT_TIMEOUT_MS
12573
+ });
12574
+ /**
12513
12575
  * Orchestrator-side destination metadata. The orchestrator computes
12514
12576
  * `id = <addonId>:<subId>` from its provider lookup so consumers
12515
12577
  * (admin UI, restore flow) see one canonical key.
@@ -12620,7 +12682,12 @@ var ArchiveManifestSchema = object({
12620
12682
  locations: array(string()),
12621
12683
  entries: array(ArchiveEntrySchema),
12622
12684
  totalBytes: number(),
12623
- totalFiles: number()
12685
+ totalFiles: number(),
12686
+ /**
12687
+ * Live SQLite databases this archive carries as their OWNER's verified
12688
+ * snapshot instead of as files (D693). Absent on archives made before.
12689
+ */
12690
+ sqliteSnapshots: array(ArchiveSqliteSnapshotSchema).optional()
12624
12691
  });
12625
12692
  var LocationStatSchema = object({
12626
12693
  name: string(),
@@ -14150,6 +14217,52 @@ var CompositionBlockStateSchema = object({
14150
14217
  reason: string().optional(),
14151
14218
  fields: array(CompositionFieldStateSchema)
14152
14219
  });
14220
+ var ComposerBlockSchema = object({
14221
+ id: string().min(1),
14222
+ name: string().min(1).max(120),
14223
+ enabled: boolean(),
14224
+ updatedAt: number(),
14225
+ composition: CompositionSchema
14226
+ });
14227
+ /**
14228
+ * A stored composition row that no longer PARSES — a schema a release
14229
+ * tightened, a row written by a newer build. Sent by id so the composer keeps
14230
+ * its device as a placeholder and reports the block `failed` naming the parse
14231
+ * error. Leaving it out would read, twice, exactly like a delete (D49).
14232
+ */
14233
+ var ComposerUnreadableBlockSchema = object({
14234
+ id: string().min(1),
14235
+ /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
14236
+ name: string().nullable(),
14237
+ /** The parse error, in the operator's words. */
14238
+ error: string()
14239
+ });
14240
+ method(object({
14241
+ /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
14242
+ integrationId: string().nullable(),
14243
+ /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
14244
+ storeLoaded: boolean(),
14245
+ blocks: array(ComposerBlockSchema),
14246
+ /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
14247
+ restartBlockIds: array(string()),
14248
+ /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
14249
+ unreadableBlocks: array(ComposerUnreadableBlockSchema)
14250
+ }), object({
14251
+ blocks: array(object({
14252
+ blockId: string(),
14253
+ status: CompositionRunStatusSchema,
14254
+ reason: string().optional()
14255
+ })),
14256
+ /**
14257
+ * False when the composer declared and withdrew NOTHING (store not loaded,
14258
+ * integration unknown, its own rows unread or read empty once). An empty
14259
+ * apply the caller owes is paid off only by one the composer acted on (D49).
14260
+ */
14261
+ acted: boolean()
14262
+ }), {
14263
+ kind: "mutation",
14264
+ auth: "admin"
14265
+ }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
14153
14266
  var NUMBER = {
14154
14267
  kind: "fixed",
14155
14268
  result: ["number"]
@@ -14386,52 +14499,6 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
14386
14499
  auth: "admin",
14387
14500
  access: "view"
14388
14501
  });
14389
- var ComposerBlockSchema = object({
14390
- id: string().min(1),
14391
- name: string().min(1).max(120),
14392
- enabled: boolean(),
14393
- updatedAt: number(),
14394
- composition: CompositionSchema
14395
- });
14396
- /**
14397
- * A stored composition row that no longer PARSES — a schema a release
14398
- * tightened, a row written by a newer build. Sent by id so the composer keeps
14399
- * its device as a placeholder and reports the block `failed` naming the parse
14400
- * error. Leaving it out would read, twice, exactly like a delete (D49).
14401
- */
14402
- var ComposerUnreadableBlockSchema = object({
14403
- id: string().min(1),
14404
- /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
14405
- name: string().nullable(),
14406
- /** The parse error, in the operator's words. */
14407
- error: string()
14408
- });
14409
- method(object({
14410
- /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
14411
- integrationId: string().nullable(),
14412
- /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
14413
- storeLoaded: boolean(),
14414
- blocks: array(ComposerBlockSchema),
14415
- /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
14416
- restartBlockIds: array(string()),
14417
- /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
14418
- unreadableBlocks: array(ComposerUnreadableBlockSchema)
14419
- }), object({
14420
- blocks: array(object({
14421
- blockId: string(),
14422
- status: CompositionRunStatusSchema,
14423
- reason: string().optional()
14424
- })),
14425
- /**
14426
- * False when the composer declared and withdrew NOTHING (store not loaded,
14427
- * integration unknown, its own rows unread or read empty once). An empty
14428
- * apply the caller owes is paid off only by one the composer acted on (D49).
14429
- */
14430
- acted: boolean()
14431
- }), {
14432
- kind: "mutation",
14433
- auth: "admin"
14434
- }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
14435
14502
  /**
14436
14503
  * `custom-model-registry` — collection cap exposing operator-registered
14437
14504
  * custom detection models. Each provider (today: `addon-model-studio`)
@@ -16380,13 +16447,226 @@ method(object({
16380
16447
  }), FieldProbeResultSchema, {
16381
16448
  kind: "mutation",
16382
16449
  auth: "admin"
16383
- }), method(object({
16384
- deviceId: number(),
16385
- caps: array(string()).readonly().optional()
16386
- }), record(string(), unknown().nullable())), method(object({
16387
- deviceIds: array(number()).readonly(),
16388
- caps: array(string()).readonly().optional()
16389
- }), record(string(), record(string(), unknown().nullable())));
16450
+ }), method(object({
16451
+ deviceId: number(),
16452
+ caps: array(string()).readonly().optional()
16453
+ }), record(string(), unknown().nullable())), method(object({
16454
+ deviceIds: array(number()).readonly(),
16455
+ caps: array(string()).readonly().optional()
16456
+ }), record(string(), record(string(), unknown().nullable())));
16457
+ /**
16458
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
16459
+ * name (same pattern as `snapshot`):
16460
+ *
16461
+ * - **Native** providers: registered per-device by device-driver
16462
+ * addons via `ctx.registerNativeCap` — either on a
16463
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
16464
+ * or directly on the camera (Reolink registers at camera level).
16465
+ * Emits an `onPressed` event every time the firmware pushes a
16466
+ * ring; status tracks the last press and a pressCount since start
16467
+ * (diagnostic).
16468
+ *
16469
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
16470
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
16471
+ * device (contact / switch / event-emitter …) into a doorbell for
16472
+ * a camera. `defaultActive: false` — the operator explicitly binds
16473
+ * it per camera in the device-bindings UI, then picks the source
16474
+ * device + trigger in the per-device settings.
16475
+ *
16476
+ * The DeviceEventPropagator re-emits `onPressed` on the camera parent
16477
+ * — subscribers listening at the camera level receive ring events
16478
+ * with `via[]` populated. No code on the parent needed.
16479
+ */
16480
+ var DoorbellStatusSchema = object({
16481
+ /** Ms epoch of the last press. null = never observed since this provider started. */
16482
+ lastPressedAt: number().nullable(),
16483
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
16484
+ pressCountSinceStart: number()
16485
+ });
16486
+ var DoorbellPressEventSchema = object({
16487
+ deviceId: number(),
16488
+ timestamp: number()
16489
+ });
16490
+ /**
16491
+ * The `doorbell-source` extension slot's editable value (D648): the camera's
16492
+ * virtual-doorbell trigger devices, exactly what the wrapper's
16493
+ * `doorbellSources` persists (as `{ deviceId }` records).
16494
+ */
16495
+ var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
16496
+ /**
16497
+ * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
16498
+ * doorbell, owned by the `virtual-doorbell` wrapper over its
16499
+ * `doorbellSources` store (D648). A source rings when one of its
16500
+ * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
16501
+ * different authority (`deviceManager.setWrapperActive`, D62) — the slot
16502
+ * reports it, it never writes it.
16503
+ */
16504
+ var DOORBELL_SOURCE_SLOT = {
16505
+ id: "doorbell-source",
16506
+ label: "Doorbell trigger devices",
16507
+ description: "Any of these becoming active rings this camera's virtual doorbell: a binary sensor when it goes active, a switch when it turns on.",
16508
+ shape: "association",
16509
+ hostDeviceTypes: [DeviceType.Camera],
16510
+ sourceCaps: SOURCE_CAPS,
16511
+ cardinality: "many",
16512
+ value: DoorbellSourceSlotValueSchema
16513
+ };
16514
+ var doorbellCapability = {
16515
+ name: "doorbell",
16516
+ scope: "device",
16517
+ deviceNative: true,
16518
+ mode: "singleton",
16519
+ kind: "wrapper",
16520
+ defaultActive: false,
16521
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
16522
+ extensionSlots: [DOORBELL_SOURCE_SLOT],
16523
+ methods: {},
16524
+ events: {
16525
+ /**
16526
+ * Fires once per physical press. Reolink delivers via Baichuan
16527
+ * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
16528
+ * release/duration — it's a pulse.
16529
+ */
16530
+ onPressed: {
16531
+ data: DoorbellPressEventSchema,
16532
+ fromState: {
16533
+ field: "lastPressedAt",
16534
+ on: "advance"
16535
+ }
16536
+ } },
16537
+ status: {
16538
+ schema: DoorbellStatusSchema,
16539
+ kind: "push"
16540
+ },
16541
+ /**
16542
+ * Runtime-state slice — last press timestamp + lifetime press count.
16543
+ * Mirrored by the kernel and readable via
16544
+ * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
16545
+ * without subscribing.
16546
+ */
16547
+ runtimeState: DoorbellStatusSchema,
16548
+ /**
16549
+ * Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
16550
+ *
16551
+ * See `RuntimeStateDurability`. Enforced by
16552
+ * `scripts/check-runtime-state-durability.ts`.
16553
+ */
16554
+ durability: "restored"
16555
+ };
16556
+ var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
16557
+ DeviceType.Camera, DeviceType.Camera;
16558
+ /** A slot's editable value, discriminated on `slot`. */
16559
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
16560
+ DeviceType.Camera;
16561
+ var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
16562
+ state: literal("unreachable"),
16563
+ reason: string()
16564
+ })]);
16565
+ /** One provider of slots — the D554 source-listing row. */
16566
+ var ExtensionSourceSchema = object({
16567
+ /** The routing prefix of every `slotRef` this provider serves. */
16568
+ source: string(),
16569
+ label: string(),
16570
+ /** Stamped by the dispatcher from the registry (D557). */
16571
+ addonId: string().optional(),
16572
+ availability: ExtensionSourceAvailabilitySchema
16573
+ });
16574
+ /**
16575
+ * How one picked source stands. `missing` — no such device (deleted, or an id
16576
+ * that never existed); `foreign` — a device the slot's owner cannot read from
16577
+ * (a source owned by another addon); `unavailable` — it exists but is not a
16578
+ * valid source now (a container, which is never a pick). A source in any of
16579
+ * these states is SHOWN, never silently dropped or re-pointed.
16580
+ */
16581
+ var ExtensionSourceHealthSchema = _enum([
16582
+ "ok",
16583
+ "missing",
16584
+ "foreign",
16585
+ "unavailable"
16586
+ ]);
16587
+ var ExtensionSlotSourceSchema = object({
16588
+ deviceId: number().int(),
16589
+ /** The device's name, or null when it could not be resolved (`missing`). */
16590
+ name: string().nullable(),
16591
+ health: ExtensionSourceHealthSchema,
16592
+ detail: string().optional()
16593
+ });
16594
+ /**
16595
+ * A DIFFERENT authority that gates whether the slot's sources do anything —
16596
+ * reported read-only, named, never written through this contract (D62). The
16597
+ * virtual doorbell's sources ring only while the wrapper is bound to the
16598
+ * camera, and that binding belongs to `deviceManager.setWrapperActive`.
16599
+ * `unknown` means the gate could not be read; it is not "inactive" (D315).
16600
+ */
16601
+ var ExtensionSlotActivationSchema = object({
16602
+ state: _enum([
16603
+ "active",
16604
+ "inactive",
16605
+ "unknown"
16606
+ ]),
16607
+ authority: string(),
16608
+ detail: string().optional()
16609
+ });
16610
+ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
16611
+ state: literal("ok"),
16612
+ /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
16613
+ slotRef: string(),
16614
+ slot: ExtensionSlotIdSchema,
16615
+ /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
16616
+ authority: string(),
16617
+ activation: ExtensionSlotActivationSchema.nullable(),
16618
+ value: ExtensionSlotValueSchema,
16619
+ sources: array(ExtensionSlotSourceSchema),
16620
+ /**
16621
+ * Devices the owner links to the host ON ITS OWN, by structure, and that
16622
+ * are therefore not in `value` (D655): a camera's device-tree children, and
16623
+ * the child a picked container stands for (D356 — a container is never a
16624
+ * pick, its children are). Read-only; the editor shows them and may offer
16625
+ * per-device options on them (the linked-devices tracked-event opt-in).
16626
+ * Absent when the owner links nothing beyond the picks, and from an owner
16627
+ * older than D655.
16628
+ */
16629
+ impliedSources: array(ExtensionSlotSourceSchema).optional()
16630
+ }), object({
16631
+ state: literal("unreachable"),
16632
+ addonId: string(),
16633
+ reason: string()
16634
+ })]);
16635
+ var ExtensionCandidatesSchema = object({ candidates: array(object({
16636
+ deviceId: number().int(),
16637
+ name: string(),
16638
+ type: string(),
16639
+ location: string().nullable(),
16640
+ /** The container a child belongs to — "Spotlight 2" alone does not say which. */
16641
+ parentName: string().nullable(),
16642
+ /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
16643
+ suggested: boolean(),
16644
+ /** Why it is suggested ("same location"), null when it is not. */
16645
+ reason: string().nullable()
16646
+ })) });
16647
+ /**
16648
+ * What a write did. `none` — applied in place. `host` / `parent` — the owner
16649
+ * reloaded the host (or, for an accessory child, its parent) because the
16650
+ * write changed what the host REGISTERS. A slot never adds a capability to its
16651
+ * host — that is a composition (D663) — so today's owners answer `none`.
16652
+ */
16653
+ var ExtensionSetResultSchema = object({
16654
+ applied: literal(true),
16655
+ reload: _enum([
16656
+ "none",
16657
+ "host",
16658
+ "parent"
16659
+ ])
16660
+ });
16661
+ var ExtensionSlotRefInputSchema = object({
16662
+ deviceId: number().int(),
16663
+ slotRef: string().min(1)
16664
+ });
16665
+ var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
16666
+ method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
16667
+ kind: "mutation",
16668
+ auth: "admin"
16669
+ });
16390
16670
  /**
16391
16671
  * Per-field ownership (D663). A composition may CLAIM fields of a native
16392
16672
  * cap's runtime-state slice on an existing device: `replace` overlays the
@@ -29701,219 +29981,6 @@ DeviceType.Camera, method(object({
29701
29981
  auth: "protected"
29702
29982
  });
29703
29983
  /**
29704
- * Doorbell button cap. Two kinds of providers coexist behind this cap
29705
- * name (same pattern as `snapshot`):
29706
- *
29707
- * - **Native** providers: registered per-device by device-driver
29708
- * addons via `ctx.registerNativeCap` — either on a
29709
- * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
29710
- * or directly on the camera (Reolink registers at camera level).
29711
- * Emits an `onPressed` event every time the firmware pushes a
29712
- * ring; status tracks the last press and a pressCount since start
29713
- * (diagnostic).
29714
- *
29715
- * - **Wrapper** provider: the `virtual-doorbell` system builtin
29716
- * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
29717
- * device (contact / switch / event-emitter …) into a doorbell for
29718
- * a camera. `defaultActive: false` — the operator explicitly binds
29719
- * it per camera in the device-bindings UI, then picks the source
29720
- * device + trigger in the per-device settings.
29721
- *
29722
- * The DeviceEventPropagator re-emits `onPressed` on the camera parent
29723
- * — subscribers listening at the camera level receive ring events
29724
- * with `via[]` populated. No code on the parent needed.
29725
- */
29726
- var DoorbellStatusSchema = object({
29727
- /** Ms epoch of the last press. null = never observed since this provider started. */
29728
- lastPressedAt: number().nullable(),
29729
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
29730
- pressCountSinceStart: number()
29731
- });
29732
- var DoorbellPressEventSchema = object({
29733
- deviceId: number(),
29734
- timestamp: number()
29735
- });
29736
- /**
29737
- * The `doorbell-source` extension slot's editable value (D648): the camera's
29738
- * virtual-doorbell trigger devices, exactly what the wrapper's
29739
- * `doorbellSources` persists (as `{ deviceId }` records).
29740
- */
29741
- var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
29742
- /**
29743
- * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
29744
- * doorbell, owned by the `virtual-doorbell` wrapper over its
29745
- * `doorbellSources` store (D648). A source rings when one of its
29746
- * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
29747
- * different authority (`deviceManager.setWrapperActive`, D62) — the slot
29748
- * reports it, it never writes it.
29749
- */
29750
- var DOORBELL_SOURCE_SLOT = {
29751
- id: "doorbell-source",
29752
- label: "Doorbell trigger devices",
29753
- 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.",
29754
- shape: "association",
29755
- hostDeviceTypes: [DeviceType.Camera],
29756
- sourceCaps: SOURCE_CAPS,
29757
- cardinality: "many",
29758
- value: DoorbellSourceSlotValueSchema
29759
- };
29760
- var doorbellCapability = {
29761
- name: "doorbell",
29762
- scope: "device",
29763
- deviceNative: true,
29764
- mode: "singleton",
29765
- kind: "wrapper",
29766
- defaultActive: false,
29767
- deviceTypes: [DeviceType.Button, DeviceType.Camera],
29768
- extensionSlots: [DOORBELL_SOURCE_SLOT],
29769
- methods: {},
29770
- events: {
29771
- /**
29772
- * Fires once per physical press. Reolink delivers via Baichuan
29773
- * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
29774
- * release/duration — it's a pulse.
29775
- */
29776
- onPressed: {
29777
- data: DoorbellPressEventSchema,
29778
- fromState: {
29779
- field: "lastPressedAt",
29780
- on: "advance"
29781
- }
29782
- } },
29783
- status: {
29784
- schema: DoorbellStatusSchema,
29785
- kind: "push"
29786
- },
29787
- /**
29788
- * Runtime-state slice — last press timestamp + lifetime press count.
29789
- * Mirrored by the kernel and readable via
29790
- * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
29791
- * without subscribing.
29792
- */
29793
- runtimeState: DoorbellStatusSchema,
29794
- /**
29795
- * 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.
29796
- *
29797
- * See `RuntimeStateDurability`. Enforced by
29798
- * `scripts/check-runtime-state-durability.ts`.
29799
- */
29800
- durability: "restored"
29801
- };
29802
- var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
29803
- DeviceType.Camera, DeviceType.Camera;
29804
- /** A slot's editable value, discriminated on `slot`. */
29805
- var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
29806
- DeviceType.Camera;
29807
- var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
29808
- state: literal("unreachable"),
29809
- reason: string()
29810
- })]);
29811
- /** One provider of slots — the D554 source-listing row. */
29812
- var ExtensionSourceSchema = object({
29813
- /** The routing prefix of every `slotRef` this provider serves. */
29814
- source: string(),
29815
- label: string(),
29816
- /** Stamped by the dispatcher from the registry (D557). */
29817
- addonId: string().optional(),
29818
- availability: ExtensionSourceAvailabilitySchema
29819
- });
29820
- /**
29821
- * How one picked source stands. `missing` — no such device (deleted, or an id
29822
- * that never existed); `foreign` — a device the slot's owner cannot read from
29823
- * (a source owned by another addon); `unavailable` — it exists but is not a
29824
- * valid source now (a container, which is never a pick). A source in any of
29825
- * these states is SHOWN, never silently dropped or re-pointed.
29826
- */
29827
- var ExtensionSourceHealthSchema = _enum([
29828
- "ok",
29829
- "missing",
29830
- "foreign",
29831
- "unavailable"
29832
- ]);
29833
- var ExtensionSlotSourceSchema = object({
29834
- deviceId: number().int(),
29835
- /** The device's name, or null when it could not be resolved (`missing`). */
29836
- name: string().nullable(),
29837
- health: ExtensionSourceHealthSchema,
29838
- detail: string().optional()
29839
- });
29840
- /**
29841
- * A DIFFERENT authority that gates whether the slot's sources do anything —
29842
- * reported read-only, named, never written through this contract (D62). The
29843
- * virtual doorbell's sources ring only while the wrapper is bound to the
29844
- * camera, and that binding belongs to `deviceManager.setWrapperActive`.
29845
- * `unknown` means the gate could not be read; it is not "inactive" (D315).
29846
- */
29847
- var ExtensionSlotActivationSchema = object({
29848
- state: _enum([
29849
- "active",
29850
- "inactive",
29851
- "unknown"
29852
- ]),
29853
- authority: string(),
29854
- detail: string().optional()
29855
- });
29856
- var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
29857
- state: literal("ok"),
29858
- /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
29859
- slotRef: string(),
29860
- slot: ExtensionSlotIdSchema,
29861
- /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
29862
- authority: string(),
29863
- activation: ExtensionSlotActivationSchema.nullable(),
29864
- value: ExtensionSlotValueSchema,
29865
- sources: array(ExtensionSlotSourceSchema),
29866
- /**
29867
- * Devices the owner links to the host ON ITS OWN, by structure, and that
29868
- * are therefore not in `value` (D655): a camera's device-tree children, and
29869
- * the child a picked container stands for (D356 — a container is never a
29870
- * pick, its children are). Read-only; the editor shows them and may offer
29871
- * per-device options on them (the linked-devices tracked-event opt-in).
29872
- * Absent when the owner links nothing beyond the picks, and from an owner
29873
- * older than D655.
29874
- */
29875
- impliedSources: array(ExtensionSlotSourceSchema).optional()
29876
- }), object({
29877
- state: literal("unreachable"),
29878
- addonId: string(),
29879
- reason: string()
29880
- })]);
29881
- var ExtensionCandidatesSchema = object({ candidates: array(object({
29882
- deviceId: number().int(),
29883
- name: string(),
29884
- type: string(),
29885
- location: string().nullable(),
29886
- /** The container a child belongs to — "Spotlight 2" alone does not say which. */
29887
- parentName: string().nullable(),
29888
- /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
29889
- suggested: boolean(),
29890
- /** Why it is suggested ("same location"), null when it is not. */
29891
- reason: string().nullable()
29892
- })) });
29893
- /**
29894
- * What a write did. `none` — applied in place. `host` / `parent` — the owner
29895
- * reloaded the host (or, for an accessory child, its parent) because the
29896
- * write changed what the host REGISTERS. A slot never adds a capability to its
29897
- * host — that is a composition (D663) — so today's owners answer `none`.
29898
- */
29899
- var ExtensionSetResultSchema = object({
29900
- applied: literal(true),
29901
- reload: _enum([
29902
- "none",
29903
- "host",
29904
- "parent"
29905
- ])
29906
- });
29907
- var ExtensionSlotRefInputSchema = object({
29908
- deviceId: number().int(),
29909
- slotRef: string().min(1)
29910
- });
29911
- var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
29912
- method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
29913
- kind: "mutation",
29914
- auth: "admin"
29915
- });
29916
- /**
29917
29984
  * Optional client-side hints sent at session creation to help the provider
29918
29985
  * pick the best native source. All fields optional — a viewer that knows
29919
29986
  * nothing still gets a sane default. (Relocated from the retired `webrtc`
@@ -44876,6 +44943,18 @@ Object.freeze({
44876
44943
  addonId: null,
44877
44944
  access: "view"
44878
44945
  },
44946
+ "databaseSnapshot.listDatabases": {
44947
+ capName: "database-snapshot",
44948
+ capScope: "system",
44949
+ addonId: null,
44950
+ access: "view"
44951
+ },
44952
+ "databaseSnapshot.writeSnapshot": {
44953
+ capName: "database-snapshot",
44954
+ capScope: "system",
44955
+ addonId: null,
44956
+ access: "create"
44957
+ },
44879
44958
  "dataStoreProvider.aggregate": {
44880
44959
  capName: "data-store-provider",
44881
44960
  capScope: "system",