@camstack/addon-provider-reolink 1.2.65 → 1.2.68

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 (3) hide show
  1. package/dist/addon.js +452 -23
  2. package/dist/addon.mjs +452 -23
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8329,18 +8329,61 @@ var RelocateFootageInputSchema = object({
8329
8329
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8330
8330
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8331
8331
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8332
+ /**
8333
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8334
+ * mover (the engine already walks both collections with a timestamp cursor and
8335
+ * already has a stamp-without-copy path).
8336
+ *
8337
+ * - `move` — the default and the historical behaviour: event-media and
8338
+ * retrain blobs move to `toLocationId` and their rows are
8339
+ * stamped. The enrolled gallery is skipped (D197).
8340
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8341
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8342
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8343
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8344
+ * instant a repoint moves that pointer the row reads from the
8345
+ * new disk while its bytes are on the old one.
8346
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8347
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8348
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8349
+ * never run beside a live second location: it is stop-the-world
8350
+ * by construction, which is acceptable only because the gallery
8351
+ * is a few KB per enrolled sample.
8352
+ */
8353
+ var MediaRelocateModeSchema = _enum([
8354
+ "move",
8355
+ "seal",
8356
+ "gallery"
8357
+ ]);
8332
8358
  var RelocateMediaInputSchema = object({
8333
8359
  toLocationId: string(),
8334
- throttleMbps: number().min(1).max(1e3).optional()
8360
+ throttleMbps: number().min(1).max(1e3).optional(),
8361
+ /** Omitted = `move`, the pre-existing behaviour. */
8362
+ mode: MediaRelocateModeSchema.optional()
8363
+ });
8364
+ /** How many rows still carry NO `locationId` — the population a repoint would
8365
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8366
+ * value that permits a non-blocking `eventMedia` cutover. */
8367
+ var UnstampedEventMediaCountSchema = object({
8368
+ media: number().int().nonnegative(),
8369
+ retrainFrames: number().int().nonnegative(),
8370
+ total: number().int().nonnegative()
8335
8371
  });
8336
8372
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8337
- /** The independently selectable logical storage classes. `recordings`
8338
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8339
- * segments; `eventMedia` is post-analysis blobs. */
8373
+ /** The independently selectable logical storage classes — every class
8374
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8375
+ * Zod enum error where they should meet an explanation.
8376
+ *
8377
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8378
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8379
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8380
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8340
8381
  var StorageMigrationClassSchema = _enum([
8341
8382
  "recordings",
8342
8383
  "recordingsLow",
8343
- "eventMedia"
8384
+ "eventMedia",
8385
+ "backups",
8386
+ "galleryMedia"
8344
8387
  ]);
8345
8388
  /** A destination is always an existing, fully-qualified location id. The
8346
8389
  * migration API intentionally never changes a source location's `basePath`:
@@ -8348,20 +8391,56 @@ var StorageMigrationClassSchema = _enum([
8348
8391
  var StorageMigrationDestinationsSchema = object({
8349
8392
  recordings: string().min(1).optional(),
8350
8393
  recordingsLow: string().min(1).optional(),
8351
- eventMedia: string().min(1).optional()
8394
+ eventMedia: string().min(1).optional(),
8395
+ backups: string().min(1).optional(),
8396
+ galleryMedia: string().min(1).optional()
8352
8397
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8398
+ /**
8399
+ * How a migration sequences the cutover against the byte move.
8400
+ *
8401
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8402
+ * resume. Recording is stopped for the whole move. Right
8403
+ * for a small or a cold class, and the only legal mode for
8404
+ * a `cardinality: 'single'` class.
8405
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8406
+ * refresh, resume, then move the past with everything
8407
+ * running. The pause is three bounded instants (a detach +
8408
+ * attach round, a write-gate drain, a lease) instead of one
8409
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8410
+ * stopped recording under `blocking`; the same move is
8411
+ * seconds of stopped recording under `nonBlocking`.
8412
+ *
8413
+ * The mode is on the JOB, not only on the input, because `status` is where an
8414
+ * operator finds out which one is running.
8415
+ */
8416
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8353
8417
  /** Shared input for planning and starting an orchestrated storage migration. */
8354
8418
  var StorageMigrationInputSchema = object({
8355
8419
  destinations: StorageMigrationDestinationsSchema,
8356
- throttleMbps: number().min(1).max(1e3).optional()
8420
+ throttleMbps: number().min(1).max(1e3).optional(),
8421
+ /** Omitted = `blocking`, which stays the default. */
8422
+ mode: StorageMigrationModeSchema.optional()
8357
8423
  });
8358
- /** The durable coordinator state machine. The only phase that changes default
8359
- * locations is `repointing`, after every selected mover has completed and been
8360
- * verified. */
8424
+ /**
8425
+ * The durable coordinator state machine.
8426
+ *
8427
+ * `blocking`:
8428
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8429
+ *
8430
+ * `nonBlocking`:
8431
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8432
+ *
8433
+ * Same phases, different order plus two new ones — not a second mover.
8434
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8435
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8436
+ * `repointing` is still the only phase that changes a default location.
8437
+ */
8361
8438
  var StorageMigrationPhaseSchema = _enum([
8362
8439
  "planning",
8440
+ "sealing",
8363
8441
  "pausing",
8364
8442
  "moving",
8443
+ "draining",
8365
8444
  "verifying",
8366
8445
  "repointing",
8367
8446
  "refreshing",
@@ -8375,17 +8454,56 @@ var StorageMigrationParticipantSchema = _enum([
8375
8454
  "recorder",
8376
8455
  "analytics"
8377
8456
  ]);
8457
+ /**
8458
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8459
+ *
8460
+ * The long half of a non-blocking migration is `draining`, and it is measured
8461
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8462
+ * existed the only place those numbers appeared was a Loki line, so an operator
8463
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8464
+ * afternoon.
8465
+ *
8466
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8467
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8468
+ * mover — which is the exact failure this is meant to end. The coordinator's
8469
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8470
+ * read `state`; folding the counters costs no extra read and makes the durable
8471
+ * record say afterwards how far a move actually got.
8472
+ *
8473
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8474
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8475
+ * cannot say M, and a 0 there would render as "100 % done".
8476
+ */
8477
+ var StorageMigrationMoveProgressSchema = object({
8478
+ filesMoved: number().int().nonnegative(),
8479
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8480
+ filesTotal: number().int().nonnegative().nullable(),
8481
+ bytesMoved: number().int().nonnegative(),
8482
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8483
+ * crash gets a new mover, and a rate computed from the migration's start
8484
+ * would silently average in the time nothing was running. */
8485
+ startedAt: number(),
8486
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8487
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8488
+ * subtract its own. */
8489
+ observedAt: number()
8490
+ });
8378
8491
  var StorageMigrationMoveSchema = object({
8379
8492
  storageClass: StorageMigrationClassSchema,
8380
8493
  fromLocationId: string(),
8381
8494
  toLocationId: string(),
8382
8495
  moverJobId: string().nullable(),
8383
8496
  state: RelocateJobStateSchema.nullable(),
8384
- error: string().nullable()
8497
+ error: string().nullable(),
8498
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8499
+ progress: StorageMigrationMoveProgressSchema.nullable()
8385
8500
  });
8386
8501
  var StorageMigrationJobSchema = object({
8387
8502
  jobId: string(),
8388
8503
  phase: StorageMigrationPhaseSchema,
8504
+ /** Which order this job is running. `status` is the only place an operator
8505
+ * can tell a seconds-long cutover from a thirty-hour one. */
8506
+ mode: StorageMigrationModeSchema,
8389
8507
  destinations: StorageMigrationDestinationsSchema,
8390
8508
  throttleMbps: number(),
8391
8509
  moves: array(StorageMigrationMoveSchema),
@@ -8398,13 +8516,122 @@ var StorageMigrationJobSchema = object({
8398
8516
  finishedAt: number().nullable(),
8399
8517
  error: string().nullable()
8400
8518
  });
8519
+ var StorageMigrationFindingSchema = object({
8520
+ code: _enum([
8521
+ "sharesDeviceWithSource",
8522
+ "deviceIdentityUnknown",
8523
+ "unstampedEventMediaRows",
8524
+ "blockingOnly",
8525
+ "noMover"
8526
+ ]),
8527
+ storageClass: StorageMigrationClassSchema,
8528
+ /** Human-readable, already carrying the ids and counts. */
8529
+ message: string()
8530
+ });
8401
8531
  var StorageMigrationPlanSchema = object({
8402
8532
  destinations: StorageMigrationDestinationsSchema,
8533
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8534
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8535
+ * it. */
8536
+ mode: StorageMigrationModeSchema,
8403
8537
  moves: array(object({
8404
8538
  storageClass: StorageMigrationClassSchema,
8405
8539
  fromLocationId: string(),
8406
8540
  toLocationId: string()
8407
- }))
8541
+ })),
8542
+ findings: array(StorageMigrationFindingSchema)
8543
+ });
8544
+ /**
8545
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8546
+ *
8547
+ * The coordinator's job record is the state of record for a migration, and its
8548
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8549
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8550
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8551
+ * way because no supported UI path existed. A mover armed like that has no job
8552
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8553
+ *
8554
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8555
+ * orchestrated it.
8556
+ */
8557
+ var StorageMigrationMoverSchema = object({
8558
+ lane: _enum(["footage", "media"]),
8559
+ job: RelocateJobSchema,
8560
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8561
+ * directly against the owning addon. */
8562
+ migrationJobId: string().nullable(),
8563
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8564
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8565
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8566
+ * rate made of two different clocks. */
8567
+ observedAt: number()
8568
+ });
8569
+ /**
8570
+ * What a SOURCE still holds for one storage class — the number that makes a
8571
+ * "drain remaining" action honest rather than hopeful.
8572
+ *
8573
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8574
+ * engine's own selection count for media), never from the resident index: a
8575
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8576
+ * never been told about (D295).
8577
+ *
8578
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8579
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8580
+ * because refusing on an unanswerable read would hide exactly the case an
8581
+ * operator needs to act on.
8582
+ */
8583
+ var StorageMigrationResidueSchema = object({
8584
+ storageClass: StorageMigrationClassSchema,
8585
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8586
+ * move from wherever they are rather than from one named source. */
8587
+ fromLocationId: string(),
8588
+ /** Where a drain would move it — the class's CURRENT default. */
8589
+ toLocationId: string(),
8590
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8591
+ items: number().int().nonnegative().nullable(),
8592
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8593
+ bytes: number().int().nonnegative().nullable()
8594
+ });
8595
+ /**
8596
+ * Run the DRAIN half and nothing else.
8597
+ *
8598
+ * A migration that reached `done` has already repointed, so `start` correctly
8599
+ * refuses its destination ("already the default") — there is nothing left to
8600
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8601
+ * or finish against a work list that was a tenth of the archive (D295), and
8602
+ * before this there was no supported way to run only that half: the only way
8603
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8604
+ *
8605
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8606
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8607
+ * re-repoint a class that is already migrated.
8608
+ */
8609
+ var StorageMigrationDrainInputSchema = object({
8610
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8611
+ * a class whose source is already empty is refused rather than started. */
8612
+ classes: array(StorageMigrationClassSchema).min(1),
8613
+ throttleMbps: number().min(1).max(1e3).optional()
8614
+ });
8615
+ /** What a footage source still holds, asked of the durable hour ledger. */
8616
+ var RelocateResidueInputSchema = object({
8617
+ fromLocationId: string().min(1),
8618
+ /** Narrow to one logical class; omit for every profile on the location. */
8619
+ footageClass: RelocateFootageClassSchema.optional()
8620
+ });
8621
+ /** `null` = the archive could not answer (no ledger on this node, or the
8622
+ * aggregate failed). Never conflated with an empty source. */
8623
+ var RelocateResidueSchema = object({
8624
+ segments: number().int().nonnegative(),
8625
+ bytes: number().int().nonnegative()
8626
+ }).nullable();
8627
+ /** How many rows a media pass would still act on against a given target — the
8628
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8629
+ * never disagree. `null` = the count could not be taken. */
8630
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8631
+ var RelocatableMediaCountInputSchema = object({
8632
+ toLocationId: string().min(1),
8633
+ /** Omitted = `move`. */
8634
+ mode: MediaRelocateModeSchema.optional()
8408
8635
  });
8409
8636
  /**
8410
8637
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8510,6 +8737,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8510
8737
  * two addons declaring the same `id` must agree on `cardinality` (validated
8511
8738
  * at kernel aggregation time, not here).
8512
8739
  */
8740
+ /**
8741
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8742
+ * actually reaches the bytes. It is the constraint that decides which
8743
+ * `storage-provider`s may back a location of that kind.
8744
+ *
8745
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8746
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8747
+ * post-analysis media roots). Only a provider that serves a genuine local
8748
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8749
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8750
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8751
+ * against a same-named local directory that is something else entirely.
8752
+ *
8753
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8754
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8755
+ * service never sees a path, so any provider can back it. `backups` is the
8756
+ * one kind that qualifies today.
8757
+ *
8758
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8759
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8760
+ * refused the configuration; the first write simply went somewhere wrong, and
8761
+ * a recording write that goes wrong surfaces as a silent black window rather
8762
+ * than an error (the read path does not `stat`). This turns that accident into
8763
+ * a declared, enforced, testable refusal.
8764
+ */
8765
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8513
8766
  var StorageLocationDeclarationSchema = object({
8514
8767
  /**
8515
8768
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8529,6 +8782,19 @@ var StorageLocationDeclarationSchema = object({
8529
8782
  */
8530
8783
  cardinality: _enum(["single", "multi"]),
8531
8784
  /**
8785
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8786
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8787
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8788
+ *
8789
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8790
+ * can only over-restrict (refuse a remote provider for a kind that might
8791
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8792
+ * permissive direction and is therefore never inferred — a repo guard
8793
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8794
+ * reached by omission.
8795
+ */
8796
+ access: StorageAccessSchema.optional(),
8797
+ /**
8532
8798
  * When set, the default instance for this location inherits its resolved
8533
8799
  * root from the named location's default instance. Useful for derivative
8534
8800
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18729,8 +18995,10 @@ var TrackSchema = object({
18729
18995
  lastSeen: number(),
18730
18996
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18731
18997
  positions: array(TrackPositionSchema).readonly(),
18732
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18733
- * saveThumbnails policy). */
18998
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18999
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
19000
+ * the retired `saveThumbnails` used to gate this and the rolling
19001
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18734
19002
  snapshots: array(TrackSnapshotSchema).readonly(),
18735
19003
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18736
19004
  zonesVisited: array(string()).readonly(),
@@ -19590,6 +19858,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19590
19858
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19591
19859
  kind: "mutation",
19592
19860
  auth: "admin"
19861
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19862
+ kind: "query",
19863
+ auth: "admin"
19593
19864
  }), method(object({}), array(RelocateJobSchema).readonly(), {
19594
19865
  kind: "query",
19595
19866
  auth: "admin"
@@ -21601,7 +21872,10 @@ method(object({
21601
21872
  }), StorageLocationSchema, {
21602
21873
  kind: "mutation",
21603
21874
  auth: "admin"
21604
- }), method(object({ id: string() }), _void(), {
21875
+ }), method(object({
21876
+ id: string(),
21877
+ force: boolean().optional()
21878
+ }), _void(), {
21605
21879
  kind: "mutation",
21606
21880
  auth: "admin"
21607
21881
  }), method(object({ id: string() }), object({
@@ -21650,6 +21924,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21650
21924
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21651
21925
  kind: "mutation",
21652
21926
  auth: "admin"
21927
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21928
+ kind: "mutation",
21929
+ auth: "admin"
21653
21930
  });
21654
21931
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21655
21932
  providerId: string().min(1),
@@ -22048,12 +22325,38 @@ response: record(string(), unknown()) }), object({
22048
22325
  *
22049
22326
  * ## Why this is a capability and not a helper
22050
22327
  *
22051
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
22052
- * plate, vehicle, identity, and the event store's derivativesand every one of
22053
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
22054
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
22055
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
22056
- * load 5,000 rows before ranking anything.
22328
+ * This capability was introduced with the claim that SIX stores in
22329
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
22330
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
22331
+ * claim was never true, and leaving it here made five stores look like pending
22332
+ * work when three of them have no vector at all. Counted column by column on
22333
+ * 2026-08-30, exactly THREE ever held one:
22334
+ *
22335
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
22336
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
22337
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
22338
+ * face, migrated 2026-08-30 into its OWN index (see below).
22339
+ *
22340
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
22341
+ * and `identities` store a name; the event store stores no derivative vector.
22342
+ * They are not migration candidates and never were.
22343
+ *
22344
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
22345
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
22346
+ * rows before ranking anything.
22347
+ *
22348
+ * ## One index per COMPARISON, never per encoder
22349
+ *
22350
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
22351
+ * model, and they still get two indexes. An index is a set of things that are
22352
+ * ranked against each other and that live and die together, and these two are
22353
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
22354
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
22355
+ * forever and is the gallery every recognition ranks against. One index would
22356
+ * mean every gallery load and every reconcile carried a filter whose failure
22357
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
22358
+ * person's only sample. The dimension they share is not a reason to share an
22359
+ * index; the question they answer is, and it differs.
22057
22360
  *
22058
22361
  * The fix is not a faster loop, it is a different backend — and the backend
22059
22362
  * should be replaceable without touching six callers. So: a singleton
@@ -22158,7 +22461,20 @@ var VectorQueryResultSchema = object({
22158
22461
  */
22159
22462
  scanned: number(),
22160
22463
  /** True when the backend could not consider every row that passed the filter. */
22161
- truncated: boolean()
22464
+ truncated: boolean(),
22465
+ /**
22466
+ * The `topK` the backend actually ran with.
22467
+ *
22468
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
22469
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
22470
+ * own log rather than in its answer. That is how an audit asking for 20,000
22471
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
22472
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
22473
+ * MUCH, in the return value, where the caller cannot fail to see it.
22474
+ *
22475
+ * Equals the requested `topK` whenever nothing was lowered.
22476
+ */
22477
+ effectiveTopK: number().int().positive()
22162
22478
  });
22163
22479
  var VectorDeleteInputSchema = object({
22164
22480
  index: string(),
@@ -22187,6 +22503,68 @@ var VectorGetResultSchema = object({ items: array(object({
22187
22503
  id: string(),
22188
22504
  metadata: VectorMetadataSchema
22189
22505
  })) });
22506
+ /**
22507
+ * Ids to read back WITH their vectors.
22508
+ *
22509
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22510
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22511
+ * caller depends on that promise. This one promises the opposite.
22512
+ *
22513
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22514
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22515
+ * a per-face cross-process KNN would be a network round trip inside the
22516
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22517
+ * it requires the index to hand the floats back. Without this method the only
22518
+ * way to keep a readable vector is a JSON column, which is the thing this
22519
+ * capability exists to delete.
22520
+ *
22521
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22522
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22523
+ */
22524
+ var VectorFetchInputSchema = object({
22525
+ index: string(),
22526
+ ids: array(string())
22527
+ });
22528
+ var VectorFetchResultSchema = object({ items: array(object({
22529
+ id: string(),
22530
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22531
+ vector: string(),
22532
+ metadata: VectorMetadataSchema
22533
+ })) });
22534
+ /**
22535
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22536
+ *
22537
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22538
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22539
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22540
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22541
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22542
+ * looked" for as long as anyone cared to read it.
22543
+ *
22544
+ * This is the primitive that question actually needs: a bounded page, ordered
22545
+ * by the backend's own row order, costing no distance computation at all.
22546
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22547
+ * the full-table read this capability was built to stop.
22548
+ */
22549
+ var VectorScanInputSchema = object({
22550
+ index: string(),
22551
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22552
+ cursor: number().int().nonnegative().default(0),
22553
+ limit: number().int().positive()
22554
+ });
22555
+ var VectorScanResultSchema = object({
22556
+ items: array(object({
22557
+ id: string(),
22558
+ metadata: VectorMetadataSchema
22559
+ })),
22560
+ /**
22561
+ * Where the next page starts, or `null` when the walk reached the end.
22562
+ *
22563
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22564
+ * from a short page: a backend is free to return fewer rows than asked.
22565
+ */
22566
+ nextCursor: number().int().nonnegative().nullable()
22567
+ });
22190
22568
  var VectorStatsInputSchema = object({ index: string() });
22191
22569
  var VectorStatsResultSchema = object({
22192
22570
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -22205,7 +22583,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
22205
22583
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
22206
22584
  kind: "mutation",
22207
22585
  auth: "admin"
22208
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22586
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22209
22587
  kind: "mutation",
22210
22588
  auth: "admin"
22211
22589
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28911,6 +29289,9 @@ method(object({
28911
29289
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28912
29290
  kind: "query",
28913
29291
  auth: "admin"
29292
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
29293
+ kind: "query",
29294
+ auth: "admin"
28914
29295
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28915
29296
  kind: "mutation",
28916
29297
  auth: "admin"
@@ -35910,6 +36291,18 @@ Object.freeze({
35910
36291
  addonId: null,
35911
36292
  access: "create"
35912
36293
  },
36294
+ "pipelineAnalytics.countRelocatableMedia": {
36295
+ capName: "pipeline-analytics",
36296
+ capScope: "device",
36297
+ addonId: null,
36298
+ access: "view"
36299
+ },
36300
+ "pipelineAnalytics.countUnstampedEventMedia": {
36301
+ capName: "pipeline-analytics",
36302
+ capScope: "device",
36303
+ addonId: null,
36304
+ access: "view"
36305
+ },
35913
36306
  "pipelineAnalytics.deleteDeviceEvents": {
35914
36307
  capName: "pipeline-analytics",
35915
36308
  capScope: "device",
@@ -37068,6 +37461,12 @@ Object.freeze({
37068
37461
  addonId: null,
37069
37462
  access: "view"
37070
37463
  },
37464
+ "recording.getRelocateResidue": {
37465
+ capName: "recording",
37466
+ capScope: "system",
37467
+ addonId: null,
37468
+ access: "view"
37469
+ },
37071
37470
  "recording.getStorageMigrationMoveStatus": {
37072
37471
  capName: "recording",
37073
37472
  capScope: "system",
@@ -37614,12 +38013,30 @@ Object.freeze({
37614
38013
  addonId: null,
37615
38014
  access: "create"
37616
38015
  },
38016
+ "storageMigration.drain": {
38017
+ capName: "storage-migration",
38018
+ capScope: "system",
38019
+ addonId: null,
38020
+ access: "create"
38021
+ },
38022
+ "storageMigration.movers": {
38023
+ capName: "storage-migration",
38024
+ capScope: "system",
38025
+ addonId: null,
38026
+ access: "view"
38027
+ },
37617
38028
  "storageMigration.plan": {
37618
38029
  capName: "storage-migration",
37619
38030
  capScope: "system",
37620
38031
  addonId: null,
37621
38032
  access: "view"
37622
38033
  },
38034
+ "storageMigration.residue": {
38035
+ capName: "storage-migration",
38036
+ capScope: "system",
38037
+ addonId: null,
38038
+ access: "view"
38039
+ },
37623
38040
  "storageMigration.start": {
37624
38041
  capName: "storage-migration",
37625
38042
  capScope: "system",
@@ -38454,6 +38871,12 @@ Object.freeze({
38454
38871
  addonId: null,
38455
38872
  access: "delete"
38456
38873
  },
38874
+ "vectorStore.fetchByIds": {
38875
+ capName: "vector-store",
38876
+ capScope: "system",
38877
+ addonId: null,
38878
+ access: "view"
38879
+ },
38457
38880
  "vectorStore.getByIds": {
38458
38881
  capName: "vector-store",
38459
38882
  capScope: "system",
@@ -38466,6 +38889,12 @@ Object.freeze({
38466
38889
  addonId: null,
38467
38890
  access: "view"
38468
38891
  },
38892
+ "vectorStore.scan": {
38893
+ capName: "vector-store",
38894
+ capScope: "system",
38895
+ addonId: null,
38896
+ access: "view"
38897
+ },
38469
38898
  "vectorStore.stats": {
38470
38899
  capName: "vector-store",
38471
38900
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8324,18 +8324,61 @@ var RelocateFootageInputSchema = object({
8324
8324
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8325
8325
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8326
8326
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8327
+ /**
8328
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8329
+ * mover (the engine already walks both collections with a timestamp cursor and
8330
+ * already has a stamp-without-copy path).
8331
+ *
8332
+ * - `move` — the default and the historical behaviour: event-media and
8333
+ * retrain blobs move to `toLocationId` and their rows are
8334
+ * stamped. The enrolled gallery is skipped (D197).
8335
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8336
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8337
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8338
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8339
+ * instant a repoint moves that pointer the row reads from the
8340
+ * new disk while its bytes are on the old one.
8341
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8342
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8343
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8344
+ * never run beside a live second location: it is stop-the-world
8345
+ * by construction, which is acceptable only because the gallery
8346
+ * is a few KB per enrolled sample.
8347
+ */
8348
+ var MediaRelocateModeSchema = _enum([
8349
+ "move",
8350
+ "seal",
8351
+ "gallery"
8352
+ ]);
8327
8353
  var RelocateMediaInputSchema = object({
8328
8354
  toLocationId: string(),
8329
- throttleMbps: number().min(1).max(1e3).optional()
8355
+ throttleMbps: number().min(1).max(1e3).optional(),
8356
+ /** Omitted = `move`, the pre-existing behaviour. */
8357
+ mode: MediaRelocateModeSchema.optional()
8358
+ });
8359
+ /** How many rows still carry NO `locationId` — the population a repoint would
8360
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8361
+ * value that permits a non-blocking `eventMedia` cutover. */
8362
+ var UnstampedEventMediaCountSchema = object({
8363
+ media: number().int().nonnegative(),
8364
+ retrainFrames: number().int().nonnegative(),
8365
+ total: number().int().nonnegative()
8330
8366
  });
8331
8367
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8332
- /** The independently selectable logical storage classes. `recordings`
8333
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8334
- * segments; `eventMedia` is post-analysis blobs. */
8368
+ /** The independently selectable logical storage classes — every class
8369
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8370
+ * Zod enum error where they should meet an explanation.
8371
+ *
8372
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8373
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8374
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8375
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8335
8376
  var StorageMigrationClassSchema = _enum([
8336
8377
  "recordings",
8337
8378
  "recordingsLow",
8338
- "eventMedia"
8379
+ "eventMedia",
8380
+ "backups",
8381
+ "galleryMedia"
8339
8382
  ]);
8340
8383
  /** A destination is always an existing, fully-qualified location id. The
8341
8384
  * migration API intentionally never changes a source location's `basePath`:
@@ -8343,20 +8386,56 @@ var StorageMigrationClassSchema = _enum([
8343
8386
  var StorageMigrationDestinationsSchema = object({
8344
8387
  recordings: string().min(1).optional(),
8345
8388
  recordingsLow: string().min(1).optional(),
8346
- eventMedia: string().min(1).optional()
8389
+ eventMedia: string().min(1).optional(),
8390
+ backups: string().min(1).optional(),
8391
+ galleryMedia: string().min(1).optional()
8347
8392
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8393
+ /**
8394
+ * How a migration sequences the cutover against the byte move.
8395
+ *
8396
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8397
+ * resume. Recording is stopped for the whole move. Right
8398
+ * for a small or a cold class, and the only legal mode for
8399
+ * a `cardinality: 'single'` class.
8400
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8401
+ * refresh, resume, then move the past with everything
8402
+ * running. The pause is three bounded instants (a detach +
8403
+ * attach round, a write-gate drain, a lease) instead of one
8404
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8405
+ * stopped recording under `blocking`; the same move is
8406
+ * seconds of stopped recording under `nonBlocking`.
8407
+ *
8408
+ * The mode is on the JOB, not only on the input, because `status` is where an
8409
+ * operator finds out which one is running.
8410
+ */
8411
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8348
8412
  /** Shared input for planning and starting an orchestrated storage migration. */
8349
8413
  var StorageMigrationInputSchema = object({
8350
8414
  destinations: StorageMigrationDestinationsSchema,
8351
- throttleMbps: number().min(1).max(1e3).optional()
8415
+ throttleMbps: number().min(1).max(1e3).optional(),
8416
+ /** Omitted = `blocking`, which stays the default. */
8417
+ mode: StorageMigrationModeSchema.optional()
8352
8418
  });
8353
- /** The durable coordinator state machine. The only phase that changes default
8354
- * locations is `repointing`, after every selected mover has completed and been
8355
- * verified. */
8419
+ /**
8420
+ * The durable coordinator state machine.
8421
+ *
8422
+ * `blocking`:
8423
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8424
+ *
8425
+ * `nonBlocking`:
8426
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8427
+ *
8428
+ * Same phases, different order plus two new ones — not a second mover.
8429
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8430
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8431
+ * `repointing` is still the only phase that changes a default location.
8432
+ */
8356
8433
  var StorageMigrationPhaseSchema = _enum([
8357
8434
  "planning",
8435
+ "sealing",
8358
8436
  "pausing",
8359
8437
  "moving",
8438
+ "draining",
8360
8439
  "verifying",
8361
8440
  "repointing",
8362
8441
  "refreshing",
@@ -8370,17 +8449,56 @@ var StorageMigrationParticipantSchema = _enum([
8370
8449
  "recorder",
8371
8450
  "analytics"
8372
8451
  ]);
8452
+ /**
8453
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8454
+ *
8455
+ * The long half of a non-blocking migration is `draining`, and it is measured
8456
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8457
+ * existed the only place those numbers appeared was a Loki line, so an operator
8458
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8459
+ * afternoon.
8460
+ *
8461
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8462
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8463
+ * mover — which is the exact failure this is meant to end. The coordinator's
8464
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8465
+ * read `state`; folding the counters costs no extra read and makes the durable
8466
+ * record say afterwards how far a move actually got.
8467
+ *
8468
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8469
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8470
+ * cannot say M, and a 0 there would render as "100 % done".
8471
+ */
8472
+ var StorageMigrationMoveProgressSchema = object({
8473
+ filesMoved: number().int().nonnegative(),
8474
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8475
+ filesTotal: number().int().nonnegative().nullable(),
8476
+ bytesMoved: number().int().nonnegative(),
8477
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8478
+ * crash gets a new mover, and a rate computed from the migration's start
8479
+ * would silently average in the time nothing was running. */
8480
+ startedAt: number(),
8481
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8482
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8483
+ * subtract its own. */
8484
+ observedAt: number()
8485
+ });
8373
8486
  var StorageMigrationMoveSchema = object({
8374
8487
  storageClass: StorageMigrationClassSchema,
8375
8488
  fromLocationId: string(),
8376
8489
  toLocationId: string(),
8377
8490
  moverJobId: string().nullable(),
8378
8491
  state: RelocateJobStateSchema.nullable(),
8379
- error: string().nullable()
8492
+ error: string().nullable(),
8493
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8494
+ progress: StorageMigrationMoveProgressSchema.nullable()
8380
8495
  });
8381
8496
  var StorageMigrationJobSchema = object({
8382
8497
  jobId: string(),
8383
8498
  phase: StorageMigrationPhaseSchema,
8499
+ /** Which order this job is running. `status` is the only place an operator
8500
+ * can tell a seconds-long cutover from a thirty-hour one. */
8501
+ mode: StorageMigrationModeSchema,
8384
8502
  destinations: StorageMigrationDestinationsSchema,
8385
8503
  throttleMbps: number(),
8386
8504
  moves: array(StorageMigrationMoveSchema),
@@ -8393,13 +8511,122 @@ var StorageMigrationJobSchema = object({
8393
8511
  finishedAt: number().nullable(),
8394
8512
  error: string().nullable()
8395
8513
  });
8514
+ var StorageMigrationFindingSchema = object({
8515
+ code: _enum([
8516
+ "sharesDeviceWithSource",
8517
+ "deviceIdentityUnknown",
8518
+ "unstampedEventMediaRows",
8519
+ "blockingOnly",
8520
+ "noMover"
8521
+ ]),
8522
+ storageClass: StorageMigrationClassSchema,
8523
+ /** Human-readable, already carrying the ids and counts. */
8524
+ message: string()
8525
+ });
8396
8526
  var StorageMigrationPlanSchema = object({
8397
8527
  destinations: StorageMigrationDestinationsSchema,
8528
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8529
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8530
+ * it. */
8531
+ mode: StorageMigrationModeSchema,
8398
8532
  moves: array(object({
8399
8533
  storageClass: StorageMigrationClassSchema,
8400
8534
  fromLocationId: string(),
8401
8535
  toLocationId: string()
8402
- }))
8536
+ })),
8537
+ findings: array(StorageMigrationFindingSchema)
8538
+ });
8539
+ /**
8540
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8541
+ *
8542
+ * The coordinator's job record is the state of record for a migration, and its
8543
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8544
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8545
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8546
+ * way because no supported UI path existed. A mover armed like that has no job
8547
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8548
+ *
8549
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8550
+ * orchestrated it.
8551
+ */
8552
+ var StorageMigrationMoverSchema = object({
8553
+ lane: _enum(["footage", "media"]),
8554
+ job: RelocateJobSchema,
8555
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8556
+ * directly against the owning addon. */
8557
+ migrationJobId: string().nullable(),
8558
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8559
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8560
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8561
+ * rate made of two different clocks. */
8562
+ observedAt: number()
8563
+ });
8564
+ /**
8565
+ * What a SOURCE still holds for one storage class — the number that makes a
8566
+ * "drain remaining" action honest rather than hopeful.
8567
+ *
8568
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8569
+ * engine's own selection count for media), never from the resident index: a
8570
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8571
+ * never been told about (D295).
8572
+ *
8573
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8574
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8575
+ * because refusing on an unanswerable read would hide exactly the case an
8576
+ * operator needs to act on.
8577
+ */
8578
+ var StorageMigrationResidueSchema = object({
8579
+ storageClass: StorageMigrationClassSchema,
8580
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8581
+ * move from wherever they are rather than from one named source. */
8582
+ fromLocationId: string(),
8583
+ /** Where a drain would move it — the class's CURRENT default. */
8584
+ toLocationId: string(),
8585
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8586
+ items: number().int().nonnegative().nullable(),
8587
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8588
+ bytes: number().int().nonnegative().nullable()
8589
+ });
8590
+ /**
8591
+ * Run the DRAIN half and nothing else.
8592
+ *
8593
+ * A migration that reached `done` has already repointed, so `start` correctly
8594
+ * refuses its destination ("already the default") — there is nothing left to
8595
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8596
+ * or finish against a work list that was a tenth of the archive (D295), and
8597
+ * before this there was no supported way to run only that half: the only way
8598
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8599
+ *
8600
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8601
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8602
+ * re-repoint a class that is already migrated.
8603
+ */
8604
+ var StorageMigrationDrainInputSchema = object({
8605
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8606
+ * a class whose source is already empty is refused rather than started. */
8607
+ classes: array(StorageMigrationClassSchema).min(1),
8608
+ throttleMbps: number().min(1).max(1e3).optional()
8609
+ });
8610
+ /** What a footage source still holds, asked of the durable hour ledger. */
8611
+ var RelocateResidueInputSchema = object({
8612
+ fromLocationId: string().min(1),
8613
+ /** Narrow to one logical class; omit for every profile on the location. */
8614
+ footageClass: RelocateFootageClassSchema.optional()
8615
+ });
8616
+ /** `null` = the archive could not answer (no ledger on this node, or the
8617
+ * aggregate failed). Never conflated with an empty source. */
8618
+ var RelocateResidueSchema = object({
8619
+ segments: number().int().nonnegative(),
8620
+ bytes: number().int().nonnegative()
8621
+ }).nullable();
8622
+ /** How many rows a media pass would still act on against a given target — the
8623
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8624
+ * never disagree. `null` = the count could not be taken. */
8625
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8626
+ var RelocatableMediaCountInputSchema = object({
8627
+ toLocationId: string().min(1),
8628
+ /** Omitted = `move`. */
8629
+ mode: MediaRelocateModeSchema.optional()
8403
8630
  });
8404
8631
  /**
8405
8632
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8505,6 +8732,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8505
8732
  * two addons declaring the same `id` must agree on `cardinality` (validated
8506
8733
  * at kernel aggregation time, not here).
8507
8734
  */
8735
+ /**
8736
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8737
+ * actually reaches the bytes. It is the constraint that decides which
8738
+ * `storage-provider`s may back a location of that kind.
8739
+ *
8740
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8741
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8742
+ * post-analysis media roots). Only a provider that serves a genuine local
8743
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8744
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8745
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8746
+ * against a same-named local directory that is something else entirely.
8747
+ *
8748
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8749
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8750
+ * service never sees a path, so any provider can back it. `backups` is the
8751
+ * one kind that qualifies today.
8752
+ *
8753
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8754
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8755
+ * refused the configuration; the first write simply went somewhere wrong, and
8756
+ * a recording write that goes wrong surfaces as a silent black window rather
8757
+ * than an error (the read path does not `stat`). This turns that accident into
8758
+ * a declared, enforced, testable refusal.
8759
+ */
8760
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8508
8761
  var StorageLocationDeclarationSchema = object({
8509
8762
  /**
8510
8763
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8524,6 +8777,19 @@ var StorageLocationDeclarationSchema = object({
8524
8777
  */
8525
8778
  cardinality: _enum(["single", "multi"]),
8526
8779
  /**
8780
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8781
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8782
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8783
+ *
8784
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8785
+ * can only over-restrict (refuse a remote provider for a kind that might
8786
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8787
+ * permissive direction and is therefore never inferred — a repo guard
8788
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8789
+ * reached by omission.
8790
+ */
8791
+ access: StorageAccessSchema.optional(),
8792
+ /**
8527
8793
  * When set, the default instance for this location inherits its resolved
8528
8794
  * root from the named location's default instance. Useful for derivative
8529
8795
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18724,8 +18990,10 @@ var TrackSchema = object({
18724
18990
  lastSeen: number(),
18725
18991
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18726
18992
  positions: array(TrackPositionSchema).readonly(),
18727
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18728
- * saveThumbnails policy). */
18993
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18994
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18995
+ * the retired `saveThumbnails` used to gate this and the rolling
18996
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18729
18997
  snapshots: array(TrackSnapshotSchema).readonly(),
18730
18998
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18731
18999
  zonesVisited: array(string()).readonly(),
@@ -19585,6 +19853,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19585
19853
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19586
19854
  kind: "mutation",
19587
19855
  auth: "admin"
19856
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19857
+ kind: "query",
19858
+ auth: "admin"
19588
19859
  }), method(object({}), array(RelocateJobSchema).readonly(), {
19589
19860
  kind: "query",
19590
19861
  auth: "admin"
@@ -21596,7 +21867,10 @@ method(object({
21596
21867
  }), StorageLocationSchema, {
21597
21868
  kind: "mutation",
21598
21869
  auth: "admin"
21599
- }), method(object({ id: string() }), _void(), {
21870
+ }), method(object({
21871
+ id: string(),
21872
+ force: boolean().optional()
21873
+ }), _void(), {
21600
21874
  kind: "mutation",
21601
21875
  auth: "admin"
21602
21876
  }), method(object({ id: string() }), object({
@@ -21645,6 +21919,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21645
21919
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21646
21920
  kind: "mutation",
21647
21921
  auth: "admin"
21922
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21923
+ kind: "mutation",
21924
+ auth: "admin"
21648
21925
  });
21649
21926
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21650
21927
  providerId: string().min(1),
@@ -22043,12 +22320,38 @@ response: record(string(), unknown()) }), object({
22043
22320
  *
22044
22321
  * ## Why this is a capability and not a helper
22045
22322
  *
22046
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
22047
- * plate, vehicle, identity, and the event store's derivativesand every one of
22048
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
22049
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
22050
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
22051
- * load 5,000 rows before ranking anything.
22323
+ * This capability was introduced with the claim that SIX stores in
22324
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
22325
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
22326
+ * claim was never true, and leaving it here made five stores look like pending
22327
+ * work when three of them have no vector at all. Counted column by column on
22328
+ * 2026-08-30, exactly THREE ever held one:
22329
+ *
22330
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
22331
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
22332
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
22333
+ * face, migrated 2026-08-30 into its OWN index (see below).
22334
+ *
22335
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
22336
+ * and `identities` store a name; the event store stores no derivative vector.
22337
+ * They are not migration candidates and never were.
22338
+ *
22339
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
22340
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
22341
+ * rows before ranking anything.
22342
+ *
22343
+ * ## One index per COMPARISON, never per encoder
22344
+ *
22345
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
22346
+ * model, and they still get two indexes. An index is a set of things that are
22347
+ * ranked against each other and that live and die together, and these two are
22348
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
22349
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
22350
+ * forever and is the gallery every recognition ranks against. One index would
22351
+ * mean every gallery load and every reconcile carried a filter whose failure
22352
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
22353
+ * person's only sample. The dimension they share is not a reason to share an
22354
+ * index; the question they answer is, and it differs.
22052
22355
  *
22053
22356
  * The fix is not a faster loop, it is a different backend — and the backend
22054
22357
  * should be replaceable without touching six callers. So: a singleton
@@ -22153,7 +22456,20 @@ var VectorQueryResultSchema = object({
22153
22456
  */
22154
22457
  scanned: number(),
22155
22458
  /** True when the backend could not consider every row that passed the filter. */
22156
- truncated: boolean()
22459
+ truncated: boolean(),
22460
+ /**
22461
+ * The `topK` the backend actually ran with.
22462
+ *
22463
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
22464
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
22465
+ * own log rather than in its answer. That is how an audit asking for 20,000
22466
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
22467
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
22468
+ * MUCH, in the return value, where the caller cannot fail to see it.
22469
+ *
22470
+ * Equals the requested `topK` whenever nothing was lowered.
22471
+ */
22472
+ effectiveTopK: number().int().positive()
22157
22473
  });
22158
22474
  var VectorDeleteInputSchema = object({
22159
22475
  index: string(),
@@ -22182,6 +22498,68 @@ var VectorGetResultSchema = object({ items: array(object({
22182
22498
  id: string(),
22183
22499
  metadata: VectorMetadataSchema
22184
22500
  })) });
22501
+ /**
22502
+ * Ids to read back WITH their vectors.
22503
+ *
22504
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22505
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22506
+ * caller depends on that promise. This one promises the opposite.
22507
+ *
22508
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22509
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22510
+ * a per-face cross-process KNN would be a network round trip inside the
22511
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22512
+ * it requires the index to hand the floats back. Without this method the only
22513
+ * way to keep a readable vector is a JSON column, which is the thing this
22514
+ * capability exists to delete.
22515
+ *
22516
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22517
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22518
+ */
22519
+ var VectorFetchInputSchema = object({
22520
+ index: string(),
22521
+ ids: array(string())
22522
+ });
22523
+ var VectorFetchResultSchema = object({ items: array(object({
22524
+ id: string(),
22525
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22526
+ vector: string(),
22527
+ metadata: VectorMetadataSchema
22528
+ })) });
22529
+ /**
22530
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22531
+ *
22532
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22533
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22534
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22535
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22536
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22537
+ * looked" for as long as anyone cared to read it.
22538
+ *
22539
+ * This is the primitive that question actually needs: a bounded page, ordered
22540
+ * by the backend's own row order, costing no distance computation at all.
22541
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22542
+ * the full-table read this capability was built to stop.
22543
+ */
22544
+ var VectorScanInputSchema = object({
22545
+ index: string(),
22546
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22547
+ cursor: number().int().nonnegative().default(0),
22548
+ limit: number().int().positive()
22549
+ });
22550
+ var VectorScanResultSchema = object({
22551
+ items: array(object({
22552
+ id: string(),
22553
+ metadata: VectorMetadataSchema
22554
+ })),
22555
+ /**
22556
+ * Where the next page starts, or `null` when the walk reached the end.
22557
+ *
22558
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22559
+ * from a short page: a backend is free to return fewer rows than asked.
22560
+ */
22561
+ nextCursor: number().int().nonnegative().nullable()
22562
+ });
22185
22563
  var VectorStatsInputSchema = object({ index: string() });
22186
22564
  var VectorStatsResultSchema = object({
22187
22565
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -22200,7 +22578,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
22200
22578
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
22201
22579
  kind: "mutation",
22202
22580
  auth: "admin"
22203
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22581
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22204
22582
  kind: "mutation",
22205
22583
  auth: "admin"
22206
22584
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28906,6 +29284,9 @@ method(object({
28906
29284
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28907
29285
  kind: "query",
28908
29286
  auth: "admin"
29287
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
29288
+ kind: "query",
29289
+ auth: "admin"
28909
29290
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28910
29291
  kind: "mutation",
28911
29292
  auth: "admin"
@@ -35905,6 +36286,18 @@ Object.freeze({
35905
36286
  addonId: null,
35906
36287
  access: "create"
35907
36288
  },
36289
+ "pipelineAnalytics.countRelocatableMedia": {
36290
+ capName: "pipeline-analytics",
36291
+ capScope: "device",
36292
+ addonId: null,
36293
+ access: "view"
36294
+ },
36295
+ "pipelineAnalytics.countUnstampedEventMedia": {
36296
+ capName: "pipeline-analytics",
36297
+ capScope: "device",
36298
+ addonId: null,
36299
+ access: "view"
36300
+ },
35908
36301
  "pipelineAnalytics.deleteDeviceEvents": {
35909
36302
  capName: "pipeline-analytics",
35910
36303
  capScope: "device",
@@ -37063,6 +37456,12 @@ Object.freeze({
37063
37456
  addonId: null,
37064
37457
  access: "view"
37065
37458
  },
37459
+ "recording.getRelocateResidue": {
37460
+ capName: "recording",
37461
+ capScope: "system",
37462
+ addonId: null,
37463
+ access: "view"
37464
+ },
37066
37465
  "recording.getStorageMigrationMoveStatus": {
37067
37466
  capName: "recording",
37068
37467
  capScope: "system",
@@ -37609,12 +38008,30 @@ Object.freeze({
37609
38008
  addonId: null,
37610
38009
  access: "create"
37611
38010
  },
38011
+ "storageMigration.drain": {
38012
+ capName: "storage-migration",
38013
+ capScope: "system",
38014
+ addonId: null,
38015
+ access: "create"
38016
+ },
38017
+ "storageMigration.movers": {
38018
+ capName: "storage-migration",
38019
+ capScope: "system",
38020
+ addonId: null,
38021
+ access: "view"
38022
+ },
37612
38023
  "storageMigration.plan": {
37613
38024
  capName: "storage-migration",
37614
38025
  capScope: "system",
37615
38026
  addonId: null,
37616
38027
  access: "view"
37617
38028
  },
38029
+ "storageMigration.residue": {
38030
+ capName: "storage-migration",
38031
+ capScope: "system",
38032
+ addonId: null,
38033
+ access: "view"
38034
+ },
37618
38035
  "storageMigration.start": {
37619
38036
  capName: "storage-migration",
37620
38037
  capScope: "system",
@@ -38449,6 +38866,12 @@ Object.freeze({
38449
38866
  addonId: null,
38450
38867
  access: "delete"
38451
38868
  },
38869
+ "vectorStore.fetchByIds": {
38870
+ capName: "vector-store",
38871
+ capScope: "system",
38872
+ addonId: null,
38873
+ access: "view"
38874
+ },
38452
38875
  "vectorStore.getByIds": {
38453
38876
  capName: "vector-store",
38454
38877
  capScope: "system",
@@ -38461,6 +38884,12 @@ Object.freeze({
38461
38884
  addonId: null,
38462
38885
  access: "view"
38463
38886
  },
38887
+ "vectorStore.scan": {
38888
+ capName: "vector-store",
38889
+ capScope: "system",
38890
+ addonId: null,
38891
+ access: "view"
38892
+ },
38464
38893
  "vectorStore.stats": {
38465
38894
  capName: "vector-store",
38466
38895
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-reolink",
3
- "version": "1.2.65",
3
+ "version": "1.2.68",
4
4
  "description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
5
5
  "keywords": [
6
6
  "camstack",