@camstack/addon-provider-rademacher 0.2.95 → 0.2.97

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 +182 -24
  2. package/dist/addon.mjs +182 -24
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8288,6 +8288,23 @@ function errMsg(err) {
8288
8288
  if (typeof err === "string") return err;
8289
8289
  return String(err);
8290
8290
  }
8291
+ new Set([
8292
+ "track",
8293
+ "summary",
8294
+ "face",
8295
+ "identity",
8296
+ "plate",
8297
+ "vehicle",
8298
+ "scene",
8299
+ "motion",
8300
+ "object",
8301
+ "audio"
8302
+ ]);
8303
+ new Set([
8304
+ "motion",
8305
+ "object",
8306
+ "audio"
8307
+ ]);
8291
8308
  var EncodeProfileSchema = object({
8292
8309
  video: object({
8293
8310
  codec: _enum([
@@ -13488,8 +13505,17 @@ method(object({
13488
13505
  }), array(SettingsRecordSchema).readonly()), method(object({
13489
13506
  namespace: string().optional(),
13490
13507
  collection: string(),
13491
- record: SettingsRecordSchema
13492
- }), _void(), { kind: "mutation" }), method(object({
13508
+ record: object({
13509
+ id: string().optional(),
13510
+ data: record(string(), unknown())
13511
+ })
13512
+ }), object({
13513
+ /**
13514
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
13515
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
13516
+ * primary key — which is the only place an auto key is knowable.
13517
+ */
13518
+ id: union([string(), number()]) }), { kind: "mutation" }), method(object({
13493
13519
  namespace: string().optional(),
13494
13520
  collection: string(),
13495
13521
  records: array(BulkRecordSchema).readonly()
@@ -13598,8 +13624,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
13598
13624
  }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
13599
13625
  namespace: string().optional(),
13600
13626
  collection: string(),
13601
- record: SettingsRecordSchema
13602
- }), _void(), {
13627
+ record: object({
13628
+ id: string().optional(),
13629
+ data: record(string(), unknown())
13630
+ })
13631
+ }), object({
13632
+ /**
13633
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
13634
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
13635
+ * primary key — which is the only place an auto key is knowable.
13636
+ */
13637
+ id: union([string(), number()]) }), {
13603
13638
  kind: "mutation",
13604
13639
  auth: "admin"
13605
13640
  }), method(object({
@@ -20507,7 +20542,20 @@ var TrackSchema = object({
20507
20542
  ...TrackRetrainFields
20508
20543
  });
20509
20544
  var BaseEventFields = {
20510
- id: string(),
20545
+ /**
20546
+ * A SQLite ROWID, assigned by the database (D474).
20547
+ *
20548
+ * Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
20549
+ * TWICE per row, in the row and in the primary-key index, across 2.1 million
20550
+ * motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
20551
+ * the rowid: the table itself is that B-tree, so the index stops existing
20552
+ * rather than getting smaller. No shorter string does that.
20553
+ *
20554
+ * Defined once here for all three event kinds, which is why they move
20555
+ * together: a per-table migration would have forked this and
20556
+ * `COMMON_BASE_COLUMNS` and reunited them two stages later.
20557
+ */
20558
+ id: number().int(),
20511
20559
  deviceId: number(),
20512
20560
  timestamp: number()
20513
20561
  };
@@ -20526,7 +20574,34 @@ var MotionEventSchema = object({
20526
20574
  /** Omitted in slim projection. */
20527
20575
  frameHeight: number().optional(),
20528
20576
  /** Populated by B5 (recording playback URL for this event). */
20529
- mediaUrl: string().optional()
20577
+ mediaUrl: string().optional(),
20578
+ /**
20579
+ * One row per motion EPISODE, not one per push (D475). `null` while the
20580
+ * episode is still open — a further rising edge extends it in place rather
20581
+ * than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
20582
+ * (the span from the first rising edge to the LAST one, deliberately NOT
20583
+ * `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
20584
+ * movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
20585
+ * motion for an instantaneous trigger).
20586
+ *
20587
+ * **Absent** (not merely `null`) on a row written before D475 — that means
20588
+ * "closed the old way, before this column existed", never "still open".
20589
+ * Nothing in this codebase may read an absent `durationMs` as an open
20590
+ * episode; only `null` means open.
20591
+ */
20592
+ durationMs: number().nullable().optional(),
20593
+ /**
20594
+ * Ms offsets from `timestamp` (the episode's own first rising edge, so the
20595
+ * first entry is always `0`) of every genuine off→on transition the
20596
+ * episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
20597
+ * push: a firmware source that keepalives at ~1 Hz for the whole burst
20598
+ * (Reolink, Hikvision) produces exactly one edge; a source that reports an
20599
+ * explicit `false` mid-episode and then resumes before the quiet window
20600
+ * elapses produces another. Stored compactly — see `motion-edge-codec.ts`
20601
+ * — and decoded back to this shape on read. Absent/empty on a legacy row,
20602
+ * which must never be read as "no episode happened here".
20603
+ */
20604
+ edges: array(number()).readonly().optional()
20530
20605
  });
20531
20606
  /**
20532
20607
  * Which detection SOURCE produced an object event. `pipeline` = the ML
@@ -20581,6 +20656,23 @@ var ObjectEventSchema = object({
20581
20656
  * includes it (it is light). Absent on rows written before this field.
20582
20657
  */
20583
20658
  frameId: string().optional(),
20659
+ /**
20660
+ * A PRODUCER-chosen key that makes a synthetic event's emission idempotent
20661
+ * (D474).
20662
+ *
20663
+ * Only the package detector writes it, and it exists because the event id
20664
+ * stopped being choosable: the delivery and pick-up rows used to BE their
20665
+ * dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
20666
+ * second delivery for this entry" survived a restart. An `INTEGER` rowid is
20667
+ * assigned by SQLite, so that key had to move off the primary key rather
20668
+ * than be dropped — a detector that cannot recognise its own row re-delivers
20669
+ * every parcel on every boot.
20670
+ *
20671
+ * Absent on every other object event, and on every row written before this
20672
+ * field. Never a substitute for `id`: it is unique per (producer, occasion),
20673
+ * not per row, and nothing addresses a row by it.
20674
+ */
20675
+ idempotencyKey: string().optional(),
20584
20676
  /** Omitted in slim projection. */
20585
20677
  trackId: string().optional(),
20586
20678
  className: string(),
@@ -21683,6 +21775,14 @@ var NativeCropResultSchema = object({
21683
21775
  * set `encodeJpeg: true`; `bytes` is then absent.
21684
21776
  */
21685
21777
  jpeg: string().optional(),
21778
+ /**
21779
+ * The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
21780
+ * `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
21781
+ * `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
21782
+ * `bytes` above has crossed this boundary as a `Uint8Array` all along — so
21783
+ * base64 was buying nothing but a multi-megabyte string in the relay's heap.
21784
+ */
21785
+ jpegBytes: _instanceof(Uint8Array).optional(),
21686
21786
  width: number().int().positive(),
21687
21787
  height: number().int().positive(),
21688
21788
  /**
@@ -21749,7 +21849,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
21749
21849
  })]);
21750
21850
  /** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
21751
21851
  var ParkedTrackFrameSchema = object({
21752
- jpeg: string(),
21852
+ /**
21853
+ * Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
21854
+ * `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
21855
+ * Exactly one of the two is present.
21856
+ */
21857
+ jpeg: string().optional(),
21858
+ /** The same JPEG as bytes, for a caller that declared it reads them (D462). */
21859
+ jpegBytes: _instanceof(Uint8Array).optional(),
21753
21860
  width: number().int().positive(),
21754
21861
  height: number().int().positive(),
21755
21862
  /** The frame instant the parcel shows (the caller's clock, echoed back). */
@@ -22336,6 +22443,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
22336
22443
  bbox: NativeCropBboxSchema,
22337
22444
  maxWidth: number().int().positive().optional(),
22338
22445
  /**
22446
+ * The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
22447
+ * back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
22448
+ * wire — never assume consent: a pre-D462 caller parses the field as
22449
+ * base64 and bytes would decode to garbage rather than fail.
22450
+ */
22451
+ acceptJpegBytes: boolean().optional(),
22452
+ /**
22339
22453
  * When `true`, the runner encodes the resolved crop to JPEG ON THE
22340
22454
  * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
22341
22455
  * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
@@ -22403,7 +22517,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
22403
22517
  }), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
22404
22518
  deviceId: number(),
22405
22519
  trackId: string(),
22406
- kind: ParkedFrameKindSchema
22520
+ kind: ParkedFrameKindSchema,
22521
+ /**
22522
+ * The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
22523
+ * back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
22524
+ * wire — never assume consent: a pre-D462 caller parses the field as
22525
+ * base64 and bytes would decode to garbage rather than fail.
22526
+ */
22527
+ acceptJpegBytes: boolean().optional()
22407
22528
  }), ParkedTrackFrameSchema.nullable()), method(object({
22408
22529
  deviceId: number(),
22409
22530
  trackId: string()
@@ -28801,26 +28922,59 @@ authKey: string().optional() }), object({
28801
28922
  /** Human-readable error when `ok: false`. */
28802
28923
  error: string().optional()
28803
28924
  }), { kind: "mutation" });
28804
- /**
28805
- * Hardware / firmware motion sensor cap — binary detected state plus
28806
- * a timestamp of the last observation. Distinct from
28807
- * `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
28808
- * `motion` is the lightweight readout from on-camera motion (Reolink
28809
- * `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
28810
- *
28811
- * Native-motion providers also fan out to `detection.camera-native`
28812
- * with `source: 'onboard'` so cross-cutting system services
28813
- * (alert-center, advanced-notifier) can subscribe once and receive
28814
- * motion from every camera.
28815
- */
28816
28925
  var MotionStatusSchema = object({
28817
28926
  detected: boolean(),
28818
28927
  /** Ms epoch of the last detected-true observation. Null if never detected. */
28819
28928
  lastDetectedAt: number().nullable(),
28820
28929
  /**
28821
- * Ms after which `detected` auto-reverts to false if no fresh push
28822
- * arrives. Null means the provider leaves detected state until a
28823
- * native "clear" event.
28930
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
28931
+ * `null` while false and on every `Sensor` device (D475) — see that
28932
+ * constant's doc for the one-authority rule.
28933
+ *
28934
+ * ## Reading this field still arms nothing
28935
+ *
28936
+ * It reads like an instruction to the consumer ("revert after N ms if
28937
+ * no fresh push arrives") and it is not one: nothing in this repo reads
28938
+ * the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
28939
+ * close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
28940
+ * imported constant, not as a read of `device.state.motion.value`, so this
28941
+ * field stays what it always was: DESCRIPTIVE output, mirroring an answer
28942
+ * computed elsewhere. Building a self-clear timer out of a READ of this
28943
+ * field would add a second falling-edge authority beside whichever one
28944
+ * already owns the device, and two that can disagree are worse than one.
28945
+ * Consumers that need a falling edge SHAPED differently — held open across
28946
+ * a flapping source — debounce on their own side and say so, as
28947
+ * `addon-export-alexa/src/motion-clear-hold.ts` and
28948
+ * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
28949
+ *
28950
+ * ## Who writes it
28951
+ *
28952
+ * - **Cameras** — the runner's phase machine, `active → watching` on
28953
+ * `cooldown_expired`, which then writes this slice with
28954
+ * `detected: false` (`handlePhaseChanged` in
28955
+ * `pipeline-runner/index.ts`). It produces the FALLING edge, which
28956
+ * matters most for the sources that only ever push a rising one:
28957
+ * Reolink emits `MotionOnMotionChanged { detected: true }` and never
28958
+ * a false.
28959
+ * - **Sensors** (Home Assistant binary sensors, Homematic) — the
28960
+ * provider pushes the false itself, from the upstream system's own
28961
+ * state change. No phase machine is involved.
28962
+ *
28963
+ * ### The phase machine is CANONICAL, not sole — and that is a defect
28964
+ *
28965
+ * An earlier revision of this docblock (mine, 2026-09-12) claimed the
28966
+ * phase machine is the sole writer for a camera. It is not.
28967
+ * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
28968
+ * `setCapSlice(motionCapability, …)` on their own rising edge, and
28969
+ * Hikvision's comment says why: it read THIS docblock, agreed the
28970
+ * runner is canonical, and wrote anyway to avoid per-tick churn. So
28971
+ * two authorities can disagree about one slice, which this repo
28972
+ * forbids, and the doc said otherwise — which is worse than saying
28973
+ * nothing, because it reads as verification.
28974
+ *
28975
+ * This predates D475 and is not fixed there: the fix touches every
28976
+ * camera provider. Recorded in D475's Consequences. Do not restore the
28977
+ * "sole writer" wording without also removing the other writers.
28824
28978
  */
28825
28979
  autoClearAfterMs: number().nullable()
28826
28980
  });
@@ -28890,7 +29044,11 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
28890
29044
  */
28891
29045
  runtimeState: MotionStatusSchema,
28892
29046
  /**
28893
- * Runtime-state durability: **session** — self-clearing by construction (`autoClearAfterMs`); a restored `detected: true` is a frozen event, and the next frame re-publishes the real one.
29047
+ * Runtime-state durability: **session** — every writer of this slice
29048
+ * writes only on an EDGE, so a restored `detected: true` would stay
29049
+ * frozen until the next one instead of being corrected. The next edge
29050
+ * re-publishes the real state. (On who the writers are, and why there
29051
+ * is more than one, see `autoClearAfterMs` above.)
28894
29052
  *
28895
29053
  * See `RuntimeStateDurability`. Enforced by
28896
29054
  * `scripts/check-runtime-state-durability.ts`.
package/dist/addon.mjs CHANGED
@@ -8287,6 +8287,23 @@ function errMsg(err) {
8287
8287
  if (typeof err === "string") return err;
8288
8288
  return String(err);
8289
8289
  }
8290
+ new Set([
8291
+ "track",
8292
+ "summary",
8293
+ "face",
8294
+ "identity",
8295
+ "plate",
8296
+ "vehicle",
8297
+ "scene",
8298
+ "motion",
8299
+ "object",
8300
+ "audio"
8301
+ ]);
8302
+ new Set([
8303
+ "motion",
8304
+ "object",
8305
+ "audio"
8306
+ ]);
8290
8307
  var EncodeProfileSchema = object({
8291
8308
  video: object({
8292
8309
  codec: _enum([
@@ -13487,8 +13504,17 @@ method(object({
13487
13504
  }), array(SettingsRecordSchema).readonly()), method(object({
13488
13505
  namespace: string().optional(),
13489
13506
  collection: string(),
13490
- record: SettingsRecordSchema
13491
- }), _void(), { kind: "mutation" }), method(object({
13507
+ record: object({
13508
+ id: string().optional(),
13509
+ data: record(string(), unknown())
13510
+ })
13511
+ }), object({
13512
+ /**
13513
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
13514
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
13515
+ * primary key — which is the only place an auto key is knowable.
13516
+ */
13517
+ id: union([string(), number()]) }), { kind: "mutation" }), method(object({
13492
13518
  namespace: string().optional(),
13493
13519
  collection: string(),
13494
13520
  records: array(BulkRecordSchema).readonly()
@@ -13597,8 +13623,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
13597
13623
  }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
13598
13624
  namespace: string().optional(),
13599
13625
  collection: string(),
13600
- record: SettingsRecordSchema
13601
- }), _void(), {
13626
+ record: object({
13627
+ id: string().optional(),
13628
+ data: record(string(), unknown())
13629
+ })
13630
+ }), object({
13631
+ /**
13632
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
13633
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
13634
+ * primary key — which is the only place an auto key is knowable.
13635
+ */
13636
+ id: union([string(), number()]) }), {
13602
13637
  kind: "mutation",
13603
13638
  auth: "admin"
13604
13639
  }), method(object({
@@ -20506,7 +20541,20 @@ var TrackSchema = object({
20506
20541
  ...TrackRetrainFields
20507
20542
  });
20508
20543
  var BaseEventFields = {
20509
- id: string(),
20544
+ /**
20545
+ * A SQLite ROWID, assigned by the database (D474).
20546
+ *
20547
+ * Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
20548
+ * TWICE per row, in the row and in the primary-key index, across 2.1 million
20549
+ * motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
20550
+ * the rowid: the table itself is that B-tree, so the index stops existing
20551
+ * rather than getting smaller. No shorter string does that.
20552
+ *
20553
+ * Defined once here for all three event kinds, which is why they move
20554
+ * together: a per-table migration would have forked this and
20555
+ * `COMMON_BASE_COLUMNS` and reunited them two stages later.
20556
+ */
20557
+ id: number().int(),
20510
20558
  deviceId: number(),
20511
20559
  timestamp: number()
20512
20560
  };
@@ -20525,7 +20573,34 @@ var MotionEventSchema = object({
20525
20573
  /** Omitted in slim projection. */
20526
20574
  frameHeight: number().optional(),
20527
20575
  /** Populated by B5 (recording playback URL for this event). */
20528
- mediaUrl: string().optional()
20576
+ mediaUrl: string().optional(),
20577
+ /**
20578
+ * One row per motion EPISODE, not one per push (D475). `null` while the
20579
+ * episode is still open — a further rising edge extends it in place rather
20580
+ * than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
20581
+ * (the span from the first rising edge to the LAST one, deliberately NOT
20582
+ * `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
20583
+ * movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
20584
+ * motion for an instantaneous trigger).
20585
+ *
20586
+ * **Absent** (not merely `null`) on a row written before D475 — that means
20587
+ * "closed the old way, before this column existed", never "still open".
20588
+ * Nothing in this codebase may read an absent `durationMs` as an open
20589
+ * episode; only `null` means open.
20590
+ */
20591
+ durationMs: number().nullable().optional(),
20592
+ /**
20593
+ * Ms offsets from `timestamp` (the episode's own first rising edge, so the
20594
+ * first entry is always `0`) of every genuine off→on transition the
20595
+ * episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
20596
+ * push: a firmware source that keepalives at ~1 Hz for the whole burst
20597
+ * (Reolink, Hikvision) produces exactly one edge; a source that reports an
20598
+ * explicit `false` mid-episode and then resumes before the quiet window
20599
+ * elapses produces another. Stored compactly — see `motion-edge-codec.ts`
20600
+ * — and decoded back to this shape on read. Absent/empty on a legacy row,
20601
+ * which must never be read as "no episode happened here".
20602
+ */
20603
+ edges: array(number()).readonly().optional()
20529
20604
  });
20530
20605
  /**
20531
20606
  * Which detection SOURCE produced an object event. `pipeline` = the ML
@@ -20580,6 +20655,23 @@ var ObjectEventSchema = object({
20580
20655
  * includes it (it is light). Absent on rows written before this field.
20581
20656
  */
20582
20657
  frameId: string().optional(),
20658
+ /**
20659
+ * A PRODUCER-chosen key that makes a synthetic event's emission idempotent
20660
+ * (D474).
20661
+ *
20662
+ * Only the package detector writes it, and it exists because the event id
20663
+ * stopped being choosable: the delivery and pick-up rows used to BE their
20664
+ * dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
20665
+ * second delivery for this entry" survived a restart. An `INTEGER` rowid is
20666
+ * assigned by SQLite, so that key had to move off the primary key rather
20667
+ * than be dropped — a detector that cannot recognise its own row re-delivers
20668
+ * every parcel on every boot.
20669
+ *
20670
+ * Absent on every other object event, and on every row written before this
20671
+ * field. Never a substitute for `id`: it is unique per (producer, occasion),
20672
+ * not per row, and nothing addresses a row by it.
20673
+ */
20674
+ idempotencyKey: string().optional(),
20583
20675
  /** Omitted in slim projection. */
20584
20676
  trackId: string().optional(),
20585
20677
  className: string(),
@@ -21682,6 +21774,14 @@ var NativeCropResultSchema = object({
21682
21774
  * set `encodeJpeg: true`; `bytes` is then absent.
21683
21775
  */
21684
21776
  jpeg: string().optional(),
21777
+ /**
21778
+ * The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
21779
+ * `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
21780
+ * `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
21781
+ * `bytes` above has crossed this boundary as a `Uint8Array` all along — so
21782
+ * base64 was buying nothing but a multi-megabyte string in the relay's heap.
21783
+ */
21784
+ jpegBytes: _instanceof(Uint8Array).optional(),
21685
21785
  width: number().int().positive(),
21686
21786
  height: number().int().positive(),
21687
21787
  /**
@@ -21748,7 +21848,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
21748
21848
  })]);
21749
21849
  /** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
21750
21850
  var ParkedTrackFrameSchema = object({
21751
- jpeg: string(),
21851
+ /**
21852
+ * Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
21853
+ * `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
21854
+ * Exactly one of the two is present.
21855
+ */
21856
+ jpeg: string().optional(),
21857
+ /** The same JPEG as bytes, for a caller that declared it reads them (D462). */
21858
+ jpegBytes: _instanceof(Uint8Array).optional(),
21752
21859
  width: number().int().positive(),
21753
21860
  height: number().int().positive(),
21754
21861
  /** The frame instant the parcel shows (the caller's clock, echoed back). */
@@ -22335,6 +22442,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
22335
22442
  bbox: NativeCropBboxSchema,
22336
22443
  maxWidth: number().int().positive().optional(),
22337
22444
  /**
22445
+ * The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
22446
+ * back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
22447
+ * wire — never assume consent: a pre-D462 caller parses the field as
22448
+ * base64 and bytes would decode to garbage rather than fail.
22449
+ */
22450
+ acceptJpegBytes: boolean().optional(),
22451
+ /**
22338
22452
  * When `true`, the runner encodes the resolved crop to JPEG ON THE
22339
22453
  * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
22340
22454
  * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
@@ -22402,7 +22516,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
22402
22516
  }), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
22403
22517
  deviceId: number(),
22404
22518
  trackId: string(),
22405
- kind: ParkedFrameKindSchema
22519
+ kind: ParkedFrameKindSchema,
22520
+ /**
22521
+ * The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
22522
+ * back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
22523
+ * wire — never assume consent: a pre-D462 caller parses the field as
22524
+ * base64 and bytes would decode to garbage rather than fail.
22525
+ */
22526
+ acceptJpegBytes: boolean().optional()
22406
22527
  }), ParkedTrackFrameSchema.nullable()), method(object({
22407
22528
  deviceId: number(),
22408
22529
  trackId: string()
@@ -28800,26 +28921,59 @@ authKey: string().optional() }), object({
28800
28921
  /** Human-readable error when `ok: false`. */
28801
28922
  error: string().optional()
28802
28923
  }), { kind: "mutation" });
28803
- /**
28804
- * Hardware / firmware motion sensor cap — binary detected state plus
28805
- * a timestamp of the last observation. Distinct from
28806
- * `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
28807
- * `motion` is the lightweight readout from on-camera motion (Reolink
28808
- * `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
28809
- *
28810
- * Native-motion providers also fan out to `detection.camera-native`
28811
- * with `source: 'onboard'` so cross-cutting system services
28812
- * (alert-center, advanced-notifier) can subscribe once and receive
28813
- * motion from every camera.
28814
- */
28815
28924
  var MotionStatusSchema = object({
28816
28925
  detected: boolean(),
28817
28926
  /** Ms epoch of the last detected-true observation. Null if never detected. */
28818
28927
  lastDetectedAt: number().nullable(),
28819
28928
  /**
28820
- * Ms after which `detected` auto-reverts to false if no fresh push
28821
- * arrives. Null means the provider leaves detected state until a
28822
- * native "clear" event.
28929
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
28930
+ * `null` while false and on every `Sensor` device (D475) — see that
28931
+ * constant's doc for the one-authority rule.
28932
+ *
28933
+ * ## Reading this field still arms nothing
28934
+ *
28935
+ * It reads like an instruction to the consumer ("revert after N ms if
28936
+ * no fresh push arrives") and it is not one: nothing in this repo reads
28937
+ * the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
28938
+ * close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
28939
+ * imported constant, not as a read of `device.state.motion.value`, so this
28940
+ * field stays what it always was: DESCRIPTIVE output, mirroring an answer
28941
+ * computed elsewhere. Building a self-clear timer out of a READ of this
28942
+ * field would add a second falling-edge authority beside whichever one
28943
+ * already owns the device, and two that can disagree are worse than one.
28944
+ * Consumers that need a falling edge SHAPED differently — held open across
28945
+ * a flapping source — debounce on their own side and say so, as
28946
+ * `addon-export-alexa/src/motion-clear-hold.ts` and
28947
+ * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
28948
+ *
28949
+ * ## Who writes it
28950
+ *
28951
+ * - **Cameras** — the runner's phase machine, `active → watching` on
28952
+ * `cooldown_expired`, which then writes this slice with
28953
+ * `detected: false` (`handlePhaseChanged` in
28954
+ * `pipeline-runner/index.ts`). It produces the FALLING edge, which
28955
+ * matters most for the sources that only ever push a rising one:
28956
+ * Reolink emits `MotionOnMotionChanged { detected: true }` and never
28957
+ * a false.
28958
+ * - **Sensors** (Home Assistant binary sensors, Homematic) — the
28959
+ * provider pushes the false itself, from the upstream system's own
28960
+ * state change. No phase machine is involved.
28961
+ *
28962
+ * ### The phase machine is CANONICAL, not sole — and that is a defect
28963
+ *
28964
+ * An earlier revision of this docblock (mine, 2026-09-12) claimed the
28965
+ * phase machine is the sole writer for a camera. It is not.
28966
+ * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
28967
+ * `setCapSlice(motionCapability, …)` on their own rising edge, and
28968
+ * Hikvision's comment says why: it read THIS docblock, agreed the
28969
+ * runner is canonical, and wrote anyway to avoid per-tick churn. So
28970
+ * two authorities can disagree about one slice, which this repo
28971
+ * forbids, and the doc said otherwise — which is worse than saying
28972
+ * nothing, because it reads as verification.
28973
+ *
28974
+ * This predates D475 and is not fixed there: the fix touches every
28975
+ * camera provider. Recorded in D475's Consequences. Do not restore the
28976
+ * "sole writer" wording without also removing the other writers.
28823
28977
  */
28824
28978
  autoClearAfterMs: number().nullable()
28825
28979
  });
@@ -28889,7 +29043,11 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
28889
29043
  */
28890
29044
  runtimeState: MotionStatusSchema,
28891
29045
  /**
28892
- * Runtime-state durability: **session** — self-clearing by construction (`autoClearAfterMs`); a restored `detected: true` is a frozen event, and the next frame re-publishes the real one.
29046
+ * Runtime-state durability: **session** — every writer of this slice
29047
+ * writes only on an EDGE, so a restored `detected: true` would stay
29048
+ * frozen until the next one instead of being corrected. The next edge
29049
+ * re-publishes the real state. (On who the writers are, and why there
29050
+ * is more than one, see `autoClearAfterMs` above.)
28893
29051
  *
28894
29052
  * See `RuntimeStateDurability`. Enforced by
28895
29053
  * `scripts/check-runtime-state-durability.ts`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-rademacher",
3
- "version": "0.2.95",
3
+ "version": "0.2.97",
4
4
  "description": "Rademacher HomePilot device-provider addon for CamStack — wraps the @apocaliss92/noderademacher local-hub client (roller shutters over the cover cap)",
5
5
  "keywords": [
6
6
  "camstack",