@camstack/addon-import-alexa 0.2.41 → 0.2.44

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
@@ -8197,18 +8197,61 @@ var RelocateFootageInputSchema = object({
8197
8197
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8198
8198
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8199
8199
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8200
+ /**
8201
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8202
+ * mover (the engine already walks both collections with a timestamp cursor and
8203
+ * already has a stamp-without-copy path).
8204
+ *
8205
+ * - `move` — the default and the historical behaviour: event-media and
8206
+ * retrain blobs move to `toLocationId` and their rows are
8207
+ * stamped. The enrolled gallery is skipped (D197).
8208
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8209
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8210
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8211
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8212
+ * instant a repoint moves that pointer the row reads from the
8213
+ * new disk while its bytes are on the old one.
8214
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8215
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8216
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8217
+ * never run beside a live second location: it is stop-the-world
8218
+ * by construction, which is acceptable only because the gallery
8219
+ * is a few KB per enrolled sample.
8220
+ */
8221
+ var MediaRelocateModeSchema = _enum([
8222
+ "move",
8223
+ "seal",
8224
+ "gallery"
8225
+ ]);
8200
8226
  var RelocateMediaInputSchema = object({
8201
8227
  toLocationId: string(),
8202
- throttleMbps: number().min(1).max(1e3).optional()
8228
+ throttleMbps: number().min(1).max(1e3).optional(),
8229
+ /** Omitted = `move`, the pre-existing behaviour. */
8230
+ mode: MediaRelocateModeSchema.optional()
8231
+ });
8232
+ /** How many rows still carry NO `locationId` — the population a repoint would
8233
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8234
+ * value that permits a non-blocking `eventMedia` cutover. */
8235
+ var UnstampedEventMediaCountSchema = object({
8236
+ media: number().int().nonnegative(),
8237
+ retrainFrames: number().int().nonnegative(),
8238
+ total: number().int().nonnegative()
8203
8239
  });
8204
8240
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8205
- /** The independently selectable logical storage classes. `recordings`
8206
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8207
- * segments; `eventMedia` is post-analysis blobs. */
8241
+ /** The independently selectable logical storage classes — every class
8242
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8243
+ * Zod enum error where they should meet an explanation.
8244
+ *
8245
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8246
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8247
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8248
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8208
8249
  var StorageMigrationClassSchema = _enum([
8209
8250
  "recordings",
8210
8251
  "recordingsLow",
8211
- "eventMedia"
8252
+ "eventMedia",
8253
+ "backups",
8254
+ "galleryMedia"
8212
8255
  ]);
8213
8256
  /** A destination is always an existing, fully-qualified location id. The
8214
8257
  * migration API intentionally never changes a source location's `basePath`:
@@ -8216,20 +8259,56 @@ var StorageMigrationClassSchema = _enum([
8216
8259
  var StorageMigrationDestinationsSchema = object({
8217
8260
  recordings: string().min(1).optional(),
8218
8261
  recordingsLow: string().min(1).optional(),
8219
- eventMedia: string().min(1).optional()
8262
+ eventMedia: string().min(1).optional(),
8263
+ backups: string().min(1).optional(),
8264
+ galleryMedia: string().min(1).optional()
8220
8265
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8266
+ /**
8267
+ * How a migration sequences the cutover against the byte move.
8268
+ *
8269
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8270
+ * resume. Recording is stopped for the whole move. Right
8271
+ * for a small or a cold class, and the only legal mode for
8272
+ * a `cardinality: 'single'` class.
8273
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8274
+ * refresh, resume, then move the past with everything
8275
+ * running. The pause is three bounded instants (a detach +
8276
+ * attach round, a write-gate drain, a lease) instead of one
8277
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8278
+ * stopped recording under `blocking`; the same move is
8279
+ * seconds of stopped recording under `nonBlocking`.
8280
+ *
8281
+ * The mode is on the JOB, not only on the input, because `status` is where an
8282
+ * operator finds out which one is running.
8283
+ */
8284
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8221
8285
  /** Shared input for planning and starting an orchestrated storage migration. */
8222
8286
  var StorageMigrationInputSchema = object({
8223
8287
  destinations: StorageMigrationDestinationsSchema,
8224
- throttleMbps: number().min(1).max(1e3).optional()
8288
+ throttleMbps: number().min(1).max(1e3).optional(),
8289
+ /** Omitted = `blocking`, which stays the default. */
8290
+ mode: StorageMigrationModeSchema.optional()
8225
8291
  });
8226
- /** The durable coordinator state machine. The only phase that changes default
8227
- * locations is `repointing`, after every selected mover has completed and been
8228
- * verified. */
8292
+ /**
8293
+ * The durable coordinator state machine.
8294
+ *
8295
+ * `blocking`:
8296
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8297
+ *
8298
+ * `nonBlocking`:
8299
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8300
+ *
8301
+ * Same phases, different order plus two new ones — not a second mover.
8302
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8303
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8304
+ * `repointing` is still the only phase that changes a default location.
8305
+ */
8229
8306
  var StorageMigrationPhaseSchema = _enum([
8230
8307
  "planning",
8308
+ "sealing",
8231
8309
  "pausing",
8232
8310
  "moving",
8311
+ "draining",
8233
8312
  "verifying",
8234
8313
  "repointing",
8235
8314
  "refreshing",
@@ -8243,17 +8322,56 @@ var StorageMigrationParticipantSchema = _enum([
8243
8322
  "recorder",
8244
8323
  "analytics"
8245
8324
  ]);
8325
+ /**
8326
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8327
+ *
8328
+ * The long half of a non-blocking migration is `draining`, and it is measured
8329
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8330
+ * existed the only place those numbers appeared was a Loki line, so an operator
8331
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8332
+ * afternoon.
8333
+ *
8334
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8335
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8336
+ * mover — which is the exact failure this is meant to end. The coordinator's
8337
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8338
+ * read `state`; folding the counters costs no extra read and makes the durable
8339
+ * record say afterwards how far a move actually got.
8340
+ *
8341
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8342
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8343
+ * cannot say M, and a 0 there would render as "100 % done".
8344
+ */
8345
+ var StorageMigrationMoveProgressSchema = object({
8346
+ filesMoved: number().int().nonnegative(),
8347
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8348
+ filesTotal: number().int().nonnegative().nullable(),
8349
+ bytesMoved: number().int().nonnegative(),
8350
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8351
+ * crash gets a new mover, and a rate computed from the migration's start
8352
+ * would silently average in the time nothing was running. */
8353
+ startedAt: number(),
8354
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8355
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8356
+ * subtract its own. */
8357
+ observedAt: number()
8358
+ });
8246
8359
  var StorageMigrationMoveSchema = object({
8247
8360
  storageClass: StorageMigrationClassSchema,
8248
8361
  fromLocationId: string(),
8249
8362
  toLocationId: string(),
8250
8363
  moverJobId: string().nullable(),
8251
8364
  state: RelocateJobStateSchema.nullable(),
8252
- error: string().nullable()
8365
+ error: string().nullable(),
8366
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8367
+ progress: StorageMigrationMoveProgressSchema.nullable()
8253
8368
  });
8254
8369
  var StorageMigrationJobSchema = object({
8255
8370
  jobId: string(),
8256
8371
  phase: StorageMigrationPhaseSchema,
8372
+ /** Which order this job is running. `status` is the only place an operator
8373
+ * can tell a seconds-long cutover from a thirty-hour one. */
8374
+ mode: StorageMigrationModeSchema,
8257
8375
  destinations: StorageMigrationDestinationsSchema,
8258
8376
  throttleMbps: number(),
8259
8377
  moves: array(StorageMigrationMoveSchema),
@@ -8266,13 +8384,122 @@ var StorageMigrationJobSchema = object({
8266
8384
  finishedAt: number().nullable(),
8267
8385
  error: string().nullable()
8268
8386
  });
8387
+ var StorageMigrationFindingSchema = object({
8388
+ code: _enum([
8389
+ "sharesDeviceWithSource",
8390
+ "deviceIdentityUnknown",
8391
+ "unstampedEventMediaRows",
8392
+ "blockingOnly",
8393
+ "noMover"
8394
+ ]),
8395
+ storageClass: StorageMigrationClassSchema,
8396
+ /** Human-readable, already carrying the ids and counts. */
8397
+ message: string()
8398
+ });
8269
8399
  var StorageMigrationPlanSchema = object({
8270
8400
  destinations: StorageMigrationDestinationsSchema,
8401
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8402
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8403
+ * it. */
8404
+ mode: StorageMigrationModeSchema,
8271
8405
  moves: array(object({
8272
8406
  storageClass: StorageMigrationClassSchema,
8273
8407
  fromLocationId: string(),
8274
8408
  toLocationId: string()
8275
- }))
8409
+ })),
8410
+ findings: array(StorageMigrationFindingSchema)
8411
+ });
8412
+ /**
8413
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8414
+ *
8415
+ * The coordinator's job record is the state of record for a migration, and its
8416
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8417
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8418
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8419
+ * way because no supported UI path existed. A mover armed like that has no job
8420
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8421
+ *
8422
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8423
+ * orchestrated it.
8424
+ */
8425
+ var StorageMigrationMoverSchema = object({
8426
+ lane: _enum(["footage", "media"]),
8427
+ job: RelocateJobSchema,
8428
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8429
+ * directly against the owning addon. */
8430
+ migrationJobId: string().nullable(),
8431
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8432
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8433
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8434
+ * rate made of two different clocks. */
8435
+ observedAt: number()
8436
+ });
8437
+ /**
8438
+ * What a SOURCE still holds for one storage class — the number that makes a
8439
+ * "drain remaining" action honest rather than hopeful.
8440
+ *
8441
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8442
+ * engine's own selection count for media), never from the resident index: a
8443
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8444
+ * never been told about (D295).
8445
+ *
8446
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8447
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8448
+ * because refusing on an unanswerable read would hide exactly the case an
8449
+ * operator needs to act on.
8450
+ */
8451
+ var StorageMigrationResidueSchema = object({
8452
+ storageClass: StorageMigrationClassSchema,
8453
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8454
+ * move from wherever they are rather than from one named source. */
8455
+ fromLocationId: string(),
8456
+ /** Where a drain would move it — the class's CURRENT default. */
8457
+ toLocationId: string(),
8458
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8459
+ items: number().int().nonnegative().nullable(),
8460
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8461
+ bytes: number().int().nonnegative().nullable()
8462
+ });
8463
+ /**
8464
+ * Run the DRAIN half and nothing else.
8465
+ *
8466
+ * A migration that reached `done` has already repointed, so `start` correctly
8467
+ * refuses its destination ("already the default") — there is nothing left to
8468
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8469
+ * or finish against a work list that was a tenth of the archive (D295), and
8470
+ * before this there was no supported way to run only that half: the only way
8471
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8472
+ *
8473
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8474
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8475
+ * re-repoint a class that is already migrated.
8476
+ */
8477
+ var StorageMigrationDrainInputSchema = object({
8478
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8479
+ * a class whose source is already empty is refused rather than started. */
8480
+ classes: array(StorageMigrationClassSchema).min(1),
8481
+ throttleMbps: number().min(1).max(1e3).optional()
8482
+ });
8483
+ /** What a footage source still holds, asked of the durable hour ledger. */
8484
+ var RelocateResidueInputSchema = object({
8485
+ fromLocationId: string().min(1),
8486
+ /** Narrow to one logical class; omit for every profile on the location. */
8487
+ footageClass: RelocateFootageClassSchema.optional()
8488
+ });
8489
+ /** `null` = the archive could not answer (no ledger on this node, or the
8490
+ * aggregate failed). Never conflated with an empty source. */
8491
+ var RelocateResidueSchema = object({
8492
+ segments: number().int().nonnegative(),
8493
+ bytes: number().int().nonnegative()
8494
+ }).nullable();
8495
+ /** How many rows a media pass would still act on against a given target — the
8496
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8497
+ * never disagree. `null` = the count could not be taken. */
8498
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8499
+ var RelocatableMediaCountInputSchema = object({
8500
+ toLocationId: string().min(1),
8501
+ /** Omitted = `move`. */
8502
+ mode: MediaRelocateModeSchema.optional()
8276
8503
  });
8277
8504
  /**
8278
8505
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8378,6 +8605,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8378
8605
  * two addons declaring the same `id` must agree on `cardinality` (validated
8379
8606
  * at kernel aggregation time, not here).
8380
8607
  */
8608
+ /**
8609
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8610
+ * actually reaches the bytes. It is the constraint that decides which
8611
+ * `storage-provider`s may back a location of that kind.
8612
+ *
8613
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8614
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8615
+ * post-analysis media roots). Only a provider that serves a genuine local
8616
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8617
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8618
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8619
+ * against a same-named local directory that is something else entirely.
8620
+ *
8621
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8622
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8623
+ * service never sees a path, so any provider can back it. `backups` is the
8624
+ * one kind that qualifies today.
8625
+ *
8626
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8627
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8628
+ * refused the configuration; the first write simply went somewhere wrong, and
8629
+ * a recording write that goes wrong surfaces as a silent black window rather
8630
+ * than an error (the read path does not `stat`). This turns that accident into
8631
+ * a declared, enforced, testable refusal.
8632
+ */
8633
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8381
8634
  var StorageLocationDeclarationSchema = object({
8382
8635
  /**
8383
8636
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8397,6 +8650,19 @@ var StorageLocationDeclarationSchema = object({
8397
8650
  */
8398
8651
  cardinality: _enum(["single", "multi"]),
8399
8652
  /**
8653
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8654
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8655
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8656
+ *
8657
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8658
+ * can only over-restrict (refuse a remote provider for a kind that might
8659
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8660
+ * permissive direction and is therefore never inferred — a repo guard
8661
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8662
+ * reached by omission.
8663
+ */
8664
+ access: StorageAccessSchema.optional(),
8665
+ /**
8400
8666
  * When set, the default instance for this location inherits its resolved
8401
8667
  * root from the named location's default instance. Useful for derivative
8402
8668
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18349,8 +18615,10 @@ var TrackSchema = object({
18349
18615
  lastSeen: number(),
18350
18616
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18351
18617
  positions: array(TrackPositionSchema).readonly(),
18352
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18353
- * saveThumbnails policy). */
18618
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18619
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18620
+ * the retired `saveThumbnails` used to gate this and the rolling
18621
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18354
18622
  snapshots: array(TrackSnapshotSchema).readonly(),
18355
18623
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18356
18624
  zonesVisited: array(string()).readonly(),
@@ -19210,6 +19478,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19210
19478
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19211
19479
  kind: "mutation",
19212
19480
  auth: "admin"
19481
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19482
+ kind: "query",
19483
+ auth: "admin"
19213
19484
  }), method(object({}), array(RelocateJobSchema).readonly(), {
19214
19485
  kind: "query",
19215
19486
  auth: "admin"
@@ -21117,7 +21388,10 @@ method(object({
21117
21388
  }), StorageLocationSchema, {
21118
21389
  kind: "mutation",
21119
21390
  auth: "admin"
21120
- }), method(object({ id: string() }), _void(), {
21391
+ }), method(object({
21392
+ id: string(),
21393
+ force: boolean().optional()
21394
+ }), _void(), {
21121
21395
  kind: "mutation",
21122
21396
  auth: "admin"
21123
21397
  }), method(object({ id: string() }), object({
@@ -21166,6 +21440,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21166
21440
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21167
21441
  kind: "mutation",
21168
21442
  auth: "admin"
21443
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21444
+ kind: "mutation",
21445
+ auth: "admin"
21169
21446
  });
21170
21447
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21171
21448
  providerId: string().min(1),
@@ -21564,12 +21841,38 @@ response: record(string(), unknown()) }), object({
21564
21841
  *
21565
21842
  * ## Why this is a capability and not a helper
21566
21843
  *
21567
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21568
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21569
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21570
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21571
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21572
- * load 5,000 rows before ranking anything.
21844
+ * This capability was introduced with the claim that SIX stores in
21845
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21846
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21847
+ * claim was never true, and leaving it here made five stores look like pending
21848
+ * work when three of them have no vector at all. Counted column by column on
21849
+ * 2026-08-30, exactly THREE ever held one:
21850
+ *
21851
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21852
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21853
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21854
+ * face, migrated 2026-08-30 into its OWN index (see below).
21855
+ *
21856
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21857
+ * and `identities` store a name; the event store stores no derivative vector.
21858
+ * They are not migration candidates and never were.
21859
+ *
21860
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21861
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21862
+ * rows before ranking anything.
21863
+ *
21864
+ * ## One index per COMPARISON, never per encoder
21865
+ *
21866
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21867
+ * model, and they still get two indexes. An index is a set of things that are
21868
+ * ranked against each other and that live and die together, and these two are
21869
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21870
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21871
+ * forever and is the gallery every recognition ranks against. One index would
21872
+ * mean every gallery load and every reconcile carried a filter whose failure
21873
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21874
+ * person's only sample. The dimension they share is not a reason to share an
21875
+ * index; the question they answer is, and it differs.
21573
21876
  *
21574
21877
  * The fix is not a faster loop, it is a different backend — and the backend
21575
21878
  * should be replaceable without touching six callers. So: a singleton
@@ -21674,7 +21977,20 @@ var VectorQueryResultSchema = object({
21674
21977
  */
21675
21978
  scanned: number(),
21676
21979
  /** True when the backend could not consider every row that passed the filter. */
21677
- truncated: boolean()
21980
+ truncated: boolean(),
21981
+ /**
21982
+ * The `topK` the backend actually ran with.
21983
+ *
21984
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21985
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21986
+ * own log rather than in its answer. That is how an audit asking for 20,000
21987
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21988
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21989
+ * MUCH, in the return value, where the caller cannot fail to see it.
21990
+ *
21991
+ * Equals the requested `topK` whenever nothing was lowered.
21992
+ */
21993
+ effectiveTopK: number().int().positive()
21678
21994
  });
21679
21995
  var VectorDeleteInputSchema = object({
21680
21996
  index: string(),
@@ -21703,6 +22019,68 @@ var VectorGetResultSchema = object({ items: array(object({
21703
22019
  id: string(),
21704
22020
  metadata: VectorMetadataSchema
21705
22021
  })) });
22022
+ /**
22023
+ * Ids to read back WITH their vectors.
22024
+ *
22025
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22026
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22027
+ * caller depends on that promise. This one promises the opposite.
22028
+ *
22029
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22030
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22031
+ * a per-face cross-process KNN would be a network round trip inside the
22032
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22033
+ * it requires the index to hand the floats back. Without this method the only
22034
+ * way to keep a readable vector is a JSON column, which is the thing this
22035
+ * capability exists to delete.
22036
+ *
22037
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22038
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22039
+ */
22040
+ var VectorFetchInputSchema = object({
22041
+ index: string(),
22042
+ ids: array(string())
22043
+ });
22044
+ var VectorFetchResultSchema = object({ items: array(object({
22045
+ id: string(),
22046
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22047
+ vector: string(),
22048
+ metadata: VectorMetadataSchema
22049
+ })) });
22050
+ /**
22051
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22052
+ *
22053
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22054
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22055
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22056
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22057
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22058
+ * looked" for as long as anyone cared to read it.
22059
+ *
22060
+ * This is the primitive that question actually needs: a bounded page, ordered
22061
+ * by the backend's own row order, costing no distance computation at all.
22062
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22063
+ * the full-table read this capability was built to stop.
22064
+ */
22065
+ var VectorScanInputSchema = object({
22066
+ index: string(),
22067
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22068
+ cursor: number().int().nonnegative().default(0),
22069
+ limit: number().int().positive()
22070
+ });
22071
+ var VectorScanResultSchema = object({
22072
+ items: array(object({
22073
+ id: string(),
22074
+ metadata: VectorMetadataSchema
22075
+ })),
22076
+ /**
22077
+ * Where the next page starts, or `null` when the walk reached the end.
22078
+ *
22079
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22080
+ * from a short page: a backend is free to return fewer rows than asked.
22081
+ */
22082
+ nextCursor: number().int().nonnegative().nullable()
22083
+ });
21706
22084
  var VectorStatsInputSchema = object({ index: string() });
21707
22085
  var VectorStatsResultSchema = object({
21708
22086
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21721,7 +22099,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21721
22099
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21722
22100
  kind: "mutation",
21723
22101
  auth: "admin"
21724
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22102
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21725
22103
  kind: "mutation",
21726
22104
  auth: "admin"
21727
22105
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28357,6 +28735,9 @@ method(object({
28357
28735
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28358
28736
  kind: "query",
28359
28737
  auth: "admin"
28738
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28739
+ kind: "query",
28740
+ auth: "admin"
28360
28741
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28361
28742
  kind: "mutation",
28362
28743
  auth: "admin"
@@ -34991,6 +35372,18 @@ Object.freeze({
34991
35372
  addonId: null,
34992
35373
  access: "create"
34993
35374
  },
35375
+ "pipelineAnalytics.countRelocatableMedia": {
35376
+ capName: "pipeline-analytics",
35377
+ capScope: "device",
35378
+ addonId: null,
35379
+ access: "view"
35380
+ },
35381
+ "pipelineAnalytics.countUnstampedEventMedia": {
35382
+ capName: "pipeline-analytics",
35383
+ capScope: "device",
35384
+ addonId: null,
35385
+ access: "view"
35386
+ },
34994
35387
  "pipelineAnalytics.deleteDeviceEvents": {
34995
35388
  capName: "pipeline-analytics",
34996
35389
  capScope: "device",
@@ -36149,6 +36542,12 @@ Object.freeze({
36149
36542
  addonId: null,
36150
36543
  access: "view"
36151
36544
  },
36545
+ "recording.getRelocateResidue": {
36546
+ capName: "recording",
36547
+ capScope: "system",
36548
+ addonId: null,
36549
+ access: "view"
36550
+ },
36152
36551
  "recording.getStorageMigrationMoveStatus": {
36153
36552
  capName: "recording",
36154
36553
  capScope: "system",
@@ -36695,12 +37094,30 @@ Object.freeze({
36695
37094
  addonId: null,
36696
37095
  access: "create"
36697
37096
  },
37097
+ "storageMigration.drain": {
37098
+ capName: "storage-migration",
37099
+ capScope: "system",
37100
+ addonId: null,
37101
+ access: "create"
37102
+ },
37103
+ "storageMigration.movers": {
37104
+ capName: "storage-migration",
37105
+ capScope: "system",
37106
+ addonId: null,
37107
+ access: "view"
37108
+ },
36698
37109
  "storageMigration.plan": {
36699
37110
  capName: "storage-migration",
36700
37111
  capScope: "system",
36701
37112
  addonId: null,
36702
37113
  access: "view"
36703
37114
  },
37115
+ "storageMigration.residue": {
37116
+ capName: "storage-migration",
37117
+ capScope: "system",
37118
+ addonId: null,
37119
+ access: "view"
37120
+ },
36704
37121
  "storageMigration.start": {
36705
37122
  capName: "storage-migration",
36706
37123
  capScope: "system",
@@ -37535,6 +37952,12 @@ Object.freeze({
37535
37952
  addonId: null,
37536
37953
  access: "delete"
37537
37954
  },
37955
+ "vectorStore.fetchByIds": {
37956
+ capName: "vector-store",
37957
+ capScope: "system",
37958
+ addonId: null,
37959
+ access: "view"
37960
+ },
37538
37961
  "vectorStore.getByIds": {
37539
37962
  capName: "vector-store",
37540
37963
  capScope: "system",
@@ -37547,6 +37970,12 @@ Object.freeze({
37547
37970
  addonId: null,
37548
37971
  access: "view"
37549
37972
  },
37973
+ "vectorStore.scan": {
37974
+ capName: "vector-store",
37975
+ capScope: "system",
37976
+ addonId: null,
37977
+ access: "view"
37978
+ },
37550
37979
  "vectorStore.stats": {
37551
37980
  capName: "vector-store",
37552
37981
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8197,18 +8197,61 @@ var RelocateFootageInputSchema = object({
8197
8197
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8198
8198
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8199
8199
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8200
+ /**
8201
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8202
+ * mover (the engine already walks both collections with a timestamp cursor and
8203
+ * already has a stamp-without-copy path).
8204
+ *
8205
+ * - `move` — the default and the historical behaviour: event-media and
8206
+ * retrain blobs move to `toLocationId` and their rows are
8207
+ * stamped. The enrolled gallery is skipped (D197).
8208
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8209
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8210
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8211
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8212
+ * instant a repoint moves that pointer the row reads from the
8213
+ * new disk while its bytes are on the old one.
8214
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8215
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8216
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8217
+ * never run beside a live second location: it is stop-the-world
8218
+ * by construction, which is acceptable only because the gallery
8219
+ * is a few KB per enrolled sample.
8220
+ */
8221
+ var MediaRelocateModeSchema = _enum([
8222
+ "move",
8223
+ "seal",
8224
+ "gallery"
8225
+ ]);
8200
8226
  var RelocateMediaInputSchema = object({
8201
8227
  toLocationId: string(),
8202
- throttleMbps: number().min(1).max(1e3).optional()
8228
+ throttleMbps: number().min(1).max(1e3).optional(),
8229
+ /** Omitted = `move`, the pre-existing behaviour. */
8230
+ mode: MediaRelocateModeSchema.optional()
8231
+ });
8232
+ /** How many rows still carry NO `locationId` — the population a repoint would
8233
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8234
+ * value that permits a non-blocking `eventMedia` cutover. */
8235
+ var UnstampedEventMediaCountSchema = object({
8236
+ media: number().int().nonnegative(),
8237
+ retrainFrames: number().int().nonnegative(),
8238
+ total: number().int().nonnegative()
8203
8239
  });
8204
8240
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8205
- /** The independently selectable logical storage classes. `recordings`
8206
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8207
- * segments; `eventMedia` is post-analysis blobs. */
8241
+ /** The independently selectable logical storage classes — every class
8242
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8243
+ * Zod enum error where they should meet an explanation.
8244
+ *
8245
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8246
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8247
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8248
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8208
8249
  var StorageMigrationClassSchema = _enum([
8209
8250
  "recordings",
8210
8251
  "recordingsLow",
8211
- "eventMedia"
8252
+ "eventMedia",
8253
+ "backups",
8254
+ "galleryMedia"
8212
8255
  ]);
8213
8256
  /** A destination is always an existing, fully-qualified location id. The
8214
8257
  * migration API intentionally never changes a source location's `basePath`:
@@ -8216,20 +8259,56 @@ var StorageMigrationClassSchema = _enum([
8216
8259
  var StorageMigrationDestinationsSchema = object({
8217
8260
  recordings: string().min(1).optional(),
8218
8261
  recordingsLow: string().min(1).optional(),
8219
- eventMedia: string().min(1).optional()
8262
+ eventMedia: string().min(1).optional(),
8263
+ backups: string().min(1).optional(),
8264
+ galleryMedia: string().min(1).optional()
8220
8265
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8266
+ /**
8267
+ * How a migration sequences the cutover against the byte move.
8268
+ *
8269
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8270
+ * resume. Recording is stopped for the whole move. Right
8271
+ * for a small or a cold class, and the only legal mode for
8272
+ * a `cardinality: 'single'` class.
8273
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8274
+ * refresh, resume, then move the past with everything
8275
+ * running. The pause is three bounded instants (a detach +
8276
+ * attach round, a write-gate drain, a lease) instead of one
8277
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8278
+ * stopped recording under `blocking`; the same move is
8279
+ * seconds of stopped recording under `nonBlocking`.
8280
+ *
8281
+ * The mode is on the JOB, not only on the input, because `status` is where an
8282
+ * operator finds out which one is running.
8283
+ */
8284
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8221
8285
  /** Shared input for planning and starting an orchestrated storage migration. */
8222
8286
  var StorageMigrationInputSchema = object({
8223
8287
  destinations: StorageMigrationDestinationsSchema,
8224
- throttleMbps: number().min(1).max(1e3).optional()
8288
+ throttleMbps: number().min(1).max(1e3).optional(),
8289
+ /** Omitted = `blocking`, which stays the default. */
8290
+ mode: StorageMigrationModeSchema.optional()
8225
8291
  });
8226
- /** The durable coordinator state machine. The only phase that changes default
8227
- * locations is `repointing`, after every selected mover has completed and been
8228
- * verified. */
8292
+ /**
8293
+ * The durable coordinator state machine.
8294
+ *
8295
+ * `blocking`:
8296
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8297
+ *
8298
+ * `nonBlocking`:
8299
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8300
+ *
8301
+ * Same phases, different order plus two new ones — not a second mover.
8302
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8303
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8304
+ * `repointing` is still the only phase that changes a default location.
8305
+ */
8229
8306
  var StorageMigrationPhaseSchema = _enum([
8230
8307
  "planning",
8308
+ "sealing",
8231
8309
  "pausing",
8232
8310
  "moving",
8311
+ "draining",
8233
8312
  "verifying",
8234
8313
  "repointing",
8235
8314
  "refreshing",
@@ -8243,17 +8322,56 @@ var StorageMigrationParticipantSchema = _enum([
8243
8322
  "recorder",
8244
8323
  "analytics"
8245
8324
  ]);
8325
+ /**
8326
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8327
+ *
8328
+ * The long half of a non-blocking migration is `draining`, and it is measured
8329
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8330
+ * existed the only place those numbers appeared was a Loki line, so an operator
8331
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8332
+ * afternoon.
8333
+ *
8334
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8335
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8336
+ * mover — which is the exact failure this is meant to end. The coordinator's
8337
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8338
+ * read `state`; folding the counters costs no extra read and makes the durable
8339
+ * record say afterwards how far a move actually got.
8340
+ *
8341
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8342
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8343
+ * cannot say M, and a 0 there would render as "100 % done".
8344
+ */
8345
+ var StorageMigrationMoveProgressSchema = object({
8346
+ filesMoved: number().int().nonnegative(),
8347
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8348
+ filesTotal: number().int().nonnegative().nullable(),
8349
+ bytesMoved: number().int().nonnegative(),
8350
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8351
+ * crash gets a new mover, and a rate computed from the migration's start
8352
+ * would silently average in the time nothing was running. */
8353
+ startedAt: number(),
8354
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8355
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8356
+ * subtract its own. */
8357
+ observedAt: number()
8358
+ });
8246
8359
  var StorageMigrationMoveSchema = object({
8247
8360
  storageClass: StorageMigrationClassSchema,
8248
8361
  fromLocationId: string(),
8249
8362
  toLocationId: string(),
8250
8363
  moverJobId: string().nullable(),
8251
8364
  state: RelocateJobStateSchema.nullable(),
8252
- error: string().nullable()
8365
+ error: string().nullable(),
8366
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8367
+ progress: StorageMigrationMoveProgressSchema.nullable()
8253
8368
  });
8254
8369
  var StorageMigrationJobSchema = object({
8255
8370
  jobId: string(),
8256
8371
  phase: StorageMigrationPhaseSchema,
8372
+ /** Which order this job is running. `status` is the only place an operator
8373
+ * can tell a seconds-long cutover from a thirty-hour one. */
8374
+ mode: StorageMigrationModeSchema,
8257
8375
  destinations: StorageMigrationDestinationsSchema,
8258
8376
  throttleMbps: number(),
8259
8377
  moves: array(StorageMigrationMoveSchema),
@@ -8266,13 +8384,122 @@ var StorageMigrationJobSchema = object({
8266
8384
  finishedAt: number().nullable(),
8267
8385
  error: string().nullable()
8268
8386
  });
8387
+ var StorageMigrationFindingSchema = object({
8388
+ code: _enum([
8389
+ "sharesDeviceWithSource",
8390
+ "deviceIdentityUnknown",
8391
+ "unstampedEventMediaRows",
8392
+ "blockingOnly",
8393
+ "noMover"
8394
+ ]),
8395
+ storageClass: StorageMigrationClassSchema,
8396
+ /** Human-readable, already carrying the ids and counts. */
8397
+ message: string()
8398
+ });
8269
8399
  var StorageMigrationPlanSchema = object({
8270
8400
  destinations: StorageMigrationDestinationsSchema,
8401
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8402
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8403
+ * it. */
8404
+ mode: StorageMigrationModeSchema,
8271
8405
  moves: array(object({
8272
8406
  storageClass: StorageMigrationClassSchema,
8273
8407
  fromLocationId: string(),
8274
8408
  toLocationId: string()
8275
- }))
8409
+ })),
8410
+ findings: array(StorageMigrationFindingSchema)
8411
+ });
8412
+ /**
8413
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8414
+ *
8415
+ * The coordinator's job record is the state of record for a migration, and its
8416
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8417
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8418
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8419
+ * way because no supported UI path existed. A mover armed like that has no job
8420
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8421
+ *
8422
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8423
+ * orchestrated it.
8424
+ */
8425
+ var StorageMigrationMoverSchema = object({
8426
+ lane: _enum(["footage", "media"]),
8427
+ job: RelocateJobSchema,
8428
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8429
+ * directly against the owning addon. */
8430
+ migrationJobId: string().nullable(),
8431
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8432
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8433
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8434
+ * rate made of two different clocks. */
8435
+ observedAt: number()
8436
+ });
8437
+ /**
8438
+ * What a SOURCE still holds for one storage class — the number that makes a
8439
+ * "drain remaining" action honest rather than hopeful.
8440
+ *
8441
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8442
+ * engine's own selection count for media), never from the resident index: a
8443
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8444
+ * never been told about (D295).
8445
+ *
8446
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8447
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8448
+ * because refusing on an unanswerable read would hide exactly the case an
8449
+ * operator needs to act on.
8450
+ */
8451
+ var StorageMigrationResidueSchema = object({
8452
+ storageClass: StorageMigrationClassSchema,
8453
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8454
+ * move from wherever they are rather than from one named source. */
8455
+ fromLocationId: string(),
8456
+ /** Where a drain would move it — the class's CURRENT default. */
8457
+ toLocationId: string(),
8458
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8459
+ items: number().int().nonnegative().nullable(),
8460
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8461
+ bytes: number().int().nonnegative().nullable()
8462
+ });
8463
+ /**
8464
+ * Run the DRAIN half and nothing else.
8465
+ *
8466
+ * A migration that reached `done` has already repointed, so `start` correctly
8467
+ * refuses its destination ("already the default") — there is nothing left to
8468
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8469
+ * or finish against a work list that was a tenth of the archive (D295), and
8470
+ * before this there was no supported way to run only that half: the only way
8471
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8472
+ *
8473
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8474
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8475
+ * re-repoint a class that is already migrated.
8476
+ */
8477
+ var StorageMigrationDrainInputSchema = object({
8478
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8479
+ * a class whose source is already empty is refused rather than started. */
8480
+ classes: array(StorageMigrationClassSchema).min(1),
8481
+ throttleMbps: number().min(1).max(1e3).optional()
8482
+ });
8483
+ /** What a footage source still holds, asked of the durable hour ledger. */
8484
+ var RelocateResidueInputSchema = object({
8485
+ fromLocationId: string().min(1),
8486
+ /** Narrow to one logical class; omit for every profile on the location. */
8487
+ footageClass: RelocateFootageClassSchema.optional()
8488
+ });
8489
+ /** `null` = the archive could not answer (no ledger on this node, or the
8490
+ * aggregate failed). Never conflated with an empty source. */
8491
+ var RelocateResidueSchema = object({
8492
+ segments: number().int().nonnegative(),
8493
+ bytes: number().int().nonnegative()
8494
+ }).nullable();
8495
+ /** How many rows a media pass would still act on against a given target — the
8496
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8497
+ * never disagree. `null` = the count could not be taken. */
8498
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8499
+ var RelocatableMediaCountInputSchema = object({
8500
+ toLocationId: string().min(1),
8501
+ /** Omitted = `move`. */
8502
+ mode: MediaRelocateModeSchema.optional()
8276
8503
  });
8277
8504
  /**
8278
8505
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8378,6 +8605,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8378
8605
  * two addons declaring the same `id` must agree on `cardinality` (validated
8379
8606
  * at kernel aggregation time, not here).
8380
8607
  */
8608
+ /**
8609
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8610
+ * actually reaches the bytes. It is the constraint that decides which
8611
+ * `storage-provider`s may back a location of that kind.
8612
+ *
8613
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8614
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8615
+ * post-analysis media roots). Only a provider that serves a genuine local
8616
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8617
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8618
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8619
+ * against a same-named local directory that is something else entirely.
8620
+ *
8621
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8622
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8623
+ * service never sees a path, so any provider can back it. `backups` is the
8624
+ * one kind that qualifies today.
8625
+ *
8626
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8627
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8628
+ * refused the configuration; the first write simply went somewhere wrong, and
8629
+ * a recording write that goes wrong surfaces as a silent black window rather
8630
+ * than an error (the read path does not `stat`). This turns that accident into
8631
+ * a declared, enforced, testable refusal.
8632
+ */
8633
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8381
8634
  var StorageLocationDeclarationSchema = object({
8382
8635
  /**
8383
8636
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8397,6 +8650,19 @@ var StorageLocationDeclarationSchema = object({
8397
8650
  */
8398
8651
  cardinality: _enum(["single", "multi"]),
8399
8652
  /**
8653
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8654
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8655
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8656
+ *
8657
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8658
+ * can only over-restrict (refuse a remote provider for a kind that might
8659
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8660
+ * permissive direction and is therefore never inferred — a repo guard
8661
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8662
+ * reached by omission.
8663
+ */
8664
+ access: StorageAccessSchema.optional(),
8665
+ /**
8400
8666
  * When set, the default instance for this location inherits its resolved
8401
8667
  * root from the named location's default instance. Useful for derivative
8402
8668
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18349,8 +18615,10 @@ var TrackSchema = object({
18349
18615
  lastSeen: number(),
18350
18616
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18351
18617
  positions: array(TrackPositionSchema).readonly(),
18352
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18353
- * saveThumbnails policy). */
18618
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18619
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18620
+ * the retired `saveThumbnails` used to gate this and the rolling
18621
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18354
18622
  snapshots: array(TrackSnapshotSchema).readonly(),
18355
18623
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18356
18624
  zonesVisited: array(string()).readonly(),
@@ -19210,6 +19478,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19210
19478
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19211
19479
  kind: "mutation",
19212
19480
  auth: "admin"
19481
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19482
+ kind: "query",
19483
+ auth: "admin"
19213
19484
  }), method(object({}), array(RelocateJobSchema).readonly(), {
19214
19485
  kind: "query",
19215
19486
  auth: "admin"
@@ -21117,7 +21388,10 @@ method(object({
21117
21388
  }), StorageLocationSchema, {
21118
21389
  kind: "mutation",
21119
21390
  auth: "admin"
21120
- }), method(object({ id: string() }), _void(), {
21391
+ }), method(object({
21392
+ id: string(),
21393
+ force: boolean().optional()
21394
+ }), _void(), {
21121
21395
  kind: "mutation",
21122
21396
  auth: "admin"
21123
21397
  }), method(object({ id: string() }), object({
@@ -21166,6 +21440,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21166
21440
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21167
21441
  kind: "mutation",
21168
21442
  auth: "admin"
21443
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21444
+ kind: "mutation",
21445
+ auth: "admin"
21169
21446
  });
21170
21447
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21171
21448
  providerId: string().min(1),
@@ -21564,12 +21841,38 @@ response: record(string(), unknown()) }), object({
21564
21841
  *
21565
21842
  * ## Why this is a capability and not a helper
21566
21843
  *
21567
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21568
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21569
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21570
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21571
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21572
- * load 5,000 rows before ranking anything.
21844
+ * This capability was introduced with the claim that SIX stores in
21845
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21846
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21847
+ * claim was never true, and leaving it here made five stores look like pending
21848
+ * work when three of them have no vector at all. Counted column by column on
21849
+ * 2026-08-30, exactly THREE ever held one:
21850
+ *
21851
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21852
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21853
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21854
+ * face, migrated 2026-08-30 into its OWN index (see below).
21855
+ *
21856
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21857
+ * and `identities` store a name; the event store stores no derivative vector.
21858
+ * They are not migration candidates and never were.
21859
+ *
21860
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21861
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21862
+ * rows before ranking anything.
21863
+ *
21864
+ * ## One index per COMPARISON, never per encoder
21865
+ *
21866
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21867
+ * model, and they still get two indexes. An index is a set of things that are
21868
+ * ranked against each other and that live and die together, and these two are
21869
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21870
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21871
+ * forever and is the gallery every recognition ranks against. One index would
21872
+ * mean every gallery load and every reconcile carried a filter whose failure
21873
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21874
+ * person's only sample. The dimension they share is not a reason to share an
21875
+ * index; the question they answer is, and it differs.
21573
21876
  *
21574
21877
  * The fix is not a faster loop, it is a different backend — and the backend
21575
21878
  * should be replaceable without touching six callers. So: a singleton
@@ -21674,7 +21977,20 @@ var VectorQueryResultSchema = object({
21674
21977
  */
21675
21978
  scanned: number(),
21676
21979
  /** True when the backend could not consider every row that passed the filter. */
21677
- truncated: boolean()
21980
+ truncated: boolean(),
21981
+ /**
21982
+ * The `topK` the backend actually ran with.
21983
+ *
21984
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21985
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21986
+ * own log rather than in its answer. That is how an audit asking for 20,000
21987
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21988
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21989
+ * MUCH, in the return value, where the caller cannot fail to see it.
21990
+ *
21991
+ * Equals the requested `topK` whenever nothing was lowered.
21992
+ */
21993
+ effectiveTopK: number().int().positive()
21678
21994
  });
21679
21995
  var VectorDeleteInputSchema = object({
21680
21996
  index: string(),
@@ -21703,6 +22019,68 @@ var VectorGetResultSchema = object({ items: array(object({
21703
22019
  id: string(),
21704
22020
  metadata: VectorMetadataSchema
21705
22021
  })) });
22022
+ /**
22023
+ * Ids to read back WITH their vectors.
22024
+ *
22025
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22026
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22027
+ * caller depends on that promise. This one promises the opposite.
22028
+ *
22029
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22030
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22031
+ * a per-face cross-process KNN would be a network round trip inside the
22032
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22033
+ * it requires the index to hand the floats back. Without this method the only
22034
+ * way to keep a readable vector is a JSON column, which is the thing this
22035
+ * capability exists to delete.
22036
+ *
22037
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22038
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22039
+ */
22040
+ var VectorFetchInputSchema = object({
22041
+ index: string(),
22042
+ ids: array(string())
22043
+ });
22044
+ var VectorFetchResultSchema = object({ items: array(object({
22045
+ id: string(),
22046
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22047
+ vector: string(),
22048
+ metadata: VectorMetadataSchema
22049
+ })) });
22050
+ /**
22051
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22052
+ *
22053
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22054
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22055
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22056
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22057
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22058
+ * looked" for as long as anyone cared to read it.
22059
+ *
22060
+ * This is the primitive that question actually needs: a bounded page, ordered
22061
+ * by the backend's own row order, costing no distance computation at all.
22062
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22063
+ * the full-table read this capability was built to stop.
22064
+ */
22065
+ var VectorScanInputSchema = object({
22066
+ index: string(),
22067
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22068
+ cursor: number().int().nonnegative().default(0),
22069
+ limit: number().int().positive()
22070
+ });
22071
+ var VectorScanResultSchema = object({
22072
+ items: array(object({
22073
+ id: string(),
22074
+ metadata: VectorMetadataSchema
22075
+ })),
22076
+ /**
22077
+ * Where the next page starts, or `null` when the walk reached the end.
22078
+ *
22079
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22080
+ * from a short page: a backend is free to return fewer rows than asked.
22081
+ */
22082
+ nextCursor: number().int().nonnegative().nullable()
22083
+ });
21706
22084
  var VectorStatsInputSchema = object({ index: string() });
21707
22085
  var VectorStatsResultSchema = object({
21708
22086
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21721,7 +22099,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21721
22099
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21722
22100
  kind: "mutation",
21723
22101
  auth: "admin"
21724
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22102
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21725
22103
  kind: "mutation",
21726
22104
  auth: "admin"
21727
22105
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28357,6 +28735,9 @@ method(object({
28357
28735
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28358
28736
  kind: "query",
28359
28737
  auth: "admin"
28738
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28739
+ kind: "query",
28740
+ auth: "admin"
28360
28741
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28361
28742
  kind: "mutation",
28362
28743
  auth: "admin"
@@ -34991,6 +35372,18 @@ Object.freeze({
34991
35372
  addonId: null,
34992
35373
  access: "create"
34993
35374
  },
35375
+ "pipelineAnalytics.countRelocatableMedia": {
35376
+ capName: "pipeline-analytics",
35377
+ capScope: "device",
35378
+ addonId: null,
35379
+ access: "view"
35380
+ },
35381
+ "pipelineAnalytics.countUnstampedEventMedia": {
35382
+ capName: "pipeline-analytics",
35383
+ capScope: "device",
35384
+ addonId: null,
35385
+ access: "view"
35386
+ },
34994
35387
  "pipelineAnalytics.deleteDeviceEvents": {
34995
35388
  capName: "pipeline-analytics",
34996
35389
  capScope: "device",
@@ -36149,6 +36542,12 @@ Object.freeze({
36149
36542
  addonId: null,
36150
36543
  access: "view"
36151
36544
  },
36545
+ "recording.getRelocateResidue": {
36546
+ capName: "recording",
36547
+ capScope: "system",
36548
+ addonId: null,
36549
+ access: "view"
36550
+ },
36152
36551
  "recording.getStorageMigrationMoveStatus": {
36153
36552
  capName: "recording",
36154
36553
  capScope: "system",
@@ -36695,12 +37094,30 @@ Object.freeze({
36695
37094
  addonId: null,
36696
37095
  access: "create"
36697
37096
  },
37097
+ "storageMigration.drain": {
37098
+ capName: "storage-migration",
37099
+ capScope: "system",
37100
+ addonId: null,
37101
+ access: "create"
37102
+ },
37103
+ "storageMigration.movers": {
37104
+ capName: "storage-migration",
37105
+ capScope: "system",
37106
+ addonId: null,
37107
+ access: "view"
37108
+ },
36698
37109
  "storageMigration.plan": {
36699
37110
  capName: "storage-migration",
36700
37111
  capScope: "system",
36701
37112
  addonId: null,
36702
37113
  access: "view"
36703
37114
  },
37115
+ "storageMigration.residue": {
37116
+ capName: "storage-migration",
37117
+ capScope: "system",
37118
+ addonId: null,
37119
+ access: "view"
37120
+ },
36704
37121
  "storageMigration.start": {
36705
37122
  capName: "storage-migration",
36706
37123
  capScope: "system",
@@ -37535,6 +37952,12 @@ Object.freeze({
37535
37952
  addonId: null,
37536
37953
  access: "delete"
37537
37954
  },
37955
+ "vectorStore.fetchByIds": {
37956
+ capName: "vector-store",
37957
+ capScope: "system",
37958
+ addonId: null,
37959
+ access: "view"
37960
+ },
37538
37961
  "vectorStore.getByIds": {
37539
37962
  capName: "vector-store",
37540
37963
  capScope: "system",
@@ -37547,6 +37970,12 @@ Object.freeze({
37547
37970
  addonId: null,
37548
37971
  access: "view"
37549
37972
  },
37973
+ "vectorStore.scan": {
37974
+ capName: "vector-store",
37975
+ capScope: "system",
37976
+ addonId: null,
37977
+ access: "view"
37978
+ },
37550
37979
  "vectorStore.stats": {
37551
37980
  capName: "vector-store",
37552
37981
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-import-alexa",
3
- "version": "0.2.41",
3
+ "version": "0.2.44",
4
4
  "description": "Alexa device-import provider for CamStack — imports the smart-home devices in a user's Alexa account via the unofficial alexa-remote2 cookie/token client (the inverse of the Alexa exporter)",
5
5
  "keywords": [
6
6
  "camstack",