@camstack/addon-provider-amcrest 0.2.123 → 0.2.125

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 +828 -434
  2. package/dist/addon.mjs +828 -434
  3. package/package.json +2 -2
package/dist/addon.mjs CHANGED
@@ -13,7 +13,7 @@ import { networkInterfaces } from "node:os";
13
13
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
14
14
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
15
15
  //#endregion
16
- //#region ../types/dist/event-category-C5xZWqz6.mjs
16
+ //#region ../types/dist/event-category-BGmz_oxW.mjs
17
17
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
18
18
  EventCategory["SystemBoot"] = "system.boot";
19
19
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -546,6 +546,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
546
546
  */
547
547
  EventCategory["PipelineAudioInferenceResult"] = "pipeline.audio-inference-result";
548
548
  EventCategory["DetectionPhaseTransition"] = "detection.phase-transition";
549
+ /**
550
+ * A camera provider's RAW onboard motion push (D673): the `MotionOnMotionChanged`
551
+ * data shape without `triggeredBy`, built by `providerMotionEvent`. Its one
552
+ * consumer is the orchestrator's camera-sensors bridge, which re-emits the
553
+ * camera's EFFECTIVE onboard motion as `MotionOnMotionChanged` (a pass-through
554
+ * for a camera with no attached sensor). Providers must not emit
555
+ * `MotionOnMotionChanged` themselves; `scripts/check-onboard-motion-emitters.ts`
556
+ * keeps it so (camera-grid is a named, deferred exception).
557
+ */
549
558
  EventCategory["ProviderMotion"] = "provider.motion";
550
559
  EventCategory["ProviderDetection"] = "provider.detection";
551
560
  EventCategory["EnrichmentEmbeddingStored"] = "enrichment.embedding.stored";
@@ -5384,7 +5393,7 @@ var ZodIssueCode = {
5384
5393
  var ZodFirstPartyTypeKind;
5385
5394
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5386
5395
  //#endregion
5387
- //#region ../types/dist/sleep-C-v96WpE.mjs
5396
+ //#region ../types/dist/sleep-CDCONfkt.mjs
5388
5397
  /**
5389
5398
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5390
5399
  * window to float samples (D455).
@@ -7417,7 +7426,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7417
7426
  return DeviceRole;
7418
7427
  }({});
7419
7428
  //#endregion
7420
- //#region ../types/dist/composition-Dq42XWp0.mjs
7429
+ //#region ../types/dist/composition-43aqsZQj.mjs
7421
7430
  /**
7422
7431
  * The ffmpeg build every CamStack node downloads, per platform and arch.
7423
7432
  *
@@ -7474,13 +7483,12 @@ portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac
7474
7483
  * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
7475
7484
  * valutatore puro del suo FRONTE.
7476
7485
  *
7477
- * Viveva dentro il builtin virtual-doorbell
7478
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
7479
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
7480
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
7481
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
7482
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
7483
- * SPOSTA qui e il doorbell la ri-esporta.
7486
+ * UNA tabella per tutti quelli che chiedono "questo device è ALTO?": il
7487
+ * trigger `RecordingTriggers.sensorDeviceIds` del recorder, i marker dei
7488
+ * sensori della post-analysis, il bridge camera-sensors dell'orchestratore e
7489
+ * le sorgenti di un campanello composto (`doorbellFeatureSources`, D671).
7490
+ * Una seconda copia divergerebbe alla prima cap aggiunta, e il sintomo — "il
7491
+ * sensore fa suonare il campanello ma non registra" — è esattamente D62.
7484
7492
  *
7485
7493
  * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
7486
7494
  * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
@@ -7506,8 +7514,6 @@ var SOURCE_CAP_ACTIVE_FIELD = {
7506
7514
  vibration: "detected",
7507
7515
  tamper: "tampered"
7508
7516
  };
7509
- /** Cap names whose presence in a device's bindings qualify it as a source. */
7510
- var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
7511
7517
  /**
7512
7518
  * Error types for the safe expression engine. Two distinct classes so callers
7513
7519
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
@@ -8963,6 +8969,82 @@ var ArchivedDebugNoteQueryInputSchema = object({
8963
8969
  /** Max rows returned, newest-first. */
8964
8970
  limit: number().int().min(1).max(1e3).optional()
8965
8971
  });
8972
+ var TrackRelationKindSchema = _enum(["same-subject", "different-subjects"]);
8973
+ var TrackSideSchema = _enum(["before", "after"]);
8974
+ var TrackPurityValueSchema = _enum(["mixed", "not-a-subject"]);
8975
+ var TrackRelationSchema = object({
8976
+ id: string(),
8977
+ deviceId: number().int(),
8978
+ leftTrackId: string(),
8979
+ rightTrackId: string(),
8980
+ leftSide: TrackSideSchema.nullable(),
8981
+ rightSide: TrackSideSchema.nullable(),
8982
+ relation: TrackRelationKindSchema,
8983
+ presence: literal("continuous").nullable(),
8984
+ leftStartedAt: number().int().nullable(),
8985
+ rightStartedAt: number().int().nullable(),
8986
+ createdAt: number().int(),
8987
+ updatedAt: number().int(),
8988
+ author: string().nullable()
8989
+ });
8990
+ var TrackPuritySchema = object({
8991
+ id: string(),
8992
+ deviceId: number().int(),
8993
+ sourceTrackId: string(),
8994
+ purity: TrackPurityValueSchema,
8995
+ switchAtMs: number().int().nullable(),
8996
+ startedAt: number().int().nullable(),
8997
+ createdAt: number().int(),
8998
+ updatedAt: number().int(),
8999
+ author: string().nullable()
9000
+ });
9001
+ var SetTrackRelationInputSchema = object({
9002
+ deviceId: number().int(),
9003
+ trackId: string().min(1),
9004
+ otherTrackId: string().min(1),
9005
+ relation: TrackRelationKindSchema,
9006
+ presence: literal("continuous").optional(),
9007
+ trackSide: TrackSideSchema.optional(),
9008
+ otherSide: TrackSideSchema.optional()
9009
+ });
9010
+ var ClearTrackRelationInputSchema = object({
9011
+ deviceId: number().int(),
9012
+ trackId: string().min(1),
9013
+ otherTrackId: string().min(1)
9014
+ });
9015
+ var ClearTrackRelationResultSchema = object({ cleared: boolean() });
9016
+ var SetTrackPurityInputSchema = object({
9017
+ deviceId: number().int(),
9018
+ trackId: string().min(1),
9019
+ purity: _enum([
9020
+ "pure",
9021
+ "mixed",
9022
+ "not-a-subject"
9023
+ ]),
9024
+ switchAtMs: number().int().optional()
9025
+ });
9026
+ /** `null` when `pure` cleared the row. */
9027
+ var SetTrackPurityResultSchema = object({ purity: TrackPuritySchema.nullable() });
9028
+ var ListTrackRelationsInputSchema = object({
9029
+ deviceId: number().int(),
9030
+ trackId: string().optional(),
9031
+ since: number().int().optional(),
9032
+ until: number().int().optional(),
9033
+ limit: number().int().min(1).max(5e3).optional()
9034
+ });
9035
+ var ListTrackRelationsResultSchema = object({
9036
+ relations: array(TrackRelationSchema).readonly(),
9037
+ purities: array(TrackPuritySchema).readonly(),
9038
+ truncated: boolean()
9039
+ });
9040
+ _enum([
9041
+ "unknown-track",
9042
+ "cross-device",
9043
+ "self-relation",
9044
+ "contradiction",
9045
+ "switch-outside-track",
9046
+ "switch-needs-mixed"
9047
+ ]);
8966
9048
  /**
8967
9049
  * Ops-log — the durable, append-only operations audit shared by the
8968
9050
  * recordings and events management surfaces.
@@ -9161,7 +9243,7 @@ var RecordingTriggersSchema = object({
9161
9243
  *
9162
9244
  * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
9163
9245
  * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
9164
- * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
9246
+ * la stessa del campanello composto (D671). Ed è il FRONTE, non
9165
9247
  * il livello: un contatto trovato già aperto al riavvio del runner non fa
9166
9248
  * registrare.
9167
9249
  */
@@ -11516,6 +11598,68 @@ method(object({
11516
11598
  password: string()
11517
11599
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
11518
11600
  /**
11601
+ * How long one snapshot may take end to end: the pinned copy of the whole
11602
+ * database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
11603
+ * disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
11604
+ * generous because a timeout fails the whole backup run.
11605
+ */
11606
+ var DATABASE_SNAPSHOT_TIMEOUT_MS = 30 * 6e4;
11607
+ /**
11608
+ * The databases an owner snapshots — declared by the OWNER, so a caller never
11609
+ * guesses which file is live from what sits beside it (a cleanly closed
11610
+ * database has no sidecars and is just as owned). Paths are absolute on the
11611
+ * owner's host.
11612
+ */
11613
+ var DatabaseSnapshotTargetsSchema = object({ databases: array(object({ livePath: string() })) });
11614
+ /** One b-tree table of the snapshot and the rows it holds. */
11615
+ var DatabaseSnapshotTableSchema = object({
11616
+ name: string(),
11617
+ rows: number().int().nonnegative()
11618
+ });
11619
+ /**
11620
+ * What the owner wrote. Every path is ABSOLUTE on the owner's host — the
11621
+ * caller pins the call to its own node, so it can read the file; a caller
11622
+ * that finds the path outside its own data root refuses it rather than
11623
+ * archiving something it cannot place.
11624
+ */
11625
+ var DatabaseSnapshotResultSchema = object({
11626
+ /** The live database the snapshot copies. Never to be copied as a file. */
11627
+ livePath: string(),
11628
+ /** The verified copy: `<livePath>` + {@link DATABASE_SNAPSHOT_SUFFIX}. */
11629
+ snapshotPath: string(),
11630
+ sizeBytes: number().int().nonnegative(),
11631
+ pageCount: number().int().nonnegative(),
11632
+ pageSize: number().int().positive(),
11633
+ /**
11634
+ * Every b-tree table with its row count. Read inside the SAME read
11635
+ * transaction the copy was taken from, and found EQUAL on the copy — so
11636
+ * this is the content of the snapshot, not an estimate of the source.
11637
+ */
11638
+ tables: array(DatabaseSnapshotTableSchema),
11639
+ /** Wall time of the pinned copy (row counts included). */
11640
+ copyMs: number().nonnegative(),
11641
+ /** Wall time of the checks on the copy (`integrity_check`, row counts). */
11642
+ verifyMs: number().nonnegative(),
11643
+ /** When the pinned read transaction began (ms epoch) — the snapshot's instant. */
11644
+ takenAt: number()
11645
+ });
11646
+ /**
11647
+ * A snapshot as an ARCHIVE records it (`ArchiveManifest.sqliteSnapshots`):
11648
+ * the same facts, with both paths relative to the archive root (the node's
11649
+ * data dir), because an archive outlives the host that made it.
11650
+ */
11651
+ var ArchiveSqliteSnapshotSchema = DatabaseSnapshotResultSchema.extend({
11652
+ /** Archive-relative path of the live database the archive does NOT carry. */
11653
+ livePath: string(),
11654
+ /** Archive-relative path of the verified copy it carries in its place. */
11655
+ snapshotPath: string()
11656
+ });
11657
+ method(object({}), DatabaseSnapshotTargetsSchema, { auth: "admin" }), method(object({}), DatabaseSnapshotResultSchema, {
11658
+ kind: "mutation",
11659
+ auth: "admin",
11660
+ timeoutMs: DATABASE_SNAPSHOT_TIMEOUT_MS
11661
+ });
11662
+ /**
11519
11663
  * Orchestrator-side destination metadata. The orchestrator computes
11520
11664
  * `id = <addonId>:<subId>` from its provider lookup so consumers
11521
11665
  * (admin UI, restore flow) see one canonical key.
@@ -11626,7 +11770,12 @@ var ArchiveManifestSchema = object({
11626
11770
  locations: array(string()),
11627
11771
  entries: array(ArchiveEntrySchema),
11628
11772
  totalBytes: number(),
11629
- totalFiles: number()
11773
+ totalFiles: number(),
11774
+ /**
11775
+ * Live SQLite databases this archive carries as their OWNER's verified
11776
+ * snapshot instead of as files (D693). Absent on archives made before.
11777
+ */
11778
+ sqliteSnapshots: array(ArchiveSqliteSnapshotSchema).optional()
11630
11779
  });
11631
11780
  var LocationStatSchema = object({
11632
11781
  name: string(),
@@ -13152,6 +13301,116 @@ var CompositionBlockStateSchema = object({
13152
13301
  reason: string().optional(),
13153
13302
  fields: array(CompositionFieldStateSchema)
13154
13303
  });
13304
+ var ComposerBlockSchema = object({
13305
+ id: string().min(1),
13306
+ name: string().min(1).max(120),
13307
+ enabled: boolean(),
13308
+ updatedAt: number(),
13309
+ composition: CompositionSchema
13310
+ });
13311
+ /**
13312
+ * A stored composition row that no longer PARSES — a schema a release
13313
+ * tightened, a row written by a newer build. Sent by id so the composer keeps
13314
+ * its device as a placeholder and reports the block `failed` naming the parse
13315
+ * error. Leaving it out would read, twice, exactly like a delete (D49).
13316
+ */
13317
+ var ComposerUnreadableBlockSchema = object({
13318
+ id: string().min(1),
13319
+ /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
13320
+ name: string().nullable(),
13321
+ /** The parse error, in the operator's words. */
13322
+ error: string()
13323
+ });
13324
+ method(object({
13325
+ /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
13326
+ integrationId: string().nullable(),
13327
+ /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
13328
+ storeLoaded: boolean(),
13329
+ blocks: array(ComposerBlockSchema),
13330
+ /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
13331
+ restartBlockIds: array(string()),
13332
+ /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
13333
+ unreadableBlocks: array(ComposerUnreadableBlockSchema)
13334
+ }), object({
13335
+ blocks: array(object({
13336
+ blockId: string(),
13337
+ status: CompositionRunStatusSchema,
13338
+ reason: string().optional()
13339
+ })),
13340
+ /**
13341
+ * False when the composer declared and withdrew NOTHING (store not loaded,
13342
+ * integration unknown, its own rows unread or read empty once). An empty
13343
+ * apply the caller owes is paid off only by one the composer acted on (D49).
13344
+ */
13345
+ acted: boolean()
13346
+ }), {
13347
+ kind: "mutation",
13348
+ auth: "admin"
13349
+ }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
13350
+ var NUMBER = {
13351
+ kind: "fixed",
13352
+ result: ["number"]
13353
+ };
13354
+ var BOOLEAN = {
13355
+ kind: "fixed",
13356
+ result: ["boolean"]
13357
+ };
13358
+ Object.freeze({
13359
+ min: NUMBER,
13360
+ max: NUMBER,
13361
+ abs: NUMBER,
13362
+ floor: NUMBER,
13363
+ ceil: NUMBER,
13364
+ sqrt: NUMBER,
13365
+ round: NUMBER,
13366
+ pow: NUMBER,
13367
+ clamp: NUMBER,
13368
+ avg: NUMBER,
13369
+ sum: NUMBER,
13370
+ age: NUMBER,
13371
+ convert: NUMBER,
13372
+ coalesce: { kind: "coalesce" },
13373
+ any: BOOLEAN,
13374
+ all: BOOLEAN,
13375
+ within: BOOLEAN,
13376
+ latest: {
13377
+ kind: "fixed",
13378
+ result: ["number", "null"]
13379
+ },
13380
+ number: {
13381
+ kind: "fixed",
13382
+ result: ["number", "null"]
13383
+ },
13384
+ rose: {
13385
+ kind: "fixed",
13386
+ result: ["number", "null"]
13387
+ },
13388
+ count: NUMBER
13389
+ });
13390
+ `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
13391
+ /**
13392
+ * What a composition may BUILD on a device type (G2, D676): the caps a new
13393
+ * device of that type, or an existing one that lacks them, can be given. The
13394
+ * blockers are the validator's own refusal codes, and a spec compares this
13395
+ * listing with `planComposition` for every capability — the editor can never
13396
+ * offer a feature the save would refuse for the same reason.
13397
+ */
13398
+ var ComposableFieldSchema = object({
13399
+ path: string(),
13400
+ kind: CompositionFieldKindSchema,
13401
+ nullable: boolean(),
13402
+ required: boolean(),
13403
+ enumValues: array(string()).optional()
13404
+ });
13405
+ var ComposableCapabilitiesSchema = object({ caps: array(object({
13406
+ cap: string(),
13407
+ fields: array(ComposableFieldSchema),
13408
+ /** Present for an item-array cap (`consumables.items`). */
13409
+ itemArray: object({
13410
+ path: string(),
13411
+ keyField: string()
13412
+ }).optional()
13413
+ })) });
13155
13414
  /** Where a block runs. The operator chooses — a block driving a device on an
13156
13415
  * agent is the reason placement is not fixed to the hub. */
13157
13416
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -13316,7 +13575,7 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
13316
13575
  }), method(object({ blockId: string() }), CompositionGetReadSchema, { auth: "admin" }), method(object({}), CompositionListReadSchema, { auth: "admin" }), method(object({
13317
13576
  addonId: string().min(1),
13318
13577
  stableId: string().min(1)
13319
- }), CompositionCustomizationReadSchema, { auth: "admin" }), method(object({
13578
+ }), CompositionCustomizationReadSchema, { auth: "admin" }), method(object({ deviceType: _enum(DeviceType) }), ComposableCapabilitiesSchema, { auth: "admin" }), method(object({
13320
13579
  composition: CompositionSchema,
13321
13580
  blockId: string().optional()
13322
13581
  }), CompositionValidationSchema, {
@@ -13324,52 +13583,6 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
13324
13583
  auth: "admin",
13325
13584
  access: "view"
13326
13585
  });
13327
- var ComposerBlockSchema = object({
13328
- id: string().min(1),
13329
- name: string().min(1).max(120),
13330
- enabled: boolean(),
13331
- updatedAt: number(),
13332
- composition: CompositionSchema
13333
- });
13334
- /**
13335
- * A stored composition row that no longer PARSES — a schema a release
13336
- * tightened, a row written by a newer build. Sent by id so the composer keeps
13337
- * its device as a placeholder and reports the block `failed` naming the parse
13338
- * error. Leaving it out would read, twice, exactly like a delete (D49).
13339
- */
13340
- var ComposerUnreadableBlockSchema = object({
13341
- id: string().min(1),
13342
- /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
13343
- name: string().nullable(),
13344
- /** The parse error, in the operator's words. */
13345
- error: string()
13346
- });
13347
- method(object({
13348
- /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
13349
- integrationId: string().nullable(),
13350
- /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
13351
- storeLoaded: boolean(),
13352
- blocks: array(ComposerBlockSchema),
13353
- /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
13354
- restartBlockIds: array(string()),
13355
- /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
13356
- unreadableBlocks: array(ComposerUnreadableBlockSchema)
13357
- }), object({
13358
- blocks: array(object({
13359
- blockId: string(),
13360
- status: CompositionRunStatusSchema,
13361
- reason: string().optional()
13362
- })),
13363
- /**
13364
- * False when the composer declared and withdrew NOTHING (store not loaded,
13365
- * integration unknown, its own rows unread or read empty once). An empty
13366
- * apply the caller owes is paid off only by one the composer acted on (D49).
13367
- */
13368
- acted: boolean()
13369
- }), {
13370
- kind: "mutation",
13371
- auth: "admin"
13372
- }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
13373
13586
  /**
13374
13587
  * `custom-model-registry` — collection cap exposing operator-registered
13375
13588
  * custom detection models. Each provider (today: `addon-model-studio`)
@@ -15519,6 +15732,121 @@ method(object({
15519
15732
  deviceIds: array(number()).readonly(),
15520
15733
  caps: array(string()).readonly().optional()
15521
15734
  }), record(string(), record(string(), unknown().nullable())));
15735
+ var ExtensionSlotIdSchema = _enum(["linked-devices"]);
15736
+ DeviceType.Camera;
15737
+ /** A slot's editable value, discriminated on `slot`. */
15738
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
15739
+ DeviceType.Camera;
15740
+ var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
15741
+ state: literal("unreachable"),
15742
+ reason: string()
15743
+ })]);
15744
+ /** One provider of slots — the D554 source-listing row. */
15745
+ var ExtensionSourceSchema = object({
15746
+ /** The routing prefix of every `slotRef` this provider serves. */
15747
+ source: string(),
15748
+ label: string(),
15749
+ /** Stamped by the dispatcher from the registry (D557). */
15750
+ addonId: string().optional(),
15751
+ availability: ExtensionSourceAvailabilitySchema
15752
+ });
15753
+ /**
15754
+ * How one picked source stands. `missing` — no such device (deleted, or an id
15755
+ * that never existed); `foreign` — a device the slot's owner cannot read from
15756
+ * (a source owned by another addon); `unavailable` — it exists but is not a
15757
+ * valid source now (a container, which is never a pick). A source in any of
15758
+ * these states is SHOWN, never silently dropped or re-pointed.
15759
+ */
15760
+ var ExtensionSourceHealthSchema = _enum([
15761
+ "ok",
15762
+ "missing",
15763
+ "foreign",
15764
+ "unavailable"
15765
+ ]);
15766
+ var ExtensionSlotSourceSchema = object({
15767
+ deviceId: number().int(),
15768
+ /** The device's name, or null when it could not be resolved (`missing`). */
15769
+ name: string().nullable(),
15770
+ health: ExtensionSourceHealthSchema,
15771
+ detail: string().optional()
15772
+ });
15773
+ /**
15774
+ * A DIFFERENT authority that gates whether the slot's sources do anything —
15775
+ * reported read-only, named, never written through this contract (D62) — e.g.
15776
+ * a slot whose sources act only while a wrapper is bound to the host, a
15777
+ * binding that belongs to `deviceManager.setWrapperActive`. No slot reports
15778
+ * one today (`linked-devices` answers `null`). `unknown` means the gate could
15779
+ * not be read; it is not "inactive" (D315).
15780
+ */
15781
+ var ExtensionSlotActivationSchema = object({
15782
+ state: _enum([
15783
+ "active",
15784
+ "inactive",
15785
+ "unknown"
15786
+ ]),
15787
+ authority: string(),
15788
+ detail: string().optional()
15789
+ });
15790
+ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
15791
+ state: literal("ok"),
15792
+ /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
15793
+ slotRef: string(),
15794
+ slot: ExtensionSlotIdSchema,
15795
+ /** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
15796
+ authority: string(),
15797
+ activation: ExtensionSlotActivationSchema.nullable(),
15798
+ value: ExtensionSlotValueSchema,
15799
+ sources: array(ExtensionSlotSourceSchema),
15800
+ /**
15801
+ * Devices the owner links to the host ON ITS OWN, by structure, and that
15802
+ * are therefore not in `value` (D655): a camera's device-tree children, and
15803
+ * the child a picked container stands for (D356 — a container is never a
15804
+ * pick, its children are). Read-only; the editor shows them and may offer
15805
+ * per-device options on them (the linked-devices tracked-event opt-in).
15806
+ * Absent when the owner links nothing beyond the picks, and from an owner
15807
+ * older than D655.
15808
+ */
15809
+ impliedSources: array(ExtensionSlotSourceSchema).optional()
15810
+ }), object({
15811
+ state: literal("unreachable"),
15812
+ addonId: string(),
15813
+ reason: string()
15814
+ })]);
15815
+ var ExtensionCandidatesSchema = object({ candidates: array(object({
15816
+ deviceId: number().int(),
15817
+ name: string(),
15818
+ type: string(),
15819
+ location: string().nullable(),
15820
+ /** The container a child belongs to — "Spotlight 2" alone does not say which. */
15821
+ parentName: string().nullable(),
15822
+ /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
15823
+ suggested: boolean(),
15824
+ /** Why it is suggested ("same location"), null when it is not. */
15825
+ reason: string().nullable()
15826
+ })) });
15827
+ /**
15828
+ * What a write did. `none` — applied in place. `host` / `parent` — the owner
15829
+ * reloaded the host (or, for an accessory child, its parent) because the
15830
+ * write changed what the host REGISTERS. A slot never adds a capability to its
15831
+ * host — that is a composition (D663) — so today's owners answer `none`.
15832
+ */
15833
+ var ExtensionSetResultSchema = object({
15834
+ applied: literal(true),
15835
+ reload: _enum([
15836
+ "none",
15837
+ "host",
15838
+ "parent"
15839
+ ])
15840
+ });
15841
+ var ExtensionSlotRefInputSchema = object({
15842
+ deviceId: number().int(),
15843
+ slotRef: string().min(1)
15844
+ });
15845
+ var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
15846
+ method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
15847
+ kind: "mutation",
15848
+ auth: "admin"
15849
+ });
15522
15850
  /**
15523
15851
  * Per-field ownership (D663). A composition may CLAIM fields of a native
15524
15852
  * cap's runtime-state slice on an existing device: `replace` overlays the
@@ -18529,17 +18857,25 @@ var NcScheduleSchema = object({
18529
18857
  */
18530
18858
  var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
18531
18859
  /**
18860
+ * How a summary window is SENT (D698): `rule` (absent) = ONE notification with
18861
+ * every section; `section` = one notification per section with something to
18862
+ * say (an unavailable section included), each titled by its section.
18863
+ */
18864
+ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
18865
+ /**
18532
18866
  * `summary`: the rule sends NOTHING per event. When a window of `schedule`
18533
18867
  * CLOSES, it sends one notification with the current state of its kinds
18534
18868
  * (low batteries, consumables to replace, devices offline, updates
18535
- * available, ...), after its own filters. Nothing to report sends nothing.
18869
+ * available, ...), after its own filters — or, with `split: 'section'`
18870
+ * (D698), one notification per section. Nothing to report sends nothing.
18536
18871
  * The schedule is the ordinary `NcSchedule` (weekly windows, IANA timezone,
18537
18872
  * midnight crossing); the send time is each window's END. Refused on the
18538
18873
  * `alarm` family, which stays instant (`systemEventDeliveryProblems`).
18539
18874
  */
18540
18875
  var NcSystemEventDeliverySchema = discriminatedUnion("mode", [object({ mode: literal("instant") }), object({
18541
18876
  mode: literal("summary"),
18542
- schedule: NcScheduleSchema
18877
+ schedule: NcScheduleSchema,
18878
+ split: NcStateSummarySplitSchema.optional()
18543
18879
  })]);
18544
18880
  /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
18545
18881
  var NcPlateMatcherSchema = object({
@@ -18679,8 +19015,14 @@ var NcSensorTransitionSchema = _enum(["raised", "cleared"]);
18679
19015
  /** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
18680
19016
  var NcZoneConditionSchema = object({
18681
19017
  ids: array(string().min(1)).min(1),
18682
- /** Quantifier over `ids` — at least one / every one visited. */
18683
- match: _enum(["any", "all"]).default("any")
19018
+ /**
19019
+ * LEGACY quantifier over `ids`. Absent = `any` (at least one visited), which
19020
+ * is what both editors mean and all they write since D690: "all of" was
19021
+ * removed from the editors because on an immediate rule it asked one
19022
+ * detection to stand in every zone at once. Still ACCEPTED, and `all` still
19023
+ * evaluated, so a stored rule keeps parsing and meaning what it meant.
19024
+ */
19025
+ match: _enum(["any", "all"]).optional()
18684
19026
  });
18685
19027
  /**
18686
19028
  * The P1 condition set — a flat AND of groups; absent group = pass;
@@ -19184,10 +19526,12 @@ var NcMediaPolicySchema = object({
19184
19526
  /**
19185
19527
  * Cooldown GRANULARITY over the subject's class — how much a fired
19186
19528
  * notification suppresses.
19187
- * - `shared` (default, and the absent value) — one window for the whole
19188
- * rule/scope: a cat silences the next dog for `cooldownSec`.
19189
- * - `per-class` — an independent window per detected class, so cat→dog fires
19190
- * at once and cat→cat still waits.
19529
+ * - `per-class` (default, and the absent value since 2026-10-01 — D36) — an
19530
+ * independent window per detected class: cat→dog fires at once, cat→cat
19531
+ * still waits.
19532
+ * - `shared` — one window for the whole rule/scope: a cat silences the next
19533
+ * dog for `cooldownSec`. Only written when an operator picks it; it is no
19534
+ * longer what an unset rule means.
19191
19535
  *
19192
19536
  * AUDIO subjects are ALWAYS per-class regardless of this setting: a scream
19193
19537
  * must not be swallowed by a bark's window (the precedent this generalizes —
@@ -19202,8 +19546,11 @@ var NcThrottleSchema = object({
19202
19546
  /**
19203
19547
  * Class granularity of the cooldown key. Optional rather than defaulted:
19204
19548
  * a Zod default does NOT run on the addon→addon cap path, so a persisted
19205
- * rule authored before this field simply carries none — and the engine
19206
- * reads absent as `shared`, the pre-existing behaviour.
19549
+ * rule authored before this field simply carries none. The engine used to
19550
+ * read absent as `shared` (D36); since 2026-10-01 it reads absent as
19551
+ * `per-class` — the operator's default — and only an explicit `shared`
19552
+ * still means `shared`. See `cooldownKey` / `keysPerClass` in the rule
19553
+ * engine, and D36's dated note.
19207
19554
  */
19208
19555
  granularity: NcThrottleGranularitySchema.optional()
19209
19556
  });
@@ -19527,11 +19874,23 @@ var NcStateSummaryPreviewSectionSchema = object({
19527
19874
  reason: string().optional()
19528
19875
  });
19529
19876
  /**
19877
+ * One notification a previewed summary would send (D698): the whole summary on
19878
+ * a `rule` split (no `section`), one section's on a `section` split.
19879
+ */
19880
+ var NcStateSummaryPreviewRowSchema = object({
19881
+ section: string().optional(),
19882
+ /** The section's name on a per-section row; every reported section's, joined, on a combined one. */
19883
+ title: string(),
19884
+ text: string(),
19885
+ count: number().int().nonnegative()
19886
+ });
19887
+ /**
19530
19888
  * The summary a rule would send now. `empty` = nothing to report and every
19531
19889
  * section read: such a summary is NOT sent. `dropped` counts the open states
19532
19890
  * the rule's own filters (or a camera mute) left out, by reason.
19533
19891
  * `excludedGroups` names the kind groups selected that have no state to report
19534
- * (backups & exports).
19892
+ * (backups & exports). `split` and `rows` (D698) say how it would be sent —
19893
+ * optional, so an older hub's answer still parses.
19535
19894
  */
19536
19895
  var NcStateSummaryPreviewSchema = object({
19537
19896
  empty: boolean(),
@@ -19539,7 +19898,9 @@ var NcStateSummaryPreviewSchema = object({
19539
19898
  text: string(),
19540
19899
  sections: array(NcStateSummaryPreviewSectionSchema),
19541
19900
  dropped: record(string(), number().int().nonnegative()),
19542
- excludedGroups: array(string())
19901
+ excludedGroups: array(string()),
19902
+ split: NcStateSummarySplitSchema.optional(),
19903
+ rows: array(NcStateSummaryPreviewRowSchema).optional()
19543
19904
  });
19544
19905
  var NcTestResultSchema = object({
19545
19906
  recordId: string(),
@@ -20553,12 +20914,26 @@ var CameraSensorRefSchema = object({
20553
20914
  function cameraSensorRefKey(ref) {
20554
20915
  return `${ref.addonId}/${ref.stableId}`;
20555
20916
  }
20556
- /** CS-1 accepts exactly one mode; CS-2 (D673) widens it to confirm / replace. */
20557
- var CameraSensorsModeSchema = _enum(["in-addition"]);
20558
- object({
20559
- mode: CameraSensorsModeSchema,
20560
- sensors: array(CameraSensorRefSchema).min(1).max(8)
20561
- }).superRefine((value, ctx) => {
20917
+ /**
20918
+ * A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
20919
+ * `replace`: its motion is the camera's, and while one is READY the camera's
20920
+ * own motion no longer counts on its own. `confirm`: while one is READY the
20921
+ * camera's own motion counts only while a confirm sensor is active — with or
20922
+ * without a replace sensor (spec C2, the controller's ruling on Q1).
20923
+ */
20924
+ var CameraSensorModeSchema = _enum([
20925
+ "in-addition",
20926
+ "confirm",
20927
+ "replace"
20928
+ ]);
20929
+ /** A stored sensor with no mode — every CS-1 row — is in addition. */
20930
+ var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
20931
+ /**
20932
+ * A camera's attached sensors. A CS-1 row carried an envelope
20933
+ * `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
20934
+ * what the write stores (D672 rule 3), so it is never written again.
20935
+ */
20936
+ var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
20562
20937
  const seen = /* @__PURE__ */ new Set();
20563
20938
  value.sensors.forEach((ref, index) => {
20564
20939
  const key = cameraSensorRefKey(ref);
@@ -20570,39 +20945,41 @@ object({
20570
20945
  seen.add(key);
20571
20946
  });
20572
20947
  });
20573
- var RefFields = {
20948
+ /** Every attachment names its mode; an older orchestrator that does not is in addition. */
20949
+ var AttachmentFields = {
20574
20950
  addonId: string(),
20575
- stableId: string()
20951
+ stableId: string(),
20952
+ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
20576
20953
  };
20577
20954
  var CameraSensorAttachmentSchema = discriminatedUnion("state", [
20578
20955
  object({
20579
- ...RefFields,
20956
+ ...AttachmentFields,
20580
20957
  state: literal("ready"),
20581
20958
  deviceId: number(),
20582
20959
  name: string(),
20583
20960
  caps: array(string()).readonly()
20584
20961
  }),
20585
20962
  object({
20586
- ...RefFields,
20963
+ ...AttachmentFields,
20587
20964
  state: literal("offline"),
20588
20965
  deviceId: number(),
20589
20966
  name: string(),
20590
20967
  reason: _enum(["offline", "disabled"])
20591
20968
  }),
20592
20969
  object({
20593
- ...RefFields,
20970
+ ...AttachmentFields,
20594
20971
  state: literal("missing"),
20595
20972
  reason: string()
20596
20973
  }),
20597
20974
  object({
20598
- ...RefFields,
20975
+ ...AttachmentFields,
20599
20976
  state: literal("unsupported"),
20600
20977
  deviceId: number(),
20601
20978
  name: string(),
20602
20979
  reason: string()
20603
20980
  }),
20604
20981
  object({
20605
- ...RefFields,
20982
+ ...AttachmentFields,
20606
20983
  state: literal("unreadable"),
20607
20984
  reason: string()
20608
20985
  })
@@ -20615,17 +20992,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
20615
20992
  * say.
20616
20993
  */
20617
20994
  var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
20995
+ /** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
20996
+ var CameraOwnMotionSchema = _enum([
20997
+ "always",
20998
+ "when-confirmed",
20999
+ "never"
21000
+ ]);
21001
+ /** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
21002
+ var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
21003
+ /**
21004
+ * The camera's OWN onboard motion (D696): the raw input the bridge combines,
21005
+ * never the effective value. The camera's `motion` slice is the effective one,
21006
+ * so a view of the camera's own row reads this.
21007
+ * - `atMs`: when the bridge received the camera's last own edge.
21008
+ * - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
21009
+ * AND it is younger than the window the bridge counts the camera's own motion
21010
+ * for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
21011
+ * sends a clear (heartbeats only) therefore reads `false` once no push came
21012
+ * within the window; a status read is a snapshot, so a live view re-asks.
21013
+ * Absent = this orchestrator has not received the camera's own motion since it
21014
+ * started (unknown, never "quiet"), or an orchestrator older than D696.
21015
+ */
21016
+ var CameraRawLevelSchema = object({
21017
+ detected: boolean(),
21018
+ atMs: number()
21019
+ });
20618
21020
  var CameraSensorsStatusSchema = discriminatedUnion("state", [
20619
- object({ state: literal("not-configured") }),
21021
+ object({
21022
+ state: literal("not-configured"),
21023
+ cameraLevel: CameraRawLevelSchema.optional()
21024
+ }),
20620
21025
  object({
20621
21026
  state: literal("unreadable"),
20622
- reason: string()
21027
+ reason: string(),
21028
+ cameraLevel: CameraRawLevelSchema.optional()
20623
21029
  }),
20624
21030
  object({
20625
21031
  state: literal("configured"),
20626
- mode: CameraSensorsModeSchema,
21032
+ cameraLevel: CameraRawLevelSchema.optional(),
20627
21033
  sensors: array(CameraSensorAttachmentSchema).readonly(),
20628
- notForwarded: CameraSensorsNotForwardedSchema.optional()
21034
+ /** Absent = an orchestrator older than CS-2: it does not say (D315). */
21035
+ cameraMotion: CameraOwnMotionSchema.optional(),
21036
+ notForwarded: CameraSensorsNotForwardedSchema.optional(),
21037
+ notEnforced: CameraSensorsNotEnforcedSchema.optional()
20629
21038
  })
20630
21039
  ]);
20631
21040
  Object.freeze({
@@ -22460,7 +22869,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22460
22869
  trackIds: array(string()).min(1)
22461
22870
  }), object({
22462
22871
  deleted: number().int(),
22463
- failed: array(string()).readonly()
22872
+ failed: array(string()).readonly(),
22873
+ sparedMediaIds: array(number().int()).readonly().optional()
22464
22874
  }), {
22465
22875
  kind: "mutation",
22466
22876
  auth: "admin"
@@ -22469,7 +22879,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22469
22879
  deviceId: number(),
22470
22880
  trackId: string(),
22471
22881
  flags: TrackFlagsPatchSchema
22472
- }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(BirthDecisionQueryInputSchema, array(BirthDecisionRecordSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
22882
+ }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(SetTrackRelationInputSchema, TrackRelationSchema, { kind: "mutation" }), method(ClearTrackRelationInputSchema, ClearTrackRelationResultSchema, { kind: "mutation" }), method(SetTrackPurityInputSchema, SetTrackPurityResultSchema, { kind: "mutation" }), method(ListTrackRelationsInputSchema, ListTrackRelationsResultSchema, { kind: "query" }), method(BirthDecisionQueryInputSchema, array(BirthDecisionRecordSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
22473
22883
  kind: "query",
22474
22884
  auth: "admin"
22475
22885
  }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
@@ -23855,8 +24265,10 @@ var RunnerCameraConfigSchema = object({
23855
24265
  * - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
23856
24266
  * analyzer providers) running on decoded frames in this runner.
23857
24267
  * - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
23858
- * analytics). The provider emits ProviderMotion
23859
- * events; the orchestrator forwards to `reportMotion`.
24268
+ * analytics). The provider emits its raw push as `ProviderMotion`
24269
+ * (D673); the orchestrator's camera-sensors bridge re-emits the camera's
24270
+ * effective motion as `MotionOnMotionChanged`, which is what reaches
24271
+ * `reportMotion`.
23860
24272
  */
23861
24273
  motionSources: MotionSourcesSchema.default(["analyzer"]),
23862
24274
  /**
@@ -24033,7 +24445,15 @@ var RunnerLocalLoadSchema = object({
24033
24445
  hasGpu: boolean(),
24034
24446
  inferenceBackend: string().optional(),
24035
24447
  cpuCores: number().optional()
24036
- })
24448
+ }),
24449
+ /**
24450
+ * Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
24451
+ * runner never writes it. ABSENT = a runner older than D696, which still
24452
+ * writes the slice from its phase machine; the orchestrator does not write
24453
+ * while any runner node is absent-or-unanswered, so one slice never has two
24454
+ * writers.
24455
+ */
24456
+ motionSliceWriter: literal("orchestrator").optional()
24037
24457
  });
24038
24458
  /**
24039
24459
  * Aggregate runtime metrics for the runner's whole local pool. Mirrors the
@@ -24667,7 +25087,64 @@ var NodeInferenceDevicesSchema = object({
24667
25087
  reachable: boolean(),
24668
25088
  devices: array(NodeInferenceDeviceSchema).readonly()
24669
25089
  });
24670
- method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
25090
+ /**
25091
+ * Pipeline Orchestrator capability — global load balancer + camera dispatcher.
25092
+ *
25093
+ * Lives on the hub. Tracks the camera-to-agent assignment map, listens to
25094
+ * device lifecycle events, queries each runner's capacity + hardware
25095
+ * profile, and dispatches `attachCamera` / `detachCamera` cap calls to the
25096
+ * appropriate runner instances. Persists assignments via the multi-level
25097
+ * settings store so they survive hub restarts.
25098
+ *
25099
+ * Strictly the control plane: never sees a frame, never calls inference,
25100
+ * never drains queues. The runner does that work locally on each agent.
25101
+ */
25102
+ /**
25103
+ * The input of `setCameraSensors` (G5, D676): the ONE typed write path of a
25104
+ * camera's attached sensors (D672). `config: null` removes the attachment —
25105
+ * the camera reads `not-configured` again, never `unreadable`.
25106
+ */
25107
+ var SetCameraSensorsInputSchema = object({
25108
+ deviceId: number().int().nonnegative(),
25109
+ /** `null` removes the attachment: the camera goes back to `not-configured`. */
25110
+ config: CameraSensorsConfigSchema.nullable()
25111
+ });
25112
+ /**
25113
+ * Why an early occupancy look (D691) was not scheduled.
25114
+ *
25115
+ * - `unknown-camera` — no session was ever dispatched for it, so there is no
25116
+ * node and no config to attach a burst with.
25117
+ * - `out-of-range` — the ask is negative or further out than the orchestrator
25118
+ * will hold a timer for; the parked-object cadence is the answer there.
25119
+ * - `no-burst-producer` — this build has no burst producer at all.
25120
+ * - `already-looked` — this camera's ONE early look since its last session has
25121
+ * been spent. A look's own burst can re-arm a flickering flip, and a look
25122
+ * per arm would chain a burst every ~30 s forever (review H2); the next
25123
+ * real session re-arms the budget.
25124
+ */
25125
+ var OccupancyLookRefusalSchema = _enum([
25126
+ "unknown-camera",
25127
+ "out-of-range",
25128
+ "no-burst-producer",
25129
+ "already-looked"
25130
+ ]);
25131
+ method(object({
25132
+ deviceId: number().int().nonnegative(),
25133
+ /** How long from NOW until the pending flip's sustain window ends. RELATIVE,
25134
+ * so the caller's clock and the orchestrator's never have to agree. */
25135
+ afterMs: number().finite(),
25136
+ /** Why, for the log. */
25137
+ reason: string()
25138
+ }), object({
25139
+ scheduled: boolean(),
25140
+ /** When `scheduled`: how long until the burst is dialled. */
25141
+ dueInMs: number().optional(),
25142
+ /** When not `scheduled`: why. */
25143
+ refusedBecause: OccupancyLookRefusalSchema.optional()
25144
+ }), {
25145
+ kind: "mutation",
25146
+ auth: "admin"
25147
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
24671
25148
  kind: "mutation",
24672
25149
  auth: "admin"
24673
25150
  }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
@@ -24821,7 +25298,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
24821
25298
  }), CameraSwitchGroupSchema, {
24822
25299
  kind: "mutation",
24823
25300
  auth: "admin"
24824
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
25301
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(SetCameraSensorsInputSchema, object({ success: literal(true) }), {
25302
+ kind: "mutation",
25303
+ auth: "admin"
25304
+ }), method(_void(), DiskReconcileJobSchema, {
24825
25305
  kind: "mutation",
24826
25306
  auth: "admin"
24827
25307
  }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
@@ -27540,219 +28020,6 @@ var CLIP_PLAYBACK_OPTIONS = {
27540
28020
  }
27541
28021
  };
27542
28022
  /**
27543
- * Doorbell button cap. Two kinds of providers coexist behind this cap
27544
- * name (same pattern as `snapshot`):
27545
- *
27546
- * - **Native** providers: registered per-device by device-driver
27547
- * addons via `ctx.registerNativeCap` — either on a
27548
- * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
27549
- * or directly on the camera (Reolink registers at camera level).
27550
- * Emits an `onPressed` event every time the firmware pushes a
27551
- * ring; status tracks the last press and a pressCount since start
27552
- * (diagnostic).
27553
- *
27554
- * - **Wrapper** provider: the `virtual-doorbell` system builtin
27555
- * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
27556
- * device (contact / switch / event-emitter …) into a doorbell for
27557
- * a camera. `defaultActive: false` — the operator explicitly binds
27558
- * it per camera in the device-bindings UI, then picks the source
27559
- * device + trigger in the per-device settings.
27560
- *
27561
- * The DeviceEventPropagator re-emits `onPressed` on the camera parent
27562
- * — subscribers listening at the camera level receive ring events
27563
- * with `via[]` populated. No code on the parent needed.
27564
- */
27565
- var DoorbellStatusSchema = object({
27566
- /** Ms epoch of the last press. null = never observed since this provider started. */
27567
- lastPressedAt: number().nullable(),
27568
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
27569
- pressCountSinceStart: number()
27570
- });
27571
- var DoorbellPressEventSchema = object({
27572
- deviceId: number(),
27573
- timestamp: number()
27574
- });
27575
- /**
27576
- * The `doorbell-source` extension slot's editable value (D648): the camera's
27577
- * virtual-doorbell trigger devices, exactly what the wrapper's
27578
- * `doorbellSources` persists (as `{ deviceId }` records).
27579
- */
27580
- var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
27581
- /**
27582
- * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
27583
- * doorbell, owned by the `virtual-doorbell` wrapper over its
27584
- * `doorbellSources` store (D648). A source rings when one of its
27585
- * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
27586
- * different authority (`deviceManager.setWrapperActive`, D62) — the slot
27587
- * reports it, it never writes it.
27588
- */
27589
- var DOORBELL_SOURCE_SLOT = {
27590
- id: "doorbell-source",
27591
- label: "Doorbell trigger devices",
27592
- 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.",
27593
- shape: "association",
27594
- hostDeviceTypes: [DeviceType.Camera],
27595
- sourceCaps: SOURCE_CAPS,
27596
- cardinality: "many",
27597
- value: DoorbellSourceSlotValueSchema
27598
- };
27599
- var doorbellCapability = {
27600
- name: "doorbell",
27601
- scope: "device",
27602
- deviceNative: true,
27603
- mode: "singleton",
27604
- kind: "wrapper",
27605
- defaultActive: false,
27606
- deviceTypes: [DeviceType.Button, DeviceType.Camera],
27607
- extensionSlots: [DOORBELL_SOURCE_SLOT],
27608
- methods: {},
27609
- events: {
27610
- /**
27611
- * Fires once per physical press. Reolink delivers via Baichuan
27612
- * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
27613
- * release/duration — it's a pulse.
27614
- */
27615
- onPressed: {
27616
- data: DoorbellPressEventSchema,
27617
- fromState: {
27618
- field: "lastPressedAt",
27619
- on: "advance"
27620
- }
27621
- } },
27622
- status: {
27623
- schema: DoorbellStatusSchema,
27624
- kind: "push"
27625
- },
27626
- /**
27627
- * Runtime-state slice — last press timestamp + lifetime press count.
27628
- * Mirrored by the kernel and readable via
27629
- * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
27630
- * without subscribing.
27631
- */
27632
- runtimeState: DoorbellStatusSchema,
27633
- /**
27634
- * 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.
27635
- *
27636
- * See `RuntimeStateDurability`. Enforced by
27637
- * `scripts/check-runtime-state-durability.ts`.
27638
- */
27639
- durability: "restored"
27640
- };
27641
- var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
27642
- DeviceType.Camera, DeviceType.Camera;
27643
- /** A slot's editable value, discriminated on `slot`. */
27644
- var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
27645
- DeviceType.Camera;
27646
- var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
27647
- state: literal("unreachable"),
27648
- reason: string()
27649
- })]);
27650
- /** One provider of slots — the D554 source-listing row. */
27651
- var ExtensionSourceSchema = object({
27652
- /** The routing prefix of every `slotRef` this provider serves. */
27653
- source: string(),
27654
- label: string(),
27655
- /** Stamped by the dispatcher from the registry (D557). */
27656
- addonId: string().optional(),
27657
- availability: ExtensionSourceAvailabilitySchema
27658
- });
27659
- /**
27660
- * How one picked source stands. `missing` — no such device (deleted, or an id
27661
- * that never existed); `foreign` — a device the slot's owner cannot read from
27662
- * (a source owned by another addon); `unavailable` — it exists but is not a
27663
- * valid source now (a container, which is never a pick). A source in any of
27664
- * these states is SHOWN, never silently dropped or re-pointed.
27665
- */
27666
- var ExtensionSourceHealthSchema = _enum([
27667
- "ok",
27668
- "missing",
27669
- "foreign",
27670
- "unavailable"
27671
- ]);
27672
- var ExtensionSlotSourceSchema = object({
27673
- deviceId: number().int(),
27674
- /** The device's name, or null when it could not be resolved (`missing`). */
27675
- name: string().nullable(),
27676
- health: ExtensionSourceHealthSchema,
27677
- detail: string().optional()
27678
- });
27679
- /**
27680
- * A DIFFERENT authority that gates whether the slot's sources do anything —
27681
- * reported read-only, named, never written through this contract (D62). The
27682
- * virtual doorbell's sources ring only while the wrapper is bound to the
27683
- * camera, and that binding belongs to `deviceManager.setWrapperActive`.
27684
- * `unknown` means the gate could not be read; it is not "inactive" (D315).
27685
- */
27686
- var ExtensionSlotActivationSchema = object({
27687
- state: _enum([
27688
- "active",
27689
- "inactive",
27690
- "unknown"
27691
- ]),
27692
- authority: string(),
27693
- detail: string().optional()
27694
- });
27695
- var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
27696
- state: literal("ok"),
27697
- /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
27698
- slotRef: string(),
27699
- slot: ExtensionSlotIdSchema,
27700
- /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
27701
- authority: string(),
27702
- activation: ExtensionSlotActivationSchema.nullable(),
27703
- value: ExtensionSlotValueSchema,
27704
- sources: array(ExtensionSlotSourceSchema),
27705
- /**
27706
- * Devices the owner links to the host ON ITS OWN, by structure, and that
27707
- * are therefore not in `value` (D655): a camera's device-tree children, and
27708
- * the child a picked container stands for (D356 — a container is never a
27709
- * pick, its children are). Read-only; the editor shows them and may offer
27710
- * per-device options on them (the linked-devices tracked-event opt-in).
27711
- * Absent when the owner links nothing beyond the picks, and from an owner
27712
- * older than D655.
27713
- */
27714
- impliedSources: array(ExtensionSlotSourceSchema).optional()
27715
- }), object({
27716
- state: literal("unreachable"),
27717
- addonId: string(),
27718
- reason: string()
27719
- })]);
27720
- var ExtensionCandidatesSchema = object({ candidates: array(object({
27721
- deviceId: number().int(),
27722
- name: string(),
27723
- type: string(),
27724
- location: string().nullable(),
27725
- /** The container a child belongs to — "Spotlight 2" alone does not say which. */
27726
- parentName: string().nullable(),
27727
- /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
27728
- suggested: boolean(),
27729
- /** Why it is suggested ("same location"), null when it is not. */
27730
- reason: string().nullable()
27731
- })) });
27732
- /**
27733
- * What a write did. `none` — applied in place. `host` / `parent` — the owner
27734
- * reloaded the host (or, for an accessory child, its parent) because the
27735
- * write changed what the host REGISTERS. A slot never adds a capability to its
27736
- * host — that is a composition (D663) — so today's owners answer `none`.
27737
- */
27738
- var ExtensionSetResultSchema = object({
27739
- applied: literal(true),
27740
- reload: _enum([
27741
- "none",
27742
- "host",
27743
- "parent"
27744
- ])
27745
- });
27746
- var ExtensionSlotRefInputSchema = object({
27747
- deviceId: number().int(),
27748
- slotRef: string().min(1)
27749
- });
27750
- var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
27751
- method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
27752
- kind: "mutation",
27753
- auth: "admin"
27754
- });
27755
- /**
27756
28023
  * Optional client-side hints sent at session creation to help the provider
27757
28024
  * pick the best native source. All fields optional — a viewer that knows
27758
28025
  * nothing still gets a sane default. (Relocated from the retired `webrtc`
@@ -30220,6 +30487,70 @@ onStatusChanged: { data: object({
30220
30487
  * whether persisting is worth a SQLite commit. */
30221
30488
  volatileStateFields: ["lastChangedAt"]
30222
30489
  };
30490
+ var DoorbellStatusSchema = object({
30491
+ /** Ms epoch of the last press. null = never observed since this provider started. */
30492
+ lastPressedAt: number().nullable(),
30493
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
30494
+ pressCountSinceStart: number()
30495
+ });
30496
+ var DoorbellPressEventSchema = object({
30497
+ deviceId: number(),
30498
+ timestamp: number()
30499
+ });
30500
+ /**
30501
+ * Doorbell button cap. Two kinds of provider serve it, and to every consumer
30502
+ * they are the same cap:
30503
+ *
30504
+ * - **Native** providers, registered per device by a driver addon through
30505
+ * `ctx.registerNativeCap` — a `DeviceType.Button` accessory with
30506
+ * `role: DeviceRole.Doorbell`, or the camera itself (Reolink registers at
30507
+ * camera level). They emit `onPressed` on every firmware ring.
30508
+ * - **A composed doorbell** (D670, D671): a camera's customization gives it
30509
+ * the cap, its `lastPressedAt` rising from the sources the operator
30510
+ * assigned in Customize → Doorbell, and the composer emits `onPressed`
30511
+ * from that field's advance (`fromState`).
30512
+ *
30513
+ * The DeviceEventPropagator re-emits `onPressed` on the camera parent.
30514
+ */
30515
+ var doorbellCapability = {
30516
+ name: "doorbell",
30517
+ scope: "device",
30518
+ deviceNative: true,
30519
+ mode: "singleton",
30520
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
30521
+ methods: {},
30522
+ events: {
30523
+ /**
30524
+ * Fires once per physical press. Reolink delivers via Baichuan
30525
+ * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
30526
+ * release/duration — it's a pulse.
30527
+ */
30528
+ onPressed: {
30529
+ data: DoorbellPressEventSchema,
30530
+ fromState: {
30531
+ field: "lastPressedAt",
30532
+ on: "advance"
30533
+ }
30534
+ } },
30535
+ status: {
30536
+ schema: DoorbellStatusSchema,
30537
+ kind: "push"
30538
+ },
30539
+ /**
30540
+ * Runtime-state slice — last press timestamp + lifetime press count.
30541
+ * Mirrored by the kernel and readable via
30542
+ * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
30543
+ * without subscribing.
30544
+ */
30545
+ runtimeState: DoorbellStatusSchema,
30546
+ /**
30547
+ * 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.
30548
+ *
30549
+ * See `RuntimeStateDurability`. Enforced by
30550
+ * `scripts/check-runtime-state-durability.ts`.
30551
+ */
30552
+ durability: "restored"
30553
+ };
30223
30554
  /**
30224
30555
  * Enum-state sensor — a string value picked from a finite option set.
30225
30556
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -32359,39 +32690,14 @@ authKey: string().optional() }), object({
32359
32690
  /** Human-readable error when `ok: false`. */
32360
32691
  error: string().optional()
32361
32692
  }), { kind: "mutation" });
32362
- /**
32363
- * Hardware / firmware motion sensor cap — binary detected state plus
32364
- * a timestamp of the last observation. Distinct from
32365
- * `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
32366
- * `motion` is the lightweight readout from on-camera motion (Reolink
32367
- * `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
32368
- *
32369
- * Native-motion providers also fan out to `detection.camera-native`
32370
- * with `source: 'onboard'` so cross-cutting system services
32371
- * (alert-center, advanced-notifier) can subscribe once and receive
32372
- * motion from every camera.
32373
- */
32374
- /**
32375
- * How long after a camera's last rising edge `pipeline-analytics` closes the
32376
- * motion EPISODE row it kept open for it (D475) — "il delay della cap", in
32377
- * the operator's words. One authority for the whole system: every provider
32378
- * that seeds `autoClearAfterMs` on a `Camera` device writes this SAME
32379
- * constant while `detected: true` (never its own number — Hikvision used to
32380
- * seed its internal 3 s inactivity timer here, which is a different clock for
32381
- * a different purpose), and `MotionEpisodeTracker` imports it directly rather
32382
- * than reading the live cap value on the hot path. A `Sensor` device (HA
32383
- * binary sensor, Homematic) gets a genuine push both ways and has no episode
32384
- * to close on a timer, so it writes `null`, never this constant.
32385
- */
32386
- var MOTION_CLOSE_AFTER_MS = 15e3;
32387
32693
  var MotionStatusSchema = object({
32388
32694
  detected: boolean(),
32389
32695
  /** Ms epoch of the last detected-true observation. Null if never detected. */
32390
32696
  lastDetectedAt: number().nullable(),
32391
32697
  /**
32392
- * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
32393
- * `null` while false and on every `Sensor` device (D475) — see that
32394
- * constant's doc for the one-authority rule.
32698
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
32699
+ * orchestrator writes it, D696), `null` while false and on every `Sensor`
32700
+ * device (D475) — see that constant's doc for the one-authority rule.
32395
32701
  *
32396
32702
  * ## Reading this field still arms nothing
32397
32703
  *
@@ -32409,34 +32715,31 @@ var MotionStatusSchema = object({
32409
32715
  * `addon-export-alexa/src/motion-clear-hold.ts` and
32410
32716
  * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
32411
32717
  *
32412
- * ## Who writes it
32413
- *
32414
- * - **Cameras** — the runner's phase machine, `active → watching` on
32415
- * `cooldown_expired`, which then writes this slice with
32416
- * `detected: false` (`handlePhaseChanged` in
32417
- * `pipeline-runner/index.ts`). It produces the FALLING edge, which
32418
- * matters most for the sources that only ever push a rising one:
32419
- * Reolink emits `MotionOnMotionChanged { detected: true }` and never
32420
- * a false.
32421
- * - **Sensors** (Home Assistant binary sensors, Homematic) — the
32422
- * provider pushes the false itself, from the upstream system's own
32423
- * state change. No phase machine is involved.
32718
+ * ## Who writes it (D696)
32424
32719
  *
32425
- * ### The phase machine is CANONICAL, not sole — and that is a defect
32720
+ * - **Cameras** — the orchestrator, and nothing else. It writes the camera's
32721
+ * EFFECTIVE motion (`addon-pipeline-orchestrator`
32722
+ * `camera-sensors/motion-slice.ts`), alongside the effective
32723
+ * `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
32724
+ * for a split camera, an unsplit emitter's direct event, the analyzer and
32725
+ * device activity, as the camera's `motionSources` counts them. A source
32726
+ * that never sends a clear falls one window after its last `true`.
32727
+ * `lastDetectedAt` moves only on an effective rise. No camera provider
32728
+ * writes this slice (not even a boot seed), and neither does the runner's
32729
+ * phase machine: its phase is "a session is attached" for every on-motion
32730
+ * session, not motion, and it now has its own `DetectionPhaseTransition`.
32731
+ * A provider's `isDetected` answers from the hub's slice.
32732
+ * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
32733
+ * imports) — the provider pushes both edges itself, from the upstream
32734
+ * system's own state change. That is the sensor's own fact.
32426
32735
  *
32427
- * An earlier revision of this docblock (mine, 2026-09-12) claimed the
32428
- * phase machine is the sole writer for a camera. It is not.
32429
- * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
32430
- * `setCapSlice(motionCapability, …)` on their own rising edge, and
32431
- * Hikvision's comment says why: it read THIS docblock, agreed the
32432
- * runner is canonical, and wrote anyway to avoid per-tick churn. So
32433
- * two authorities can disagree about one slice, which this repo
32434
- * forbids, and the doc said otherwise — which is worse than saying
32435
- * nothing, because it reads as verification.
32736
+ * `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
32737
+ * `motion` slice; each sensor writer is a named exemption.
32436
32738
  *
32437
- * This predates D475 and is not fixed there: the fix touches every
32438
- * camera provider. Recorded in D475's Consequences. Do not restore the
32439
- * "sole writer" wording without also removing the other writers.
32739
+ * This replaces the D475 §4 rule ("the phase machine is the sole writer").
32740
+ * That rule was never true: Hikvision and Amcrest wrote the slice raw beside
32741
+ * it, every provider seeded it at boot, and every session left it
32742
+ * `detected: true` after its detach.
32440
32743
  */
32441
32744
  autoClearAfterMs: number().nullable()
32442
32745
  });
@@ -32508,11 +32811,12 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
32508
32811
  */
32509
32812
  runtimeState: MotionStatusSchema,
32510
32813
  /**
32511
- * Runtime-state durability: **session** — every writer of this slice
32814
+ * Runtime-state durability: **session** — the writer of this slice
32512
32815
  * writes only on an EDGE, so a restored `detected: true` would stay
32513
32816
  * frozen until the next one instead of being corrected. The next edge
32514
- * re-publishes the real state. (On who the writers are, and why there
32515
- * is more than one, see `autoClearAfterMs` above.)
32817
+ * re-publishes the real state, and the orchestrator re-publishes every
32818
+ * camera when it starts writing (D696; on who writes it, see
32819
+ * `autoClearAfterMs` above).
32516
32820
  *
32517
32821
  * See `RuntimeStateDurability`. Enforced by
32518
32822
  * `scripts/check-runtime-state-durability.ts`.
@@ -35053,8 +35357,7 @@ var ptzAutotrackCapability = {
35053
35357
  deviceNative: true,
35054
35358
  mode: "singleton",
35055
35359
  /**
35056
- * Two kinds of provider behind one name, the same shape `snapshot` and
35057
- * `doorbell` use:
35360
+ * Two kinds of provider behind one name, the same shape `snapshot` uses:
35058
35361
  *
35059
35362
  * - **Native**: the camera's own firmware autotrack, registered per device by
35060
35363
  * the driver when the probe says it exists (Reolink: yes; Hikvision:
@@ -35062,7 +35365,7 @@ var ptzAutotrackCapability = {
35062
35365
  * - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
35063
35366
  * which follows a subject with `ptz.move` pulses driven by the detection
35064
35367
  * pipeline. `defaultActive: false` — the operator binds it per camera in
35065
- * the bindings UI, exactly as `virtual-doorbell` is bound.
35368
+ * the bindings UI.
35066
35369
  *
35067
35370
  * The binding chooses WHICH implementation answers; `setEnabled` stays the
35068
35371
  * one switch for the function either way. A camera never has both driving its
@@ -39405,47 +39708,6 @@ var zoneRulesCapability = {
39405
39708
  */
39406
39709
  durability: "restored"
39407
39710
  };
39408
- var NUMBER = {
39409
- kind: "fixed",
39410
- result: ["number"]
39411
- };
39412
- var BOOLEAN = {
39413
- kind: "fixed",
39414
- result: ["boolean"]
39415
- };
39416
- Object.freeze({
39417
- min: NUMBER,
39418
- max: NUMBER,
39419
- abs: NUMBER,
39420
- floor: NUMBER,
39421
- ceil: NUMBER,
39422
- sqrt: NUMBER,
39423
- round: NUMBER,
39424
- pow: NUMBER,
39425
- clamp: NUMBER,
39426
- avg: NUMBER,
39427
- sum: NUMBER,
39428
- age: NUMBER,
39429
- convert: NUMBER,
39430
- coalesce: { kind: "coalesce" },
39431
- any: BOOLEAN,
39432
- all: BOOLEAN,
39433
- within: BOOLEAN,
39434
- latest: {
39435
- kind: "fixed",
39436
- result: ["number", "null"]
39437
- },
39438
- number: {
39439
- kind: "fixed",
39440
- result: ["number", "null"]
39441
- },
39442
- rose: {
39443
- kind: "fixed",
39444
- result: ["number", "null"]
39445
- },
39446
- count: NUMBER
39447
- });
39448
- `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
39449
39711
  /**
39450
39712
  * Accessory device helpers — shared across drivers.
39451
39713
  *
@@ -43597,6 +43859,12 @@ Object.freeze({
43597
43859
  addonId: null,
43598
43860
  access: "view"
43599
43861
  },
43862
+ "coreBlocks.listComposableCaps": {
43863
+ capName: "core-blocks",
43864
+ capScope: "system",
43865
+ addonId: null,
43866
+ access: "view"
43867
+ },
43600
43868
  "coreBlocks.listCompositions": {
43601
43869
  capName: "core-blocks",
43602
43870
  capScope: "system",
@@ -43675,6 +43943,18 @@ Object.freeze({
43675
43943
  addonId: null,
43676
43944
  access: "view"
43677
43945
  },
43946
+ "databaseSnapshot.listDatabases": {
43947
+ capName: "database-snapshot",
43948
+ capScope: "system",
43949
+ addonId: null,
43950
+ access: "view"
43951
+ },
43952
+ "databaseSnapshot.writeSnapshot": {
43953
+ capName: "database-snapshot",
43954
+ capScope: "system",
43955
+ addonId: null,
43956
+ access: "create"
43957
+ },
43678
43958
  "dataStoreProvider.aggregate": {
43679
43959
  capName: "data-store-provider",
43680
43960
  capScope: "system",
@@ -46411,6 +46691,12 @@ Object.freeze({
46411
46691
  addonId: null,
46412
46692
  access: "create"
46413
46693
  },
46694
+ "pipelineAnalytics.clearTrackRelation": {
46695
+ capName: "pipeline-analytics",
46696
+ capScope: "device",
46697
+ addonId: null,
46698
+ access: "delete"
46699
+ },
46414
46700
  "pipelineAnalytics.clearTracks": {
46415
46701
  capName: "pipeline-analytics",
46416
46702
  capScope: "device",
@@ -46663,6 +46949,12 @@ Object.freeze({
46663
46949
  addonId: null,
46664
46950
  access: "view"
46665
46951
  },
46952
+ "pipelineAnalytics.listTrackRelations": {
46953
+ capName: "pipeline-analytics",
46954
+ capScope: "device",
46955
+ addonId: null,
46956
+ access: "view"
46957
+ },
46666
46958
  "pipelineAnalytics.listTracks": {
46667
46959
  capName: "pipeline-analytics",
46668
46960
  capScope: "device",
@@ -46777,6 +47069,18 @@ Object.freeze({
46777
47069
  addonId: null,
46778
47070
  access: "create"
46779
47071
  },
47072
+ "pipelineAnalytics.setTrackPurity": {
47073
+ capName: "pipeline-analytics",
47074
+ capScope: "device",
47075
+ addonId: null,
47076
+ access: "create"
47077
+ },
47078
+ "pipelineAnalytics.setTrackRelation": {
47079
+ capName: "pipeline-analytics",
47080
+ capScope: "device",
47081
+ addonId: null,
47082
+ access: "create"
47083
+ },
46780
47084
  "pipelineAnalytics.startStorageMigrationMove": {
46781
47085
  capName: "pipeline-analytics",
46782
47086
  capScope: "device",
@@ -47215,6 +47519,12 @@ Object.freeze({
47215
47519
  addonId: null,
47216
47520
  access: "delete"
47217
47521
  },
47522
+ "pipelineOrchestrator.requestOccupancyLook": {
47523
+ capName: "pipeline-orchestrator",
47524
+ capScope: "system",
47525
+ addonId: null,
47526
+ access: "create"
47527
+ },
47218
47528
  "pipelineOrchestrator.resetNodePipelineDefaults": {
47219
47529
  capName: "pipeline-orchestrator",
47220
47530
  capScope: "system",
@@ -47281,6 +47591,12 @@ Object.freeze({
47281
47591
  addonId: null,
47282
47592
  access: "create"
47283
47593
  },
47594
+ "pipelineOrchestrator.setCameraSensors": {
47595
+ capName: "pipeline-orchestrator",
47596
+ capScope: "system",
47597
+ addonId: null,
47598
+ access: "create"
47599
+ },
47284
47600
  "pipelineOrchestrator.setCameraStepOverride": {
47285
47601
  capName: "pipeline-orchestrator",
47286
47602
  capScope: "system",
@@ -50691,6 +51007,11 @@ Object.freeze({
50691
51007
  form: "single",
50692
51008
  optional: false
50693
51009
  }],
51010
+ "pipelineAnalytics.clearTrackRelation": [{
51011
+ name: "deviceId",
51012
+ form: "single",
51013
+ optional: false
51014
+ }],
50694
51015
  "pipelineAnalytics.clearTracks": [{
50695
51016
  name: "deviceId",
50696
51017
  form: "single",
@@ -50841,6 +51162,11 @@ Object.freeze({
50841
51162
  form: "single",
50842
51163
  optional: false
50843
51164
  }],
51165
+ "pipelineAnalytics.listTrackRelations": [{
51166
+ name: "deviceId",
51167
+ form: "single",
51168
+ optional: false
51169
+ }],
50844
51170
  "pipelineAnalytics.listTracks": [{
50845
51171
  name: "deviceId",
50846
51172
  form: "single",
@@ -50911,6 +51237,16 @@ Object.freeze({
50911
51237
  form: "single",
50912
51238
  optional: false
50913
51239
  }],
51240
+ "pipelineAnalytics.setTrackPurity": [{
51241
+ name: "deviceId",
51242
+ form: "single",
51243
+ optional: false
51244
+ }],
51245
+ "pipelineAnalytics.setTrackRelation": [{
51246
+ name: "deviceId",
51247
+ form: "single",
51248
+ optional: false
51249
+ }],
50914
51250
  "pipelineAnalytics.wipeAllAnalytics": [{
50915
51251
  name: "deviceId",
50916
51252
  form: "single",
@@ -50981,6 +51317,11 @@ Object.freeze({
50981
51317
  form: "single",
50982
51318
  optional: false
50983
51319
  }],
51320
+ "pipelineOrchestrator.requestOccupancyLook": [{
51321
+ name: "deviceId",
51322
+ form: "single",
51323
+ optional: false
51324
+ }],
50984
51325
  "pipelineOrchestrator.resolvePipeline": [{
50985
51326
  name: "deviceId",
50986
51327
  form: "single",
@@ -50991,6 +51332,11 @@ Object.freeze({
50991
51332
  form: "single",
50992
51333
  optional: false
50993
51334
  }],
51335
+ "pipelineOrchestrator.setCameraSensors": [{
51336
+ name: "deviceId",
51337
+ form: "single",
51338
+ optional: false
51339
+ }],
50994
51340
  "pipelineOrchestrator.setCameraStepOverride": [{
50995
51341
  name: "deviceId",
50996
51342
  form: "single",
@@ -52137,6 +52483,18 @@ var STATE_SUMMARY_VARS = [
52137
52483
  systemEventKinds: [...SUMMARISABLE],
52138
52484
  systemEventDeliveries: ["summary"]
52139
52485
  },
52486
+ {
52487
+ name: "summarySection",
52488
+ label: "Summary: this section",
52489
+ description: "The section a per-section summary row is about (D698); on a summary sent as one message, every section it reports, comma-separated.",
52490
+ example: "Batterie scariche",
52491
+ group: "system",
52492
+ families: ["rule"],
52493
+ fields: [...RULE_TEXT],
52494
+ kinds: ["system"],
52495
+ systemEventKinds: [...SUMMARISABLE],
52496
+ systemEventDeliveries: ["summary"]
52497
+ },
52140
52498
  ...STATE_SUMMARY_SECTION_VARS.map((v) => ({
52141
52499
  name: v.name,
52142
52500
  label: v.label,
@@ -52213,6 +52571,37 @@ var STATE_SUMMARY_VARS = [
52213
52571
  [...RULE_TEXT],
52214
52572
  ...STATE_SUMMARY_VARS
52215
52573
  ];
52574
+ new Set([
52575
+ "disarmed",
52576
+ "armed_home",
52577
+ "armed_away",
52578
+ "armed_night",
52579
+ "armed_vacation",
52580
+ "armed_custom_bypass",
52581
+ "arming",
52582
+ "disarming",
52583
+ "pending",
52584
+ "triggered",
52585
+ "open",
52586
+ "opening",
52587
+ "closing",
52588
+ "closed",
52589
+ "stopped",
52590
+ "locked",
52591
+ "unlocked",
52592
+ "locking",
52593
+ "unlocking",
52594
+ "jammed",
52595
+ "on",
52596
+ "off",
52597
+ "home",
52598
+ "not_home",
52599
+ "matched",
52600
+ "diverged",
52601
+ "unknown",
52602
+ "latched",
52603
+ "live"
52604
+ ]);
52216
52605
  /**
52217
52606
  * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
52218
52607
  *
@@ -52444,6 +52833,25 @@ TimelapseRuleInputSchema.extend({
52444
52833
  createdAt: number(),
52445
52834
  updatedAt: number()
52446
52835
  });
52836
+ async function readHubMotionDetected(deviceState, deviceId) {
52837
+ let slice;
52838
+ try {
52839
+ slice = await deviceState.getCapSlice.query({
52840
+ deviceId,
52841
+ capName: "motion"
52842
+ });
52843
+ } catch (err) {
52844
+ const reason = err instanceof Error ? err.message : String(err);
52845
+ throw new Error(`motion state of device ${deviceId} is unreadable: ${reason}`, { cause: err });
52846
+ }
52847
+ const detected = slice?.["detected"];
52848
+ if (typeof detected !== "boolean") throw new Error(`motion state of device ${deviceId} is not published yet (unknown)`);
52849
+ return detected;
52850
+ }
52851
+ MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
52852
+ function providerMotionEvent(source, data) {
52853
+ return createEvent(EventCategory.ProviderMotion, source, data);
52854
+ }
52447
52855
  object({
52448
52856
  /**
52449
52857
  * Fraction of the box's own size added on EACH side before cutting.
@@ -54813,17 +55221,14 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
54813
55221
  }
54814
55222
  /** Register the native `motion` cap. Its mere presence (a `kind:'native'`
54815
55223
  * `motion` binding) is what the orchestrator reads to default a
54816
- * freshly-adopted camera to `motionSources:['onboard']`. */
55224
+ * freshly-adopted camera to `motionSources:['onboard']`. `isDetected`
55225
+ * answers from the HUB's slice; an unreadable hub, or a slice nobody has
55226
+ * published yet, fails the call — never `false` for unknown (D49, D393). */
54817
55227
  registerMotionCap() {
54818
55228
  this.ctx.registerNativeCap(motionCapability, { isDetected: async ({ deviceId }) => {
54819
55229
  if (deviceId !== this.id) throw new Error(`AmcrestCamera: motion deviceId mismatch, expected ${this.id}, got ${deviceId}`);
54820
- return this.getCapSlice(motionCapability)?.detected ?? false;
55230
+ return readHubMotionDetected(this.ctx.api.deviceState, this.id);
54821
55231
  } });
54822
- this.setCapSlice(motionCapability, {
54823
- detected: false,
54824
- lastDetectedAt: null,
54825
- autoClearAfterMs: null
54826
- });
54827
55232
  this.ctx.logger.info("amcrest: motion cap registered", { tags: { deviceId: this.id } });
54828
55233
  }
54829
55234
  /** Reusable event-source identity for every emit on this device. */
@@ -54835,10 +55240,12 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
54835
55240
  deviceId: this.id
54836
55241
  };
54837
55242
  }
54838
- /** Emit an onboard motion transition on the bus. The runner subscribes
54839
- * and drives its phase machine via `reportMotion`. */
55243
+ /** Emit the camera's RAW onboard motion transition (`ProviderMotion`,
55244
+ * D673). The orchestrator's camera-sensors bridge re-emits it as
55245
+ * `MotionOnMotionChanged`; the runner subscribes to that and drives its
55246
+ * phase machine via `reportMotion`. */
54840
55247
  emitMotion(detected, timestamp) {
54841
- this.ctx.eventBus.emit(createEvent(EventCategory.MotionOnMotionChanged, this.eventSource(), {
55248
+ this.ctx.eventBus.emit(providerMotionEvent(this.eventSource(), {
54842
55249
  deviceId: this.id,
54843
55250
  detected,
54844
55251
  timestamp,
@@ -54933,14 +55340,7 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
54933
55340
  const wasActive = this.motionActive;
54934
55341
  this.motionActive = true;
54935
55342
  this.emitMotion(true, now);
54936
- if (!wasActive) {
54937
- this.setCapSlice(motionCapability, {
54938
- detected: true,
54939
- lastDetectedAt: now,
54940
- autoClearAfterMs: MOTION_CLOSE_AFTER_MS
54941
- });
54942
- this.ctx.logger.info("amcrest: onboard motion started", { tags: { deviceId: this.id } });
54943
- }
55343
+ if (!wasActive) this.ctx.logger.info("amcrest: onboard motion started", { tags: { deviceId: this.id } });
54944
55344
  if (this.motionKeepaliveTimer === null) this.motionKeepaliveTimer = setInterval(() => {
54945
55345
  this.emitMotion(true, Date.now());
54946
55346
  }, AmcrestCamera.MOTION_KEEPALIVE_MS);
@@ -54950,12 +55350,6 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
54950
55350
  if (!this.motionActive) return;
54951
55351
  this.motionActive = false;
54952
55352
  this.emitMotion(false, now);
54953
- const lastDetectedAt = this.getCapSlice(motionCapability)?.lastDetectedAt ?? now;
54954
- this.setCapSlice(motionCapability, {
54955
- detected: false,
54956
- lastDetectedAt,
54957
- autoClearAfterMs: null
54958
- });
54959
55353
  this.ctx.logger.info("amcrest: onboard motion stopped", { tags: { deviceId: this.id } });
54960
55354
  }
54961
55355
  clearMotionKeepalive() {