@camstack/addon-provider-dreo 0.2.42 → 0.2.45

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
@@ -8075,18 +8075,61 @@ var RelocateFootageInputSchema = object({
8075
8075
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8076
8076
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8077
8077
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8078
+ /**
8079
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8080
+ * mover (the engine already walks both collections with a timestamp cursor and
8081
+ * already has a stamp-without-copy path).
8082
+ *
8083
+ * - `move` — the default and the historical behaviour: event-media and
8084
+ * retrain blobs move to `toLocationId` and their rows are
8085
+ * stamped. The enrolled gallery is skipped (D197).
8086
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8087
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8088
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8089
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8090
+ * instant a repoint moves that pointer the row reads from the
8091
+ * new disk while its bytes are on the old one.
8092
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8093
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8094
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8095
+ * never run beside a live second location: it is stop-the-world
8096
+ * by construction, which is acceptable only because the gallery
8097
+ * is a few KB per enrolled sample.
8098
+ */
8099
+ var MediaRelocateModeSchema = _enum([
8100
+ "move",
8101
+ "seal",
8102
+ "gallery"
8103
+ ]);
8078
8104
  var RelocateMediaInputSchema = object({
8079
8105
  toLocationId: string(),
8080
- throttleMbps: number().min(1).max(1e3).optional()
8106
+ throttleMbps: number().min(1).max(1e3).optional(),
8107
+ /** Omitted = `move`, the pre-existing behaviour. */
8108
+ mode: MediaRelocateModeSchema.optional()
8109
+ });
8110
+ /** How many rows still carry NO `locationId` — the population a repoint would
8111
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8112
+ * value that permits a non-blocking `eventMedia` cutover. */
8113
+ var UnstampedEventMediaCountSchema = object({
8114
+ media: number().int().nonnegative(),
8115
+ retrainFrames: number().int().nonnegative(),
8116
+ total: number().int().nonnegative()
8081
8117
  });
8082
8118
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8083
- /** The independently selectable logical storage classes. `recordings`
8084
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8085
- * segments; `eventMedia` is post-analysis blobs. */
8119
+ /** The independently selectable logical storage classes — every class
8120
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8121
+ * Zod enum error where they should meet an explanation.
8122
+ *
8123
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8124
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8125
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8126
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8086
8127
  var StorageMigrationClassSchema = _enum([
8087
8128
  "recordings",
8088
8129
  "recordingsLow",
8089
- "eventMedia"
8130
+ "eventMedia",
8131
+ "backups",
8132
+ "galleryMedia"
8090
8133
  ]);
8091
8134
  /** A destination is always an existing, fully-qualified location id. The
8092
8135
  * migration API intentionally never changes a source location's `basePath`:
@@ -8094,20 +8137,56 @@ var StorageMigrationClassSchema = _enum([
8094
8137
  var StorageMigrationDestinationsSchema = object({
8095
8138
  recordings: string().min(1).optional(),
8096
8139
  recordingsLow: string().min(1).optional(),
8097
- eventMedia: string().min(1).optional()
8140
+ eventMedia: string().min(1).optional(),
8141
+ backups: string().min(1).optional(),
8142
+ galleryMedia: string().min(1).optional()
8098
8143
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8144
+ /**
8145
+ * How a migration sequences the cutover against the byte move.
8146
+ *
8147
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8148
+ * resume. Recording is stopped for the whole move. Right
8149
+ * for a small or a cold class, and the only legal mode for
8150
+ * a `cardinality: 'single'` class.
8151
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8152
+ * refresh, resume, then move the past with everything
8153
+ * running. The pause is three bounded instants (a detach +
8154
+ * attach round, a write-gate drain, a lease) instead of one
8155
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8156
+ * stopped recording under `blocking`; the same move is
8157
+ * seconds of stopped recording under `nonBlocking`.
8158
+ *
8159
+ * The mode is on the JOB, not only on the input, because `status` is where an
8160
+ * operator finds out which one is running.
8161
+ */
8162
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8099
8163
  /** Shared input for planning and starting an orchestrated storage migration. */
8100
8164
  var StorageMigrationInputSchema = object({
8101
8165
  destinations: StorageMigrationDestinationsSchema,
8102
- throttleMbps: number().min(1).max(1e3).optional()
8166
+ throttleMbps: number().min(1).max(1e3).optional(),
8167
+ /** Omitted = `blocking`, which stays the default. */
8168
+ mode: StorageMigrationModeSchema.optional()
8103
8169
  });
8104
- /** The durable coordinator state machine. The only phase that changes default
8105
- * locations is `repointing`, after every selected mover has completed and been
8106
- * verified. */
8170
+ /**
8171
+ * The durable coordinator state machine.
8172
+ *
8173
+ * `blocking`:
8174
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8175
+ *
8176
+ * `nonBlocking`:
8177
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8178
+ *
8179
+ * Same phases, different order plus two new ones — not a second mover.
8180
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8181
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8182
+ * `repointing` is still the only phase that changes a default location.
8183
+ */
8107
8184
  var StorageMigrationPhaseSchema = _enum([
8108
8185
  "planning",
8186
+ "sealing",
8109
8187
  "pausing",
8110
8188
  "moving",
8189
+ "draining",
8111
8190
  "verifying",
8112
8191
  "repointing",
8113
8192
  "refreshing",
@@ -8121,17 +8200,56 @@ var StorageMigrationParticipantSchema = _enum([
8121
8200
  "recorder",
8122
8201
  "analytics"
8123
8202
  ]);
8203
+ /**
8204
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8205
+ *
8206
+ * The long half of a non-blocking migration is `draining`, and it is measured
8207
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8208
+ * existed the only place those numbers appeared was a Loki line, so an operator
8209
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8210
+ * afternoon.
8211
+ *
8212
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8213
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8214
+ * mover — which is the exact failure this is meant to end. The coordinator's
8215
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8216
+ * read `state`; folding the counters costs no extra read and makes the durable
8217
+ * record say afterwards how far a move actually got.
8218
+ *
8219
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8220
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8221
+ * cannot say M, and a 0 there would render as "100 % done".
8222
+ */
8223
+ var StorageMigrationMoveProgressSchema = object({
8224
+ filesMoved: number().int().nonnegative(),
8225
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8226
+ filesTotal: number().int().nonnegative().nullable(),
8227
+ bytesMoved: number().int().nonnegative(),
8228
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8229
+ * crash gets a new mover, and a rate computed from the migration's start
8230
+ * would silently average in the time nothing was running. */
8231
+ startedAt: number(),
8232
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8233
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8234
+ * subtract its own. */
8235
+ observedAt: number()
8236
+ });
8124
8237
  var StorageMigrationMoveSchema = object({
8125
8238
  storageClass: StorageMigrationClassSchema,
8126
8239
  fromLocationId: string(),
8127
8240
  toLocationId: string(),
8128
8241
  moverJobId: string().nullable(),
8129
8242
  state: RelocateJobStateSchema.nullable(),
8130
- error: string().nullable()
8243
+ error: string().nullable(),
8244
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8245
+ progress: StorageMigrationMoveProgressSchema.nullable()
8131
8246
  });
8132
8247
  var StorageMigrationJobSchema = object({
8133
8248
  jobId: string(),
8134
8249
  phase: StorageMigrationPhaseSchema,
8250
+ /** Which order this job is running. `status` is the only place an operator
8251
+ * can tell a seconds-long cutover from a thirty-hour one. */
8252
+ mode: StorageMigrationModeSchema,
8135
8253
  destinations: StorageMigrationDestinationsSchema,
8136
8254
  throttleMbps: number(),
8137
8255
  moves: array(StorageMigrationMoveSchema),
@@ -8144,13 +8262,122 @@ var StorageMigrationJobSchema = object({
8144
8262
  finishedAt: number().nullable(),
8145
8263
  error: string().nullable()
8146
8264
  });
8265
+ var StorageMigrationFindingSchema = object({
8266
+ code: _enum([
8267
+ "sharesDeviceWithSource",
8268
+ "deviceIdentityUnknown",
8269
+ "unstampedEventMediaRows",
8270
+ "blockingOnly",
8271
+ "noMover"
8272
+ ]),
8273
+ storageClass: StorageMigrationClassSchema,
8274
+ /** Human-readable, already carrying the ids and counts. */
8275
+ message: string()
8276
+ });
8147
8277
  var StorageMigrationPlanSchema = object({
8148
8278
  destinations: StorageMigrationDestinationsSchema,
8279
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8280
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8281
+ * it. */
8282
+ mode: StorageMigrationModeSchema,
8149
8283
  moves: array(object({
8150
8284
  storageClass: StorageMigrationClassSchema,
8151
8285
  fromLocationId: string(),
8152
8286
  toLocationId: string()
8153
- }))
8287
+ })),
8288
+ findings: array(StorageMigrationFindingSchema)
8289
+ });
8290
+ /**
8291
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8292
+ *
8293
+ * The coordinator's job record is the state of record for a migration, and its
8294
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8295
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8296
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8297
+ * way because no supported UI path existed. A mover armed like that has no job
8298
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8299
+ *
8300
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8301
+ * orchestrated it.
8302
+ */
8303
+ var StorageMigrationMoverSchema = object({
8304
+ lane: _enum(["footage", "media"]),
8305
+ job: RelocateJobSchema,
8306
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8307
+ * directly against the owning addon. */
8308
+ migrationJobId: string().nullable(),
8309
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8310
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8311
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8312
+ * rate made of two different clocks. */
8313
+ observedAt: number()
8314
+ });
8315
+ /**
8316
+ * What a SOURCE still holds for one storage class — the number that makes a
8317
+ * "drain remaining" action honest rather than hopeful.
8318
+ *
8319
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8320
+ * engine's own selection count for media), never from the resident index: a
8321
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8322
+ * never been told about (D295).
8323
+ *
8324
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8325
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8326
+ * because refusing on an unanswerable read would hide exactly the case an
8327
+ * operator needs to act on.
8328
+ */
8329
+ var StorageMigrationResidueSchema = object({
8330
+ storageClass: StorageMigrationClassSchema,
8331
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8332
+ * move from wherever they are rather than from one named source. */
8333
+ fromLocationId: string(),
8334
+ /** Where a drain would move it — the class's CURRENT default. */
8335
+ toLocationId: string(),
8336
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8337
+ items: number().int().nonnegative().nullable(),
8338
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8339
+ bytes: number().int().nonnegative().nullable()
8340
+ });
8341
+ /**
8342
+ * Run the DRAIN half and nothing else.
8343
+ *
8344
+ * A migration that reached `done` has already repointed, so `start` correctly
8345
+ * refuses its destination ("already the default") — there is nothing left to
8346
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8347
+ * or finish against a work list that was a tenth of the archive (D295), and
8348
+ * before this there was no supported way to run only that half: the only way
8349
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8350
+ *
8351
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8352
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8353
+ * re-repoint a class that is already migrated.
8354
+ */
8355
+ var StorageMigrationDrainInputSchema = object({
8356
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8357
+ * a class whose source is already empty is refused rather than started. */
8358
+ classes: array(StorageMigrationClassSchema).min(1),
8359
+ throttleMbps: number().min(1).max(1e3).optional()
8360
+ });
8361
+ /** What a footage source still holds, asked of the durable hour ledger. */
8362
+ var RelocateResidueInputSchema = object({
8363
+ fromLocationId: string().min(1),
8364
+ /** Narrow to one logical class; omit for every profile on the location. */
8365
+ footageClass: RelocateFootageClassSchema.optional()
8366
+ });
8367
+ /** `null` = the archive could not answer (no ledger on this node, or the
8368
+ * aggregate failed). Never conflated with an empty source. */
8369
+ var RelocateResidueSchema = object({
8370
+ segments: number().int().nonnegative(),
8371
+ bytes: number().int().nonnegative()
8372
+ }).nullable();
8373
+ /** How many rows a media pass would still act on against a given target — the
8374
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8375
+ * never disagree. `null` = the count could not be taken. */
8376
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8377
+ var RelocatableMediaCountInputSchema = object({
8378
+ toLocationId: string().min(1),
8379
+ /** Omitted = `move`. */
8380
+ mode: MediaRelocateModeSchema.optional()
8154
8381
  });
8155
8382
  /**
8156
8383
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8256,6 +8483,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8256
8483
  * two addons declaring the same `id` must agree on `cardinality` (validated
8257
8484
  * at kernel aggregation time, not here).
8258
8485
  */
8486
+ /**
8487
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8488
+ * actually reaches the bytes. It is the constraint that decides which
8489
+ * `storage-provider`s may back a location of that kind.
8490
+ *
8491
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8492
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8493
+ * post-analysis media roots). Only a provider that serves a genuine local
8494
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8495
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8496
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8497
+ * against a same-named local directory that is something else entirely.
8498
+ *
8499
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8500
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8501
+ * service never sees a path, so any provider can back it. `backups` is the
8502
+ * one kind that qualifies today.
8503
+ *
8504
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8505
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8506
+ * refused the configuration; the first write simply went somewhere wrong, and
8507
+ * a recording write that goes wrong surfaces as a silent black window rather
8508
+ * than an error (the read path does not `stat`). This turns that accident into
8509
+ * a declared, enforced, testable refusal.
8510
+ */
8511
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8259
8512
  var StorageLocationDeclarationSchema = object({
8260
8513
  /**
8261
8514
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8275,6 +8528,19 @@ var StorageLocationDeclarationSchema = object({
8275
8528
  */
8276
8529
  cardinality: _enum(["single", "multi"]),
8277
8530
  /**
8531
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8532
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8533
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8534
+ *
8535
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8536
+ * can only over-restrict (refuse a remote provider for a kind that might
8537
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8538
+ * permissive direction and is therefore never inferred — a repo guard
8539
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8540
+ * reached by omission.
8541
+ */
8542
+ access: StorageAccessSchema.optional(),
8543
+ /**
8278
8544
  * When set, the default instance for this location inherits its resolved
8279
8545
  * root from the named location's default instance. Useful for derivative
8280
8546
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18159,8 +18425,10 @@ var TrackSchema = object({
18159
18425
  lastSeen: number(),
18160
18426
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18161
18427
  positions: array(TrackPositionSchema).readonly(),
18162
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18163
- * saveThumbnails policy). */
18428
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18429
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18430
+ * the retired `saveThumbnails` used to gate this and the rolling
18431
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18164
18432
  snapshots: array(TrackSnapshotSchema).readonly(),
18165
18433
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18166
18434
  zonesVisited: array(string()).readonly(),
@@ -19020,6 +19288,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19020
19288
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19021
19289
  kind: "mutation",
19022
19290
  auth: "admin"
19291
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19292
+ kind: "query",
19293
+ auth: "admin"
19023
19294
  }), method(object({}), array(RelocateJobSchema).readonly(), {
19024
19295
  kind: "query",
19025
19296
  auth: "admin"
@@ -20927,7 +21198,10 @@ method(object({
20927
21198
  }), StorageLocationSchema, {
20928
21199
  kind: "mutation",
20929
21200
  auth: "admin"
20930
- }), method(object({ id: string() }), _void(), {
21201
+ }), method(object({
21202
+ id: string(),
21203
+ force: boolean().optional()
21204
+ }), _void(), {
20931
21205
  kind: "mutation",
20932
21206
  auth: "admin"
20933
21207
  }), method(object({ id: string() }), object({
@@ -20976,6 +21250,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20976
21250
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20977
21251
  kind: "mutation",
20978
21252
  auth: "admin"
21253
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21254
+ kind: "mutation",
21255
+ auth: "admin"
20979
21256
  });
20980
21257
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20981
21258
  providerId: string().min(1),
@@ -21374,12 +21651,38 @@ response: record(string(), unknown()) }), object({
21374
21651
  *
21375
21652
  * ## Why this is a capability and not a helper
21376
21653
  *
21377
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21378
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21379
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21380
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21381
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21382
- * load 5,000 rows before ranking anything.
21654
+ * This capability was introduced with the claim that SIX stores in
21655
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21656
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21657
+ * claim was never true, and leaving it here made five stores look like pending
21658
+ * work when three of them have no vector at all. Counted column by column on
21659
+ * 2026-08-30, exactly THREE ever held one:
21660
+ *
21661
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21662
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21663
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21664
+ * face, migrated 2026-08-30 into its OWN index (see below).
21665
+ *
21666
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21667
+ * and `identities` store a name; the event store stores no derivative vector.
21668
+ * They are not migration candidates and never were.
21669
+ *
21670
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21671
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21672
+ * rows before ranking anything.
21673
+ *
21674
+ * ## One index per COMPARISON, never per encoder
21675
+ *
21676
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21677
+ * model, and they still get two indexes. An index is a set of things that are
21678
+ * ranked against each other and that live and die together, and these two are
21679
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21680
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21681
+ * forever and is the gallery every recognition ranks against. One index would
21682
+ * mean every gallery load and every reconcile carried a filter whose failure
21683
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21684
+ * person's only sample. The dimension they share is not a reason to share an
21685
+ * index; the question they answer is, and it differs.
21383
21686
  *
21384
21687
  * The fix is not a faster loop, it is a different backend — and the backend
21385
21688
  * should be replaceable without touching six callers. So: a singleton
@@ -21484,7 +21787,20 @@ var VectorQueryResultSchema = object({
21484
21787
  */
21485
21788
  scanned: number(),
21486
21789
  /** True when the backend could not consider every row that passed the filter. */
21487
- truncated: boolean()
21790
+ truncated: boolean(),
21791
+ /**
21792
+ * The `topK` the backend actually ran with.
21793
+ *
21794
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21795
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21796
+ * own log rather than in its answer. That is how an audit asking for 20,000
21797
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21798
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21799
+ * MUCH, in the return value, where the caller cannot fail to see it.
21800
+ *
21801
+ * Equals the requested `topK` whenever nothing was lowered.
21802
+ */
21803
+ effectiveTopK: number().int().positive()
21488
21804
  });
21489
21805
  var VectorDeleteInputSchema = object({
21490
21806
  index: string(),
@@ -21513,6 +21829,68 @@ var VectorGetResultSchema = object({ items: array(object({
21513
21829
  id: string(),
21514
21830
  metadata: VectorMetadataSchema
21515
21831
  })) });
21832
+ /**
21833
+ * Ids to read back WITH their vectors.
21834
+ *
21835
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21836
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21837
+ * caller depends on that promise. This one promises the opposite.
21838
+ *
21839
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21840
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21841
+ * a per-face cross-process KNN would be a network round trip inside the
21842
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21843
+ * it requires the index to hand the floats back. Without this method the only
21844
+ * way to keep a readable vector is a JSON column, which is the thing this
21845
+ * capability exists to delete.
21846
+ *
21847
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21848
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21849
+ */
21850
+ var VectorFetchInputSchema = object({
21851
+ index: string(),
21852
+ ids: array(string())
21853
+ });
21854
+ var VectorFetchResultSchema = object({ items: array(object({
21855
+ id: string(),
21856
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21857
+ vector: string(),
21858
+ metadata: VectorMetadataSchema
21859
+ })) });
21860
+ /**
21861
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21862
+ *
21863
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21864
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21865
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21866
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21867
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21868
+ * looked" for as long as anyone cared to read it.
21869
+ *
21870
+ * This is the primitive that question actually needs: a bounded page, ordered
21871
+ * by the backend's own row order, costing no distance computation at all.
21872
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21873
+ * the full-table read this capability was built to stop.
21874
+ */
21875
+ var VectorScanInputSchema = object({
21876
+ index: string(),
21877
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21878
+ cursor: number().int().nonnegative().default(0),
21879
+ limit: number().int().positive()
21880
+ });
21881
+ var VectorScanResultSchema = object({
21882
+ items: array(object({
21883
+ id: string(),
21884
+ metadata: VectorMetadataSchema
21885
+ })),
21886
+ /**
21887
+ * Where the next page starts, or `null` when the walk reached the end.
21888
+ *
21889
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21890
+ * from a short page: a backend is free to return fewer rows than asked.
21891
+ */
21892
+ nextCursor: number().int().nonnegative().nullable()
21893
+ });
21516
21894
  var VectorStatsInputSchema = object({ index: string() });
21517
21895
  var VectorStatsResultSchema = object({
21518
21896
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21531,7 +21909,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21531
21909
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21532
21910
  kind: "mutation",
21533
21911
  auth: "admin"
21534
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21912
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21535
21913
  kind: "mutation",
21536
21914
  auth: "admin"
21537
21915
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28158,6 +28536,9 @@ method(object({
28158
28536
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28159
28537
  kind: "query",
28160
28538
  auth: "admin"
28539
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28540
+ kind: "query",
28541
+ auth: "admin"
28161
28542
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28162
28543
  kind: "mutation",
28163
28544
  auth: "admin"
@@ -34792,6 +35173,18 @@ Object.freeze({
34792
35173
  addonId: null,
34793
35174
  access: "create"
34794
35175
  },
35176
+ "pipelineAnalytics.countRelocatableMedia": {
35177
+ capName: "pipeline-analytics",
35178
+ capScope: "device",
35179
+ addonId: null,
35180
+ access: "view"
35181
+ },
35182
+ "pipelineAnalytics.countUnstampedEventMedia": {
35183
+ capName: "pipeline-analytics",
35184
+ capScope: "device",
35185
+ addonId: null,
35186
+ access: "view"
35187
+ },
34795
35188
  "pipelineAnalytics.deleteDeviceEvents": {
34796
35189
  capName: "pipeline-analytics",
34797
35190
  capScope: "device",
@@ -35950,6 +36343,12 @@ Object.freeze({
35950
36343
  addonId: null,
35951
36344
  access: "view"
35952
36345
  },
36346
+ "recording.getRelocateResidue": {
36347
+ capName: "recording",
36348
+ capScope: "system",
36349
+ addonId: null,
36350
+ access: "view"
36351
+ },
35953
36352
  "recording.getStorageMigrationMoveStatus": {
35954
36353
  capName: "recording",
35955
36354
  capScope: "system",
@@ -36496,12 +36895,30 @@ Object.freeze({
36496
36895
  addonId: null,
36497
36896
  access: "create"
36498
36897
  },
36898
+ "storageMigration.drain": {
36899
+ capName: "storage-migration",
36900
+ capScope: "system",
36901
+ addonId: null,
36902
+ access: "create"
36903
+ },
36904
+ "storageMigration.movers": {
36905
+ capName: "storage-migration",
36906
+ capScope: "system",
36907
+ addonId: null,
36908
+ access: "view"
36909
+ },
36499
36910
  "storageMigration.plan": {
36500
36911
  capName: "storage-migration",
36501
36912
  capScope: "system",
36502
36913
  addonId: null,
36503
36914
  access: "view"
36504
36915
  },
36916
+ "storageMigration.residue": {
36917
+ capName: "storage-migration",
36918
+ capScope: "system",
36919
+ addonId: null,
36920
+ access: "view"
36921
+ },
36505
36922
  "storageMigration.start": {
36506
36923
  capName: "storage-migration",
36507
36924
  capScope: "system",
@@ -37336,6 +37753,12 @@ Object.freeze({
37336
37753
  addonId: null,
37337
37754
  access: "delete"
37338
37755
  },
37756
+ "vectorStore.fetchByIds": {
37757
+ capName: "vector-store",
37758
+ capScope: "system",
37759
+ addonId: null,
37760
+ access: "view"
37761
+ },
37339
37762
  "vectorStore.getByIds": {
37340
37763
  capName: "vector-store",
37341
37764
  capScope: "system",
@@ -37348,6 +37771,12 @@ Object.freeze({
37348
37771
  addonId: null,
37349
37772
  access: "view"
37350
37773
  },
37774
+ "vectorStore.scan": {
37775
+ capName: "vector-store",
37776
+ capScope: "system",
37777
+ addonId: null,
37778
+ access: "view"
37779
+ },
37351
37780
  "vectorStore.stats": {
37352
37781
  capName: "vector-store",
37353
37782
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8076,18 +8076,61 @@ var RelocateFootageInputSchema = object({
8076
8076
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8077
8077
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8078
8078
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8079
+ /**
8080
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8081
+ * mover (the engine already walks both collections with a timestamp cursor and
8082
+ * already has a stamp-without-copy path).
8083
+ *
8084
+ * - `move` — the default and the historical behaviour: event-media and
8085
+ * retrain blobs move to `toLocationId` and their rows are
8086
+ * stamped. The enrolled gallery is skipped (D197).
8087
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8088
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8089
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8090
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8091
+ * instant a repoint moves that pointer the row reads from the
8092
+ * new disk while its bytes are on the old one.
8093
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8094
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8095
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8096
+ * never run beside a live second location: it is stop-the-world
8097
+ * by construction, which is acceptable only because the gallery
8098
+ * is a few KB per enrolled sample.
8099
+ */
8100
+ var MediaRelocateModeSchema = _enum([
8101
+ "move",
8102
+ "seal",
8103
+ "gallery"
8104
+ ]);
8079
8105
  var RelocateMediaInputSchema = object({
8080
8106
  toLocationId: string(),
8081
- throttleMbps: number().min(1).max(1e3).optional()
8107
+ throttleMbps: number().min(1).max(1e3).optional(),
8108
+ /** Omitted = `move`, the pre-existing behaviour. */
8109
+ mode: MediaRelocateModeSchema.optional()
8110
+ });
8111
+ /** How many rows still carry NO `locationId` — the population a repoint would
8112
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8113
+ * value that permits a non-blocking `eventMedia` cutover. */
8114
+ var UnstampedEventMediaCountSchema = object({
8115
+ media: number().int().nonnegative(),
8116
+ retrainFrames: number().int().nonnegative(),
8117
+ total: number().int().nonnegative()
8082
8118
  });
8083
8119
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8084
- /** The independently selectable logical storage classes. `recordings`
8085
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8086
- * segments; `eventMedia` is post-analysis blobs. */
8120
+ /** The independently selectable logical storage classes — every class
8121
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8122
+ * Zod enum error where they should meet an explanation.
8123
+ *
8124
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8125
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8126
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8127
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8087
8128
  var StorageMigrationClassSchema = _enum([
8088
8129
  "recordings",
8089
8130
  "recordingsLow",
8090
- "eventMedia"
8131
+ "eventMedia",
8132
+ "backups",
8133
+ "galleryMedia"
8091
8134
  ]);
8092
8135
  /** A destination is always an existing, fully-qualified location id. The
8093
8136
  * migration API intentionally never changes a source location's `basePath`:
@@ -8095,20 +8138,56 @@ var StorageMigrationClassSchema = _enum([
8095
8138
  var StorageMigrationDestinationsSchema = object({
8096
8139
  recordings: string().min(1).optional(),
8097
8140
  recordingsLow: string().min(1).optional(),
8098
- eventMedia: string().min(1).optional()
8141
+ eventMedia: string().min(1).optional(),
8142
+ backups: string().min(1).optional(),
8143
+ galleryMedia: string().min(1).optional()
8099
8144
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8145
+ /**
8146
+ * How a migration sequences the cutover against the byte move.
8147
+ *
8148
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8149
+ * resume. Recording is stopped for the whole move. Right
8150
+ * for a small or a cold class, and the only legal mode for
8151
+ * a `cardinality: 'single'` class.
8152
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8153
+ * refresh, resume, then move the past with everything
8154
+ * running. The pause is three bounded instants (a detach +
8155
+ * attach round, a write-gate drain, a lease) instead of one
8156
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8157
+ * stopped recording under `blocking`; the same move is
8158
+ * seconds of stopped recording under `nonBlocking`.
8159
+ *
8160
+ * The mode is on the JOB, not only on the input, because `status` is where an
8161
+ * operator finds out which one is running.
8162
+ */
8163
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8100
8164
  /** Shared input for planning and starting an orchestrated storage migration. */
8101
8165
  var StorageMigrationInputSchema = object({
8102
8166
  destinations: StorageMigrationDestinationsSchema,
8103
- throttleMbps: number().min(1).max(1e3).optional()
8167
+ throttleMbps: number().min(1).max(1e3).optional(),
8168
+ /** Omitted = `blocking`, which stays the default. */
8169
+ mode: StorageMigrationModeSchema.optional()
8104
8170
  });
8105
- /** The durable coordinator state machine. The only phase that changes default
8106
- * locations is `repointing`, after every selected mover has completed and been
8107
- * verified. */
8171
+ /**
8172
+ * The durable coordinator state machine.
8173
+ *
8174
+ * `blocking`:
8175
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8176
+ *
8177
+ * `nonBlocking`:
8178
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8179
+ *
8180
+ * Same phases, different order plus two new ones — not a second mover.
8181
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8182
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8183
+ * `repointing` is still the only phase that changes a default location.
8184
+ */
8108
8185
  var StorageMigrationPhaseSchema = _enum([
8109
8186
  "planning",
8187
+ "sealing",
8110
8188
  "pausing",
8111
8189
  "moving",
8190
+ "draining",
8112
8191
  "verifying",
8113
8192
  "repointing",
8114
8193
  "refreshing",
@@ -8122,17 +8201,56 @@ var StorageMigrationParticipantSchema = _enum([
8122
8201
  "recorder",
8123
8202
  "analytics"
8124
8203
  ]);
8204
+ /**
8205
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8206
+ *
8207
+ * The long half of a non-blocking migration is `draining`, and it is measured
8208
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8209
+ * existed the only place those numbers appeared was a Loki line, so an operator
8210
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8211
+ * afternoon.
8212
+ *
8213
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8214
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8215
+ * mover — which is the exact failure this is meant to end. The coordinator's
8216
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8217
+ * read `state`; folding the counters costs no extra read and makes the durable
8218
+ * record say afterwards how far a move actually got.
8219
+ *
8220
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8221
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8222
+ * cannot say M, and a 0 there would render as "100 % done".
8223
+ */
8224
+ var StorageMigrationMoveProgressSchema = object({
8225
+ filesMoved: number().int().nonnegative(),
8226
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8227
+ filesTotal: number().int().nonnegative().nullable(),
8228
+ bytesMoved: number().int().nonnegative(),
8229
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8230
+ * crash gets a new mover, and a rate computed from the migration's start
8231
+ * would silently average in the time nothing was running. */
8232
+ startedAt: number(),
8233
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8234
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8235
+ * subtract its own. */
8236
+ observedAt: number()
8237
+ });
8125
8238
  var StorageMigrationMoveSchema = object({
8126
8239
  storageClass: StorageMigrationClassSchema,
8127
8240
  fromLocationId: string(),
8128
8241
  toLocationId: string(),
8129
8242
  moverJobId: string().nullable(),
8130
8243
  state: RelocateJobStateSchema.nullable(),
8131
- error: string().nullable()
8244
+ error: string().nullable(),
8245
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8246
+ progress: StorageMigrationMoveProgressSchema.nullable()
8132
8247
  });
8133
8248
  var StorageMigrationJobSchema = object({
8134
8249
  jobId: string(),
8135
8250
  phase: StorageMigrationPhaseSchema,
8251
+ /** Which order this job is running. `status` is the only place an operator
8252
+ * can tell a seconds-long cutover from a thirty-hour one. */
8253
+ mode: StorageMigrationModeSchema,
8136
8254
  destinations: StorageMigrationDestinationsSchema,
8137
8255
  throttleMbps: number(),
8138
8256
  moves: array(StorageMigrationMoveSchema),
@@ -8145,13 +8263,122 @@ var StorageMigrationJobSchema = object({
8145
8263
  finishedAt: number().nullable(),
8146
8264
  error: string().nullable()
8147
8265
  });
8266
+ var StorageMigrationFindingSchema = object({
8267
+ code: _enum([
8268
+ "sharesDeviceWithSource",
8269
+ "deviceIdentityUnknown",
8270
+ "unstampedEventMediaRows",
8271
+ "blockingOnly",
8272
+ "noMover"
8273
+ ]),
8274
+ storageClass: StorageMigrationClassSchema,
8275
+ /** Human-readable, already carrying the ids and counts. */
8276
+ message: string()
8277
+ });
8148
8278
  var StorageMigrationPlanSchema = object({
8149
8279
  destinations: StorageMigrationDestinationsSchema,
8280
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8281
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8282
+ * it. */
8283
+ mode: StorageMigrationModeSchema,
8150
8284
  moves: array(object({
8151
8285
  storageClass: StorageMigrationClassSchema,
8152
8286
  fromLocationId: string(),
8153
8287
  toLocationId: string()
8154
- }))
8288
+ })),
8289
+ findings: array(StorageMigrationFindingSchema)
8290
+ });
8291
+ /**
8292
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8293
+ *
8294
+ * The coordinator's job record is the state of record for a migration, and its
8295
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8296
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8297
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8298
+ * way because no supported UI path existed. A mover armed like that has no job
8299
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8300
+ *
8301
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8302
+ * orchestrated it.
8303
+ */
8304
+ var StorageMigrationMoverSchema = object({
8305
+ lane: _enum(["footage", "media"]),
8306
+ job: RelocateJobSchema,
8307
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8308
+ * directly against the owning addon. */
8309
+ migrationJobId: string().nullable(),
8310
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8311
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8312
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8313
+ * rate made of two different clocks. */
8314
+ observedAt: number()
8315
+ });
8316
+ /**
8317
+ * What a SOURCE still holds for one storage class — the number that makes a
8318
+ * "drain remaining" action honest rather than hopeful.
8319
+ *
8320
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8321
+ * engine's own selection count for media), never from the resident index: a
8322
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8323
+ * never been told about (D295).
8324
+ *
8325
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8326
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8327
+ * because refusing on an unanswerable read would hide exactly the case an
8328
+ * operator needs to act on.
8329
+ */
8330
+ var StorageMigrationResidueSchema = object({
8331
+ storageClass: StorageMigrationClassSchema,
8332
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8333
+ * move from wherever they are rather than from one named source. */
8334
+ fromLocationId: string(),
8335
+ /** Where a drain would move it — the class's CURRENT default. */
8336
+ toLocationId: string(),
8337
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8338
+ items: number().int().nonnegative().nullable(),
8339
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8340
+ bytes: number().int().nonnegative().nullable()
8341
+ });
8342
+ /**
8343
+ * Run the DRAIN half and nothing else.
8344
+ *
8345
+ * A migration that reached `done` has already repointed, so `start` correctly
8346
+ * refuses its destination ("already the default") — there is nothing left to
8347
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8348
+ * or finish against a work list that was a tenth of the archive (D295), and
8349
+ * before this there was no supported way to run only that half: the only way
8350
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8351
+ *
8352
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8353
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8354
+ * re-repoint a class that is already migrated.
8355
+ */
8356
+ var StorageMigrationDrainInputSchema = object({
8357
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8358
+ * a class whose source is already empty is refused rather than started. */
8359
+ classes: array(StorageMigrationClassSchema).min(1),
8360
+ throttleMbps: number().min(1).max(1e3).optional()
8361
+ });
8362
+ /** What a footage source still holds, asked of the durable hour ledger. */
8363
+ var RelocateResidueInputSchema = object({
8364
+ fromLocationId: string().min(1),
8365
+ /** Narrow to one logical class; omit for every profile on the location. */
8366
+ footageClass: RelocateFootageClassSchema.optional()
8367
+ });
8368
+ /** `null` = the archive could not answer (no ledger on this node, or the
8369
+ * aggregate failed). Never conflated with an empty source. */
8370
+ var RelocateResidueSchema = object({
8371
+ segments: number().int().nonnegative(),
8372
+ bytes: number().int().nonnegative()
8373
+ }).nullable();
8374
+ /** How many rows a media pass would still act on against a given target — the
8375
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8376
+ * never disagree. `null` = the count could not be taken. */
8377
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8378
+ var RelocatableMediaCountInputSchema = object({
8379
+ toLocationId: string().min(1),
8380
+ /** Omitted = `move`. */
8381
+ mode: MediaRelocateModeSchema.optional()
8155
8382
  });
8156
8383
  /**
8157
8384
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8257,6 +8484,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8257
8484
  * two addons declaring the same `id` must agree on `cardinality` (validated
8258
8485
  * at kernel aggregation time, not here).
8259
8486
  */
8487
+ /**
8488
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8489
+ * actually reaches the bytes. It is the constraint that decides which
8490
+ * `storage-provider`s may back a location of that kind.
8491
+ *
8492
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8493
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8494
+ * post-analysis media roots). Only a provider that serves a genuine local
8495
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8496
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8497
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8498
+ * against a same-named local directory that is something else entirely.
8499
+ *
8500
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8501
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8502
+ * service never sees a path, so any provider can back it. `backups` is the
8503
+ * one kind that qualifies today.
8504
+ *
8505
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8506
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8507
+ * refused the configuration; the first write simply went somewhere wrong, and
8508
+ * a recording write that goes wrong surfaces as a silent black window rather
8509
+ * than an error (the read path does not `stat`). This turns that accident into
8510
+ * a declared, enforced, testable refusal.
8511
+ */
8512
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8260
8513
  var StorageLocationDeclarationSchema = object({
8261
8514
  /**
8262
8515
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8276,6 +8529,19 @@ var StorageLocationDeclarationSchema = object({
8276
8529
  */
8277
8530
  cardinality: _enum(["single", "multi"]),
8278
8531
  /**
8532
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8533
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8534
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8535
+ *
8536
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8537
+ * can only over-restrict (refuse a remote provider for a kind that might
8538
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8539
+ * permissive direction and is therefore never inferred — a repo guard
8540
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8541
+ * reached by omission.
8542
+ */
8543
+ access: StorageAccessSchema.optional(),
8544
+ /**
8279
8545
  * When set, the default instance for this location inherits its resolved
8280
8546
  * root from the named location's default instance. Useful for derivative
8281
8547
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18160,8 +18426,10 @@ var TrackSchema = object({
18160
18426
  lastSeen: number(),
18161
18427
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18162
18428
  positions: array(TrackPositionSchema).readonly(),
18163
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18164
- * saveThumbnails policy). */
18429
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18430
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18431
+ * the retired `saveThumbnails` used to gate this and the rolling
18432
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18165
18433
  snapshots: array(TrackSnapshotSchema).readonly(),
18166
18434
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18167
18435
  zonesVisited: array(string()).readonly(),
@@ -19021,6 +19289,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19021
19289
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19022
19290
  kind: "mutation",
19023
19291
  auth: "admin"
19292
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19293
+ kind: "query",
19294
+ auth: "admin"
19024
19295
  }), method(object({}), array(RelocateJobSchema).readonly(), {
19025
19296
  kind: "query",
19026
19297
  auth: "admin"
@@ -20928,7 +21199,10 @@ method(object({
20928
21199
  }), StorageLocationSchema, {
20929
21200
  kind: "mutation",
20930
21201
  auth: "admin"
20931
- }), method(object({ id: string() }), _void(), {
21202
+ }), method(object({
21203
+ id: string(),
21204
+ force: boolean().optional()
21205
+ }), _void(), {
20932
21206
  kind: "mutation",
20933
21207
  auth: "admin"
20934
21208
  }), method(object({ id: string() }), object({
@@ -20977,6 +21251,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20977
21251
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20978
21252
  kind: "mutation",
20979
21253
  auth: "admin"
21254
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21255
+ kind: "mutation",
21256
+ auth: "admin"
20980
21257
  });
20981
21258
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20982
21259
  providerId: string().min(1),
@@ -21375,12 +21652,38 @@ response: record(string(), unknown()) }), object({
21375
21652
  *
21376
21653
  * ## Why this is a capability and not a helper
21377
21654
  *
21378
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21379
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21380
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21381
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21382
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21383
- * load 5,000 rows before ranking anything.
21655
+ * This capability was introduced with the claim that SIX stores in
21656
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21657
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21658
+ * claim was never true, and leaving it here made five stores look like pending
21659
+ * work when three of them have no vector at all. Counted column by column on
21660
+ * 2026-08-30, exactly THREE ever held one:
21661
+ *
21662
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21663
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21664
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21665
+ * face, migrated 2026-08-30 into its OWN index (see below).
21666
+ *
21667
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21668
+ * and `identities` store a name; the event store stores no derivative vector.
21669
+ * They are not migration candidates and never were.
21670
+ *
21671
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21672
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21673
+ * rows before ranking anything.
21674
+ *
21675
+ * ## One index per COMPARISON, never per encoder
21676
+ *
21677
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21678
+ * model, and they still get two indexes. An index is a set of things that are
21679
+ * ranked against each other and that live and die together, and these two are
21680
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21681
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21682
+ * forever and is the gallery every recognition ranks against. One index would
21683
+ * mean every gallery load and every reconcile carried a filter whose failure
21684
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21685
+ * person's only sample. The dimension they share is not a reason to share an
21686
+ * index; the question they answer is, and it differs.
21384
21687
  *
21385
21688
  * The fix is not a faster loop, it is a different backend — and the backend
21386
21689
  * should be replaceable without touching six callers. So: a singleton
@@ -21485,7 +21788,20 @@ var VectorQueryResultSchema = object({
21485
21788
  */
21486
21789
  scanned: number(),
21487
21790
  /** True when the backend could not consider every row that passed the filter. */
21488
- truncated: boolean()
21791
+ truncated: boolean(),
21792
+ /**
21793
+ * The `topK` the backend actually ran with.
21794
+ *
21795
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21796
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21797
+ * own log rather than in its answer. That is how an audit asking for 20,000
21798
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21799
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21800
+ * MUCH, in the return value, where the caller cannot fail to see it.
21801
+ *
21802
+ * Equals the requested `topK` whenever nothing was lowered.
21803
+ */
21804
+ effectiveTopK: number().int().positive()
21489
21805
  });
21490
21806
  var VectorDeleteInputSchema = object({
21491
21807
  index: string(),
@@ -21514,6 +21830,68 @@ var VectorGetResultSchema = object({ items: array(object({
21514
21830
  id: string(),
21515
21831
  metadata: VectorMetadataSchema
21516
21832
  })) });
21833
+ /**
21834
+ * Ids to read back WITH their vectors.
21835
+ *
21836
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21837
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21838
+ * caller depends on that promise. This one promises the opposite.
21839
+ *
21840
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21841
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21842
+ * a per-face cross-process KNN would be a network round trip inside the
21843
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21844
+ * it requires the index to hand the floats back. Without this method the only
21845
+ * way to keep a readable vector is a JSON column, which is the thing this
21846
+ * capability exists to delete.
21847
+ *
21848
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21849
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21850
+ */
21851
+ var VectorFetchInputSchema = object({
21852
+ index: string(),
21853
+ ids: array(string())
21854
+ });
21855
+ var VectorFetchResultSchema = object({ items: array(object({
21856
+ id: string(),
21857
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21858
+ vector: string(),
21859
+ metadata: VectorMetadataSchema
21860
+ })) });
21861
+ /**
21862
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21863
+ *
21864
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21865
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21866
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21867
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21868
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21869
+ * looked" for as long as anyone cared to read it.
21870
+ *
21871
+ * This is the primitive that question actually needs: a bounded page, ordered
21872
+ * by the backend's own row order, costing no distance computation at all.
21873
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21874
+ * the full-table read this capability was built to stop.
21875
+ */
21876
+ var VectorScanInputSchema = object({
21877
+ index: string(),
21878
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21879
+ cursor: number().int().nonnegative().default(0),
21880
+ limit: number().int().positive()
21881
+ });
21882
+ var VectorScanResultSchema = object({
21883
+ items: array(object({
21884
+ id: string(),
21885
+ metadata: VectorMetadataSchema
21886
+ })),
21887
+ /**
21888
+ * Where the next page starts, or `null` when the walk reached the end.
21889
+ *
21890
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21891
+ * from a short page: a backend is free to return fewer rows than asked.
21892
+ */
21893
+ nextCursor: number().int().nonnegative().nullable()
21894
+ });
21517
21895
  var VectorStatsInputSchema = object({ index: string() });
21518
21896
  var VectorStatsResultSchema = object({
21519
21897
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21532,7 +21910,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21532
21910
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21533
21911
  kind: "mutation",
21534
21912
  auth: "admin"
21535
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21913
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21536
21914
  kind: "mutation",
21537
21915
  auth: "admin"
21538
21916
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28159,6 +28537,9 @@ method(object({
28159
28537
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28160
28538
  kind: "query",
28161
28539
  auth: "admin"
28540
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28541
+ kind: "query",
28542
+ auth: "admin"
28162
28543
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28163
28544
  kind: "mutation",
28164
28545
  auth: "admin"
@@ -34793,6 +35174,18 @@ Object.freeze({
34793
35174
  addonId: null,
34794
35175
  access: "create"
34795
35176
  },
35177
+ "pipelineAnalytics.countRelocatableMedia": {
35178
+ capName: "pipeline-analytics",
35179
+ capScope: "device",
35180
+ addonId: null,
35181
+ access: "view"
35182
+ },
35183
+ "pipelineAnalytics.countUnstampedEventMedia": {
35184
+ capName: "pipeline-analytics",
35185
+ capScope: "device",
35186
+ addonId: null,
35187
+ access: "view"
35188
+ },
34796
35189
  "pipelineAnalytics.deleteDeviceEvents": {
34797
35190
  capName: "pipeline-analytics",
34798
35191
  capScope: "device",
@@ -35951,6 +36344,12 @@ Object.freeze({
35951
36344
  addonId: null,
35952
36345
  access: "view"
35953
36346
  },
36347
+ "recording.getRelocateResidue": {
36348
+ capName: "recording",
36349
+ capScope: "system",
36350
+ addonId: null,
36351
+ access: "view"
36352
+ },
35954
36353
  "recording.getStorageMigrationMoveStatus": {
35955
36354
  capName: "recording",
35956
36355
  capScope: "system",
@@ -36497,12 +36896,30 @@ Object.freeze({
36497
36896
  addonId: null,
36498
36897
  access: "create"
36499
36898
  },
36899
+ "storageMigration.drain": {
36900
+ capName: "storage-migration",
36901
+ capScope: "system",
36902
+ addonId: null,
36903
+ access: "create"
36904
+ },
36905
+ "storageMigration.movers": {
36906
+ capName: "storage-migration",
36907
+ capScope: "system",
36908
+ addonId: null,
36909
+ access: "view"
36910
+ },
36500
36911
  "storageMigration.plan": {
36501
36912
  capName: "storage-migration",
36502
36913
  capScope: "system",
36503
36914
  addonId: null,
36504
36915
  access: "view"
36505
36916
  },
36917
+ "storageMigration.residue": {
36918
+ capName: "storage-migration",
36919
+ capScope: "system",
36920
+ addonId: null,
36921
+ access: "view"
36922
+ },
36506
36923
  "storageMigration.start": {
36507
36924
  capName: "storage-migration",
36508
36925
  capScope: "system",
@@ -37337,6 +37754,12 @@ Object.freeze({
37337
37754
  addonId: null,
37338
37755
  access: "delete"
37339
37756
  },
37757
+ "vectorStore.fetchByIds": {
37758
+ capName: "vector-store",
37759
+ capScope: "system",
37760
+ addonId: null,
37761
+ access: "view"
37762
+ },
37340
37763
  "vectorStore.getByIds": {
37341
37764
  capName: "vector-store",
37342
37765
  capScope: "system",
@@ -37349,6 +37772,12 @@ Object.freeze({
37349
37772
  addonId: null,
37350
37773
  access: "view"
37351
37774
  },
37775
+ "vectorStore.scan": {
37776
+ capName: "vector-store",
37777
+ capScope: "system",
37778
+ addonId: null,
37779
+ access: "view"
37780
+ },
37352
37781
  "vectorStore.stats": {
37353
37782
  capName: "vector-store",
37354
37783
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreo",
3
- "version": "0.2.42",
3
+ "version": "0.2.45",
4
4
  "description": "Dreo smart-device (fan / air-circulator / purifier / heater / humidifier) device-provider addon for CamStack — wraps the @apocaliss92/nodedreo Dreo cloud client (REST + WebSocket)",
5
5
  "keywords": [
6
6
  "camstack",