@camstack/addon-export-google 0.1.6 → 0.1.9

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.
@@ -8232,18 +8232,61 @@ var RelocateFootageInputSchema = object({
8232
8232
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8233
8233
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8234
8234
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8235
+ /**
8236
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8237
+ * mover (the engine already walks both collections with a timestamp cursor and
8238
+ * already has a stamp-without-copy path).
8239
+ *
8240
+ * - `move` — the default and the historical behaviour: event-media and
8241
+ * retrain blobs move to `toLocationId` and their rows are
8242
+ * stamped. The enrolled gallery is skipped (D197).
8243
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8244
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8245
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8246
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8247
+ * instant a repoint moves that pointer the row reads from the
8248
+ * new disk while its bytes are on the old one.
8249
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8250
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8251
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8252
+ * never run beside a live second location: it is stop-the-world
8253
+ * by construction, which is acceptable only because the gallery
8254
+ * is a few KB per enrolled sample.
8255
+ */
8256
+ var MediaRelocateModeSchema = _enum([
8257
+ "move",
8258
+ "seal",
8259
+ "gallery"
8260
+ ]);
8235
8261
  var RelocateMediaInputSchema = object({
8236
8262
  toLocationId: string(),
8237
- throttleMbps: number().min(1).max(1e3).optional()
8263
+ throttleMbps: number().min(1).max(1e3).optional(),
8264
+ /** Omitted = `move`, the pre-existing behaviour. */
8265
+ mode: MediaRelocateModeSchema.optional()
8266
+ });
8267
+ /** How many rows still carry NO `locationId` — the population a repoint would
8268
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8269
+ * value that permits a non-blocking `eventMedia` cutover. */
8270
+ var UnstampedEventMediaCountSchema = object({
8271
+ media: number().int().nonnegative(),
8272
+ retrainFrames: number().int().nonnegative(),
8273
+ total: number().int().nonnegative()
8238
8274
  });
8239
8275
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8240
- /** The independently selectable logical storage classes. `recordings`
8241
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8242
- * segments; `eventMedia` is post-analysis blobs. */
8276
+ /** The independently selectable logical storage classes — every class
8277
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8278
+ * Zod enum error where they should meet an explanation.
8279
+ *
8280
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8281
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8282
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8283
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8243
8284
  var StorageMigrationClassSchema = _enum([
8244
8285
  "recordings",
8245
8286
  "recordingsLow",
8246
- "eventMedia"
8287
+ "eventMedia",
8288
+ "backups",
8289
+ "galleryMedia"
8247
8290
  ]);
8248
8291
  /** A destination is always an existing, fully-qualified location id. The
8249
8292
  * migration API intentionally never changes a source location's `basePath`:
@@ -8251,20 +8294,56 @@ var StorageMigrationClassSchema = _enum([
8251
8294
  var StorageMigrationDestinationsSchema = object({
8252
8295
  recordings: string().min(1).optional(),
8253
8296
  recordingsLow: string().min(1).optional(),
8254
- eventMedia: string().min(1).optional()
8297
+ eventMedia: string().min(1).optional(),
8298
+ backups: string().min(1).optional(),
8299
+ galleryMedia: string().min(1).optional()
8255
8300
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8301
+ /**
8302
+ * How a migration sequences the cutover against the byte move.
8303
+ *
8304
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8305
+ * resume. Recording is stopped for the whole move. Right
8306
+ * for a small or a cold class, and the only legal mode for
8307
+ * a `cardinality: 'single'` class.
8308
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8309
+ * refresh, resume, then move the past with everything
8310
+ * running. The pause is three bounded instants (a detach +
8311
+ * attach round, a write-gate drain, a lease) instead of one
8312
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8313
+ * stopped recording under `blocking`; the same move is
8314
+ * seconds of stopped recording under `nonBlocking`.
8315
+ *
8316
+ * The mode is on the JOB, not only on the input, because `status` is where an
8317
+ * operator finds out which one is running.
8318
+ */
8319
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8256
8320
  /** Shared input for planning and starting an orchestrated storage migration. */
8257
8321
  var StorageMigrationInputSchema = object({
8258
8322
  destinations: StorageMigrationDestinationsSchema,
8259
- throttleMbps: number().min(1).max(1e3).optional()
8323
+ throttleMbps: number().min(1).max(1e3).optional(),
8324
+ /** Omitted = `blocking`, which stays the default. */
8325
+ mode: StorageMigrationModeSchema.optional()
8260
8326
  });
8261
- /** The durable coordinator state machine. The only phase that changes default
8262
- * locations is `repointing`, after every selected mover has completed and been
8263
- * verified. */
8327
+ /**
8328
+ * The durable coordinator state machine.
8329
+ *
8330
+ * `blocking`:
8331
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8332
+ *
8333
+ * `nonBlocking`:
8334
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8335
+ *
8336
+ * Same phases, different order plus two new ones — not a second mover.
8337
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8338
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8339
+ * `repointing` is still the only phase that changes a default location.
8340
+ */
8264
8341
  var StorageMigrationPhaseSchema = _enum([
8265
8342
  "planning",
8343
+ "sealing",
8266
8344
  "pausing",
8267
8345
  "moving",
8346
+ "draining",
8268
8347
  "verifying",
8269
8348
  "repointing",
8270
8349
  "refreshing",
@@ -8278,17 +8357,56 @@ var StorageMigrationParticipantSchema = _enum([
8278
8357
  "recorder",
8279
8358
  "analytics"
8280
8359
  ]);
8360
+ /**
8361
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8362
+ *
8363
+ * The long half of a non-blocking migration is `draining`, and it is measured
8364
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8365
+ * existed the only place those numbers appeared was a Loki line, so an operator
8366
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8367
+ * afternoon.
8368
+ *
8369
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8370
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8371
+ * mover — which is the exact failure this is meant to end. The coordinator's
8372
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8373
+ * read `state`; folding the counters costs no extra read and makes the durable
8374
+ * record say afterwards how far a move actually got.
8375
+ *
8376
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8377
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8378
+ * cannot say M, and a 0 there would render as "100 % done".
8379
+ */
8380
+ var StorageMigrationMoveProgressSchema = object({
8381
+ filesMoved: number().int().nonnegative(),
8382
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8383
+ filesTotal: number().int().nonnegative().nullable(),
8384
+ bytesMoved: number().int().nonnegative(),
8385
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8386
+ * crash gets a new mover, and a rate computed from the migration's start
8387
+ * would silently average in the time nothing was running. */
8388
+ startedAt: number(),
8389
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8390
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8391
+ * subtract its own. */
8392
+ observedAt: number()
8393
+ });
8281
8394
  var StorageMigrationMoveSchema = object({
8282
8395
  storageClass: StorageMigrationClassSchema,
8283
8396
  fromLocationId: string(),
8284
8397
  toLocationId: string(),
8285
8398
  moverJobId: string().nullable(),
8286
8399
  state: RelocateJobStateSchema.nullable(),
8287
- error: string().nullable()
8400
+ error: string().nullable(),
8401
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8402
+ progress: StorageMigrationMoveProgressSchema.nullable()
8288
8403
  });
8289
8404
  var StorageMigrationJobSchema = object({
8290
8405
  jobId: string(),
8291
8406
  phase: StorageMigrationPhaseSchema,
8407
+ /** Which order this job is running. `status` is the only place an operator
8408
+ * can tell a seconds-long cutover from a thirty-hour one. */
8409
+ mode: StorageMigrationModeSchema,
8292
8410
  destinations: StorageMigrationDestinationsSchema,
8293
8411
  throttleMbps: number(),
8294
8412
  moves: array(StorageMigrationMoveSchema),
@@ -8301,13 +8419,122 @@ var StorageMigrationJobSchema = object({
8301
8419
  finishedAt: number().nullable(),
8302
8420
  error: string().nullable()
8303
8421
  });
8422
+ var StorageMigrationFindingSchema = object({
8423
+ code: _enum([
8424
+ "sharesDeviceWithSource",
8425
+ "deviceIdentityUnknown",
8426
+ "unstampedEventMediaRows",
8427
+ "blockingOnly",
8428
+ "noMover"
8429
+ ]),
8430
+ storageClass: StorageMigrationClassSchema,
8431
+ /** Human-readable, already carrying the ids and counts. */
8432
+ message: string()
8433
+ });
8304
8434
  var StorageMigrationPlanSchema = object({
8305
8435
  destinations: StorageMigrationDestinationsSchema,
8436
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8437
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8438
+ * it. */
8439
+ mode: StorageMigrationModeSchema,
8306
8440
  moves: array(object({
8307
8441
  storageClass: StorageMigrationClassSchema,
8308
8442
  fromLocationId: string(),
8309
8443
  toLocationId: string()
8310
- }))
8444
+ })),
8445
+ findings: array(StorageMigrationFindingSchema)
8446
+ });
8447
+ /**
8448
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8449
+ *
8450
+ * The coordinator's job record is the state of record for a migration, and its
8451
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8452
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8453
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8454
+ * way because no supported UI path existed. A mover armed like that has no job
8455
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8456
+ *
8457
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8458
+ * orchestrated it.
8459
+ */
8460
+ var StorageMigrationMoverSchema = object({
8461
+ lane: _enum(["footage", "media"]),
8462
+ job: RelocateJobSchema,
8463
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8464
+ * directly against the owning addon. */
8465
+ migrationJobId: string().nullable(),
8466
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8467
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8468
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8469
+ * rate made of two different clocks. */
8470
+ observedAt: number()
8471
+ });
8472
+ /**
8473
+ * What a SOURCE still holds for one storage class — the number that makes a
8474
+ * "drain remaining" action honest rather than hopeful.
8475
+ *
8476
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8477
+ * engine's own selection count for media), never from the resident index: a
8478
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8479
+ * never been told about (D295).
8480
+ *
8481
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8482
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8483
+ * because refusing on an unanswerable read would hide exactly the case an
8484
+ * operator needs to act on.
8485
+ */
8486
+ var StorageMigrationResidueSchema = object({
8487
+ storageClass: StorageMigrationClassSchema,
8488
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8489
+ * move from wherever they are rather than from one named source. */
8490
+ fromLocationId: string(),
8491
+ /** Where a drain would move it — the class's CURRENT default. */
8492
+ toLocationId: string(),
8493
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8494
+ items: number().int().nonnegative().nullable(),
8495
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8496
+ bytes: number().int().nonnegative().nullable()
8497
+ });
8498
+ /**
8499
+ * Run the DRAIN half and nothing else.
8500
+ *
8501
+ * A migration that reached `done` has already repointed, so `start` correctly
8502
+ * refuses its destination ("already the default") — there is nothing left to
8503
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8504
+ * or finish against a work list that was a tenth of the archive (D295), and
8505
+ * before this there was no supported way to run only that half: the only way
8506
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8507
+ *
8508
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8509
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8510
+ * re-repoint a class that is already migrated.
8511
+ */
8512
+ var StorageMigrationDrainInputSchema = object({
8513
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8514
+ * a class whose source is already empty is refused rather than started. */
8515
+ classes: array(StorageMigrationClassSchema).min(1),
8516
+ throttleMbps: number().min(1).max(1e3).optional()
8517
+ });
8518
+ /** What a footage source still holds, asked of the durable hour ledger. */
8519
+ var RelocateResidueInputSchema = object({
8520
+ fromLocationId: string().min(1),
8521
+ /** Narrow to one logical class; omit for every profile on the location. */
8522
+ footageClass: RelocateFootageClassSchema.optional()
8523
+ });
8524
+ /** `null` = the archive could not answer (no ledger on this node, or the
8525
+ * aggregate failed). Never conflated with an empty source. */
8526
+ var RelocateResidueSchema = object({
8527
+ segments: number().int().nonnegative(),
8528
+ bytes: number().int().nonnegative()
8529
+ }).nullable();
8530
+ /** How many rows a media pass would still act on against a given target — the
8531
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8532
+ * never disagree. `null` = the count could not be taken. */
8533
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8534
+ var RelocatableMediaCountInputSchema = object({
8535
+ toLocationId: string().min(1),
8536
+ /** Omitted = `move`. */
8537
+ mode: MediaRelocateModeSchema.optional()
8311
8538
  });
8312
8539
  /**
8313
8540
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8413,6 +8640,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8413
8640
  * two addons declaring the same `id` must agree on `cardinality` (validated
8414
8641
  * at kernel aggregation time, not here).
8415
8642
  */
8643
+ /**
8644
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8645
+ * actually reaches the bytes. It is the constraint that decides which
8646
+ * `storage-provider`s may back a location of that kind.
8647
+ *
8648
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8649
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8650
+ * post-analysis media roots). Only a provider that serves a genuine local
8651
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8652
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8653
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8654
+ * against a same-named local directory that is something else entirely.
8655
+ *
8656
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8657
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8658
+ * service never sees a path, so any provider can back it. `backups` is the
8659
+ * one kind that qualifies today.
8660
+ *
8661
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8662
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8663
+ * refused the configuration; the first write simply went somewhere wrong, and
8664
+ * a recording write that goes wrong surfaces as a silent black window rather
8665
+ * than an error (the read path does not `stat`). This turns that accident into
8666
+ * a declared, enforced, testable refusal.
8667
+ */
8668
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8416
8669
  var StorageLocationDeclarationSchema = object({
8417
8670
  /**
8418
8671
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8432,6 +8685,19 @@ var StorageLocationDeclarationSchema = object({
8432
8685
  */
8433
8686
  cardinality: _enum(["single", "multi"]),
8434
8687
  /**
8688
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8689
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8690
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8691
+ *
8692
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8693
+ * can only over-restrict (refuse a remote provider for a kind that might
8694
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8695
+ * permissive direction and is therefore never inferred — a repo guard
8696
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8697
+ * reached by omission.
8698
+ */
8699
+ access: StorageAccessSchema.optional(),
8700
+ /**
8435
8701
  * When set, the default instance for this location inherits its resolved
8436
8702
  * root from the named location's default instance. Useful for derivative
8437
8703
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18046,8 +18312,10 @@ var TrackSchema = object({
18046
18312
  lastSeen: number(),
18047
18313
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18048
18314
  positions: array(TrackPositionSchema).readonly(),
18049
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18050
- * saveThumbnails policy). */
18315
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18316
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18317
+ * the retired `saveThumbnails` used to gate this and the rolling
18318
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18051
18319
  snapshots: array(TrackSnapshotSchema).readonly(),
18052
18320
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18053
18321
  zonesVisited: array(string()).readonly(),
@@ -18907,6 +19175,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18907
19175
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18908
19176
  kind: "mutation",
18909
19177
  auth: "admin"
19178
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19179
+ kind: "query",
19180
+ auth: "admin"
18910
19181
  }), method(object({}), array(RelocateJobSchema).readonly(), {
18911
19182
  kind: "query",
18912
19183
  auth: "admin"
@@ -20814,7 +21085,10 @@ method(object({
20814
21085
  }), StorageLocationSchema, {
20815
21086
  kind: "mutation",
20816
21087
  auth: "admin"
20817
- }), method(object({ id: string() }), _void(), {
21088
+ }), method(object({
21089
+ id: string(),
21090
+ force: boolean().optional()
21091
+ }), _void(), {
20818
21092
  kind: "mutation",
20819
21093
  auth: "admin"
20820
21094
  }), method(object({ id: string() }), object({
@@ -20863,6 +21137,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20863
21137
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20864
21138
  kind: "mutation",
20865
21139
  auth: "admin"
21140
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21141
+ kind: "mutation",
21142
+ auth: "admin"
20866
21143
  });
20867
21144
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20868
21145
  providerId: string().min(1),
@@ -21261,12 +21538,38 @@ response: record(string(), unknown()) }), object({
21261
21538
  *
21262
21539
  * ## Why this is a capability and not a helper
21263
21540
  *
21264
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21265
- * plate, vehicle, identity, and the event store's derivativesand every one of
21266
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21267
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21268
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21269
- * load 5,000 rows before ranking anything.
21541
+ * This capability was introduced with the claim that SIX stores in
21542
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21543
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21544
+ * claim was never true, and leaving it here made five stores look like pending
21545
+ * work when three of them have no vector at all. Counted column by column on
21546
+ * 2026-08-30, exactly THREE ever held one:
21547
+ *
21548
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21549
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21550
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21551
+ * face, migrated 2026-08-30 into its OWN index (see below).
21552
+ *
21553
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21554
+ * and `identities` store a name; the event store stores no derivative vector.
21555
+ * They are not migration candidates and never were.
21556
+ *
21557
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21558
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21559
+ * rows before ranking anything.
21560
+ *
21561
+ * ## One index per COMPARISON, never per encoder
21562
+ *
21563
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21564
+ * model, and they still get two indexes. An index is a set of things that are
21565
+ * ranked against each other and that live and die together, and these two are
21566
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21567
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21568
+ * forever and is the gallery every recognition ranks against. One index would
21569
+ * mean every gallery load and every reconcile carried a filter whose failure
21570
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21571
+ * person's only sample. The dimension they share is not a reason to share an
21572
+ * index; the question they answer is, and it differs.
21270
21573
  *
21271
21574
  * The fix is not a faster loop, it is a different backend — and the backend
21272
21575
  * should be replaceable without touching six callers. So: a singleton
@@ -21371,7 +21674,20 @@ var VectorQueryResultSchema = object({
21371
21674
  */
21372
21675
  scanned: number(),
21373
21676
  /** True when the backend could not consider every row that passed the filter. */
21374
- truncated: boolean()
21677
+ truncated: boolean(),
21678
+ /**
21679
+ * The `topK` the backend actually ran with.
21680
+ *
21681
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21682
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21683
+ * own log rather than in its answer. That is how an audit asking for 20,000
21684
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21685
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21686
+ * MUCH, in the return value, where the caller cannot fail to see it.
21687
+ *
21688
+ * Equals the requested `topK` whenever nothing was lowered.
21689
+ */
21690
+ effectiveTopK: number().int().positive()
21375
21691
  });
21376
21692
  var VectorDeleteInputSchema = object({
21377
21693
  index: string(),
@@ -21400,6 +21716,68 @@ var VectorGetResultSchema = object({ items: array(object({
21400
21716
  id: string(),
21401
21717
  metadata: VectorMetadataSchema
21402
21718
  })) });
21719
+ /**
21720
+ * Ids to read back WITH their vectors.
21721
+ *
21722
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21723
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21724
+ * caller depends on that promise. This one promises the opposite.
21725
+ *
21726
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21727
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21728
+ * a per-face cross-process KNN would be a network round trip inside the
21729
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21730
+ * it requires the index to hand the floats back. Without this method the only
21731
+ * way to keep a readable vector is a JSON column, which is the thing this
21732
+ * capability exists to delete.
21733
+ *
21734
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21735
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21736
+ */
21737
+ var VectorFetchInputSchema = object({
21738
+ index: string(),
21739
+ ids: array(string())
21740
+ });
21741
+ var VectorFetchResultSchema = object({ items: array(object({
21742
+ id: string(),
21743
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21744
+ vector: string(),
21745
+ metadata: VectorMetadataSchema
21746
+ })) });
21747
+ /**
21748
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21749
+ *
21750
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21751
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21752
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21753
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21754
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21755
+ * looked" for as long as anyone cared to read it.
21756
+ *
21757
+ * This is the primitive that question actually needs: a bounded page, ordered
21758
+ * by the backend's own row order, costing no distance computation at all.
21759
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21760
+ * the full-table read this capability was built to stop.
21761
+ */
21762
+ var VectorScanInputSchema = object({
21763
+ index: string(),
21764
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21765
+ cursor: number().int().nonnegative().default(0),
21766
+ limit: number().int().positive()
21767
+ });
21768
+ var VectorScanResultSchema = object({
21769
+ items: array(object({
21770
+ id: string(),
21771
+ metadata: VectorMetadataSchema
21772
+ })),
21773
+ /**
21774
+ * Where the next page starts, or `null` when the walk reached the end.
21775
+ *
21776
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21777
+ * from a short page: a backend is free to return fewer rows than asked.
21778
+ */
21779
+ nextCursor: number().int().nonnegative().nullable()
21780
+ });
21403
21781
  var VectorStatsInputSchema = object({ index: string() });
21404
21782
  var VectorStatsResultSchema = object({
21405
21783
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21418,7 +21796,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21418
21796
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21419
21797
  kind: "mutation",
21420
21798
  auth: "admin"
21421
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21799
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21422
21800
  kind: "mutation",
21423
21801
  auth: "admin"
21424
21802
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26334,6 +26712,9 @@ method(object({
26334
26712
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26335
26713
  kind: "query",
26336
26714
  auth: "admin"
26715
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26716
+ kind: "query",
26717
+ auth: "admin"
26337
26718
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26338
26719
  kind: "mutation",
26339
26720
  auth: "admin"
@@ -31306,6 +31687,18 @@ Object.freeze({
31306
31687
  addonId: null,
31307
31688
  access: "create"
31308
31689
  },
31690
+ "pipelineAnalytics.countRelocatableMedia": {
31691
+ capName: "pipeline-analytics",
31692
+ capScope: "device",
31693
+ addonId: null,
31694
+ access: "view"
31695
+ },
31696
+ "pipelineAnalytics.countUnstampedEventMedia": {
31697
+ capName: "pipeline-analytics",
31698
+ capScope: "device",
31699
+ addonId: null,
31700
+ access: "view"
31701
+ },
31309
31702
  "pipelineAnalytics.deleteDeviceEvents": {
31310
31703
  capName: "pipeline-analytics",
31311
31704
  capScope: "device",
@@ -32464,6 +32857,12 @@ Object.freeze({
32464
32857
  addonId: null,
32465
32858
  access: "view"
32466
32859
  },
32860
+ "recording.getRelocateResidue": {
32861
+ capName: "recording",
32862
+ capScope: "system",
32863
+ addonId: null,
32864
+ access: "view"
32865
+ },
32467
32866
  "recording.getStorageMigrationMoveStatus": {
32468
32867
  capName: "recording",
32469
32868
  capScope: "system",
@@ -33010,12 +33409,30 @@ Object.freeze({
33010
33409
  addonId: null,
33011
33410
  access: "create"
33012
33411
  },
33412
+ "storageMigration.drain": {
33413
+ capName: "storage-migration",
33414
+ capScope: "system",
33415
+ addonId: null,
33416
+ access: "create"
33417
+ },
33418
+ "storageMigration.movers": {
33419
+ capName: "storage-migration",
33420
+ capScope: "system",
33421
+ addonId: null,
33422
+ access: "view"
33423
+ },
33013
33424
  "storageMigration.plan": {
33014
33425
  capName: "storage-migration",
33015
33426
  capScope: "system",
33016
33427
  addonId: null,
33017
33428
  access: "view"
33018
33429
  },
33430
+ "storageMigration.residue": {
33431
+ capName: "storage-migration",
33432
+ capScope: "system",
33433
+ addonId: null,
33434
+ access: "view"
33435
+ },
33019
33436
  "storageMigration.start": {
33020
33437
  capName: "storage-migration",
33021
33438
  capScope: "system",
@@ -33850,6 +34267,12 @@ Object.freeze({
33850
34267
  addonId: null,
33851
34268
  access: "delete"
33852
34269
  },
34270
+ "vectorStore.fetchByIds": {
34271
+ capName: "vector-store",
34272
+ capScope: "system",
34273
+ addonId: null,
34274
+ access: "view"
34275
+ },
33853
34276
  "vectorStore.getByIds": {
33854
34277
  capName: "vector-store",
33855
34278
  capScope: "system",
@@ -33862,6 +34285,12 @@ Object.freeze({
33862
34285
  addonId: null,
33863
34286
  access: "view"
33864
34287
  },
34288
+ "vectorStore.scan": {
34289
+ capName: "vector-store",
34290
+ capScope: "system",
34291
+ addonId: null,
34292
+ access: "view"
34293
+ },
33865
34294
  "vectorStore.stats": {
33866
34295
  capName: "vector-store",
33867
34296
  capScope: "system",
@@ -8228,18 +8228,61 @@ var RelocateFootageInputSchema = object({
8228
8228
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8229
8229
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8230
8230
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8231
+ /**
8232
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8233
+ * mover (the engine already walks both collections with a timestamp cursor and
8234
+ * already has a stamp-without-copy path).
8235
+ *
8236
+ * - `move` — the default and the historical behaviour: event-media and
8237
+ * retrain blobs move to `toLocationId` and their rows are
8238
+ * stamped. The enrolled gallery is skipped (D197).
8239
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8240
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8241
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8242
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8243
+ * instant a repoint moves that pointer the row reads from the
8244
+ * new disk while its bytes are on the old one.
8245
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8246
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8247
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8248
+ * never run beside a live second location: it is stop-the-world
8249
+ * by construction, which is acceptable only because the gallery
8250
+ * is a few KB per enrolled sample.
8251
+ */
8252
+ var MediaRelocateModeSchema = _enum([
8253
+ "move",
8254
+ "seal",
8255
+ "gallery"
8256
+ ]);
8231
8257
  var RelocateMediaInputSchema = object({
8232
8258
  toLocationId: string(),
8233
- throttleMbps: number().min(1).max(1e3).optional()
8259
+ throttleMbps: number().min(1).max(1e3).optional(),
8260
+ /** Omitted = `move`, the pre-existing behaviour. */
8261
+ mode: MediaRelocateModeSchema.optional()
8262
+ });
8263
+ /** How many rows still carry NO `locationId` — the population a repoint would
8264
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8265
+ * value that permits a non-blocking `eventMedia` cutover. */
8266
+ var UnstampedEventMediaCountSchema = object({
8267
+ media: number().int().nonnegative(),
8268
+ retrainFrames: number().int().nonnegative(),
8269
+ total: number().int().nonnegative()
8234
8270
  });
8235
8271
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8236
- /** The independently selectable logical storage classes. `recordings`
8237
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8238
- * segments; `eventMedia` is post-analysis blobs. */
8272
+ /** The independently selectable logical storage classes — every class
8273
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8274
+ * Zod enum error where they should meet an explanation.
8275
+ *
8276
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8277
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8278
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8279
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8239
8280
  var StorageMigrationClassSchema = _enum([
8240
8281
  "recordings",
8241
8282
  "recordingsLow",
8242
- "eventMedia"
8283
+ "eventMedia",
8284
+ "backups",
8285
+ "galleryMedia"
8243
8286
  ]);
8244
8287
  /** A destination is always an existing, fully-qualified location id. The
8245
8288
  * migration API intentionally never changes a source location's `basePath`:
@@ -8247,20 +8290,56 @@ var StorageMigrationClassSchema = _enum([
8247
8290
  var StorageMigrationDestinationsSchema = object({
8248
8291
  recordings: string().min(1).optional(),
8249
8292
  recordingsLow: string().min(1).optional(),
8250
- eventMedia: string().min(1).optional()
8293
+ eventMedia: string().min(1).optional(),
8294
+ backups: string().min(1).optional(),
8295
+ galleryMedia: string().min(1).optional()
8251
8296
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8297
+ /**
8298
+ * How a migration sequences the cutover against the byte move.
8299
+ *
8300
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8301
+ * resume. Recording is stopped for the whole move. Right
8302
+ * for a small or a cold class, and the only legal mode for
8303
+ * a `cardinality: 'single'` class.
8304
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8305
+ * refresh, resume, then move the past with everything
8306
+ * running. The pause is three bounded instants (a detach +
8307
+ * attach round, a write-gate drain, a lease) instead of one
8308
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8309
+ * stopped recording under `blocking`; the same move is
8310
+ * seconds of stopped recording under `nonBlocking`.
8311
+ *
8312
+ * The mode is on the JOB, not only on the input, because `status` is where an
8313
+ * operator finds out which one is running.
8314
+ */
8315
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8252
8316
  /** Shared input for planning and starting an orchestrated storage migration. */
8253
8317
  var StorageMigrationInputSchema = object({
8254
8318
  destinations: StorageMigrationDestinationsSchema,
8255
- throttleMbps: number().min(1).max(1e3).optional()
8319
+ throttleMbps: number().min(1).max(1e3).optional(),
8320
+ /** Omitted = `blocking`, which stays the default. */
8321
+ mode: StorageMigrationModeSchema.optional()
8256
8322
  });
8257
- /** The durable coordinator state machine. The only phase that changes default
8258
- * locations is `repointing`, after every selected mover has completed and been
8259
- * verified. */
8323
+ /**
8324
+ * The durable coordinator state machine.
8325
+ *
8326
+ * `blocking`:
8327
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8328
+ *
8329
+ * `nonBlocking`:
8330
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8331
+ *
8332
+ * Same phases, different order plus two new ones — not a second mover.
8333
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8334
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8335
+ * `repointing` is still the only phase that changes a default location.
8336
+ */
8260
8337
  var StorageMigrationPhaseSchema = _enum([
8261
8338
  "planning",
8339
+ "sealing",
8262
8340
  "pausing",
8263
8341
  "moving",
8342
+ "draining",
8264
8343
  "verifying",
8265
8344
  "repointing",
8266
8345
  "refreshing",
@@ -8274,17 +8353,56 @@ var StorageMigrationParticipantSchema = _enum([
8274
8353
  "recorder",
8275
8354
  "analytics"
8276
8355
  ]);
8356
+ /**
8357
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8358
+ *
8359
+ * The long half of a non-blocking migration is `draining`, and it is measured
8360
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8361
+ * existed the only place those numbers appeared was a Loki line, so an operator
8362
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8363
+ * afternoon.
8364
+ *
8365
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8366
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8367
+ * mover — which is the exact failure this is meant to end. The coordinator's
8368
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8369
+ * read `state`; folding the counters costs no extra read and makes the durable
8370
+ * record say afterwards how far a move actually got.
8371
+ *
8372
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8373
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8374
+ * cannot say M, and a 0 there would render as "100 % done".
8375
+ */
8376
+ var StorageMigrationMoveProgressSchema = object({
8377
+ filesMoved: number().int().nonnegative(),
8378
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8379
+ filesTotal: number().int().nonnegative().nullable(),
8380
+ bytesMoved: number().int().nonnegative(),
8381
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8382
+ * crash gets a new mover, and a rate computed from the migration's start
8383
+ * would silently average in the time nothing was running. */
8384
+ startedAt: number(),
8385
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8386
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8387
+ * subtract its own. */
8388
+ observedAt: number()
8389
+ });
8277
8390
  var StorageMigrationMoveSchema = object({
8278
8391
  storageClass: StorageMigrationClassSchema,
8279
8392
  fromLocationId: string(),
8280
8393
  toLocationId: string(),
8281
8394
  moverJobId: string().nullable(),
8282
8395
  state: RelocateJobStateSchema.nullable(),
8283
- error: string().nullable()
8396
+ error: string().nullable(),
8397
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8398
+ progress: StorageMigrationMoveProgressSchema.nullable()
8284
8399
  });
8285
8400
  var StorageMigrationJobSchema = object({
8286
8401
  jobId: string(),
8287
8402
  phase: StorageMigrationPhaseSchema,
8403
+ /** Which order this job is running. `status` is the only place an operator
8404
+ * can tell a seconds-long cutover from a thirty-hour one. */
8405
+ mode: StorageMigrationModeSchema,
8288
8406
  destinations: StorageMigrationDestinationsSchema,
8289
8407
  throttleMbps: number(),
8290
8408
  moves: array(StorageMigrationMoveSchema),
@@ -8297,13 +8415,122 @@ var StorageMigrationJobSchema = object({
8297
8415
  finishedAt: number().nullable(),
8298
8416
  error: string().nullable()
8299
8417
  });
8418
+ var StorageMigrationFindingSchema = object({
8419
+ code: _enum([
8420
+ "sharesDeviceWithSource",
8421
+ "deviceIdentityUnknown",
8422
+ "unstampedEventMediaRows",
8423
+ "blockingOnly",
8424
+ "noMover"
8425
+ ]),
8426
+ storageClass: StorageMigrationClassSchema,
8427
+ /** Human-readable, already carrying the ids and counts. */
8428
+ message: string()
8429
+ });
8300
8430
  var StorageMigrationPlanSchema = object({
8301
8431
  destinations: StorageMigrationDestinationsSchema,
8432
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8433
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8434
+ * it. */
8435
+ mode: StorageMigrationModeSchema,
8302
8436
  moves: array(object({
8303
8437
  storageClass: StorageMigrationClassSchema,
8304
8438
  fromLocationId: string(),
8305
8439
  toLocationId: string()
8306
- }))
8440
+ })),
8441
+ findings: array(StorageMigrationFindingSchema)
8442
+ });
8443
+ /**
8444
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8445
+ *
8446
+ * The coordinator's job record is the state of record for a migration, and its
8447
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8448
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8449
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8450
+ * way because no supported UI path existed. A mover armed like that has no job
8451
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8452
+ *
8453
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8454
+ * orchestrated it.
8455
+ */
8456
+ var StorageMigrationMoverSchema = object({
8457
+ lane: _enum(["footage", "media"]),
8458
+ job: RelocateJobSchema,
8459
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8460
+ * directly against the owning addon. */
8461
+ migrationJobId: string().nullable(),
8462
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8463
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8464
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8465
+ * rate made of two different clocks. */
8466
+ observedAt: number()
8467
+ });
8468
+ /**
8469
+ * What a SOURCE still holds for one storage class — the number that makes a
8470
+ * "drain remaining" action honest rather than hopeful.
8471
+ *
8472
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8473
+ * engine's own selection count for media), never from the resident index: a
8474
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8475
+ * never been told about (D295).
8476
+ *
8477
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8478
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8479
+ * because refusing on an unanswerable read would hide exactly the case an
8480
+ * operator needs to act on.
8481
+ */
8482
+ var StorageMigrationResidueSchema = object({
8483
+ storageClass: StorageMigrationClassSchema,
8484
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8485
+ * move from wherever they are rather than from one named source. */
8486
+ fromLocationId: string(),
8487
+ /** Where a drain would move it — the class's CURRENT default. */
8488
+ toLocationId: string(),
8489
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8490
+ items: number().int().nonnegative().nullable(),
8491
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8492
+ bytes: number().int().nonnegative().nullable()
8493
+ });
8494
+ /**
8495
+ * Run the DRAIN half and nothing else.
8496
+ *
8497
+ * A migration that reached `done` has already repointed, so `start` correctly
8498
+ * refuses its destination ("already the default") — there is nothing left to
8499
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8500
+ * or finish against a work list that was a tenth of the archive (D295), and
8501
+ * before this there was no supported way to run only that half: the only way
8502
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8503
+ *
8504
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8505
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8506
+ * re-repoint a class that is already migrated.
8507
+ */
8508
+ var StorageMigrationDrainInputSchema = object({
8509
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8510
+ * a class whose source is already empty is refused rather than started. */
8511
+ classes: array(StorageMigrationClassSchema).min(1),
8512
+ throttleMbps: number().min(1).max(1e3).optional()
8513
+ });
8514
+ /** What a footage source still holds, asked of the durable hour ledger. */
8515
+ var RelocateResidueInputSchema = object({
8516
+ fromLocationId: string().min(1),
8517
+ /** Narrow to one logical class; omit for every profile on the location. */
8518
+ footageClass: RelocateFootageClassSchema.optional()
8519
+ });
8520
+ /** `null` = the archive could not answer (no ledger on this node, or the
8521
+ * aggregate failed). Never conflated with an empty source. */
8522
+ var RelocateResidueSchema = object({
8523
+ segments: number().int().nonnegative(),
8524
+ bytes: number().int().nonnegative()
8525
+ }).nullable();
8526
+ /** How many rows a media pass would still act on against a given target — the
8527
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8528
+ * never disagree. `null` = the count could not be taken. */
8529
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8530
+ var RelocatableMediaCountInputSchema = object({
8531
+ toLocationId: string().min(1),
8532
+ /** Omitted = `move`. */
8533
+ mode: MediaRelocateModeSchema.optional()
8307
8534
  });
8308
8535
  /**
8309
8536
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8409,6 +8636,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8409
8636
  * two addons declaring the same `id` must agree on `cardinality` (validated
8410
8637
  * at kernel aggregation time, not here).
8411
8638
  */
8639
+ /**
8640
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8641
+ * actually reaches the bytes. It is the constraint that decides which
8642
+ * `storage-provider`s may back a location of that kind.
8643
+ *
8644
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8645
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8646
+ * post-analysis media roots). Only a provider that serves a genuine local
8647
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8648
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8649
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8650
+ * against a same-named local directory that is something else entirely.
8651
+ *
8652
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8653
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8654
+ * service never sees a path, so any provider can back it. `backups` is the
8655
+ * one kind that qualifies today.
8656
+ *
8657
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8658
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8659
+ * refused the configuration; the first write simply went somewhere wrong, and
8660
+ * a recording write that goes wrong surfaces as a silent black window rather
8661
+ * than an error (the read path does not `stat`). This turns that accident into
8662
+ * a declared, enforced, testable refusal.
8663
+ */
8664
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8412
8665
  var StorageLocationDeclarationSchema = object({
8413
8666
  /**
8414
8667
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8428,6 +8681,19 @@ var StorageLocationDeclarationSchema = object({
8428
8681
  */
8429
8682
  cardinality: _enum(["single", "multi"]),
8430
8683
  /**
8684
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8685
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8686
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8687
+ *
8688
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8689
+ * can only over-restrict (refuse a remote provider for a kind that might
8690
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8691
+ * permissive direction and is therefore never inferred — a repo guard
8692
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8693
+ * reached by omission.
8694
+ */
8695
+ access: StorageAccessSchema.optional(),
8696
+ /**
8431
8697
  * When set, the default instance for this location inherits its resolved
8432
8698
  * root from the named location's default instance. Useful for derivative
8433
8699
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18042,8 +18308,10 @@ var TrackSchema = object({
18042
18308
  lastSeen: number(),
18043
18309
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18044
18310
  positions: array(TrackPositionSchema).readonly(),
18045
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18046
- * saveThumbnails policy). */
18311
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18312
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18313
+ * the retired `saveThumbnails` used to gate this and the rolling
18314
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18047
18315
  snapshots: array(TrackSnapshotSchema).readonly(),
18048
18316
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18049
18317
  zonesVisited: array(string()).readonly(),
@@ -18903,6 +19171,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18903
19171
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18904
19172
  kind: "mutation",
18905
19173
  auth: "admin"
19174
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19175
+ kind: "query",
19176
+ auth: "admin"
18906
19177
  }), method(object({}), array(RelocateJobSchema).readonly(), {
18907
19178
  kind: "query",
18908
19179
  auth: "admin"
@@ -20810,7 +21081,10 @@ method(object({
20810
21081
  }), StorageLocationSchema, {
20811
21082
  kind: "mutation",
20812
21083
  auth: "admin"
20813
- }), method(object({ id: string() }), _void(), {
21084
+ }), method(object({
21085
+ id: string(),
21086
+ force: boolean().optional()
21087
+ }), _void(), {
20814
21088
  kind: "mutation",
20815
21089
  auth: "admin"
20816
21090
  }), method(object({ id: string() }), object({
@@ -20859,6 +21133,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20859
21133
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20860
21134
  kind: "mutation",
20861
21135
  auth: "admin"
21136
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21137
+ kind: "mutation",
21138
+ auth: "admin"
20862
21139
  });
20863
21140
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20864
21141
  providerId: string().min(1),
@@ -21257,12 +21534,38 @@ response: record(string(), unknown()) }), object({
21257
21534
  *
21258
21535
  * ## Why this is a capability and not a helper
21259
21536
  *
21260
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21261
- * plate, vehicle, identity, and the event store's derivativesand every one of
21262
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21263
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21264
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21265
- * load 5,000 rows before ranking anything.
21537
+ * This capability was introduced with the claim that SIX stores in
21538
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21539
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21540
+ * claim was never true, and leaving it here made five stores look like pending
21541
+ * work when three of them have no vector at all. Counted column by column on
21542
+ * 2026-08-30, exactly THREE ever held one:
21543
+ *
21544
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21545
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21546
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21547
+ * face, migrated 2026-08-30 into its OWN index (see below).
21548
+ *
21549
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21550
+ * and `identities` store a name; the event store stores no derivative vector.
21551
+ * They are not migration candidates and never were.
21552
+ *
21553
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21554
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21555
+ * rows before ranking anything.
21556
+ *
21557
+ * ## One index per COMPARISON, never per encoder
21558
+ *
21559
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21560
+ * model, and they still get two indexes. An index is a set of things that are
21561
+ * ranked against each other and that live and die together, and these two are
21562
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21563
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21564
+ * forever and is the gallery every recognition ranks against. One index would
21565
+ * mean every gallery load and every reconcile carried a filter whose failure
21566
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21567
+ * person's only sample. The dimension they share is not a reason to share an
21568
+ * index; the question they answer is, and it differs.
21266
21569
  *
21267
21570
  * The fix is not a faster loop, it is a different backend — and the backend
21268
21571
  * should be replaceable without touching six callers. So: a singleton
@@ -21367,7 +21670,20 @@ var VectorQueryResultSchema = object({
21367
21670
  */
21368
21671
  scanned: number(),
21369
21672
  /** True when the backend could not consider every row that passed the filter. */
21370
- truncated: boolean()
21673
+ truncated: boolean(),
21674
+ /**
21675
+ * The `topK` the backend actually ran with.
21676
+ *
21677
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21678
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21679
+ * own log rather than in its answer. That is how an audit asking for 20,000
21680
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21681
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21682
+ * MUCH, in the return value, where the caller cannot fail to see it.
21683
+ *
21684
+ * Equals the requested `topK` whenever nothing was lowered.
21685
+ */
21686
+ effectiveTopK: number().int().positive()
21371
21687
  });
21372
21688
  var VectorDeleteInputSchema = object({
21373
21689
  index: string(),
@@ -21396,6 +21712,68 @@ var VectorGetResultSchema = object({ items: array(object({
21396
21712
  id: string(),
21397
21713
  metadata: VectorMetadataSchema
21398
21714
  })) });
21715
+ /**
21716
+ * Ids to read back WITH their vectors.
21717
+ *
21718
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21719
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21720
+ * caller depends on that promise. This one promises the opposite.
21721
+ *
21722
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21723
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21724
+ * a per-face cross-process KNN would be a network round trip inside the
21725
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21726
+ * it requires the index to hand the floats back. Without this method the only
21727
+ * way to keep a readable vector is a JSON column, which is the thing this
21728
+ * capability exists to delete.
21729
+ *
21730
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21731
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21732
+ */
21733
+ var VectorFetchInputSchema = object({
21734
+ index: string(),
21735
+ ids: array(string())
21736
+ });
21737
+ var VectorFetchResultSchema = object({ items: array(object({
21738
+ id: string(),
21739
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21740
+ vector: string(),
21741
+ metadata: VectorMetadataSchema
21742
+ })) });
21743
+ /**
21744
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21745
+ *
21746
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21747
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21748
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21749
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21750
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21751
+ * looked" for as long as anyone cared to read it.
21752
+ *
21753
+ * This is the primitive that question actually needs: a bounded page, ordered
21754
+ * by the backend's own row order, costing no distance computation at all.
21755
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21756
+ * the full-table read this capability was built to stop.
21757
+ */
21758
+ var VectorScanInputSchema = object({
21759
+ index: string(),
21760
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21761
+ cursor: number().int().nonnegative().default(0),
21762
+ limit: number().int().positive()
21763
+ });
21764
+ var VectorScanResultSchema = object({
21765
+ items: array(object({
21766
+ id: string(),
21767
+ metadata: VectorMetadataSchema
21768
+ })),
21769
+ /**
21770
+ * Where the next page starts, or `null` when the walk reached the end.
21771
+ *
21772
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21773
+ * from a short page: a backend is free to return fewer rows than asked.
21774
+ */
21775
+ nextCursor: number().int().nonnegative().nullable()
21776
+ });
21399
21777
  var VectorStatsInputSchema = object({ index: string() });
21400
21778
  var VectorStatsResultSchema = object({
21401
21779
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21414,7 +21792,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21414
21792
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21415
21793
  kind: "mutation",
21416
21794
  auth: "admin"
21417
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21795
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21418
21796
  kind: "mutation",
21419
21797
  auth: "admin"
21420
21798
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26330,6 +26708,9 @@ method(object({
26330
26708
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26331
26709
  kind: "query",
26332
26710
  auth: "admin"
26711
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26712
+ kind: "query",
26713
+ auth: "admin"
26333
26714
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26334
26715
  kind: "mutation",
26335
26716
  auth: "admin"
@@ -31302,6 +31683,18 @@ Object.freeze({
31302
31683
  addonId: null,
31303
31684
  access: "create"
31304
31685
  },
31686
+ "pipelineAnalytics.countRelocatableMedia": {
31687
+ capName: "pipeline-analytics",
31688
+ capScope: "device",
31689
+ addonId: null,
31690
+ access: "view"
31691
+ },
31692
+ "pipelineAnalytics.countUnstampedEventMedia": {
31693
+ capName: "pipeline-analytics",
31694
+ capScope: "device",
31695
+ addonId: null,
31696
+ access: "view"
31697
+ },
31305
31698
  "pipelineAnalytics.deleteDeviceEvents": {
31306
31699
  capName: "pipeline-analytics",
31307
31700
  capScope: "device",
@@ -32460,6 +32853,12 @@ Object.freeze({
32460
32853
  addonId: null,
32461
32854
  access: "view"
32462
32855
  },
32856
+ "recording.getRelocateResidue": {
32857
+ capName: "recording",
32858
+ capScope: "system",
32859
+ addonId: null,
32860
+ access: "view"
32861
+ },
32463
32862
  "recording.getStorageMigrationMoveStatus": {
32464
32863
  capName: "recording",
32465
32864
  capScope: "system",
@@ -33006,12 +33405,30 @@ Object.freeze({
33006
33405
  addonId: null,
33007
33406
  access: "create"
33008
33407
  },
33408
+ "storageMigration.drain": {
33409
+ capName: "storage-migration",
33410
+ capScope: "system",
33411
+ addonId: null,
33412
+ access: "create"
33413
+ },
33414
+ "storageMigration.movers": {
33415
+ capName: "storage-migration",
33416
+ capScope: "system",
33417
+ addonId: null,
33418
+ access: "view"
33419
+ },
33009
33420
  "storageMigration.plan": {
33010
33421
  capName: "storage-migration",
33011
33422
  capScope: "system",
33012
33423
  addonId: null,
33013
33424
  access: "view"
33014
33425
  },
33426
+ "storageMigration.residue": {
33427
+ capName: "storage-migration",
33428
+ capScope: "system",
33429
+ addonId: null,
33430
+ access: "view"
33431
+ },
33015
33432
  "storageMigration.start": {
33016
33433
  capName: "storage-migration",
33017
33434
  capScope: "system",
@@ -33846,6 +34263,12 @@ Object.freeze({
33846
34263
  addonId: null,
33847
34264
  access: "delete"
33848
34265
  },
34266
+ "vectorStore.fetchByIds": {
34267
+ capName: "vector-store",
34268
+ capScope: "system",
34269
+ addonId: null,
34270
+ access: "view"
34271
+ },
33849
34272
  "vectorStore.getByIds": {
33850
34273
  capName: "vector-store",
33851
34274
  capScope: "system",
@@ -33858,6 +34281,12 @@ Object.freeze({
33858
34281
  addonId: null,
33859
34282
  access: "view"
33860
34283
  },
34284
+ "vectorStore.scan": {
34285
+ capName: "vector-store",
34286
+ capScope: "system",
34287
+ addonId: null,
34288
+ access: "view"
34289
+ },
33861
34290
  "vectorStore.stats": {
33862
34291
  capName: "vector-store",
33863
34292
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-google",
3
- "version": "0.1.6",
3
+ "version": "0.1.9",
4
4
  "description": "Google Home export — hub-side smart-home fulfillment (SYNC / QUERY / EXECUTE / DISCONNECT) for the non-camera fleet, served over the hub's own OAuth account link. No Google credential is stored, sent or required.",
5
5
  "keywords": [
6
6
  "camstack",