@camstack/addon-provider-homeassistant 1.2.103 → 1.2.105

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.
package/dist/addon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_dist = require("./dist-B1wVsjRx.js");
2
+ const require_dist = require("./dist-Ds45JTMq.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  let node_zlib = require("node:zlib");
5
5
  //#region src/ha-device-source.ts
package/dist/addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-jHuKjwKy.mjs";
1
+ import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-4WKeNf6a.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { brotliCompressSync, deflateSync, gzipSync } from "node:zlib";
4
4
  //#region src/ha-device-source.ts
@@ -7830,6 +7830,157 @@ var CameraSwitchGroupSchema = object({
7830
7830
  /** Unix ms when the group was composed server-side. */
7831
7831
  fetchedAt: number()
7832
7832
  });
7833
+ /**
7834
+ * What the gate decided about a birth, from the CALLER's point of view.
7835
+ *
7836
+ * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
7837
+ * at all — it is a deferral, and the row is written when the deferral ENDS.
7838
+ * The third member is the one the gate's own type cannot express, because
7839
+ * exhaustion is a property of how long the caller waited.
7840
+ */
7841
+ var BirthDecisionVerdictSchema = _enum([
7842
+ "confirmed",
7843
+ "suppressed",
7844
+ "exhausted-fallback"
7845
+ ]);
7846
+ /** One birth decision, as it is kept. */
7847
+ var BirthDecisionRecordSchema = object({
7848
+ id: string(),
7849
+ /** Epoch ms the VERDICT was taken (not the birth instant — see `firstSeen`). */
7850
+ at: number().int(),
7851
+ /** The camera. Required: every question here is asked per-camera. */
7852
+ deviceId: number().int(),
7853
+ /**
7854
+ * The track the decision was about. PROVENANCE, not ownership — a suppressed
7855
+ * birth has no track at all, and a confirmed one is expected to age out long
7856
+ * before this row does. Named `sourceTrackId` so the retention model's
7857
+ * ownership derivation (`collection-classification.ts`, which keys on a
7858
+ * column literally called `trackId`) cannot reach it.
7859
+ */
7860
+ sourceTrackId: string(),
7861
+ /** The candidate's claimed class. The miss rate is asked per class too. */
7862
+ className: string(),
7863
+ verdict: BirthDecisionVerdictSchema,
7864
+ /**
7865
+ * The gate's own `ConfirmationReason` (`confirmed`, `suppressed`,
7866
+ * `native-pass`, `no-crop`, `timeout`, `carried-inconclusive`, …), or `null`
7867
+ * when the gate is DISABLED and every birth is waved through. `null` is not
7868
+ * "unknown": it says the gate took no measurement because it was off, which
7869
+ * is a different population and must never be averaged in with the rest.
7870
+ */
7871
+ reason: string().nullable(),
7872
+ /** Deferral attempts this birth used. 0 = decided on its first look. */
7873
+ attempts: number().int(),
7874
+ /** Ms from the FIRST undecided attempt to this verdict. 0 = never deferred. */
7875
+ deferredForMs: number().int(),
7876
+ /**
7877
+ * THE COLUMN THE RE-OFFER DEFECT IS COUNTED IN.
7878
+ *
7879
+ * `true` when the frame the verdict was taken on carried no matched
7880
+ * detection for this track — the tracker was coasting a frozen box and the
7881
+ * subject was not observed. The deferred-birth re-offer pulls the candidate
7882
+ * straight out of `result.tracked` without checking, so this is reachable
7883
+ * today; the question is the RATE, per camera, and whether refusing those
7884
+ * frames would have cost real tracks (cross-read against `verdict` and
7885
+ * `decidedByBirthEvidence`).
7886
+ */
7887
+ decidedOnCoastedFrame: boolean(),
7888
+ /** Were D379 birth-instant pixels in hand when this candidate was submitted? */
7889
+ birthEvidenceAvailable: boolean(),
7890
+ /**
7891
+ * Did those pixels DECIDE it (`cropSource === 'carried'`)? Available and
7892
+ * deciding are different: the carried crop is confirm-only, so a candidate
7893
+ * can hold evidence, be found inconclusive on it, and be decided by a native
7894
+ * crop of a later instant. A coasted decision backed by carried evidence is
7895
+ * a real observation of the birth instant; one without it is not.
7896
+ */
7897
+ decidedByBirthEvidence: boolean(),
7898
+ /** Best class-compatible crop score, or `null` when nothing compatible was
7899
+ * found — deliberately not 0, which would be a measurement that never was. */
7900
+ bestScore: number().nullable(),
7901
+ /** The bar this candidate actually faced (the phantom-cell hook may raise it). */
7902
+ appliedMinConfidence: number().nullable(),
7903
+ /**
7904
+ * The track's own `firstSeen` — the candidate's first frame, which is where
7905
+ * the timeline starts. `null` for a suppressed birth, which has no track.
7906
+ */
7907
+ firstSeen: number().int().nullable(),
7908
+ /**
7909
+ * The device's most recent motion RISING EDGE at the moment of the decision,
7910
+ * or `null` when there is none, it is older than
7911
+ * {@link MAX_BIRTH_LATENCY_PROXY_MS}, or this runner never saw one.
7912
+ */
7913
+ motionOnsetAt: number().int().nullable(),
7914
+ /**
7915
+ * `firstSeen − motionOnsetAt` — THE OPERATOR'S COMPLAINT, IN MILLISECONDS,
7916
+ * AND THE WEAKEST NUMBER IN THIS ROW. Read the error bars before quoting it.
7917
+ *
7918
+ * **Why motion onset and not something else.** Two other proxies were
7919
+ * considered and rejected:
7920
+ * - *the recording/pipeline session start*: for a camera on
7921
+ * `detectionMode: 'always'` the session opens at process start, hours
7922
+ * before any subject. It measures nothing.
7923
+ * - *the first detection on the device in this burst*: CIRCULAR. A track's
7924
+ * `firstSeen` IS the first detection of that object, so for the track that
7925
+ * OPENS a burst — the only one the operator is complaining about — the two
7926
+ * are the same instant and the latency is 0 by construction.
7927
+ * Motion onset is the only in-process signal produced by a DIFFERENT
7928
+ * mechanism from the object detector, so it is the only one that can precede
7929
+ * it. It is also already maintained per-device at frame rate on this very
7930
+ * node (`handleMotionAnalysis` / `handleOnboardMotion`), which is what makes
7931
+ * it free — and, decisively, the frame path and the motion path are gated to
7932
+ * the SAME designated post-processing node, so the mirror is never empty for
7933
+ * a camera whose births land here.
7934
+ *
7935
+ * **Error bars, all of them.**
7936
+ * 1. *Motion has no class.* A burst opened by rain, a headlight sweeping a
7937
+ * wall or a branch, and only later joined by the person, OVERSTATES the
7938
+ * latency without bound. Mitigated, never removed, by
7939
+ * {@link BirthDecisionRecord.birthIndexInBurst}: only index 0 is a
7940
+ * candidate for "this burst is this subject", and even then it is a
7941
+ * candidate, not a fact.
7942
+ * 2. *The sign is not guaranteed.* The analyzer needs a pixel-count and
7943
+ * intensity threshold. A subject entering slowly at the far edge of the
7944
+ * frame can clear the detector's confidence floor BEFORE it clears the
7945
+ * motion floor, making this negative. Negatives are stored as-is and
7946
+ * never clamped — clamping would fabricate the distribution's left tail,
7947
+ * which is the half that says the proxy is unreliable.
7948
+ * 3. *Onboard motion carries firmware latency of unknown, per-model offset*
7949
+ * (hundreds of ms), plus camera-vs-hub clock skew on top. Numbers are
7950
+ * therefore comparable WITHIN a camera and not across cameras of
7951
+ * different motion sources. The motion source is deliberately not copied
7952
+ * here — it belongs to the addon that owns the device (D224) and this is
7953
+ * a write on the frame path — so group by `deviceId`, which is how the
7954
+ * question is always asked anyway.
7955
+ * 4. *Continuous motion.* On a busy scene the burst never closes and the
7956
+ * onset is minutes old. Bounded by {@link MAX_BIRTH_LATENCY_PROXY_MS};
7957
+ * past it this is `null`.
7958
+ * 5. *No motion signal at all* — analyzer off, onboard-only camera not
7959
+ * reporting, or nothing since boot: `null`. Which is the truth about a
7960
+ * camera nobody has a reference instant for.
7961
+ *
7962
+ * So this is a per-camera DISTRIBUTION over index-0 births, and it is honest
7963
+ * as such. It is not a per-track fact and must never be shown as one.
7964
+ */
7965
+ birthLatencyMs: number().int().nullable(),
7966
+ /**
7967
+ * How many births this device has already decided since that motion onset.
7968
+ * 0 = the first, i.e. the only index at which the burst plausibly belongs to
7969
+ * this subject. `null` when there is no usable onset.
7970
+ */
7971
+ birthIndexInBurst: number().int().nullable()
7972
+ });
7973
+ /** Query input for `listBirthDecisions` — newest first, one camera or all. */
7974
+ var BirthDecisionQueryInputSchema = object({
7975
+ /** Restrict to a single camera; omit for every row. */
7976
+ deviceId: number().int().optional(),
7977
+ /** Only decisions at or after this epoch ms. */
7978
+ since: number().int().optional(),
7979
+ /** Restrict to one verdict — the miss rate is read one population at a time. */
7980
+ verdict: BirthDecisionVerdictSchema.optional(),
7981
+ /** Max rows returned, newest-first. */
7982
+ limit: number().int().min(1).max(5e3).optional()
7983
+ });
7833
7984
  /** One archived note — the operator's words plus enough context to find what
7834
7985
  * they were looking at, after the track itself is gone. */
7835
7986
  var ArchivedDebugNoteSchema = object({
@@ -20507,7 +20658,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
20507
20658
  deviceId: number(),
20508
20659
  trackId: string(),
20509
20660
  flags: TrackFlagsPatchSchema
20510
- }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
20661
+ }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(BirthDecisionQueryInputSchema, array(BirthDecisionRecordSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
20511
20662
  kind: "query",
20512
20663
  auth: "admin"
20513
20664
  }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
@@ -20949,6 +21100,22 @@ var occupancyRecheckFramesField = {
20949
21100
  step: 1
20950
21101
  };
20951
21102
  /**
21103
+ * Frames one PRE-ROLL catch-up burst may send to inference at session open.
21104
+ *
21105
+ * The default of 12 over a ~4 s retained window is one frame per ~333 ms of
21106
+ * footage, and costs ~480 ms of ONE inference permit at the 40 ms/frame this
21107
+ * fleet measures — one-shot, and only ever taken while a permit would still be
21108
+ * spare for live. `0` turns the burst off entirely (the history is still
21109
+ * decoded, because that is how the dial reaches a decodable GOP, and is then
21110
+ * discarded — the pre-D411 behaviour).
21111
+ */
21112
+ var preRollInferenceFramesField = {
21113
+ min: 0,
21114
+ max: 30,
21115
+ default: 12,
21116
+ step: 1
21117
+ };
21118
+ /**
20952
21119
  * Source enum for motion signals fed to the runner. Extensible — add
20953
21120
  * new variants here when new motion-trigger paths are wired in
20954
21121
  * (`wasm-cross-camera`, `event-bus-relay`, etc.). The runner uses
@@ -21189,6 +21356,31 @@ var RunnerCameraConfigSchema = object({
21189
21356
  * to every occupancy rule until something moved in front of it. The churn is
21190
21357
  * now paid on the interval instead — see `occupancyRecheckSecField`.
21191
21358
  */
21359
+ /**
21360
+ * Infer the session's PRE-ROLL — the retained history the restreamer replays
21361
+ * at session open — instead of decoding it and throwing it away.
21362
+ *
21363
+ * DEFAULT `true`, and the default is the argument. This is not a new
21364
+ * capability being offered cautiously: the pre-roll is ALREADY requested,
21365
+ * already served, already decoded and already paid for on every on-motion
21366
+ * detection session that asks for history. What shipped was a last-moment
21367
+ * discard — `FrameSlot`'s throttle compares wall clocks, and ~4 s of media
21368
+ * arriving inside a few hundred ms of wall clock looks to it like one frame's
21369
+ * worth. Device 617, 2026-09-08: a re-run of the SAME model over the stored
21370
+ * recording scored the subject `vehicle 0.5669` — above the 0.50 floor —
21371
+ * 1.68 s BEFORE the live track was born, on a frame that was in the pre-roll,
21372
+ * was decoded, and was freed.
21373
+ *
21374
+ * Shipping that as opt-in would ship the bug: an operator cannot discover a
21375
+ * setting whose absence looks exactly like a camera that noticed the cyclist
21376
+ * late. What makes ON safe is not a switch but the BOUND —
21377
+ * `preRollInferenceFrames`, a wall-clock ceiling, and a lane that never takes
21378
+ * the last inference permit — so the switch exists for the camera where the
21379
+ * history is worthless (a doorbell whose subject is always already at the
21380
+ * door), not as a hedge against the feature.
21381
+ */
21382
+ preRollInferenceEnabled: boolean().default(true),
21383
+ preRollInferenceFrames: number().min(preRollInferenceFramesField.min).max(preRollInferenceFramesField.max).default(preRollInferenceFramesField.default),
21192
21384
  occupancyRecheckEnabled: boolean().default(true),
21193
21385
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
21194
21386
  occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
@@ -21217,7 +21409,7 @@ var RunnerCameraConfigSchema = object({
21217
21409
  */
21218
21410
  inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
21219
21411
  });
21220
- motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, maxSessionHoldMsField.min, maxSessionHoldMsField.max, maxSessionHoldMsField.step, maxSessionHoldMsField.default, audioMotionWindowMsField.min, audioMotionWindowMsField.max, audioMotionWindowMsField.step, audioMotionWindowMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
21412
+ motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, maxSessionHoldMsField.min, maxSessionHoldMsField.max, maxSessionHoldMsField.step, maxSessionHoldMsField.default, audioMotionWindowMsField.min, audioMotionWindowMsField.max, audioMotionWindowMsField.step, audioMotionWindowMsField.default, preRollInferenceFramesField.min, preRollInferenceFramesField.max, preRollInferenceFramesField.step, preRollInferenceFramesField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
21221
21413
  /**
21222
21414
  * Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
21223
21415
  * load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
@@ -37996,6 +38188,12 @@ Object.freeze({
37996
38188
  addonId: null,
37997
38189
  access: "view"
37998
38190
  },
38191
+ "pipelineAnalytics.listBirthDecisions": {
38192
+ capName: "pipeline-analytics",
38193
+ capScope: "device",
38194
+ addonId: null,
38195
+ access: "view"
38196
+ },
37999
38197
  "pipelineAnalytics.listEventKinds": {
38000
38198
  capName: "pipeline-analytics",
38001
38199
  capScope: "device",
@@ -41788,6 +41986,11 @@ Object.freeze({
41788
41986
  form: "single",
41789
41987
  optional: true
41790
41988
  }],
41989
+ "pipelineAnalytics.listBirthDecisions": [{
41990
+ name: "deviceId",
41991
+ form: "single",
41992
+ optional: true
41993
+ }],
41791
41994
  "pipelineAnalytics.listEventKinds": [{
41792
41995
  name: "deviceId",
41793
41996
  form: "single",
@@ -7830,6 +7830,157 @@ var CameraSwitchGroupSchema = object({
7830
7830
  /** Unix ms when the group was composed server-side. */
7831
7831
  fetchedAt: number()
7832
7832
  });
7833
+ /**
7834
+ * What the gate decided about a birth, from the CALLER's point of view.
7835
+ *
7836
+ * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
7837
+ * at all — it is a deferral, and the row is written when the deferral ENDS.
7838
+ * The third member is the one the gate's own type cannot express, because
7839
+ * exhaustion is a property of how long the caller waited.
7840
+ */
7841
+ var BirthDecisionVerdictSchema = _enum([
7842
+ "confirmed",
7843
+ "suppressed",
7844
+ "exhausted-fallback"
7845
+ ]);
7846
+ /** One birth decision, as it is kept. */
7847
+ var BirthDecisionRecordSchema = object({
7848
+ id: string(),
7849
+ /** Epoch ms the VERDICT was taken (not the birth instant — see `firstSeen`). */
7850
+ at: number().int(),
7851
+ /** The camera. Required: every question here is asked per-camera. */
7852
+ deviceId: number().int(),
7853
+ /**
7854
+ * The track the decision was about. PROVENANCE, not ownership — a suppressed
7855
+ * birth has no track at all, and a confirmed one is expected to age out long
7856
+ * before this row does. Named `sourceTrackId` so the retention model's
7857
+ * ownership derivation (`collection-classification.ts`, which keys on a
7858
+ * column literally called `trackId`) cannot reach it.
7859
+ */
7860
+ sourceTrackId: string(),
7861
+ /** The candidate's claimed class. The miss rate is asked per class too. */
7862
+ className: string(),
7863
+ verdict: BirthDecisionVerdictSchema,
7864
+ /**
7865
+ * The gate's own `ConfirmationReason` (`confirmed`, `suppressed`,
7866
+ * `native-pass`, `no-crop`, `timeout`, `carried-inconclusive`, …), or `null`
7867
+ * when the gate is DISABLED and every birth is waved through. `null` is not
7868
+ * "unknown": it says the gate took no measurement because it was off, which
7869
+ * is a different population and must never be averaged in with the rest.
7870
+ */
7871
+ reason: string().nullable(),
7872
+ /** Deferral attempts this birth used. 0 = decided on its first look. */
7873
+ attempts: number().int(),
7874
+ /** Ms from the FIRST undecided attempt to this verdict. 0 = never deferred. */
7875
+ deferredForMs: number().int(),
7876
+ /**
7877
+ * THE COLUMN THE RE-OFFER DEFECT IS COUNTED IN.
7878
+ *
7879
+ * `true` when the frame the verdict was taken on carried no matched
7880
+ * detection for this track — the tracker was coasting a frozen box and the
7881
+ * subject was not observed. The deferred-birth re-offer pulls the candidate
7882
+ * straight out of `result.tracked` without checking, so this is reachable
7883
+ * today; the question is the RATE, per camera, and whether refusing those
7884
+ * frames would have cost real tracks (cross-read against `verdict` and
7885
+ * `decidedByBirthEvidence`).
7886
+ */
7887
+ decidedOnCoastedFrame: boolean(),
7888
+ /** Were D379 birth-instant pixels in hand when this candidate was submitted? */
7889
+ birthEvidenceAvailable: boolean(),
7890
+ /**
7891
+ * Did those pixels DECIDE it (`cropSource === 'carried'`)? Available and
7892
+ * deciding are different: the carried crop is confirm-only, so a candidate
7893
+ * can hold evidence, be found inconclusive on it, and be decided by a native
7894
+ * crop of a later instant. A coasted decision backed by carried evidence is
7895
+ * a real observation of the birth instant; one without it is not.
7896
+ */
7897
+ decidedByBirthEvidence: boolean(),
7898
+ /** Best class-compatible crop score, or `null` when nothing compatible was
7899
+ * found — deliberately not 0, which would be a measurement that never was. */
7900
+ bestScore: number().nullable(),
7901
+ /** The bar this candidate actually faced (the phantom-cell hook may raise it). */
7902
+ appliedMinConfidence: number().nullable(),
7903
+ /**
7904
+ * The track's own `firstSeen` — the candidate's first frame, which is where
7905
+ * the timeline starts. `null` for a suppressed birth, which has no track.
7906
+ */
7907
+ firstSeen: number().int().nullable(),
7908
+ /**
7909
+ * The device's most recent motion RISING EDGE at the moment of the decision,
7910
+ * or `null` when there is none, it is older than
7911
+ * {@link MAX_BIRTH_LATENCY_PROXY_MS}, or this runner never saw one.
7912
+ */
7913
+ motionOnsetAt: number().int().nullable(),
7914
+ /**
7915
+ * `firstSeen − motionOnsetAt` — THE OPERATOR'S COMPLAINT, IN MILLISECONDS,
7916
+ * AND THE WEAKEST NUMBER IN THIS ROW. Read the error bars before quoting it.
7917
+ *
7918
+ * **Why motion onset and not something else.** Two other proxies were
7919
+ * considered and rejected:
7920
+ * - *the recording/pipeline session start*: for a camera on
7921
+ * `detectionMode: 'always'` the session opens at process start, hours
7922
+ * before any subject. It measures nothing.
7923
+ * - *the first detection on the device in this burst*: CIRCULAR. A track's
7924
+ * `firstSeen` IS the first detection of that object, so for the track that
7925
+ * OPENS a burst — the only one the operator is complaining about — the two
7926
+ * are the same instant and the latency is 0 by construction.
7927
+ * Motion onset is the only in-process signal produced by a DIFFERENT
7928
+ * mechanism from the object detector, so it is the only one that can precede
7929
+ * it. It is also already maintained per-device at frame rate on this very
7930
+ * node (`handleMotionAnalysis` / `handleOnboardMotion`), which is what makes
7931
+ * it free — and, decisively, the frame path and the motion path are gated to
7932
+ * the SAME designated post-processing node, so the mirror is never empty for
7933
+ * a camera whose births land here.
7934
+ *
7935
+ * **Error bars, all of them.**
7936
+ * 1. *Motion has no class.* A burst opened by rain, a headlight sweeping a
7937
+ * wall or a branch, and only later joined by the person, OVERSTATES the
7938
+ * latency without bound. Mitigated, never removed, by
7939
+ * {@link BirthDecisionRecord.birthIndexInBurst}: only index 0 is a
7940
+ * candidate for "this burst is this subject", and even then it is a
7941
+ * candidate, not a fact.
7942
+ * 2. *The sign is not guaranteed.* The analyzer needs a pixel-count and
7943
+ * intensity threshold. A subject entering slowly at the far edge of the
7944
+ * frame can clear the detector's confidence floor BEFORE it clears the
7945
+ * motion floor, making this negative. Negatives are stored as-is and
7946
+ * never clamped — clamping would fabricate the distribution's left tail,
7947
+ * which is the half that says the proxy is unreliable.
7948
+ * 3. *Onboard motion carries firmware latency of unknown, per-model offset*
7949
+ * (hundreds of ms), plus camera-vs-hub clock skew on top. Numbers are
7950
+ * therefore comparable WITHIN a camera and not across cameras of
7951
+ * different motion sources. The motion source is deliberately not copied
7952
+ * here — it belongs to the addon that owns the device (D224) and this is
7953
+ * a write on the frame path — so group by `deviceId`, which is how the
7954
+ * question is always asked anyway.
7955
+ * 4. *Continuous motion.* On a busy scene the burst never closes and the
7956
+ * onset is minutes old. Bounded by {@link MAX_BIRTH_LATENCY_PROXY_MS};
7957
+ * past it this is `null`.
7958
+ * 5. *No motion signal at all* — analyzer off, onboard-only camera not
7959
+ * reporting, or nothing since boot: `null`. Which is the truth about a
7960
+ * camera nobody has a reference instant for.
7961
+ *
7962
+ * So this is a per-camera DISTRIBUTION over index-0 births, and it is honest
7963
+ * as such. It is not a per-track fact and must never be shown as one.
7964
+ */
7965
+ birthLatencyMs: number().int().nullable(),
7966
+ /**
7967
+ * How many births this device has already decided since that motion onset.
7968
+ * 0 = the first, i.e. the only index at which the burst plausibly belongs to
7969
+ * this subject. `null` when there is no usable onset.
7970
+ */
7971
+ birthIndexInBurst: number().int().nullable()
7972
+ });
7973
+ /** Query input for `listBirthDecisions` — newest first, one camera or all. */
7974
+ var BirthDecisionQueryInputSchema = object({
7975
+ /** Restrict to a single camera; omit for every row. */
7976
+ deviceId: number().int().optional(),
7977
+ /** Only decisions at or after this epoch ms. */
7978
+ since: number().int().optional(),
7979
+ /** Restrict to one verdict — the miss rate is read one population at a time. */
7980
+ verdict: BirthDecisionVerdictSchema.optional(),
7981
+ /** Max rows returned, newest-first. */
7982
+ limit: number().int().min(1).max(5e3).optional()
7983
+ });
7833
7984
  /** One archived note — the operator's words plus enough context to find what
7834
7985
  * they were looking at, after the track itself is gone. */
7835
7986
  var ArchivedDebugNoteSchema = object({
@@ -20507,7 +20658,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
20507
20658
  deviceId: number(),
20508
20659
  trackId: string(),
20509
20660
  flags: TrackFlagsPatchSchema
20510
- }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
20661
+ }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(BirthDecisionQueryInputSchema, array(BirthDecisionRecordSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
20511
20662
  kind: "query",
20512
20663
  auth: "admin"
20513
20664
  }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
@@ -20949,6 +21100,22 @@ var occupancyRecheckFramesField = {
20949
21100
  step: 1
20950
21101
  };
20951
21102
  /**
21103
+ * Frames one PRE-ROLL catch-up burst may send to inference at session open.
21104
+ *
21105
+ * The default of 12 over a ~4 s retained window is one frame per ~333 ms of
21106
+ * footage, and costs ~480 ms of ONE inference permit at the 40 ms/frame this
21107
+ * fleet measures — one-shot, and only ever taken while a permit would still be
21108
+ * spare for live. `0` turns the burst off entirely (the history is still
21109
+ * decoded, because that is how the dial reaches a decodable GOP, and is then
21110
+ * discarded — the pre-D411 behaviour).
21111
+ */
21112
+ var preRollInferenceFramesField = {
21113
+ min: 0,
21114
+ max: 30,
21115
+ default: 12,
21116
+ step: 1
21117
+ };
21118
+ /**
20952
21119
  * Source enum for motion signals fed to the runner. Extensible — add
20953
21120
  * new variants here when new motion-trigger paths are wired in
20954
21121
  * (`wasm-cross-camera`, `event-bus-relay`, etc.). The runner uses
@@ -21189,6 +21356,31 @@ var RunnerCameraConfigSchema = object({
21189
21356
  * to every occupancy rule until something moved in front of it. The churn is
21190
21357
  * now paid on the interval instead — see `occupancyRecheckSecField`.
21191
21358
  */
21359
+ /**
21360
+ * Infer the session's PRE-ROLL — the retained history the restreamer replays
21361
+ * at session open — instead of decoding it and throwing it away.
21362
+ *
21363
+ * DEFAULT `true`, and the default is the argument. This is not a new
21364
+ * capability being offered cautiously: the pre-roll is ALREADY requested,
21365
+ * already served, already decoded and already paid for on every on-motion
21366
+ * detection session that asks for history. What shipped was a last-moment
21367
+ * discard — `FrameSlot`'s throttle compares wall clocks, and ~4 s of media
21368
+ * arriving inside a few hundred ms of wall clock looks to it like one frame's
21369
+ * worth. Device 617, 2026-09-08: a re-run of the SAME model over the stored
21370
+ * recording scored the subject `vehicle 0.5669` — above the 0.50 floor —
21371
+ * 1.68 s BEFORE the live track was born, on a frame that was in the pre-roll,
21372
+ * was decoded, and was freed.
21373
+ *
21374
+ * Shipping that as opt-in would ship the bug: an operator cannot discover a
21375
+ * setting whose absence looks exactly like a camera that noticed the cyclist
21376
+ * late. What makes ON safe is not a switch but the BOUND —
21377
+ * `preRollInferenceFrames`, a wall-clock ceiling, and a lane that never takes
21378
+ * the last inference permit — so the switch exists for the camera where the
21379
+ * history is worthless (a doorbell whose subject is always already at the
21380
+ * door), not as a hedge against the feature.
21381
+ */
21382
+ preRollInferenceEnabled: boolean().default(true),
21383
+ preRollInferenceFrames: number().min(preRollInferenceFramesField.min).max(preRollInferenceFramesField.max).default(preRollInferenceFramesField.default),
21192
21384
  occupancyRecheckEnabled: boolean().default(true),
21193
21385
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
21194
21386
  occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
@@ -21217,7 +21409,7 @@ var RunnerCameraConfigSchema = object({
21217
21409
  */
21218
21410
  inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
21219
21411
  });
21220
- motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, maxSessionHoldMsField.min, maxSessionHoldMsField.max, maxSessionHoldMsField.step, maxSessionHoldMsField.default, audioMotionWindowMsField.min, audioMotionWindowMsField.max, audioMotionWindowMsField.step, audioMotionWindowMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
21412
+ motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, maxSessionHoldMsField.min, maxSessionHoldMsField.max, maxSessionHoldMsField.step, maxSessionHoldMsField.default, audioMotionWindowMsField.min, audioMotionWindowMsField.max, audioMotionWindowMsField.step, audioMotionWindowMsField.default, preRollInferenceFramesField.min, preRollInferenceFramesField.max, preRollInferenceFramesField.step, preRollInferenceFramesField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
21221
21413
  /**
21222
21414
  * Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
21223
21415
  * load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
@@ -37996,6 +38188,12 @@ Object.freeze({
37996
38188
  addonId: null,
37997
38189
  access: "view"
37998
38190
  },
38191
+ "pipelineAnalytics.listBirthDecisions": {
38192
+ capName: "pipeline-analytics",
38193
+ capScope: "device",
38194
+ addonId: null,
38195
+ access: "view"
38196
+ },
37999
38197
  "pipelineAnalytics.listEventKinds": {
38000
38198
  capName: "pipeline-analytics",
38001
38199
  capScope: "device",
@@ -41788,6 +41986,11 @@ Object.freeze({
41788
41986
  form: "single",
41789
41987
  optional: true
41790
41988
  }],
41989
+ "pipelineAnalytics.listBirthDecisions": [{
41990
+ name: "deviceId",
41991
+ form: "single",
41992
+ optional: true
41993
+ }],
41791
41994
  "pipelineAnalytics.listEventKinds": [{
41792
41995
  name: "deviceId",
41793
41996
  form: "single",
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  //#endregion
6
- const require_dist = require("../dist-B1wVsjRx.js");
6
+ const require_dist = require("../dist-Ds45JTMq.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  //#region src/ha-export/topics.ts
9
9
  /**
@@ -1,4 +1,4 @@
1
- import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-jHuKjwKy.mjs";
1
+ import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-4WKeNf6a.mjs";
2
2
  import { createHmac, timingSafeEqual } from "node:crypto";
3
3
  //#region src/ha-export/topics.ts
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-homeassistant",
3
- "version": "1.2.103",
3
+ "version": "1.2.105",
4
4
  "description": "Home Assistant device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",