@camstack/system 1.2.157 → 1.2.160

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 (77) hide show
  1. package/dist/addon-runner.js +17 -16
  2. package/dist/addon-runner.mjs +2 -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.d.ts +10 -7
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +50 -12
  11. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +50 -12
  12. package/dist/builtins/backup-orchestrator/write-targets.d.ts +63 -0
  13. package/dist/builtins/console-logging/index.js +1 -1
  14. package/dist/builtins/console-logging/index.mjs +1 -1
  15. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  16. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  17. package/dist/builtins/device-manager/device-bindings-store.d.ts +56 -10
  18. package/dist/builtins/device-manager/device-manager.addon.d.ts +11 -0
  19. package/dist/builtins/device-manager/device-manager.addon.js +216 -81
  20. package/dist/builtins/device-manager/device-manager.addon.mjs +216 -81
  21. package/dist/builtins/device-manager/device-meta-actions.d.ts +9 -3
  22. package/dist/builtins/device-manager/device-meta-store.d.ts +32 -5
  23. package/dist/builtins/device-manager/device-queries.d.ts +7 -3
  24. package/dist/builtins/device-manager/write-lock.d.ts +17 -0
  25. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  26. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  27. package/dist/builtins/hub-forwarder/index.js +1 -1
  28. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  29. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  30. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  31. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  32. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  33. package/dist/builtins/local-network/local-network.addon.js +1 -1
  34. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  35. package/dist/builtins/loki-logging/index.js +1 -1
  36. package/dist/builtins/loki-logging/index.mjs +1 -1
  37. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  38. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  39. package/dist/builtins/platform-probe/index.js +1 -1
  40. package/dist/builtins/platform-probe/index.mjs +1 -1
  41. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  42. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  43. package/dist/builtins/snapshot/index.js +1 -1
  44. package/dist/builtins/snapshot/index.mjs +1 -1
  45. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  46. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  47. package/dist/builtins/sqlite-storage/filter-compiler.d.ts +41 -2
  48. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +15 -7
  49. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  50. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  51. package/dist/builtins/sqlite-storage/vector-index-shared.d.ts +30 -5
  52. package/dist/builtins/sqlite-storage/vector-index-vec.d.ts +28 -6
  53. package/dist/builtins/storage-orchestrator/access-guards.d.ts +32 -0
  54. package/dist/builtins/storage-orchestrator/location-secrets.d.ts +33 -0
  55. package/dist/builtins/storage-orchestrator/storage-migration-coordinator.d.ts +74 -3
  56. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +26 -0
  57. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +552 -15
  58. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +552 -15
  59. package/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +56 -1
  60. package/dist/builtins/system-config/system-config.addon.js +1 -1
  61. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  62. package/dist/builtins/winston-logging/index.js +1 -1
  63. package/dist/builtins/winston-logging/index.mjs +1 -1
  64. package/dist/{dist-CDgIzo82.js → dist-CcvXUhHK.js} +537 -17
  65. package/dist/{dist-LvKus-mT.mjs → dist-DKs---Vx.mjs} +520 -18
  66. package/dist/index.js +141 -139
  67. package/dist/index.mjs +3 -3
  68. package/dist/kernel/deps/manifest-system-deps.d.ts +15 -0
  69. package/dist/kernel/index.d.ts +4 -2
  70. package/dist/kernel/moleculer/cap-usage-registry.d.ts +132 -7
  71. package/dist/kernel/storage-location-registry.d.ts +16 -1
  72. package/dist/kernel/transport/local-child-registry.d.ts +57 -0
  73. package/dist/{manifest-python-deps-CD14Pv0-.mjs → manifest-system-deps-DnoPpLGp.mjs} +466 -83
  74. package/dist/{manifest-python-deps-DVODn-qc.js → manifest-system-deps-oJMkWSX-.js} +477 -82
  75. package/dist/{retired-settings-keys-CV4QVdXj.mjs → retired-settings-keys-C3eONTvV.mjs} +1 -1
  76. package/dist/{retired-settings-keys-BfAzWvPC.js → retired-settings-keys-DXZ2xe7C.js} +1 -1
  77. package/package.json +2 -1
@@ -3682,6 +3682,53 @@ var CameraSwitchGroupSchema = zod.z.object({
3682
3682
  /** Unix ms when the group was composed server-side. */
3683
3683
  fetchedAt: zod.z.number()
3684
3684
  });
3685
+ /**
3686
+ * The value a redacted secret is replaced with on every read surface.
3687
+ *
3688
+ * It is also the WRITE-BACK token: an `upsertLocation` that sends this value
3689
+ * back for a key means "keep what is stored", which is what lets an operator
3690
+ * rename a location without retyping its password. A literal an operator could
3691
+ * plausibly choose as a real password would turn that convenience into a way
3692
+ * to lock yourself out, hence the sentinel shape.
3693
+ */
3694
+ var REDACTED_SECRET = "__camstack_redacted__";
3695
+ /**
3696
+ * Every config key in `schema` whose value is a secret, including keys nested
3697
+ * inside `group` / `sub-tabs` containers.
3698
+ */
3699
+ function collectSecretConfigKeys(schema) {
3700
+ const keys = /* @__PURE__ */ new Set();
3701
+ for (const section of sectionsOf(schema)) for (const field of fieldsOf(section)) walkField(field, keys);
3702
+ return keys;
3703
+ }
3704
+ function isRecord$2(value) {
3705
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3706
+ }
3707
+ function sectionsOf(schema) {
3708
+ if (!isRecord$2(schema)) return [];
3709
+ const sections = schema["sections"];
3710
+ return Array.isArray(sections) ? sections : [];
3711
+ }
3712
+ function fieldsOf(node) {
3713
+ if (!isRecord$2(node)) return [];
3714
+ const fields = node["fields"];
3715
+ return Array.isArray(fields) ? fields : [];
3716
+ }
3717
+ function walkField(field, out) {
3718
+ if (!isRecord$2(field)) return;
3719
+ const type = field["type"];
3720
+ const key = field["key"];
3721
+ if ((type === "password" || field["secret"] === true) && typeof key === "string" && key.length > 0) out.add(key);
3722
+ if (type === "group") {
3723
+ for (const child of fieldsOf(field)) walkField(child, out);
3724
+ return;
3725
+ }
3726
+ if (type === "sub-tabs") {
3727
+ const tabs = field["tabs"];
3728
+ if (!Array.isArray(tabs)) return;
3729
+ for (const tab of tabs) for (const child of fieldsOf(tab)) walkField(child, out);
3730
+ }
3731
+ }
3685
3732
  /** Friendly display labels for stream quality IDs. */
3686
3733
  var STREAM_QUALITY_LABELS = {
3687
3734
  high: "High",
@@ -4130,6 +4177,21 @@ var RelocateJobSchema = zod.z.object({
4130
4177
  bytesMoved: zod.z.number().int(),
4131
4178
  /** Total files discovered up front; null while (or when) unknown. */
4132
4179
  filesTotal: zod.z.number().int().nullable(),
4180
+ /**
4181
+ * Rows this run CORRECTED while moving them — a durable mutation the move
4182
+ * made that nobody asked for, so it is reported where the operator reads the
4183
+ * job rather than only in a log line.
4184
+ *
4185
+ * A footage segment records its byte count in its own NAME, and the durable
4186
+ * hour row derives its aggregates from those names. A file that does not
4187
+ * match its name therefore makes the ledger's sums — and with them quota and
4188
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
4189
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
4190
+ *
4191
+ * Absent on lanes where the question has no meaning: a media blob's size is
4192
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
4193
+ */
4194
+ rowsReconciled: zod.z.number().int().nonnegative().optional(),
4133
4195
  startedAt: zod.z.number(),
4134
4196
  finishedAt: zod.z.number().nullable(),
4135
4197
  error: zod.z.string().nullable()
@@ -4198,14 +4260,42 @@ var RelocateMediaInputSchema = zod.z.object({
4198
4260
  /** Omitted = `move`, the pre-existing behaviour. */
4199
4261
  mode: MediaRelocateModeSchema.optional()
4200
4262
  });
4201
- /** How many rows still carry NO `locationId` — the population a repoint would
4202
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
4203
- * value that permits a non-blocking `eventMedia` cutover. */
4204
- var UnstampedEventMediaCountSchema = zod.z.object({
4205
- media: zod.z.number().int().nonnegative(),
4206
- retrainFrames: zod.z.number().int().nonnegative(),
4207
- total: zod.z.number().int().nonnegative()
4263
+ /**
4264
+ * The unstamped population of ONE collection split, because the gate and the
4265
+ * operator ask two different questions and only one of them has to be cheap.
4266
+ *
4267
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
4268
+ * repoint". It is a single indexed seek to the first matching row, so it stays
4269
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
4270
+ * that matters — after a seal, when the population is empty.
4271
+ *
4272
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
4273
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
4274
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
4275
+ * and useful answer: "there are some, and this read could not say how many"
4276
+ * still refuses the cutover, which is the whole job.
4277
+ */
4278
+ var UnstampedRowsSchema = zod.z.object({
4279
+ present: zod.z.boolean(),
4280
+ rows: zod.z.number().int().nonnegative().nullable()
4208
4281
  });
4282
+ /**
4283
+ * How many rows still carry NO `locationId` — the population a repoint would
4284
+ * silently re-aim at a disk that does not hold their bytes.
4285
+ *
4286
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
4287
+ * over. The gate opens on a measured absence and on nothing else; an unread
4288
+ * collection and an empty one are different facts, and this repo has already
4289
+ * paid for conflating them (`RelocateResidueSchema`, D295).
4290
+ */
4291
+ var UnstampedEventMediaCountSchema = zod.z.object({
4292
+ media: UnstampedRowsSchema,
4293
+ retrainFrames: UnstampedRowsSchema,
4294
+ /** True when EITHER collection holds one. The refusal reads this. */
4295
+ anyPresent: zod.z.boolean(),
4296
+ /** Sum across both, or `null` when either lane could not be counted. */
4297
+ total: zod.z.number().int().nonnegative().nullable()
4298
+ }).nullable();
4209
4299
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: zod.z.string().min(1) });
4210
4300
  /** The independently selectable logical storage classes — every class
4211
4301
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -4291,13 +4381,53 @@ var StorageMigrationParticipantSchema = zod.z.enum([
4291
4381
  "recorder",
4292
4382
  "analytics"
4293
4383
  ]);
4384
+ /**
4385
+ * The mover's own numbers, folded onto the coordinator's durable move record.
4386
+ *
4387
+ * The long half of a non-blocking migration is `draining`, and it is measured
4388
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
4389
+ * existed the only place those numbers appeared was a Loki line, so an operator
4390
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
4391
+ * afternoon.
4392
+ *
4393
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
4394
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
4395
+ * mover — which is the exact failure this is meant to end. The coordinator's
4396
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
4397
+ * read `state`; folding the counters costs no extra read and makes the durable
4398
+ * record say afterwards how far a move actually got.
4399
+ *
4400
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
4401
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
4402
+ * cannot say M, and a 0 there would render as "100 % done".
4403
+ */
4404
+ var StorageMigrationMoveProgressSchema = zod.z.object({
4405
+ filesMoved: zod.z.number().int().nonnegative(),
4406
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
4407
+ filesTotal: zod.z.number().int().nonnegative().nullable(),
4408
+ bytesMoved: zod.z.number().int().nonnegative(),
4409
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
4410
+ * a lane that cannot reconcile. A migration that silently rewrote durable
4411
+ * rows would be the same failure as one that silently skipped them. */
4412
+ rowsReconciled: zod.z.number().int().nonnegative().optional(),
4413
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
4414
+ * crash gets a new mover, and a rate computed from the migration's start
4415
+ * would silently average in the time nothing was running. */
4416
+ startedAt: zod.z.number(),
4417
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
4418
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
4419
+ * subtract its own. */
4420
+ observedAt: zod.z.number()
4421
+ });
4294
4422
  var StorageMigrationMoveSchema = zod.z.object({
4295
4423
  storageClass: StorageMigrationClassSchema,
4296
4424
  fromLocationId: zod.z.string(),
4297
4425
  toLocationId: zod.z.string(),
4298
4426
  moverJobId: zod.z.string().nullable(),
4299
4427
  state: RelocateJobStateSchema.nullable(),
4300
- error: zod.z.string().nullable()
4428
+ error: zod.z.string().nullable(),
4429
+ /** Last observed mover counters; `null` until the mover has been polled once. */
4430
+ progress: StorageMigrationMoveProgressSchema.nullable()
4301
4431
  });
4302
4432
  var StorageMigrationJobSchema = zod.z.object({
4303
4433
  jobId: zod.z.string(),
@@ -4367,6 +4497,106 @@ var StorageMigrationPlanSchema = zod.z.object({
4367
4497
  findings: zod.z.array(StorageMigrationFindingSchema)
4368
4498
  });
4369
4499
  /**
4500
+ * Which single-flight engine owns a class of work.
4501
+ *
4502
+ * Shared rather than re-declared per consumer: the coordinator lanes its moves
4503
+ * by it, and `storageMigration.movers` labels a mover with it so an operator
4504
+ * can see *which* engine is busy when a drain refuses to start beside another.
4505
+ */
4506
+ var StorageMigrationLaneSchema = zod.z.enum(["footage", "media"]);
4507
+ /**
4508
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
4509
+ *
4510
+ * The coordinator's job record is the state of record for a migration, and its
4511
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
4512
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
4513
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
4514
+ * way because no supported UI path existed. A mover armed like that has no job
4515
+ * to fold progress into, so it has to be readable on its own or it is invisible.
4516
+ *
4517
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
4518
+ * orchestrated it.
4519
+ */
4520
+ var StorageMigrationMoverSchema = zod.z.object({
4521
+ lane: StorageMigrationLaneSchema,
4522
+ job: RelocateJobSchema,
4523
+ /** The coordinator job that armed this mover, or `null` for a mover armed
4524
+ * directly against the owning addon. */
4525
+ migrationJobId: zod.z.string().nullable(),
4526
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
4527
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
4528
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
4529
+ * rate made of two different clocks. */
4530
+ observedAt: zod.z.number()
4531
+ });
4532
+ /**
4533
+ * What a SOURCE still holds for one storage class — the number that makes a
4534
+ * "drain remaining" action honest rather than hopeful.
4535
+ *
4536
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
4537
+ * engine's own selection count for media), never from the resident index: a
4538
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
4539
+ * never been told about (D295).
4540
+ *
4541
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
4542
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
4543
+ * because refusing on an unanswerable read would hide exactly the case an
4544
+ * operator needs to act on.
4545
+ */
4546
+ var StorageMigrationResidueSchema = zod.z.object({
4547
+ storageClass: StorageMigrationClassSchema,
4548
+ /** The location still holding the data. `'*'` for the media lane, whose rows
4549
+ * move from wherever they are rather than from one named source. */
4550
+ fromLocationId: zod.z.string(),
4551
+ /** Where a drain would move it — the class's CURRENT default. */
4552
+ toLocationId: zod.z.string(),
4553
+ /** Segments (footage lane) or rows (media lane) still on the source. */
4554
+ items: zod.z.number().int().nonnegative().nullable(),
4555
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
4556
+ bytes: zod.z.number().int().nonnegative().nullable()
4557
+ });
4558
+ /**
4559
+ * Run the DRAIN half and nothing else.
4560
+ *
4561
+ * A migration that reached `done` has already repointed, so `start` correctly
4562
+ * refuses its destination ("already the default") — there is nothing left to
4563
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
4564
+ * or finish against a work list that was a tenth of the archive (D295), and
4565
+ * before this there was no supported way to run only that half: the only way
4566
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
4567
+ *
4568
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
4569
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
4570
+ * re-repoint a class that is already migrated.
4571
+ */
4572
+ var StorageMigrationDrainInputSchema = zod.z.object({
4573
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
4574
+ * a class whose source is already empty is refused rather than started. */
4575
+ classes: zod.z.array(StorageMigrationClassSchema).min(1),
4576
+ throttleMbps: zod.z.number().min(1).max(1e3).optional()
4577
+ });
4578
+ /** What a footage source still holds, asked of the durable hour ledger. */
4579
+ var RelocateResidueInputSchema = zod.z.object({
4580
+ fromLocationId: zod.z.string().min(1),
4581
+ /** Narrow to one logical class; omit for every profile on the location. */
4582
+ footageClass: RelocateFootageClassSchema.optional()
4583
+ });
4584
+ /** `null` = the archive could not answer (no ledger on this node, or the
4585
+ * aggregate failed). Never conflated with an empty source. */
4586
+ var RelocateResidueSchema = zod.z.object({
4587
+ segments: zod.z.number().int().nonnegative(),
4588
+ bytes: zod.z.number().int().nonnegative()
4589
+ }).nullable();
4590
+ /** How many rows a media pass would still act on against a given target — the
4591
+ * media lane's denominator AND its residue, from ONE derivation so the two can
4592
+ * never disagree. `null` = the count could not be taken. */
4593
+ var RelocatableMediaCountSchema = zod.z.object({ rows: zod.z.number().int().nonnegative() }).nullable();
4594
+ var RelocatableMediaCountInputSchema = zod.z.object({
4595
+ toLocationId: zod.z.string().min(1),
4596
+ /** Omitted = `move`. */
4597
+ mode: MediaRelocateModeSchema.optional()
4598
+ });
4599
+ /**
4370
4600
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
4371
4601
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
4372
4602
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -4470,6 +4700,38 @@ var StorageLocationRefSchema = zod.z.union([StorageLocationTypeSchema, zod.z.str
4470
4700
  * two addons declaring the same `id` must agree on `cardinality` (validated
4471
4701
  * at kernel aggregation time, not here).
4472
4702
  */
4703
+ /**
4704
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
4705
+ * actually reaches the bytes. It is the constraint that decides which
4706
+ * `storage-provider`s may back a location of that kind.
4707
+ *
4708
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
4709
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
4710
+ * post-analysis media roots). Only a provider that serves a genuine local
4711
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
4712
+ * remote provider's `resolve` returns a path on the REMOTE host, and
4713
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
4714
+ * against a same-named local directory that is something else entirely.
4715
+ *
4716
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
4717
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
4718
+ * service never sees a path, so any provider can back it. `backups` is the
4719
+ * one kind that qualifies today.
4720
+ *
4721
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
4722
+ * an EMERGENT property of how the recorder happened to be written. Nothing
4723
+ * refused the configuration; the first write simply went somewhere wrong, and
4724
+ * a recording write that goes wrong surfaces as a silent black window rather
4725
+ * than an error (the read path does not `stat`). This turns that accident into
4726
+ * a declared, enforced, testable refusal.
4727
+ */
4728
+ var StorageAccessSchema = zod.z.enum(["local-path", "cap-mediated"]);
4729
+ /**
4730
+ * What an ABSENT `access` means. Fail-closed: a declaration that says nothing
4731
+ * is treated as if it does raw filesystem I/O, so a remote provider is
4732
+ * refused for it. The permissive value must be written down.
4733
+ */
4734
+ var STORAGE_ACCESS_FALLBACK = "local-path";
4473
4735
  var StorageLocationDeclarationSchema = zod.z.object({
4474
4736
  /**
4475
4737
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -4489,6 +4751,19 @@ var StorageLocationDeclarationSchema = zod.z.object({
4489
4751
  */
4490
4752
  cardinality: zod.z.enum(["single", "multi"]),
4491
4753
  /**
4754
+ * HOW the declaring service reaches the bytes — and therefore WHICH
4755
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
4756
+ * and {@link STORAGE_ACCESS_FALLBACK}.
4757
+ *
4758
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
4759
+ * can only over-restrict (refuse a remote provider for a kind that might
4760
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
4761
+ * permissive direction and is therefore never inferred — a repo guard
4762
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
4763
+ * reached by omission.
4764
+ */
4765
+ access: StorageAccessSchema.optional(),
4766
+ /**
4492
4767
  * When set, the default instance for this location inherits its resolved
4493
4768
  * root from the named location's default instance. Useful for derivative
4494
4769
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -10583,6 +10858,15 @@ var deviceManagerCapability = {
10583
10858
  * calls are sync. Bindings change rarely (only on wrapper toggle or
10584
10859
  * device add/remove) — clients invalidate via the
10585
10860
  * `capability.binding-changed` event.
10861
+ *
10862
+ * "A single round-trip" describes the CLIENT's side and used not to
10863
+ * describe the server's: until 2026-08-30 the resolver read the persisted
10864
+ * wrapper activations once per device, so answering this cost one
10865
+ * settings-door RPC per device — 1 020 on the live 1 019-device hub, and
10866
+ * it did not return in 240 s against `SystemMirror.init`'s 15 s budget.
10867
+ * The server side is now two reads for the whole fleet. Anything PERIODIC
10868
+ * still belongs on `getBindings` / `getBindingsBatch` (D12); this remains
10869
+ * a warm seed.
10586
10870
  */
10587
10871
  getAllBindings: method(zod.z.object({}), zod.z.array(DeviceBindingsForDeviceSchema)),
10588
10872
  /**
@@ -16908,8 +17192,10 @@ var TrackSchema = zod.z.object({
16908
17192
  lastSeen: zod.z.number(),
16909
17193
  /** Frame-rate position history (subject to maxPositionHistory cap). */
16910
17194
  positions: zod.z.array(TrackPositionSchema).readonly(),
16911
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
16912
- * saveThumbnails policy). */
17195
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
17196
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
17197
+ * the retired `saveThumbnails` used to gate this and the rolling
17198
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
16913
17199
  snapshots: zod.z.array(TrackSnapshotSchema).readonly(),
16914
17200
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
16915
17201
  zonesVisited: zod.z.array(zod.z.string()).readonly(),
@@ -17999,8 +18285,34 @@ var pipelineAnalyticsCapability = {
17999
18285
  * happens to stamp it. This count is what the migration planner's
18000
18286
  * non-blocking gate reads; `relocateMedia({ mode: 'seal' })` is what drives
18001
18287
  * it to zero.
18288
+ *
18289
+ * TWO indexed statements per collection, not a walk. It used to page the
18290
+ * whole collection at 200 rows per RPC ordered by an unindexed column, so
18291
+ * on the live hub — 1 254 576 rows — it hit the 60 s RPC deadline every
18292
+ * time it was called, and the migration it gates could never start. The
18293
+ * cheap question (`present`: is there at least one) is asked first and
18294
+ * separately from the expensive one (`rows`), because only the first has
18295
+ * to be answerable for the gate to do its job.
18296
+ *
18297
+ * **`null` is "not measurable", never zero** — at either level. An
18298
+ * unreadable collection must not read as a sealed one.
18002
18299
  */
18003
18300
  countUnstampedEventMedia: method(zod.z.object({}), UnstampedEventMediaCountSchema, { auth: "admin" }),
18301
+ /**
18302
+ * How many rows a pass would STILL act on against `toLocationId`.
18303
+ *
18304
+ * One derivation, two consumers: it is the media lane's denominator (the
18305
+ * **M** the footage lane gets from the ledger census — D295) and it is the
18306
+ * residue behind "drain remaining". Deriving them separately is how "N of M"
18307
+ * ends up comparing two different populations.
18308
+ *
18309
+ * `null` means the count could not be taken; it is never zero-filled,
18310
+ * because a zero here reads as "nothing left to move".
18311
+ */
18312
+ countRelocatableMedia: method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
18313
+ kind: "query",
18314
+ auth: "admin"
18315
+ }),
18004
18316
  /** Every relocate job this addon knows about, newest first (in RAM: the
18005
18317
  * move is resumable, so a lost list costs nothing but the display). */
18006
18318
  listRelocateMediaJobs: method(zod.z.object({}), zod.z.array(RelocateJobSchema).readonly(), {
@@ -20958,6 +21270,35 @@ var storageMigrationCapability = {
20958
21270
  cancel: method(zod.z.object({ jobId: zod.z.string() }), zod.z.object({ cancelled: zod.z.boolean() }), {
20959
21271
  kind: "mutation",
20960
21272
  auth: "admin"
21273
+ }),
21274
+ /**
21275
+ * Every mover running RIGHT NOW, in both lanes, with its counters.
21276
+ *
21277
+ * `status` covers a migration's own moves — the coordinator folds their
21278
+ * progress onto the durable job record it is already polling. This covers
21279
+ * the other case, and it is not hypothetical: a drain armed straight against
21280
+ * `recording.relocateFootage` (the only path that existed before
21281
+ * {@link drain}) has no job to fold into and would otherwise be invisible.
21282
+ */
21283
+ movers: method(zod.z.object({}), zod.z.array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }),
21284
+ /**
21285
+ * What each class's SOURCE still holds, from the archive — never from the
21286
+ * resident index (D295). Only classes with something left (or something
21287
+ * unknown) are listed, so an empty list means there is nothing to drain and
21288
+ * the UI has no honest button to offer.
21289
+ */
21290
+ residue: method(zod.z.object({}), zod.z.array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }),
21291
+ /**
21292
+ * Run the drain half alone, on a class whose default has ALREADY moved.
21293
+ *
21294
+ * It never repoints anything, which is what lets `start` keep refusing a
21295
+ * destination that is already the default: the two verbs cannot be confused
21296
+ * for one another, and no operator can re-repoint a migrated class through
21297
+ * this door.
21298
+ */
21299
+ drain: method(StorageMigrationDrainInputSchema, zod.z.object({ jobId: zod.z.string() }), {
21300
+ kind: "mutation",
21301
+ auth: "admin"
20961
21302
  })
20962
21303
  }
20963
21304
  };
@@ -21520,12 +21861,38 @@ response: zod.z.record(zod.z.string(), zod.z.unknown()) }), zod.z.object({
21520
21861
  *
21521
21862
  * ## Why this is a capability and not a helper
21522
21863
  *
21523
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21524
- * plate, vehicle, identity, and the event store's derivativesand every one of
21525
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21526
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21527
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21528
- * load 5,000 rows before ranking anything.
21864
+ * This capability was introduced with the claim that SIX stores in
21865
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21866
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21867
+ * claim was never true, and leaving it here made five stores look like pending
21868
+ * work when three of them have no vector at all. Counted column by column on
21869
+ * 2026-08-30, exactly THREE ever held one:
21870
+ *
21871
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21872
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21873
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21874
+ * face, migrated 2026-08-30 into its OWN index (see below).
21875
+ *
21876
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21877
+ * and `identities` store a name; the event store stores no derivative vector.
21878
+ * They are not migration candidates and never were.
21879
+ *
21880
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21881
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21882
+ * rows before ranking anything.
21883
+ *
21884
+ * ## One index per COMPARISON, never per encoder
21885
+ *
21886
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21887
+ * model, and they still get two indexes. An index is a set of things that are
21888
+ * ranked against each other and that live and die together, and these two are
21889
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21890
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21891
+ * forever and is the gallery every recognition ranks against. One index would
21892
+ * mean every gallery load and every reconcile carried a filter whose failure
21893
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21894
+ * person's only sample. The dimension they share is not a reason to share an
21895
+ * index; the question they answer is, and it differs.
21529
21896
  *
21530
21897
  * The fix is not a faster loop, it is a different backend — and the backend
21531
21898
  * should be replaceable without touching six callers. So: a singleton
@@ -21630,7 +21997,20 @@ var VectorQueryResultSchema = zod.z.object({
21630
21997
  */
21631
21998
  scanned: zod.z.number(),
21632
21999
  /** True when the backend could not consider every row that passed the filter. */
21633
- truncated: zod.z.boolean()
22000
+ truncated: zod.z.boolean(),
22001
+ /**
22002
+ * The `topK` the backend actually ran with.
22003
+ *
22004
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
22005
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
22006
+ * own log rather than in its answer. That is how an audit asking for 20,000
22007
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
22008
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
22009
+ * MUCH, in the return value, where the caller cannot fail to see it.
22010
+ *
22011
+ * Equals the requested `topK` whenever nothing was lowered.
22012
+ */
22013
+ effectiveTopK: zod.z.number().int().positive()
21634
22014
  });
21635
22015
  var VectorDeleteInputSchema = zod.z.object({
21636
22016
  index: zod.z.string(),
@@ -21659,6 +22039,68 @@ var VectorGetResultSchema = zod.z.object({ items: zod.z.array(zod.z.object({
21659
22039
  id: zod.z.string(),
21660
22040
  metadata: VectorMetadataSchema
21661
22041
  })) });
22042
+ /**
22043
+ * Ids to read back WITH their vectors.
22044
+ *
22045
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22046
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22047
+ * caller depends on that promise. This one promises the opposite.
22048
+ *
22049
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22050
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22051
+ * a per-face cross-process KNN would be a network round trip inside the
22052
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22053
+ * it requires the index to hand the floats back. Without this method the only
22054
+ * way to keep a readable vector is a JSON column, which is the thing this
22055
+ * capability exists to delete.
22056
+ *
22057
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22058
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22059
+ */
22060
+ var VectorFetchInputSchema = zod.z.object({
22061
+ index: zod.z.string(),
22062
+ ids: zod.z.array(zod.z.string())
22063
+ });
22064
+ var VectorFetchResultSchema = zod.z.object({ items: zod.z.array(zod.z.object({
22065
+ id: zod.z.string(),
22066
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22067
+ vector: zod.z.string(),
22068
+ metadata: VectorMetadataSchema
22069
+ })) });
22070
+ /**
22071
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22072
+ *
22073
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22074
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22075
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22076
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22077
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22078
+ * looked" for as long as anyone cared to read it.
22079
+ *
22080
+ * This is the primitive that question actually needs: a bounded page, ordered
22081
+ * by the backend's own row order, costing no distance computation at all.
22082
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22083
+ * the full-table read this capability was built to stop.
22084
+ */
22085
+ var VectorScanInputSchema = zod.z.object({
22086
+ index: zod.z.string(),
22087
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22088
+ cursor: zod.z.number().int().nonnegative().default(0),
22089
+ limit: zod.z.number().int().positive()
22090
+ });
22091
+ var VectorScanResultSchema = zod.z.object({
22092
+ items: zod.z.array(zod.z.object({
22093
+ id: zod.z.string(),
22094
+ metadata: VectorMetadataSchema
22095
+ })),
22096
+ /**
22097
+ * Where the next page starts, or `null` when the walk reached the end.
22098
+ *
22099
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22100
+ * from a short page: a backend is free to return fewer rows than asked.
22101
+ */
22102
+ nextCursor: zod.z.number().int().nonnegative().nullable()
22103
+ });
21662
22104
  var VectorStatsInputSchema = zod.z.object({ index: zod.z.string() });
21663
22105
  var VectorStatsResultSchema = zod.z.object({
21664
22106
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21697,6 +22139,10 @@ var vectorStoreCapability = {
21697
22139
  query: method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }),
21698
22140
  /** Metadata by id, no vectors — see {@link VectorGetResultSchema}. */
21699
22141
  getByIds: method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }),
22142
+ /** Metadata AND vectors, by named id — see {@link VectorFetchInputSchema}. */
22143
+ fetchByIds: method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }),
22144
+ /** One page of the whole index, unranked — see {@link VectorScanInputSchema}. */
22145
+ scan: method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }),
21700
22146
  deleteByIds: method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21701
22147
  kind: "mutation",
21702
22148
  auth: "admin"
@@ -29398,6 +29844,20 @@ var recordingCapability = {
29398
29844
  kind: "query",
29399
29845
  auth: "admin"
29400
29846
  }),
29847
+ /**
29848
+ * What a location STILL holds, asked of the durable hour ledger.
29849
+ *
29850
+ * The number behind "drain remaining": segments and bytes that would still
29851
+ * have to move off `fromLocationId`. It is a ledger aggregate — the archive
29852
+ * — because the resident index is not the archive (D295), and a drain sized
29853
+ * off the index is exactly what reported `done` over 80.3 GB on 2026-08-29.
29854
+ * `null` means the archive could not be asked (no ledger on this node, or
29855
+ * the aggregate failed) and is never conflated with an empty source.
29856
+ */
29857
+ getRelocateResidue: method(RelocateResidueInputSchema, RelocateResidueSchema, {
29858
+ kind: "query",
29859
+ auth: "admin"
29860
+ }),
29401
29861
  /** Cancel a running or queued relocate job. A queued job never runs. */
29402
29862
  cancelRelocateJob: method(zod.z.object({ jobId: zod.z.string() }), zod.z.object({ cancelled: zod.z.boolean() }), {
29403
29863
  kind: "mutation",
@@ -36222,6 +36682,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
36222
36682
  addonId: null,
36223
36683
  access: "create"
36224
36684
  },
36685
+ "pipelineAnalytics.countRelocatableMedia": {
36686
+ capName: "pipeline-analytics",
36687
+ capScope: "device",
36688
+ addonId: null,
36689
+ access: "view"
36690
+ },
36225
36691
  "pipelineAnalytics.countUnstampedEventMedia": {
36226
36692
  capName: "pipeline-analytics",
36227
36693
  capScope: "device",
@@ -37386,6 +37852,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
37386
37852
  addonId: null,
37387
37853
  access: "view"
37388
37854
  },
37855
+ "recording.getRelocateResidue": {
37856
+ capName: "recording",
37857
+ capScope: "system",
37858
+ addonId: null,
37859
+ access: "view"
37860
+ },
37389
37861
  "recording.getStorageMigrationMoveStatus": {
37390
37862
  capName: "recording",
37391
37863
  capScope: "system",
@@ -37932,12 +38404,30 @@ var METHOD_ACCESS_MAP = Object.freeze({
37932
38404
  addonId: null,
37933
38405
  access: "create"
37934
38406
  },
38407
+ "storageMigration.drain": {
38408
+ capName: "storage-migration",
38409
+ capScope: "system",
38410
+ addonId: null,
38411
+ access: "create"
38412
+ },
38413
+ "storageMigration.movers": {
38414
+ capName: "storage-migration",
38415
+ capScope: "system",
38416
+ addonId: null,
38417
+ access: "view"
38418
+ },
37935
38419
  "storageMigration.plan": {
37936
38420
  capName: "storage-migration",
37937
38421
  capScope: "system",
37938
38422
  addonId: null,
37939
38423
  access: "view"
37940
38424
  },
38425
+ "storageMigration.residue": {
38426
+ capName: "storage-migration",
38427
+ capScope: "system",
38428
+ addonId: null,
38429
+ access: "view"
38430
+ },
37941
38431
  "storageMigration.start": {
37942
38432
  capName: "storage-migration",
37943
38433
  capScope: "system",
@@ -38772,6 +39262,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
38772
39262
  addonId: null,
38773
39263
  access: "delete"
38774
39264
  },
39265
+ "vectorStore.fetchByIds": {
39266
+ capName: "vector-store",
39267
+ capScope: "system",
39268
+ addonId: null,
39269
+ access: "view"
39270
+ },
38775
39271
  "vectorStore.getByIds": {
38776
39272
  capName: "vector-store",
38777
39273
  capScope: "system",
@@ -38784,6 +39280,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
38784
39280
  addonId: null,
38785
39281
  access: "view"
38786
39282
  },
39283
+ "vectorStore.scan": {
39284
+ capName: "vector-store",
39285
+ capScope: "system",
39286
+ addonId: null,
39287
+ access: "view"
39288
+ },
38787
39289
  "vectorStore.stats": {
38788
39290
  capName: "vector-store",
38789
39291
  capScope: "system",
@@ -41770,6 +42272,12 @@ Object.defineProperty(exports, "METHOD_ACCESS_MAP", {
41770
42272
  return METHOD_ACCESS_MAP;
41771
42273
  }
41772
42274
  });
42275
+ Object.defineProperty(exports, "REDACTED_SECRET", {
42276
+ enumerable: true,
42277
+ get: function() {
42278
+ return REDACTED_SECRET;
42279
+ }
42280
+ });
41773
42281
  Object.defineProperty(exports, "RUNTIME_DEFAULTS", {
41774
42282
  enumerable: true,
41775
42283
  get: function() {
@@ -41800,6 +42308,12 @@ Object.defineProperty(exports, "SOURCE_DEVICE_TYPES", {
41800
42308
  return SOURCE_DEVICE_TYPES;
41801
42309
  }
41802
42310
  });
42311
+ Object.defineProperty(exports, "STORAGE_ACCESS_FALLBACK", {
42312
+ enumerable: true,
42313
+ get: function() {
42314
+ return STORAGE_ACCESS_FALLBACK;
42315
+ }
42316
+ });
41803
42317
  Object.defineProperty(exports, "STREAM_PROFILE_META", {
41804
42318
  enumerable: true,
41805
42319
  get: function() {
@@ -41908,6 +42422,12 @@ Object.defineProperty(exports, "buildStreamParamsConfigSchema", {
41908
42422
  return buildStreamParamsConfigSchema;
41909
42423
  }
41910
42424
  });
42425
+ Object.defineProperty(exports, "collectSecretConfigKeys", {
42426
+ enumerable: true,
42427
+ get: function() {
42428
+ return collectSecretConfigKeys;
42429
+ }
42430
+ });
41911
42431
  Object.defineProperty(exports, "coreBlockAddonId", {
41912
42432
  enumerable: true,
41913
42433
  get: function() {