@camstack/addon-provider-homeassistant 1.2.61 → 1.2.62

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-C9c_O8wh.js");
2
+ const require_dist = require("./dist-u1L6UZmY.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-DoPggq1j.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-DV4Xqi_x.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
@@ -8221,6 +8221,20 @@ var RelocateJobSchema = object({
8221
8221
  * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8222
8222
  */
8223
8223
  rowsReconciled: number().int().nonnegative().optional(),
8224
+ /**
8225
+ * Rows this run FORGOT because the file they name is not on disk.
8226
+ *
8227
+ * The mover derived the path from the row's own fields and `stat`ed it; an
8228
+ * ENOENT there is a per-path confirmation that the segment is gone (D296),
8229
+ * and the durable row is dropped through the same channel eviction uses. It
8230
+ * is reported for the same reason `rowsReconciled` is: this is a durable
8231
+ * mutation nobody asked for, and a migration that quietly erases hour rows is
8232
+ * the same failure as one that quietly skips them (D295).
8233
+ *
8234
+ * The production drain of 2026-08-30 would have reported 11 074 here — the
8235
+ * ledger claimed 5.65 GB of footage that no longer existed.
8236
+ */
8237
+ rowsForgotten: number().int().nonnegative().optional(),
8224
8238
  startedAt: number(),
8225
8239
  finishedAt: number().nullable(),
8226
8240
  error: string().nullable()
@@ -8584,6 +8598,91 @@ var RelocateResidueSchema = object({
8584
8598
  segments: number().int().nonnegative(),
8585
8599
  bytes: number().int().nonnegative()
8586
8600
  }).nullable();
8601
+ /**
8602
+ * Ask one location whether its durable hour rows describe the disk — the walk
8603
+ * (D319).
8604
+ *
8605
+ * `apply` DEFAULTS TO FALSE and that default is the product: the operator's
8606
+ * missing tool is the question, and the dry run is how they sanity-check the
8607
+ * destructive run before authorising it.
8608
+ */
8609
+ var LedgerWalkInputSchema = object({
8610
+ locationId: string().min(1),
8611
+ /** Forget the confirmed-absent rows, rather than only counting them. */
8612
+ apply: boolean().optional(),
8613
+ /** Narrow to one camera. */
8614
+ deviceId: number().int().positive().optional(),
8615
+ /** Narrow to these recording profiles; empty/absent = every profile. */
8616
+ profiles: array(string().min(1)).optional()
8617
+ });
8618
+ /** Why a whole walk did nothing. Every one leaves the ledger untouched. */
8619
+ var LedgerWalkRefusalSchema = _enum([
8620
+ "location-unknown",
8621
+ "source-writable",
8622
+ "no-ledger",
8623
+ "archive-unreadable",
8624
+ "anchor-absent",
8625
+ "anchor-unreadable",
8626
+ "anchor-moved"
8627
+ ]);
8628
+ _enum([
8629
+ "live-tail",
8630
+ "listing-error",
8631
+ "path-mismatch",
8632
+ "durable-refused"
8633
+ ]);
8634
+ /** Every skip reason, always present, always a number — so a reason that never
8635
+ * fired reports as zero rather than absent and the report shape is constant
8636
+ * between passes. Spelled out rather than `z.record` for exactly that. */
8637
+ var LedgerWalkSkipCountsSchema = object({
8638
+ "live-tail": number().int().nonnegative(),
8639
+ "listing-error": number().int().nonnegative(),
8640
+ "path-mismatch": number().int().nonnegative(),
8641
+ "durable-refused": number().int().nonnegative()
8642
+ });
8643
+ /** One camera's share of a walk, so a report names cameras and not rows. */
8644
+ var LedgerWalkDeviceReportSchema = object({
8645
+ deviceId: number().int(),
8646
+ hoursWalked: number().int().nonnegative(),
8647
+ hoursMissing: number().int().nonnegative(),
8648
+ ghostSegments: number().int().nonnegative(),
8649
+ ghostBytes: number().int().nonnegative(),
8650
+ forgottenSegments: number().int().nonnegative(),
8651
+ orphanFiles: number().int().nonnegative()
8652
+ });
8653
+ /**
8654
+ * What one walk claimed, listed, found and (only when armed) forgot.
8655
+ *
8656
+ * `archiveSegments` is the **M** and `segmentsClaimed` the **N** (D295), so a
8657
+ * walk that saw a fraction of the location is visible in its own report rather
8658
+ * than in the absence of one.
8659
+ */
8660
+ var LedgerWalkReportSchema = object({
8661
+ locationId: string(),
8662
+ applied: boolean(),
8663
+ refused: LedgerWalkRefusalSchema.nullable(),
8664
+ archiveSegments: number().int().nonnegative().nullable(),
8665
+ archiveBytes: number().int().nonnegative().nullable(),
8666
+ hoursClaimed: number().int().nonnegative(),
8667
+ hoursWalked: number().int().nonnegative(),
8668
+ hoursMissing: number().int().nonnegative(),
8669
+ /** `readdir` calls issued — the cost, stated in the unit that is paid. */
8670
+ listings: number().int().nonnegative(),
8671
+ segmentsClaimed: number().int().nonnegative(),
8672
+ ghostSegments: number().int().nonnegative(),
8673
+ ghostBytes: number().int().nonnegative(),
8674
+ ghostHoursWhole: number().int().nonnegative(),
8675
+ forgottenSegments: number().int().nonnegative(),
8676
+ forgottenBytes: number().int().nonnegative(),
8677
+ /** Files under a claimed hour that no durable row names. Never deleted. */
8678
+ orphanFiles: number().int().nonnegative(),
8679
+ orphanSample: array(string()).readonly(),
8680
+ hoursSkipped: number().int().nonnegative(),
8681
+ skippedByReason: LedgerWalkSkipCountsSchema,
8682
+ /** The walk stopped at its per-pass hour bound with claims unwalked. */
8683
+ bounded: boolean(),
8684
+ byDevice: array(LedgerWalkDeviceReportSchema).readonly()
8685
+ });
8587
8686
  /** How many rows a media pass would still act on against a given target — the
8588
8687
  * media lane's denominator AND its residue, from ONE derivation so the two can
8589
8688
  * never disagree. `null` = the count could not be taken. */
@@ -19384,13 +19483,15 @@ var ListGroupsPageSchema = object({
19384
19483
  groups: array(AnalyticsGroupRecordSchema).readonly(),
19385
19484
  nextCursor: string().nullable()
19386
19485
  });
19486
+ var KEY_EVENTS_DEFAULT_LIMIT = 50;
19487
+ var KEY_EVENTS_MAX_LIMIT = 200;
19387
19488
  var KeyEventQueryInput = object({
19388
19489
  deviceId: number(),
19389
19490
  /** Window lower bound (track firstSeen ≥ since). */
19390
19491
  since: number(),
19391
19492
  /** Window upper bound (track firstSeen ≤ until). */
19392
19493
  until: number(),
19393
- limit: number().int().min(1).max(200).default(50),
19494
+ limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
19394
19495
  /** Drop tracks scoring below this importance. */
19395
19496
  minImportance: number().min(0).max(1).optional(),
19396
19497
  /** Restrict to a single class (e.g. 'person'). */
@@ -19412,6 +19513,32 @@ var KeyEventSchema = object({
19412
19513
  ...TrackFlagFields,
19413
19514
  ...TrackRetrainFields
19414
19515
  });
19516
+ /** `getKeyEvents`' window and filters, asked of a SET of cameras at once. */
19517
+ var KeyEventBatchQueryInput = object({
19518
+ deviceIds: array(number()).min(1).max(200),
19519
+ since: number(),
19520
+ until: number(),
19521
+ /** Applied PER CAMERA, exactly as `getKeyEvents.limit` is — never a total
19522
+ * across the set, which would let a busy camera starve a quiet one of its
19523
+ * rows and change what the merged feed contains. */
19524
+ limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
19525
+ minImportance: number().min(0).max(1).optional(),
19526
+ classFilter: string().optional()
19527
+ });
19528
+ /**
19529
+ * One camera's key events in a batch answer.
19530
+ *
19531
+ * The row exists for every requested id. `getKeyEvents` degrades to `[]` on
19532
+ * error rather than throwing, so a camera whose store read failed and one with
19533
+ * no events in the window were ALREADY indistinguishable per camera — the
19534
+ * batch does not make that worse, and the row keeps the deviceId the single
19535
+ * method's output never carried (the caller used to stamp it from the fan-out
19536
+ * key, which only worked because there was one query per camera).
19537
+ */
19538
+ var KeyEventsForDeviceSchema = object({
19539
+ deviceId: number(),
19540
+ events: array(KeyEventSchema).readonly()
19541
+ });
19415
19542
  object({
19416
19543
  trackId: string(),
19417
19544
  className: string(),
@@ -19681,7 +19808,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19681
19808
  until: number().optional(),
19682
19809
  kinds: array(string()).optional(),
19683
19810
  limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19684
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19811
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()), method(object({
19685
19812
  deviceId: number(),
19686
19813
  since: number(),
19687
19814
  until: number(),
@@ -29137,6 +29264,9 @@ method(object({
29137
29264
  }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
29138
29265
  kind: "query",
29139
29266
  auth: "admin"
29267
+ }), method(LedgerWalkInputSchema, LedgerWalkReportSchema, {
29268
+ kind: "mutation",
29269
+ auth: "admin"
29140
29270
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
29141
29271
  kind: "mutation",
29142
29272
  auth: "admin"
@@ -29528,6 +29658,25 @@ var SceneMonitorStatusSchema = object({
29528
29658
  monitors: array(SceneMonitorSchema),
29529
29659
  lastFetchedAt: number()
29530
29660
  });
29661
+ /**
29662
+ * One camera's row in a `listScenesBatch` answer.
29663
+ *
29664
+ * `status` is NULLABLE and the nullability is the whole point. `scene-monitor`
29665
+ * is a `defaultActive` wrapper, so every camera is asked; a camera whose
29666
+ * provider is absent (pipeline-analytics not deployed, the post-processing node
29667
+ * down) cannot answer, and that is not the same fact as a camera with no scenes
29668
+ * configured. Fanned out per camera the difference was visible — one query
29669
+ * errored while the others resolved — and a batch that returned only the rows
29670
+ * it managed would have destroyed it, silently, by making an unreachable camera
29671
+ * indistinguishable from one that answered `monitors: []`.
29672
+ *
29673
+ * So: EVERY requested deviceId gets a row. `status: null` means "this camera
29674
+ * could not be read"; `status.monitors: []` means "read, and it has none".
29675
+ */
29676
+ var SceneMonitorStatusForDeviceSchema = object({
29677
+ deviceId: number(),
29678
+ status: SceneMonitorStatusSchema.nullable()
29679
+ });
29531
29680
  var sceneMonitorCapability = {
29532
29681
  name: "scene-monitor",
29533
29682
  scope: "device",
@@ -29537,6 +29686,22 @@ var sceneMonitorCapability = {
29537
29686
  deviceTypes: [DeviceType.Camera],
29538
29687
  methods: {
29539
29688
  listScenes: method(object({ deviceId: number() }), SceneMonitorStatusSchema),
29689
+ /**
29690
+ * The same answer, for a SET of cameras, in one round trip.
29691
+ *
29692
+ * `/scenes` renders every camera and re-reads them on a 30s safety-net
29693
+ * poll behind the push slice. Fanned out client-side that was one query
29694
+ * per camera — 29 round trips through the browser, the hub and the
29695
+ * post-analysis runner every 30 seconds to read an in-memory map the
29696
+ * owner had already merged. The work is unchanged (`statusFor` per
29697
+ * device, all in-process at the owner); what collapses is the transport.
29698
+ *
29699
+ * A camera that cannot answer still gets a row, with `status: null` —
29700
+ * see {@link SceneMonitorStatusForDeviceSchema}. Never fewer rows than
29701
+ * ids: a caller that asked for twenty-nine and got twenty-seven cannot
29702
+ * tell which two are missing, or that any are.
29703
+ */
29704
+ listScenesBatch: method(object({ deviceIds: array(number()).min(1).max(200) }), array(SceneMonitorStatusForDeviceSchema).readonly()),
29540
29705
  createScene: method(object({
29541
29706
  deviceId: number(),
29542
29707
  label: string(),
@@ -31372,6 +31537,27 @@ var CameraOccupancySnapshotSchema = object({
31372
31537
  stationaryObjects: array(StationaryObjectSchema).readonly().optional()
31373
31538
  });
31374
31539
  /**
31540
+ * One camera's row in a `getCurrentSnapshotBatch` answer.
31541
+ *
31542
+ * THREE outcomes, and the single-camera method could only express two of them
31543
+ * because `snapshot: null` was already spoken for:
31544
+ *
31545
+ * - `read: 'read'`, `snapshot` present — the live occupancy reading.
31546
+ * - `read: 'read'`, `snapshot: null` — read, and this camera has no reading
31547
+ * yet: no frame since boot, and no parked-object registry to hydrate from.
31548
+ * - `read: 'unreadable'` — the owner could not answer for this
31549
+ * camera. `snapshot` is null, and it does NOT mean "nothing parked here".
31550
+ *
31551
+ * Collapsing the last two is the failure this field exists to prevent: a
31552
+ * hydration that threw would otherwise render as an empty Stationary section,
31553
+ * which is a definite claim about a camera nobody could read.
31554
+ */
31555
+ var CameraOccupancySnapshotForDeviceSchema = object({
31556
+ deviceId: number(),
31557
+ read: _enum(["read", "unreadable"]),
31558
+ snapshot: CameraOccupancySnapshotSchema.nullable()
31559
+ });
31560
+ /**
31375
31561
  * Time-series resolution. The history methods return one bucket per
31376
31562
  * step over the requested range. Smaller resolutions cost more
31377
31563
  * memory + bandwidth; bound to discrete steps so caller cannot ask
@@ -31428,6 +31614,20 @@ var zoneAnalyticsCapability = {
31428
31614
  * (no inference result emitted since boot or since binding was
31429
31615
  * activated). */
31430
31616
  getCurrentSnapshot: method(object({ deviceId: number() }), CameraOccupancySnapshotSchema.nullable()),
31617
+ /**
31618
+ * The same snapshot, for a SET of cameras, in one round trip.
31619
+ *
31620
+ * The Events page's Stationary section polls this every 15s for every
31621
+ * selected camera. Fanned out client-side that is one query per camera to
31622
+ * read a `Map.get` at the owner — the answer costs nothing, the round trip
31623
+ * costs everything. Batched, N transports become one and the per-device
31624
+ * work is unchanged.
31625
+ *
31626
+ * Every requested deviceId gets a row, tagged `read` — see
31627
+ * {@link CameraOccupancySnapshotForDeviceSchema}. A camera the owner could
31628
+ * not answer for is `'unreadable'`, never an empty reading.
31629
+ */
31630
+ getCurrentSnapshotBatch: method(object({ deviceIds: array(number()).min(1).max(200) }), array(CameraOccupancySnapshotForDeviceSchema).readonly()),
31431
31631
  /** Time-series object count inside one zone. `className` optional —
31432
31632
  * omit to count every class in the zone. */
31433
31633
  getZoneHistory: method(object({
@@ -35849,6 +36049,12 @@ Object.freeze({
35849
36049
  addonId: null,
35850
36050
  access: "view"
35851
36051
  },
36052
+ "pipelineAnalytics.getKeyEventsBatch": {
36053
+ capName: "pipeline-analytics",
36054
+ capScope: "device",
36055
+ addonId: null,
36056
+ access: "view"
36057
+ },
35852
36058
  "pipelineAnalytics.getMotionEvents": {
35853
36059
  capName: "pipeline-analytics",
35854
36060
  capScope: "device",
@@ -37025,6 +37231,12 @@ Object.freeze({
37025
37231
  addonId: null,
37026
37232
  access: "view"
37027
37233
  },
37234
+ "recording.reconcileLedgerAgainstDisk": {
37235
+ capName: "recording",
37236
+ capScope: "system",
37237
+ addonId: null,
37238
+ access: "create"
37239
+ },
37028
37240
  "recording.refreshStorageLocationsForMigration": {
37029
37241
  capName: "recording",
37030
37242
  capScope: "system",
@@ -37151,6 +37363,12 @@ Object.freeze({
37151
37363
  addonId: null,
37152
37364
  access: "view"
37153
37365
  },
37366
+ "sceneMonitor.listScenesBatch": {
37367
+ capName: "scene-monitor",
37368
+ capScope: "device",
37369
+ addonId: null,
37370
+ access: "view"
37371
+ },
37154
37372
  "sceneMonitor.recheckNow": {
37155
37373
  capName: "scene-monitor",
37156
37374
  capScope: "device",
@@ -38507,6 +38725,12 @@ Object.freeze({
38507
38725
  addonId: null,
38508
38726
  access: "view"
38509
38727
  },
38728
+ "zoneAnalytics.getCurrentSnapshotBatch": {
38729
+ capName: "zone-analytics",
38730
+ capScope: "device",
38731
+ addonId: null,
38732
+ access: "view"
38733
+ },
38510
38734
  "zoneAnalytics.getUnzonedHistory": {
38511
38735
  capName: "zone-analytics",
38512
38736
  capScope: "device",
@@ -39511,6 +39735,11 @@ Object.freeze({
39511
39735
  form: "single",
39512
39736
  optional: false
39513
39737
  }],
39738
+ "pipelineAnalytics.getKeyEventsBatch": [{
39739
+ name: "deviceIds",
39740
+ form: "array",
39741
+ optional: false
39742
+ }],
39514
39743
  "pipelineAnalytics.getMotionEvents": [{
39515
39744
  name: "deviceId",
39516
39745
  form: "single",
@@ -39951,6 +40180,11 @@ Object.freeze({
39951
40180
  form: "single",
39952
40181
  optional: false
39953
40182
  }],
40183
+ "recording.reconcileLedgerAgainstDisk": [{
40184
+ name: "deviceId",
40185
+ form: "single",
40186
+ optional: true
40187
+ }],
39954
40188
  "recording.relocateFootage": [{
39955
40189
  name: "deviceId",
39956
40190
  form: "single",
@@ -40016,6 +40250,11 @@ Object.freeze({
40016
40250
  form: "single",
40017
40251
  optional: false
40018
40252
  }],
40253
+ "sceneMonitor.listScenesBatch": [{
40254
+ name: "deviceIds",
40255
+ form: "array",
40256
+ optional: false
40257
+ }],
40019
40258
  "sceneMonitor.recheckNow": [{
40020
40259
  name: "deviceId",
40021
40260
  form: "single",
@@ -40277,6 +40516,11 @@ Object.freeze({
40277
40516
  form: "single",
40278
40517
  optional: false
40279
40518
  }],
40519
+ "zoneAnalytics.getCurrentSnapshotBatch": [{
40520
+ name: "deviceIds",
40521
+ form: "array",
40522
+ optional: false
40523
+ }],
40280
40524
  "zoneAnalytics.getUnzonedHistory": [{
40281
40525
  name: "deviceId",
40282
40526
  form: "single",
@@ -8221,6 +8221,20 @@ var RelocateJobSchema = object({
8221
8221
  * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8222
8222
  */
8223
8223
  rowsReconciled: number().int().nonnegative().optional(),
8224
+ /**
8225
+ * Rows this run FORGOT because the file they name is not on disk.
8226
+ *
8227
+ * The mover derived the path from the row's own fields and `stat`ed it; an
8228
+ * ENOENT there is a per-path confirmation that the segment is gone (D296),
8229
+ * and the durable row is dropped through the same channel eviction uses. It
8230
+ * is reported for the same reason `rowsReconciled` is: this is a durable
8231
+ * mutation nobody asked for, and a migration that quietly erases hour rows is
8232
+ * the same failure as one that quietly skips them (D295).
8233
+ *
8234
+ * The production drain of 2026-08-30 would have reported 11 074 here — the
8235
+ * ledger claimed 5.65 GB of footage that no longer existed.
8236
+ */
8237
+ rowsForgotten: number().int().nonnegative().optional(),
8224
8238
  startedAt: number(),
8225
8239
  finishedAt: number().nullable(),
8226
8240
  error: string().nullable()
@@ -8584,6 +8598,91 @@ var RelocateResidueSchema = object({
8584
8598
  segments: number().int().nonnegative(),
8585
8599
  bytes: number().int().nonnegative()
8586
8600
  }).nullable();
8601
+ /**
8602
+ * Ask one location whether its durable hour rows describe the disk — the walk
8603
+ * (D319).
8604
+ *
8605
+ * `apply` DEFAULTS TO FALSE and that default is the product: the operator's
8606
+ * missing tool is the question, and the dry run is how they sanity-check the
8607
+ * destructive run before authorising it.
8608
+ */
8609
+ var LedgerWalkInputSchema = object({
8610
+ locationId: string().min(1),
8611
+ /** Forget the confirmed-absent rows, rather than only counting them. */
8612
+ apply: boolean().optional(),
8613
+ /** Narrow to one camera. */
8614
+ deviceId: number().int().positive().optional(),
8615
+ /** Narrow to these recording profiles; empty/absent = every profile. */
8616
+ profiles: array(string().min(1)).optional()
8617
+ });
8618
+ /** Why a whole walk did nothing. Every one leaves the ledger untouched. */
8619
+ var LedgerWalkRefusalSchema = _enum([
8620
+ "location-unknown",
8621
+ "source-writable",
8622
+ "no-ledger",
8623
+ "archive-unreadable",
8624
+ "anchor-absent",
8625
+ "anchor-unreadable",
8626
+ "anchor-moved"
8627
+ ]);
8628
+ _enum([
8629
+ "live-tail",
8630
+ "listing-error",
8631
+ "path-mismatch",
8632
+ "durable-refused"
8633
+ ]);
8634
+ /** Every skip reason, always present, always a number — so a reason that never
8635
+ * fired reports as zero rather than absent and the report shape is constant
8636
+ * between passes. Spelled out rather than `z.record` for exactly that. */
8637
+ var LedgerWalkSkipCountsSchema = object({
8638
+ "live-tail": number().int().nonnegative(),
8639
+ "listing-error": number().int().nonnegative(),
8640
+ "path-mismatch": number().int().nonnegative(),
8641
+ "durable-refused": number().int().nonnegative()
8642
+ });
8643
+ /** One camera's share of a walk, so a report names cameras and not rows. */
8644
+ var LedgerWalkDeviceReportSchema = object({
8645
+ deviceId: number().int(),
8646
+ hoursWalked: number().int().nonnegative(),
8647
+ hoursMissing: number().int().nonnegative(),
8648
+ ghostSegments: number().int().nonnegative(),
8649
+ ghostBytes: number().int().nonnegative(),
8650
+ forgottenSegments: number().int().nonnegative(),
8651
+ orphanFiles: number().int().nonnegative()
8652
+ });
8653
+ /**
8654
+ * What one walk claimed, listed, found and (only when armed) forgot.
8655
+ *
8656
+ * `archiveSegments` is the **M** and `segmentsClaimed` the **N** (D295), so a
8657
+ * walk that saw a fraction of the location is visible in its own report rather
8658
+ * than in the absence of one.
8659
+ */
8660
+ var LedgerWalkReportSchema = object({
8661
+ locationId: string(),
8662
+ applied: boolean(),
8663
+ refused: LedgerWalkRefusalSchema.nullable(),
8664
+ archiveSegments: number().int().nonnegative().nullable(),
8665
+ archiveBytes: number().int().nonnegative().nullable(),
8666
+ hoursClaimed: number().int().nonnegative(),
8667
+ hoursWalked: number().int().nonnegative(),
8668
+ hoursMissing: number().int().nonnegative(),
8669
+ /** `readdir` calls issued — the cost, stated in the unit that is paid. */
8670
+ listings: number().int().nonnegative(),
8671
+ segmentsClaimed: number().int().nonnegative(),
8672
+ ghostSegments: number().int().nonnegative(),
8673
+ ghostBytes: number().int().nonnegative(),
8674
+ ghostHoursWhole: number().int().nonnegative(),
8675
+ forgottenSegments: number().int().nonnegative(),
8676
+ forgottenBytes: number().int().nonnegative(),
8677
+ /** Files under a claimed hour that no durable row names. Never deleted. */
8678
+ orphanFiles: number().int().nonnegative(),
8679
+ orphanSample: array(string()).readonly(),
8680
+ hoursSkipped: number().int().nonnegative(),
8681
+ skippedByReason: LedgerWalkSkipCountsSchema,
8682
+ /** The walk stopped at its per-pass hour bound with claims unwalked. */
8683
+ bounded: boolean(),
8684
+ byDevice: array(LedgerWalkDeviceReportSchema).readonly()
8685
+ });
8587
8686
  /** How many rows a media pass would still act on against a given target — the
8588
8687
  * media lane's denominator AND its residue, from ONE derivation so the two can
8589
8688
  * never disagree. `null` = the count could not be taken. */
@@ -19384,13 +19483,15 @@ var ListGroupsPageSchema = object({
19384
19483
  groups: array(AnalyticsGroupRecordSchema).readonly(),
19385
19484
  nextCursor: string().nullable()
19386
19485
  });
19486
+ var KEY_EVENTS_DEFAULT_LIMIT = 50;
19487
+ var KEY_EVENTS_MAX_LIMIT = 200;
19387
19488
  var KeyEventQueryInput = object({
19388
19489
  deviceId: number(),
19389
19490
  /** Window lower bound (track firstSeen ≥ since). */
19390
19491
  since: number(),
19391
19492
  /** Window upper bound (track firstSeen ≤ until). */
19392
19493
  until: number(),
19393
- limit: number().int().min(1).max(200).default(50),
19494
+ limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
19394
19495
  /** Drop tracks scoring below this importance. */
19395
19496
  minImportance: number().min(0).max(1).optional(),
19396
19497
  /** Restrict to a single class (e.g. 'person'). */
@@ -19412,6 +19513,32 @@ var KeyEventSchema = object({
19412
19513
  ...TrackFlagFields,
19413
19514
  ...TrackRetrainFields
19414
19515
  });
19516
+ /** `getKeyEvents`' window and filters, asked of a SET of cameras at once. */
19517
+ var KeyEventBatchQueryInput = object({
19518
+ deviceIds: array(number()).min(1).max(200),
19519
+ since: number(),
19520
+ until: number(),
19521
+ /** Applied PER CAMERA, exactly as `getKeyEvents.limit` is — never a total
19522
+ * across the set, which would let a busy camera starve a quiet one of its
19523
+ * rows and change what the merged feed contains. */
19524
+ limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
19525
+ minImportance: number().min(0).max(1).optional(),
19526
+ classFilter: string().optional()
19527
+ });
19528
+ /**
19529
+ * One camera's key events in a batch answer.
19530
+ *
19531
+ * The row exists for every requested id. `getKeyEvents` degrades to `[]` on
19532
+ * error rather than throwing, so a camera whose store read failed and one with
19533
+ * no events in the window were ALREADY indistinguishable per camera — the
19534
+ * batch does not make that worse, and the row keeps the deviceId the single
19535
+ * method's output never carried (the caller used to stamp it from the fan-out
19536
+ * key, which only worked because there was one query per camera).
19537
+ */
19538
+ var KeyEventsForDeviceSchema = object({
19539
+ deviceId: number(),
19540
+ events: array(KeyEventSchema).readonly()
19541
+ });
19415
19542
  object({
19416
19543
  trackId: string(),
19417
19544
  className: string(),
@@ -19681,7 +19808,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19681
19808
  until: number().optional(),
19682
19809
  kinds: array(string()).optional(),
19683
19810
  limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19684
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19811
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()), method(object({
19685
19812
  deviceId: number(),
19686
19813
  since: number(),
19687
19814
  until: number(),
@@ -29137,6 +29264,9 @@ method(object({
29137
29264
  }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
29138
29265
  kind: "query",
29139
29266
  auth: "admin"
29267
+ }), method(LedgerWalkInputSchema, LedgerWalkReportSchema, {
29268
+ kind: "mutation",
29269
+ auth: "admin"
29140
29270
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
29141
29271
  kind: "mutation",
29142
29272
  auth: "admin"
@@ -29528,6 +29658,25 @@ var SceneMonitorStatusSchema = object({
29528
29658
  monitors: array(SceneMonitorSchema),
29529
29659
  lastFetchedAt: number()
29530
29660
  });
29661
+ /**
29662
+ * One camera's row in a `listScenesBatch` answer.
29663
+ *
29664
+ * `status` is NULLABLE and the nullability is the whole point. `scene-monitor`
29665
+ * is a `defaultActive` wrapper, so every camera is asked; a camera whose
29666
+ * provider is absent (pipeline-analytics not deployed, the post-processing node
29667
+ * down) cannot answer, and that is not the same fact as a camera with no scenes
29668
+ * configured. Fanned out per camera the difference was visible — one query
29669
+ * errored while the others resolved — and a batch that returned only the rows
29670
+ * it managed would have destroyed it, silently, by making an unreachable camera
29671
+ * indistinguishable from one that answered `monitors: []`.
29672
+ *
29673
+ * So: EVERY requested deviceId gets a row. `status: null` means "this camera
29674
+ * could not be read"; `status.monitors: []` means "read, and it has none".
29675
+ */
29676
+ var SceneMonitorStatusForDeviceSchema = object({
29677
+ deviceId: number(),
29678
+ status: SceneMonitorStatusSchema.nullable()
29679
+ });
29531
29680
  var sceneMonitorCapability = {
29532
29681
  name: "scene-monitor",
29533
29682
  scope: "device",
@@ -29537,6 +29686,22 @@ var sceneMonitorCapability = {
29537
29686
  deviceTypes: [DeviceType.Camera],
29538
29687
  methods: {
29539
29688
  listScenes: method(object({ deviceId: number() }), SceneMonitorStatusSchema),
29689
+ /**
29690
+ * The same answer, for a SET of cameras, in one round trip.
29691
+ *
29692
+ * `/scenes` renders every camera and re-reads them on a 30s safety-net
29693
+ * poll behind the push slice. Fanned out client-side that was one query
29694
+ * per camera — 29 round trips through the browser, the hub and the
29695
+ * post-analysis runner every 30 seconds to read an in-memory map the
29696
+ * owner had already merged. The work is unchanged (`statusFor` per
29697
+ * device, all in-process at the owner); what collapses is the transport.
29698
+ *
29699
+ * A camera that cannot answer still gets a row, with `status: null` —
29700
+ * see {@link SceneMonitorStatusForDeviceSchema}. Never fewer rows than
29701
+ * ids: a caller that asked for twenty-nine and got twenty-seven cannot
29702
+ * tell which two are missing, or that any are.
29703
+ */
29704
+ listScenesBatch: method(object({ deviceIds: array(number()).min(1).max(200) }), array(SceneMonitorStatusForDeviceSchema).readonly()),
29540
29705
  createScene: method(object({
29541
29706
  deviceId: number(),
29542
29707
  label: string(),
@@ -31372,6 +31537,27 @@ var CameraOccupancySnapshotSchema = object({
31372
31537
  stationaryObjects: array(StationaryObjectSchema).readonly().optional()
31373
31538
  });
31374
31539
  /**
31540
+ * One camera's row in a `getCurrentSnapshotBatch` answer.
31541
+ *
31542
+ * THREE outcomes, and the single-camera method could only express two of them
31543
+ * because `snapshot: null` was already spoken for:
31544
+ *
31545
+ * - `read: 'read'`, `snapshot` present — the live occupancy reading.
31546
+ * - `read: 'read'`, `snapshot: null` — read, and this camera has no reading
31547
+ * yet: no frame since boot, and no parked-object registry to hydrate from.
31548
+ * - `read: 'unreadable'` — the owner could not answer for this
31549
+ * camera. `snapshot` is null, and it does NOT mean "nothing parked here".
31550
+ *
31551
+ * Collapsing the last two is the failure this field exists to prevent: a
31552
+ * hydration that threw would otherwise render as an empty Stationary section,
31553
+ * which is a definite claim about a camera nobody could read.
31554
+ */
31555
+ var CameraOccupancySnapshotForDeviceSchema = object({
31556
+ deviceId: number(),
31557
+ read: _enum(["read", "unreadable"]),
31558
+ snapshot: CameraOccupancySnapshotSchema.nullable()
31559
+ });
31560
+ /**
31375
31561
  * Time-series resolution. The history methods return one bucket per
31376
31562
  * step over the requested range. Smaller resolutions cost more
31377
31563
  * memory + bandwidth; bound to discrete steps so caller cannot ask
@@ -31428,6 +31614,20 @@ var zoneAnalyticsCapability = {
31428
31614
  * (no inference result emitted since boot or since binding was
31429
31615
  * activated). */
31430
31616
  getCurrentSnapshot: method(object({ deviceId: number() }), CameraOccupancySnapshotSchema.nullable()),
31617
+ /**
31618
+ * The same snapshot, for a SET of cameras, in one round trip.
31619
+ *
31620
+ * The Events page's Stationary section polls this every 15s for every
31621
+ * selected camera. Fanned out client-side that is one query per camera to
31622
+ * read a `Map.get` at the owner — the answer costs nothing, the round trip
31623
+ * costs everything. Batched, N transports become one and the per-device
31624
+ * work is unchanged.
31625
+ *
31626
+ * Every requested deviceId gets a row, tagged `read` — see
31627
+ * {@link CameraOccupancySnapshotForDeviceSchema}. A camera the owner could
31628
+ * not answer for is `'unreadable'`, never an empty reading.
31629
+ */
31630
+ getCurrentSnapshotBatch: method(object({ deviceIds: array(number()).min(1).max(200) }), array(CameraOccupancySnapshotForDeviceSchema).readonly()),
31431
31631
  /** Time-series object count inside one zone. `className` optional —
31432
31632
  * omit to count every class in the zone. */
31433
31633
  getZoneHistory: method(object({
@@ -35849,6 +36049,12 @@ Object.freeze({
35849
36049
  addonId: null,
35850
36050
  access: "view"
35851
36051
  },
36052
+ "pipelineAnalytics.getKeyEventsBatch": {
36053
+ capName: "pipeline-analytics",
36054
+ capScope: "device",
36055
+ addonId: null,
36056
+ access: "view"
36057
+ },
35852
36058
  "pipelineAnalytics.getMotionEvents": {
35853
36059
  capName: "pipeline-analytics",
35854
36060
  capScope: "device",
@@ -37025,6 +37231,12 @@ Object.freeze({
37025
37231
  addonId: null,
37026
37232
  access: "view"
37027
37233
  },
37234
+ "recording.reconcileLedgerAgainstDisk": {
37235
+ capName: "recording",
37236
+ capScope: "system",
37237
+ addonId: null,
37238
+ access: "create"
37239
+ },
37028
37240
  "recording.refreshStorageLocationsForMigration": {
37029
37241
  capName: "recording",
37030
37242
  capScope: "system",
@@ -37151,6 +37363,12 @@ Object.freeze({
37151
37363
  addonId: null,
37152
37364
  access: "view"
37153
37365
  },
37366
+ "sceneMonitor.listScenesBatch": {
37367
+ capName: "scene-monitor",
37368
+ capScope: "device",
37369
+ addonId: null,
37370
+ access: "view"
37371
+ },
37154
37372
  "sceneMonitor.recheckNow": {
37155
37373
  capName: "scene-monitor",
37156
37374
  capScope: "device",
@@ -38507,6 +38725,12 @@ Object.freeze({
38507
38725
  addonId: null,
38508
38726
  access: "view"
38509
38727
  },
38728
+ "zoneAnalytics.getCurrentSnapshotBatch": {
38729
+ capName: "zone-analytics",
38730
+ capScope: "device",
38731
+ addonId: null,
38732
+ access: "view"
38733
+ },
38510
38734
  "zoneAnalytics.getUnzonedHistory": {
38511
38735
  capName: "zone-analytics",
38512
38736
  capScope: "device",
@@ -39511,6 +39735,11 @@ Object.freeze({
39511
39735
  form: "single",
39512
39736
  optional: false
39513
39737
  }],
39738
+ "pipelineAnalytics.getKeyEventsBatch": [{
39739
+ name: "deviceIds",
39740
+ form: "array",
39741
+ optional: false
39742
+ }],
39514
39743
  "pipelineAnalytics.getMotionEvents": [{
39515
39744
  name: "deviceId",
39516
39745
  form: "single",
@@ -39951,6 +40180,11 @@ Object.freeze({
39951
40180
  form: "single",
39952
40181
  optional: false
39953
40182
  }],
40183
+ "recording.reconcileLedgerAgainstDisk": [{
40184
+ name: "deviceId",
40185
+ form: "single",
40186
+ optional: true
40187
+ }],
39954
40188
  "recording.relocateFootage": [{
39955
40189
  name: "deviceId",
39956
40190
  form: "single",
@@ -40016,6 +40250,11 @@ Object.freeze({
40016
40250
  form: "single",
40017
40251
  optional: false
40018
40252
  }],
40253
+ "sceneMonitor.listScenesBatch": [{
40254
+ name: "deviceIds",
40255
+ form: "array",
40256
+ optional: false
40257
+ }],
40019
40258
  "sceneMonitor.recheckNow": [{
40020
40259
  name: "deviceId",
40021
40260
  form: "single",
@@ -40277,6 +40516,11 @@ Object.freeze({
40277
40516
  form: "single",
40278
40517
  optional: false
40279
40518
  }],
40519
+ "zoneAnalytics.getCurrentSnapshotBatch": [{
40520
+ name: "deviceIds",
40521
+ form: "array",
40522
+ optional: false
40523
+ }],
40280
40524
  "zoneAnalytics.getUnzonedHistory": [{
40281
40525
  name: "deviceId",
40282
40526
  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-C9c_O8wh.js");
6
+ const require_dist = require("../dist-u1L6UZmY.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-DoPggq1j.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-DV4Xqi_x.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.61",
3
+ "version": "1.2.62",
4
4
  "description": "Home Assistant device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",