@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.js CHANGED
@@ -34,7 +34,7 @@ let node_stream = require("node:stream");
34
34
  let node_stream_promises = require("node:stream/promises");
35
35
  let node_child_process = require("node:child_process");
36
36
  let node_os = require("node:os");
37
- //#region ../types/dist/event-category-C5xZWqz6.mjs
37
+ //#region ../types/dist/event-category-BGmz_oxW.mjs
38
38
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
39
39
  EventCategory["SystemBoot"] = "system.boot";
40
40
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -567,6 +567,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
567
567
  */
568
568
  EventCategory["PipelineAudioInferenceResult"] = "pipeline.audio-inference-result";
569
569
  EventCategory["DetectionPhaseTransition"] = "detection.phase-transition";
570
+ /**
571
+ * A camera provider's RAW onboard motion push (D673): the `MotionOnMotionChanged`
572
+ * data shape without `triggeredBy`, built by `providerMotionEvent`. Its one
573
+ * consumer is the orchestrator's camera-sensors bridge, which re-emits the
574
+ * camera's EFFECTIVE onboard motion as `MotionOnMotionChanged` (a pass-through
575
+ * for a camera with no attached sensor). Providers must not emit
576
+ * `MotionOnMotionChanged` themselves; `scripts/check-onboard-motion-emitters.ts`
577
+ * keeps it so (camera-grid is a named, deferred exception).
578
+ */
570
579
  EventCategory["ProviderMotion"] = "provider.motion";
571
580
  EventCategory["ProviderDetection"] = "provider.detection";
572
581
  EventCategory["EnrichmentEmbeddingStored"] = "enrichment.embedding.stored";
@@ -5405,7 +5414,7 @@ var ZodIssueCode = {
5405
5414
  var ZodFirstPartyTypeKind;
5406
5415
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5407
5416
  //#endregion
5408
- //#region ../types/dist/sleep-C-v96WpE.mjs
5417
+ //#region ../types/dist/sleep-CDCONfkt.mjs
5409
5418
  /**
5410
5419
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5411
5420
  * window to float samples (D455).
@@ -7438,7 +7447,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7438
7447
  return DeviceRole;
7439
7448
  }({});
7440
7449
  //#endregion
7441
- //#region ../types/dist/composition-Dq42XWp0.mjs
7450
+ //#region ../types/dist/composition-43aqsZQj.mjs
7442
7451
  /**
7443
7452
  * The ffmpeg build every CamStack node downloads, per platform and arch.
7444
7453
  *
@@ -7495,13 +7504,12 @@ portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac
7495
7504
  * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
7496
7505
  * valutatore puro del suo FRONTE.
7497
7506
  *
7498
- * Viveva dentro il builtin virtual-doorbell
7499
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
7500
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
7501
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
7502
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
7503
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
7504
- * SPOSTA qui e il doorbell la ri-esporta.
7507
+ * UNA tabella per tutti quelli che chiedono "questo device è ALTO?": il
7508
+ * trigger `RecordingTriggers.sensorDeviceIds` del recorder, i marker dei
7509
+ * sensori della post-analysis, il bridge camera-sensors dell'orchestratore e
7510
+ * le sorgenti di un campanello composto (`doorbellFeatureSources`, D671).
7511
+ * Una seconda copia divergerebbe alla prima cap aggiunta, e il sintomo — "il
7512
+ * sensore fa suonare il campanello ma non registra" — è esattamente D62.
7505
7513
  *
7506
7514
  * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
7507
7515
  * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
@@ -7527,8 +7535,6 @@ var SOURCE_CAP_ACTIVE_FIELD = {
7527
7535
  vibration: "detected",
7528
7536
  tamper: "tampered"
7529
7537
  };
7530
- /** Cap names whose presence in a device's bindings qualify it as a source. */
7531
- var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
7532
7538
  /**
7533
7539
  * Error types for the safe expression engine. Two distinct classes so callers
7534
7540
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
@@ -8984,6 +8990,82 @@ var ArchivedDebugNoteQueryInputSchema = object({
8984
8990
  /** Max rows returned, newest-first. */
8985
8991
  limit: number().int().min(1).max(1e3).optional()
8986
8992
  });
8993
+ var TrackRelationKindSchema = _enum(["same-subject", "different-subjects"]);
8994
+ var TrackSideSchema = _enum(["before", "after"]);
8995
+ var TrackPurityValueSchema = _enum(["mixed", "not-a-subject"]);
8996
+ var TrackRelationSchema = object({
8997
+ id: string(),
8998
+ deviceId: number().int(),
8999
+ leftTrackId: string(),
9000
+ rightTrackId: string(),
9001
+ leftSide: TrackSideSchema.nullable(),
9002
+ rightSide: TrackSideSchema.nullable(),
9003
+ relation: TrackRelationKindSchema,
9004
+ presence: literal("continuous").nullable(),
9005
+ leftStartedAt: number().int().nullable(),
9006
+ rightStartedAt: number().int().nullable(),
9007
+ createdAt: number().int(),
9008
+ updatedAt: number().int(),
9009
+ author: string().nullable()
9010
+ });
9011
+ var TrackPuritySchema = object({
9012
+ id: string(),
9013
+ deviceId: number().int(),
9014
+ sourceTrackId: string(),
9015
+ purity: TrackPurityValueSchema,
9016
+ switchAtMs: number().int().nullable(),
9017
+ startedAt: number().int().nullable(),
9018
+ createdAt: number().int(),
9019
+ updatedAt: number().int(),
9020
+ author: string().nullable()
9021
+ });
9022
+ var SetTrackRelationInputSchema = object({
9023
+ deviceId: number().int(),
9024
+ trackId: string().min(1),
9025
+ otherTrackId: string().min(1),
9026
+ relation: TrackRelationKindSchema,
9027
+ presence: literal("continuous").optional(),
9028
+ trackSide: TrackSideSchema.optional(),
9029
+ otherSide: TrackSideSchema.optional()
9030
+ });
9031
+ var ClearTrackRelationInputSchema = object({
9032
+ deviceId: number().int(),
9033
+ trackId: string().min(1),
9034
+ otherTrackId: string().min(1)
9035
+ });
9036
+ var ClearTrackRelationResultSchema = object({ cleared: boolean() });
9037
+ var SetTrackPurityInputSchema = object({
9038
+ deviceId: number().int(),
9039
+ trackId: string().min(1),
9040
+ purity: _enum([
9041
+ "pure",
9042
+ "mixed",
9043
+ "not-a-subject"
9044
+ ]),
9045
+ switchAtMs: number().int().optional()
9046
+ });
9047
+ /** `null` when `pure` cleared the row. */
9048
+ var SetTrackPurityResultSchema = object({ purity: TrackPuritySchema.nullable() });
9049
+ var ListTrackRelationsInputSchema = object({
9050
+ deviceId: number().int(),
9051
+ trackId: string().optional(),
9052
+ since: number().int().optional(),
9053
+ until: number().int().optional(),
9054
+ limit: number().int().min(1).max(5e3).optional()
9055
+ });
9056
+ var ListTrackRelationsResultSchema = object({
9057
+ relations: array(TrackRelationSchema).readonly(),
9058
+ purities: array(TrackPuritySchema).readonly(),
9059
+ truncated: boolean()
9060
+ });
9061
+ _enum([
9062
+ "unknown-track",
9063
+ "cross-device",
9064
+ "self-relation",
9065
+ "contradiction",
9066
+ "switch-outside-track",
9067
+ "switch-needs-mixed"
9068
+ ]);
8987
9069
  /**
8988
9070
  * Ops-log — the durable, append-only operations audit shared by the
8989
9071
  * recordings and events management surfaces.
@@ -9182,7 +9264,7 @@ var RecordingTriggersSchema = object({
9182
9264
  *
9183
9265
  * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
9184
9266
  * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
9185
- * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
9267
+ * la stessa del campanello composto (D671). Ed è il FRONTE, non
9186
9268
  * il livello: un contatto trovato già aperto al riavvio del runner non fa
9187
9269
  * registrare.
9188
9270
  */
@@ -11537,6 +11619,68 @@ method(object({
11537
11619
  password: string()
11538
11620
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
11539
11621
  /**
11622
+ * How long one snapshot may take end to end: the pinned copy of the whole
11623
+ * database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
11624
+ * disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
11625
+ * generous because a timeout fails the whole backup run.
11626
+ */
11627
+ var DATABASE_SNAPSHOT_TIMEOUT_MS = 30 * 6e4;
11628
+ /**
11629
+ * The databases an owner snapshots — declared by the OWNER, so a caller never
11630
+ * guesses which file is live from what sits beside it (a cleanly closed
11631
+ * database has no sidecars and is just as owned). Paths are absolute on the
11632
+ * owner's host.
11633
+ */
11634
+ var DatabaseSnapshotTargetsSchema = object({ databases: array(object({ livePath: string() })) });
11635
+ /** One b-tree table of the snapshot and the rows it holds. */
11636
+ var DatabaseSnapshotTableSchema = object({
11637
+ name: string(),
11638
+ rows: number().int().nonnegative()
11639
+ });
11640
+ /**
11641
+ * What the owner wrote. Every path is ABSOLUTE on the owner's host — the
11642
+ * caller pins the call to its own node, so it can read the file; a caller
11643
+ * that finds the path outside its own data root refuses it rather than
11644
+ * archiving something it cannot place.
11645
+ */
11646
+ var DatabaseSnapshotResultSchema = object({
11647
+ /** The live database the snapshot copies. Never to be copied as a file. */
11648
+ livePath: string(),
11649
+ /** The verified copy: `<livePath>` + {@link DATABASE_SNAPSHOT_SUFFIX}. */
11650
+ snapshotPath: string(),
11651
+ sizeBytes: number().int().nonnegative(),
11652
+ pageCount: number().int().nonnegative(),
11653
+ pageSize: number().int().positive(),
11654
+ /**
11655
+ * Every b-tree table with its row count. Read inside the SAME read
11656
+ * transaction the copy was taken from, and found EQUAL on the copy — so
11657
+ * this is the content of the snapshot, not an estimate of the source.
11658
+ */
11659
+ tables: array(DatabaseSnapshotTableSchema),
11660
+ /** Wall time of the pinned copy (row counts included). */
11661
+ copyMs: number().nonnegative(),
11662
+ /** Wall time of the checks on the copy (`integrity_check`, row counts). */
11663
+ verifyMs: number().nonnegative(),
11664
+ /** When the pinned read transaction began (ms epoch) — the snapshot's instant. */
11665
+ takenAt: number()
11666
+ });
11667
+ /**
11668
+ * A snapshot as an ARCHIVE records it (`ArchiveManifest.sqliteSnapshots`):
11669
+ * the same facts, with both paths relative to the archive root (the node's
11670
+ * data dir), because an archive outlives the host that made it.
11671
+ */
11672
+ var ArchiveSqliteSnapshotSchema = DatabaseSnapshotResultSchema.extend({
11673
+ /** Archive-relative path of the live database the archive does NOT carry. */
11674
+ livePath: string(),
11675
+ /** Archive-relative path of the verified copy it carries in its place. */
11676
+ snapshotPath: string()
11677
+ });
11678
+ method(object({}), DatabaseSnapshotTargetsSchema, { auth: "admin" }), method(object({}), DatabaseSnapshotResultSchema, {
11679
+ kind: "mutation",
11680
+ auth: "admin",
11681
+ timeoutMs: DATABASE_SNAPSHOT_TIMEOUT_MS
11682
+ });
11683
+ /**
11540
11684
  * Orchestrator-side destination metadata. The orchestrator computes
11541
11685
  * `id = <addonId>:<subId>` from its provider lookup so consumers
11542
11686
  * (admin UI, restore flow) see one canonical key.
@@ -11647,7 +11791,12 @@ var ArchiveManifestSchema = object({
11647
11791
  locations: array(string()),
11648
11792
  entries: array(ArchiveEntrySchema),
11649
11793
  totalBytes: number(),
11650
- totalFiles: number()
11794
+ totalFiles: number(),
11795
+ /**
11796
+ * Live SQLite databases this archive carries as their OWNER's verified
11797
+ * snapshot instead of as files (D693). Absent on archives made before.
11798
+ */
11799
+ sqliteSnapshots: array(ArchiveSqliteSnapshotSchema).optional()
11651
11800
  });
11652
11801
  var LocationStatSchema = object({
11653
11802
  name: string(),
@@ -13173,6 +13322,116 @@ var CompositionBlockStateSchema = object({
13173
13322
  reason: string().optional(),
13174
13323
  fields: array(CompositionFieldStateSchema)
13175
13324
  });
13325
+ var ComposerBlockSchema = object({
13326
+ id: string().min(1),
13327
+ name: string().min(1).max(120),
13328
+ enabled: boolean(),
13329
+ updatedAt: number(),
13330
+ composition: CompositionSchema
13331
+ });
13332
+ /**
13333
+ * A stored composition row that no longer PARSES — a schema a release
13334
+ * tightened, a row written by a newer build. Sent by id so the composer keeps
13335
+ * its device as a placeholder and reports the block `failed` naming the parse
13336
+ * error. Leaving it out would read, twice, exactly like a delete (D49).
13337
+ */
13338
+ var ComposerUnreadableBlockSchema = object({
13339
+ id: string().min(1),
13340
+ /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
13341
+ name: string().nullable(),
13342
+ /** The parse error, in the operator's words. */
13343
+ error: string()
13344
+ });
13345
+ method(object({
13346
+ /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
13347
+ integrationId: string().nullable(),
13348
+ /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
13349
+ storeLoaded: boolean(),
13350
+ blocks: array(ComposerBlockSchema),
13351
+ /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
13352
+ restartBlockIds: array(string()),
13353
+ /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
13354
+ unreadableBlocks: array(ComposerUnreadableBlockSchema)
13355
+ }), object({
13356
+ blocks: array(object({
13357
+ blockId: string(),
13358
+ status: CompositionRunStatusSchema,
13359
+ reason: string().optional()
13360
+ })),
13361
+ /**
13362
+ * False when the composer declared and withdrew NOTHING (store not loaded,
13363
+ * integration unknown, its own rows unread or read empty once). An empty
13364
+ * apply the caller owes is paid off only by one the composer acted on (D49).
13365
+ */
13366
+ acted: boolean()
13367
+ }), {
13368
+ kind: "mutation",
13369
+ auth: "admin"
13370
+ }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
13371
+ var NUMBER = {
13372
+ kind: "fixed",
13373
+ result: ["number"]
13374
+ };
13375
+ var BOOLEAN = {
13376
+ kind: "fixed",
13377
+ result: ["boolean"]
13378
+ };
13379
+ Object.freeze({
13380
+ min: NUMBER,
13381
+ max: NUMBER,
13382
+ abs: NUMBER,
13383
+ floor: NUMBER,
13384
+ ceil: NUMBER,
13385
+ sqrt: NUMBER,
13386
+ round: NUMBER,
13387
+ pow: NUMBER,
13388
+ clamp: NUMBER,
13389
+ avg: NUMBER,
13390
+ sum: NUMBER,
13391
+ age: NUMBER,
13392
+ convert: NUMBER,
13393
+ coalesce: { kind: "coalesce" },
13394
+ any: BOOLEAN,
13395
+ all: BOOLEAN,
13396
+ within: BOOLEAN,
13397
+ latest: {
13398
+ kind: "fixed",
13399
+ result: ["number", "null"]
13400
+ },
13401
+ number: {
13402
+ kind: "fixed",
13403
+ result: ["number", "null"]
13404
+ },
13405
+ rose: {
13406
+ kind: "fixed",
13407
+ result: ["number", "null"]
13408
+ },
13409
+ count: NUMBER
13410
+ });
13411
+ `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
13412
+ /**
13413
+ * What a composition may BUILD on a device type (G2, D676): the caps a new
13414
+ * device of that type, or an existing one that lacks them, can be given. The
13415
+ * blockers are the validator's own refusal codes, and a spec compares this
13416
+ * listing with `planComposition` for every capability — the editor can never
13417
+ * offer a feature the save would refuse for the same reason.
13418
+ */
13419
+ var ComposableFieldSchema = object({
13420
+ path: string(),
13421
+ kind: CompositionFieldKindSchema,
13422
+ nullable: boolean(),
13423
+ required: boolean(),
13424
+ enumValues: array(string()).optional()
13425
+ });
13426
+ var ComposableCapabilitiesSchema = object({ caps: array(object({
13427
+ cap: string(),
13428
+ fields: array(ComposableFieldSchema),
13429
+ /** Present for an item-array cap (`consumables.items`). */
13430
+ itemArray: object({
13431
+ path: string(),
13432
+ keyField: string()
13433
+ }).optional()
13434
+ })) });
13176
13435
  /** Where a block runs. The operator chooses — a block driving a device on an
13177
13436
  * agent is the reason placement is not fixed to the hub. */
13178
13437
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -13337,7 +13596,7 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
13337
13596
  }), method(object({ blockId: string() }), CompositionGetReadSchema, { auth: "admin" }), method(object({}), CompositionListReadSchema, { auth: "admin" }), method(object({
13338
13597
  addonId: string().min(1),
13339
13598
  stableId: string().min(1)
13340
- }), CompositionCustomizationReadSchema, { auth: "admin" }), method(object({
13599
+ }), CompositionCustomizationReadSchema, { auth: "admin" }), method(object({ deviceType: _enum(DeviceType) }), ComposableCapabilitiesSchema, { auth: "admin" }), method(object({
13341
13600
  composition: CompositionSchema,
13342
13601
  blockId: string().optional()
13343
13602
  }), CompositionValidationSchema, {
@@ -13345,52 +13604,6 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
13345
13604
  auth: "admin",
13346
13605
  access: "view"
13347
13606
  });
13348
- var ComposerBlockSchema = object({
13349
- id: string().min(1),
13350
- name: string().min(1).max(120),
13351
- enabled: boolean(),
13352
- updatedAt: number(),
13353
- composition: CompositionSchema
13354
- });
13355
- /**
13356
- * A stored composition row that no longer PARSES — a schema a release
13357
- * tightened, a row written by a newer build. Sent by id so the composer keeps
13358
- * its device as a placeholder and reports the block `failed` naming the parse
13359
- * error. Leaving it out would read, twice, exactly like a delete (D49).
13360
- */
13361
- var ComposerUnreadableBlockSchema = object({
13362
- id: string().min(1),
13363
- /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
13364
- name: string().nullable(),
13365
- /** The parse error, in the operator's words. */
13366
- error: string()
13367
- });
13368
- method(object({
13369
- /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
13370
- integrationId: string().nullable(),
13371
- /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
13372
- storeLoaded: boolean(),
13373
- blocks: array(ComposerBlockSchema),
13374
- /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
13375
- restartBlockIds: array(string()),
13376
- /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
13377
- unreadableBlocks: array(ComposerUnreadableBlockSchema)
13378
- }), object({
13379
- blocks: array(object({
13380
- blockId: string(),
13381
- status: CompositionRunStatusSchema,
13382
- reason: string().optional()
13383
- })),
13384
- /**
13385
- * False when the composer declared and withdrew NOTHING (store not loaded,
13386
- * integration unknown, its own rows unread or read empty once). An empty
13387
- * apply the caller owes is paid off only by one the composer acted on (D49).
13388
- */
13389
- acted: boolean()
13390
- }), {
13391
- kind: "mutation",
13392
- auth: "admin"
13393
- }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
13394
13607
  /**
13395
13608
  * `custom-model-registry` — collection cap exposing operator-registered
13396
13609
  * custom detection models. Each provider (today: `addon-model-studio`)
@@ -15540,6 +15753,121 @@ method(object({
15540
15753
  deviceIds: array(number()).readonly(),
15541
15754
  caps: array(string()).readonly().optional()
15542
15755
  }), record(string(), record(string(), unknown().nullable())));
15756
+ var ExtensionSlotIdSchema = _enum(["linked-devices"]);
15757
+ DeviceType.Camera;
15758
+ /** A slot's editable value, discriminated on `slot`. */
15759
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
15760
+ DeviceType.Camera;
15761
+ var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
15762
+ state: literal("unreachable"),
15763
+ reason: string()
15764
+ })]);
15765
+ /** One provider of slots — the D554 source-listing row. */
15766
+ var ExtensionSourceSchema = object({
15767
+ /** The routing prefix of every `slotRef` this provider serves. */
15768
+ source: string(),
15769
+ label: string(),
15770
+ /** Stamped by the dispatcher from the registry (D557). */
15771
+ addonId: string().optional(),
15772
+ availability: ExtensionSourceAvailabilitySchema
15773
+ });
15774
+ /**
15775
+ * How one picked source stands. `missing` — no such device (deleted, or an id
15776
+ * that never existed); `foreign` — a device the slot's owner cannot read from
15777
+ * (a source owned by another addon); `unavailable` — it exists but is not a
15778
+ * valid source now (a container, which is never a pick). A source in any of
15779
+ * these states is SHOWN, never silently dropped or re-pointed.
15780
+ */
15781
+ var ExtensionSourceHealthSchema = _enum([
15782
+ "ok",
15783
+ "missing",
15784
+ "foreign",
15785
+ "unavailable"
15786
+ ]);
15787
+ var ExtensionSlotSourceSchema = object({
15788
+ deviceId: number().int(),
15789
+ /** The device's name, or null when it could not be resolved (`missing`). */
15790
+ name: string().nullable(),
15791
+ health: ExtensionSourceHealthSchema,
15792
+ detail: string().optional()
15793
+ });
15794
+ /**
15795
+ * A DIFFERENT authority that gates whether the slot's sources do anything —
15796
+ * reported read-only, named, never written through this contract (D62) — e.g.
15797
+ * a slot whose sources act only while a wrapper is bound to the host, a
15798
+ * binding that belongs to `deviceManager.setWrapperActive`. No slot reports
15799
+ * one today (`linked-devices` answers `null`). `unknown` means the gate could
15800
+ * not be read; it is not "inactive" (D315).
15801
+ */
15802
+ var ExtensionSlotActivationSchema = object({
15803
+ state: _enum([
15804
+ "active",
15805
+ "inactive",
15806
+ "unknown"
15807
+ ]),
15808
+ authority: string(),
15809
+ detail: string().optional()
15810
+ });
15811
+ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
15812
+ state: literal("ok"),
15813
+ /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
15814
+ slotRef: string(),
15815
+ slot: ExtensionSlotIdSchema,
15816
+ /** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
15817
+ authority: string(),
15818
+ activation: ExtensionSlotActivationSchema.nullable(),
15819
+ value: ExtensionSlotValueSchema,
15820
+ sources: array(ExtensionSlotSourceSchema),
15821
+ /**
15822
+ * Devices the owner links to the host ON ITS OWN, by structure, and that
15823
+ * are therefore not in `value` (D655): a camera's device-tree children, and
15824
+ * the child a picked container stands for (D356 — a container is never a
15825
+ * pick, its children are). Read-only; the editor shows them and may offer
15826
+ * per-device options on them (the linked-devices tracked-event opt-in).
15827
+ * Absent when the owner links nothing beyond the picks, and from an owner
15828
+ * older than D655.
15829
+ */
15830
+ impliedSources: array(ExtensionSlotSourceSchema).optional()
15831
+ }), object({
15832
+ state: literal("unreachable"),
15833
+ addonId: string(),
15834
+ reason: string()
15835
+ })]);
15836
+ var ExtensionCandidatesSchema = object({ candidates: array(object({
15837
+ deviceId: number().int(),
15838
+ name: string(),
15839
+ type: string(),
15840
+ location: string().nullable(),
15841
+ /** The container a child belongs to — "Spotlight 2" alone does not say which. */
15842
+ parentName: string().nullable(),
15843
+ /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
15844
+ suggested: boolean(),
15845
+ /** Why it is suggested ("same location"), null when it is not. */
15846
+ reason: string().nullable()
15847
+ })) });
15848
+ /**
15849
+ * What a write did. `none` — applied in place. `host` / `parent` — the owner
15850
+ * reloaded the host (or, for an accessory child, its parent) because the
15851
+ * write changed what the host REGISTERS. A slot never adds a capability to its
15852
+ * host — that is a composition (D663) — so today's owners answer `none`.
15853
+ */
15854
+ var ExtensionSetResultSchema = object({
15855
+ applied: literal(true),
15856
+ reload: _enum([
15857
+ "none",
15858
+ "host",
15859
+ "parent"
15860
+ ])
15861
+ });
15862
+ var ExtensionSlotRefInputSchema = object({
15863
+ deviceId: number().int(),
15864
+ slotRef: string().min(1)
15865
+ });
15866
+ var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
15867
+ method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
15868
+ kind: "mutation",
15869
+ auth: "admin"
15870
+ });
15543
15871
  /**
15544
15872
  * Per-field ownership (D663). A composition may CLAIM fields of a native
15545
15873
  * cap's runtime-state slice on an existing device: `replace` overlays the
@@ -18550,17 +18878,25 @@ var NcScheduleSchema = object({
18550
18878
  */
18551
18879
  var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
18552
18880
  /**
18881
+ * How a summary window is SENT (D698): `rule` (absent) = ONE notification with
18882
+ * every section; `section` = one notification per section with something to
18883
+ * say (an unavailable section included), each titled by its section.
18884
+ */
18885
+ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
18886
+ /**
18553
18887
  * `summary`: the rule sends NOTHING per event. When a window of `schedule`
18554
18888
  * CLOSES, it sends one notification with the current state of its kinds
18555
18889
  * (low batteries, consumables to replace, devices offline, updates
18556
- * available, ...), after its own filters. Nothing to report sends nothing.
18890
+ * available, ...), after its own filters — or, with `split: 'section'`
18891
+ * (D698), one notification per section. Nothing to report sends nothing.
18557
18892
  * The schedule is the ordinary `NcSchedule` (weekly windows, IANA timezone,
18558
18893
  * midnight crossing); the send time is each window's END. Refused on the
18559
18894
  * `alarm` family, which stays instant (`systemEventDeliveryProblems`).
18560
18895
  */
18561
18896
  var NcSystemEventDeliverySchema = discriminatedUnion("mode", [object({ mode: literal("instant") }), object({
18562
18897
  mode: literal("summary"),
18563
- schedule: NcScheduleSchema
18898
+ schedule: NcScheduleSchema,
18899
+ split: NcStateSummarySplitSchema.optional()
18564
18900
  })]);
18565
18901
  /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
18566
18902
  var NcPlateMatcherSchema = object({
@@ -18700,8 +19036,14 @@ var NcSensorTransitionSchema = _enum(["raised", "cleared"]);
18700
19036
  /** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
18701
19037
  var NcZoneConditionSchema = object({
18702
19038
  ids: array(string().min(1)).min(1),
18703
- /** Quantifier over `ids` — at least one / every one visited. */
18704
- match: _enum(["any", "all"]).default("any")
19039
+ /**
19040
+ * LEGACY quantifier over `ids`. Absent = `any` (at least one visited), which
19041
+ * is what both editors mean and all they write since D690: "all of" was
19042
+ * removed from the editors because on an immediate rule it asked one
19043
+ * detection to stand in every zone at once. Still ACCEPTED, and `all` still
19044
+ * evaluated, so a stored rule keeps parsing and meaning what it meant.
19045
+ */
19046
+ match: _enum(["any", "all"]).optional()
18705
19047
  });
18706
19048
  /**
18707
19049
  * The P1 condition set — a flat AND of groups; absent group = pass;
@@ -19205,10 +19547,12 @@ var NcMediaPolicySchema = object({
19205
19547
  /**
19206
19548
  * Cooldown GRANULARITY over the subject's class — how much a fired
19207
19549
  * notification suppresses.
19208
- * - `shared` (default, and the absent value) — one window for the whole
19209
- * rule/scope: a cat silences the next dog for `cooldownSec`.
19210
- * - `per-class` — an independent window per detected class, so cat→dog fires
19211
- * at once and cat→cat still waits.
19550
+ * - `per-class` (default, and the absent value since 2026-10-01 — D36) — an
19551
+ * independent window per detected class: cat→dog fires at once, cat→cat
19552
+ * still waits.
19553
+ * - `shared` — one window for the whole rule/scope: a cat silences the next
19554
+ * dog for `cooldownSec`. Only written when an operator picks it; it is no
19555
+ * longer what an unset rule means.
19212
19556
  *
19213
19557
  * AUDIO subjects are ALWAYS per-class regardless of this setting: a scream
19214
19558
  * must not be swallowed by a bark's window (the precedent this generalizes —
@@ -19223,8 +19567,11 @@ var NcThrottleSchema = object({
19223
19567
  /**
19224
19568
  * Class granularity of the cooldown key. Optional rather than defaulted:
19225
19569
  * a Zod default does NOT run on the addon→addon cap path, so a persisted
19226
- * rule authored before this field simply carries none — and the engine
19227
- * reads absent as `shared`, the pre-existing behaviour.
19570
+ * rule authored before this field simply carries none. The engine used to
19571
+ * read absent as `shared` (D36); since 2026-10-01 it reads absent as
19572
+ * `per-class` — the operator's default — and only an explicit `shared`
19573
+ * still means `shared`. See `cooldownKey` / `keysPerClass` in the rule
19574
+ * engine, and D36's dated note.
19228
19575
  */
19229
19576
  granularity: NcThrottleGranularitySchema.optional()
19230
19577
  });
@@ -19548,11 +19895,23 @@ var NcStateSummaryPreviewSectionSchema = object({
19548
19895
  reason: string().optional()
19549
19896
  });
19550
19897
  /**
19898
+ * One notification a previewed summary would send (D698): the whole summary on
19899
+ * a `rule` split (no `section`), one section's on a `section` split.
19900
+ */
19901
+ var NcStateSummaryPreviewRowSchema = object({
19902
+ section: string().optional(),
19903
+ /** The section's name on a per-section row; every reported section's, joined, on a combined one. */
19904
+ title: string(),
19905
+ text: string(),
19906
+ count: number().int().nonnegative()
19907
+ });
19908
+ /**
19551
19909
  * The summary a rule would send now. `empty` = nothing to report and every
19552
19910
  * section read: such a summary is NOT sent. `dropped` counts the open states
19553
19911
  * the rule's own filters (or a camera mute) left out, by reason.
19554
19912
  * `excludedGroups` names the kind groups selected that have no state to report
19555
- * (backups & exports).
19913
+ * (backups & exports). `split` and `rows` (D698) say how it would be sent —
19914
+ * optional, so an older hub's answer still parses.
19556
19915
  */
19557
19916
  var NcStateSummaryPreviewSchema = object({
19558
19917
  empty: boolean(),
@@ -19560,7 +19919,9 @@ var NcStateSummaryPreviewSchema = object({
19560
19919
  text: string(),
19561
19920
  sections: array(NcStateSummaryPreviewSectionSchema),
19562
19921
  dropped: record(string(), number().int().nonnegative()),
19563
- excludedGroups: array(string())
19922
+ excludedGroups: array(string()),
19923
+ split: NcStateSummarySplitSchema.optional(),
19924
+ rows: array(NcStateSummaryPreviewRowSchema).optional()
19564
19925
  });
19565
19926
  var NcTestResultSchema = object({
19566
19927
  recordId: string(),
@@ -20574,12 +20935,26 @@ var CameraSensorRefSchema = object({
20574
20935
  function cameraSensorRefKey(ref) {
20575
20936
  return `${ref.addonId}/${ref.stableId}`;
20576
20937
  }
20577
- /** CS-1 accepts exactly one mode; CS-2 (D673) widens it to confirm / replace. */
20578
- var CameraSensorsModeSchema = _enum(["in-addition"]);
20579
- object({
20580
- mode: CameraSensorsModeSchema,
20581
- sensors: array(CameraSensorRefSchema).min(1).max(8)
20582
- }).superRefine((value, ctx) => {
20938
+ /**
20939
+ * A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
20940
+ * `replace`: its motion is the camera's, and while one is READY the camera's
20941
+ * own motion no longer counts on its own. `confirm`: while one is READY the
20942
+ * camera's own motion counts only while a confirm sensor is active — with or
20943
+ * without a replace sensor (spec C2, the controller's ruling on Q1).
20944
+ */
20945
+ var CameraSensorModeSchema = _enum([
20946
+ "in-addition",
20947
+ "confirm",
20948
+ "replace"
20949
+ ]);
20950
+ /** A stored sensor with no mode — every CS-1 row — is in addition. */
20951
+ var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
20952
+ /**
20953
+ * A camera's attached sensors. A CS-1 row carried an envelope
20954
+ * `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
20955
+ * what the write stores (D672 rule 3), so it is never written again.
20956
+ */
20957
+ var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
20583
20958
  const seen = /* @__PURE__ */ new Set();
20584
20959
  value.sensors.forEach((ref, index) => {
20585
20960
  const key = cameraSensorRefKey(ref);
@@ -20591,39 +20966,41 @@ object({
20591
20966
  seen.add(key);
20592
20967
  });
20593
20968
  });
20594
- var RefFields = {
20969
+ /** Every attachment names its mode; an older orchestrator that does not is in addition. */
20970
+ var AttachmentFields = {
20595
20971
  addonId: string(),
20596
- stableId: string()
20972
+ stableId: string(),
20973
+ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
20597
20974
  };
20598
20975
  var CameraSensorAttachmentSchema = discriminatedUnion("state", [
20599
20976
  object({
20600
- ...RefFields,
20977
+ ...AttachmentFields,
20601
20978
  state: literal("ready"),
20602
20979
  deviceId: number(),
20603
20980
  name: string(),
20604
20981
  caps: array(string()).readonly()
20605
20982
  }),
20606
20983
  object({
20607
- ...RefFields,
20984
+ ...AttachmentFields,
20608
20985
  state: literal("offline"),
20609
20986
  deviceId: number(),
20610
20987
  name: string(),
20611
20988
  reason: _enum(["offline", "disabled"])
20612
20989
  }),
20613
20990
  object({
20614
- ...RefFields,
20991
+ ...AttachmentFields,
20615
20992
  state: literal("missing"),
20616
20993
  reason: string()
20617
20994
  }),
20618
20995
  object({
20619
- ...RefFields,
20996
+ ...AttachmentFields,
20620
20997
  state: literal("unsupported"),
20621
20998
  deviceId: number(),
20622
20999
  name: string(),
20623
21000
  reason: string()
20624
21001
  }),
20625
21002
  object({
20626
- ...RefFields,
21003
+ ...AttachmentFields,
20627
21004
  state: literal("unreadable"),
20628
21005
  reason: string()
20629
21006
  })
@@ -20636,17 +21013,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
20636
21013
  * say.
20637
21014
  */
20638
21015
  var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
21016
+ /** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
21017
+ var CameraOwnMotionSchema = _enum([
21018
+ "always",
21019
+ "when-confirmed",
21020
+ "never"
21021
+ ]);
21022
+ /** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
21023
+ var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
21024
+ /**
21025
+ * The camera's OWN onboard motion (D696): the raw input the bridge combines,
21026
+ * never the effective value. The camera's `motion` slice is the effective one,
21027
+ * so a view of the camera's own row reads this.
21028
+ * - `atMs`: when the bridge received the camera's last own edge.
21029
+ * - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
21030
+ * AND it is younger than the window the bridge counts the camera's own motion
21031
+ * for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
21032
+ * sends a clear (heartbeats only) therefore reads `false` once no push came
21033
+ * within the window; a status read is a snapshot, so a live view re-asks.
21034
+ * Absent = this orchestrator has not received the camera's own motion since it
21035
+ * started (unknown, never "quiet"), or an orchestrator older than D696.
21036
+ */
21037
+ var CameraRawLevelSchema = object({
21038
+ detected: boolean(),
21039
+ atMs: number()
21040
+ });
20639
21041
  var CameraSensorsStatusSchema = discriminatedUnion("state", [
20640
- object({ state: literal("not-configured") }),
21042
+ object({
21043
+ state: literal("not-configured"),
21044
+ cameraLevel: CameraRawLevelSchema.optional()
21045
+ }),
20641
21046
  object({
20642
21047
  state: literal("unreadable"),
20643
- reason: string()
21048
+ reason: string(),
21049
+ cameraLevel: CameraRawLevelSchema.optional()
20644
21050
  }),
20645
21051
  object({
20646
21052
  state: literal("configured"),
20647
- mode: CameraSensorsModeSchema,
21053
+ cameraLevel: CameraRawLevelSchema.optional(),
20648
21054
  sensors: array(CameraSensorAttachmentSchema).readonly(),
20649
- notForwarded: CameraSensorsNotForwardedSchema.optional()
21055
+ /** Absent = an orchestrator older than CS-2: it does not say (D315). */
21056
+ cameraMotion: CameraOwnMotionSchema.optional(),
21057
+ notForwarded: CameraSensorsNotForwardedSchema.optional(),
21058
+ notEnforced: CameraSensorsNotEnforcedSchema.optional()
20650
21059
  })
20651
21060
  ]);
20652
21061
  Object.freeze({
@@ -22481,7 +22890,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22481
22890
  trackIds: array(string()).min(1)
22482
22891
  }), object({
22483
22892
  deleted: number().int(),
22484
- failed: array(string()).readonly()
22893
+ failed: array(string()).readonly(),
22894
+ sparedMediaIds: array(number().int()).readonly().optional()
22485
22895
  }), {
22486
22896
  kind: "mutation",
22487
22897
  auth: "admin"
@@ -22490,7 +22900,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
22490
22900
  deviceId: number(),
22491
22901
  trackId: string(),
22492
22902
  flags: TrackFlagsPatchSchema
22493
- }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(BirthDecisionQueryInputSchema, array(BirthDecisionRecordSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
22903
+ }), 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, {
22494
22904
  kind: "query",
22495
22905
  auth: "admin"
22496
22906
  }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
@@ -23876,8 +24286,10 @@ var RunnerCameraConfigSchema = object({
23876
24286
  * - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
23877
24287
  * analyzer providers) running on decoded frames in this runner.
23878
24288
  * - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
23879
- * analytics). The provider emits ProviderMotion
23880
- * events; the orchestrator forwards to `reportMotion`.
24289
+ * analytics). The provider emits its raw push as `ProviderMotion`
24290
+ * (D673); the orchestrator's camera-sensors bridge re-emits the camera's
24291
+ * effective motion as `MotionOnMotionChanged`, which is what reaches
24292
+ * `reportMotion`.
23881
24293
  */
23882
24294
  motionSources: MotionSourcesSchema.default(["analyzer"]),
23883
24295
  /**
@@ -24054,7 +24466,15 @@ var RunnerLocalLoadSchema = object({
24054
24466
  hasGpu: boolean(),
24055
24467
  inferenceBackend: string().optional(),
24056
24468
  cpuCores: number().optional()
24057
- })
24469
+ }),
24470
+ /**
24471
+ * Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
24472
+ * runner never writes it. ABSENT = a runner older than D696, which still
24473
+ * writes the slice from its phase machine; the orchestrator does not write
24474
+ * while any runner node is absent-or-unanswered, so one slice never has two
24475
+ * writers.
24476
+ */
24477
+ motionSliceWriter: literal("orchestrator").optional()
24058
24478
  });
24059
24479
  /**
24060
24480
  * Aggregate runtime metrics for the runner's whole local pool. Mirrors the
@@ -24688,7 +25108,64 @@ var NodeInferenceDevicesSchema = object({
24688
25108
  reachable: boolean(),
24689
25109
  devices: array(NodeInferenceDeviceSchema).readonly()
24690
25110
  });
24691
- method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
25111
+ /**
25112
+ * Pipeline Orchestrator capability — global load balancer + camera dispatcher.
25113
+ *
25114
+ * Lives on the hub. Tracks the camera-to-agent assignment map, listens to
25115
+ * device lifecycle events, queries each runner's capacity + hardware
25116
+ * profile, and dispatches `attachCamera` / `detachCamera` cap calls to the
25117
+ * appropriate runner instances. Persists assignments via the multi-level
25118
+ * settings store so they survive hub restarts.
25119
+ *
25120
+ * Strictly the control plane: never sees a frame, never calls inference,
25121
+ * never drains queues. The runner does that work locally on each agent.
25122
+ */
25123
+ /**
25124
+ * The input of `setCameraSensors` (G5, D676): the ONE typed write path of a
25125
+ * camera's attached sensors (D672). `config: null` removes the attachment —
25126
+ * the camera reads `not-configured` again, never `unreadable`.
25127
+ */
25128
+ var SetCameraSensorsInputSchema = object({
25129
+ deviceId: number().int().nonnegative(),
25130
+ /** `null` removes the attachment: the camera goes back to `not-configured`. */
25131
+ config: CameraSensorsConfigSchema.nullable()
25132
+ });
25133
+ /**
25134
+ * Why an early occupancy look (D691) was not scheduled.
25135
+ *
25136
+ * - `unknown-camera` — no session was ever dispatched for it, so there is no
25137
+ * node and no config to attach a burst with.
25138
+ * - `out-of-range` — the ask is negative or further out than the orchestrator
25139
+ * will hold a timer for; the parked-object cadence is the answer there.
25140
+ * - `no-burst-producer` — this build has no burst producer at all.
25141
+ * - `already-looked` — this camera's ONE early look since its last session has
25142
+ * been spent. A look's own burst can re-arm a flickering flip, and a look
25143
+ * per arm would chain a burst every ~30 s forever (review H2); the next
25144
+ * real session re-arms the budget.
25145
+ */
25146
+ var OccupancyLookRefusalSchema = _enum([
25147
+ "unknown-camera",
25148
+ "out-of-range",
25149
+ "no-burst-producer",
25150
+ "already-looked"
25151
+ ]);
25152
+ method(object({
25153
+ deviceId: number().int().nonnegative(),
25154
+ /** How long from NOW until the pending flip's sustain window ends. RELATIVE,
25155
+ * so the caller's clock and the orchestrator's never have to agree. */
25156
+ afterMs: number().finite(),
25157
+ /** Why, for the log. */
25158
+ reason: string()
25159
+ }), object({
25160
+ scheduled: boolean(),
25161
+ /** When `scheduled`: how long until the burst is dialled. */
25162
+ dueInMs: number().optional(),
25163
+ /** When not `scheduled`: why. */
25164
+ refusedBecause: OccupancyLookRefusalSchema.optional()
25165
+ }), {
25166
+ kind: "mutation",
25167
+ auth: "admin"
25168
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
24692
25169
  kind: "mutation",
24693
25170
  auth: "admin"
24694
25171
  }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
@@ -24842,7 +25319,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
24842
25319
  }), CameraSwitchGroupSchema, {
24843
25320
  kind: "mutation",
24844
25321
  auth: "admin"
24845
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
25322
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(SetCameraSensorsInputSchema, object({ success: literal(true) }), {
25323
+ kind: "mutation",
25324
+ auth: "admin"
25325
+ }), method(_void(), DiskReconcileJobSchema, {
24846
25326
  kind: "mutation",
24847
25327
  auth: "admin"
24848
25328
  }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
@@ -27561,219 +28041,6 @@ var CLIP_PLAYBACK_OPTIONS = {
27561
28041
  }
27562
28042
  };
27563
28043
  /**
27564
- * Doorbell button cap. Two kinds of providers coexist behind this cap
27565
- * name (same pattern as `snapshot`):
27566
- *
27567
- * - **Native** providers: registered per-device by device-driver
27568
- * addons via `ctx.registerNativeCap` — either on a
27569
- * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
27570
- * or directly on the camera (Reolink registers at camera level).
27571
- * Emits an `onPressed` event every time the firmware pushes a
27572
- * ring; status tracks the last press and a pressCount since start
27573
- * (diagnostic).
27574
- *
27575
- * - **Wrapper** provider: the `virtual-doorbell` system builtin
27576
- * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
27577
- * device (contact / switch / event-emitter …) into a doorbell for
27578
- * a camera. `defaultActive: false` — the operator explicitly binds
27579
- * it per camera in the device-bindings UI, then picks the source
27580
- * device + trigger in the per-device settings.
27581
- *
27582
- * The DeviceEventPropagator re-emits `onPressed` on the camera parent
27583
- * — subscribers listening at the camera level receive ring events
27584
- * with `via[]` populated. No code on the parent needed.
27585
- */
27586
- var DoorbellStatusSchema = object({
27587
- /** Ms epoch of the last press. null = never observed since this provider started. */
27588
- lastPressedAt: number().nullable(),
27589
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
27590
- pressCountSinceStart: number()
27591
- });
27592
- var DoorbellPressEventSchema = object({
27593
- deviceId: number(),
27594
- timestamp: number()
27595
- });
27596
- /**
27597
- * The `doorbell-source` extension slot's editable value (D648): the camera's
27598
- * virtual-doorbell trigger devices, exactly what the wrapper's
27599
- * `doorbellSources` persists (as `{ deviceId }` records).
27600
- */
27601
- var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
27602
- /**
27603
- * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
27604
- * doorbell, owned by the `virtual-doorbell` wrapper over its
27605
- * `doorbellSources` store (D648). A source rings when one of its
27606
- * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
27607
- * different authority (`deviceManager.setWrapperActive`, D62) — the slot
27608
- * reports it, it never writes it.
27609
- */
27610
- var DOORBELL_SOURCE_SLOT = {
27611
- id: "doorbell-source",
27612
- label: "Doorbell trigger devices",
27613
- 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.",
27614
- shape: "association",
27615
- hostDeviceTypes: [DeviceType.Camera],
27616
- sourceCaps: SOURCE_CAPS,
27617
- cardinality: "many",
27618
- value: DoorbellSourceSlotValueSchema
27619
- };
27620
- var doorbellCapability = {
27621
- name: "doorbell",
27622
- scope: "device",
27623
- deviceNative: true,
27624
- mode: "singleton",
27625
- kind: "wrapper",
27626
- defaultActive: false,
27627
- deviceTypes: [DeviceType.Button, DeviceType.Camera],
27628
- extensionSlots: [DOORBELL_SOURCE_SLOT],
27629
- methods: {},
27630
- events: {
27631
- /**
27632
- * Fires once per physical press. Reolink delivers via Baichuan
27633
- * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
27634
- * release/duration — it's a pulse.
27635
- */
27636
- onPressed: {
27637
- data: DoorbellPressEventSchema,
27638
- fromState: {
27639
- field: "lastPressedAt",
27640
- on: "advance"
27641
- }
27642
- } },
27643
- status: {
27644
- schema: DoorbellStatusSchema,
27645
- kind: "push"
27646
- },
27647
- /**
27648
- * Runtime-state slice — last press timestamp + lifetime press count.
27649
- * Mirrored by the kernel and readable via
27650
- * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
27651
- * without subscribing.
27652
- */
27653
- runtimeState: DoorbellStatusSchema,
27654
- /**
27655
- * 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.
27656
- *
27657
- * See `RuntimeStateDurability`. Enforced by
27658
- * `scripts/check-runtime-state-durability.ts`.
27659
- */
27660
- durability: "restored"
27661
- };
27662
- var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
27663
- DeviceType.Camera, DeviceType.Camera;
27664
- /** A slot's editable value, discriminated on `slot`. */
27665
- var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
27666
- DeviceType.Camera;
27667
- var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
27668
- state: literal("unreachable"),
27669
- reason: string()
27670
- })]);
27671
- /** One provider of slots — the D554 source-listing row. */
27672
- var ExtensionSourceSchema = object({
27673
- /** The routing prefix of every `slotRef` this provider serves. */
27674
- source: string(),
27675
- label: string(),
27676
- /** Stamped by the dispatcher from the registry (D557). */
27677
- addonId: string().optional(),
27678
- availability: ExtensionSourceAvailabilitySchema
27679
- });
27680
- /**
27681
- * How one picked source stands. `missing` — no such device (deleted, or an id
27682
- * that never existed); `foreign` — a device the slot's owner cannot read from
27683
- * (a source owned by another addon); `unavailable` — it exists but is not a
27684
- * valid source now (a container, which is never a pick). A source in any of
27685
- * these states is SHOWN, never silently dropped or re-pointed.
27686
- */
27687
- var ExtensionSourceHealthSchema = _enum([
27688
- "ok",
27689
- "missing",
27690
- "foreign",
27691
- "unavailable"
27692
- ]);
27693
- var ExtensionSlotSourceSchema = object({
27694
- deviceId: number().int(),
27695
- /** The device's name, or null when it could not be resolved (`missing`). */
27696
- name: string().nullable(),
27697
- health: ExtensionSourceHealthSchema,
27698
- detail: string().optional()
27699
- });
27700
- /**
27701
- * A DIFFERENT authority that gates whether the slot's sources do anything —
27702
- * reported read-only, named, never written through this contract (D62). The
27703
- * virtual doorbell's sources ring only while the wrapper is bound to the
27704
- * camera, and that binding belongs to `deviceManager.setWrapperActive`.
27705
- * `unknown` means the gate could not be read; it is not "inactive" (D315).
27706
- */
27707
- var ExtensionSlotActivationSchema = object({
27708
- state: _enum([
27709
- "active",
27710
- "inactive",
27711
- "unknown"
27712
- ]),
27713
- authority: string(),
27714
- detail: string().optional()
27715
- });
27716
- var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
27717
- state: literal("ok"),
27718
- /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
27719
- slotRef: string(),
27720
- slot: ExtensionSlotIdSchema,
27721
- /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
27722
- authority: string(),
27723
- activation: ExtensionSlotActivationSchema.nullable(),
27724
- value: ExtensionSlotValueSchema,
27725
- sources: array(ExtensionSlotSourceSchema),
27726
- /**
27727
- * Devices the owner links to the host ON ITS OWN, by structure, and that
27728
- * are therefore not in `value` (D655): a camera's device-tree children, and
27729
- * the child a picked container stands for (D356 — a container is never a
27730
- * pick, its children are). Read-only; the editor shows them and may offer
27731
- * per-device options on them (the linked-devices tracked-event opt-in).
27732
- * Absent when the owner links nothing beyond the picks, and from an owner
27733
- * older than D655.
27734
- */
27735
- impliedSources: array(ExtensionSlotSourceSchema).optional()
27736
- }), object({
27737
- state: literal("unreachable"),
27738
- addonId: string(),
27739
- reason: string()
27740
- })]);
27741
- var ExtensionCandidatesSchema = object({ candidates: array(object({
27742
- deviceId: number().int(),
27743
- name: string(),
27744
- type: string(),
27745
- location: string().nullable(),
27746
- /** The container a child belongs to — "Spotlight 2" alone does not say which. */
27747
- parentName: string().nullable(),
27748
- /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
27749
- suggested: boolean(),
27750
- /** Why it is suggested ("same location"), null when it is not. */
27751
- reason: string().nullable()
27752
- })) });
27753
- /**
27754
- * What a write did. `none` — applied in place. `host` / `parent` — the owner
27755
- * reloaded the host (or, for an accessory child, its parent) because the
27756
- * write changed what the host REGISTERS. A slot never adds a capability to its
27757
- * host — that is a composition (D663) — so today's owners answer `none`.
27758
- */
27759
- var ExtensionSetResultSchema = object({
27760
- applied: literal(true),
27761
- reload: _enum([
27762
- "none",
27763
- "host",
27764
- "parent"
27765
- ])
27766
- });
27767
- var ExtensionSlotRefInputSchema = object({
27768
- deviceId: number().int(),
27769
- slotRef: string().min(1)
27770
- });
27771
- var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
27772
- method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
27773
- kind: "mutation",
27774
- auth: "admin"
27775
- });
27776
- /**
27777
28044
  * Optional client-side hints sent at session creation to help the provider
27778
28045
  * pick the best native source. All fields optional — a viewer that knows
27779
28046
  * nothing still gets a sane default. (Relocated from the retired `webrtc`
@@ -30241,6 +30508,70 @@ onStatusChanged: { data: object({
30241
30508
  * whether persisting is worth a SQLite commit. */
30242
30509
  volatileStateFields: ["lastChangedAt"]
30243
30510
  };
30511
+ var DoorbellStatusSchema = object({
30512
+ /** Ms epoch of the last press. null = never observed since this provider started. */
30513
+ lastPressedAt: number().nullable(),
30514
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
30515
+ pressCountSinceStart: number()
30516
+ });
30517
+ var DoorbellPressEventSchema = object({
30518
+ deviceId: number(),
30519
+ timestamp: number()
30520
+ });
30521
+ /**
30522
+ * Doorbell button cap. Two kinds of provider serve it, and to every consumer
30523
+ * they are the same cap:
30524
+ *
30525
+ * - **Native** providers, registered per device by a driver addon through
30526
+ * `ctx.registerNativeCap` — a `DeviceType.Button` accessory with
30527
+ * `role: DeviceRole.Doorbell`, or the camera itself (Reolink registers at
30528
+ * camera level). They emit `onPressed` on every firmware ring.
30529
+ * - **A composed doorbell** (D670, D671): a camera's customization gives it
30530
+ * the cap, its `lastPressedAt` rising from the sources the operator
30531
+ * assigned in Customize → Doorbell, and the composer emits `onPressed`
30532
+ * from that field's advance (`fromState`).
30533
+ *
30534
+ * The DeviceEventPropagator re-emits `onPressed` on the camera parent.
30535
+ */
30536
+ var doorbellCapability = {
30537
+ name: "doorbell",
30538
+ scope: "device",
30539
+ deviceNative: true,
30540
+ mode: "singleton",
30541
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
30542
+ methods: {},
30543
+ events: {
30544
+ /**
30545
+ * Fires once per physical press. Reolink delivers via Baichuan
30546
+ * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
30547
+ * release/duration — it's a pulse.
30548
+ */
30549
+ onPressed: {
30550
+ data: DoorbellPressEventSchema,
30551
+ fromState: {
30552
+ field: "lastPressedAt",
30553
+ on: "advance"
30554
+ }
30555
+ } },
30556
+ status: {
30557
+ schema: DoorbellStatusSchema,
30558
+ kind: "push"
30559
+ },
30560
+ /**
30561
+ * Runtime-state slice — last press timestamp + lifetime press count.
30562
+ * Mirrored by the kernel and readable via
30563
+ * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
30564
+ * without subscribing.
30565
+ */
30566
+ runtimeState: DoorbellStatusSchema,
30567
+ /**
30568
+ * 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.
30569
+ *
30570
+ * See `RuntimeStateDurability`. Enforced by
30571
+ * `scripts/check-runtime-state-durability.ts`.
30572
+ */
30573
+ durability: "restored"
30574
+ };
30244
30575
  /**
30245
30576
  * Enum-state sensor — a string value picked from a finite option set.
30246
30577
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -32380,39 +32711,14 @@ authKey: string().optional() }), object({
32380
32711
  /** Human-readable error when `ok: false`. */
32381
32712
  error: string().optional()
32382
32713
  }), { kind: "mutation" });
32383
- /**
32384
- * Hardware / firmware motion sensor cap — binary detected state plus
32385
- * a timestamp of the last observation. Distinct from
32386
- * `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
32387
- * `motion` is the lightweight readout from on-camera motion (Reolink
32388
- * `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
32389
- *
32390
- * Native-motion providers also fan out to `detection.camera-native`
32391
- * with `source: 'onboard'` so cross-cutting system services
32392
- * (alert-center, advanced-notifier) can subscribe once and receive
32393
- * motion from every camera.
32394
- */
32395
- /**
32396
- * How long after a camera's last rising edge `pipeline-analytics` closes the
32397
- * motion EPISODE row it kept open for it (D475) — "il delay della cap", in
32398
- * the operator's words. One authority for the whole system: every provider
32399
- * that seeds `autoClearAfterMs` on a `Camera` device writes this SAME
32400
- * constant while `detected: true` (never its own number — Hikvision used to
32401
- * seed its internal 3 s inactivity timer here, which is a different clock for
32402
- * a different purpose), and `MotionEpisodeTracker` imports it directly rather
32403
- * than reading the live cap value on the hot path. A `Sensor` device (HA
32404
- * binary sensor, Homematic) gets a genuine push both ways and has no episode
32405
- * to close on a timer, so it writes `null`, never this constant.
32406
- */
32407
- var MOTION_CLOSE_AFTER_MS = 15e3;
32408
32714
  var MotionStatusSchema = object({
32409
32715
  detected: boolean(),
32410
32716
  /** Ms epoch of the last detected-true observation. Null if never detected. */
32411
32717
  lastDetectedAt: number().nullable(),
32412
32718
  /**
32413
- * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
32414
- * `null` while false and on every `Sensor` device (D475) — see that
32415
- * constant's doc for the one-authority rule.
32719
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
32720
+ * orchestrator writes it, D696), `null` while false and on every `Sensor`
32721
+ * device (D475) — see that constant's doc for the one-authority rule.
32416
32722
  *
32417
32723
  * ## Reading this field still arms nothing
32418
32724
  *
@@ -32430,34 +32736,31 @@ var MotionStatusSchema = object({
32430
32736
  * `addon-export-alexa/src/motion-clear-hold.ts` and
32431
32737
  * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
32432
32738
  *
32433
- * ## Who writes it
32434
- *
32435
- * - **Cameras** — the runner's phase machine, `active → watching` on
32436
- * `cooldown_expired`, which then writes this slice with
32437
- * `detected: false` (`handlePhaseChanged` in
32438
- * `pipeline-runner/index.ts`). It produces the FALLING edge, which
32439
- * matters most for the sources that only ever push a rising one:
32440
- * Reolink emits `MotionOnMotionChanged { detected: true }` and never
32441
- * a false.
32442
- * - **Sensors** (Home Assistant binary sensors, Homematic) — the
32443
- * provider pushes the false itself, from the upstream system's own
32444
- * state change. No phase machine is involved.
32739
+ * ## Who writes it (D696)
32445
32740
  *
32446
- * ### The phase machine is CANONICAL, not sole — and that is a defect
32741
+ * - **Cameras** — the orchestrator, and nothing else. It writes the camera's
32742
+ * EFFECTIVE motion (`addon-pipeline-orchestrator`
32743
+ * `camera-sensors/motion-slice.ts`), alongside the effective
32744
+ * `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
32745
+ * for a split camera, an unsplit emitter's direct event, the analyzer and
32746
+ * device activity, as the camera's `motionSources` counts them. A source
32747
+ * that never sends a clear falls one window after its last `true`.
32748
+ * `lastDetectedAt` moves only on an effective rise. No camera provider
32749
+ * writes this slice (not even a boot seed), and neither does the runner's
32750
+ * phase machine: its phase is "a session is attached" for every on-motion
32751
+ * session, not motion, and it now has its own `DetectionPhaseTransition`.
32752
+ * A provider's `isDetected` answers from the hub's slice.
32753
+ * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
32754
+ * imports) — the provider pushes both edges itself, from the upstream
32755
+ * system's own state change. That is the sensor's own fact.
32447
32756
  *
32448
- * An earlier revision of this docblock (mine, 2026-09-12) claimed the
32449
- * phase machine is the sole writer for a camera. It is not.
32450
- * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
32451
- * `setCapSlice(motionCapability, …)` on their own rising edge, and
32452
- * Hikvision's comment says why: it read THIS docblock, agreed the
32453
- * runner is canonical, and wrote anyway to avoid per-tick churn. So
32454
- * two authorities can disagree about one slice, which this repo
32455
- * forbids, and the doc said otherwise — which is worse than saying
32456
- * nothing, because it reads as verification.
32757
+ * `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
32758
+ * `motion` slice; each sensor writer is a named exemption.
32457
32759
  *
32458
- * This predates D475 and is not fixed there: the fix touches every
32459
- * camera provider. Recorded in D475's Consequences. Do not restore the
32460
- * "sole writer" wording without also removing the other writers.
32760
+ * This replaces the D475 §4 rule ("the phase machine is the sole writer").
32761
+ * That rule was never true: Hikvision and Amcrest wrote the slice raw beside
32762
+ * it, every provider seeded it at boot, and every session left it
32763
+ * `detected: true` after its detach.
32461
32764
  */
32462
32765
  autoClearAfterMs: number().nullable()
32463
32766
  });
@@ -32529,11 +32832,12 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
32529
32832
  */
32530
32833
  runtimeState: MotionStatusSchema,
32531
32834
  /**
32532
- * Runtime-state durability: **session** — every writer of this slice
32835
+ * Runtime-state durability: **session** — the writer of this slice
32533
32836
  * writes only on an EDGE, so a restored `detected: true` would stay
32534
32837
  * frozen until the next one instead of being corrected. The next edge
32535
- * re-publishes the real state. (On who the writers are, and why there
32536
- * is more than one, see `autoClearAfterMs` above.)
32838
+ * re-publishes the real state, and the orchestrator re-publishes every
32839
+ * camera when it starts writing (D696; on who writes it, see
32840
+ * `autoClearAfterMs` above).
32537
32841
  *
32538
32842
  * See `RuntimeStateDurability`. Enforced by
32539
32843
  * `scripts/check-runtime-state-durability.ts`.
@@ -35074,8 +35378,7 @@ var ptzAutotrackCapability = {
35074
35378
  deviceNative: true,
35075
35379
  mode: "singleton",
35076
35380
  /**
35077
- * Two kinds of provider behind one name, the same shape `snapshot` and
35078
- * `doorbell` use:
35381
+ * Two kinds of provider behind one name, the same shape `snapshot` uses:
35079
35382
  *
35080
35383
  * - **Native**: the camera's own firmware autotrack, registered per device by
35081
35384
  * the driver when the probe says it exists (Reolink: yes; Hikvision:
@@ -35083,7 +35386,7 @@ var ptzAutotrackCapability = {
35083
35386
  * - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
35084
35387
  * which follows a subject with `ptz.move` pulses driven by the detection
35085
35388
  * pipeline. `defaultActive: false` — the operator binds it per camera in
35086
- * the bindings UI, exactly as `virtual-doorbell` is bound.
35389
+ * the bindings UI.
35087
35390
  *
35088
35391
  * The binding chooses WHICH implementation answers; `setEnabled` stays the
35089
35392
  * one switch for the function either way. A camera never has both driving its
@@ -39426,47 +39729,6 @@ var zoneRulesCapability = {
39426
39729
  */
39427
39730
  durability: "restored"
39428
39731
  };
39429
- var NUMBER = {
39430
- kind: "fixed",
39431
- result: ["number"]
39432
- };
39433
- var BOOLEAN = {
39434
- kind: "fixed",
39435
- result: ["boolean"]
39436
- };
39437
- Object.freeze({
39438
- min: NUMBER,
39439
- max: NUMBER,
39440
- abs: NUMBER,
39441
- floor: NUMBER,
39442
- ceil: NUMBER,
39443
- sqrt: NUMBER,
39444
- round: NUMBER,
39445
- pow: NUMBER,
39446
- clamp: NUMBER,
39447
- avg: NUMBER,
39448
- sum: NUMBER,
39449
- age: NUMBER,
39450
- convert: NUMBER,
39451
- coalesce: { kind: "coalesce" },
39452
- any: BOOLEAN,
39453
- all: BOOLEAN,
39454
- within: BOOLEAN,
39455
- latest: {
39456
- kind: "fixed",
39457
- result: ["number", "null"]
39458
- },
39459
- number: {
39460
- kind: "fixed",
39461
- result: ["number", "null"]
39462
- },
39463
- rose: {
39464
- kind: "fixed",
39465
- result: ["number", "null"]
39466
- },
39467
- count: NUMBER
39468
- });
39469
- `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
39470
39732
  /**
39471
39733
  * Accessory device helpers — shared across drivers.
39472
39734
  *
@@ -43618,6 +43880,12 @@ Object.freeze({
43618
43880
  addonId: null,
43619
43881
  access: "view"
43620
43882
  },
43883
+ "coreBlocks.listComposableCaps": {
43884
+ capName: "core-blocks",
43885
+ capScope: "system",
43886
+ addonId: null,
43887
+ access: "view"
43888
+ },
43621
43889
  "coreBlocks.listCompositions": {
43622
43890
  capName: "core-blocks",
43623
43891
  capScope: "system",
@@ -43696,6 +43964,18 @@ Object.freeze({
43696
43964
  addonId: null,
43697
43965
  access: "view"
43698
43966
  },
43967
+ "databaseSnapshot.listDatabases": {
43968
+ capName: "database-snapshot",
43969
+ capScope: "system",
43970
+ addonId: null,
43971
+ access: "view"
43972
+ },
43973
+ "databaseSnapshot.writeSnapshot": {
43974
+ capName: "database-snapshot",
43975
+ capScope: "system",
43976
+ addonId: null,
43977
+ access: "create"
43978
+ },
43699
43979
  "dataStoreProvider.aggregate": {
43700
43980
  capName: "data-store-provider",
43701
43981
  capScope: "system",
@@ -46432,6 +46712,12 @@ Object.freeze({
46432
46712
  addonId: null,
46433
46713
  access: "create"
46434
46714
  },
46715
+ "pipelineAnalytics.clearTrackRelation": {
46716
+ capName: "pipeline-analytics",
46717
+ capScope: "device",
46718
+ addonId: null,
46719
+ access: "delete"
46720
+ },
46435
46721
  "pipelineAnalytics.clearTracks": {
46436
46722
  capName: "pipeline-analytics",
46437
46723
  capScope: "device",
@@ -46684,6 +46970,12 @@ Object.freeze({
46684
46970
  addonId: null,
46685
46971
  access: "view"
46686
46972
  },
46973
+ "pipelineAnalytics.listTrackRelations": {
46974
+ capName: "pipeline-analytics",
46975
+ capScope: "device",
46976
+ addonId: null,
46977
+ access: "view"
46978
+ },
46687
46979
  "pipelineAnalytics.listTracks": {
46688
46980
  capName: "pipeline-analytics",
46689
46981
  capScope: "device",
@@ -46798,6 +47090,18 @@ Object.freeze({
46798
47090
  addonId: null,
46799
47091
  access: "create"
46800
47092
  },
47093
+ "pipelineAnalytics.setTrackPurity": {
47094
+ capName: "pipeline-analytics",
47095
+ capScope: "device",
47096
+ addonId: null,
47097
+ access: "create"
47098
+ },
47099
+ "pipelineAnalytics.setTrackRelation": {
47100
+ capName: "pipeline-analytics",
47101
+ capScope: "device",
47102
+ addonId: null,
47103
+ access: "create"
47104
+ },
46801
47105
  "pipelineAnalytics.startStorageMigrationMove": {
46802
47106
  capName: "pipeline-analytics",
46803
47107
  capScope: "device",
@@ -47236,6 +47540,12 @@ Object.freeze({
47236
47540
  addonId: null,
47237
47541
  access: "delete"
47238
47542
  },
47543
+ "pipelineOrchestrator.requestOccupancyLook": {
47544
+ capName: "pipeline-orchestrator",
47545
+ capScope: "system",
47546
+ addonId: null,
47547
+ access: "create"
47548
+ },
47239
47549
  "pipelineOrchestrator.resetNodePipelineDefaults": {
47240
47550
  capName: "pipeline-orchestrator",
47241
47551
  capScope: "system",
@@ -47302,6 +47612,12 @@ Object.freeze({
47302
47612
  addonId: null,
47303
47613
  access: "create"
47304
47614
  },
47615
+ "pipelineOrchestrator.setCameraSensors": {
47616
+ capName: "pipeline-orchestrator",
47617
+ capScope: "system",
47618
+ addonId: null,
47619
+ access: "create"
47620
+ },
47305
47621
  "pipelineOrchestrator.setCameraStepOverride": {
47306
47622
  capName: "pipeline-orchestrator",
47307
47623
  capScope: "system",
@@ -50712,6 +51028,11 @@ Object.freeze({
50712
51028
  form: "single",
50713
51029
  optional: false
50714
51030
  }],
51031
+ "pipelineAnalytics.clearTrackRelation": [{
51032
+ name: "deviceId",
51033
+ form: "single",
51034
+ optional: false
51035
+ }],
50715
51036
  "pipelineAnalytics.clearTracks": [{
50716
51037
  name: "deviceId",
50717
51038
  form: "single",
@@ -50862,6 +51183,11 @@ Object.freeze({
50862
51183
  form: "single",
50863
51184
  optional: false
50864
51185
  }],
51186
+ "pipelineAnalytics.listTrackRelations": [{
51187
+ name: "deviceId",
51188
+ form: "single",
51189
+ optional: false
51190
+ }],
50865
51191
  "pipelineAnalytics.listTracks": [{
50866
51192
  name: "deviceId",
50867
51193
  form: "single",
@@ -50932,6 +51258,16 @@ Object.freeze({
50932
51258
  form: "single",
50933
51259
  optional: false
50934
51260
  }],
51261
+ "pipelineAnalytics.setTrackPurity": [{
51262
+ name: "deviceId",
51263
+ form: "single",
51264
+ optional: false
51265
+ }],
51266
+ "pipelineAnalytics.setTrackRelation": [{
51267
+ name: "deviceId",
51268
+ form: "single",
51269
+ optional: false
51270
+ }],
50935
51271
  "pipelineAnalytics.wipeAllAnalytics": [{
50936
51272
  name: "deviceId",
50937
51273
  form: "single",
@@ -51002,6 +51338,11 @@ Object.freeze({
51002
51338
  form: "single",
51003
51339
  optional: false
51004
51340
  }],
51341
+ "pipelineOrchestrator.requestOccupancyLook": [{
51342
+ name: "deviceId",
51343
+ form: "single",
51344
+ optional: false
51345
+ }],
51005
51346
  "pipelineOrchestrator.resolvePipeline": [{
51006
51347
  name: "deviceId",
51007
51348
  form: "single",
@@ -51012,6 +51353,11 @@ Object.freeze({
51012
51353
  form: "single",
51013
51354
  optional: false
51014
51355
  }],
51356
+ "pipelineOrchestrator.setCameraSensors": [{
51357
+ name: "deviceId",
51358
+ form: "single",
51359
+ optional: false
51360
+ }],
51015
51361
  "pipelineOrchestrator.setCameraStepOverride": [{
51016
51362
  name: "deviceId",
51017
51363
  form: "single",
@@ -52158,6 +52504,18 @@ var STATE_SUMMARY_VARS = [
52158
52504
  systemEventKinds: [...SUMMARISABLE],
52159
52505
  systemEventDeliveries: ["summary"]
52160
52506
  },
52507
+ {
52508
+ name: "summarySection",
52509
+ label: "Summary: this section",
52510
+ description: "The section a per-section summary row is about (D698); on a summary sent as one message, every section it reports, comma-separated.",
52511
+ example: "Batterie scariche",
52512
+ group: "system",
52513
+ families: ["rule"],
52514
+ fields: [...RULE_TEXT],
52515
+ kinds: ["system"],
52516
+ systemEventKinds: [...SUMMARISABLE],
52517
+ systemEventDeliveries: ["summary"]
52518
+ },
52161
52519
  ...STATE_SUMMARY_SECTION_VARS.map((v) => ({
52162
52520
  name: v.name,
52163
52521
  label: v.label,
@@ -52234,6 +52592,37 @@ var STATE_SUMMARY_VARS = [
52234
52592
  [...RULE_TEXT],
52235
52593
  ...STATE_SUMMARY_VARS
52236
52594
  ];
52595
+ new Set([
52596
+ "disarmed",
52597
+ "armed_home",
52598
+ "armed_away",
52599
+ "armed_night",
52600
+ "armed_vacation",
52601
+ "armed_custom_bypass",
52602
+ "arming",
52603
+ "disarming",
52604
+ "pending",
52605
+ "triggered",
52606
+ "open",
52607
+ "opening",
52608
+ "closing",
52609
+ "closed",
52610
+ "stopped",
52611
+ "locked",
52612
+ "unlocked",
52613
+ "locking",
52614
+ "unlocking",
52615
+ "jammed",
52616
+ "on",
52617
+ "off",
52618
+ "home",
52619
+ "not_home",
52620
+ "matched",
52621
+ "diverged",
52622
+ "unknown",
52623
+ "latched",
52624
+ "live"
52625
+ ]);
52237
52626
  /**
52238
52627
  * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
52239
52628
  *
@@ -52465,6 +52854,25 @@ TimelapseRuleInputSchema.extend({
52465
52854
  createdAt: number(),
52466
52855
  updatedAt: number()
52467
52856
  });
52857
+ async function readHubMotionDetected(deviceState, deviceId) {
52858
+ let slice;
52859
+ try {
52860
+ slice = await deviceState.getCapSlice.query({
52861
+ deviceId,
52862
+ capName: "motion"
52863
+ });
52864
+ } catch (err) {
52865
+ const reason = err instanceof Error ? err.message : String(err);
52866
+ throw new Error(`motion state of device ${deviceId} is unreadable: ${reason}`, { cause: err });
52867
+ }
52868
+ const detected = slice?.["detected"];
52869
+ if (typeof detected !== "boolean") throw new Error(`motion state of device ${deviceId} is not published yet (unknown)`);
52870
+ return detected;
52871
+ }
52872
+ MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
52873
+ function providerMotionEvent(source, data) {
52874
+ return createEvent(EventCategory.ProviderMotion, source, data);
52875
+ }
52468
52876
  object({
52469
52877
  /**
52470
52878
  * Fraction of the box's own size added on EACH side before cutting.
@@ -54834,17 +55242,14 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
54834
55242
  }
54835
55243
  /** Register the native `motion` cap. Its mere presence (a `kind:'native'`
54836
55244
  * `motion` binding) is what the orchestrator reads to default a
54837
- * freshly-adopted camera to `motionSources:['onboard']`. */
55245
+ * freshly-adopted camera to `motionSources:['onboard']`. `isDetected`
55246
+ * answers from the HUB's slice; an unreadable hub, or a slice nobody has
55247
+ * published yet, fails the call — never `false` for unknown (D49, D393). */
54838
55248
  registerMotionCap() {
54839
55249
  this.ctx.registerNativeCap(motionCapability, { isDetected: async ({ deviceId }) => {
54840
55250
  if (deviceId !== this.id) throw new Error(`AmcrestCamera: motion deviceId mismatch, expected ${this.id}, got ${deviceId}`);
54841
- return this.getCapSlice(motionCapability)?.detected ?? false;
55251
+ return readHubMotionDetected(this.ctx.api.deviceState, this.id);
54842
55252
  } });
54843
- this.setCapSlice(motionCapability, {
54844
- detected: false,
54845
- lastDetectedAt: null,
54846
- autoClearAfterMs: null
54847
- });
54848
55253
  this.ctx.logger.info("amcrest: motion cap registered", { tags: { deviceId: this.id } });
54849
55254
  }
54850
55255
  /** Reusable event-source identity for every emit on this device. */
@@ -54856,10 +55261,12 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
54856
55261
  deviceId: this.id
54857
55262
  };
54858
55263
  }
54859
- /** Emit an onboard motion transition on the bus. The runner subscribes
54860
- * and drives its phase machine via `reportMotion`. */
55264
+ /** Emit the camera's RAW onboard motion transition (`ProviderMotion`,
55265
+ * D673). The orchestrator's camera-sensors bridge re-emits it as
55266
+ * `MotionOnMotionChanged`; the runner subscribes to that and drives its
55267
+ * phase machine via `reportMotion`. */
54861
55268
  emitMotion(detected, timestamp) {
54862
- this.ctx.eventBus.emit(createEvent(EventCategory.MotionOnMotionChanged, this.eventSource(), {
55269
+ this.ctx.eventBus.emit(providerMotionEvent(this.eventSource(), {
54863
55270
  deviceId: this.id,
54864
55271
  detected,
54865
55272
  timestamp,
@@ -54954,14 +55361,7 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
54954
55361
  const wasActive = this.motionActive;
54955
55362
  this.motionActive = true;
54956
55363
  this.emitMotion(true, now);
54957
- if (!wasActive) {
54958
- this.setCapSlice(motionCapability, {
54959
- detected: true,
54960
- lastDetectedAt: now,
54961
- autoClearAfterMs: MOTION_CLOSE_AFTER_MS
54962
- });
54963
- this.ctx.logger.info("amcrest: onboard motion started", { tags: { deviceId: this.id } });
54964
- }
55364
+ if (!wasActive) this.ctx.logger.info("amcrest: onboard motion started", { tags: { deviceId: this.id } });
54965
55365
  if (this.motionKeepaliveTimer === null) this.motionKeepaliveTimer = setInterval(() => {
54966
55366
  this.emitMotion(true, Date.now());
54967
55367
  }, AmcrestCamera.MOTION_KEEPALIVE_MS);
@@ -54971,12 +55371,6 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
54971
55371
  if (!this.motionActive) return;
54972
55372
  this.motionActive = false;
54973
55373
  this.emitMotion(false, now);
54974
- const lastDetectedAt = this.getCapSlice(motionCapability)?.lastDetectedAt ?? now;
54975
- this.setCapSlice(motionCapability, {
54976
- detected: false,
54977
- lastDetectedAt,
54978
- autoClearAfterMs: null
54979
- });
54980
55374
  this.ctx.logger.info("amcrest: onboard motion stopped", { tags: { deviceId: this.id } });
54981
55375
  }
54982
55376
  clearMotionKeepalive() {