@camstack/addon-pipeline 1.2.224 → 1.2.226

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 (31) hide show
  1. package/dist/audio-analyzer/index.js +2 -2
  2. package/dist/audio-analyzer/index.mjs +2 -2
  3. package/dist/{default-detection-model-BSX8cVHY.mjs → default-detection-model-A2qZmOuO.mjs} +1 -1
  4. package/dist/{default-detection-model-B7kn9xHR.js → default-detection-model-BseJDKpG.js} +1 -1
  5. package/dist/detection-pipeline/index.js +4 -4
  6. package/dist/detection-pipeline/index.mjs +4 -4
  7. package/dist/{dist-DZsjVFey.js → dist-DXilmc1W.js} +177 -9
  8. package/dist/{dist-BNzfbpF6.mjs → dist-InCt3_5U.mjs} +172 -10
  9. package/dist/motion-wasm/index.js +1 -1
  10. package/dist/motion-wasm/index.mjs +1 -1
  11. package/dist/{node-BhQ8dDQC.js → node--Icxw2jo.js} +1 -1
  12. package/dist/{node-uYIx2aZF.mjs → node-B6Wz_gqK.mjs} +1 -1
  13. package/dist/pipeline-runner/index.js +34 -5
  14. package/dist/pipeline-runner/index.mjs +34 -6
  15. package/dist/{process-memory-CkoLpOV-.mjs → process-memory-DnuJjAW1.mjs} +1 -1
  16. package/dist/{process-memory-BozKb5-g.js → process-memory-pGbtKNsw.js} +1 -1
  17. package/dist/recorder/index.js +64 -9
  18. package/dist/recorder/index.mjs +64 -9
  19. package/dist/{segment-demux-js-Dh1dn_AT.mjs → segment-demux-js-CB9SGcWW.mjs} +1 -1
  20. package/dist/{segment-demux-js-Cvszh55p.js → segment-demux-js-jnT5YAxt.js} +1 -1
  21. package/dist/stream-broker/_stub.js +1 -1
  22. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-BZG3prqU.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-D2AmFf2m.mjs} +3 -3
  23. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-gz4b6miC.mjs +26 -0
  24. package/dist/stream-broker/demux-worker-child.js +1 -1
  25. package/dist/stream-broker/demux-worker-child.mjs +1 -1
  26. package/dist/stream-broker/{hostInit-Cyo0CFo3.mjs → hostInit-Bs7yHPfB.mjs} +3 -3
  27. package/dist/stream-broker/index.js +3 -3
  28. package/dist/stream-broker/index.mjs +3 -3
  29. package/dist/stream-broker/remoteEntry.js +1 -1
  30. package/package.json +2 -2
  31. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CyMYDKfM.mjs +0 -26
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../chunk-emK7D4bc.js");
6
- const require_dist = require("../dist-DZsjVFey.js");
7
- const require_process_memory = require("../process-memory-BozKb5-g.js");
6
+ const require_dist = require("../dist-DXilmc1W.js");
7
+ const require_process_memory = require("../process-memory-pGbtKNsw.js");
8
8
  let node_fs = require("node:fs");
9
9
  node_fs = require_chunk.__toESM(node_fs);
10
10
  let node_path = require("node:path");
@@ -1,6 +1,6 @@
1
1
  import { n as __require } from "../chunk-DnnnRqeS.mjs";
2
- import { C as PoolMemoryWatchdog, Jt as audioChunkBytesPerSample, Lt as errMsg, M as audioAnalysisCapability, N as audioAnalyzerCapability, Ot as resolvePoolMemoryPolicy, Wt as BaseAddon, Xt as expandAudioChunkToF32le, Zt as hydrateSchema, n as AUDIO_BACKEND_CHOICES, s as DEFAULT_AUDIO_ANALYZER_CONFIG, st as mapAudioLabelToMacro, tn as nodePin, vn as EventCategory, y as HF_BASE_URL } from "../dist-BNzfbpF6.mjs";
3
- import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-CkoLpOV-.mjs";
2
+ import { Gt as BaseAddon, N as audioAnalysisCapability, P as audioAnalyzerCapability, Qt as hydrateSchema, Rt as errMsg, Yt as audioChunkBytesPerSample, Zt as expandAudioChunkToF32le, ct as mapAudioLabelToMacro, kt as resolvePoolMemoryPolicy, n as AUDIO_BACKEND_CHOICES, nn as nodePin, s as DEFAULT_AUDIO_ANALYZER_CONFIG, w as PoolMemoryWatchdog, y as HF_BASE_URL, yn as EventCategory } from "../dist-InCt3_5U.mjs";
3
+ import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-DnuJjAW1.mjs";
4
4
  import * as fs from "node:fs";
5
5
  import * as path$1 from "node:path";
6
6
  import { downloadFile } from "@camstack/system/addon-utils";
@@ -1,4 +1,4 @@
1
- import { P as audioKindId, a as COCO_80_LABELS, nt as hfModelUrl, o as COCO_TO_MACRO, r as AUDIO_MACRO_LABELS } from "./dist-BNzfbpF6.mjs";
1
+ import { F as audioKindId, a as COCO_80_LABELS, o as COCO_TO_MACRO, r as AUDIO_MACRO_LABELS, rt as hfModelUrl } from "./dist-InCt3_5U.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  //#region src/detection-pipeline/pipeline/landmark-precision-gate.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-DZsjVFey.js");
1
+ const require_dist = require("./dist-DXilmc1W.js");
2
2
  let node_crypto = require("node:crypto");
3
3
  //#region src/detection-pipeline/pipeline/landmark-precision-gate.ts
4
4
  /**
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../chunk-emK7D4bc.js");
6
- const require_dist = require("../dist-DZsjVFey.js");
7
- const require_node = require("../node-BhQ8dDQC.js");
8
- const require_default_detection_model = require("../default-detection-model-B7kn9xHR.js");
6
+ const require_dist = require("../dist-DXilmc1W.js");
7
+ const require_node = require("../node--Icxw2jo.js");
8
+ const require_default_detection_model = require("../default-detection-model-BseJDKpG.js");
9
9
  const require_lazy_sharp = require("../lazy-sharp-BuwKlQLR.js");
10
- const require_process_memory = require("../process-memory-BozKb5-g.js");
10
+ const require_process_memory = require("../process-memory-pGbtKNsw.js");
11
11
  let node_os = require("node:os");
12
12
  node_os = require_chunk.__toESM(node_os);
13
13
  let node_fs = require("node:fs");
@@ -1,9 +1,9 @@
1
1
  import { n as __require } from "../chunk-DnnnRqeS.mjs";
2
- import { A as YAMNET_TO_MACRO, At as runtimeDevices$1, C as PoolMemoryWatchdog, Ft as supportedRuntimes$1, K as detectionPipelineCapability, Lt as errMsg, Ot as resolvePoolMemoryPolicy, Tt as resolveClusterStepModelId, V as defaultDeviceFor$1, Wt as BaseAddon, Y as enumerateInferenceDevices, Yt as createEvent, Z as evaluateZoneRules, Zt as hydrateSchema, _n as union, _t as pickClusterStepSettings, an as sleep, at as loadContributionCapability, bt as pipelineExecutorCapability, c as DEFAULT_CLUSTER_STEP_MODELS, gn as string, gt as pickClusterStepModels, l as DEFAULT_CLUSTER_STEP_SETTINGS, m as DEVICE_BACKEND_TO_FORMAT, mt as overlayClusterStepSettings, nn as parseJsonUnknown, pn as object, rt as inferModelProvider, sn as array, t as APPLE_SA_TO_MACRO, tn as nodePin, vn as EventCategory } from "../dist-BNzfbpF6.mjs";
3
- import { o as readProcessCost } from "../node-uYIx2aZF.mjs";
4
- import { a as ALL_PIPELINE_STEPS, c as getStep, d as landmarkPrecisionVerdict, l as getStepDefinition, n as resolveDefaultDetectionModel, o as ALL_STEPS, r as localFrameRegistry, s as getDefaultModelForFormat, u as resolveModelForFormat } from "../default-detection-model-BSX8cVHY.mjs";
2
+ import { Et as resolveClusterStepModelId, Gt as BaseAddon, H as defaultDeviceFor$1, It as supportedRuntimes$1, Q as evaluateZoneRules, Qt as hydrateSchema, Rt as errMsg, X as enumerateInferenceDevices, Xt as createEvent, _n as string, _t as pickClusterStepModels, c as DEFAULT_CLUSTER_STEP_MODELS, cn as array, ht as overlayClusterStepSettings, it as inferModelProvider, j as YAMNET_TO_MACRO, jt as runtimeDevices$1, kt as resolvePoolMemoryPolicy, l as DEFAULT_CLUSTER_STEP_SETTINGS, m as DEVICE_BACKEND_TO_FORMAT, mn as object, nn as nodePin, on as sleep, ot as loadContributionCapability, q as detectionPipelineCapability, rn as parseJsonUnknown, t as APPLE_SA_TO_MACRO, vn as union, vt as pickClusterStepSettings, w as PoolMemoryWatchdog, xt as pipelineExecutorCapability, yn as EventCategory } from "../dist-InCt3_5U.mjs";
3
+ import { o as readProcessCost } from "../node-B6Wz_gqK.mjs";
4
+ import { a as ALL_PIPELINE_STEPS, c as getStep, d as landmarkPrecisionVerdict, l as getStepDefinition, n as resolveDefaultDetectionModel, o as ALL_STEPS, r as localFrameRegistry, s as getDefaultModelForFormat, u as resolveModelForFormat } from "../default-detection-model-A2qZmOuO.mjs";
5
5
  import { t as getSharp } from "../lazy-sharp-DXsqwpph.mjs";
6
- import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-CkoLpOV-.mjs";
6
+ import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-DnuJjAW1.mjs";
7
7
  import * as os from "node:os";
8
8
  import * as fs from "node:fs";
9
9
  import * as path$1 from "node:path";
@@ -8161,6 +8161,23 @@ function errMsg(err) {
8161
8161
  if (typeof err === "string") return err;
8162
8162
  return String(err);
8163
8163
  }
8164
+ new Set([
8165
+ "track",
8166
+ "summary",
8167
+ "face",
8168
+ "identity",
8169
+ "plate",
8170
+ "vehicle",
8171
+ "scene",
8172
+ "motion",
8173
+ "object",
8174
+ "audio"
8175
+ ]);
8176
+ new Set([
8177
+ "motion",
8178
+ "object",
8179
+ "audio"
8180
+ ]);
8164
8181
  var EncodeProfileSchema = object({
8165
8182
  video: object({
8166
8183
  codec: _enum([
@@ -14550,8 +14567,17 @@ method(object({
14550
14567
  }), array(SettingsRecordSchema).readonly()), method(object({
14551
14568
  namespace: string().optional(),
14552
14569
  collection: string(),
14553
- record: SettingsRecordSchema
14554
- }), _void(), { kind: "mutation" }), method(object({
14570
+ record: object({
14571
+ id: string().optional(),
14572
+ data: record(string(), unknown())
14573
+ })
14574
+ }), object({
14575
+ /**
14576
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
14577
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
14578
+ * primary key — which is the only place an auto key is knowable.
14579
+ */
14580
+ id: union([string(), number()]) }), { kind: "mutation" }), method(object({
14555
14581
  namespace: string().optional(),
14556
14582
  collection: string(),
14557
14583
  records: array(BulkRecordSchema).readonly()
@@ -14660,8 +14686,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
14660
14686
  }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
14661
14687
  namespace: string().optional(),
14662
14688
  collection: string(),
14663
- record: SettingsRecordSchema
14664
- }), _void(), {
14689
+ record: object({
14690
+ id: string().optional(),
14691
+ data: record(string(), unknown())
14692
+ })
14693
+ }), object({
14694
+ /**
14695
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
14696
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
14697
+ * primary key — which is the only place an auto key is knowable.
14698
+ */
14699
+ id: union([string(), number()]) }), {
14665
14700
  kind: "mutation",
14666
14701
  auth: "admin"
14667
14702
  }), method(object({
@@ -21915,7 +21950,20 @@ var TrackSchema = object({
21915
21950
  ...TrackRetrainFields
21916
21951
  });
21917
21952
  var BaseEventFields = {
21918
- id: string(),
21953
+ /**
21954
+ * A SQLite ROWID, assigned by the database (D474).
21955
+ *
21956
+ * Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
21957
+ * TWICE per row, in the row and in the primary-key index, across 2.1 million
21958
+ * motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
21959
+ * the rowid: the table itself is that B-tree, so the index stops existing
21960
+ * rather than getting smaller. No shorter string does that.
21961
+ *
21962
+ * Defined once here for all three event kinds, which is why they move
21963
+ * together: a per-table migration would have forked this and
21964
+ * `COMMON_BASE_COLUMNS` and reunited them two stages later.
21965
+ */
21966
+ id: number().int(),
21919
21967
  deviceId: number(),
21920
21968
  timestamp: number()
21921
21969
  };
@@ -21934,7 +21982,34 @@ var MotionEventSchema = object({
21934
21982
  /** Omitted in slim projection. */
21935
21983
  frameHeight: number().optional(),
21936
21984
  /** Populated by B5 (recording playback URL for this event). */
21937
- mediaUrl: string().optional()
21985
+ mediaUrl: string().optional(),
21986
+ /**
21987
+ * One row per motion EPISODE, not one per push (D475). `null` while the
21988
+ * episode is still open — a further rising edge extends it in place rather
21989
+ * than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
21990
+ * (the span from the first rising edge to the LAST one, deliberately NOT
21991
+ * `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
21992
+ * movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
21993
+ * motion for an instantaneous trigger).
21994
+ *
21995
+ * **Absent** (not merely `null`) on a row written before D475 — that means
21996
+ * "closed the old way, before this column existed", never "still open".
21997
+ * Nothing in this codebase may read an absent `durationMs` as an open
21998
+ * episode; only `null` means open.
21999
+ */
22000
+ durationMs: number().nullable().optional(),
22001
+ /**
22002
+ * Ms offsets from `timestamp` (the episode's own first rising edge, so the
22003
+ * first entry is always `0`) of every genuine off→on transition the
22004
+ * episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
22005
+ * push: a firmware source that keepalives at ~1 Hz for the whole burst
22006
+ * (Reolink, Hikvision) produces exactly one edge; a source that reports an
22007
+ * explicit `false` mid-episode and then resumes before the quiet window
22008
+ * elapses produces another. Stored compactly — see `motion-edge-codec.ts`
22009
+ * — and decoded back to this shape on read. Absent/empty on a legacy row,
22010
+ * which must never be read as "no episode happened here".
22011
+ */
22012
+ edges: array(number()).readonly().optional()
21938
22013
  });
21939
22014
  /**
21940
22015
  * Which detection SOURCE produced an object event. `pipeline` = the ML
@@ -21989,6 +22064,23 @@ var ObjectEventSchema = object({
21989
22064
  * includes it (it is light). Absent on rows written before this field.
21990
22065
  */
21991
22066
  frameId: string().optional(),
22067
+ /**
22068
+ * A PRODUCER-chosen key that makes a synthetic event's emission idempotent
22069
+ * (D474).
22070
+ *
22071
+ * Only the package detector writes it, and it exists because the event id
22072
+ * stopped being choosable: the delivery and pick-up rows used to BE their
22073
+ * dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
22074
+ * second delivery for this entry" survived a restart. An `INTEGER` rowid is
22075
+ * assigned by SQLite, so that key had to move off the primary key rather
22076
+ * than be dropped — a detector that cannot recognise its own row re-delivers
22077
+ * every parcel on every boot.
22078
+ *
22079
+ * Absent on every other object event, and on every row written before this
22080
+ * field. Never a substitute for `id`: it is unique per (producer, occasion),
22081
+ * not per row, and nothing addresses a row by it.
22082
+ */
22083
+ idempotencyKey: string().optional(),
21992
22084
  /** Omitted in slim projection. */
21993
22085
  trackId: string().optional(),
21994
22086
  className: string(),
@@ -29415,14 +29507,84 @@ authKey: string().optional() }), object({
29415
29507
  /** Human-readable error when `ok: false`. */
29416
29508
  error: string().optional()
29417
29509
  }), { kind: "mutation" });
29510
+ /**
29511
+ * Hardware / firmware motion sensor cap — binary detected state plus
29512
+ * a timestamp of the last observation. Distinct from
29513
+ * `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
29514
+ * `motion` is the lightweight readout from on-camera motion (Reolink
29515
+ * `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
29516
+ *
29517
+ * Native-motion providers also fan out to `detection.camera-native`
29518
+ * with `source: 'onboard'` so cross-cutting system services
29519
+ * (alert-center, advanced-notifier) can subscribe once and receive
29520
+ * motion from every camera.
29521
+ */
29522
+ /**
29523
+ * How long after a camera's last rising edge `pipeline-analytics` closes the
29524
+ * motion EPISODE row it kept open for it (D475) — "il delay della cap", in
29525
+ * the operator's words. One authority for the whole system: every provider
29526
+ * that seeds `autoClearAfterMs` on a `Camera` device writes this SAME
29527
+ * constant while `detected: true` (never its own number — Hikvision used to
29528
+ * seed its internal 3 s inactivity timer here, which is a different clock for
29529
+ * a different purpose), and `MotionEpisodeTracker` imports it directly rather
29530
+ * than reading the live cap value on the hot path. A `Sensor` device (HA
29531
+ * binary sensor, Homematic) gets a genuine push both ways and has no episode
29532
+ * to close on a timer, so it writes `null`, never this constant.
29533
+ */
29534
+ var MOTION_CLOSE_AFTER_MS = 15e3;
29418
29535
  object({
29419
29536
  detected: boolean(),
29420
29537
  /** Ms epoch of the last detected-true observation. Null if never detected. */
29421
29538
  lastDetectedAt: number().nullable(),
29422
29539
  /**
29423
- * Ms after which `detected` auto-reverts to false if no fresh push
29424
- * arrives. Null means the provider leaves detected state until a
29425
- * native "clear" event.
29540
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
29541
+ * `null` while false and on every `Sensor` device (D475) — see that
29542
+ * constant's doc for the one-authority rule.
29543
+ *
29544
+ * ## Reading this field still arms nothing
29545
+ *
29546
+ * It reads like an instruction to the consumer ("revert after N ms if
29547
+ * no fresh push arrives") and it is not one: nothing in this repo reads
29548
+ * the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
29549
+ * close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
29550
+ * imported constant, not as a read of `device.state.motion.value`, so this
29551
+ * field stays what it always was: DESCRIPTIVE output, mirroring an answer
29552
+ * computed elsewhere. Building a self-clear timer out of a READ of this
29553
+ * field would add a second falling-edge authority beside whichever one
29554
+ * already owns the device, and two that can disagree are worse than one.
29555
+ * Consumers that need a falling edge SHAPED differently — held open across
29556
+ * a flapping source — debounce on their own side and say so, as
29557
+ * `addon-export-alexa/src/motion-clear-hold.ts` and
29558
+ * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
29559
+ *
29560
+ * ## Who writes it
29561
+ *
29562
+ * - **Cameras** — the runner's phase machine, `active → watching` on
29563
+ * `cooldown_expired`, which then writes this slice with
29564
+ * `detected: false` (`handlePhaseChanged` in
29565
+ * `pipeline-runner/index.ts`). It produces the FALLING edge, which
29566
+ * matters most for the sources that only ever push a rising one:
29567
+ * Reolink emits `MotionOnMotionChanged { detected: true }` and never
29568
+ * a false.
29569
+ * - **Sensors** (Home Assistant binary sensors, Homematic) — the
29570
+ * provider pushes the false itself, from the upstream system's own
29571
+ * state change. No phase machine is involved.
29572
+ *
29573
+ * ### The phase machine is CANONICAL, not sole — and that is a defect
29574
+ *
29575
+ * An earlier revision of this docblock (mine, 2026-09-12) claimed the
29576
+ * phase machine is the sole writer for a camera. It is not.
29577
+ * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
29578
+ * `setCapSlice(motionCapability, …)` on their own rising edge, and
29579
+ * Hikvision's comment says why: it read THIS docblock, agreed the
29580
+ * runner is canonical, and wrote anyway to avoid per-tick churn. So
29581
+ * two authorities can disagree about one slice, which this repo
29582
+ * forbids, and the doc said otherwise — which is worse than saying
29583
+ * nothing, because it reads as verification.
29584
+ *
29585
+ * This predates D475 and is not fixed there: the fix touches every
29586
+ * camera provider. Recorded in D475's Consequences. Do not restore the
29587
+ * "sole writer" wording without also removing the other writers.
29426
29588
  */
29427
29589
  autoClearAfterMs: number().nullable()
29428
29590
  });
@@ -43776,6 +43938,12 @@ Object.defineProperty(exports, "HF_BASE_URL", {
43776
43938
  return HF_BASE_URL;
43777
43939
  }
43778
43940
  });
43941
+ Object.defineProperty(exports, "MOTION_CLOSE_AFTER_MS", {
43942
+ enumerable: true,
43943
+ get: function() {
43944
+ return MOTION_CLOSE_AFTER_MS;
43945
+ }
43946
+ });
43779
43947
  Object.defineProperty(exports, "NativeLeaseAdmissionSchema", {
43780
43948
  enumerable: true,
43781
43949
  get: function() {
@@ -8161,6 +8161,23 @@ function errMsg(err) {
8161
8161
  if (typeof err === "string") return err;
8162
8162
  return String(err);
8163
8163
  }
8164
+ new Set([
8165
+ "track",
8166
+ "summary",
8167
+ "face",
8168
+ "identity",
8169
+ "plate",
8170
+ "vehicle",
8171
+ "scene",
8172
+ "motion",
8173
+ "object",
8174
+ "audio"
8175
+ ]);
8176
+ new Set([
8177
+ "motion",
8178
+ "object",
8179
+ "audio"
8180
+ ]);
8164
8181
  var EncodeProfileSchema = object({
8165
8182
  video: object({
8166
8183
  codec: _enum([
@@ -14550,8 +14567,17 @@ method(object({
14550
14567
  }), array(SettingsRecordSchema).readonly()), method(object({
14551
14568
  namespace: string().optional(),
14552
14569
  collection: string(),
14553
- record: SettingsRecordSchema
14554
- }), _void(), { kind: "mutation" }), method(object({
14570
+ record: object({
14571
+ id: string().optional(),
14572
+ data: record(string(), unknown())
14573
+ })
14574
+ }), object({
14575
+ /**
14576
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
14577
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
14578
+ * primary key — which is the only place an auto key is knowable.
14579
+ */
14580
+ id: union([string(), number()]) }), { kind: "mutation" }), method(object({
14555
14581
  namespace: string().optional(),
14556
14582
  collection: string(),
14557
14583
  records: array(BulkRecordSchema).readonly()
@@ -14660,8 +14686,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
14660
14686
  }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
14661
14687
  namespace: string().optional(),
14662
14688
  collection: string(),
14663
- record: SettingsRecordSchema
14664
- }), _void(), {
14689
+ record: object({
14690
+ id: string().optional(),
14691
+ data: record(string(), unknown())
14692
+ })
14693
+ }), object({
14694
+ /**
14695
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
14696
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
14697
+ * primary key — which is the only place an auto key is knowable.
14698
+ */
14699
+ id: union([string(), number()]) }), {
14665
14700
  kind: "mutation",
14666
14701
  auth: "admin"
14667
14702
  }), method(object({
@@ -21915,7 +21950,20 @@ var TrackSchema = object({
21915
21950
  ...TrackRetrainFields
21916
21951
  });
21917
21952
  var BaseEventFields = {
21918
- id: string(),
21953
+ /**
21954
+ * A SQLite ROWID, assigned by the database (D474).
21955
+ *
21956
+ * Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
21957
+ * TWICE per row, in the row and in the primary-key index, across 2.1 million
21958
+ * motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
21959
+ * the rowid: the table itself is that B-tree, so the index stops existing
21960
+ * rather than getting smaller. No shorter string does that.
21961
+ *
21962
+ * Defined once here for all three event kinds, which is why they move
21963
+ * together: a per-table migration would have forked this and
21964
+ * `COMMON_BASE_COLUMNS` and reunited them two stages later.
21965
+ */
21966
+ id: number().int(),
21919
21967
  deviceId: number(),
21920
21968
  timestamp: number()
21921
21969
  };
@@ -21934,7 +21982,34 @@ var MotionEventSchema = object({
21934
21982
  /** Omitted in slim projection. */
21935
21983
  frameHeight: number().optional(),
21936
21984
  /** Populated by B5 (recording playback URL for this event). */
21937
- mediaUrl: string().optional()
21985
+ mediaUrl: string().optional(),
21986
+ /**
21987
+ * One row per motion EPISODE, not one per push (D475). `null` while the
21988
+ * episode is still open — a further rising edge extends it in place rather
21989
+ * than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
21990
+ * (the span from the first rising edge to the LAST one, deliberately NOT
21991
+ * `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
21992
+ * movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
21993
+ * motion for an instantaneous trigger).
21994
+ *
21995
+ * **Absent** (not merely `null`) on a row written before D475 — that means
21996
+ * "closed the old way, before this column existed", never "still open".
21997
+ * Nothing in this codebase may read an absent `durationMs` as an open
21998
+ * episode; only `null` means open.
21999
+ */
22000
+ durationMs: number().nullable().optional(),
22001
+ /**
22002
+ * Ms offsets from `timestamp` (the episode's own first rising edge, so the
22003
+ * first entry is always `0`) of every genuine off→on transition the
22004
+ * episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
22005
+ * push: a firmware source that keepalives at ~1 Hz for the whole burst
22006
+ * (Reolink, Hikvision) produces exactly one edge; a source that reports an
22007
+ * explicit `false` mid-episode and then resumes before the quiet window
22008
+ * elapses produces another. Stored compactly — see `motion-edge-codec.ts`
22009
+ * — and decoded back to this shape on read. Absent/empty on a legacy row,
22010
+ * which must never be read as "no episode happened here".
22011
+ */
22012
+ edges: array(number()).readonly().optional()
21938
22013
  });
21939
22014
  /**
21940
22015
  * Which detection SOURCE produced an object event. `pipeline` = the ML
@@ -21989,6 +22064,23 @@ var ObjectEventSchema = object({
21989
22064
  * includes it (it is light). Absent on rows written before this field.
21990
22065
  */
21991
22066
  frameId: string().optional(),
22067
+ /**
22068
+ * A PRODUCER-chosen key that makes a synthetic event's emission idempotent
22069
+ * (D474).
22070
+ *
22071
+ * Only the package detector writes it, and it exists because the event id
22072
+ * stopped being choosable: the delivery and pick-up rows used to BE their
22073
+ * dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
22074
+ * second delivery for this entry" survived a restart. An `INTEGER` rowid is
22075
+ * assigned by SQLite, so that key had to move off the primary key rather
22076
+ * than be dropped — a detector that cannot recognise its own row re-delivers
22077
+ * every parcel on every boot.
22078
+ *
22079
+ * Absent on every other object event, and on every row written before this
22080
+ * field. Never a substitute for `id`: it is unique per (producer, occasion),
22081
+ * not per row, and nothing addresses a row by it.
22082
+ */
22083
+ idempotencyKey: string().optional(),
21992
22084
  /** Omitted in slim projection. */
21993
22085
  trackId: string().optional(),
21994
22086
  className: string(),
@@ -29415,14 +29507,84 @@ authKey: string().optional() }), object({
29415
29507
  /** Human-readable error when `ok: false`. */
29416
29508
  error: string().optional()
29417
29509
  }), { kind: "mutation" });
29510
+ /**
29511
+ * Hardware / firmware motion sensor cap — binary detected state plus
29512
+ * a timestamp of the last observation. Distinct from
29513
+ * `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
29514
+ * `motion` is the lightweight readout from on-camera motion (Reolink
29515
+ * `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
29516
+ *
29517
+ * Native-motion providers also fan out to `detection.camera-native`
29518
+ * with `source: 'onboard'` so cross-cutting system services
29519
+ * (alert-center, advanced-notifier) can subscribe once and receive
29520
+ * motion from every camera.
29521
+ */
29522
+ /**
29523
+ * How long after a camera's last rising edge `pipeline-analytics` closes the
29524
+ * motion EPISODE row it kept open for it (D475) — "il delay della cap", in
29525
+ * the operator's words. One authority for the whole system: every provider
29526
+ * that seeds `autoClearAfterMs` on a `Camera` device writes this SAME
29527
+ * constant while `detected: true` (never its own number — Hikvision used to
29528
+ * seed its internal 3 s inactivity timer here, which is a different clock for
29529
+ * a different purpose), and `MotionEpisodeTracker` imports it directly rather
29530
+ * than reading the live cap value on the hot path. A `Sensor` device (HA
29531
+ * binary sensor, Homematic) gets a genuine push both ways and has no episode
29532
+ * to close on a timer, so it writes `null`, never this constant.
29533
+ */
29534
+ var MOTION_CLOSE_AFTER_MS = 15e3;
29418
29535
  object({
29419
29536
  detected: boolean(),
29420
29537
  /** Ms epoch of the last detected-true observation. Null if never detected. */
29421
29538
  lastDetectedAt: number().nullable(),
29422
29539
  /**
29423
- * Ms after which `detected` auto-reverts to false if no fresh push
29424
- * arrives. Null means the provider leaves detected state until a
29425
- * native "clear" event.
29540
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
29541
+ * `null` while false and on every `Sensor` device (D475) — see that
29542
+ * constant's doc for the one-authority rule.
29543
+ *
29544
+ * ## Reading this field still arms nothing
29545
+ *
29546
+ * It reads like an instruction to the consumer ("revert after N ms if
29547
+ * no fresh push arrives") and it is not one: nothing in this repo reads
29548
+ * the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
29549
+ * close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
29550
+ * imported constant, not as a read of `device.state.motion.value`, so this
29551
+ * field stays what it always was: DESCRIPTIVE output, mirroring an answer
29552
+ * computed elsewhere. Building a self-clear timer out of a READ of this
29553
+ * field would add a second falling-edge authority beside whichever one
29554
+ * already owns the device, and two that can disagree are worse than one.
29555
+ * Consumers that need a falling edge SHAPED differently — held open across
29556
+ * a flapping source — debounce on their own side and say so, as
29557
+ * `addon-export-alexa/src/motion-clear-hold.ts` and
29558
+ * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
29559
+ *
29560
+ * ## Who writes it
29561
+ *
29562
+ * - **Cameras** — the runner's phase machine, `active → watching` on
29563
+ * `cooldown_expired`, which then writes this slice with
29564
+ * `detected: false` (`handlePhaseChanged` in
29565
+ * `pipeline-runner/index.ts`). It produces the FALLING edge, which
29566
+ * matters most for the sources that only ever push a rising one:
29567
+ * Reolink emits `MotionOnMotionChanged { detected: true }` and never
29568
+ * a false.
29569
+ * - **Sensors** (Home Assistant binary sensors, Homematic) — the
29570
+ * provider pushes the false itself, from the upstream system's own
29571
+ * state change. No phase machine is involved.
29572
+ *
29573
+ * ### The phase machine is CANONICAL, not sole — and that is a defect
29574
+ *
29575
+ * An earlier revision of this docblock (mine, 2026-09-12) claimed the
29576
+ * phase machine is the sole writer for a camera. It is not.
29577
+ * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
29578
+ * `setCapSlice(motionCapability, …)` on their own rising edge, and
29579
+ * Hikvision's comment says why: it read THIS docblock, agreed the
29580
+ * runner is canonical, and wrote anyway to avoid per-tick churn. So
29581
+ * two authorities can disagree about one slice, which this repo
29582
+ * forbids, and the doc said otherwise — which is worse than saying
29583
+ * nothing, because it reads as verification.
29584
+ *
29585
+ * This predates D475 and is not fixed there: the fix touches every
29586
+ * camera provider. Recorded in D475's Consequences. Do not restore the
29587
+ * "sole writer" wording without also removing the other writers.
29426
29588
  */
29427
29589
  autoClearAfterMs: number().nullable()
29428
29590
  });
@@ -43614,4 +43776,4 @@ function enumerateInferenceDevices(hw) {
43614
43776
  return out;
43615
43777
  }
43616
43778
  //#endregion
43617
- export { evictionPolicyOfLocation as $, makeProfileBrokerId as $t, YAMNET_TO_MACRO as A, runtimeDevices as At, declareLogChannel as B, buildFfmpegArgs as Bt, PoolMemoryWatchdog as C, recordingExportCapability as Ct, RecordingConfigSchema as D, resolveLocationMode as Dt, RECORDING_EXPORT_MAX_READ_BYTES as E, resolveEgressDecodeHwAccel as Et, batteryCapability as F, supportedRuntimes as Ft, deriveRecordingMode as G, CAM_PROFILE_ORDER as Gt, defineCustomActions as H, isSoftwareDecode as Ht, cameraStreamsCapability as I, webrtcSessionCapability as It, egressTransportFromRequest as J, audioChunkBytesPerSample as Jt, detectionPipelineCapability as K, DeviceFeature as Kt, createHwAccelCache as L, errMsg as Lt, audioAnalysisCapability as M, storageOccupancyCapability as Mt, audioAnalyzerCapability as N, streamBrokerCapability as Nt, RecordingSignalStatusSchema as O, resolvePoolMemoryPolicy as Ot, audioKindId as P, stripRetiredBandPreBufferSec as Pt, evictionPolicyForMode as Q, isEvent as Qt, createLogChannelsProvider as R, AUDIO_PRESETS as Rt, OpsLogEntrySchema as S, recordingCapability as St, RATE_CONTROL_TIGHT as T, resolveClusterStepModelId as Tt, deriveBatteryPresence as U, BOOT_RECOVERY_BACKOFF_MS as Ut, defaultDeviceFor as V, invocationFromEncodeProfile as Vt, deriveDetailCropRect as W, BaseAddon as Wt, evaluateSensorEdge as X, expandAudioChunkToF32le as Xt, enumerateInferenceDevices as Y, createEvent as Yt, evaluateZoneRules as Z, hydrateSchema as Zt, FailureCounters as _, union as _n, pickClusterStepSettings as _t, COCO_80_LABELS as a, sleep as an, loadContributionCapability as at, NativeLeaseAdmissionSchema as b, pipelineExecutorCapability as bt, DEFAULT_CLUSTER_STEP_MODELS as c, boolean as cn, maskUrlCredentials as ct, DEFAULT_EVENTS_BAND_BUFFER_SEC as d, literal as dn, migrateLegacyDeviceSignalConfig as dt, makeSourceBrokerId as en, failureContributionCapability as et, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS as f, number as fn, modeMayWrite as ft, ExportRecordSchema as g, string as gn, pickClusterStepModels as gt, EncodeProfileSchema as h, record as hn, parseProcStatus as ht, BatteryStatusSchema as i, selectAssignedProfileSlots as in, isFirstLevelMacroClass as it, addonWidgetsSourceCapability as j, storageEvictableCapability as jt, RingBuffer as k, resolveRecordingProfiles as kt, DEFAULT_CLUSTER_STEP_SETTINGS as l, discriminatedUnion as ln, mayReadLocation as lt, DEVICE_BACKEND_TO_FORMAT as m, preprocess as mn, overlayClusterStepSettings as mt, AUDIO_BACKEND_CHOICES as n, parseJsonUnknown as nn, hfModelUrl as nt, COCO_TO_MACRO as o, _enum as on, logChannelsCapability as ot, DEFAULT_NATIVE_LEASE_SETTINGS as p, object as pn, motionDetectionCapability as pt, egressTranscodeSharingKey as q, DeviceType as qt, AUDIO_MACRO_LABELS as r, parseProfileBrokerId as rn, inferModelProvider as rt, DEFAULT_AUDIO_ANALYZER_CONFIG as s, array as sn, mapAudioLabelToMacro as st, APPLE_SA_TO_MACRO as t, nodePin as tn, gbToBytes as tt, DEFAULT_DETAIL_CROP_CONVENTION as u, lazy as un, mayWriteToLocation as ut, G711_SCALE_CORRECTION_DB as v, EventCategory as vn, pickDetailCropConvention as vt, RATE_CONTROL_RELAXED as w, recordingSignalCapability as wt, NativeLeaseSettingsSchema as x, pipelineRunnerCapability as xt, HF_BASE_URL as y, pickNativeLeaseOverride as yt, customAction as z, Fmp4BoxSplitter as zt };
43779
+ export { evictionPolicyForMode as $, isEvent as $t, RingBuffer as A, resolveRecordingProfiles as At, customAction as B, Fmp4BoxSplitter as Bt, OpsLogEntrySchema as C, recordingCapability as Ct, RECORDING_EXPORT_MAX_READ_BYTES as D, resolveEgressDecodeHwAccel as Dt, RATE_CONTROL_TIGHT as E, resolveClusterStepModelId as Et, audioKindId as F, stripRetiredBandPreBufferSec as Ft, deriveDetailCropRect as G, BaseAddon as Gt, defaultDeviceFor as H, invocationFromEncodeProfile as Ht, batteryCapability as I, supportedRuntimes as It, egressTranscodeSharingKey as J, DeviceType as Jt, deriveRecordingMode as K, CAM_PROFILE_ORDER as Kt, cameraStreamsCapability as L, webrtcSessionCapability as Lt, addonWidgetsSourceCapability as M, storageEvictableCapability as Mt, audioAnalysisCapability as N, storageOccupancyCapability as Nt, RecordingConfigSchema as O, resolveLocationMode as Ot, audioAnalyzerCapability as P, streamBrokerCapability as Pt, evaluateZoneRules as Q, hydrateSchema as Qt, createHwAccelCache as R, errMsg as Rt, NativeLeaseSettingsSchema as S, pipelineRunnerCapability as St, RATE_CONTROL_RELAXED as T, recordingSignalCapability as Tt, defineCustomActions as U, isSoftwareDecode as Ut, declareLogChannel as V, buildFfmpegArgs as Vt, deriveBatteryPresence as W, BOOT_RECOVERY_BACKOFF_MS as Wt, enumerateInferenceDevices as X, createEvent as Xt, egressTransportFromRequest as Y, audioChunkBytesPerSample as Yt, evaluateSensorEdge as Z, expandAudioChunkToF32le as Zt, FailureCounters as _, string as _n, pickClusterStepModels as _t, COCO_80_LABELS as a, selectAssignedProfileSlots as an, isFirstLevelMacroClass as at, MOTION_CLOSE_AFTER_MS as b, pickNativeLeaseOverride as bt, DEFAULT_CLUSTER_STEP_MODELS as c, array as cn, mapAudioLabelToMacro as ct, DEFAULT_EVENTS_BAND_BUFFER_SEC as d, lazy as dn, mayWriteToLocation as dt, makeProfileBrokerId as en, evictionPolicyOfLocation as et, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS as f, literal as fn, migrateLegacyDeviceSignalConfig as ft, ExportRecordSchema as g, record as gn, parseProcStatus as gt, EncodeProfileSchema as h, preprocess as hn, overlayClusterStepSettings as ht, BatteryStatusSchema as i, parseProfileBrokerId as in, inferModelProvider as it, YAMNET_TO_MACRO as j, runtimeDevices as jt, RecordingSignalStatusSchema as k, resolvePoolMemoryPolicy as kt, DEFAULT_CLUSTER_STEP_SETTINGS as l, boolean as ln, maskUrlCredentials as lt, DEVICE_BACKEND_TO_FORMAT as m, object as mn, motionDetectionCapability as mt, AUDIO_BACKEND_CHOICES as n, nodePin as nn, gbToBytes as nt, COCO_TO_MACRO as o, sleep as on, loadContributionCapability as ot, DEFAULT_NATIVE_LEASE_SETTINGS as p, number as pn, modeMayWrite as pt, detectionPipelineCapability as q, DeviceFeature as qt, AUDIO_MACRO_LABELS as r, parseJsonUnknown as rn, hfModelUrl as rt, DEFAULT_AUDIO_ANALYZER_CONFIG as s, _enum as sn, logChannelsCapability as st, APPLE_SA_TO_MACRO as t, makeSourceBrokerId as tn, failureContributionCapability as tt, DEFAULT_DETAIL_CROP_CONVENTION as u, discriminatedUnion as un, mayReadLocation as ut, G711_SCALE_CORRECTION_DB as v, union as vn, pickClusterStepSettings as vt, PoolMemoryWatchdog as w, recordingExportCapability as wt, NativeLeaseAdmissionSchema as x, pipelineExecutorCapability as xt, HF_BASE_URL as y, EventCategory as yn, pickDetailCropConvention as yt, createLogChannelsProvider as z, AUDIO_PRESETS as zt };
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_dist = require("../dist-DZsjVFey.js");
5
+ const require_dist = require("../dist-DXilmc1W.js");
6
6
  const require_lazy_sharp = require("../lazy-sharp-BuwKlQLR.js");
7
7
  let node_fs = require("node:fs");
8
8
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Wt as BaseAddon, Z as evaluateZoneRules, Zt as hydrateSchema, pt as motionDetectionCapability, qt as DeviceType } from "../dist-BNzfbpF6.mjs";
1
+ import { Gt as BaseAddon, Jt as DeviceType, Q as evaluateZoneRules, Qt as hydrateSchema, mt as motionDetectionCapability } from "../dist-InCt3_5U.mjs";
2
2
  import { t as getSharp } from "../lazy-sharp-DXsqwpph.mjs";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { join } from "node:path";
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-emK7D4bc.js");
2
- const require_dist = require("./dist-DZsjVFey.js");
2
+ const require_dist = require("./dist-DXilmc1W.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  let node_fs = require("node:fs");
5
5
  node_fs = require_chunk.__toESM(node_fs, 1);
@@ -1,4 +1,4 @@
1
- import { Bt as buildFfmpegArgs, Ht as isSoftwareDecode, Lt as errMsg, zt as Fmp4BoxSplitter } from "./dist-BNzfbpF6.mjs";
1
+ import { Bt as Fmp4BoxSplitter, Rt as errMsg, Ut as isSoftwareDecode, Vt as buildFfmpegArgs } from "./dist-InCt3_5U.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { realpathSync } from "node:fs";
4
4
  import path from "node:path";