@camstack/addon-notifiers 1.2.46 → 1.2.49

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
@@ -8172,18 +8172,61 @@ var RelocateFootageInputSchema = object({
8172
8172
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8173
8173
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8174
8174
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8175
+ /**
8176
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8177
+ * mover (the engine already walks both collections with a timestamp cursor and
8178
+ * already has a stamp-without-copy path).
8179
+ *
8180
+ * - `move` — the default and the historical behaviour: event-media and
8181
+ * retrain blobs move to `toLocationId` and their rows are
8182
+ * stamped. The enrolled gallery is skipped (D197).
8183
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8184
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8185
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8186
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8187
+ * instant a repoint moves that pointer the row reads from the
8188
+ * new disk while its bytes are on the old one.
8189
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8190
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8191
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8192
+ * never run beside a live second location: it is stop-the-world
8193
+ * by construction, which is acceptable only because the gallery
8194
+ * is a few KB per enrolled sample.
8195
+ */
8196
+ var MediaRelocateModeSchema = _enum([
8197
+ "move",
8198
+ "seal",
8199
+ "gallery"
8200
+ ]);
8175
8201
  var RelocateMediaInputSchema = object({
8176
8202
  toLocationId: string(),
8177
- throttleMbps: number().min(1).max(1e3).optional()
8203
+ throttleMbps: number().min(1).max(1e3).optional(),
8204
+ /** Omitted = `move`, the pre-existing behaviour. */
8205
+ mode: MediaRelocateModeSchema.optional()
8206
+ });
8207
+ /** How many rows still carry NO `locationId` — the population a repoint would
8208
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8209
+ * value that permits a non-blocking `eventMedia` cutover. */
8210
+ var UnstampedEventMediaCountSchema = object({
8211
+ media: number().int().nonnegative(),
8212
+ retrainFrames: number().int().nonnegative(),
8213
+ total: number().int().nonnegative()
8178
8214
  });
8179
8215
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8180
- /** The independently selectable logical storage classes. `recordings`
8181
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8182
- * segments; `eventMedia` is post-analysis blobs. */
8216
+ /** The independently selectable logical storage classes — every class
8217
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8218
+ * Zod enum error where they should meet an explanation.
8219
+ *
8220
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8221
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8222
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8223
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8183
8224
  var StorageMigrationClassSchema = _enum([
8184
8225
  "recordings",
8185
8226
  "recordingsLow",
8186
- "eventMedia"
8227
+ "eventMedia",
8228
+ "backups",
8229
+ "galleryMedia"
8187
8230
  ]);
8188
8231
  /** A destination is always an existing, fully-qualified location id. The
8189
8232
  * migration API intentionally never changes a source location's `basePath`:
@@ -8191,20 +8234,56 @@ var StorageMigrationClassSchema = _enum([
8191
8234
  var StorageMigrationDestinationsSchema = object({
8192
8235
  recordings: string().min(1).optional(),
8193
8236
  recordingsLow: string().min(1).optional(),
8194
- eventMedia: string().min(1).optional()
8237
+ eventMedia: string().min(1).optional(),
8238
+ backups: string().min(1).optional(),
8239
+ galleryMedia: string().min(1).optional()
8195
8240
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8241
+ /**
8242
+ * How a migration sequences the cutover against the byte move.
8243
+ *
8244
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8245
+ * resume. Recording is stopped for the whole move. Right
8246
+ * for a small or a cold class, and the only legal mode for
8247
+ * a `cardinality: 'single'` class.
8248
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8249
+ * refresh, resume, then move the past with everything
8250
+ * running. The pause is three bounded instants (a detach +
8251
+ * attach round, a write-gate drain, a lease) instead of one
8252
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8253
+ * stopped recording under `blocking`; the same move is
8254
+ * seconds of stopped recording under `nonBlocking`.
8255
+ *
8256
+ * The mode is on the JOB, not only on the input, because `status` is where an
8257
+ * operator finds out which one is running.
8258
+ */
8259
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8196
8260
  /** Shared input for planning and starting an orchestrated storage migration. */
8197
8261
  var StorageMigrationInputSchema = object({
8198
8262
  destinations: StorageMigrationDestinationsSchema,
8199
- throttleMbps: number().min(1).max(1e3).optional()
8263
+ throttleMbps: number().min(1).max(1e3).optional(),
8264
+ /** Omitted = `blocking`, which stays the default. */
8265
+ mode: StorageMigrationModeSchema.optional()
8200
8266
  });
8201
- /** The durable coordinator state machine. The only phase that changes default
8202
- * locations is `repointing`, after every selected mover has completed and been
8203
- * verified. */
8267
+ /**
8268
+ * The durable coordinator state machine.
8269
+ *
8270
+ * `blocking`:
8271
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8272
+ *
8273
+ * `nonBlocking`:
8274
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8275
+ *
8276
+ * Same phases, different order plus two new ones — not a second mover.
8277
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8278
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8279
+ * `repointing` is still the only phase that changes a default location.
8280
+ */
8204
8281
  var StorageMigrationPhaseSchema = _enum([
8205
8282
  "planning",
8283
+ "sealing",
8206
8284
  "pausing",
8207
8285
  "moving",
8286
+ "draining",
8208
8287
  "verifying",
8209
8288
  "repointing",
8210
8289
  "refreshing",
@@ -8218,17 +8297,56 @@ var StorageMigrationParticipantSchema = _enum([
8218
8297
  "recorder",
8219
8298
  "analytics"
8220
8299
  ]);
8300
+ /**
8301
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8302
+ *
8303
+ * The long half of a non-blocking migration is `draining`, and it is measured
8304
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8305
+ * existed the only place those numbers appeared was a Loki line, so an operator
8306
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8307
+ * afternoon.
8308
+ *
8309
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8310
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8311
+ * mover — which is the exact failure this is meant to end. The coordinator's
8312
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8313
+ * read `state`; folding the counters costs no extra read and makes the durable
8314
+ * record say afterwards how far a move actually got.
8315
+ *
8316
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8317
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8318
+ * cannot say M, and a 0 there would render as "100 % done".
8319
+ */
8320
+ var StorageMigrationMoveProgressSchema = object({
8321
+ filesMoved: number().int().nonnegative(),
8322
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8323
+ filesTotal: number().int().nonnegative().nullable(),
8324
+ bytesMoved: number().int().nonnegative(),
8325
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8326
+ * crash gets a new mover, and a rate computed from the migration's start
8327
+ * would silently average in the time nothing was running. */
8328
+ startedAt: number(),
8329
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8330
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8331
+ * subtract its own. */
8332
+ observedAt: number()
8333
+ });
8221
8334
  var StorageMigrationMoveSchema = object({
8222
8335
  storageClass: StorageMigrationClassSchema,
8223
8336
  fromLocationId: string(),
8224
8337
  toLocationId: string(),
8225
8338
  moverJobId: string().nullable(),
8226
8339
  state: RelocateJobStateSchema.nullable(),
8227
- error: string().nullable()
8340
+ error: string().nullable(),
8341
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8342
+ progress: StorageMigrationMoveProgressSchema.nullable()
8228
8343
  });
8229
8344
  var StorageMigrationJobSchema = object({
8230
8345
  jobId: string(),
8231
8346
  phase: StorageMigrationPhaseSchema,
8347
+ /** Which order this job is running. `status` is the only place an operator
8348
+ * can tell a seconds-long cutover from a thirty-hour one. */
8349
+ mode: StorageMigrationModeSchema,
8232
8350
  destinations: StorageMigrationDestinationsSchema,
8233
8351
  throttleMbps: number(),
8234
8352
  moves: array(StorageMigrationMoveSchema),
@@ -8241,13 +8359,122 @@ var StorageMigrationJobSchema = object({
8241
8359
  finishedAt: number().nullable(),
8242
8360
  error: string().nullable()
8243
8361
  });
8362
+ var StorageMigrationFindingSchema = object({
8363
+ code: _enum([
8364
+ "sharesDeviceWithSource",
8365
+ "deviceIdentityUnknown",
8366
+ "unstampedEventMediaRows",
8367
+ "blockingOnly",
8368
+ "noMover"
8369
+ ]),
8370
+ storageClass: StorageMigrationClassSchema,
8371
+ /** Human-readable, already carrying the ids and counts. */
8372
+ message: string()
8373
+ });
8244
8374
  var StorageMigrationPlanSchema = object({
8245
8375
  destinations: StorageMigrationDestinationsSchema,
8376
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8377
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8378
+ * it. */
8379
+ mode: StorageMigrationModeSchema,
8246
8380
  moves: array(object({
8247
8381
  storageClass: StorageMigrationClassSchema,
8248
8382
  fromLocationId: string(),
8249
8383
  toLocationId: string()
8250
- }))
8384
+ })),
8385
+ findings: array(StorageMigrationFindingSchema)
8386
+ });
8387
+ /**
8388
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8389
+ *
8390
+ * The coordinator's job record is the state of record for a migration, and its
8391
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8392
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8393
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8394
+ * way because no supported UI path existed. A mover armed like that has no job
8395
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8396
+ *
8397
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8398
+ * orchestrated it.
8399
+ */
8400
+ var StorageMigrationMoverSchema = object({
8401
+ lane: _enum(["footage", "media"]),
8402
+ job: RelocateJobSchema,
8403
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8404
+ * directly against the owning addon. */
8405
+ migrationJobId: string().nullable(),
8406
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8407
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8408
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8409
+ * rate made of two different clocks. */
8410
+ observedAt: number()
8411
+ });
8412
+ /**
8413
+ * What a SOURCE still holds for one storage class — the number that makes a
8414
+ * "drain remaining" action honest rather than hopeful.
8415
+ *
8416
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8417
+ * engine's own selection count for media), never from the resident index: a
8418
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8419
+ * never been told about (D295).
8420
+ *
8421
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8422
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8423
+ * because refusing on an unanswerable read would hide exactly the case an
8424
+ * operator needs to act on.
8425
+ */
8426
+ var StorageMigrationResidueSchema = object({
8427
+ storageClass: StorageMigrationClassSchema,
8428
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8429
+ * move from wherever they are rather than from one named source. */
8430
+ fromLocationId: string(),
8431
+ /** Where a drain would move it — the class's CURRENT default. */
8432
+ toLocationId: string(),
8433
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8434
+ items: number().int().nonnegative().nullable(),
8435
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8436
+ bytes: number().int().nonnegative().nullable()
8437
+ });
8438
+ /**
8439
+ * Run the DRAIN half and nothing else.
8440
+ *
8441
+ * A migration that reached `done` has already repointed, so `start` correctly
8442
+ * refuses its destination ("already the default") — there is nothing left to
8443
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8444
+ * or finish against a work list that was a tenth of the archive (D295), and
8445
+ * before this there was no supported way to run only that half: the only way
8446
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8447
+ *
8448
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8449
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8450
+ * re-repoint a class that is already migrated.
8451
+ */
8452
+ var StorageMigrationDrainInputSchema = object({
8453
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8454
+ * a class whose source is already empty is refused rather than started. */
8455
+ classes: array(StorageMigrationClassSchema).min(1),
8456
+ throttleMbps: number().min(1).max(1e3).optional()
8457
+ });
8458
+ /** What a footage source still holds, asked of the durable hour ledger. */
8459
+ var RelocateResidueInputSchema = object({
8460
+ fromLocationId: string().min(1),
8461
+ /** Narrow to one logical class; omit for every profile on the location. */
8462
+ footageClass: RelocateFootageClassSchema.optional()
8463
+ });
8464
+ /** `null` = the archive could not answer (no ledger on this node, or the
8465
+ * aggregate failed). Never conflated with an empty source. */
8466
+ var RelocateResidueSchema = object({
8467
+ segments: number().int().nonnegative(),
8468
+ bytes: number().int().nonnegative()
8469
+ }).nullable();
8470
+ /** How many rows a media pass would still act on against a given target — the
8471
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8472
+ * never disagree. `null` = the count could not be taken. */
8473
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8474
+ var RelocatableMediaCountInputSchema = object({
8475
+ toLocationId: string().min(1),
8476
+ /** Omitted = `move`. */
8477
+ mode: MediaRelocateModeSchema.optional()
8251
8478
  });
8252
8479
  /**
8253
8480
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8353,6 +8580,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8353
8580
  * two addons declaring the same `id` must agree on `cardinality` (validated
8354
8581
  * at kernel aggregation time, not here).
8355
8582
  */
8583
+ /**
8584
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8585
+ * actually reaches the bytes. It is the constraint that decides which
8586
+ * `storage-provider`s may back a location of that kind.
8587
+ *
8588
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8589
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8590
+ * post-analysis media roots). Only a provider that serves a genuine local
8591
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8592
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8593
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8594
+ * against a same-named local directory that is something else entirely.
8595
+ *
8596
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8597
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8598
+ * service never sees a path, so any provider can back it. `backups` is the
8599
+ * one kind that qualifies today.
8600
+ *
8601
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8602
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8603
+ * refused the configuration; the first write simply went somewhere wrong, and
8604
+ * a recording write that goes wrong surfaces as a silent black window rather
8605
+ * than an error (the read path does not `stat`). This turns that accident into
8606
+ * a declared, enforced, testable refusal.
8607
+ */
8608
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8356
8609
  var StorageLocationDeclarationSchema = object({
8357
8610
  /**
8358
8611
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8372,6 +8625,19 @@ var StorageLocationDeclarationSchema = object({
8372
8625
  */
8373
8626
  cardinality: _enum(["single", "multi"]),
8374
8627
  /**
8628
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8629
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8630
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8631
+ *
8632
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8633
+ * can only over-restrict (refuse a remote provider for a kind that might
8634
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8635
+ * permissive direction and is therefore never inferred — a repo guard
8636
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8637
+ * reached by omission.
8638
+ */
8639
+ access: StorageAccessSchema.optional(),
8640
+ /**
8375
8641
  * When set, the default instance for this location inherits its resolved
8376
8642
  * root from the named location's default instance. Useful for derivative
8377
8643
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17952,8 +18218,10 @@ var TrackSchema = object({
17952
18218
  lastSeen: number(),
17953
18219
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17954
18220
  positions: array(TrackPositionSchema).readonly(),
17955
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17956
- * saveThumbnails policy). */
18221
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18222
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18223
+ * the retired `saveThumbnails` used to gate this and the rolling
18224
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17957
18225
  snapshots: array(TrackSnapshotSchema).readonly(),
17958
18226
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17959
18227
  zonesVisited: array(string()).readonly(),
@@ -18813,6 +19081,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18813
19081
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18814
19082
  kind: "mutation",
18815
19083
  auth: "admin"
19084
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19085
+ kind: "query",
19086
+ auth: "admin"
18816
19087
  }), method(object({}), array(RelocateJobSchema).readonly(), {
18817
19088
  kind: "query",
18818
19089
  auth: "admin"
@@ -20720,7 +20991,10 @@ method(object({
20720
20991
  }), StorageLocationSchema, {
20721
20992
  kind: "mutation",
20722
20993
  auth: "admin"
20723
- }), method(object({ id: string() }), _void(), {
20994
+ }), method(object({
20995
+ id: string(),
20996
+ force: boolean().optional()
20997
+ }), _void(), {
20724
20998
  kind: "mutation",
20725
20999
  auth: "admin"
20726
21000
  }), method(object({ id: string() }), object({
@@ -20769,6 +21043,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20769
21043
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20770
21044
  kind: "mutation",
20771
21045
  auth: "admin"
21046
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21047
+ kind: "mutation",
21048
+ auth: "admin"
20772
21049
  });
20773
21050
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20774
21051
  providerId: string().min(1),
@@ -21167,12 +21444,38 @@ response: record(string(), unknown()) }), object({
21167
21444
  *
21168
21445
  * ## Why this is a capability and not a helper
21169
21446
  *
21170
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21171
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21172
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21173
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21174
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21175
- * load 5,000 rows before ranking anything.
21447
+ * This capability was introduced with the claim that SIX stores in
21448
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21449
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21450
+ * claim was never true, and leaving it here made five stores look like pending
21451
+ * work when three of them have no vector at all. Counted column by column on
21452
+ * 2026-08-30, exactly THREE ever held one:
21453
+ *
21454
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21455
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21456
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21457
+ * face, migrated 2026-08-30 into its OWN index (see below).
21458
+ *
21459
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21460
+ * and `identities` store a name; the event store stores no derivative vector.
21461
+ * They are not migration candidates and never were.
21462
+ *
21463
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21464
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21465
+ * rows before ranking anything.
21466
+ *
21467
+ * ## One index per COMPARISON, never per encoder
21468
+ *
21469
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21470
+ * model, and they still get two indexes. An index is a set of things that are
21471
+ * ranked against each other and that live and die together, and these two are
21472
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21473
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21474
+ * forever and is the gallery every recognition ranks against. One index would
21475
+ * mean every gallery load and every reconcile carried a filter whose failure
21476
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21477
+ * person's only sample. The dimension they share is not a reason to share an
21478
+ * index; the question they answer is, and it differs.
21176
21479
  *
21177
21480
  * The fix is not a faster loop, it is a different backend — and the backend
21178
21481
  * should be replaceable without touching six callers. So: a singleton
@@ -21277,7 +21580,20 @@ var VectorQueryResultSchema = object({
21277
21580
  */
21278
21581
  scanned: number(),
21279
21582
  /** True when the backend could not consider every row that passed the filter. */
21280
- truncated: boolean()
21583
+ truncated: boolean(),
21584
+ /**
21585
+ * The `topK` the backend actually ran with.
21586
+ *
21587
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21588
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21589
+ * own log rather than in its answer. That is how an audit asking for 20,000
21590
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21591
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21592
+ * MUCH, in the return value, where the caller cannot fail to see it.
21593
+ *
21594
+ * Equals the requested `topK` whenever nothing was lowered.
21595
+ */
21596
+ effectiveTopK: number().int().positive()
21281
21597
  });
21282
21598
  var VectorDeleteInputSchema = object({
21283
21599
  index: string(),
@@ -21306,6 +21622,68 @@ var VectorGetResultSchema = object({ items: array(object({
21306
21622
  id: string(),
21307
21623
  metadata: VectorMetadataSchema
21308
21624
  })) });
21625
+ /**
21626
+ * Ids to read back WITH their vectors.
21627
+ *
21628
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21629
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21630
+ * caller depends on that promise. This one promises the opposite.
21631
+ *
21632
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21633
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21634
+ * a per-face cross-process KNN would be a network round trip inside the
21635
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21636
+ * it requires the index to hand the floats back. Without this method the only
21637
+ * way to keep a readable vector is a JSON column, which is the thing this
21638
+ * capability exists to delete.
21639
+ *
21640
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21641
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21642
+ */
21643
+ var VectorFetchInputSchema = object({
21644
+ index: string(),
21645
+ ids: array(string())
21646
+ });
21647
+ var VectorFetchResultSchema = object({ items: array(object({
21648
+ id: string(),
21649
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21650
+ vector: string(),
21651
+ metadata: VectorMetadataSchema
21652
+ })) });
21653
+ /**
21654
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21655
+ *
21656
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21657
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21658
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21659
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21660
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21661
+ * looked" for as long as anyone cared to read it.
21662
+ *
21663
+ * This is the primitive that question actually needs: a bounded page, ordered
21664
+ * by the backend's own row order, costing no distance computation at all.
21665
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21666
+ * the full-table read this capability was built to stop.
21667
+ */
21668
+ var VectorScanInputSchema = object({
21669
+ index: string(),
21670
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21671
+ cursor: number().int().nonnegative().default(0),
21672
+ limit: number().int().positive()
21673
+ });
21674
+ var VectorScanResultSchema = object({
21675
+ items: array(object({
21676
+ id: string(),
21677
+ metadata: VectorMetadataSchema
21678
+ })),
21679
+ /**
21680
+ * Where the next page starts, or `null` when the walk reached the end.
21681
+ *
21682
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21683
+ * from a short page: a backend is free to return fewer rows than asked.
21684
+ */
21685
+ nextCursor: number().int().nonnegative().nullable()
21686
+ });
21309
21687
  var VectorStatsInputSchema = object({ index: string() });
21310
21688
  var VectorStatsResultSchema = object({
21311
21689
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21324,7 +21702,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21324
21702
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21325
21703
  kind: "mutation",
21326
21704
  auth: "admin"
21327
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21705
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21328
21706
  kind: "mutation",
21329
21707
  auth: "admin"
21330
21708
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26228,6 +26606,9 @@ method(object({
26228
26606
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26229
26607
  kind: "query",
26230
26608
  auth: "admin"
26609
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26610
+ kind: "query",
26611
+ auth: "admin"
26231
26612
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26232
26613
  kind: "mutation",
26233
26614
  auth: "admin"
@@ -31193,6 +31574,18 @@ Object.freeze({
31193
31574
  addonId: null,
31194
31575
  access: "create"
31195
31576
  },
31577
+ "pipelineAnalytics.countRelocatableMedia": {
31578
+ capName: "pipeline-analytics",
31579
+ capScope: "device",
31580
+ addonId: null,
31581
+ access: "view"
31582
+ },
31583
+ "pipelineAnalytics.countUnstampedEventMedia": {
31584
+ capName: "pipeline-analytics",
31585
+ capScope: "device",
31586
+ addonId: null,
31587
+ access: "view"
31588
+ },
31196
31589
  "pipelineAnalytics.deleteDeviceEvents": {
31197
31590
  capName: "pipeline-analytics",
31198
31591
  capScope: "device",
@@ -32351,6 +32744,12 @@ Object.freeze({
32351
32744
  addonId: null,
32352
32745
  access: "view"
32353
32746
  },
32747
+ "recording.getRelocateResidue": {
32748
+ capName: "recording",
32749
+ capScope: "system",
32750
+ addonId: null,
32751
+ access: "view"
32752
+ },
32354
32753
  "recording.getStorageMigrationMoveStatus": {
32355
32754
  capName: "recording",
32356
32755
  capScope: "system",
@@ -32897,12 +33296,30 @@ Object.freeze({
32897
33296
  addonId: null,
32898
33297
  access: "create"
32899
33298
  },
33299
+ "storageMigration.drain": {
33300
+ capName: "storage-migration",
33301
+ capScope: "system",
33302
+ addonId: null,
33303
+ access: "create"
33304
+ },
33305
+ "storageMigration.movers": {
33306
+ capName: "storage-migration",
33307
+ capScope: "system",
33308
+ addonId: null,
33309
+ access: "view"
33310
+ },
32900
33311
  "storageMigration.plan": {
32901
33312
  capName: "storage-migration",
32902
33313
  capScope: "system",
32903
33314
  addonId: null,
32904
33315
  access: "view"
32905
33316
  },
33317
+ "storageMigration.residue": {
33318
+ capName: "storage-migration",
33319
+ capScope: "system",
33320
+ addonId: null,
33321
+ access: "view"
33322
+ },
32906
33323
  "storageMigration.start": {
32907
33324
  capName: "storage-migration",
32908
33325
  capScope: "system",
@@ -33737,6 +34154,12 @@ Object.freeze({
33737
34154
  addonId: null,
33738
34155
  access: "delete"
33739
34156
  },
34157
+ "vectorStore.fetchByIds": {
34158
+ capName: "vector-store",
34159
+ capScope: "system",
34160
+ addonId: null,
34161
+ access: "view"
34162
+ },
33740
34163
  "vectorStore.getByIds": {
33741
34164
  capName: "vector-store",
33742
34165
  capScope: "system",
@@ -33749,6 +34172,12 @@ Object.freeze({
33749
34172
  addonId: null,
33750
34173
  access: "view"
33751
34174
  },
34175
+ "vectorStore.scan": {
34176
+ capName: "vector-store",
34177
+ capScope: "system",
34178
+ addonId: null,
34179
+ access: "view"
34180
+ },
33752
34181
  "vectorStore.stats": {
33753
34182
  capName: "vector-store",
33754
34183
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8145,18 +8145,61 @@ var RelocateFootageInputSchema = object({
8145
8145
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8146
8146
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8147
8147
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8148
+ /**
8149
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8150
+ * mover (the engine already walks both collections with a timestamp cursor and
8151
+ * already has a stamp-without-copy path).
8152
+ *
8153
+ * - `move` — the default and the historical behaviour: event-media and
8154
+ * retrain blobs move to `toLocationId` and their rows are
8155
+ * stamped. The enrolled gallery is skipped (D197).
8156
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8157
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8158
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8159
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8160
+ * instant a repoint moves that pointer the row reads from the
8161
+ * new disk while its bytes are on the old one.
8162
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8163
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8164
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8165
+ * never run beside a live second location: it is stop-the-world
8166
+ * by construction, which is acceptable only because the gallery
8167
+ * is a few KB per enrolled sample.
8168
+ */
8169
+ var MediaRelocateModeSchema = _enum([
8170
+ "move",
8171
+ "seal",
8172
+ "gallery"
8173
+ ]);
8148
8174
  var RelocateMediaInputSchema = object({
8149
8175
  toLocationId: string(),
8150
- throttleMbps: number().min(1).max(1e3).optional()
8176
+ throttleMbps: number().min(1).max(1e3).optional(),
8177
+ /** Omitted = `move`, the pre-existing behaviour. */
8178
+ mode: MediaRelocateModeSchema.optional()
8179
+ });
8180
+ /** How many rows still carry NO `locationId` — the population a repoint would
8181
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8182
+ * value that permits a non-blocking `eventMedia` cutover. */
8183
+ var UnstampedEventMediaCountSchema = object({
8184
+ media: number().int().nonnegative(),
8185
+ retrainFrames: number().int().nonnegative(),
8186
+ total: number().int().nonnegative()
8151
8187
  });
8152
8188
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8153
- /** The independently selectable logical storage classes. `recordings`
8154
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8155
- * segments; `eventMedia` is post-analysis blobs. */
8189
+ /** The independently selectable logical storage classes — every class
8190
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8191
+ * Zod enum error where they should meet an explanation.
8192
+ *
8193
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8194
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8195
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8196
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8156
8197
  var StorageMigrationClassSchema = _enum([
8157
8198
  "recordings",
8158
8199
  "recordingsLow",
8159
- "eventMedia"
8200
+ "eventMedia",
8201
+ "backups",
8202
+ "galleryMedia"
8160
8203
  ]);
8161
8204
  /** A destination is always an existing, fully-qualified location id. The
8162
8205
  * migration API intentionally never changes a source location's `basePath`:
@@ -8164,20 +8207,56 @@ var StorageMigrationClassSchema = _enum([
8164
8207
  var StorageMigrationDestinationsSchema = object({
8165
8208
  recordings: string().min(1).optional(),
8166
8209
  recordingsLow: string().min(1).optional(),
8167
- eventMedia: string().min(1).optional()
8210
+ eventMedia: string().min(1).optional(),
8211
+ backups: string().min(1).optional(),
8212
+ galleryMedia: string().min(1).optional()
8168
8213
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8214
+ /**
8215
+ * How a migration sequences the cutover against the byte move.
8216
+ *
8217
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8218
+ * resume. Recording is stopped for the whole move. Right
8219
+ * for a small or a cold class, and the only legal mode for
8220
+ * a `cardinality: 'single'` class.
8221
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8222
+ * refresh, resume, then move the past with everything
8223
+ * running. The pause is three bounded instants (a detach +
8224
+ * attach round, a write-gate drain, a lease) instead of one
8225
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8226
+ * stopped recording under `blocking`; the same move is
8227
+ * seconds of stopped recording under `nonBlocking`.
8228
+ *
8229
+ * The mode is on the JOB, not only on the input, because `status` is where an
8230
+ * operator finds out which one is running.
8231
+ */
8232
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8169
8233
  /** Shared input for planning and starting an orchestrated storage migration. */
8170
8234
  var StorageMigrationInputSchema = object({
8171
8235
  destinations: StorageMigrationDestinationsSchema,
8172
- throttleMbps: number().min(1).max(1e3).optional()
8236
+ throttleMbps: number().min(1).max(1e3).optional(),
8237
+ /** Omitted = `blocking`, which stays the default. */
8238
+ mode: StorageMigrationModeSchema.optional()
8173
8239
  });
8174
- /** The durable coordinator state machine. The only phase that changes default
8175
- * locations is `repointing`, after every selected mover has completed and been
8176
- * verified. */
8240
+ /**
8241
+ * The durable coordinator state machine.
8242
+ *
8243
+ * `blocking`:
8244
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8245
+ *
8246
+ * `nonBlocking`:
8247
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8248
+ *
8249
+ * Same phases, different order plus two new ones — not a second mover.
8250
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8251
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8252
+ * `repointing` is still the only phase that changes a default location.
8253
+ */
8177
8254
  var StorageMigrationPhaseSchema = _enum([
8178
8255
  "planning",
8256
+ "sealing",
8179
8257
  "pausing",
8180
8258
  "moving",
8259
+ "draining",
8181
8260
  "verifying",
8182
8261
  "repointing",
8183
8262
  "refreshing",
@@ -8191,17 +8270,56 @@ var StorageMigrationParticipantSchema = _enum([
8191
8270
  "recorder",
8192
8271
  "analytics"
8193
8272
  ]);
8273
+ /**
8274
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8275
+ *
8276
+ * The long half of a non-blocking migration is `draining`, and it is measured
8277
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8278
+ * existed the only place those numbers appeared was a Loki line, so an operator
8279
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8280
+ * afternoon.
8281
+ *
8282
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8283
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8284
+ * mover — which is the exact failure this is meant to end. The coordinator's
8285
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8286
+ * read `state`; folding the counters costs no extra read and makes the durable
8287
+ * record say afterwards how far a move actually got.
8288
+ *
8289
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8290
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8291
+ * cannot say M, and a 0 there would render as "100 % done".
8292
+ */
8293
+ var StorageMigrationMoveProgressSchema = object({
8294
+ filesMoved: number().int().nonnegative(),
8295
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8296
+ filesTotal: number().int().nonnegative().nullable(),
8297
+ bytesMoved: number().int().nonnegative(),
8298
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8299
+ * crash gets a new mover, and a rate computed from the migration's start
8300
+ * would silently average in the time nothing was running. */
8301
+ startedAt: number(),
8302
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8303
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8304
+ * subtract its own. */
8305
+ observedAt: number()
8306
+ });
8194
8307
  var StorageMigrationMoveSchema = object({
8195
8308
  storageClass: StorageMigrationClassSchema,
8196
8309
  fromLocationId: string(),
8197
8310
  toLocationId: string(),
8198
8311
  moverJobId: string().nullable(),
8199
8312
  state: RelocateJobStateSchema.nullable(),
8200
- error: string().nullable()
8313
+ error: string().nullable(),
8314
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8315
+ progress: StorageMigrationMoveProgressSchema.nullable()
8201
8316
  });
8202
8317
  var StorageMigrationJobSchema = object({
8203
8318
  jobId: string(),
8204
8319
  phase: StorageMigrationPhaseSchema,
8320
+ /** Which order this job is running. `status` is the only place an operator
8321
+ * can tell a seconds-long cutover from a thirty-hour one. */
8322
+ mode: StorageMigrationModeSchema,
8205
8323
  destinations: StorageMigrationDestinationsSchema,
8206
8324
  throttleMbps: number(),
8207
8325
  moves: array(StorageMigrationMoveSchema),
@@ -8214,13 +8332,122 @@ var StorageMigrationJobSchema = object({
8214
8332
  finishedAt: number().nullable(),
8215
8333
  error: string().nullable()
8216
8334
  });
8335
+ var StorageMigrationFindingSchema = object({
8336
+ code: _enum([
8337
+ "sharesDeviceWithSource",
8338
+ "deviceIdentityUnknown",
8339
+ "unstampedEventMediaRows",
8340
+ "blockingOnly",
8341
+ "noMover"
8342
+ ]),
8343
+ storageClass: StorageMigrationClassSchema,
8344
+ /** Human-readable, already carrying the ids and counts. */
8345
+ message: string()
8346
+ });
8217
8347
  var StorageMigrationPlanSchema = object({
8218
8348
  destinations: StorageMigrationDestinationsSchema,
8349
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8350
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8351
+ * it. */
8352
+ mode: StorageMigrationModeSchema,
8219
8353
  moves: array(object({
8220
8354
  storageClass: StorageMigrationClassSchema,
8221
8355
  fromLocationId: string(),
8222
8356
  toLocationId: string()
8223
- }))
8357
+ })),
8358
+ findings: array(StorageMigrationFindingSchema)
8359
+ });
8360
+ /**
8361
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8362
+ *
8363
+ * The coordinator's job record is the state of record for a migration, and its
8364
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8365
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8366
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8367
+ * way because no supported UI path existed. A mover armed like that has no job
8368
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8369
+ *
8370
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8371
+ * orchestrated it.
8372
+ */
8373
+ var StorageMigrationMoverSchema = object({
8374
+ lane: _enum(["footage", "media"]),
8375
+ job: RelocateJobSchema,
8376
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8377
+ * directly against the owning addon. */
8378
+ migrationJobId: string().nullable(),
8379
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8380
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8381
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8382
+ * rate made of two different clocks. */
8383
+ observedAt: number()
8384
+ });
8385
+ /**
8386
+ * What a SOURCE still holds for one storage class — the number that makes a
8387
+ * "drain remaining" action honest rather than hopeful.
8388
+ *
8389
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8390
+ * engine's own selection count for media), never from the resident index: a
8391
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8392
+ * never been told about (D295).
8393
+ *
8394
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8395
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8396
+ * because refusing on an unanswerable read would hide exactly the case an
8397
+ * operator needs to act on.
8398
+ */
8399
+ var StorageMigrationResidueSchema = object({
8400
+ storageClass: StorageMigrationClassSchema,
8401
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8402
+ * move from wherever they are rather than from one named source. */
8403
+ fromLocationId: string(),
8404
+ /** Where a drain would move it — the class's CURRENT default. */
8405
+ toLocationId: string(),
8406
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8407
+ items: number().int().nonnegative().nullable(),
8408
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8409
+ bytes: number().int().nonnegative().nullable()
8410
+ });
8411
+ /**
8412
+ * Run the DRAIN half and nothing else.
8413
+ *
8414
+ * A migration that reached `done` has already repointed, so `start` correctly
8415
+ * refuses its destination ("already the default") — there is nothing left to
8416
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8417
+ * or finish against a work list that was a tenth of the archive (D295), and
8418
+ * before this there was no supported way to run only that half: the only way
8419
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8420
+ *
8421
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8422
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8423
+ * re-repoint a class that is already migrated.
8424
+ */
8425
+ var StorageMigrationDrainInputSchema = object({
8426
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8427
+ * a class whose source is already empty is refused rather than started. */
8428
+ classes: array(StorageMigrationClassSchema).min(1),
8429
+ throttleMbps: number().min(1).max(1e3).optional()
8430
+ });
8431
+ /** What a footage source still holds, asked of the durable hour ledger. */
8432
+ var RelocateResidueInputSchema = object({
8433
+ fromLocationId: string().min(1),
8434
+ /** Narrow to one logical class; omit for every profile on the location. */
8435
+ footageClass: RelocateFootageClassSchema.optional()
8436
+ });
8437
+ /** `null` = the archive could not answer (no ledger on this node, or the
8438
+ * aggregate failed). Never conflated with an empty source. */
8439
+ var RelocateResidueSchema = object({
8440
+ segments: number().int().nonnegative(),
8441
+ bytes: number().int().nonnegative()
8442
+ }).nullable();
8443
+ /** How many rows a media pass would still act on against a given target — the
8444
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8445
+ * never disagree. `null` = the count could not be taken. */
8446
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8447
+ var RelocatableMediaCountInputSchema = object({
8448
+ toLocationId: string().min(1),
8449
+ /** Omitted = `move`. */
8450
+ mode: MediaRelocateModeSchema.optional()
8224
8451
  });
8225
8452
  /**
8226
8453
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8326,6 +8553,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8326
8553
  * two addons declaring the same `id` must agree on `cardinality` (validated
8327
8554
  * at kernel aggregation time, not here).
8328
8555
  */
8556
+ /**
8557
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8558
+ * actually reaches the bytes. It is the constraint that decides which
8559
+ * `storage-provider`s may back a location of that kind.
8560
+ *
8561
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8562
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8563
+ * post-analysis media roots). Only a provider that serves a genuine local
8564
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8565
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8566
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8567
+ * against a same-named local directory that is something else entirely.
8568
+ *
8569
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8570
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8571
+ * service never sees a path, so any provider can back it. `backups` is the
8572
+ * one kind that qualifies today.
8573
+ *
8574
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8575
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8576
+ * refused the configuration; the first write simply went somewhere wrong, and
8577
+ * a recording write that goes wrong surfaces as a silent black window rather
8578
+ * than an error (the read path does not `stat`). This turns that accident into
8579
+ * a declared, enforced, testable refusal.
8580
+ */
8581
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8329
8582
  var StorageLocationDeclarationSchema = object({
8330
8583
  /**
8331
8584
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8345,6 +8598,19 @@ var StorageLocationDeclarationSchema = object({
8345
8598
  */
8346
8599
  cardinality: _enum(["single", "multi"]),
8347
8600
  /**
8601
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8602
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8603
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8604
+ *
8605
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8606
+ * can only over-restrict (refuse a remote provider for a kind that might
8607
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8608
+ * permissive direction and is therefore never inferred — a repo guard
8609
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8610
+ * reached by omission.
8611
+ */
8612
+ access: StorageAccessSchema.optional(),
8613
+ /**
8348
8614
  * When set, the default instance for this location inherits its resolved
8349
8615
  * root from the named location's default instance. Useful for derivative
8350
8616
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17925,8 +18191,10 @@ var TrackSchema = object({
17925
18191
  lastSeen: number(),
17926
18192
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17927
18193
  positions: array(TrackPositionSchema).readonly(),
17928
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17929
- * saveThumbnails policy). */
18194
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18195
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18196
+ * the retired `saveThumbnails` used to gate this and the rolling
18197
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17930
18198
  snapshots: array(TrackSnapshotSchema).readonly(),
17931
18199
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17932
18200
  zonesVisited: array(string()).readonly(),
@@ -18786,6 +19054,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18786
19054
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18787
19055
  kind: "mutation",
18788
19056
  auth: "admin"
19057
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19058
+ kind: "query",
19059
+ auth: "admin"
18789
19060
  }), method(object({}), array(RelocateJobSchema).readonly(), {
18790
19061
  kind: "query",
18791
19062
  auth: "admin"
@@ -20693,7 +20964,10 @@ method(object({
20693
20964
  }), StorageLocationSchema, {
20694
20965
  kind: "mutation",
20695
20966
  auth: "admin"
20696
- }), method(object({ id: string() }), _void(), {
20967
+ }), method(object({
20968
+ id: string(),
20969
+ force: boolean().optional()
20970
+ }), _void(), {
20697
20971
  kind: "mutation",
20698
20972
  auth: "admin"
20699
20973
  }), method(object({ id: string() }), object({
@@ -20742,6 +21016,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20742
21016
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20743
21017
  kind: "mutation",
20744
21018
  auth: "admin"
21019
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21020
+ kind: "mutation",
21021
+ auth: "admin"
20745
21022
  });
20746
21023
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20747
21024
  providerId: string().min(1),
@@ -21140,12 +21417,38 @@ response: record(string(), unknown()) }), object({
21140
21417
  *
21141
21418
  * ## Why this is a capability and not a helper
21142
21419
  *
21143
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21144
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21145
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21146
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21147
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21148
- * load 5,000 rows before ranking anything.
21420
+ * This capability was introduced with the claim that SIX stores in
21421
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21422
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21423
+ * claim was never true, and leaving it here made five stores look like pending
21424
+ * work when three of them have no vector at all. Counted column by column on
21425
+ * 2026-08-30, exactly THREE ever held one:
21426
+ *
21427
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21428
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21429
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21430
+ * face, migrated 2026-08-30 into its OWN index (see below).
21431
+ *
21432
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21433
+ * and `identities` store a name; the event store stores no derivative vector.
21434
+ * They are not migration candidates and never were.
21435
+ *
21436
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21437
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21438
+ * rows before ranking anything.
21439
+ *
21440
+ * ## One index per COMPARISON, never per encoder
21441
+ *
21442
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21443
+ * model, and they still get two indexes. An index is a set of things that are
21444
+ * ranked against each other and that live and die together, and these two are
21445
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21446
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21447
+ * forever and is the gallery every recognition ranks against. One index would
21448
+ * mean every gallery load and every reconcile carried a filter whose failure
21449
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21450
+ * person's only sample. The dimension they share is not a reason to share an
21451
+ * index; the question they answer is, and it differs.
21149
21452
  *
21150
21453
  * The fix is not a faster loop, it is a different backend — and the backend
21151
21454
  * should be replaceable without touching six callers. So: a singleton
@@ -21250,7 +21553,20 @@ var VectorQueryResultSchema = object({
21250
21553
  */
21251
21554
  scanned: number(),
21252
21555
  /** True when the backend could not consider every row that passed the filter. */
21253
- truncated: boolean()
21556
+ truncated: boolean(),
21557
+ /**
21558
+ * The `topK` the backend actually ran with.
21559
+ *
21560
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21561
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21562
+ * own log rather than in its answer. That is how an audit asking for 20,000
21563
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21564
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21565
+ * MUCH, in the return value, where the caller cannot fail to see it.
21566
+ *
21567
+ * Equals the requested `topK` whenever nothing was lowered.
21568
+ */
21569
+ effectiveTopK: number().int().positive()
21254
21570
  });
21255
21571
  var VectorDeleteInputSchema = object({
21256
21572
  index: string(),
@@ -21279,6 +21595,68 @@ var VectorGetResultSchema = object({ items: array(object({
21279
21595
  id: string(),
21280
21596
  metadata: VectorMetadataSchema
21281
21597
  })) });
21598
+ /**
21599
+ * Ids to read back WITH their vectors.
21600
+ *
21601
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21602
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21603
+ * caller depends on that promise. This one promises the opposite.
21604
+ *
21605
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21606
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21607
+ * a per-face cross-process KNN would be a network round trip inside the
21608
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21609
+ * it requires the index to hand the floats back. Without this method the only
21610
+ * way to keep a readable vector is a JSON column, which is the thing this
21611
+ * capability exists to delete.
21612
+ *
21613
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21614
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21615
+ */
21616
+ var VectorFetchInputSchema = object({
21617
+ index: string(),
21618
+ ids: array(string())
21619
+ });
21620
+ var VectorFetchResultSchema = object({ items: array(object({
21621
+ id: string(),
21622
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21623
+ vector: string(),
21624
+ metadata: VectorMetadataSchema
21625
+ })) });
21626
+ /**
21627
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21628
+ *
21629
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21630
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21631
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21632
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21633
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21634
+ * looked" for as long as anyone cared to read it.
21635
+ *
21636
+ * This is the primitive that question actually needs: a bounded page, ordered
21637
+ * by the backend's own row order, costing no distance computation at all.
21638
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21639
+ * the full-table read this capability was built to stop.
21640
+ */
21641
+ var VectorScanInputSchema = object({
21642
+ index: string(),
21643
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21644
+ cursor: number().int().nonnegative().default(0),
21645
+ limit: number().int().positive()
21646
+ });
21647
+ var VectorScanResultSchema = object({
21648
+ items: array(object({
21649
+ id: string(),
21650
+ metadata: VectorMetadataSchema
21651
+ })),
21652
+ /**
21653
+ * Where the next page starts, or `null` when the walk reached the end.
21654
+ *
21655
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21656
+ * from a short page: a backend is free to return fewer rows than asked.
21657
+ */
21658
+ nextCursor: number().int().nonnegative().nullable()
21659
+ });
21282
21660
  var VectorStatsInputSchema = object({ index: string() });
21283
21661
  var VectorStatsResultSchema = object({
21284
21662
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21297,7 +21675,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21297
21675
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21298
21676
  kind: "mutation",
21299
21677
  auth: "admin"
21300
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21678
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21301
21679
  kind: "mutation",
21302
21680
  auth: "admin"
21303
21681
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26201,6 +26579,9 @@ method(object({
26201
26579
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26202
26580
  kind: "query",
26203
26581
  auth: "admin"
26582
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26583
+ kind: "query",
26584
+ auth: "admin"
26204
26585
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26205
26586
  kind: "mutation",
26206
26587
  auth: "admin"
@@ -31166,6 +31547,18 @@ Object.freeze({
31166
31547
  addonId: null,
31167
31548
  access: "create"
31168
31549
  },
31550
+ "pipelineAnalytics.countRelocatableMedia": {
31551
+ capName: "pipeline-analytics",
31552
+ capScope: "device",
31553
+ addonId: null,
31554
+ access: "view"
31555
+ },
31556
+ "pipelineAnalytics.countUnstampedEventMedia": {
31557
+ capName: "pipeline-analytics",
31558
+ capScope: "device",
31559
+ addonId: null,
31560
+ access: "view"
31561
+ },
31169
31562
  "pipelineAnalytics.deleteDeviceEvents": {
31170
31563
  capName: "pipeline-analytics",
31171
31564
  capScope: "device",
@@ -32324,6 +32717,12 @@ Object.freeze({
32324
32717
  addonId: null,
32325
32718
  access: "view"
32326
32719
  },
32720
+ "recording.getRelocateResidue": {
32721
+ capName: "recording",
32722
+ capScope: "system",
32723
+ addonId: null,
32724
+ access: "view"
32725
+ },
32327
32726
  "recording.getStorageMigrationMoveStatus": {
32328
32727
  capName: "recording",
32329
32728
  capScope: "system",
@@ -32870,12 +33269,30 @@ Object.freeze({
32870
33269
  addonId: null,
32871
33270
  access: "create"
32872
33271
  },
33272
+ "storageMigration.drain": {
33273
+ capName: "storage-migration",
33274
+ capScope: "system",
33275
+ addonId: null,
33276
+ access: "create"
33277
+ },
33278
+ "storageMigration.movers": {
33279
+ capName: "storage-migration",
33280
+ capScope: "system",
33281
+ addonId: null,
33282
+ access: "view"
33283
+ },
32873
33284
  "storageMigration.plan": {
32874
33285
  capName: "storage-migration",
32875
33286
  capScope: "system",
32876
33287
  addonId: null,
32877
33288
  access: "view"
32878
33289
  },
33290
+ "storageMigration.residue": {
33291
+ capName: "storage-migration",
33292
+ capScope: "system",
33293
+ addonId: null,
33294
+ access: "view"
33295
+ },
32879
33296
  "storageMigration.start": {
32880
33297
  capName: "storage-migration",
32881
33298
  capScope: "system",
@@ -33710,6 +34127,12 @@ Object.freeze({
33710
34127
  addonId: null,
33711
34128
  access: "delete"
33712
34129
  },
34130
+ "vectorStore.fetchByIds": {
34131
+ capName: "vector-store",
34132
+ capScope: "system",
34133
+ addonId: null,
34134
+ access: "view"
34135
+ },
33713
34136
  "vectorStore.getByIds": {
33714
34137
  capName: "vector-store",
33715
34138
  capScope: "system",
@@ -33722,6 +34145,12 @@ Object.freeze({
33722
34145
  addonId: null,
33723
34146
  access: "view"
33724
34147
  },
34148
+ "vectorStore.scan": {
34149
+ capName: "vector-store",
34150
+ capScope: "system",
34151
+ addonId: null,
34152
+ access: "view"
34153
+ },
33725
34154
  "vectorStore.stats": {
33726
34155
  capName: "vector-store",
33727
34156
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-notifiers",
3
- "version": "1.2.46",
3
+ "version": "1.2.49",
4
4
  "description": "System notifiers addon for CamStack — a `notification-output` collection provider hosting per-kind notifier adapters (ntfy, pushover, gotify, telegram, discord, webhook, zentik).",
5
5
  "keywords": [
6
6
  "camstack",