@camstack/system 1.2.162 → 1.2.163

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/addon-runner.js +1 -1
  2. package/dist/addon-runner.mjs +1 -1
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/console-logging/index.js +1 -1
  12. package/dist/builtins/console-logging/index.mjs +1 -1
  13. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  14. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  15. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  16. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  17. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  18. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  19. package/dist/builtins/hub-forwarder/index.js +1 -1
  20. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  21. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  22. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  23. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  24. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  25. package/dist/builtins/local-network/local-network.addon.js +1 -1
  26. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  27. package/dist/builtins/loki-logging/index.js +1 -1
  28. package/dist/builtins/loki-logging/index.mjs +1 -1
  29. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  30. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  31. package/dist/builtins/platform-probe/index.js +1 -1
  32. package/dist/builtins/platform-probe/index.mjs +1 -1
  33. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  34. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  35. package/dist/builtins/snapshot/index.js +1 -1
  36. package/dist/builtins/snapshot/index.mjs +1 -1
  37. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  38. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  39. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  40. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  41. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  42. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  43. package/dist/builtins/system-config/system-config.addon.js +1 -1
  44. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  45. package/dist/builtins/winston-logging/index.js +1 -1
  46. package/dist/builtins/winston-logging/index.mjs +1 -1
  47. package/dist/{dist-CCIBlacf.js → dist-B29Skpzo.js} +274 -1
  48. package/dist/{dist-5Xzz_kCk.mjs → dist-DxFjna2a.mjs} +274 -1
  49. package/dist/index.js +74 -11
  50. package/dist/index.mjs +74 -11
  51. package/dist/{manifest-system-deps-shjDShSB.mjs → manifest-system-deps-CG9ESHhv.mjs} +1 -1
  52. package/dist/{manifest-system-deps-alrkBKVQ.js → manifest-system-deps-DBje540e.js} +1 -1
  53. package/dist/{retired-settings-keys-BxV3e2Km.js → retired-settings-keys-CRL0qOnU.js} +1 -1
  54. package/dist/{retired-settings-keys-CnuALlaP.mjs → retired-settings-keys-N0NZzDE3.mjs} +1 -1
  55. package/package.json +1 -1
@@ -4192,6 +4192,20 @@ var RelocateJobSchema = z.object({
4192
4192
  * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
4193
4193
  */
4194
4194
  rowsReconciled: z.number().int().nonnegative().optional(),
4195
+ /**
4196
+ * Rows this run FORGOT because the file they name is not on disk.
4197
+ *
4198
+ * The mover derived the path from the row's own fields and `stat`ed it; an
4199
+ * ENOENT there is a per-path confirmation that the segment is gone (D296),
4200
+ * and the durable row is dropped through the same channel eviction uses. It
4201
+ * is reported for the same reason `rowsReconciled` is: this is a durable
4202
+ * mutation nobody asked for, and a migration that quietly erases hour rows is
4203
+ * the same failure as one that quietly skips them (D295).
4204
+ *
4205
+ * The production drain of 2026-08-30 would have reported 11 074 here — the
4206
+ * ledger claimed 5.65 GB of footage that no longer existed.
4207
+ */
4208
+ rowsForgotten: z.number().int().nonnegative().optional(),
4195
4209
  startedAt: z.number(),
4196
4210
  finishedAt: z.number().nullable(),
4197
4211
  error: z.string().nullable()
@@ -4587,6 +4601,91 @@ var RelocateResidueSchema = z.object({
4587
4601
  segments: z.number().int().nonnegative(),
4588
4602
  bytes: z.number().int().nonnegative()
4589
4603
  }).nullable();
4604
+ /**
4605
+ * Ask one location whether its durable hour rows describe the disk — the walk
4606
+ * (D319).
4607
+ *
4608
+ * `apply` DEFAULTS TO FALSE and that default is the product: the operator's
4609
+ * missing tool is the question, and the dry run is how they sanity-check the
4610
+ * destructive run before authorising it.
4611
+ */
4612
+ var LedgerWalkInputSchema = z.object({
4613
+ locationId: z.string().min(1),
4614
+ /** Forget the confirmed-absent rows, rather than only counting them. */
4615
+ apply: z.boolean().optional(),
4616
+ /** Narrow to one camera. */
4617
+ deviceId: z.number().int().positive().optional(),
4618
+ /** Narrow to these recording profiles; empty/absent = every profile. */
4619
+ profiles: z.array(z.string().min(1)).optional()
4620
+ });
4621
+ /** Why a whole walk did nothing. Every one leaves the ledger untouched. */
4622
+ var LedgerWalkRefusalSchema = z.enum([
4623
+ "location-unknown",
4624
+ "source-writable",
4625
+ "no-ledger",
4626
+ "archive-unreadable",
4627
+ "anchor-absent",
4628
+ "anchor-unreadable",
4629
+ "anchor-moved"
4630
+ ]);
4631
+ z.enum([
4632
+ "live-tail",
4633
+ "listing-error",
4634
+ "path-mismatch",
4635
+ "durable-refused"
4636
+ ]);
4637
+ /** Every skip reason, always present, always a number — so a reason that never
4638
+ * fired reports as zero rather than absent and the report shape is constant
4639
+ * between passes. Spelled out rather than `z.record` for exactly that. */
4640
+ var LedgerWalkSkipCountsSchema = z.object({
4641
+ "live-tail": z.number().int().nonnegative(),
4642
+ "listing-error": z.number().int().nonnegative(),
4643
+ "path-mismatch": z.number().int().nonnegative(),
4644
+ "durable-refused": z.number().int().nonnegative()
4645
+ });
4646
+ /** One camera's share of a walk, so a report names cameras and not rows. */
4647
+ var LedgerWalkDeviceReportSchema = z.object({
4648
+ deviceId: z.number().int(),
4649
+ hoursWalked: z.number().int().nonnegative(),
4650
+ hoursMissing: z.number().int().nonnegative(),
4651
+ ghostSegments: z.number().int().nonnegative(),
4652
+ ghostBytes: z.number().int().nonnegative(),
4653
+ forgottenSegments: z.number().int().nonnegative(),
4654
+ orphanFiles: z.number().int().nonnegative()
4655
+ });
4656
+ /**
4657
+ * What one walk claimed, listed, found and (only when armed) forgot.
4658
+ *
4659
+ * `archiveSegments` is the **M** and `segmentsClaimed` the **N** (D295), so a
4660
+ * walk that saw a fraction of the location is visible in its own report rather
4661
+ * than in the absence of one.
4662
+ */
4663
+ var LedgerWalkReportSchema = z.object({
4664
+ locationId: z.string(),
4665
+ applied: z.boolean(),
4666
+ refused: LedgerWalkRefusalSchema.nullable(),
4667
+ archiveSegments: z.number().int().nonnegative().nullable(),
4668
+ archiveBytes: z.number().int().nonnegative().nullable(),
4669
+ hoursClaimed: z.number().int().nonnegative(),
4670
+ hoursWalked: z.number().int().nonnegative(),
4671
+ hoursMissing: z.number().int().nonnegative(),
4672
+ /** `readdir` calls issued — the cost, stated in the unit that is paid. */
4673
+ listings: z.number().int().nonnegative(),
4674
+ segmentsClaimed: z.number().int().nonnegative(),
4675
+ ghostSegments: z.number().int().nonnegative(),
4676
+ ghostBytes: z.number().int().nonnegative(),
4677
+ ghostHoursWhole: z.number().int().nonnegative(),
4678
+ forgottenSegments: z.number().int().nonnegative(),
4679
+ forgottenBytes: z.number().int().nonnegative(),
4680
+ /** Files under a claimed hour that no durable row names. Never deleted. */
4681
+ orphanFiles: z.number().int().nonnegative(),
4682
+ orphanSample: z.array(z.string()).readonly(),
4683
+ hoursSkipped: z.number().int().nonnegative(),
4684
+ skippedByReason: LedgerWalkSkipCountsSchema,
4685
+ /** The walk stopped at its per-pass hour bound with claims unwalked. */
4686
+ bounded: z.boolean(),
4687
+ byDevice: z.array(LedgerWalkDeviceReportSchema).readonly()
4688
+ });
4590
4689
  /** How many rows a media pass would still act on against a given target — the
4591
4690
  * media lane's denominator AND its residue, from ONE derivation so the two can
4592
4691
  * never disagree. `null` = the count could not be taken. */
@@ -17777,13 +17876,15 @@ var ListGroupsPageSchema = z.object({
17777
17876
  groups: z.array(AnalyticsGroupRecordSchema).readonly(),
17778
17877
  nextCursor: z.string().nullable()
17779
17878
  });
17879
+ var KEY_EVENTS_DEFAULT_LIMIT = 50;
17880
+ var KEY_EVENTS_MAX_LIMIT = 200;
17780
17881
  var KeyEventQueryInput = z.object({
17781
17882
  deviceId: z.number(),
17782
17883
  /** Window lower bound (track firstSeen ≥ since). */
17783
17884
  since: z.number(),
17784
17885
  /** Window upper bound (track firstSeen ≤ until). */
17785
17886
  until: z.number(),
17786
- limit: z.number().int().min(1).max(200).default(50),
17887
+ limit: z.number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
17787
17888
  /** Drop tracks scoring below this importance. */
17788
17889
  minImportance: z.number().min(0).max(1).optional(),
17789
17890
  /** Restrict to a single class (e.g. 'person'). */
@@ -17805,6 +17906,32 @@ var KeyEventSchema = z.object({
17805
17906
  ...TrackFlagFields,
17806
17907
  ...TrackRetrainFields
17807
17908
  });
17909
+ /** `getKeyEvents`' window and filters, asked of a SET of cameras at once. */
17910
+ var KeyEventBatchQueryInput = z.object({
17911
+ deviceIds: z.array(z.number()).min(1).max(200),
17912
+ since: z.number(),
17913
+ until: z.number(),
17914
+ /** Applied PER CAMERA, exactly as `getKeyEvents.limit` is — never a total
17915
+ * across the set, which would let a busy camera starve a quiet one of its
17916
+ * rows and change what the merged feed contains. */
17917
+ limit: z.number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
17918
+ minImportance: z.number().min(0).max(1).optional(),
17919
+ classFilter: z.string().optional()
17920
+ });
17921
+ /**
17922
+ * One camera's key events in a batch answer.
17923
+ *
17924
+ * The row exists for every requested id. `getKeyEvents` degrades to `[]` on
17925
+ * error rather than throwing, so a camera whose store read failed and one with
17926
+ * no events in the window were ALREADY indistinguishable per camera — the
17927
+ * batch does not make that worse, and the row keeps the deviceId the single
17928
+ * method's output never carried (the caller used to stamp it from the fan-out
17929
+ * key, which only worked because there was one query per camera).
17930
+ */
17931
+ var KeyEventsForDeviceSchema = z.object({
17932
+ deviceId: z.number(),
17933
+ events: z.array(KeyEventSchema).readonly()
17934
+ });
17808
17935
  z.object({
17809
17936
  trackId: z.string(),
17810
17937
  className: z.string(),
@@ -18154,6 +18281,21 @@ var pipelineAnalyticsCapability = {
18154
18281
  * scored on-read (no write). Degrades to `[]` on error.
18155
18282
  */
18156
18283
  getKeyEvents: method(KeyEventQueryInput, z.array(KeyEventSchema).readonly()),
18284
+ /**
18285
+ * The same ranking, for a SET of cameras, in one round trip.
18286
+ *
18287
+ * The Detection Intelligence events feed asks this of every selected
18288
+ * camera and re-asks on a 30s timer. Fanned out client-side that is N
18289
+ * round trips — browser → hub → post-analysis — for N independent,
18290
+ * already-indexed store queries. Batched, the queries are unchanged and
18291
+ * run concurrently INSIDE the owner; only the transport collapses.
18292
+ *
18293
+ * Deliberately per-device rather than pre-merged: `limit` stays per
18294
+ * camera (a total would let a busy camera starve a quiet one), and a
18295
+ * caller that renders one camera's lane needs to know which camera a row
18296
+ * came from. `getKeyEvents` stays for single-device callers.
18297
+ */
18298
+ getKeyEventsBatch: method(KeyEventBatchQueryInput, z.array(KeyEventsForDeviceSchema).readonly()),
18157
18299
  /** Server-side bucketed event counts for the 24-hour timeline.
18158
18300
  * Returns one entry per non-empty bucket; empty buckets are omitted. */
18159
18301
  getEventDensity: method(z.object({
@@ -30023,6 +30165,23 @@ var recordingCapability = {
30023
30165
  kind: "query",
30024
30166
  auth: "admin"
30025
30167
  }),
30168
+ /**
30169
+ * Does this location's LEDGER tell the truth about its disk? (D319)
30170
+ *
30171
+ * One `readdir` per claimed hour, diffed both ways: durable rows whose file
30172
+ * is not there, and files no durable row names. `apply` defaults to FALSE —
30173
+ * the report is the product, and the dry run is how an operator
30174
+ * sanity-checks the destructive run before authorising it.
30175
+ *
30176
+ * REFUSES a source that is still a write target: a listing of a live
30177
+ * location is a lower bound, which is not the strong evidence that lets
30178
+ * this pass forget without a budget. A live location is reconciled by the
30179
+ * mover, under D318's bound.
30180
+ */
30181
+ reconcileLedgerAgainstDisk: method(LedgerWalkInputSchema, LedgerWalkReportSchema, {
30182
+ kind: "mutation",
30183
+ auth: "admin"
30184
+ }),
30026
30185
  /** Cancel a running or queued relocate job. A queued job never runs. */
30027
30186
  cancelRelocateJob: method(z.object({ jobId: z.string() }), z.object({ cancelled: z.boolean() }), {
30028
30187
  kind: "mutation",
@@ -30457,6 +30616,25 @@ var SceneMonitorStatusSchema = z.object({
30457
30616
  monitors: z.array(SceneMonitorSchema),
30458
30617
  lastFetchedAt: z.number()
30459
30618
  });
30619
+ /**
30620
+ * One camera's row in a `listScenesBatch` answer.
30621
+ *
30622
+ * `status` is NULLABLE and the nullability is the whole point. `scene-monitor`
30623
+ * is a `defaultActive` wrapper, so every camera is asked; a camera whose
30624
+ * provider is absent (pipeline-analytics not deployed, the post-processing node
30625
+ * down) cannot answer, and that is not the same fact as a camera with no scenes
30626
+ * configured. Fanned out per camera the difference was visible — one query
30627
+ * errored while the others resolved — and a batch that returned only the rows
30628
+ * it managed would have destroyed it, silently, by making an unreachable camera
30629
+ * indistinguishable from one that answered `monitors: []`.
30630
+ *
30631
+ * So: EVERY requested deviceId gets a row. `status: null` means "this camera
30632
+ * could not be read"; `status.monitors: []` means "read, and it has none".
30633
+ */
30634
+ var SceneMonitorStatusForDeviceSchema = z.object({
30635
+ deviceId: z.number(),
30636
+ status: SceneMonitorStatusSchema.nullable()
30637
+ });
30460
30638
  var sceneMonitorCapability = {
30461
30639
  name: "scene-monitor",
30462
30640
  scope: "device",
@@ -30466,6 +30644,22 @@ var sceneMonitorCapability = {
30466
30644
  deviceTypes: [DeviceType.Camera],
30467
30645
  methods: {
30468
30646
  listScenes: method(z.object({ deviceId: z.number() }), SceneMonitorStatusSchema),
30647
+ /**
30648
+ * The same answer, for a SET of cameras, in one round trip.
30649
+ *
30650
+ * `/scenes` renders every camera and re-reads them on a 30s safety-net
30651
+ * poll behind the push slice. Fanned out client-side that was one query
30652
+ * per camera — 29 round trips through the browser, the hub and the
30653
+ * post-analysis runner every 30 seconds to read an in-memory map the
30654
+ * owner had already merged. The work is unchanged (`statusFor` per
30655
+ * device, all in-process at the owner); what collapses is the transport.
30656
+ *
30657
+ * A camera that cannot answer still gets a row, with `status: null` —
30658
+ * see {@link SceneMonitorStatusForDeviceSchema}. Never fewer rows than
30659
+ * ids: a caller that asked for twenty-nine and got twenty-seven cannot
30660
+ * tell which two are missing, or that any are.
30661
+ */
30662
+ listScenesBatch: method(z.object({ deviceIds: z.array(z.number()).min(1).max(200) }), z.array(SceneMonitorStatusForDeviceSchema).readonly()),
30469
30663
  createScene: method(z.object({
30470
30664
  deviceId: z.number(),
30471
30665
  label: z.string(),
@@ -32736,6 +32930,27 @@ var CameraOccupancySnapshotSchema = z.object({
32736
32930
  stationaryObjects: z.array(StationaryObjectSchema).readonly().optional()
32737
32931
  });
32738
32932
  /**
32933
+ * One camera's row in a `getCurrentSnapshotBatch` answer.
32934
+ *
32935
+ * THREE outcomes, and the single-camera method could only express two of them
32936
+ * because `snapshot: null` was already spoken for:
32937
+ *
32938
+ * - `read: 'read'`, `snapshot` present — the live occupancy reading.
32939
+ * - `read: 'read'`, `snapshot: null` — read, and this camera has no reading
32940
+ * yet: no frame since boot, and no parked-object registry to hydrate from.
32941
+ * - `read: 'unreadable'` — the owner could not answer for this
32942
+ * camera. `snapshot` is null, and it does NOT mean "nothing parked here".
32943
+ *
32944
+ * Collapsing the last two is the failure this field exists to prevent: a
32945
+ * hydration that threw would otherwise render as an empty Stationary section,
32946
+ * which is a definite claim about a camera nobody could read.
32947
+ */
32948
+ var CameraOccupancySnapshotForDeviceSchema = z.object({
32949
+ deviceId: z.number(),
32950
+ read: z.enum(["read", "unreadable"]),
32951
+ snapshot: CameraOccupancySnapshotSchema.nullable()
32952
+ });
32953
+ /**
32739
32954
  * Time-series resolution. The history methods return one bucket per
32740
32955
  * step over the requested range. Smaller resolutions cost more
32741
32956
  * memory + bandwidth; bound to discrete steps so caller cannot ask
@@ -32792,6 +33007,20 @@ var zoneAnalyticsCapability = {
32792
33007
  * (no inference result emitted since boot or since binding was
32793
33008
  * activated). */
32794
33009
  getCurrentSnapshot: method(z.object({ deviceId: z.number() }), CameraOccupancySnapshotSchema.nullable()),
33010
+ /**
33011
+ * The same snapshot, for a SET of cameras, in one round trip.
33012
+ *
33013
+ * The Events page's Stationary section polls this every 15s for every
33014
+ * selected camera. Fanned out client-side that is one query per camera to
33015
+ * read a `Map.get` at the owner — the answer costs nothing, the round trip
33016
+ * costs everything. Batched, N transports become one and the per-device
33017
+ * work is unchanged.
33018
+ *
33019
+ * Every requested deviceId gets a row, tagged `read` — see
33020
+ * {@link CameraOccupancySnapshotForDeviceSchema}. A camera the owner could
33021
+ * not answer for is `'unreadable'`, never an empty reading.
33022
+ */
33023
+ getCurrentSnapshotBatch: method(z.object({ deviceIds: z.array(z.number()).min(1).max(200) }), z.array(CameraOccupancySnapshotForDeviceSchema).readonly()),
32795
33024
  /** Time-series object count inside one zone. `className` optional —
32796
33025
  * omit to count every class in the zone. */
32797
33026
  getZoneHistory: method(z.object({
@@ -36925,6 +37154,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
36925
37154
  addonId: null,
36926
37155
  access: "view"
36927
37156
  },
37157
+ "pipelineAnalytics.getKeyEventsBatch": {
37158
+ capName: "pipeline-analytics",
37159
+ capScope: "device",
37160
+ addonId: null,
37161
+ access: "view"
37162
+ },
36928
37163
  "pipelineAnalytics.getMotionEvents": {
36929
37164
  capName: "pipeline-analytics",
36930
37165
  capScope: "device",
@@ -38101,6 +38336,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
38101
38336
  addonId: null,
38102
38337
  access: "view"
38103
38338
  },
38339
+ "recording.reconcileLedgerAgainstDisk": {
38340
+ capName: "recording",
38341
+ capScope: "system",
38342
+ addonId: null,
38343
+ access: "create"
38344
+ },
38104
38345
  "recording.refreshStorageLocationsForMigration": {
38105
38346
  capName: "recording",
38106
38347
  capScope: "system",
@@ -38227,6 +38468,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
38227
38468
  addonId: null,
38228
38469
  access: "view"
38229
38470
  },
38471
+ "sceneMonitor.listScenesBatch": {
38472
+ capName: "scene-monitor",
38473
+ capScope: "device",
38474
+ addonId: null,
38475
+ access: "view"
38476
+ },
38230
38477
  "sceneMonitor.recheckNow": {
38231
38478
  capName: "scene-monitor",
38232
38479
  capScope: "device",
@@ -39583,6 +39830,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
39583
39830
  addonId: null,
39584
39831
  access: "view"
39585
39832
  },
39833
+ "zoneAnalytics.getCurrentSnapshotBatch": {
39834
+ capName: "zone-analytics",
39835
+ capScope: "device",
39836
+ addonId: null,
39837
+ access: "view"
39838
+ },
39586
39839
  "zoneAnalytics.getUnzonedHistory": {
39587
39840
  capName: "zone-analytics",
39588
39841
  capScope: "device",
@@ -40587,6 +40840,11 @@ Object.freeze({
40587
40840
  form: "single",
40588
40841
  optional: false
40589
40842
  }],
40843
+ "pipelineAnalytics.getKeyEventsBatch": [{
40844
+ name: "deviceIds",
40845
+ form: "array",
40846
+ optional: false
40847
+ }],
40590
40848
  "pipelineAnalytics.getMotionEvents": [{
40591
40849
  name: "deviceId",
40592
40850
  form: "single",
@@ -41027,6 +41285,11 @@ Object.freeze({
41027
41285
  form: "single",
41028
41286
  optional: false
41029
41287
  }],
41288
+ "recording.reconcileLedgerAgainstDisk": [{
41289
+ name: "deviceId",
41290
+ form: "single",
41291
+ optional: true
41292
+ }],
41030
41293
  "recording.relocateFootage": [{
41031
41294
  name: "deviceId",
41032
41295
  form: "single",
@@ -41092,6 +41355,11 @@ Object.freeze({
41092
41355
  form: "single",
41093
41356
  optional: false
41094
41357
  }],
41358
+ "sceneMonitor.listScenesBatch": [{
41359
+ name: "deviceIds",
41360
+ form: "array",
41361
+ optional: false
41362
+ }],
41095
41363
  "sceneMonitor.recheckNow": [{
41096
41364
  name: "deviceId",
41097
41365
  form: "single",
@@ -41353,6 +41621,11 @@ Object.freeze({
41353
41621
  form: "single",
41354
41622
  optional: false
41355
41623
  }],
41624
+ "zoneAnalytics.getCurrentSnapshotBatch": [{
41625
+ name: "deviceIds",
41626
+ form: "array",
41627
+ optional: false
41628
+ }],
41356
41629
  "zoneAnalytics.getUnzonedHistory": [{
41357
41630
  name: "deviceId",
41358
41631
  form: "single",
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-Cek0wNdY.js");
3
- const require_dist = require("./dist-CCIBlacf.js");
3
+ const require_dist = require("./dist-B29Skpzo.js");
4
4
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
5
5
  require("./builtins/alerts/index.js");
6
6
  const require_formatter = require("./formatter-DqAKDlvN.js");
@@ -26,7 +26,7 @@ require("./builtins/system-config/index.js");
26
26
  const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
27
27
  const require_file_data_plane = require("./file-data-plane-DO8KbxCe.js");
28
28
  const require_tls$1 = require("./tls-BxQlomxd.js");
29
- const require_manifest_system_deps = require("./manifest-system-deps-alrkBKVQ.js");
29
+ const require_manifest_system_deps = require("./manifest-system-deps-DBje540e.js");
30
30
  const require_resource_monitor = require("./resource-monitor-CdnzxBLP.js");
31
31
  const require_custom_action_registry = require("./custom-action-registry-jY0NOZK8.js");
32
32
  let zod = require("zod");
@@ -6847,19 +6847,82 @@ function unwrapValue(parsed) {
6847
6847
  if (!isRecord$1(parsed) || !("value" in parsed)) return parsed;
6848
6848
  return parsed.value;
6849
6849
  }
6850
+ /**
6851
+ * Rows one page of a prefix read asks for.
6852
+ *
6853
+ * Below `SETTINGS_QUERY_DEFAULT_ROW_CAP` (2 000, `query-bounds.ts`) on purpose:
6854
+ * this read now names its own bound, so the engine's defensive cap is never the
6855
+ * thing that decides how much of the answer the caller gets.
6856
+ */
6857
+ var PREFIX_PAGE_ROWS = 1e3;
6858
+ /**
6859
+ * Pages one prefix read may take before it refuses.
6860
+ *
6861
+ * 512 pages is 512 000 rows — three orders of magnitude past the largest live
6862
+ * scope (`addon-device-settings` for one addon over a ~1 019-device fleet) and
6863
+ * still a bound, because a walk with no bound is the defect this file was
6864
+ * fixing, not one to reintroduce.
6865
+ */
6866
+ var PREFIX_PAGE_BUDGET = 512;
6867
+ /**
6868
+ * Every row under `prefix`, or a throw — never the first 2 000 of them.
6869
+ *
6870
+ * **The defect.** This issued ONE `query` with no `limit`, and
6871
+ * `queryDeclared` resolves an absent limit to `SETTINGS_QUERY_DEFAULT_ROW_CAP`
6872
+ * and cuts the result there. On the live hub that fired 138 times in two hours
6873
+ * (`settings-store query truncated by a defensive row cap`, collection
6874
+ * `addon-device-settings`, `rowCap: 2000`, `requestedLimit: null`): a
6875
+ * ~1 019-device fleet with more than two stored keys per device puts one
6876
+ * addon's `<addonId>:` range past the cap. The engine warned; the door did not
6877
+ * notice, and handed its caller a short map that is **shape-identical to a
6878
+ * complete one**. Every device whose rows sort past the cap reads as "has no
6879
+ * stored settings", which is exactly what a device with none looks like.
6880
+ *
6881
+ * **The fix is a keyset walk, not a bigger limit.** The cursor is the last id
6882
+ * of the previous page, INCLUSIVE — so the page boundary re-reads exactly one
6883
+ * row (ids are unique, so a full page always advances) and no row can fall
6884
+ * between two pages the way an `OFFSET` walk drops rows under a concurrent
6885
+ * write (D295 rule 1). Re-reading is free here: the accumulator is keyed by
6886
+ * suffix, so the duplicate overwrites itself with its own value.
6887
+ *
6888
+ * `ORDER BY id` is not decoration — the cursor is only meaningful if the
6889
+ * engine returns the range in the order the cursor advances through. It is the
6890
+ * primary key, so the ordering is the range scan's own.
6891
+ *
6892
+ * @throws when the prefix cannot be expressed as a range and the collection is
6893
+ * larger than one page, or when the walk exceeds {@link PREFIX_PAGE_BUDGET}.
6894
+ * A throw is the point: a caller that cannot be answered completely must not
6895
+ * be handed something that looks like a complete answer.
6896
+ */
6850
6897
  async function loadPrefixed(door, collection, prefix) {
6851
6898
  const range = require_builtins_sqlite_storage_sqlite_settings_addon.prefixRange(prefix);
6852
- const rows = await door.query({
6853
- collection,
6854
- ...range !== null ? { filter: { whereBetween: { id: [range.lo, range.hi] } } } : {}
6855
- });
6856
6899
  const result = {};
6857
- for (const row of rows) {
6858
- if (range !== null && (row.id < range.lo || row.id >= range.hi)) continue;
6859
- if (!row.id.startsWith(prefix)) continue;
6860
- result[row.id.slice(prefix.length)] = unwrapValue(row.data);
6900
+ let cursor = range?.lo ?? null;
6901
+ for (let page = 0;; page++) {
6902
+ if (page >= PREFIX_PAGE_BUDGET) throw new Error(`settings door: reading "${prefix}" from "${collection}" exceeded ${PREFIX_PAGE_BUDGET} pages of ${PREFIX_PAGE_ROWS} rows. Refusing to return the part that was read — a partial scope read is indistinguishable from an empty one.`);
6903
+ const rows = await door.query({
6904
+ collection,
6905
+ filter: {
6906
+ ...range !== null && cursor !== null ? { whereBetween: { id: [cursor, range.hi] } } : {},
6907
+ orderBy: {
6908
+ field: "id",
6909
+ direction: "asc"
6910
+ },
6911
+ limit: PREFIX_PAGE_ROWS
6912
+ }
6913
+ });
6914
+ for (const row of rows) {
6915
+ if (range !== null && (row.id < range.lo || row.id >= range.hi)) continue;
6916
+ if (!row.id.startsWith(prefix)) continue;
6917
+ result[row.id.slice(prefix.length)] = unwrapValue(row.data);
6918
+ }
6919
+ if (rows.length < PREFIX_PAGE_ROWS) return result;
6920
+ const last = rows[rows.length - 1];
6921
+ if (last === void 0) return result;
6922
+ if (range === null) throw new Error(`settings door: prefix "${prefix}" on "${collection}" cannot be expressed as an id range, and the unfiltered read filled a page — the answer would be partial. Use an ASCII, non-empty prefix.`);
6923
+ if (last.id === cursor) throw new Error(`settings door: reading "${prefix}" from "${collection}" made no progress at id "${last.id}" — ids under a prefix must be unique.`);
6924
+ cursor = last.id;
6861
6925
  }
6862
- return result;
6863
6926
  }
6864
6927
  async function replacePrefixed(door, collection, prefix, values, wrap) {
6865
6928
  const range = require_builtins_sqlite_storage_sqlite_settings_addon.prefixRange(prefix);
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM$1, r as __exportAll, t as __commonJSMin$1 } from "./chunk-CNf5ZN-e.mjs";
2
- import { $ as isObjectInput, $t as parseJsonUnknown$1, Bt as ReadinessTimeoutError, Ft as DEVICE_STATUS_METHOD, Gt as createEvent, Ht as asJsonObject$1, J as extractNestedAddonId, Jt as expandCapMethods, Kt as emitDownForOwnedCaps, Nt as DATAPLANE_SECRET_HEADER$1, Pt as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Q as isCollectionArrayMethod, Qt as parseJsonObject, T as addonSettingsCapability, Ut as asNumber, Wt as asString$1, Z as isArrayOutputSchema, _t as resolveMethodAuth, bt as scopesAllowDeviceCap, ct as looseSchema, dt as objectInputDeclaresAddonId, en as readinessKey, f as LOG_LEVEL_RANK, h as RUNTIME_DEFAULTS, in as EventCategory$1, it as lifecycleJobSchema, jt as errMsg$1, mt as procedureAuthKey, nn as scopeKey, nt as isVoidInput, p as METHOD_ACCESS_MAP, rt as kebabToCamel, st as logLevelAtMost, t as ALL_CAPABILITY_DEFINITIONS, tn as resolveCapMount, yt as scopesAllowAddon, zt as ReadinessRegistry } from "./dist-5Xzz_kCk.mjs";
2
+ import { $ as isObjectInput, $t as parseJsonUnknown$1, Bt as ReadinessTimeoutError, Ft as DEVICE_STATUS_METHOD, Gt as createEvent, Ht as asJsonObject$1, J as extractNestedAddonId, Jt as expandCapMethods, Kt as emitDownForOwnedCaps, Nt as DATAPLANE_SECRET_HEADER$1, Pt as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Q as isCollectionArrayMethod, Qt as parseJsonObject, T as addonSettingsCapability, Ut as asNumber, Wt as asString$1, Z as isArrayOutputSchema, _t as resolveMethodAuth, bt as scopesAllowDeviceCap, ct as looseSchema, dt as objectInputDeclaresAddonId, en as readinessKey, f as LOG_LEVEL_RANK, h as RUNTIME_DEFAULTS, in as EventCategory$1, it as lifecycleJobSchema, jt as errMsg$1, mt as procedureAuthKey, nn as scopeKey, nt as isVoidInput, p as METHOD_ACCESS_MAP, rt as kebabToCamel, st as logLevelAtMost, t as ALL_CAPABILITY_DEFINITIONS, tn as resolveCapMount, yt as scopesAllowAddon, zt as ReadinessRegistry } from "./dist-DxFjna2a.mjs";
3
3
  import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
4
4
  import "./builtins/alerts/index.mjs";
5
5
  import { t as formatLogLine } from "./formatter-B7qW8bPJ.mjs";
@@ -25,7 +25,7 @@ import "./builtins/system-config/index.mjs";
25
25
  import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
26
26
  import { a as parseTokenizedUrl, c as collectModelFiles, d as downloadModel, f as ensureModel, h as isModelDownloaded, i as parseRangeHeader, l as deleteModelFromDisk, m as getModelFilePath, n as contentTypeFor, o as resolveFilePath, p as fetchJson, r as createAuthenticatedFileServer, s as ModelDownloadService, t as createFileDataPlaneHandler, u as downloadFile } from "./file-data-plane-BhKdxJgf.mjs";
27
27
  import { C as registerLanHttpHandler, S as readLanHttpState, _ as DEFAULT_LAN_HTTP_PORT, a as writeTlsMode, b as bindPendingLanHttp, c as loadTlsCert, d as collectCertIdentity, f as CA_VALIDITY_DAYS, g as evaluateExistingCert, h as SERVER_AUTH_OID, i as writeExtraSans, l as reissueTlsLeaf, m as MAX_LEAF_VALIDITY_DAYS, n as readTlsAccessStatus, o as validateUploadedTls, p as LEAF_RENEWAL_WINDOW_DAYS, r as readTlsMode, s as ensureTlsCert, t as readExtraSans, u as CA_COMMON_NAME, v as allFamiliesListenHost, x as closeLanHttp, y as applyLanHttp } from "./tls-DOTmtLCW.mjs";
28
- import { $ as FrameDecoder, $t as DECISIVE_HEAP_SPACES, A as createUdsEventBus, At as HEAP_WATCH_INTERVAL_MS, B as CapRouteError, Bt as buildHeapSample, C as ipcParentLink, Cn as diffEventPlane, Ct as resolveAddonClass, D as createHubCapForwardService, Dt as HEAP_RECLAIM_MIN_INTERVAL_MS, E as HUB_CAP_FWD_SERVICE, Et as createAddonDataPlaneFacility, F as LocalChildRegistry, Ft as RSS_BUDGET_REANNOUNCE_MIN_MS, G as PARENT_ROUTED_PROVIDER_ADDON_ID, Gt as hubMainRssBudget, H as callWithServiceDiscovery, Ht as createLoopDelayMeter, I as UDS_NO_ROUTE_PREFIX, It as RSS_BUDGET_RELEASE_RATIO, J as createLocalTransport, Jt as reclaimIntervalMs, K as __resetCapUsageRegistryForTests, Kt as nextRssBudgetState, L as AGENT_CAP_FWD_ACTION, Lt as RUNNER_HEAP_WATCH_INTERVAL_MS, M as createUdsLogger, Mt as HUB_MAIN_HEAP_WATCH_LABEL, N as createUdsLoggerWithControl, Nt as HUB_MAIN_RSS_BUDGET_MB, O as createParentUnownedCallHandler, Ot as HEAP_RECLAIM_STEADY_STATE_INTERVAL_MS, P as LocalChildClient, Pt as HUB_RSS_BUDGET_ENV, Q as localEndpointPath, Qt as strandedMb, R as AGENT_CAP_FWD_SERVICE, Rt as RUNNER_RSS_BUDGET_ENV, S as buildLinkChain, Sn as createEventPlaneReader, St as installManifestNativeDeps, T as HUB_CAP_FWD_ACTION, Tt as runNpm, U as readMoleculerFanoutMode, Ut as createV8Reclaimer, V as classifyCapRoute, Vt as createDeferredHeapWatchSink, W as CapUsageRegistry, Wt as describeRss, X as UdsLocalTransportServer, Xt as startHeapWatch, Y as UdsLocalTransportClient, Yt as shouldReclaim, Z as SocketChannel, Zt as startRunnerHeapWatch, _ as AddonDepsManager, _n as sampleSocketDirection, _t as serializeTypedArrays, a as createUdsAddonContext, an as heapSpaceField, b as brokerCallForCap, bn as EVENT_PLANE_TOP_N, bt as CapabilityUnavailableError, c as getOrInitReadinessRegistryForClient, cn as EMPTY_SOCKET_PLANE_BASELINE, ct as createAddonService, d as clusterEventTopic, dn as createSocketPlaneReader, dt as capActionName, en as HEAP_SPACE_REPORT_MIN_MB, et as encodeFrame, f as getBrokerEventBus, fn as diffSocketPlane, ft as capActionSuffix, g as subscribePassthrough, gn as recordSocketFrame, gt as deserializeTypedArrays, h as setNodeEventInterest, hn as createSocketDirectionCounters, ht as parseCapAction, i as createAddonContext, in as heapSnapshotAuthorised, j as udsChildLogToWorkerEntry, jt as HEAP_WATCH_WARN_RATIO, k as createUdsEventBridge, kt as HEAP_RECLAIM_TRIGGER_MB, l as setHubConnected, ln as SOCKET_PLANE_TOP_N, lt as validateProviderRegistrations, m as registerEventBusService, mn as EMPTY_SOCKET_DIRECTION, mt as capServiceName, n as installManifestPythonDeps, nn as emitHeapDiagnosticReport, nt as buildUdsNativeCapProxy, o as getWorkerDeviceRegistry, on as readHeapSpaces, ot as mountNativeCapService, p as getMoleculerEventStats, pn as formatSocketPlane, pt as capBareAction, q as getCapUsageRegistry, qt as parseRssBudgetMb, r as adaptBrokerToCluster, rn as formatHeapSpaces, rt as createBrokerDeviceManagerApi, s as getOrInitReadinessRegistry, sn as selectReportedSpaces, t as installManifestSystemDeps, tn as RUNNER_HEAP_SNAPSHOT_ENV, tt as buildNativeCapProxy, u as EVENT_TOPIC_PREFIX, un as createSocketPlaneMeter, ut as NATIVE_PROVIDER_SERVICE_INFIX, v as createKernelHwAccel, vn as socketDirectionBytes, vt as DeviceRegistry, w as localProviderLink, wn as formatEventPlane, wt as resolveNpmInvocation, x as brokerTransportLink, xn as createEventPlaneMeter, xt as copyBundledNativeModules, y as resolveHwAccel, yn as socketDirectionMessages, yt as CapabilityHandle, z as CapRouteResolver, zt as ZERO_LOOP_DELAY } from "./manifest-system-deps-shjDShSB.mjs";
28
+ import { $ as FrameDecoder, $t as DECISIVE_HEAP_SPACES, A as createUdsEventBus, At as HEAP_WATCH_INTERVAL_MS, B as CapRouteError, Bt as buildHeapSample, C as ipcParentLink, Cn as diffEventPlane, Ct as resolveAddonClass, D as createHubCapForwardService, Dt as HEAP_RECLAIM_MIN_INTERVAL_MS, E as HUB_CAP_FWD_SERVICE, Et as createAddonDataPlaneFacility, F as LocalChildRegistry, Ft as RSS_BUDGET_REANNOUNCE_MIN_MS, G as PARENT_ROUTED_PROVIDER_ADDON_ID, Gt as hubMainRssBudget, H as callWithServiceDiscovery, Ht as createLoopDelayMeter, I as UDS_NO_ROUTE_PREFIX, It as RSS_BUDGET_RELEASE_RATIO, J as createLocalTransport, Jt as reclaimIntervalMs, K as __resetCapUsageRegistryForTests, Kt as nextRssBudgetState, L as AGENT_CAP_FWD_ACTION, Lt as RUNNER_HEAP_WATCH_INTERVAL_MS, M as createUdsLogger, Mt as HUB_MAIN_HEAP_WATCH_LABEL, N as createUdsLoggerWithControl, Nt as HUB_MAIN_RSS_BUDGET_MB, O as createParentUnownedCallHandler, Ot as HEAP_RECLAIM_STEADY_STATE_INTERVAL_MS, P as LocalChildClient, Pt as HUB_RSS_BUDGET_ENV, Q as localEndpointPath, Qt as strandedMb, R as AGENT_CAP_FWD_SERVICE, Rt as RUNNER_RSS_BUDGET_ENV, S as buildLinkChain, Sn as createEventPlaneReader, St as installManifestNativeDeps, T as HUB_CAP_FWD_ACTION, Tt as runNpm, U as readMoleculerFanoutMode, Ut as createV8Reclaimer, V as classifyCapRoute, Vt as createDeferredHeapWatchSink, W as CapUsageRegistry, Wt as describeRss, X as UdsLocalTransportServer, Xt as startHeapWatch, Y as UdsLocalTransportClient, Yt as shouldReclaim, Z as SocketChannel, Zt as startRunnerHeapWatch, _ as AddonDepsManager, _n as sampleSocketDirection, _t as serializeTypedArrays, a as createUdsAddonContext, an as heapSpaceField, b as brokerCallForCap, bn as EVENT_PLANE_TOP_N, bt as CapabilityUnavailableError, c as getOrInitReadinessRegistryForClient, cn as EMPTY_SOCKET_PLANE_BASELINE, ct as createAddonService, d as clusterEventTopic, dn as createSocketPlaneReader, dt as capActionName, en as HEAP_SPACE_REPORT_MIN_MB, et as encodeFrame, f as getBrokerEventBus, fn as diffSocketPlane, ft as capActionSuffix, g as subscribePassthrough, gn as recordSocketFrame, gt as deserializeTypedArrays, h as setNodeEventInterest, hn as createSocketDirectionCounters, ht as parseCapAction, i as createAddonContext, in as heapSnapshotAuthorised, j as udsChildLogToWorkerEntry, jt as HEAP_WATCH_WARN_RATIO, k as createUdsEventBridge, kt as HEAP_RECLAIM_TRIGGER_MB, l as setHubConnected, ln as SOCKET_PLANE_TOP_N, lt as validateProviderRegistrations, m as registerEventBusService, mn as EMPTY_SOCKET_DIRECTION, mt as capServiceName, n as installManifestPythonDeps, nn as emitHeapDiagnosticReport, nt as buildUdsNativeCapProxy, o as getWorkerDeviceRegistry, on as readHeapSpaces, ot as mountNativeCapService, p as getMoleculerEventStats, pn as formatSocketPlane, pt as capBareAction, q as getCapUsageRegistry, qt as parseRssBudgetMb, r as adaptBrokerToCluster, rn as formatHeapSpaces, rt as createBrokerDeviceManagerApi, s as getOrInitReadinessRegistry, sn as selectReportedSpaces, t as installManifestSystemDeps, tn as RUNNER_HEAP_SNAPSHOT_ENV, tt as buildNativeCapProxy, u as EVENT_TOPIC_PREFIX, un as createSocketPlaneMeter, ut as NATIVE_PROVIDER_SERVICE_INFIX, v as createKernelHwAccel, vn as socketDirectionBytes, vt as DeviceRegistry, w as localProviderLink, wn as formatEventPlane, wt as resolveNpmInvocation, x as brokerTransportLink, xn as createEventPlaneMeter, xt as copyBundledNativeModules, y as resolveHwAccel, yn as socketDirectionMessages, yt as CapabilityHandle, z as CapRouteResolver, zt as ZERO_LOOP_DELAY } from "./manifest-system-deps-CG9ESHhv.mjs";
29
29
  import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-BWmQ5i-o.mjs";
30
30
  import { t as CustomActionRegistry } from "./custom-action-registry-F__gp_VX.mjs";
31
31
  import { z } from "zod";
@@ -6840,19 +6840,82 @@ function unwrapValue(parsed) {
6840
6840
  if (!isRecord$1(parsed) || !("value" in parsed)) return parsed;
6841
6841
  return parsed.value;
6842
6842
  }
6843
+ /**
6844
+ * Rows one page of a prefix read asks for.
6845
+ *
6846
+ * Below `SETTINGS_QUERY_DEFAULT_ROW_CAP` (2 000, `query-bounds.ts`) on purpose:
6847
+ * this read now names its own bound, so the engine's defensive cap is never the
6848
+ * thing that decides how much of the answer the caller gets.
6849
+ */
6850
+ var PREFIX_PAGE_ROWS = 1e3;
6851
+ /**
6852
+ * Pages one prefix read may take before it refuses.
6853
+ *
6854
+ * 512 pages is 512 000 rows — three orders of magnitude past the largest live
6855
+ * scope (`addon-device-settings` for one addon over a ~1 019-device fleet) and
6856
+ * still a bound, because a walk with no bound is the defect this file was
6857
+ * fixing, not one to reintroduce.
6858
+ */
6859
+ var PREFIX_PAGE_BUDGET = 512;
6860
+ /**
6861
+ * Every row under `prefix`, or a throw — never the first 2 000 of them.
6862
+ *
6863
+ * **The defect.** This issued ONE `query` with no `limit`, and
6864
+ * `queryDeclared` resolves an absent limit to `SETTINGS_QUERY_DEFAULT_ROW_CAP`
6865
+ * and cuts the result there. On the live hub that fired 138 times in two hours
6866
+ * (`settings-store query truncated by a defensive row cap`, collection
6867
+ * `addon-device-settings`, `rowCap: 2000`, `requestedLimit: null`): a
6868
+ * ~1 019-device fleet with more than two stored keys per device puts one
6869
+ * addon's `<addonId>:` range past the cap. The engine warned; the door did not
6870
+ * notice, and handed its caller a short map that is **shape-identical to a
6871
+ * complete one**. Every device whose rows sort past the cap reads as "has no
6872
+ * stored settings", which is exactly what a device with none looks like.
6873
+ *
6874
+ * **The fix is a keyset walk, not a bigger limit.** The cursor is the last id
6875
+ * of the previous page, INCLUSIVE — so the page boundary re-reads exactly one
6876
+ * row (ids are unique, so a full page always advances) and no row can fall
6877
+ * between two pages the way an `OFFSET` walk drops rows under a concurrent
6878
+ * write (D295 rule 1). Re-reading is free here: the accumulator is keyed by
6879
+ * suffix, so the duplicate overwrites itself with its own value.
6880
+ *
6881
+ * `ORDER BY id` is not decoration — the cursor is only meaningful if the
6882
+ * engine returns the range in the order the cursor advances through. It is the
6883
+ * primary key, so the ordering is the range scan's own.
6884
+ *
6885
+ * @throws when the prefix cannot be expressed as a range and the collection is
6886
+ * larger than one page, or when the walk exceeds {@link PREFIX_PAGE_BUDGET}.
6887
+ * A throw is the point: a caller that cannot be answered completely must not
6888
+ * be handed something that looks like a complete answer.
6889
+ */
6843
6890
  async function loadPrefixed(door, collection, prefix) {
6844
6891
  const range = prefixRange(prefix);
6845
- const rows = await door.query({
6846
- collection,
6847
- ...range !== null ? { filter: { whereBetween: { id: [range.lo, range.hi] } } } : {}
6848
- });
6849
6892
  const result = {};
6850
- for (const row of rows) {
6851
- if (range !== null && (row.id < range.lo || row.id >= range.hi)) continue;
6852
- if (!row.id.startsWith(prefix)) continue;
6853
- result[row.id.slice(prefix.length)] = unwrapValue(row.data);
6893
+ let cursor = range?.lo ?? null;
6894
+ for (let page = 0;; page++) {
6895
+ if (page >= PREFIX_PAGE_BUDGET) throw new Error(`settings door: reading "${prefix}" from "${collection}" exceeded ${PREFIX_PAGE_BUDGET} pages of ${PREFIX_PAGE_ROWS} rows. Refusing to return the part that was read — a partial scope read is indistinguishable from an empty one.`);
6896
+ const rows = await door.query({
6897
+ collection,
6898
+ filter: {
6899
+ ...range !== null && cursor !== null ? { whereBetween: { id: [cursor, range.hi] } } : {},
6900
+ orderBy: {
6901
+ field: "id",
6902
+ direction: "asc"
6903
+ },
6904
+ limit: PREFIX_PAGE_ROWS
6905
+ }
6906
+ });
6907
+ for (const row of rows) {
6908
+ if (range !== null && (row.id < range.lo || row.id >= range.hi)) continue;
6909
+ if (!row.id.startsWith(prefix)) continue;
6910
+ result[row.id.slice(prefix.length)] = unwrapValue(row.data);
6911
+ }
6912
+ if (rows.length < PREFIX_PAGE_ROWS) return result;
6913
+ const last = rows[rows.length - 1];
6914
+ if (last === void 0) return result;
6915
+ if (range === null) throw new Error(`settings door: prefix "${prefix}" on "${collection}" cannot be expressed as an id range, and the unfiltered read filled a page — the answer would be partial. Use an ASCII, non-empty prefix.`);
6916
+ if (last.id === cursor) throw new Error(`settings door: reading "${prefix}" from "${collection}" made no progress at id "${last.id}" — ids under a prefix must be unique.`);
6917
+ cursor = last.id;
6854
6918
  }
6855
- return result;
6856
6919
  }
6857
6920
  async function replacePrefixed(door, collection, prefix, values, wrap) {
6858
6921
  const range = prefixRange(prefix);
@@ -1,4 +1,4 @@
1
- import "./dist-5Xzz_kCk.mjs";
1
+ import "./dist-DxFjna2a.mjs";
2
2
  import * as crypto$1 from "node:crypto";
3
3
  import { randomBytes, randomUUID } from "node:crypto";
4
4
  import { ensureBinary, ensureFfmpeg, ensurePython, installPythonPackages, installPythonRequirements } from "@camstack/types/node";
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- require("./dist-CCIBlacf.js");
2
+ require("./dist-B29Skpzo.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  node_crypto = require_chunk.__toESM(node_crypto);
5
5
  let _camstack_types_node = require("@camstack/types/node");
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-CCIBlacf.js");
1
+ const require_dist = require("./dist-B29Skpzo.js");
2
2
  //#region src/builtins/sqlite-storage/retired-settings-keys.ts
3
3
  /**
4
4
  * Is THIS node the one whose settings store is the cluster's authority?
@@ -1,4 +1,4 @@
1
- import { Ht as asJsonObject } from "./dist-5Xzz_kCk.mjs";
1
+ import { Ht as asJsonObject } from "./dist-DxFjna2a.mjs";
2
2
  //#region src/builtins/sqlite-storage/retired-settings-keys.ts
3
3
  /**
4
4
  * Is THIS node the one whose settings store is the cluster's authority?