@camstack/addon-post-analysis 1.2.153 → 1.2.154

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.
@@ -8257,6 +8257,20 @@ var RelocateJobSchema = object({
8257
8257
  * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8258
8258
  */
8259
8259
  rowsReconciled: number().int().nonnegative().optional(),
8260
+ /**
8261
+ * Rows this run FORGOT because the file they name is not on disk.
8262
+ *
8263
+ * The mover derived the path from the row's own fields and `stat`ed it; an
8264
+ * ENOENT there is a per-path confirmation that the segment is gone (D296),
8265
+ * and the durable row is dropped through the same channel eviction uses. It
8266
+ * is reported for the same reason `rowsReconciled` is: this is a durable
8267
+ * mutation nobody asked for, and a migration that quietly erases hour rows is
8268
+ * the same failure as one that quietly skips them (D295).
8269
+ *
8270
+ * The production drain of 2026-08-30 would have reported 11 074 here — the
8271
+ * ledger claimed 5.65 GB of footage that no longer existed.
8272
+ */
8273
+ rowsForgotten: number().int().nonnegative().optional(),
8260
8274
  startedAt: number(),
8261
8275
  finishedAt: number().nullable(),
8262
8276
  error: string().nullable()
@@ -8620,6 +8634,91 @@ var RelocateResidueSchema = object({
8620
8634
  segments: number().int().nonnegative(),
8621
8635
  bytes: number().int().nonnegative()
8622
8636
  }).nullable();
8637
+ /**
8638
+ * Ask one location whether its durable hour rows describe the disk — the walk
8639
+ * (D319).
8640
+ *
8641
+ * `apply` DEFAULTS TO FALSE and that default is the product: the operator's
8642
+ * missing tool is the question, and the dry run is how they sanity-check the
8643
+ * destructive run before authorising it.
8644
+ */
8645
+ var LedgerWalkInputSchema = object({
8646
+ locationId: string().min(1),
8647
+ /** Forget the confirmed-absent rows, rather than only counting them. */
8648
+ apply: boolean().optional(),
8649
+ /** Narrow to one camera. */
8650
+ deviceId: number().int().positive().optional(),
8651
+ /** Narrow to these recording profiles; empty/absent = every profile. */
8652
+ profiles: array(string().min(1)).optional()
8653
+ });
8654
+ /** Why a whole walk did nothing. Every one leaves the ledger untouched. */
8655
+ var LedgerWalkRefusalSchema = _enum([
8656
+ "location-unknown",
8657
+ "source-writable",
8658
+ "no-ledger",
8659
+ "archive-unreadable",
8660
+ "anchor-absent",
8661
+ "anchor-unreadable",
8662
+ "anchor-moved"
8663
+ ]);
8664
+ _enum([
8665
+ "live-tail",
8666
+ "listing-error",
8667
+ "path-mismatch",
8668
+ "durable-refused"
8669
+ ]);
8670
+ /** Every skip reason, always present, always a number — so a reason that never
8671
+ * fired reports as zero rather than absent and the report shape is constant
8672
+ * between passes. Spelled out rather than `z.record` for exactly that. */
8673
+ var LedgerWalkSkipCountsSchema = object({
8674
+ "live-tail": number().int().nonnegative(),
8675
+ "listing-error": number().int().nonnegative(),
8676
+ "path-mismatch": number().int().nonnegative(),
8677
+ "durable-refused": number().int().nonnegative()
8678
+ });
8679
+ /** One camera's share of a walk, so a report names cameras and not rows. */
8680
+ var LedgerWalkDeviceReportSchema = object({
8681
+ deviceId: number().int(),
8682
+ hoursWalked: number().int().nonnegative(),
8683
+ hoursMissing: number().int().nonnegative(),
8684
+ ghostSegments: number().int().nonnegative(),
8685
+ ghostBytes: number().int().nonnegative(),
8686
+ forgottenSegments: number().int().nonnegative(),
8687
+ orphanFiles: number().int().nonnegative()
8688
+ });
8689
+ /**
8690
+ * What one walk claimed, listed, found and (only when armed) forgot.
8691
+ *
8692
+ * `archiveSegments` is the **M** and `segmentsClaimed` the **N** (D295), so a
8693
+ * walk that saw a fraction of the location is visible in its own report rather
8694
+ * than in the absence of one.
8695
+ */
8696
+ var LedgerWalkReportSchema = object({
8697
+ locationId: string(),
8698
+ applied: boolean(),
8699
+ refused: LedgerWalkRefusalSchema.nullable(),
8700
+ archiveSegments: number().int().nonnegative().nullable(),
8701
+ archiveBytes: number().int().nonnegative().nullable(),
8702
+ hoursClaimed: number().int().nonnegative(),
8703
+ hoursWalked: number().int().nonnegative(),
8704
+ hoursMissing: number().int().nonnegative(),
8705
+ /** `readdir` calls issued — the cost, stated in the unit that is paid. */
8706
+ listings: number().int().nonnegative(),
8707
+ segmentsClaimed: number().int().nonnegative(),
8708
+ ghostSegments: number().int().nonnegative(),
8709
+ ghostBytes: number().int().nonnegative(),
8710
+ ghostHoursWhole: number().int().nonnegative(),
8711
+ forgottenSegments: number().int().nonnegative(),
8712
+ forgottenBytes: number().int().nonnegative(),
8713
+ /** Files under a claimed hour that no durable row names. Never deleted. */
8714
+ orphanFiles: number().int().nonnegative(),
8715
+ orphanSample: array(string()).readonly(),
8716
+ hoursSkipped: number().int().nonnegative(),
8717
+ skippedByReason: LedgerWalkSkipCountsSchema,
8718
+ /** The walk stopped at its per-pass hour bound with claims unwalked. */
8719
+ bounded: boolean(),
8720
+ byDevice: array(LedgerWalkDeviceReportSchema).readonly()
8721
+ });
8623
8722
  /** How many rows a media pass would still act on against a given target — the
8624
8723
  * media lane's denominator AND its residue, from ONE derivation so the two can
8625
8724
  * never disagree. `null` = the count could not be taken. */
@@ -19995,13 +20094,15 @@ var ListGroupsPageSchema = object({
19995
20094
  groups: array(AnalyticsGroupRecordSchema).readonly(),
19996
20095
  nextCursor: string().nullable()
19997
20096
  });
20097
+ var KEY_EVENTS_DEFAULT_LIMIT = 50;
20098
+ var KEY_EVENTS_MAX_LIMIT = 200;
19998
20099
  var KeyEventQueryInput = object({
19999
20100
  deviceId: number(),
20000
20101
  /** Window lower bound (track firstSeen ≥ since). */
20001
20102
  since: number(),
20002
20103
  /** Window upper bound (track firstSeen ≤ until). */
20003
20104
  until: number(),
20004
- limit: number().int().min(1).max(200).default(50),
20105
+ limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
20005
20106
  /** Drop tracks scoring below this importance. */
20006
20107
  minImportance: number().min(0).max(1).optional(),
20007
20108
  /** Restrict to a single class (e.g. 'person'). */
@@ -20023,6 +20124,32 @@ var KeyEventSchema = object({
20023
20124
  ...TrackFlagFields,
20024
20125
  ...TrackRetrainFields
20025
20126
  });
20127
+ /** `getKeyEvents`' window and filters, asked of a SET of cameras at once. */
20128
+ var KeyEventBatchQueryInput = object({
20129
+ deviceIds: array(number()).min(1).max(200),
20130
+ since: number(),
20131
+ until: number(),
20132
+ /** Applied PER CAMERA, exactly as `getKeyEvents.limit` is — never a total
20133
+ * across the set, which would let a busy camera starve a quiet one of its
20134
+ * rows and change what the merged feed contains. */
20135
+ limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
20136
+ minImportance: number().min(0).max(1).optional(),
20137
+ classFilter: string().optional()
20138
+ });
20139
+ /**
20140
+ * One camera's key events in a batch answer.
20141
+ *
20142
+ * The row exists for every requested id. `getKeyEvents` degrades to `[]` on
20143
+ * error rather than throwing, so a camera whose store read failed and one with
20144
+ * no events in the window were ALREADY indistinguishable per camera — the
20145
+ * batch does not make that worse, and the row keeps the deviceId the single
20146
+ * method's output never carried (the caller used to stamp it from the fan-out
20147
+ * key, which only worked because there was one query per camera).
20148
+ */
20149
+ var KeyEventsForDeviceSchema = object({
20150
+ deviceId: number(),
20151
+ events: array(KeyEventSchema).readonly()
20152
+ });
20026
20153
  object({
20027
20154
  trackId: string(),
20028
20155
  className: string(),
@@ -20371,6 +20498,21 @@ var pipelineAnalyticsCapability = {
20371
20498
  * scored on-read (no write). Degrades to `[]` on error.
20372
20499
  */
20373
20500
  getKeyEvents: method(KeyEventQueryInput, array(KeyEventSchema).readonly()),
20501
+ /**
20502
+ * The same ranking, for a SET of cameras, in one round trip.
20503
+ *
20504
+ * The Detection Intelligence events feed asks this of every selected
20505
+ * camera and re-asks on a 30s timer. Fanned out client-side that is N
20506
+ * round trips — browser → hub → post-analysis — for N independent,
20507
+ * already-indexed store queries. Batched, the queries are unchanged and
20508
+ * run concurrently INSIDE the owner; only the transport collapses.
20509
+ *
20510
+ * Deliberately per-device rather than pre-merged: `limit` stays per
20511
+ * camera (a total would let a busy camera starve a quiet one), and a
20512
+ * caller that renders one camera's lane needs to know which camera a row
20513
+ * came from. `getKeyEvents` stays for single-device callers.
20514
+ */
20515
+ getKeyEventsBatch: method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()),
20374
20516
  /** Server-side bucketed event counts for the 24-hour timeline.
20375
20517
  * Returns one entry per non-empty bucket; empty buckets are omitted. */
20376
20518
  getEventDensity: method(object({
@@ -30265,6 +30407,9 @@ method(object({
30265
30407
  }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
30266
30408
  kind: "query",
30267
30409
  auth: "admin"
30410
+ }), method(LedgerWalkInputSchema, LedgerWalkReportSchema, {
30411
+ kind: "mutation",
30412
+ auth: "admin"
30268
30413
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
30269
30414
  kind: "mutation",
30270
30415
  auth: "admin"
@@ -30681,6 +30826,25 @@ var SceneMonitorStatusSchema = object({
30681
30826
  monitors: array(SceneMonitorSchema),
30682
30827
  lastFetchedAt: number()
30683
30828
  });
30829
+ /**
30830
+ * One camera's row in a `listScenesBatch` answer.
30831
+ *
30832
+ * `status` is NULLABLE and the nullability is the whole point. `scene-monitor`
30833
+ * is a `defaultActive` wrapper, so every camera is asked; a camera whose
30834
+ * provider is absent (pipeline-analytics not deployed, the post-processing node
30835
+ * down) cannot answer, and that is not the same fact as a camera with no scenes
30836
+ * configured. Fanned out per camera the difference was visible — one query
30837
+ * errored while the others resolved — and a batch that returned only the rows
30838
+ * it managed would have destroyed it, silently, by making an unreachable camera
30839
+ * indistinguishable from one that answered `monitors: []`.
30840
+ *
30841
+ * So: EVERY requested deviceId gets a row. `status: null` means "this camera
30842
+ * could not be read"; `status.monitors: []` means "read, and it has none".
30843
+ */
30844
+ var SceneMonitorStatusForDeviceSchema = object({
30845
+ deviceId: number(),
30846
+ status: SceneMonitorStatusSchema.nullable()
30847
+ });
30684
30848
  var sceneMonitorCapability = {
30685
30849
  name: "scene-monitor",
30686
30850
  scope: "device",
@@ -30690,6 +30854,22 @@ var sceneMonitorCapability = {
30690
30854
  deviceTypes: [DeviceType.Camera],
30691
30855
  methods: {
30692
30856
  listScenes: method(object({ deviceId: number() }), SceneMonitorStatusSchema),
30857
+ /**
30858
+ * The same answer, for a SET of cameras, in one round trip.
30859
+ *
30860
+ * `/scenes` renders every camera and re-reads them on a 30s safety-net
30861
+ * poll behind the push slice. Fanned out client-side that was one query
30862
+ * per camera — 29 round trips through the browser, the hub and the
30863
+ * post-analysis runner every 30 seconds to read an in-memory map the
30864
+ * owner had already merged. The work is unchanged (`statusFor` per
30865
+ * device, all in-process at the owner); what collapses is the transport.
30866
+ *
30867
+ * A camera that cannot answer still gets a row, with `status: null` —
30868
+ * see {@link SceneMonitorStatusForDeviceSchema}. Never fewer rows than
30869
+ * ids: a caller that asked for twenty-nine and got twenty-seven cannot
30870
+ * tell which two are missing, or that any are.
30871
+ */
30872
+ listScenesBatch: method(object({ deviceIds: array(number()).min(1).max(200) }), array(SceneMonitorStatusForDeviceSchema).readonly()),
30693
30873
  createScene: method(object({
30694
30874
  deviceId: number(),
30695
30875
  label: string(),
@@ -32525,6 +32705,27 @@ var CameraOccupancySnapshotSchema = object({
32525
32705
  stationaryObjects: array(StationaryObjectSchema).readonly().optional()
32526
32706
  });
32527
32707
  /**
32708
+ * One camera's row in a `getCurrentSnapshotBatch` answer.
32709
+ *
32710
+ * THREE outcomes, and the single-camera method could only express two of them
32711
+ * because `snapshot: null` was already spoken for:
32712
+ *
32713
+ * - `read: 'read'`, `snapshot` present — the live occupancy reading.
32714
+ * - `read: 'read'`, `snapshot: null` — read, and this camera has no reading
32715
+ * yet: no frame since boot, and no parked-object registry to hydrate from.
32716
+ * - `read: 'unreadable'` — the owner could not answer for this
32717
+ * camera. `snapshot` is null, and it does NOT mean "nothing parked here".
32718
+ *
32719
+ * Collapsing the last two is the failure this field exists to prevent: a
32720
+ * hydration that threw would otherwise render as an empty Stationary section,
32721
+ * which is a definite claim about a camera nobody could read.
32722
+ */
32723
+ var CameraOccupancySnapshotForDeviceSchema = object({
32724
+ deviceId: number(),
32725
+ read: _enum(["read", "unreadable"]),
32726
+ snapshot: CameraOccupancySnapshotSchema.nullable()
32727
+ });
32728
+ /**
32528
32729
  * Time-series resolution. The history methods return one bucket per
32529
32730
  * step over the requested range. Smaller resolutions cost more
32530
32731
  * memory + bandwidth; bound to discrete steps so caller cannot ask
@@ -32581,6 +32782,20 @@ var zoneAnalyticsCapability = {
32581
32782
  * (no inference result emitted since boot or since binding was
32582
32783
  * activated). */
32583
32784
  getCurrentSnapshot: method(object({ deviceId: number() }), CameraOccupancySnapshotSchema.nullable()),
32785
+ /**
32786
+ * The same snapshot, for a SET of cameras, in one round trip.
32787
+ *
32788
+ * The Events page's Stationary section polls this every 15s for every
32789
+ * selected camera. Fanned out client-side that is one query per camera to
32790
+ * read a `Map.get` at the owner — the answer costs nothing, the round trip
32791
+ * costs everything. Batched, N transports become one and the per-device
32792
+ * work is unchanged.
32793
+ *
32794
+ * Every requested deviceId gets a row, tagged `read` — see
32795
+ * {@link CameraOccupancySnapshotForDeviceSchema}. A camera the owner could
32796
+ * not answer for is `'unreadable'`, never an empty reading.
32797
+ */
32798
+ getCurrentSnapshotBatch: method(object({ deviceIds: array(number()).min(1).max(200) }), array(CameraOccupancySnapshotForDeviceSchema).readonly()),
32584
32799
  /** Time-series object count inside one zone. `className` optional —
32585
32800
  * omit to count every class in the zone. */
32586
32801
  getZoneHistory: method(object({
@@ -37194,6 +37409,12 @@ Object.freeze({
37194
37409
  addonId: null,
37195
37410
  access: "view"
37196
37411
  },
37412
+ "pipelineAnalytics.getKeyEventsBatch": {
37413
+ capName: "pipeline-analytics",
37414
+ capScope: "device",
37415
+ addonId: null,
37416
+ access: "view"
37417
+ },
37197
37418
  "pipelineAnalytics.getMotionEvents": {
37198
37419
  capName: "pipeline-analytics",
37199
37420
  capScope: "device",
@@ -38370,6 +38591,12 @@ Object.freeze({
38370
38591
  addonId: null,
38371
38592
  access: "view"
38372
38593
  },
38594
+ "recording.reconcileLedgerAgainstDisk": {
38595
+ capName: "recording",
38596
+ capScope: "system",
38597
+ addonId: null,
38598
+ access: "create"
38599
+ },
38373
38600
  "recording.refreshStorageLocationsForMigration": {
38374
38601
  capName: "recording",
38375
38602
  capScope: "system",
@@ -38496,6 +38723,12 @@ Object.freeze({
38496
38723
  addonId: null,
38497
38724
  access: "view"
38498
38725
  },
38726
+ "sceneMonitor.listScenesBatch": {
38727
+ capName: "scene-monitor",
38728
+ capScope: "device",
38729
+ addonId: null,
38730
+ access: "view"
38731
+ },
38499
38732
  "sceneMonitor.recheckNow": {
38500
38733
  capName: "scene-monitor",
38501
38734
  capScope: "device",
@@ -39852,6 +40085,12 @@ Object.freeze({
39852
40085
  addonId: null,
39853
40086
  access: "view"
39854
40087
  },
40088
+ "zoneAnalytics.getCurrentSnapshotBatch": {
40089
+ capName: "zone-analytics",
40090
+ capScope: "device",
40091
+ addonId: null,
40092
+ access: "view"
40093
+ },
39855
40094
  "zoneAnalytics.getUnzonedHistory": {
39856
40095
  capName: "zone-analytics",
39857
40096
  capScope: "device",
@@ -40856,6 +41095,11 @@ Object.freeze({
40856
41095
  form: "single",
40857
41096
  optional: false
40858
41097
  }],
41098
+ "pipelineAnalytics.getKeyEventsBatch": [{
41099
+ name: "deviceIds",
41100
+ form: "array",
41101
+ optional: false
41102
+ }],
40859
41103
  "pipelineAnalytics.getMotionEvents": [{
40860
41104
  name: "deviceId",
40861
41105
  form: "single",
@@ -41296,6 +41540,11 @@ Object.freeze({
41296
41540
  form: "single",
41297
41541
  optional: false
41298
41542
  }],
41543
+ "recording.reconcileLedgerAgainstDisk": [{
41544
+ name: "deviceId",
41545
+ form: "single",
41546
+ optional: true
41547
+ }],
41299
41548
  "recording.relocateFootage": [{
41300
41549
  name: "deviceId",
41301
41550
  form: "single",
@@ -41361,6 +41610,11 @@ Object.freeze({
41361
41610
  form: "single",
41362
41611
  optional: false
41363
41612
  }],
41613
+ "sceneMonitor.listScenesBatch": [{
41614
+ name: "deviceIds",
41615
+ form: "array",
41616
+ optional: false
41617
+ }],
41364
41618
  "sceneMonitor.recheckNow": [{
41365
41619
  name: "deviceId",
41366
41620
  form: "single",
@@ -41622,6 +41876,11 @@ Object.freeze({
41622
41876
  form: "single",
41623
41877
  optional: false
41624
41878
  }],
41879
+ "zoneAnalytics.getCurrentSnapshotBatch": [{
41880
+ name: "deviceIds",
41881
+ form: "array",
41882
+ optional: false
41883
+ }],
41625
41884
  "zoneAnalytics.getUnzonedHistory": [{
41626
41885
  name: "deviceId",
41627
41886
  form: "single",