@camstack/addon-mqtt-broker 1.2.47 → 1.2.49

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.
@@ -8047,6 +8047,20 @@ var RelocateJobSchema = object({
8047
8047
  * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8048
8048
  */
8049
8049
  rowsReconciled: number().int().nonnegative().optional(),
8050
+ /**
8051
+ * Rows this run FORGOT because the file they name is not on disk.
8052
+ *
8053
+ * The mover derived the path from the row's own fields and `stat`ed it; an
8054
+ * ENOENT there is a per-path confirmation that the segment is gone (D296),
8055
+ * and the durable row is dropped through the same channel eviction uses. It
8056
+ * is reported for the same reason `rowsReconciled` is: this is a durable
8057
+ * mutation nobody asked for, and a migration that quietly erases hour rows is
8058
+ * the same failure as one that quietly skips them (D295).
8059
+ *
8060
+ * The production drain of 2026-08-30 would have reported 11 074 here — the
8061
+ * ledger claimed 5.65 GB of footage that no longer existed.
8062
+ */
8063
+ rowsForgotten: number().int().nonnegative().optional(),
8050
8064
  startedAt: number(),
8051
8065
  finishedAt: number().nullable(),
8052
8066
  error: string().nullable()
@@ -8410,6 +8424,91 @@ var RelocateResidueSchema = object({
8410
8424
  segments: number().int().nonnegative(),
8411
8425
  bytes: number().int().nonnegative()
8412
8426
  }).nullable();
8427
+ /**
8428
+ * Ask one location whether its durable hour rows describe the disk — the walk
8429
+ * (D319).
8430
+ *
8431
+ * `apply` DEFAULTS TO FALSE and that default is the product: the operator's
8432
+ * missing tool is the question, and the dry run is how they sanity-check the
8433
+ * destructive run before authorising it.
8434
+ */
8435
+ var LedgerWalkInputSchema = object({
8436
+ locationId: string().min(1),
8437
+ /** Forget the confirmed-absent rows, rather than only counting them. */
8438
+ apply: boolean().optional(),
8439
+ /** Narrow to one camera. */
8440
+ deviceId: number().int().positive().optional(),
8441
+ /** Narrow to these recording profiles; empty/absent = every profile. */
8442
+ profiles: array(string().min(1)).optional()
8443
+ });
8444
+ /** Why a whole walk did nothing. Every one leaves the ledger untouched. */
8445
+ var LedgerWalkRefusalSchema = _enum([
8446
+ "location-unknown",
8447
+ "source-writable",
8448
+ "no-ledger",
8449
+ "archive-unreadable",
8450
+ "anchor-absent",
8451
+ "anchor-unreadable",
8452
+ "anchor-moved"
8453
+ ]);
8454
+ _enum([
8455
+ "live-tail",
8456
+ "listing-error",
8457
+ "path-mismatch",
8458
+ "durable-refused"
8459
+ ]);
8460
+ /** Every skip reason, always present, always a number — so a reason that never
8461
+ * fired reports as zero rather than absent and the report shape is constant
8462
+ * between passes. Spelled out rather than `z.record` for exactly that. */
8463
+ var LedgerWalkSkipCountsSchema = object({
8464
+ "live-tail": number().int().nonnegative(),
8465
+ "listing-error": number().int().nonnegative(),
8466
+ "path-mismatch": number().int().nonnegative(),
8467
+ "durable-refused": number().int().nonnegative()
8468
+ });
8469
+ /** One camera's share of a walk, so a report names cameras and not rows. */
8470
+ var LedgerWalkDeviceReportSchema = object({
8471
+ deviceId: number().int(),
8472
+ hoursWalked: number().int().nonnegative(),
8473
+ hoursMissing: number().int().nonnegative(),
8474
+ ghostSegments: number().int().nonnegative(),
8475
+ ghostBytes: number().int().nonnegative(),
8476
+ forgottenSegments: number().int().nonnegative(),
8477
+ orphanFiles: number().int().nonnegative()
8478
+ });
8479
+ /**
8480
+ * What one walk claimed, listed, found and (only when armed) forgot.
8481
+ *
8482
+ * `archiveSegments` is the **M** and `segmentsClaimed` the **N** (D295), so a
8483
+ * walk that saw a fraction of the location is visible in its own report rather
8484
+ * than in the absence of one.
8485
+ */
8486
+ var LedgerWalkReportSchema = object({
8487
+ locationId: string(),
8488
+ applied: boolean(),
8489
+ refused: LedgerWalkRefusalSchema.nullable(),
8490
+ archiveSegments: number().int().nonnegative().nullable(),
8491
+ archiveBytes: number().int().nonnegative().nullable(),
8492
+ hoursClaimed: number().int().nonnegative(),
8493
+ hoursWalked: number().int().nonnegative(),
8494
+ hoursMissing: number().int().nonnegative(),
8495
+ /** `readdir` calls issued — the cost, stated in the unit that is paid. */
8496
+ listings: number().int().nonnegative(),
8497
+ segmentsClaimed: number().int().nonnegative(),
8498
+ ghostSegments: number().int().nonnegative(),
8499
+ ghostBytes: number().int().nonnegative(),
8500
+ ghostHoursWhole: number().int().nonnegative(),
8501
+ forgottenSegments: number().int().nonnegative(),
8502
+ forgottenBytes: number().int().nonnegative(),
8503
+ /** Files under a claimed hour that no durable row names. Never deleted. */
8504
+ orphanFiles: number().int().nonnegative(),
8505
+ orphanSample: array(string()).readonly(),
8506
+ hoursSkipped: number().int().nonnegative(),
8507
+ skippedByReason: LedgerWalkSkipCountsSchema,
8508
+ /** The walk stopped at its per-pass hour bound with claims unwalked. */
8509
+ bounded: boolean(),
8510
+ byDevice: array(LedgerWalkDeviceReportSchema).readonly()
8511
+ });
8413
8512
  /** How many rows a media pass would still act on against a given target — the
8414
8513
  * media lane's denominator AND its residue, from ONE derivation so the two can
8415
8514
  * never disagree. `null` = the count could not be taken. */
@@ -18751,13 +18850,15 @@ var ListGroupsPageSchema = object({
18751
18850
  groups: array(AnalyticsGroupRecordSchema).readonly(),
18752
18851
  nextCursor: string().nullable()
18753
18852
  });
18853
+ var KEY_EVENTS_DEFAULT_LIMIT = 50;
18854
+ var KEY_EVENTS_MAX_LIMIT = 200;
18754
18855
  var KeyEventQueryInput = object({
18755
18856
  deviceId: number(),
18756
18857
  /** Window lower bound (track firstSeen ≥ since). */
18757
18858
  since: number(),
18758
18859
  /** Window upper bound (track firstSeen ≤ until). */
18759
18860
  until: number(),
18760
- limit: number().int().min(1).max(200).default(50),
18861
+ limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
18761
18862
  /** Drop tracks scoring below this importance. */
18762
18863
  minImportance: number().min(0).max(1).optional(),
18763
18864
  /** Restrict to a single class (e.g. 'person'). */
@@ -18779,6 +18880,32 @@ var KeyEventSchema = object({
18779
18880
  ...TrackFlagFields,
18780
18881
  ...TrackRetrainFields
18781
18882
  });
18883
+ /** `getKeyEvents`' window and filters, asked of a SET of cameras at once. */
18884
+ var KeyEventBatchQueryInput = object({
18885
+ deviceIds: array(number()).min(1).max(200),
18886
+ since: number(),
18887
+ until: number(),
18888
+ /** Applied PER CAMERA, exactly as `getKeyEvents.limit` is — never a total
18889
+ * across the set, which would let a busy camera starve a quiet one of its
18890
+ * rows and change what the merged feed contains. */
18891
+ limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
18892
+ minImportance: number().min(0).max(1).optional(),
18893
+ classFilter: string().optional()
18894
+ });
18895
+ /**
18896
+ * One camera's key events in a batch answer.
18897
+ *
18898
+ * The row exists for every requested id. `getKeyEvents` degrades to `[]` on
18899
+ * error rather than throwing, so a camera whose store read failed and one with
18900
+ * no events in the window were ALREADY indistinguishable per camera — the
18901
+ * batch does not make that worse, and the row keeps the deviceId the single
18902
+ * method's output never carried (the caller used to stamp it from the fan-out
18903
+ * key, which only worked because there was one query per camera).
18904
+ */
18905
+ var KeyEventsForDeviceSchema = object({
18906
+ deviceId: number(),
18907
+ events: array(KeyEventSchema).readonly()
18908
+ });
18782
18909
  object({
18783
18910
  trackId: string(),
18784
18911
  className: string(),
@@ -18850,6 +18977,50 @@ var EventStoreFootprintSchema = object({
18850
18977
  totalBytes: number().int(),
18851
18978
  devices: array(EventStoreDeviceFootprintSchema).readonly()
18852
18979
  });
18980
+ /** Event-media footprint for one {@link MediaFileKind}. */
18981
+ var EventMediaKindFootprintSchema = object({
18982
+ kind: MediaFileKindEnum,
18983
+ /** Media rows of this kind. */
18984
+ rows: number().int(),
18985
+ /** Bytes on disk held by those rows. */
18986
+ bytes: number().int()
18987
+ });
18988
+ /**
18989
+ * The media footprint broken down by KIND — the axis a deletion decision
18990
+ * actually turns on.
18991
+ *
18992
+ * A byte total says how much there is; it cannot say what is safe to remove.
18993
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
18994
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
18995
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
18996
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
18997
+ * nothing else, so sizing a deletion means summing per kind.
18998
+ *
18999
+ * ## Why `unaccounted*` exists
19000
+ *
19001
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
19002
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
19003
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
19004
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
19005
+ * retired code path, or by a version that knew a kind this one does not) would
19006
+ * otherwise vanish from the total silently, and an operator would delete
19007
+ * against a denominator smaller than the disk.
19008
+ *
19009
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
19010
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
19011
+ */
19012
+ var EventMediaKindBreakdownSchema = object({
19013
+ /** Every media row in scope, from one unfiltered aggregate. */
19014
+ totalRows: number().int(),
19015
+ /** Every media byte in scope, from that same aggregate. */
19016
+ totalBytes: number().int(),
19017
+ /** Per-kind footprint, ordered by bytes descending. */
19018
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
19019
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
19020
+ unaccountedRows: number().int(),
19021
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
19022
+ unaccountedBytes: number().int()
19023
+ });
18853
19024
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
18854
19025
  var EventPruneCountsSchema = object({
18855
19026
  motion: number().int(),
@@ -19004,7 +19175,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19004
19175
  until: number().optional(),
19005
19176
  kinds: array(string()).optional(),
19006
19177
  limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19007
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19178
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()), method(object({
19008
19179
  deviceId: number(),
19009
19180
  since: number(),
19010
19181
  until: number(),
@@ -19053,6 +19224,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19053
19224
  }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
19054
19225
  kind: "query",
19055
19226
  auth: "admin"
19227
+ }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
19228
+ kind: "query",
19229
+ auth: "admin"
19056
19230
  }), method(object({
19057
19231
  olderThanMs: number(),
19058
19232
  reason: OpsLogReasonSchema.optional()
@@ -21004,6 +21178,20 @@ method(object({
21004
21178
  error: string().optional()
21005
21179
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
21006
21180
  providerId: string(),
21181
+ /**
21182
+ * The location this config is an UNSAVED edit of, when there is one.
21183
+ *
21184
+ * `listLocations` replaces every declared secret with the redaction
21185
+ * sentinel, so the edit modal's form state holds the sentinel for any
21186
+ * credential the operator did not retype — and posting that here
21187
+ * without a way to resolve it makes the provider try to authenticate
21188
+ * as `__camstack_redacted__` and report the operator's own working
21189
+ * password as wrong. Given this id, the orchestrator restores each
21190
+ * sentinel from the stored config (same rule as `upsertLocation`)
21191
+ * before dispatching. Omitted by the "Add location" wizard, where
21192
+ * every value was typed just now and nothing is stored yet.
21193
+ */
21194
+ locationId: string().optional(),
21007
21195
  config: record(string(), unknown())
21008
21196
  }), object({
21009
21197
  ok: boolean(),
@@ -26639,6 +26827,9 @@ method(object({
26639
26827
  }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26640
26828
  kind: "query",
26641
26829
  auth: "admin"
26830
+ }), method(LedgerWalkInputSchema, LedgerWalkReportSchema, {
26831
+ kind: "mutation",
26832
+ auth: "admin"
26642
26833
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26643
26834
  kind: "mutation",
26644
26835
  auth: "admin"
@@ -27030,7 +27221,26 @@ var SceneMonitorStatusSchema = object({
27030
27221
  monitors: array(SceneMonitorSchema),
27031
27222
  lastFetchedAt: number()
27032
27223
  });
27033
- DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSchema), method(object({
27224
+ /**
27225
+ * One camera's row in a `listScenesBatch` answer.
27226
+ *
27227
+ * `status` is NULLABLE and the nullability is the whole point. `scene-monitor`
27228
+ * is a `defaultActive` wrapper, so every camera is asked; a camera whose
27229
+ * provider is absent (pipeline-analytics not deployed, the post-processing node
27230
+ * down) cannot answer, and that is not the same fact as a camera with no scenes
27231
+ * configured. Fanned out per camera the difference was visible — one query
27232
+ * errored while the others resolved — and a batch that returned only the rows
27233
+ * it managed would have destroyed it, silently, by making an unreachable camera
27234
+ * indistinguishable from one that answered `monitors: []`.
27235
+ *
27236
+ * So: EVERY requested deviceId gets a row. `status: null` means "this camera
27237
+ * could not be read"; `status.monitors: []` means "read, and it has none".
27238
+ */
27239
+ var SceneMonitorStatusForDeviceSchema = object({
27240
+ deviceId: number(),
27241
+ status: SceneMonitorStatusSchema.nullable()
27242
+ });
27243
+ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSchema), method(object({ deviceIds: array(number()).min(1).max(200) }), array(SceneMonitorStatusForDeviceSchema).readonly()), method(object({
27034
27244
  deviceId: number(),
27035
27245
  label: string(),
27036
27246
  roi: MaskRectShapeSchema,
@@ -28354,6 +28564,27 @@ var CameraOccupancySnapshotSchema = object({
28354
28564
  stationaryObjects: array(StationaryObjectSchema).readonly().optional()
28355
28565
  });
28356
28566
  /**
28567
+ * One camera's row in a `getCurrentSnapshotBatch` answer.
28568
+ *
28569
+ * THREE outcomes, and the single-camera method could only express two of them
28570
+ * because `snapshot: null` was already spoken for:
28571
+ *
28572
+ * - `read: 'read'`, `snapshot` present — the live occupancy reading.
28573
+ * - `read: 'read'`, `snapshot: null` — read, and this camera has no reading
28574
+ * yet: no frame since boot, and no parked-object registry to hydrate from.
28575
+ * - `read: 'unreadable'` — the owner could not answer for this
28576
+ * camera. `snapshot` is null, and it does NOT mean "nothing parked here".
28577
+ *
28578
+ * Collapsing the last two is the failure this field exists to prevent: a
28579
+ * hydration that threw would otherwise render as an empty Stationary section,
28580
+ * which is a definite claim about a camera nobody could read.
28581
+ */
28582
+ var CameraOccupancySnapshotForDeviceSchema = object({
28583
+ deviceId: number(),
28584
+ read: _enum(["read", "unreadable"]),
28585
+ snapshot: CameraOccupancySnapshotSchema.nullable()
28586
+ });
28587
+ /**
28357
28588
  * Time-series resolution. The history methods return one bucket per
28358
28589
  * step over the requested range. Smaller resolutions cost more
28359
28590
  * memory + bandwidth; bound to discrete steps so caller cannot ask
@@ -28377,7 +28608,7 @@ var HistoryPointSchema = object({
28377
28608
  /** Object count averaged over the bucket (rounded to nearest integer). */
28378
28609
  count: number().int().nonnegative()
28379
28610
  });
28380
- DeviceType.Camera, method(object({ deviceId: number() }), CameraOccupancySnapshotSchema.nullable()), method(object({
28611
+ DeviceType.Camera, method(object({ deviceId: number() }), CameraOccupancySnapshotSchema.nullable()), method(object({ deviceIds: array(number()).min(1).max(200) }), array(CameraOccupancySnapshotForDeviceSchema).readonly()), method(object({
28381
28612
  deviceId: number(),
28382
28613
  zoneId: string(),
28383
28614
  className: string().optional()
@@ -31658,6 +31889,12 @@ Object.freeze({
31658
31889
  addonId: null,
31659
31890
  access: "view"
31660
31891
  },
31892
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
31893
+ capName: "pipeline-analytics",
31894
+ capScope: "device",
31895
+ addonId: null,
31896
+ access: "view"
31897
+ },
31661
31898
  "pipelineAnalytics.getEventStoreFootprint": {
31662
31899
  capName: "pipeline-analytics",
31663
31900
  capScope: "device",
@@ -31676,6 +31913,12 @@ Object.freeze({
31676
31913
  addonId: null,
31677
31914
  access: "view"
31678
31915
  },
31916
+ "pipelineAnalytics.getKeyEventsBatch": {
31917
+ capName: "pipeline-analytics",
31918
+ capScope: "device",
31919
+ addonId: null,
31920
+ access: "view"
31921
+ },
31679
31922
  "pipelineAnalytics.getMotionEvents": {
31680
31923
  capName: "pipeline-analytics",
31681
31924
  capScope: "device",
@@ -32852,6 +33095,12 @@ Object.freeze({
32852
33095
  addonId: null,
32853
33096
  access: "view"
32854
33097
  },
33098
+ "recording.reconcileLedgerAgainstDisk": {
33099
+ capName: "recording",
33100
+ capScope: "system",
33101
+ addonId: null,
33102
+ access: "create"
33103
+ },
32855
33104
  "recording.refreshStorageLocationsForMigration": {
32856
33105
  capName: "recording",
32857
33106
  capScope: "system",
@@ -32978,6 +33227,12 @@ Object.freeze({
32978
33227
  addonId: null,
32979
33228
  access: "view"
32980
33229
  },
33230
+ "sceneMonitor.listScenesBatch": {
33231
+ capName: "scene-monitor",
33232
+ capScope: "device",
33233
+ addonId: null,
33234
+ access: "view"
33235
+ },
32981
33236
  "sceneMonitor.recheckNow": {
32982
33237
  capName: "scene-monitor",
32983
33238
  capScope: "device",
@@ -34334,6 +34589,12 @@ Object.freeze({
34334
34589
  addonId: null,
34335
34590
  access: "view"
34336
34591
  },
34592
+ "zoneAnalytics.getCurrentSnapshotBatch": {
34593
+ capName: "zone-analytics",
34594
+ capScope: "device",
34595
+ addonId: null,
34596
+ access: "view"
34597
+ },
34337
34598
  "zoneAnalytics.getUnzonedHistory": {
34338
34599
  capName: "zone-analytics",
34339
34600
  capScope: "device",
@@ -35323,6 +35584,11 @@ Object.freeze({
35323
35584
  form: "single",
35324
35585
  optional: false
35325
35586
  }],
35587
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
35588
+ name: "deviceId",
35589
+ form: "single",
35590
+ optional: true
35591
+ }],
35326
35592
  "pipelineAnalytics.getGroup": [{
35327
35593
  name: "deviceId",
35328
35594
  form: "single",
@@ -35333,6 +35599,11 @@ Object.freeze({
35333
35599
  form: "single",
35334
35600
  optional: false
35335
35601
  }],
35602
+ "pipelineAnalytics.getKeyEventsBatch": [{
35603
+ name: "deviceIds",
35604
+ form: "array",
35605
+ optional: false
35606
+ }],
35336
35607
  "pipelineAnalytics.getMotionEvents": [{
35337
35608
  name: "deviceId",
35338
35609
  form: "single",
@@ -35773,6 +36044,11 @@ Object.freeze({
35773
36044
  form: "single",
35774
36045
  optional: false
35775
36046
  }],
36047
+ "recording.reconcileLedgerAgainstDisk": [{
36048
+ name: "deviceId",
36049
+ form: "single",
36050
+ optional: true
36051
+ }],
35776
36052
  "recording.relocateFootage": [{
35777
36053
  name: "deviceId",
35778
36054
  form: "single",
@@ -35838,6 +36114,11 @@ Object.freeze({
35838
36114
  form: "single",
35839
36115
  optional: false
35840
36116
  }],
36117
+ "sceneMonitor.listScenesBatch": [{
36118
+ name: "deviceIds",
36119
+ form: "array",
36120
+ optional: false
36121
+ }],
35841
36122
  "sceneMonitor.recheckNow": [{
35842
36123
  name: "deviceId",
35843
36124
  form: "single",
@@ -36099,6 +36380,11 @@ Object.freeze({
36099
36380
  form: "single",
36100
36381
  optional: false
36101
36382
  }],
36383
+ "zoneAnalytics.getCurrentSnapshotBatch": [{
36384
+ name: "deviceIds",
36385
+ form: "array",
36386
+ optional: false
36387
+ }],
36102
36388
  "zoneAnalytics.getUnzonedHistory": [{
36103
36389
  name: "deviceId",
36104
36390
  form: "single",
@@ -8042,6 +8042,20 @@ var RelocateJobSchema = object({
8042
8042
  * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8043
8043
  */
8044
8044
  rowsReconciled: number().int().nonnegative().optional(),
8045
+ /**
8046
+ * Rows this run FORGOT because the file they name is not on disk.
8047
+ *
8048
+ * The mover derived the path from the row's own fields and `stat`ed it; an
8049
+ * ENOENT there is a per-path confirmation that the segment is gone (D296),
8050
+ * and the durable row is dropped through the same channel eviction uses. It
8051
+ * is reported for the same reason `rowsReconciled` is: this is a durable
8052
+ * mutation nobody asked for, and a migration that quietly erases hour rows is
8053
+ * the same failure as one that quietly skips them (D295).
8054
+ *
8055
+ * The production drain of 2026-08-30 would have reported 11 074 here — the
8056
+ * ledger claimed 5.65 GB of footage that no longer existed.
8057
+ */
8058
+ rowsForgotten: number().int().nonnegative().optional(),
8045
8059
  startedAt: number(),
8046
8060
  finishedAt: number().nullable(),
8047
8061
  error: string().nullable()
@@ -8405,6 +8419,91 @@ var RelocateResidueSchema = object({
8405
8419
  segments: number().int().nonnegative(),
8406
8420
  bytes: number().int().nonnegative()
8407
8421
  }).nullable();
8422
+ /**
8423
+ * Ask one location whether its durable hour rows describe the disk — the walk
8424
+ * (D319).
8425
+ *
8426
+ * `apply` DEFAULTS TO FALSE and that default is the product: the operator's
8427
+ * missing tool is the question, and the dry run is how they sanity-check the
8428
+ * destructive run before authorising it.
8429
+ */
8430
+ var LedgerWalkInputSchema = object({
8431
+ locationId: string().min(1),
8432
+ /** Forget the confirmed-absent rows, rather than only counting them. */
8433
+ apply: boolean().optional(),
8434
+ /** Narrow to one camera. */
8435
+ deviceId: number().int().positive().optional(),
8436
+ /** Narrow to these recording profiles; empty/absent = every profile. */
8437
+ profiles: array(string().min(1)).optional()
8438
+ });
8439
+ /** Why a whole walk did nothing. Every one leaves the ledger untouched. */
8440
+ var LedgerWalkRefusalSchema = _enum([
8441
+ "location-unknown",
8442
+ "source-writable",
8443
+ "no-ledger",
8444
+ "archive-unreadable",
8445
+ "anchor-absent",
8446
+ "anchor-unreadable",
8447
+ "anchor-moved"
8448
+ ]);
8449
+ _enum([
8450
+ "live-tail",
8451
+ "listing-error",
8452
+ "path-mismatch",
8453
+ "durable-refused"
8454
+ ]);
8455
+ /** Every skip reason, always present, always a number — so a reason that never
8456
+ * fired reports as zero rather than absent and the report shape is constant
8457
+ * between passes. Spelled out rather than `z.record` for exactly that. */
8458
+ var LedgerWalkSkipCountsSchema = object({
8459
+ "live-tail": number().int().nonnegative(),
8460
+ "listing-error": number().int().nonnegative(),
8461
+ "path-mismatch": number().int().nonnegative(),
8462
+ "durable-refused": number().int().nonnegative()
8463
+ });
8464
+ /** One camera's share of a walk, so a report names cameras and not rows. */
8465
+ var LedgerWalkDeviceReportSchema = object({
8466
+ deviceId: number().int(),
8467
+ hoursWalked: number().int().nonnegative(),
8468
+ hoursMissing: number().int().nonnegative(),
8469
+ ghostSegments: number().int().nonnegative(),
8470
+ ghostBytes: number().int().nonnegative(),
8471
+ forgottenSegments: number().int().nonnegative(),
8472
+ orphanFiles: number().int().nonnegative()
8473
+ });
8474
+ /**
8475
+ * What one walk claimed, listed, found and (only when armed) forgot.
8476
+ *
8477
+ * `archiveSegments` is the **M** and `segmentsClaimed` the **N** (D295), so a
8478
+ * walk that saw a fraction of the location is visible in its own report rather
8479
+ * than in the absence of one.
8480
+ */
8481
+ var LedgerWalkReportSchema = object({
8482
+ locationId: string(),
8483
+ applied: boolean(),
8484
+ refused: LedgerWalkRefusalSchema.nullable(),
8485
+ archiveSegments: number().int().nonnegative().nullable(),
8486
+ archiveBytes: number().int().nonnegative().nullable(),
8487
+ hoursClaimed: number().int().nonnegative(),
8488
+ hoursWalked: number().int().nonnegative(),
8489
+ hoursMissing: number().int().nonnegative(),
8490
+ /** `readdir` calls issued — the cost, stated in the unit that is paid. */
8491
+ listings: number().int().nonnegative(),
8492
+ segmentsClaimed: number().int().nonnegative(),
8493
+ ghostSegments: number().int().nonnegative(),
8494
+ ghostBytes: number().int().nonnegative(),
8495
+ ghostHoursWhole: number().int().nonnegative(),
8496
+ forgottenSegments: number().int().nonnegative(),
8497
+ forgottenBytes: number().int().nonnegative(),
8498
+ /** Files under a claimed hour that no durable row names. Never deleted. */
8499
+ orphanFiles: number().int().nonnegative(),
8500
+ orphanSample: array(string()).readonly(),
8501
+ hoursSkipped: number().int().nonnegative(),
8502
+ skippedByReason: LedgerWalkSkipCountsSchema,
8503
+ /** The walk stopped at its per-pass hour bound with claims unwalked. */
8504
+ bounded: boolean(),
8505
+ byDevice: array(LedgerWalkDeviceReportSchema).readonly()
8506
+ });
8408
8507
  /** How many rows a media pass would still act on against a given target — the
8409
8508
  * media lane's denominator AND its residue, from ONE derivation so the two can
8410
8509
  * never disagree. `null` = the count could not be taken. */
@@ -18746,13 +18845,15 @@ var ListGroupsPageSchema = object({
18746
18845
  groups: array(AnalyticsGroupRecordSchema).readonly(),
18747
18846
  nextCursor: string().nullable()
18748
18847
  });
18848
+ var KEY_EVENTS_DEFAULT_LIMIT = 50;
18849
+ var KEY_EVENTS_MAX_LIMIT = 200;
18749
18850
  var KeyEventQueryInput = object({
18750
18851
  deviceId: number(),
18751
18852
  /** Window lower bound (track firstSeen ≥ since). */
18752
18853
  since: number(),
18753
18854
  /** Window upper bound (track firstSeen ≤ until). */
18754
18855
  until: number(),
18755
- limit: number().int().min(1).max(200).default(50),
18856
+ limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
18756
18857
  /** Drop tracks scoring below this importance. */
18757
18858
  minImportance: number().min(0).max(1).optional(),
18758
18859
  /** Restrict to a single class (e.g. 'person'). */
@@ -18774,6 +18875,32 @@ var KeyEventSchema = object({
18774
18875
  ...TrackFlagFields,
18775
18876
  ...TrackRetrainFields
18776
18877
  });
18878
+ /** `getKeyEvents`' window and filters, asked of a SET of cameras at once. */
18879
+ var KeyEventBatchQueryInput = object({
18880
+ deviceIds: array(number()).min(1).max(200),
18881
+ since: number(),
18882
+ until: number(),
18883
+ /** Applied PER CAMERA, exactly as `getKeyEvents.limit` is — never a total
18884
+ * across the set, which would let a busy camera starve a quiet one of its
18885
+ * rows and change what the merged feed contains. */
18886
+ limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
18887
+ minImportance: number().min(0).max(1).optional(),
18888
+ classFilter: string().optional()
18889
+ });
18890
+ /**
18891
+ * One camera's key events in a batch answer.
18892
+ *
18893
+ * The row exists for every requested id. `getKeyEvents` degrades to `[]` on
18894
+ * error rather than throwing, so a camera whose store read failed and one with
18895
+ * no events in the window were ALREADY indistinguishable per camera — the
18896
+ * batch does not make that worse, and the row keeps the deviceId the single
18897
+ * method's output never carried (the caller used to stamp it from the fan-out
18898
+ * key, which only worked because there was one query per camera).
18899
+ */
18900
+ var KeyEventsForDeviceSchema = object({
18901
+ deviceId: number(),
18902
+ events: array(KeyEventSchema).readonly()
18903
+ });
18777
18904
  object({
18778
18905
  trackId: string(),
18779
18906
  className: string(),
@@ -18845,6 +18972,50 @@ var EventStoreFootprintSchema = object({
18845
18972
  totalBytes: number().int(),
18846
18973
  devices: array(EventStoreDeviceFootprintSchema).readonly()
18847
18974
  });
18975
+ /** Event-media footprint for one {@link MediaFileKind}. */
18976
+ var EventMediaKindFootprintSchema = object({
18977
+ kind: MediaFileKindEnum,
18978
+ /** Media rows of this kind. */
18979
+ rows: number().int(),
18980
+ /** Bytes on disk held by those rows. */
18981
+ bytes: number().int()
18982
+ });
18983
+ /**
18984
+ * The media footprint broken down by KIND — the axis a deletion decision
18985
+ * actually turns on.
18986
+ *
18987
+ * A byte total says how much there is; it cannot say what is safe to remove.
18988
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
18989
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
18990
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
18991
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
18992
+ * nothing else, so sizing a deletion means summing per kind.
18993
+ *
18994
+ * ## Why `unaccounted*` exists
18995
+ *
18996
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
18997
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
18998
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
18999
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
19000
+ * retired code path, or by a version that knew a kind this one does not) would
19001
+ * otherwise vanish from the total silently, and an operator would delete
19002
+ * against a denominator smaller than the disk.
19003
+ *
19004
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
19005
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
19006
+ */
19007
+ var EventMediaKindBreakdownSchema = object({
19008
+ /** Every media row in scope, from one unfiltered aggregate. */
19009
+ totalRows: number().int(),
19010
+ /** Every media byte in scope, from that same aggregate. */
19011
+ totalBytes: number().int(),
19012
+ /** Per-kind footprint, ordered by bytes descending. */
19013
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
19014
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
19015
+ unaccountedRows: number().int(),
19016
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
19017
+ unaccountedBytes: number().int()
19018
+ });
18848
19019
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
18849
19020
  var EventPruneCountsSchema = object({
18850
19021
  motion: number().int(),
@@ -18999,7 +19170,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18999
19170
  until: number().optional(),
19000
19171
  kinds: array(string()).optional(),
19001
19172
  limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19002
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19173
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()), method(object({
19003
19174
  deviceId: number(),
19004
19175
  since: number(),
19005
19176
  until: number(),
@@ -19048,6 +19219,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19048
19219
  }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
19049
19220
  kind: "query",
19050
19221
  auth: "admin"
19222
+ }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
19223
+ kind: "query",
19224
+ auth: "admin"
19051
19225
  }), method(object({
19052
19226
  olderThanMs: number(),
19053
19227
  reason: OpsLogReasonSchema.optional()
@@ -20999,6 +21173,20 @@ method(object({
20999
21173
  error: string().optional()
21000
21174
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
21001
21175
  providerId: string(),
21176
+ /**
21177
+ * The location this config is an UNSAVED edit of, when there is one.
21178
+ *
21179
+ * `listLocations` replaces every declared secret with the redaction
21180
+ * sentinel, so the edit modal's form state holds the sentinel for any
21181
+ * credential the operator did not retype — and posting that here
21182
+ * without a way to resolve it makes the provider try to authenticate
21183
+ * as `__camstack_redacted__` and report the operator's own working
21184
+ * password as wrong. Given this id, the orchestrator restores each
21185
+ * sentinel from the stored config (same rule as `upsertLocation`)
21186
+ * before dispatching. Omitted by the "Add location" wizard, where
21187
+ * every value was typed just now and nothing is stored yet.
21188
+ */
21189
+ locationId: string().optional(),
21002
21190
  config: record(string(), unknown())
21003
21191
  }), object({
21004
21192
  ok: boolean(),
@@ -26634,6 +26822,9 @@ method(object({
26634
26822
  }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26635
26823
  kind: "query",
26636
26824
  auth: "admin"
26825
+ }), method(LedgerWalkInputSchema, LedgerWalkReportSchema, {
26826
+ kind: "mutation",
26827
+ auth: "admin"
26637
26828
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26638
26829
  kind: "mutation",
26639
26830
  auth: "admin"
@@ -27025,7 +27216,26 @@ var SceneMonitorStatusSchema = object({
27025
27216
  monitors: array(SceneMonitorSchema),
27026
27217
  lastFetchedAt: number()
27027
27218
  });
27028
- DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSchema), method(object({
27219
+ /**
27220
+ * One camera's row in a `listScenesBatch` answer.
27221
+ *
27222
+ * `status` is NULLABLE and the nullability is the whole point. `scene-monitor`
27223
+ * is a `defaultActive` wrapper, so every camera is asked; a camera whose
27224
+ * provider is absent (pipeline-analytics not deployed, the post-processing node
27225
+ * down) cannot answer, and that is not the same fact as a camera with no scenes
27226
+ * configured. Fanned out per camera the difference was visible — one query
27227
+ * errored while the others resolved — and a batch that returned only the rows
27228
+ * it managed would have destroyed it, silently, by making an unreachable camera
27229
+ * indistinguishable from one that answered `monitors: []`.
27230
+ *
27231
+ * So: EVERY requested deviceId gets a row. `status: null` means "this camera
27232
+ * could not be read"; `status.monitors: []` means "read, and it has none".
27233
+ */
27234
+ var SceneMonitorStatusForDeviceSchema = object({
27235
+ deviceId: number(),
27236
+ status: SceneMonitorStatusSchema.nullable()
27237
+ });
27238
+ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSchema), method(object({ deviceIds: array(number()).min(1).max(200) }), array(SceneMonitorStatusForDeviceSchema).readonly()), method(object({
27029
27239
  deviceId: number(),
27030
27240
  label: string(),
27031
27241
  roi: MaskRectShapeSchema,
@@ -28349,6 +28559,27 @@ var CameraOccupancySnapshotSchema = object({
28349
28559
  stationaryObjects: array(StationaryObjectSchema).readonly().optional()
28350
28560
  });
28351
28561
  /**
28562
+ * One camera's row in a `getCurrentSnapshotBatch` answer.
28563
+ *
28564
+ * THREE outcomes, and the single-camera method could only express two of them
28565
+ * because `snapshot: null` was already spoken for:
28566
+ *
28567
+ * - `read: 'read'`, `snapshot` present — the live occupancy reading.
28568
+ * - `read: 'read'`, `snapshot: null` — read, and this camera has no reading
28569
+ * yet: no frame since boot, and no parked-object registry to hydrate from.
28570
+ * - `read: 'unreadable'` — the owner could not answer for this
28571
+ * camera. `snapshot` is null, and it does NOT mean "nothing parked here".
28572
+ *
28573
+ * Collapsing the last two is the failure this field exists to prevent: a
28574
+ * hydration that threw would otherwise render as an empty Stationary section,
28575
+ * which is a definite claim about a camera nobody could read.
28576
+ */
28577
+ var CameraOccupancySnapshotForDeviceSchema = object({
28578
+ deviceId: number(),
28579
+ read: _enum(["read", "unreadable"]),
28580
+ snapshot: CameraOccupancySnapshotSchema.nullable()
28581
+ });
28582
+ /**
28352
28583
  * Time-series resolution. The history methods return one bucket per
28353
28584
  * step over the requested range. Smaller resolutions cost more
28354
28585
  * memory + bandwidth; bound to discrete steps so caller cannot ask
@@ -28372,7 +28603,7 @@ var HistoryPointSchema = object({
28372
28603
  /** Object count averaged over the bucket (rounded to nearest integer). */
28373
28604
  count: number().int().nonnegative()
28374
28605
  });
28375
- DeviceType.Camera, method(object({ deviceId: number() }), CameraOccupancySnapshotSchema.nullable()), method(object({
28606
+ DeviceType.Camera, method(object({ deviceId: number() }), CameraOccupancySnapshotSchema.nullable()), method(object({ deviceIds: array(number()).min(1).max(200) }), array(CameraOccupancySnapshotForDeviceSchema).readonly()), method(object({
28376
28607
  deviceId: number(),
28377
28608
  zoneId: string(),
28378
28609
  className: string().optional()
@@ -31653,6 +31884,12 @@ Object.freeze({
31653
31884
  addonId: null,
31654
31885
  access: "view"
31655
31886
  },
31887
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
31888
+ capName: "pipeline-analytics",
31889
+ capScope: "device",
31890
+ addonId: null,
31891
+ access: "view"
31892
+ },
31656
31893
  "pipelineAnalytics.getEventStoreFootprint": {
31657
31894
  capName: "pipeline-analytics",
31658
31895
  capScope: "device",
@@ -31671,6 +31908,12 @@ Object.freeze({
31671
31908
  addonId: null,
31672
31909
  access: "view"
31673
31910
  },
31911
+ "pipelineAnalytics.getKeyEventsBatch": {
31912
+ capName: "pipeline-analytics",
31913
+ capScope: "device",
31914
+ addonId: null,
31915
+ access: "view"
31916
+ },
31674
31917
  "pipelineAnalytics.getMotionEvents": {
31675
31918
  capName: "pipeline-analytics",
31676
31919
  capScope: "device",
@@ -32847,6 +33090,12 @@ Object.freeze({
32847
33090
  addonId: null,
32848
33091
  access: "view"
32849
33092
  },
33093
+ "recording.reconcileLedgerAgainstDisk": {
33094
+ capName: "recording",
33095
+ capScope: "system",
33096
+ addonId: null,
33097
+ access: "create"
33098
+ },
32850
33099
  "recording.refreshStorageLocationsForMigration": {
32851
33100
  capName: "recording",
32852
33101
  capScope: "system",
@@ -32973,6 +33222,12 @@ Object.freeze({
32973
33222
  addonId: null,
32974
33223
  access: "view"
32975
33224
  },
33225
+ "sceneMonitor.listScenesBatch": {
33226
+ capName: "scene-monitor",
33227
+ capScope: "device",
33228
+ addonId: null,
33229
+ access: "view"
33230
+ },
32976
33231
  "sceneMonitor.recheckNow": {
32977
33232
  capName: "scene-monitor",
32978
33233
  capScope: "device",
@@ -34329,6 +34584,12 @@ Object.freeze({
34329
34584
  addonId: null,
34330
34585
  access: "view"
34331
34586
  },
34587
+ "zoneAnalytics.getCurrentSnapshotBatch": {
34588
+ capName: "zone-analytics",
34589
+ capScope: "device",
34590
+ addonId: null,
34591
+ access: "view"
34592
+ },
34332
34593
  "zoneAnalytics.getUnzonedHistory": {
34333
34594
  capName: "zone-analytics",
34334
34595
  capScope: "device",
@@ -35318,6 +35579,11 @@ Object.freeze({
35318
35579
  form: "single",
35319
35580
  optional: false
35320
35581
  }],
35582
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
35583
+ name: "deviceId",
35584
+ form: "single",
35585
+ optional: true
35586
+ }],
35321
35587
  "pipelineAnalytics.getGroup": [{
35322
35588
  name: "deviceId",
35323
35589
  form: "single",
@@ -35328,6 +35594,11 @@ Object.freeze({
35328
35594
  form: "single",
35329
35595
  optional: false
35330
35596
  }],
35597
+ "pipelineAnalytics.getKeyEventsBatch": [{
35598
+ name: "deviceIds",
35599
+ form: "array",
35600
+ optional: false
35601
+ }],
35331
35602
  "pipelineAnalytics.getMotionEvents": [{
35332
35603
  name: "deviceId",
35333
35604
  form: "single",
@@ -35768,6 +36039,11 @@ Object.freeze({
35768
36039
  form: "single",
35769
36040
  optional: false
35770
36041
  }],
36042
+ "recording.reconcileLedgerAgainstDisk": [{
36043
+ name: "deviceId",
36044
+ form: "single",
36045
+ optional: true
36046
+ }],
35771
36047
  "recording.relocateFootage": [{
35772
36048
  name: "deviceId",
35773
36049
  form: "single",
@@ -35833,6 +36109,11 @@ Object.freeze({
35833
36109
  form: "single",
35834
36110
  optional: false
35835
36111
  }],
36112
+ "sceneMonitor.listScenesBatch": [{
36113
+ name: "deviceIds",
36114
+ form: "array",
36115
+ optional: false
36116
+ }],
35836
36117
  "sceneMonitor.recheckNow": [{
35837
36118
  name: "deviceId",
35838
36119
  form: "single",
@@ -36094,6 +36375,11 @@ Object.freeze({
36094
36375
  form: "single",
36095
36376
  optional: false
36096
36377
  }],
36378
+ "zoneAnalytics.getCurrentSnapshotBatch": [{
36379
+ name: "deviceIds",
36380
+ form: "array",
36381
+ optional: false
36382
+ }],
36097
36383
  "zoneAnalytics.getUnzonedHistory": [{
36098
36384
  name: "deviceId",
36099
36385
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-mqtt-broker",
3
- "version": "1.2.47",
3
+ "version": "1.2.49",
4
4
  "description": "MQTT broker registry addon for CamStack — manages external broker entries + an optional embedded aedes broker. Consumers spin up their own `mqtt.js` clients via the `mqtt-broker` cap.",
5
5
  "keywords": [
6
6
  "camstack",