@camstack/addon-provider-rtsp 1.2.116 → 1.2.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +476 -274
  2. package/dist/addon.mjs +476 -274
  3. package/package.json +2 -2
package/dist/addon.mjs CHANGED
@@ -11600,6 +11600,68 @@ method(object({
11600
11600
  password: string()
11601
11601
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
11602
11602
  /**
11603
+ * How long one snapshot may take end to end: the pinned copy of the whole
11604
+ * database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
11605
+ * disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
11606
+ * generous because a timeout fails the whole backup run.
11607
+ */
11608
+ var DATABASE_SNAPSHOT_TIMEOUT_MS = 30 * 6e4;
11609
+ /**
11610
+ * The databases an owner snapshots — declared by the OWNER, so a caller never
11611
+ * guesses which file is live from what sits beside it (a cleanly closed
11612
+ * database has no sidecars and is just as owned). Paths are absolute on the
11613
+ * owner's host.
11614
+ */
11615
+ var DatabaseSnapshotTargetsSchema = object({ databases: array(object({ livePath: string() })) });
11616
+ /** One b-tree table of the snapshot and the rows it holds. */
11617
+ var DatabaseSnapshotTableSchema = object({
11618
+ name: string(),
11619
+ rows: number().int().nonnegative()
11620
+ });
11621
+ /**
11622
+ * What the owner wrote. Every path is ABSOLUTE on the owner's host — the
11623
+ * caller pins the call to its own node, so it can read the file; a caller
11624
+ * that finds the path outside its own data root refuses it rather than
11625
+ * archiving something it cannot place.
11626
+ */
11627
+ var DatabaseSnapshotResultSchema = object({
11628
+ /** The live database the snapshot copies. Never to be copied as a file. */
11629
+ livePath: string(),
11630
+ /** The verified copy: `<livePath>` + {@link DATABASE_SNAPSHOT_SUFFIX}. */
11631
+ snapshotPath: string(),
11632
+ sizeBytes: number().int().nonnegative(),
11633
+ pageCount: number().int().nonnegative(),
11634
+ pageSize: number().int().positive(),
11635
+ /**
11636
+ * Every b-tree table with its row count. Read inside the SAME read
11637
+ * transaction the copy was taken from, and found EQUAL on the copy — so
11638
+ * this is the content of the snapshot, not an estimate of the source.
11639
+ */
11640
+ tables: array(DatabaseSnapshotTableSchema),
11641
+ /** Wall time of the pinned copy (row counts included). */
11642
+ copyMs: number().nonnegative(),
11643
+ /** Wall time of the checks on the copy (`integrity_check`, row counts). */
11644
+ verifyMs: number().nonnegative(),
11645
+ /** When the pinned read transaction began (ms epoch) — the snapshot's instant. */
11646
+ takenAt: number()
11647
+ });
11648
+ /**
11649
+ * A snapshot as an ARCHIVE records it (`ArchiveManifest.sqliteSnapshots`):
11650
+ * the same facts, with both paths relative to the archive root (the node's
11651
+ * data dir), because an archive outlives the host that made it.
11652
+ */
11653
+ var ArchiveSqliteSnapshotSchema = DatabaseSnapshotResultSchema.extend({
11654
+ /** Archive-relative path of the live database the archive does NOT carry. */
11655
+ livePath: string(),
11656
+ /** Archive-relative path of the verified copy it carries in its place. */
11657
+ snapshotPath: string()
11658
+ });
11659
+ method(object({}), DatabaseSnapshotTargetsSchema, { auth: "admin" }), method(object({}), DatabaseSnapshotResultSchema, {
11660
+ kind: "mutation",
11661
+ auth: "admin",
11662
+ timeoutMs: DATABASE_SNAPSHOT_TIMEOUT_MS
11663
+ });
11664
+ /**
11603
11665
  * Orchestrator-side destination metadata. The orchestrator computes
11604
11666
  * `id = <addonId>:<subId>` from its provider lookup so consumers
11605
11667
  * (admin UI, restore flow) see one canonical key.
@@ -11710,7 +11772,12 @@ var ArchiveManifestSchema = object({
11710
11772
  locations: array(string()),
11711
11773
  entries: array(ArchiveEntrySchema),
11712
11774
  totalBytes: number(),
11713
- totalFiles: number()
11775
+ totalFiles: number(),
11776
+ /**
11777
+ * Live SQLite databases this archive carries as their OWNER's verified
11778
+ * snapshot instead of as files (D693). Absent on archives made before.
11779
+ */
11780
+ sqliteSnapshots: array(ArchiveSqliteSnapshotSchema).optional()
11714
11781
  });
11715
11782
  var LocationStatSchema = object({
11716
11783
  name: string(),
@@ -13236,6 +13303,52 @@ var CompositionBlockStateSchema = object({
13236
13303
  reason: string().optional(),
13237
13304
  fields: array(CompositionFieldStateSchema)
13238
13305
  });
13306
+ var ComposerBlockSchema = object({
13307
+ id: string().min(1),
13308
+ name: string().min(1).max(120),
13309
+ enabled: boolean(),
13310
+ updatedAt: number(),
13311
+ composition: CompositionSchema
13312
+ });
13313
+ /**
13314
+ * A stored composition row that no longer PARSES — a schema a release
13315
+ * tightened, a row written by a newer build. Sent by id so the composer keeps
13316
+ * its device as a placeholder and reports the block `failed` naming the parse
13317
+ * error. Leaving it out would read, twice, exactly like a delete (D49).
13318
+ */
13319
+ var ComposerUnreadableBlockSchema = object({
13320
+ id: string().min(1),
13321
+ /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
13322
+ name: string().nullable(),
13323
+ /** The parse error, in the operator's words. */
13324
+ error: string()
13325
+ });
13326
+ method(object({
13327
+ /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
13328
+ integrationId: string().nullable(),
13329
+ /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
13330
+ storeLoaded: boolean(),
13331
+ blocks: array(ComposerBlockSchema),
13332
+ /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
13333
+ restartBlockIds: array(string()),
13334
+ /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
13335
+ unreadableBlocks: array(ComposerUnreadableBlockSchema)
13336
+ }), object({
13337
+ blocks: array(object({
13338
+ blockId: string(),
13339
+ status: CompositionRunStatusSchema,
13340
+ reason: string().optional()
13341
+ })),
13342
+ /**
13343
+ * False when the composer declared and withdrew NOTHING (store not loaded,
13344
+ * integration unknown, its own rows unread or read empty once). An empty
13345
+ * apply the caller owes is paid off only by one the composer acted on (D49).
13346
+ */
13347
+ acted: boolean()
13348
+ }), {
13349
+ kind: "mutation",
13350
+ auth: "admin"
13351
+ }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
13239
13352
  var NUMBER = {
13240
13353
  kind: "fixed",
13241
13354
  result: ["number"]
@@ -13472,52 +13585,6 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
13472
13585
  auth: "admin",
13473
13586
  access: "view"
13474
13587
  });
13475
- var ComposerBlockSchema = object({
13476
- id: string().min(1),
13477
- name: string().min(1).max(120),
13478
- enabled: boolean(),
13479
- updatedAt: number(),
13480
- composition: CompositionSchema
13481
- });
13482
- /**
13483
- * A stored composition row that no longer PARSES — a schema a release
13484
- * tightened, a row written by a newer build. Sent by id so the composer keeps
13485
- * its device as a placeholder and reports the block `failed` naming the parse
13486
- * error. Leaving it out would read, twice, exactly like a delete (D49).
13487
- */
13488
- var ComposerUnreadableBlockSchema = object({
13489
- id: string().min(1),
13490
- /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
13491
- name: string().nullable(),
13492
- /** The parse error, in the operator's words. */
13493
- error: string()
13494
- });
13495
- method(object({
13496
- /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
13497
- integrationId: string().nullable(),
13498
- /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
13499
- storeLoaded: boolean(),
13500
- blocks: array(ComposerBlockSchema),
13501
- /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
13502
- restartBlockIds: array(string()),
13503
- /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
13504
- unreadableBlocks: array(ComposerUnreadableBlockSchema)
13505
- }), object({
13506
- blocks: array(object({
13507
- blockId: string(),
13508
- status: CompositionRunStatusSchema,
13509
- reason: string().optional()
13510
- })),
13511
- /**
13512
- * False when the composer declared and withdrew NOTHING (store not loaded,
13513
- * integration unknown, its own rows unread or read empty once). An empty
13514
- * apply the caller owes is paid off only by one the composer acted on (D49).
13515
- */
13516
- acted: boolean()
13517
- }), {
13518
- kind: "mutation",
13519
- auth: "admin"
13520
- }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
13521
13588
  /**
13522
13589
  * `custom-model-registry` — collection cap exposing operator-registered
13523
13590
  * custom detection models. Each provider (today: `addon-model-studio`)
@@ -15555,6 +15622,219 @@ method(object({
15555
15622
  caps: array(string()).readonly().optional()
15556
15623
  }), record(string(), record(string(), unknown().nullable())));
15557
15624
  /**
15625
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
15626
+ * name (same pattern as `snapshot`):
15627
+ *
15628
+ * - **Native** providers: registered per-device by device-driver
15629
+ * addons via `ctx.registerNativeCap` — either on a
15630
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
15631
+ * or directly on the camera (Reolink registers at camera level).
15632
+ * Emits an `onPressed` event every time the firmware pushes a
15633
+ * ring; status tracks the last press and a pressCount since start
15634
+ * (diagnostic).
15635
+ *
15636
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
15637
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
15638
+ * device (contact / switch / event-emitter …) into a doorbell for
15639
+ * a camera. `defaultActive: false` — the operator explicitly binds
15640
+ * it per camera in the device-bindings UI, then picks the source
15641
+ * device + trigger in the per-device settings.
15642
+ *
15643
+ * The DeviceEventPropagator re-emits `onPressed` on the camera parent
15644
+ * — subscribers listening at the camera level receive ring events
15645
+ * with `via[]` populated. No code on the parent needed.
15646
+ */
15647
+ var DoorbellStatusSchema = object({
15648
+ /** Ms epoch of the last press. null = never observed since this provider started. */
15649
+ lastPressedAt: number().nullable(),
15650
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
15651
+ pressCountSinceStart: number()
15652
+ });
15653
+ var DoorbellPressEventSchema = object({
15654
+ deviceId: number(),
15655
+ timestamp: number()
15656
+ });
15657
+ /**
15658
+ * The `doorbell-source` extension slot's editable value (D648): the camera's
15659
+ * virtual-doorbell trigger devices, exactly what the wrapper's
15660
+ * `doorbellSources` persists (as `{ deviceId }` records).
15661
+ */
15662
+ var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
15663
+ /**
15664
+ * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
15665
+ * doorbell, owned by the `virtual-doorbell` wrapper over its
15666
+ * `doorbellSources` store (D648). A source rings when one of its
15667
+ * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
15668
+ * different authority (`deviceManager.setWrapperActive`, D62) — the slot
15669
+ * reports it, it never writes it.
15670
+ */
15671
+ var DOORBELL_SOURCE_SLOT = {
15672
+ id: "doorbell-source",
15673
+ label: "Doorbell trigger devices",
15674
+ 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.",
15675
+ shape: "association",
15676
+ hostDeviceTypes: [DeviceType.Camera],
15677
+ sourceCaps: SOURCE_CAPS,
15678
+ cardinality: "many",
15679
+ value: DoorbellSourceSlotValueSchema
15680
+ };
15681
+ var doorbellCapability = {
15682
+ name: "doorbell",
15683
+ scope: "device",
15684
+ deviceNative: true,
15685
+ mode: "singleton",
15686
+ kind: "wrapper",
15687
+ defaultActive: false,
15688
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
15689
+ extensionSlots: [DOORBELL_SOURCE_SLOT],
15690
+ methods: {},
15691
+ events: {
15692
+ /**
15693
+ * Fires once per physical press. Reolink delivers via Baichuan
15694
+ * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
15695
+ * release/duration — it's a pulse.
15696
+ */
15697
+ onPressed: {
15698
+ data: DoorbellPressEventSchema,
15699
+ fromState: {
15700
+ field: "lastPressedAt",
15701
+ on: "advance"
15702
+ }
15703
+ } },
15704
+ status: {
15705
+ schema: DoorbellStatusSchema,
15706
+ kind: "push"
15707
+ },
15708
+ /**
15709
+ * Runtime-state slice — last press timestamp + lifetime press count.
15710
+ * Mirrored by the kernel and readable via
15711
+ * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
15712
+ * without subscribing.
15713
+ */
15714
+ runtimeState: DoorbellStatusSchema,
15715
+ /**
15716
+ * 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.
15717
+ *
15718
+ * See `RuntimeStateDurability`. Enforced by
15719
+ * `scripts/check-runtime-state-durability.ts`.
15720
+ */
15721
+ durability: "restored"
15722
+ };
15723
+ var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
15724
+ DeviceType.Camera, DeviceType.Camera;
15725
+ /** A slot's editable value, discriminated on `slot`. */
15726
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
15727
+ DeviceType.Camera;
15728
+ var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
15729
+ state: literal("unreachable"),
15730
+ reason: string()
15731
+ })]);
15732
+ /** One provider of slots — the D554 source-listing row. */
15733
+ var ExtensionSourceSchema = object({
15734
+ /** The routing prefix of every `slotRef` this provider serves. */
15735
+ source: string(),
15736
+ label: string(),
15737
+ /** Stamped by the dispatcher from the registry (D557). */
15738
+ addonId: string().optional(),
15739
+ availability: ExtensionSourceAvailabilitySchema
15740
+ });
15741
+ /**
15742
+ * How one picked source stands. `missing` — no such device (deleted, or an id
15743
+ * that never existed); `foreign` — a device the slot's owner cannot read from
15744
+ * (a source owned by another addon); `unavailable` — it exists but is not a
15745
+ * valid source now (a container, which is never a pick). A source in any of
15746
+ * these states is SHOWN, never silently dropped or re-pointed.
15747
+ */
15748
+ var ExtensionSourceHealthSchema = _enum([
15749
+ "ok",
15750
+ "missing",
15751
+ "foreign",
15752
+ "unavailable"
15753
+ ]);
15754
+ var ExtensionSlotSourceSchema = object({
15755
+ deviceId: number().int(),
15756
+ /** The device's name, or null when it could not be resolved (`missing`). */
15757
+ name: string().nullable(),
15758
+ health: ExtensionSourceHealthSchema,
15759
+ detail: string().optional()
15760
+ });
15761
+ /**
15762
+ * A DIFFERENT authority that gates whether the slot's sources do anything —
15763
+ * reported read-only, named, never written through this contract (D62). The
15764
+ * virtual doorbell's sources ring only while the wrapper is bound to the
15765
+ * camera, and that binding belongs to `deviceManager.setWrapperActive`.
15766
+ * `unknown` means the gate could not be read; it is not "inactive" (D315).
15767
+ */
15768
+ var ExtensionSlotActivationSchema = object({
15769
+ state: _enum([
15770
+ "active",
15771
+ "inactive",
15772
+ "unknown"
15773
+ ]),
15774
+ authority: string(),
15775
+ detail: string().optional()
15776
+ });
15777
+ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
15778
+ state: literal("ok"),
15779
+ /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
15780
+ slotRef: string(),
15781
+ slot: ExtensionSlotIdSchema,
15782
+ /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
15783
+ authority: string(),
15784
+ activation: ExtensionSlotActivationSchema.nullable(),
15785
+ value: ExtensionSlotValueSchema,
15786
+ sources: array(ExtensionSlotSourceSchema),
15787
+ /**
15788
+ * Devices the owner links to the host ON ITS OWN, by structure, and that
15789
+ * are therefore not in `value` (D655): a camera's device-tree children, and
15790
+ * the child a picked container stands for (D356 — a container is never a
15791
+ * pick, its children are). Read-only; the editor shows them and may offer
15792
+ * per-device options on them (the linked-devices tracked-event opt-in).
15793
+ * Absent when the owner links nothing beyond the picks, and from an owner
15794
+ * older than D655.
15795
+ */
15796
+ impliedSources: array(ExtensionSlotSourceSchema).optional()
15797
+ }), object({
15798
+ state: literal("unreachable"),
15799
+ addonId: string(),
15800
+ reason: string()
15801
+ })]);
15802
+ var ExtensionCandidatesSchema = object({ candidates: array(object({
15803
+ deviceId: number().int(),
15804
+ name: string(),
15805
+ type: string(),
15806
+ location: string().nullable(),
15807
+ /** The container a child belongs to — "Spotlight 2" alone does not say which. */
15808
+ parentName: string().nullable(),
15809
+ /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
15810
+ suggested: boolean(),
15811
+ /** Why it is suggested ("same location"), null when it is not. */
15812
+ reason: string().nullable()
15813
+ })) });
15814
+ /**
15815
+ * What a write did. `none` — applied in place. `host` / `parent` — the owner
15816
+ * reloaded the host (or, for an accessory child, its parent) because the
15817
+ * write changed what the host REGISTERS. A slot never adds a capability to its
15818
+ * host — that is a composition (D663) — so today's owners answer `none`.
15819
+ */
15820
+ var ExtensionSetResultSchema = object({
15821
+ applied: literal(true),
15822
+ reload: _enum([
15823
+ "none",
15824
+ "host",
15825
+ "parent"
15826
+ ])
15827
+ });
15828
+ var ExtensionSlotRefInputSchema = object({
15829
+ deviceId: number().int(),
15830
+ slotRef: string().min(1)
15831
+ });
15832
+ var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
15833
+ method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
15834
+ kind: "mutation",
15835
+ auth: "admin"
15836
+ });
15837
+ /**
15558
15838
  * Per-field ownership (D663). A composition may CLAIM fields of a native
15559
15839
  * cap's runtime-state slice on an existing device: `replace` overlays the
15560
15840
  * claimed fields on the native slice, `add` builds a slice the device does
@@ -18564,17 +18844,25 @@ var NcScheduleSchema = object({
18564
18844
  */
18565
18845
  var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
18566
18846
  /**
18847
+ * How a summary window is SENT (D698): `rule` (absent) = ONE notification with
18848
+ * every section; `section` = one notification per section with something to
18849
+ * say (an unavailable section included), each titled by its section.
18850
+ */
18851
+ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
18852
+ /**
18567
18853
  * `summary`: the rule sends NOTHING per event. When a window of `schedule`
18568
18854
  * CLOSES, it sends one notification with the current state of its kinds
18569
18855
  * (low batteries, consumables to replace, devices offline, updates
18570
- * available, ...), after its own filters. Nothing to report sends nothing.
18856
+ * available, ...), after its own filters — or, with `split: 'section'`
18857
+ * (D698), one notification per section. Nothing to report sends nothing.
18571
18858
  * The schedule is the ordinary `NcSchedule` (weekly windows, IANA timezone,
18572
18859
  * midnight crossing); the send time is each window's END. Refused on the
18573
18860
  * `alarm` family, which stays instant (`systemEventDeliveryProblems`).
18574
18861
  */
18575
18862
  var NcSystemEventDeliverySchema = discriminatedUnion("mode", [object({ mode: literal("instant") }), object({
18576
18863
  mode: literal("summary"),
18577
- schedule: NcScheduleSchema
18864
+ schedule: NcScheduleSchema,
18865
+ split: NcStateSummarySplitSchema.optional()
18578
18866
  })]);
18579
18867
  /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
18580
18868
  var NcPlateMatcherSchema = object({
@@ -18714,8 +19002,14 @@ var NcSensorTransitionSchema = _enum(["raised", "cleared"]);
18714
19002
  /** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
18715
19003
  var NcZoneConditionSchema = object({
18716
19004
  ids: array(string().min(1)).min(1),
18717
- /** Quantifier over `ids` — at least one / every one visited. */
18718
- match: _enum(["any", "all"]).default("any")
19005
+ /**
19006
+ * LEGACY quantifier over `ids`. Absent = `any` (at least one visited), which
19007
+ * is what both editors mean and all they write since D690: "all of" was
19008
+ * removed from the editors because on an immediate rule it asked one
19009
+ * detection to stand in every zone at once. Still ACCEPTED, and `all` still
19010
+ * evaluated, so a stored rule keeps parsing and meaning what it meant.
19011
+ */
19012
+ match: _enum(["any", "all"]).optional()
18719
19013
  });
18720
19014
  /**
18721
19015
  * The P1 condition set — a flat AND of groups; absent group = pass;
@@ -19219,10 +19513,12 @@ var NcMediaPolicySchema = object({
19219
19513
  /**
19220
19514
  * Cooldown GRANULARITY over the subject's class — how much a fired
19221
19515
  * notification suppresses.
19222
- * - `shared` (default, and the absent value) — one window for the whole
19223
- * rule/scope: a cat silences the next dog for `cooldownSec`.
19224
- * - `per-class` — an independent window per detected class, so cat→dog fires
19225
- * at once and cat→cat still waits.
19516
+ * - `per-class` (default, and the absent value since 2026-10-01 — D36) — an
19517
+ * independent window per detected class: cat→dog fires at once, cat→cat
19518
+ * still waits.
19519
+ * - `shared` — one window for the whole rule/scope: a cat silences the next
19520
+ * dog for `cooldownSec`. Only written when an operator picks it; it is no
19521
+ * longer what an unset rule means.
19226
19522
  *
19227
19523
  * AUDIO subjects are ALWAYS per-class regardless of this setting: a scream
19228
19524
  * must not be swallowed by a bark's window (the precedent this generalizes —
@@ -19237,8 +19533,11 @@ var NcThrottleSchema = object({
19237
19533
  /**
19238
19534
  * Class granularity of the cooldown key. Optional rather than defaulted:
19239
19535
  * a Zod default does NOT run on the addon→addon cap path, so a persisted
19240
- * rule authored before this field simply carries none — and the engine
19241
- * reads absent as `shared`, the pre-existing behaviour.
19536
+ * rule authored before this field simply carries none. The engine used to
19537
+ * read absent as `shared` (D36); since 2026-10-01 it reads absent as
19538
+ * `per-class` — the operator's default — and only an explicit `shared`
19539
+ * still means `shared`. See `cooldownKey` / `keysPerClass` in the rule
19540
+ * engine, and D36's dated note.
19242
19541
  */
19243
19542
  granularity: NcThrottleGranularitySchema.optional()
19244
19543
  });
@@ -19562,11 +19861,23 @@ var NcStateSummaryPreviewSectionSchema = object({
19562
19861
  reason: string().optional()
19563
19862
  });
19564
19863
  /**
19864
+ * One notification a previewed summary would send (D698): the whole summary on
19865
+ * a `rule` split (no `section`), one section's on a `section` split.
19866
+ */
19867
+ var NcStateSummaryPreviewRowSchema = object({
19868
+ section: string().optional(),
19869
+ /** The section's name on a per-section row; every reported section's, joined, on a combined one. */
19870
+ title: string(),
19871
+ text: string(),
19872
+ count: number().int().nonnegative()
19873
+ });
19874
+ /**
19565
19875
  * The summary a rule would send now. `empty` = nothing to report and every
19566
19876
  * section read: such a summary is NOT sent. `dropped` counts the open states
19567
19877
  * the rule's own filters (or a camera mute) left out, by reason.
19568
19878
  * `excludedGroups` names the kind groups selected that have no state to report
19569
- * (backups & exports).
19879
+ * (backups & exports). `split` and `rows` (D698) say how it would be sent —
19880
+ * optional, so an older hub's answer still parses.
19570
19881
  */
19571
19882
  var NcStateSummaryPreviewSchema = object({
19572
19883
  empty: boolean(),
@@ -19574,7 +19885,9 @@ var NcStateSummaryPreviewSchema = object({
19574
19885
  text: string(),
19575
19886
  sections: array(NcStateSummaryPreviewSectionSchema),
19576
19887
  dropped: record(string(), number().int().nonnegative()),
19577
- excludedGroups: array(string())
19888
+ excludedGroups: array(string()),
19889
+ split: NcStateSummarySplitSchema.optional(),
19890
+ rows: array(NcStateSummaryPreviewRowSchema).optional()
19578
19891
  });
19579
19892
  var NcTestResultSchema = object({
19580
19893
  recordId: string(),
@@ -22495,7 +22808,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22495
22808
  trackIds: array(string()).min(1)
22496
22809
  }), object({
22497
22810
  deleted: number().int(),
22498
- failed: array(string()).readonly()
22811
+ failed: array(string()).readonly(),
22812
+ sparedMediaIds: array(number().int()).readonly().optional()
22499
22813
  }), {
22500
22814
  kind: "mutation",
22501
22815
  auth: "admin"
@@ -24724,7 +25038,42 @@ var SetCameraSensorsInputSchema = object({
24724
25038
  /** `null` removes the attachment: the camera goes back to `not-configured`. */
24725
25039
  config: CameraSensorsConfigSchema.nullable()
24726
25040
  });
24727
- method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
25041
+ /**
25042
+ * Why an early occupancy look (D691) was not scheduled.
25043
+ *
25044
+ * - `unknown-camera` — no session was ever dispatched for it, so there is no
25045
+ * node and no config to attach a burst with.
25046
+ * - `out-of-range` — the ask is negative or further out than the orchestrator
25047
+ * will hold a timer for; the parked-object cadence is the answer there.
25048
+ * - `no-burst-producer` — this build has no burst producer at all.
25049
+ * - `already-looked` — this camera's ONE early look since its last session has
25050
+ * been spent. A look's own burst can re-arm a flickering flip, and a look
25051
+ * per arm would chain a burst every ~30 s forever (review H2); the next
25052
+ * real session re-arms the budget.
25053
+ */
25054
+ var OccupancyLookRefusalSchema = _enum([
25055
+ "unknown-camera",
25056
+ "out-of-range",
25057
+ "no-burst-producer",
25058
+ "already-looked"
25059
+ ]);
25060
+ method(object({
25061
+ deviceId: number().int().nonnegative(),
25062
+ /** How long from NOW until the pending flip's sustain window ends. RELATIVE,
25063
+ * so the caller's clock and the orchestrator's never have to agree. */
25064
+ afterMs: number().finite(),
25065
+ /** Why, for the log. */
25066
+ reason: string()
25067
+ }), object({
25068
+ scheduled: boolean(),
25069
+ /** When `scheduled`: how long until the burst is dialled. */
25070
+ dueInMs: number().optional(),
25071
+ /** When not `scheduled`: why. */
25072
+ refusedBecause: OccupancyLookRefusalSchema.optional()
25073
+ }), {
25074
+ kind: "mutation",
25075
+ auth: "admin"
25076
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
24728
25077
  kind: "mutation",
24729
25078
  auth: "admin"
24730
25079
  }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
@@ -27191,219 +27540,6 @@ DeviceType.Camera, method(object({
27191
27540
  auth: "protected"
27192
27541
  });
27193
27542
  /**
27194
- * Doorbell button cap. Two kinds of providers coexist behind this cap
27195
- * name (same pattern as `snapshot`):
27196
- *
27197
- * - **Native** providers: registered per-device by device-driver
27198
- * addons via `ctx.registerNativeCap` — either on a
27199
- * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
27200
- * or directly on the camera (Reolink registers at camera level).
27201
- * Emits an `onPressed` event every time the firmware pushes a
27202
- * ring; status tracks the last press and a pressCount since start
27203
- * (diagnostic).
27204
- *
27205
- * - **Wrapper** provider: the `virtual-doorbell` system builtin
27206
- * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
27207
- * device (contact / switch / event-emitter …) into a doorbell for
27208
- * a camera. `defaultActive: false` — the operator explicitly binds
27209
- * it per camera in the device-bindings UI, then picks the source
27210
- * device + trigger in the per-device settings.
27211
- *
27212
- * The DeviceEventPropagator re-emits `onPressed` on the camera parent
27213
- * — subscribers listening at the camera level receive ring events
27214
- * with `via[]` populated. No code on the parent needed.
27215
- */
27216
- var DoorbellStatusSchema = object({
27217
- /** Ms epoch of the last press. null = never observed since this provider started. */
27218
- lastPressedAt: number().nullable(),
27219
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
27220
- pressCountSinceStart: number()
27221
- });
27222
- var DoorbellPressEventSchema = object({
27223
- deviceId: number(),
27224
- timestamp: number()
27225
- });
27226
- /**
27227
- * The `doorbell-source` extension slot's editable value (D648): the camera's
27228
- * virtual-doorbell trigger devices, exactly what the wrapper's
27229
- * `doorbellSources` persists (as `{ deviceId }` records).
27230
- */
27231
- var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
27232
- /**
27233
- * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
27234
- * doorbell, owned by the `virtual-doorbell` wrapper over its
27235
- * `doorbellSources` store (D648). A source rings when one of its
27236
- * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
27237
- * different authority (`deviceManager.setWrapperActive`, D62) — the slot
27238
- * reports it, it never writes it.
27239
- */
27240
- var DOORBELL_SOURCE_SLOT = {
27241
- id: "doorbell-source",
27242
- label: "Doorbell trigger devices",
27243
- 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.",
27244
- shape: "association",
27245
- hostDeviceTypes: [DeviceType.Camera],
27246
- sourceCaps: SOURCE_CAPS,
27247
- cardinality: "many",
27248
- value: DoorbellSourceSlotValueSchema
27249
- };
27250
- var doorbellCapability = {
27251
- name: "doorbell",
27252
- scope: "device",
27253
- deviceNative: true,
27254
- mode: "singleton",
27255
- kind: "wrapper",
27256
- defaultActive: false,
27257
- deviceTypes: [DeviceType.Button, DeviceType.Camera],
27258
- extensionSlots: [DOORBELL_SOURCE_SLOT],
27259
- methods: {},
27260
- events: {
27261
- /**
27262
- * Fires once per physical press. Reolink delivers via Baichuan
27263
- * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
27264
- * release/duration — it's a pulse.
27265
- */
27266
- onPressed: {
27267
- data: DoorbellPressEventSchema,
27268
- fromState: {
27269
- field: "lastPressedAt",
27270
- on: "advance"
27271
- }
27272
- } },
27273
- status: {
27274
- schema: DoorbellStatusSchema,
27275
- kind: "push"
27276
- },
27277
- /**
27278
- * Runtime-state slice — last press timestamp + lifetime press count.
27279
- * Mirrored by the kernel and readable via
27280
- * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
27281
- * without subscribing.
27282
- */
27283
- runtimeState: DoorbellStatusSchema,
27284
- /**
27285
- * 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.
27286
- *
27287
- * See `RuntimeStateDurability`. Enforced by
27288
- * `scripts/check-runtime-state-durability.ts`.
27289
- */
27290
- durability: "restored"
27291
- };
27292
- var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
27293
- DeviceType.Camera, DeviceType.Camera;
27294
- /** A slot's editable value, discriminated on `slot`. */
27295
- var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
27296
- DeviceType.Camera;
27297
- var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
27298
- state: literal("unreachable"),
27299
- reason: string()
27300
- })]);
27301
- /** One provider of slots — the D554 source-listing row. */
27302
- var ExtensionSourceSchema = object({
27303
- /** The routing prefix of every `slotRef` this provider serves. */
27304
- source: string(),
27305
- label: string(),
27306
- /** Stamped by the dispatcher from the registry (D557). */
27307
- addonId: string().optional(),
27308
- availability: ExtensionSourceAvailabilitySchema
27309
- });
27310
- /**
27311
- * How one picked source stands. `missing` — no such device (deleted, or an id
27312
- * that never existed); `foreign` — a device the slot's owner cannot read from
27313
- * (a source owned by another addon); `unavailable` — it exists but is not a
27314
- * valid source now (a container, which is never a pick). A source in any of
27315
- * these states is SHOWN, never silently dropped or re-pointed.
27316
- */
27317
- var ExtensionSourceHealthSchema = _enum([
27318
- "ok",
27319
- "missing",
27320
- "foreign",
27321
- "unavailable"
27322
- ]);
27323
- var ExtensionSlotSourceSchema = object({
27324
- deviceId: number().int(),
27325
- /** The device's name, or null when it could not be resolved (`missing`). */
27326
- name: string().nullable(),
27327
- health: ExtensionSourceHealthSchema,
27328
- detail: string().optional()
27329
- });
27330
- /**
27331
- * A DIFFERENT authority that gates whether the slot's sources do anything —
27332
- * reported read-only, named, never written through this contract (D62). The
27333
- * virtual doorbell's sources ring only while the wrapper is bound to the
27334
- * camera, and that binding belongs to `deviceManager.setWrapperActive`.
27335
- * `unknown` means the gate could not be read; it is not "inactive" (D315).
27336
- */
27337
- var ExtensionSlotActivationSchema = object({
27338
- state: _enum([
27339
- "active",
27340
- "inactive",
27341
- "unknown"
27342
- ]),
27343
- authority: string(),
27344
- detail: string().optional()
27345
- });
27346
- var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
27347
- state: literal("ok"),
27348
- /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
27349
- slotRef: string(),
27350
- slot: ExtensionSlotIdSchema,
27351
- /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
27352
- authority: string(),
27353
- activation: ExtensionSlotActivationSchema.nullable(),
27354
- value: ExtensionSlotValueSchema,
27355
- sources: array(ExtensionSlotSourceSchema),
27356
- /**
27357
- * Devices the owner links to the host ON ITS OWN, by structure, and that
27358
- * are therefore not in `value` (D655): a camera's device-tree children, and
27359
- * the child a picked container stands for (D356 — a container is never a
27360
- * pick, its children are). Read-only; the editor shows them and may offer
27361
- * per-device options on them (the linked-devices tracked-event opt-in).
27362
- * Absent when the owner links nothing beyond the picks, and from an owner
27363
- * older than D655.
27364
- */
27365
- impliedSources: array(ExtensionSlotSourceSchema).optional()
27366
- }), object({
27367
- state: literal("unreachable"),
27368
- addonId: string(),
27369
- reason: string()
27370
- })]);
27371
- var ExtensionCandidatesSchema = object({ candidates: array(object({
27372
- deviceId: number().int(),
27373
- name: string(),
27374
- type: string(),
27375
- location: string().nullable(),
27376
- /** The container a child belongs to — "Spotlight 2" alone does not say which. */
27377
- parentName: string().nullable(),
27378
- /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
27379
- suggested: boolean(),
27380
- /** Why it is suggested ("same location"), null when it is not. */
27381
- reason: string().nullable()
27382
- })) });
27383
- /**
27384
- * What a write did. `none` — applied in place. `host` / `parent` — the owner
27385
- * reloaded the host (or, for an accessory child, its parent) because the
27386
- * write changed what the host REGISTERS. A slot never adds a capability to its
27387
- * host — that is a composition (D663) — so today's owners answer `none`.
27388
- */
27389
- var ExtensionSetResultSchema = object({
27390
- applied: literal(true),
27391
- reload: _enum([
27392
- "none",
27393
- "host",
27394
- "parent"
27395
- ])
27396
- });
27397
- var ExtensionSlotRefInputSchema = object({
27398
- deviceId: number().int(),
27399
- slotRef: string().min(1)
27400
- });
27401
- var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
27402
- method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
27403
- kind: "mutation",
27404
- auth: "admin"
27405
- });
27406
- /**
27407
27543
  * Optional client-side hints sent at session creation to help the provider
27408
27544
  * pick the best native source. All fields optional — a viewer that knows
27409
27545
  * nothing still gets a sane default. (Relocated from the retired `webrtc`
@@ -42672,6 +42808,18 @@ Object.freeze({
42672
42808
  addonId: null,
42673
42809
  access: "view"
42674
42810
  },
42811
+ "databaseSnapshot.listDatabases": {
42812
+ capName: "database-snapshot",
42813
+ capScope: "system",
42814
+ addonId: null,
42815
+ access: "view"
42816
+ },
42817
+ "databaseSnapshot.writeSnapshot": {
42818
+ capName: "database-snapshot",
42819
+ capScope: "system",
42820
+ addonId: null,
42821
+ access: "create"
42822
+ },
42675
42823
  "dataStoreProvider.aggregate": {
42676
42824
  capName: "data-store-provider",
42677
42825
  capScope: "system",
@@ -46236,6 +46384,12 @@ Object.freeze({
46236
46384
  addonId: null,
46237
46385
  access: "delete"
46238
46386
  },
46387
+ "pipelineOrchestrator.requestOccupancyLook": {
46388
+ capName: "pipeline-orchestrator",
46389
+ capScope: "system",
46390
+ addonId: null,
46391
+ access: "create"
46392
+ },
46239
46393
  "pipelineOrchestrator.resetNodePipelineDefaults": {
46240
46394
  capName: "pipeline-orchestrator",
46241
46395
  capScope: "system",
@@ -50028,6 +50182,11 @@ Object.freeze({
50028
50182
  form: "single",
50029
50183
  optional: false
50030
50184
  }],
50185
+ "pipelineOrchestrator.requestOccupancyLook": [{
50186
+ name: "deviceId",
50187
+ form: "single",
50188
+ optional: false
50189
+ }],
50031
50190
  "pipelineOrchestrator.resolvePipeline": [{
50032
50191
  name: "deviceId",
50033
50192
  form: "single",
@@ -51189,6 +51348,18 @@ var STATE_SUMMARY_VARS = [
51189
51348
  systemEventKinds: [...SUMMARISABLE],
51190
51349
  systemEventDeliveries: ["summary"]
51191
51350
  },
51351
+ {
51352
+ name: "summarySection",
51353
+ label: "Summary: this section",
51354
+ description: "The section a per-section summary row is about (D698); on a summary sent as one message, every section it reports, comma-separated.",
51355
+ example: "Batterie scariche",
51356
+ group: "system",
51357
+ families: ["rule"],
51358
+ fields: [...RULE_TEXT],
51359
+ kinds: ["system"],
51360
+ systemEventKinds: [...SUMMARISABLE],
51361
+ systemEventDeliveries: ["summary"]
51362
+ },
51192
51363
  ...STATE_SUMMARY_SECTION_VARS.map((v) => ({
51193
51364
  name: v.name,
51194
51365
  label: v.label,
@@ -51265,6 +51436,37 @@ var STATE_SUMMARY_VARS = [
51265
51436
  [...RULE_TEXT],
51266
51437
  ...STATE_SUMMARY_VARS
51267
51438
  ];
51439
+ new Set([
51440
+ "disarmed",
51441
+ "armed_home",
51442
+ "armed_away",
51443
+ "armed_night",
51444
+ "armed_vacation",
51445
+ "armed_custom_bypass",
51446
+ "arming",
51447
+ "disarming",
51448
+ "pending",
51449
+ "triggered",
51450
+ "open",
51451
+ "opening",
51452
+ "closing",
51453
+ "closed",
51454
+ "stopped",
51455
+ "locked",
51456
+ "unlocked",
51457
+ "locking",
51458
+ "unlocking",
51459
+ "jammed",
51460
+ "on",
51461
+ "off",
51462
+ "home",
51463
+ "not_home",
51464
+ "matched",
51465
+ "diverged",
51466
+ "unknown",
51467
+ "latched",
51468
+ "live"
51469
+ ]);
51268
51470
  /**
51269
51471
  * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
51270
51472
  *