@camstack/addon-provider-rtsp 1.2.42 → 1.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
@@ -8095,18 +8095,61 @@ var RelocateFootageInputSchema = object({
8095
8095
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8096
8096
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8097
8097
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8098
+ /**
8099
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8100
+ * mover (the engine already walks both collections with a timestamp cursor and
8101
+ * already has a stamp-without-copy path).
8102
+ *
8103
+ * - `move` — the default and the historical behaviour: event-media and
8104
+ * retrain blobs move to `toLocationId` and their rows are
8105
+ * stamped. The enrolled gallery is skipped (D197).
8106
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8107
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8108
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8109
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8110
+ * instant a repoint moves that pointer the row reads from the
8111
+ * new disk while its bytes are on the old one.
8112
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8113
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8114
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8115
+ * never run beside a live second location: it is stop-the-world
8116
+ * by construction, which is acceptable only because the gallery
8117
+ * is a few KB per enrolled sample.
8118
+ */
8119
+ var MediaRelocateModeSchema = _enum([
8120
+ "move",
8121
+ "seal",
8122
+ "gallery"
8123
+ ]);
8098
8124
  var RelocateMediaInputSchema = object({
8099
8125
  toLocationId: string(),
8100
- throttleMbps: number().min(1).max(1e3).optional()
8126
+ throttleMbps: number().min(1).max(1e3).optional(),
8127
+ /** Omitted = `move`, the pre-existing behaviour. */
8128
+ mode: MediaRelocateModeSchema.optional()
8129
+ });
8130
+ /** How many rows still carry NO `locationId` — the population a repoint would
8131
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8132
+ * value that permits a non-blocking `eventMedia` cutover. */
8133
+ var UnstampedEventMediaCountSchema = object({
8134
+ media: number().int().nonnegative(),
8135
+ retrainFrames: number().int().nonnegative(),
8136
+ total: number().int().nonnegative()
8101
8137
  });
8102
8138
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8103
- /** The independently selectable logical storage classes. `recordings`
8104
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8105
- * segments; `eventMedia` is post-analysis blobs. */
8139
+ /** The independently selectable logical storage classes — every class
8140
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8141
+ * Zod enum error where they should meet an explanation.
8142
+ *
8143
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8144
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8145
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8146
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8106
8147
  var StorageMigrationClassSchema = _enum([
8107
8148
  "recordings",
8108
8149
  "recordingsLow",
8109
- "eventMedia"
8150
+ "eventMedia",
8151
+ "backups",
8152
+ "galleryMedia"
8110
8153
  ]);
8111
8154
  /** A destination is always an existing, fully-qualified location id. The
8112
8155
  * migration API intentionally never changes a source location's `basePath`:
@@ -8114,20 +8157,56 @@ var StorageMigrationClassSchema = _enum([
8114
8157
  var StorageMigrationDestinationsSchema = object({
8115
8158
  recordings: string().min(1).optional(),
8116
8159
  recordingsLow: string().min(1).optional(),
8117
- eventMedia: string().min(1).optional()
8160
+ eventMedia: string().min(1).optional(),
8161
+ backups: string().min(1).optional(),
8162
+ galleryMedia: string().min(1).optional()
8118
8163
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8164
+ /**
8165
+ * How a migration sequences the cutover against the byte move.
8166
+ *
8167
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8168
+ * resume. Recording is stopped for the whole move. Right
8169
+ * for a small or a cold class, and the only legal mode for
8170
+ * a `cardinality: 'single'` class.
8171
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8172
+ * refresh, resume, then move the past with everything
8173
+ * running. The pause is three bounded instants (a detach +
8174
+ * attach round, a write-gate drain, a lease) instead of one
8175
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8176
+ * stopped recording under `blocking`; the same move is
8177
+ * seconds of stopped recording under `nonBlocking`.
8178
+ *
8179
+ * The mode is on the JOB, not only on the input, because `status` is where an
8180
+ * operator finds out which one is running.
8181
+ */
8182
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8119
8183
  /** Shared input for planning and starting an orchestrated storage migration. */
8120
8184
  var StorageMigrationInputSchema = object({
8121
8185
  destinations: StorageMigrationDestinationsSchema,
8122
- throttleMbps: number().min(1).max(1e3).optional()
8186
+ throttleMbps: number().min(1).max(1e3).optional(),
8187
+ /** Omitted = `blocking`, which stays the default. */
8188
+ mode: StorageMigrationModeSchema.optional()
8123
8189
  });
8124
- /** The durable coordinator state machine. The only phase that changes default
8125
- * locations is `repointing`, after every selected mover has completed and been
8126
- * verified. */
8190
+ /**
8191
+ * The durable coordinator state machine.
8192
+ *
8193
+ * `blocking`:
8194
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8195
+ *
8196
+ * `nonBlocking`:
8197
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8198
+ *
8199
+ * Same phases, different order plus two new ones — not a second mover.
8200
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8201
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8202
+ * `repointing` is still the only phase that changes a default location.
8203
+ */
8127
8204
  var StorageMigrationPhaseSchema = _enum([
8128
8205
  "planning",
8206
+ "sealing",
8129
8207
  "pausing",
8130
8208
  "moving",
8209
+ "draining",
8131
8210
  "verifying",
8132
8211
  "repointing",
8133
8212
  "refreshing",
@@ -8141,17 +8220,56 @@ var StorageMigrationParticipantSchema = _enum([
8141
8220
  "recorder",
8142
8221
  "analytics"
8143
8222
  ]);
8223
+ /**
8224
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8225
+ *
8226
+ * The long half of a non-blocking migration is `draining`, and it is measured
8227
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8228
+ * existed the only place those numbers appeared was a Loki line, so an operator
8229
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8230
+ * afternoon.
8231
+ *
8232
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8233
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8234
+ * mover — which is the exact failure this is meant to end. The coordinator's
8235
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8236
+ * read `state`; folding the counters costs no extra read and makes the durable
8237
+ * record say afterwards how far a move actually got.
8238
+ *
8239
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8240
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8241
+ * cannot say M, and a 0 there would render as "100 % done".
8242
+ */
8243
+ var StorageMigrationMoveProgressSchema = object({
8244
+ filesMoved: number().int().nonnegative(),
8245
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8246
+ filesTotal: number().int().nonnegative().nullable(),
8247
+ bytesMoved: number().int().nonnegative(),
8248
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8249
+ * crash gets a new mover, and a rate computed from the migration's start
8250
+ * would silently average in the time nothing was running. */
8251
+ startedAt: number(),
8252
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8253
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8254
+ * subtract its own. */
8255
+ observedAt: number()
8256
+ });
8144
8257
  var StorageMigrationMoveSchema = object({
8145
8258
  storageClass: StorageMigrationClassSchema,
8146
8259
  fromLocationId: string(),
8147
8260
  toLocationId: string(),
8148
8261
  moverJobId: string().nullable(),
8149
8262
  state: RelocateJobStateSchema.nullable(),
8150
- error: string().nullable()
8263
+ error: string().nullable(),
8264
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8265
+ progress: StorageMigrationMoveProgressSchema.nullable()
8151
8266
  });
8152
8267
  var StorageMigrationJobSchema = object({
8153
8268
  jobId: string(),
8154
8269
  phase: StorageMigrationPhaseSchema,
8270
+ /** Which order this job is running. `status` is the only place an operator
8271
+ * can tell a seconds-long cutover from a thirty-hour one. */
8272
+ mode: StorageMigrationModeSchema,
8155
8273
  destinations: StorageMigrationDestinationsSchema,
8156
8274
  throttleMbps: number(),
8157
8275
  moves: array(StorageMigrationMoveSchema),
@@ -8164,13 +8282,122 @@ var StorageMigrationJobSchema = object({
8164
8282
  finishedAt: number().nullable(),
8165
8283
  error: string().nullable()
8166
8284
  });
8285
+ var StorageMigrationFindingSchema = object({
8286
+ code: _enum([
8287
+ "sharesDeviceWithSource",
8288
+ "deviceIdentityUnknown",
8289
+ "unstampedEventMediaRows",
8290
+ "blockingOnly",
8291
+ "noMover"
8292
+ ]),
8293
+ storageClass: StorageMigrationClassSchema,
8294
+ /** Human-readable, already carrying the ids and counts. */
8295
+ message: string()
8296
+ });
8167
8297
  var StorageMigrationPlanSchema = object({
8168
8298
  destinations: StorageMigrationDestinationsSchema,
8299
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8300
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8301
+ * it. */
8302
+ mode: StorageMigrationModeSchema,
8169
8303
  moves: array(object({
8170
8304
  storageClass: StorageMigrationClassSchema,
8171
8305
  fromLocationId: string(),
8172
8306
  toLocationId: string()
8173
- }))
8307
+ })),
8308
+ findings: array(StorageMigrationFindingSchema)
8309
+ });
8310
+ /**
8311
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8312
+ *
8313
+ * The coordinator's job record is the state of record for a migration, and its
8314
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8315
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8316
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8317
+ * way because no supported UI path existed. A mover armed like that has no job
8318
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8319
+ *
8320
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8321
+ * orchestrated it.
8322
+ */
8323
+ var StorageMigrationMoverSchema = object({
8324
+ lane: _enum(["footage", "media"]),
8325
+ job: RelocateJobSchema,
8326
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8327
+ * directly against the owning addon. */
8328
+ migrationJobId: string().nullable(),
8329
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8330
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8331
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8332
+ * rate made of two different clocks. */
8333
+ observedAt: number()
8334
+ });
8335
+ /**
8336
+ * What a SOURCE still holds for one storage class — the number that makes a
8337
+ * "drain remaining" action honest rather than hopeful.
8338
+ *
8339
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8340
+ * engine's own selection count for media), never from the resident index: a
8341
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8342
+ * never been told about (D295).
8343
+ *
8344
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8345
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8346
+ * because refusing on an unanswerable read would hide exactly the case an
8347
+ * operator needs to act on.
8348
+ */
8349
+ var StorageMigrationResidueSchema = object({
8350
+ storageClass: StorageMigrationClassSchema,
8351
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8352
+ * move from wherever they are rather than from one named source. */
8353
+ fromLocationId: string(),
8354
+ /** Where a drain would move it — the class's CURRENT default. */
8355
+ toLocationId: string(),
8356
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8357
+ items: number().int().nonnegative().nullable(),
8358
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8359
+ bytes: number().int().nonnegative().nullable()
8360
+ });
8361
+ /**
8362
+ * Run the DRAIN half and nothing else.
8363
+ *
8364
+ * A migration that reached `done` has already repointed, so `start` correctly
8365
+ * refuses its destination ("already the default") — there is nothing left to
8366
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8367
+ * or finish against a work list that was a tenth of the archive (D295), and
8368
+ * before this there was no supported way to run only that half: the only way
8369
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8370
+ *
8371
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8372
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8373
+ * re-repoint a class that is already migrated.
8374
+ */
8375
+ var StorageMigrationDrainInputSchema = object({
8376
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8377
+ * a class whose source is already empty is refused rather than started. */
8378
+ classes: array(StorageMigrationClassSchema).min(1),
8379
+ throttleMbps: number().min(1).max(1e3).optional()
8380
+ });
8381
+ /** What a footage source still holds, asked of the durable hour ledger. */
8382
+ var RelocateResidueInputSchema = object({
8383
+ fromLocationId: string().min(1),
8384
+ /** Narrow to one logical class; omit for every profile on the location. */
8385
+ footageClass: RelocateFootageClassSchema.optional()
8386
+ });
8387
+ /** `null` = the archive could not answer (no ledger on this node, or the
8388
+ * aggregate failed). Never conflated with an empty source. */
8389
+ var RelocateResidueSchema = object({
8390
+ segments: number().int().nonnegative(),
8391
+ bytes: number().int().nonnegative()
8392
+ }).nullable();
8393
+ /** How many rows a media pass would still act on against a given target — the
8394
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8395
+ * never disagree. `null` = the count could not be taken. */
8396
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8397
+ var RelocatableMediaCountInputSchema = object({
8398
+ toLocationId: string().min(1),
8399
+ /** Omitted = `move`. */
8400
+ mode: MediaRelocateModeSchema.optional()
8174
8401
  });
8175
8402
  /**
8176
8403
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8276,6 +8503,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8276
8503
  * two addons declaring the same `id` must agree on `cardinality` (validated
8277
8504
  * at kernel aggregation time, not here).
8278
8505
  */
8506
+ /**
8507
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8508
+ * actually reaches the bytes. It is the constraint that decides which
8509
+ * `storage-provider`s may back a location of that kind.
8510
+ *
8511
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8512
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8513
+ * post-analysis media roots). Only a provider that serves a genuine local
8514
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8515
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8516
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8517
+ * against a same-named local directory that is something else entirely.
8518
+ *
8519
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8520
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8521
+ * service never sees a path, so any provider can back it. `backups` is the
8522
+ * one kind that qualifies today.
8523
+ *
8524
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8525
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8526
+ * refused the configuration; the first write simply went somewhere wrong, and
8527
+ * a recording write that goes wrong surfaces as a silent black window rather
8528
+ * than an error (the read path does not `stat`). This turns that accident into
8529
+ * a declared, enforced, testable refusal.
8530
+ */
8531
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8279
8532
  var StorageLocationDeclarationSchema = object({
8280
8533
  /**
8281
8534
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8295,6 +8548,19 @@ var StorageLocationDeclarationSchema = object({
8295
8548
  */
8296
8549
  cardinality: _enum(["single", "multi"]),
8297
8550
  /**
8551
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8552
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8553
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8554
+ *
8555
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8556
+ * can only over-restrict (refuse a remote provider for a kind that might
8557
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8558
+ * permissive direction and is therefore never inferred — a repo guard
8559
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8560
+ * reached by omission.
8561
+ */
8562
+ access: StorageAccessSchema.optional(),
8563
+ /**
8298
8564
  * When set, the default instance for this location inherits its resolved
8299
8565
  * root from the named location's default instance. Useful for derivative
8300
8566
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18162,8 +18428,10 @@ var TrackSchema = object({
18162
18428
  lastSeen: number(),
18163
18429
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18164
18430
  positions: array(TrackPositionSchema).readonly(),
18165
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18166
- * saveThumbnails policy). */
18431
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18432
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18433
+ * the retired `saveThumbnails` used to gate this and the rolling
18434
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18167
18435
  snapshots: array(TrackSnapshotSchema).readonly(),
18168
18436
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18169
18437
  zonesVisited: array(string()).readonly(),
@@ -19023,6 +19291,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19023
19291
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19024
19292
  kind: "mutation",
19025
19293
  auth: "admin"
19294
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19295
+ kind: "query",
19296
+ auth: "admin"
19026
19297
  }), method(object({}), array(RelocateJobSchema).readonly(), {
19027
19298
  kind: "query",
19028
19299
  auth: "admin"
@@ -21034,7 +21305,10 @@ method(object({
21034
21305
  }), StorageLocationSchema, {
21035
21306
  kind: "mutation",
21036
21307
  auth: "admin"
21037
- }), method(object({ id: string() }), _void(), {
21308
+ }), method(object({
21309
+ id: string(),
21310
+ force: boolean().optional()
21311
+ }), _void(), {
21038
21312
  kind: "mutation",
21039
21313
  auth: "admin"
21040
21314
  }), method(object({ id: string() }), object({
@@ -21083,6 +21357,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21083
21357
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21084
21358
  kind: "mutation",
21085
21359
  auth: "admin"
21360
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21361
+ kind: "mutation",
21362
+ auth: "admin"
21086
21363
  });
21087
21364
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21088
21365
  providerId: string().min(1),
@@ -21481,12 +21758,38 @@ response: record(string(), unknown()) }), object({
21481
21758
  *
21482
21759
  * ## Why this is a capability and not a helper
21483
21760
  *
21484
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21485
- * plate, vehicle, identity, and the event store's derivativesand every one of
21486
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21487
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21488
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21489
- * load 5,000 rows before ranking anything.
21761
+ * This capability was introduced with the claim that SIX stores in
21762
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21763
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21764
+ * claim was never true, and leaving it here made five stores look like pending
21765
+ * work when three of them have no vector at all. Counted column by column on
21766
+ * 2026-08-30, exactly THREE ever held one:
21767
+ *
21768
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21769
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21770
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21771
+ * face, migrated 2026-08-30 into its OWN index (see below).
21772
+ *
21773
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21774
+ * and `identities` store a name; the event store stores no derivative vector.
21775
+ * They are not migration candidates and never were.
21776
+ *
21777
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21778
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21779
+ * rows before ranking anything.
21780
+ *
21781
+ * ## One index per COMPARISON, never per encoder
21782
+ *
21783
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21784
+ * model, and they still get two indexes. An index is a set of things that are
21785
+ * ranked against each other and that live and die together, and these two are
21786
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21787
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21788
+ * forever and is the gallery every recognition ranks against. One index would
21789
+ * mean every gallery load and every reconcile carried a filter whose failure
21790
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21791
+ * person's only sample. The dimension they share is not a reason to share an
21792
+ * index; the question they answer is, and it differs.
21490
21793
  *
21491
21794
  * The fix is not a faster loop, it is a different backend — and the backend
21492
21795
  * should be replaceable without touching six callers. So: a singleton
@@ -21591,7 +21894,20 @@ var VectorQueryResultSchema = object({
21591
21894
  */
21592
21895
  scanned: number(),
21593
21896
  /** True when the backend could not consider every row that passed the filter. */
21594
- truncated: boolean()
21897
+ truncated: boolean(),
21898
+ /**
21899
+ * The `topK` the backend actually ran with.
21900
+ *
21901
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21902
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21903
+ * own log rather than in its answer. That is how an audit asking for 20,000
21904
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21905
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21906
+ * MUCH, in the return value, where the caller cannot fail to see it.
21907
+ *
21908
+ * Equals the requested `topK` whenever nothing was lowered.
21909
+ */
21910
+ effectiveTopK: number().int().positive()
21595
21911
  });
21596
21912
  var VectorDeleteInputSchema = object({
21597
21913
  index: string(),
@@ -21620,6 +21936,68 @@ var VectorGetResultSchema = object({ items: array(object({
21620
21936
  id: string(),
21621
21937
  metadata: VectorMetadataSchema
21622
21938
  })) });
21939
+ /**
21940
+ * Ids to read back WITH their vectors.
21941
+ *
21942
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21943
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21944
+ * caller depends on that promise. This one promises the opposite.
21945
+ *
21946
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21947
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21948
+ * a per-face cross-process KNN would be a network round trip inside the
21949
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21950
+ * it requires the index to hand the floats back. Without this method the only
21951
+ * way to keep a readable vector is a JSON column, which is the thing this
21952
+ * capability exists to delete.
21953
+ *
21954
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21955
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21956
+ */
21957
+ var VectorFetchInputSchema = object({
21958
+ index: string(),
21959
+ ids: array(string())
21960
+ });
21961
+ var VectorFetchResultSchema = object({ items: array(object({
21962
+ id: string(),
21963
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21964
+ vector: string(),
21965
+ metadata: VectorMetadataSchema
21966
+ })) });
21967
+ /**
21968
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21969
+ *
21970
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21971
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21972
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21973
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21974
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21975
+ * looked" for as long as anyone cared to read it.
21976
+ *
21977
+ * This is the primitive that question actually needs: a bounded page, ordered
21978
+ * by the backend's own row order, costing no distance computation at all.
21979
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21980
+ * the full-table read this capability was built to stop.
21981
+ */
21982
+ var VectorScanInputSchema = object({
21983
+ index: string(),
21984
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21985
+ cursor: number().int().nonnegative().default(0),
21986
+ limit: number().int().positive()
21987
+ });
21988
+ var VectorScanResultSchema = object({
21989
+ items: array(object({
21990
+ id: string(),
21991
+ metadata: VectorMetadataSchema
21992
+ })),
21993
+ /**
21994
+ * Where the next page starts, or `null` when the walk reached the end.
21995
+ *
21996
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21997
+ * from a short page: a backend is free to return fewer rows than asked.
21998
+ */
21999
+ nextCursor: number().int().nonnegative().nullable()
22000
+ });
21623
22001
  var VectorStatsInputSchema = object({ index: string() });
21624
22002
  var VectorStatsResultSchema = object({
21625
22003
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21638,7 +22016,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21638
22016
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21639
22017
  kind: "mutation",
21640
22018
  auth: "admin"
21641
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22019
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21642
22020
  kind: "mutation",
21643
22021
  auth: "admin"
21644
22022
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28265,6 +28643,9 @@ method(object({
28265
28643
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28266
28644
  kind: "query",
28267
28645
  auth: "admin"
28646
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28647
+ kind: "query",
28648
+ auth: "admin"
28268
28649
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28269
28650
  kind: "mutation",
28270
28651
  auth: "admin"
@@ -34965,6 +35346,18 @@ Object.freeze({
34965
35346
  addonId: null,
34966
35347
  access: "create"
34967
35348
  },
35349
+ "pipelineAnalytics.countRelocatableMedia": {
35350
+ capName: "pipeline-analytics",
35351
+ capScope: "device",
35352
+ addonId: null,
35353
+ access: "view"
35354
+ },
35355
+ "pipelineAnalytics.countUnstampedEventMedia": {
35356
+ capName: "pipeline-analytics",
35357
+ capScope: "device",
35358
+ addonId: null,
35359
+ access: "view"
35360
+ },
34968
35361
  "pipelineAnalytics.deleteDeviceEvents": {
34969
35362
  capName: "pipeline-analytics",
34970
35363
  capScope: "device",
@@ -36123,6 +36516,12 @@ Object.freeze({
36123
36516
  addonId: null,
36124
36517
  access: "view"
36125
36518
  },
36519
+ "recording.getRelocateResidue": {
36520
+ capName: "recording",
36521
+ capScope: "system",
36522
+ addonId: null,
36523
+ access: "view"
36524
+ },
36126
36525
  "recording.getStorageMigrationMoveStatus": {
36127
36526
  capName: "recording",
36128
36527
  capScope: "system",
@@ -36669,12 +37068,30 @@ Object.freeze({
36669
37068
  addonId: null,
36670
37069
  access: "create"
36671
37070
  },
37071
+ "storageMigration.drain": {
37072
+ capName: "storage-migration",
37073
+ capScope: "system",
37074
+ addonId: null,
37075
+ access: "create"
37076
+ },
37077
+ "storageMigration.movers": {
37078
+ capName: "storage-migration",
37079
+ capScope: "system",
37080
+ addonId: null,
37081
+ access: "view"
37082
+ },
36672
37083
  "storageMigration.plan": {
36673
37084
  capName: "storage-migration",
36674
37085
  capScope: "system",
36675
37086
  addonId: null,
36676
37087
  access: "view"
36677
37088
  },
37089
+ "storageMigration.residue": {
37090
+ capName: "storage-migration",
37091
+ capScope: "system",
37092
+ addonId: null,
37093
+ access: "view"
37094
+ },
36678
37095
  "storageMigration.start": {
36679
37096
  capName: "storage-migration",
36680
37097
  capScope: "system",
@@ -37509,6 +37926,12 @@ Object.freeze({
37509
37926
  addonId: null,
37510
37927
  access: "delete"
37511
37928
  },
37929
+ "vectorStore.fetchByIds": {
37930
+ capName: "vector-store",
37931
+ capScope: "system",
37932
+ addonId: null,
37933
+ access: "view"
37934
+ },
37512
37935
  "vectorStore.getByIds": {
37513
37936
  capName: "vector-store",
37514
37937
  capScope: "system",
@@ -37521,6 +37944,12 @@ Object.freeze({
37521
37944
  addonId: null,
37522
37945
  access: "view"
37523
37946
  },
37947
+ "vectorStore.scan": {
37948
+ capName: "vector-store",
37949
+ capScope: "system",
37950
+ addonId: null,
37951
+ access: "view"
37952
+ },
37524
37953
  "vectorStore.stats": {
37525
37954
  capName: "vector-store",
37526
37955
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8071,18 +8071,61 @@ var RelocateFootageInputSchema = object({
8071
8071
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8072
8072
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8073
8073
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8074
+ /**
8075
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8076
+ * mover (the engine already walks both collections with a timestamp cursor and
8077
+ * already has a stamp-without-copy path).
8078
+ *
8079
+ * - `move` — the default and the historical behaviour: event-media and
8080
+ * retrain blobs move to `toLocationId` and their rows are
8081
+ * stamped. The enrolled gallery is skipped (D197).
8082
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8083
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8084
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8085
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8086
+ * instant a repoint moves that pointer the row reads from the
8087
+ * new disk while its bytes are on the old one.
8088
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8089
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8090
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8091
+ * never run beside a live second location: it is stop-the-world
8092
+ * by construction, which is acceptable only because the gallery
8093
+ * is a few KB per enrolled sample.
8094
+ */
8095
+ var MediaRelocateModeSchema = _enum([
8096
+ "move",
8097
+ "seal",
8098
+ "gallery"
8099
+ ]);
8074
8100
  var RelocateMediaInputSchema = object({
8075
8101
  toLocationId: string(),
8076
- throttleMbps: number().min(1).max(1e3).optional()
8102
+ throttleMbps: number().min(1).max(1e3).optional(),
8103
+ /** Omitted = `move`, the pre-existing behaviour. */
8104
+ mode: MediaRelocateModeSchema.optional()
8105
+ });
8106
+ /** How many rows still carry NO `locationId` — the population a repoint would
8107
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8108
+ * value that permits a non-blocking `eventMedia` cutover. */
8109
+ var UnstampedEventMediaCountSchema = object({
8110
+ media: number().int().nonnegative(),
8111
+ retrainFrames: number().int().nonnegative(),
8112
+ total: number().int().nonnegative()
8077
8113
  });
8078
8114
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8079
- /** The independently selectable logical storage classes. `recordings`
8080
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8081
- * segments; `eventMedia` is post-analysis blobs. */
8115
+ /** The independently selectable logical storage classes — every class
8116
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8117
+ * Zod enum error where they should meet an explanation.
8118
+ *
8119
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8120
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8121
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8122
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8082
8123
  var StorageMigrationClassSchema = _enum([
8083
8124
  "recordings",
8084
8125
  "recordingsLow",
8085
- "eventMedia"
8126
+ "eventMedia",
8127
+ "backups",
8128
+ "galleryMedia"
8086
8129
  ]);
8087
8130
  /** A destination is always an existing, fully-qualified location id. The
8088
8131
  * migration API intentionally never changes a source location's `basePath`:
@@ -8090,20 +8133,56 @@ var StorageMigrationClassSchema = _enum([
8090
8133
  var StorageMigrationDestinationsSchema = object({
8091
8134
  recordings: string().min(1).optional(),
8092
8135
  recordingsLow: string().min(1).optional(),
8093
- eventMedia: string().min(1).optional()
8136
+ eventMedia: string().min(1).optional(),
8137
+ backups: string().min(1).optional(),
8138
+ galleryMedia: string().min(1).optional()
8094
8139
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8140
+ /**
8141
+ * How a migration sequences the cutover against the byte move.
8142
+ *
8143
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8144
+ * resume. Recording is stopped for the whole move. Right
8145
+ * for a small or a cold class, and the only legal mode for
8146
+ * a `cardinality: 'single'` class.
8147
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8148
+ * refresh, resume, then move the past with everything
8149
+ * running. The pause is three bounded instants (a detach +
8150
+ * attach round, a write-gate drain, a lease) instead of one
8151
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8152
+ * stopped recording under `blocking`; the same move is
8153
+ * seconds of stopped recording under `nonBlocking`.
8154
+ *
8155
+ * The mode is on the JOB, not only on the input, because `status` is where an
8156
+ * operator finds out which one is running.
8157
+ */
8158
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8095
8159
  /** Shared input for planning and starting an orchestrated storage migration. */
8096
8160
  var StorageMigrationInputSchema = object({
8097
8161
  destinations: StorageMigrationDestinationsSchema,
8098
- throttleMbps: number().min(1).max(1e3).optional()
8162
+ throttleMbps: number().min(1).max(1e3).optional(),
8163
+ /** Omitted = `blocking`, which stays the default. */
8164
+ mode: StorageMigrationModeSchema.optional()
8099
8165
  });
8100
- /** The durable coordinator state machine. The only phase that changes default
8101
- * locations is `repointing`, after every selected mover has completed and been
8102
- * verified. */
8166
+ /**
8167
+ * The durable coordinator state machine.
8168
+ *
8169
+ * `blocking`:
8170
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8171
+ *
8172
+ * `nonBlocking`:
8173
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8174
+ *
8175
+ * Same phases, different order plus two new ones — not a second mover.
8176
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8177
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8178
+ * `repointing` is still the only phase that changes a default location.
8179
+ */
8103
8180
  var StorageMigrationPhaseSchema = _enum([
8104
8181
  "planning",
8182
+ "sealing",
8105
8183
  "pausing",
8106
8184
  "moving",
8185
+ "draining",
8107
8186
  "verifying",
8108
8187
  "repointing",
8109
8188
  "refreshing",
@@ -8117,17 +8196,56 @@ var StorageMigrationParticipantSchema = _enum([
8117
8196
  "recorder",
8118
8197
  "analytics"
8119
8198
  ]);
8199
+ /**
8200
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8201
+ *
8202
+ * The long half of a non-blocking migration is `draining`, and it is measured
8203
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8204
+ * existed the only place those numbers appeared was a Loki line, so an operator
8205
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8206
+ * afternoon.
8207
+ *
8208
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8209
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8210
+ * mover — which is the exact failure this is meant to end. The coordinator's
8211
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8212
+ * read `state`; folding the counters costs no extra read and makes the durable
8213
+ * record say afterwards how far a move actually got.
8214
+ *
8215
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8216
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8217
+ * cannot say M, and a 0 there would render as "100 % done".
8218
+ */
8219
+ var StorageMigrationMoveProgressSchema = object({
8220
+ filesMoved: number().int().nonnegative(),
8221
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8222
+ filesTotal: number().int().nonnegative().nullable(),
8223
+ bytesMoved: number().int().nonnegative(),
8224
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8225
+ * crash gets a new mover, and a rate computed from the migration's start
8226
+ * would silently average in the time nothing was running. */
8227
+ startedAt: number(),
8228
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8229
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8230
+ * subtract its own. */
8231
+ observedAt: number()
8232
+ });
8120
8233
  var StorageMigrationMoveSchema = object({
8121
8234
  storageClass: StorageMigrationClassSchema,
8122
8235
  fromLocationId: string(),
8123
8236
  toLocationId: string(),
8124
8237
  moverJobId: string().nullable(),
8125
8238
  state: RelocateJobStateSchema.nullable(),
8126
- error: string().nullable()
8239
+ error: string().nullable(),
8240
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8241
+ progress: StorageMigrationMoveProgressSchema.nullable()
8127
8242
  });
8128
8243
  var StorageMigrationJobSchema = object({
8129
8244
  jobId: string(),
8130
8245
  phase: StorageMigrationPhaseSchema,
8246
+ /** Which order this job is running. `status` is the only place an operator
8247
+ * can tell a seconds-long cutover from a thirty-hour one. */
8248
+ mode: StorageMigrationModeSchema,
8131
8249
  destinations: StorageMigrationDestinationsSchema,
8132
8250
  throttleMbps: number(),
8133
8251
  moves: array(StorageMigrationMoveSchema),
@@ -8140,13 +8258,122 @@ var StorageMigrationJobSchema = object({
8140
8258
  finishedAt: number().nullable(),
8141
8259
  error: string().nullable()
8142
8260
  });
8261
+ var StorageMigrationFindingSchema = object({
8262
+ code: _enum([
8263
+ "sharesDeviceWithSource",
8264
+ "deviceIdentityUnknown",
8265
+ "unstampedEventMediaRows",
8266
+ "blockingOnly",
8267
+ "noMover"
8268
+ ]),
8269
+ storageClass: StorageMigrationClassSchema,
8270
+ /** Human-readable, already carrying the ids and counts. */
8271
+ message: string()
8272
+ });
8143
8273
  var StorageMigrationPlanSchema = object({
8144
8274
  destinations: StorageMigrationDestinationsSchema,
8275
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8276
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8277
+ * it. */
8278
+ mode: StorageMigrationModeSchema,
8145
8279
  moves: array(object({
8146
8280
  storageClass: StorageMigrationClassSchema,
8147
8281
  fromLocationId: string(),
8148
8282
  toLocationId: string()
8149
- }))
8283
+ })),
8284
+ findings: array(StorageMigrationFindingSchema)
8285
+ });
8286
+ /**
8287
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8288
+ *
8289
+ * The coordinator's job record is the state of record for a migration, and its
8290
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8291
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8292
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8293
+ * way because no supported UI path existed. A mover armed like that has no job
8294
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8295
+ *
8296
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8297
+ * orchestrated it.
8298
+ */
8299
+ var StorageMigrationMoverSchema = object({
8300
+ lane: _enum(["footage", "media"]),
8301
+ job: RelocateJobSchema,
8302
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8303
+ * directly against the owning addon. */
8304
+ migrationJobId: string().nullable(),
8305
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8306
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8307
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8308
+ * rate made of two different clocks. */
8309
+ observedAt: number()
8310
+ });
8311
+ /**
8312
+ * What a SOURCE still holds for one storage class — the number that makes a
8313
+ * "drain remaining" action honest rather than hopeful.
8314
+ *
8315
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8316
+ * engine's own selection count for media), never from the resident index: a
8317
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8318
+ * never been told about (D295).
8319
+ *
8320
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8321
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8322
+ * because refusing on an unanswerable read would hide exactly the case an
8323
+ * operator needs to act on.
8324
+ */
8325
+ var StorageMigrationResidueSchema = object({
8326
+ storageClass: StorageMigrationClassSchema,
8327
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8328
+ * move from wherever they are rather than from one named source. */
8329
+ fromLocationId: string(),
8330
+ /** Where a drain would move it — the class's CURRENT default. */
8331
+ toLocationId: string(),
8332
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8333
+ items: number().int().nonnegative().nullable(),
8334
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8335
+ bytes: number().int().nonnegative().nullable()
8336
+ });
8337
+ /**
8338
+ * Run the DRAIN half and nothing else.
8339
+ *
8340
+ * A migration that reached `done` has already repointed, so `start` correctly
8341
+ * refuses its destination ("already the default") — there is nothing left to
8342
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8343
+ * or finish against a work list that was a tenth of the archive (D295), and
8344
+ * before this there was no supported way to run only that half: the only way
8345
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8346
+ *
8347
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8348
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8349
+ * re-repoint a class that is already migrated.
8350
+ */
8351
+ var StorageMigrationDrainInputSchema = object({
8352
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8353
+ * a class whose source is already empty is refused rather than started. */
8354
+ classes: array(StorageMigrationClassSchema).min(1),
8355
+ throttleMbps: number().min(1).max(1e3).optional()
8356
+ });
8357
+ /** What a footage source still holds, asked of the durable hour ledger. */
8358
+ var RelocateResidueInputSchema = object({
8359
+ fromLocationId: string().min(1),
8360
+ /** Narrow to one logical class; omit for every profile on the location. */
8361
+ footageClass: RelocateFootageClassSchema.optional()
8362
+ });
8363
+ /** `null` = the archive could not answer (no ledger on this node, or the
8364
+ * aggregate failed). Never conflated with an empty source. */
8365
+ var RelocateResidueSchema = object({
8366
+ segments: number().int().nonnegative(),
8367
+ bytes: number().int().nonnegative()
8368
+ }).nullable();
8369
+ /** How many rows a media pass would still act on against a given target — the
8370
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8371
+ * never disagree. `null` = the count could not be taken. */
8372
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8373
+ var RelocatableMediaCountInputSchema = object({
8374
+ toLocationId: string().min(1),
8375
+ /** Omitted = `move`. */
8376
+ mode: MediaRelocateModeSchema.optional()
8150
8377
  });
8151
8378
  /**
8152
8379
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8252,6 +8479,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8252
8479
  * two addons declaring the same `id` must agree on `cardinality` (validated
8253
8480
  * at kernel aggregation time, not here).
8254
8481
  */
8482
+ /**
8483
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8484
+ * actually reaches the bytes. It is the constraint that decides which
8485
+ * `storage-provider`s may back a location of that kind.
8486
+ *
8487
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8488
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8489
+ * post-analysis media roots). Only a provider that serves a genuine local
8490
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8491
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8492
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8493
+ * against a same-named local directory that is something else entirely.
8494
+ *
8495
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8496
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8497
+ * service never sees a path, so any provider can back it. `backups` is the
8498
+ * one kind that qualifies today.
8499
+ *
8500
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8501
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8502
+ * refused the configuration; the first write simply went somewhere wrong, and
8503
+ * a recording write that goes wrong surfaces as a silent black window rather
8504
+ * than an error (the read path does not `stat`). This turns that accident into
8505
+ * a declared, enforced, testable refusal.
8506
+ */
8507
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8255
8508
  var StorageLocationDeclarationSchema = object({
8256
8509
  /**
8257
8510
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8271,6 +8524,19 @@ var StorageLocationDeclarationSchema = object({
8271
8524
  */
8272
8525
  cardinality: _enum(["single", "multi"]),
8273
8526
  /**
8527
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8528
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8529
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8530
+ *
8531
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8532
+ * can only over-restrict (refuse a remote provider for a kind that might
8533
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8534
+ * permissive direction and is therefore never inferred — a repo guard
8535
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8536
+ * reached by omission.
8537
+ */
8538
+ access: StorageAccessSchema.optional(),
8539
+ /**
8274
8540
  * When set, the default instance for this location inherits its resolved
8275
8541
  * root from the named location's default instance. Useful for derivative
8276
8542
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18138,8 +18404,10 @@ var TrackSchema = object({
18138
18404
  lastSeen: number(),
18139
18405
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18140
18406
  positions: array(TrackPositionSchema).readonly(),
18141
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18142
- * saveThumbnails policy). */
18407
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18408
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18409
+ * the retired `saveThumbnails` used to gate this and the rolling
18410
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18143
18411
  snapshots: array(TrackSnapshotSchema).readonly(),
18144
18412
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18145
18413
  zonesVisited: array(string()).readonly(),
@@ -18999,6 +19267,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18999
19267
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19000
19268
  kind: "mutation",
19001
19269
  auth: "admin"
19270
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19271
+ kind: "query",
19272
+ auth: "admin"
19002
19273
  }), method(object({}), array(RelocateJobSchema).readonly(), {
19003
19274
  kind: "query",
19004
19275
  auth: "admin"
@@ -21010,7 +21281,10 @@ method(object({
21010
21281
  }), StorageLocationSchema, {
21011
21282
  kind: "mutation",
21012
21283
  auth: "admin"
21013
- }), method(object({ id: string() }), _void(), {
21284
+ }), method(object({
21285
+ id: string(),
21286
+ force: boolean().optional()
21287
+ }), _void(), {
21014
21288
  kind: "mutation",
21015
21289
  auth: "admin"
21016
21290
  }), method(object({ id: string() }), object({
@@ -21059,6 +21333,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21059
21333
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21060
21334
  kind: "mutation",
21061
21335
  auth: "admin"
21336
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21337
+ kind: "mutation",
21338
+ auth: "admin"
21062
21339
  });
21063
21340
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21064
21341
  providerId: string().min(1),
@@ -21457,12 +21734,38 @@ response: record(string(), unknown()) }), object({
21457
21734
  *
21458
21735
  * ## Why this is a capability and not a helper
21459
21736
  *
21460
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21461
- * plate, vehicle, identity, and the event store's derivativesand every one of
21462
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21463
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21464
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21465
- * load 5,000 rows before ranking anything.
21737
+ * This capability was introduced with the claim that SIX stores in
21738
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21739
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21740
+ * claim was never true, and leaving it here made five stores look like pending
21741
+ * work when three of them have no vector at all. Counted column by column on
21742
+ * 2026-08-30, exactly THREE ever held one:
21743
+ *
21744
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21745
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21746
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21747
+ * face, migrated 2026-08-30 into its OWN index (see below).
21748
+ *
21749
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21750
+ * and `identities` store a name; the event store stores no derivative vector.
21751
+ * They are not migration candidates and never were.
21752
+ *
21753
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21754
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21755
+ * rows before ranking anything.
21756
+ *
21757
+ * ## One index per COMPARISON, never per encoder
21758
+ *
21759
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21760
+ * model, and they still get two indexes. An index is a set of things that are
21761
+ * ranked against each other and that live and die together, and these two are
21762
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21763
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21764
+ * forever and is the gallery every recognition ranks against. One index would
21765
+ * mean every gallery load and every reconcile carried a filter whose failure
21766
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21767
+ * person's only sample. The dimension they share is not a reason to share an
21768
+ * index; the question they answer is, and it differs.
21466
21769
  *
21467
21770
  * The fix is not a faster loop, it is a different backend — and the backend
21468
21771
  * should be replaceable without touching six callers. So: a singleton
@@ -21567,7 +21870,20 @@ var VectorQueryResultSchema = object({
21567
21870
  */
21568
21871
  scanned: number(),
21569
21872
  /** True when the backend could not consider every row that passed the filter. */
21570
- truncated: boolean()
21873
+ truncated: boolean(),
21874
+ /**
21875
+ * The `topK` the backend actually ran with.
21876
+ *
21877
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21878
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21879
+ * own log rather than in its answer. That is how an audit asking for 20,000
21880
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21881
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21882
+ * MUCH, in the return value, where the caller cannot fail to see it.
21883
+ *
21884
+ * Equals the requested `topK` whenever nothing was lowered.
21885
+ */
21886
+ effectiveTopK: number().int().positive()
21571
21887
  });
21572
21888
  var VectorDeleteInputSchema = object({
21573
21889
  index: string(),
@@ -21596,6 +21912,68 @@ var VectorGetResultSchema = object({ items: array(object({
21596
21912
  id: string(),
21597
21913
  metadata: VectorMetadataSchema
21598
21914
  })) });
21915
+ /**
21916
+ * Ids to read back WITH their vectors.
21917
+ *
21918
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21919
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21920
+ * caller depends on that promise. This one promises the opposite.
21921
+ *
21922
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21923
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21924
+ * a per-face cross-process KNN would be a network round trip inside the
21925
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21926
+ * it requires the index to hand the floats back. Without this method the only
21927
+ * way to keep a readable vector is a JSON column, which is the thing this
21928
+ * capability exists to delete.
21929
+ *
21930
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21931
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21932
+ */
21933
+ var VectorFetchInputSchema = object({
21934
+ index: string(),
21935
+ ids: array(string())
21936
+ });
21937
+ var VectorFetchResultSchema = object({ items: array(object({
21938
+ id: string(),
21939
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21940
+ vector: string(),
21941
+ metadata: VectorMetadataSchema
21942
+ })) });
21943
+ /**
21944
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21945
+ *
21946
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21947
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21948
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21949
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21950
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21951
+ * looked" for as long as anyone cared to read it.
21952
+ *
21953
+ * This is the primitive that question actually needs: a bounded page, ordered
21954
+ * by the backend's own row order, costing no distance computation at all.
21955
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21956
+ * the full-table read this capability was built to stop.
21957
+ */
21958
+ var VectorScanInputSchema = object({
21959
+ index: string(),
21960
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21961
+ cursor: number().int().nonnegative().default(0),
21962
+ limit: number().int().positive()
21963
+ });
21964
+ var VectorScanResultSchema = object({
21965
+ items: array(object({
21966
+ id: string(),
21967
+ metadata: VectorMetadataSchema
21968
+ })),
21969
+ /**
21970
+ * Where the next page starts, or `null` when the walk reached the end.
21971
+ *
21972
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21973
+ * from a short page: a backend is free to return fewer rows than asked.
21974
+ */
21975
+ nextCursor: number().int().nonnegative().nullable()
21976
+ });
21599
21977
  var VectorStatsInputSchema = object({ index: string() });
21600
21978
  var VectorStatsResultSchema = object({
21601
21979
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21614,7 +21992,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21614
21992
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21615
21993
  kind: "mutation",
21616
21994
  auth: "admin"
21617
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21995
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21618
21996
  kind: "mutation",
21619
21997
  auth: "admin"
21620
21998
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28241,6 +28619,9 @@ method(object({
28241
28619
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28242
28620
  kind: "query",
28243
28621
  auth: "admin"
28622
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28623
+ kind: "query",
28624
+ auth: "admin"
28244
28625
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28245
28626
  kind: "mutation",
28246
28627
  auth: "admin"
@@ -34941,6 +35322,18 @@ Object.freeze({
34941
35322
  addonId: null,
34942
35323
  access: "create"
34943
35324
  },
35325
+ "pipelineAnalytics.countRelocatableMedia": {
35326
+ capName: "pipeline-analytics",
35327
+ capScope: "device",
35328
+ addonId: null,
35329
+ access: "view"
35330
+ },
35331
+ "pipelineAnalytics.countUnstampedEventMedia": {
35332
+ capName: "pipeline-analytics",
35333
+ capScope: "device",
35334
+ addonId: null,
35335
+ access: "view"
35336
+ },
34944
35337
  "pipelineAnalytics.deleteDeviceEvents": {
34945
35338
  capName: "pipeline-analytics",
34946
35339
  capScope: "device",
@@ -36099,6 +36492,12 @@ Object.freeze({
36099
36492
  addonId: null,
36100
36493
  access: "view"
36101
36494
  },
36495
+ "recording.getRelocateResidue": {
36496
+ capName: "recording",
36497
+ capScope: "system",
36498
+ addonId: null,
36499
+ access: "view"
36500
+ },
36102
36501
  "recording.getStorageMigrationMoveStatus": {
36103
36502
  capName: "recording",
36104
36503
  capScope: "system",
@@ -36645,12 +37044,30 @@ Object.freeze({
36645
37044
  addonId: null,
36646
37045
  access: "create"
36647
37046
  },
37047
+ "storageMigration.drain": {
37048
+ capName: "storage-migration",
37049
+ capScope: "system",
37050
+ addonId: null,
37051
+ access: "create"
37052
+ },
37053
+ "storageMigration.movers": {
37054
+ capName: "storage-migration",
37055
+ capScope: "system",
37056
+ addonId: null,
37057
+ access: "view"
37058
+ },
36648
37059
  "storageMigration.plan": {
36649
37060
  capName: "storage-migration",
36650
37061
  capScope: "system",
36651
37062
  addonId: null,
36652
37063
  access: "view"
36653
37064
  },
37065
+ "storageMigration.residue": {
37066
+ capName: "storage-migration",
37067
+ capScope: "system",
37068
+ addonId: null,
37069
+ access: "view"
37070
+ },
36654
37071
  "storageMigration.start": {
36655
37072
  capName: "storage-migration",
36656
37073
  capScope: "system",
@@ -37485,6 +37902,12 @@ Object.freeze({
37485
37902
  addonId: null,
37486
37903
  access: "delete"
37487
37904
  },
37905
+ "vectorStore.fetchByIds": {
37906
+ capName: "vector-store",
37907
+ capScope: "system",
37908
+ addonId: null,
37909
+ access: "view"
37910
+ },
37488
37911
  "vectorStore.getByIds": {
37489
37912
  capName: "vector-store",
37490
37913
  capScope: "system",
@@ -37497,6 +37920,12 @@ Object.freeze({
37497
37920
  addonId: null,
37498
37921
  access: "view"
37499
37922
  },
37923
+ "vectorStore.scan": {
37924
+ capName: "vector-store",
37925
+ capScope: "system",
37926
+ addonId: null,
37927
+ access: "view"
37928
+ },
37500
37929
  "vectorStore.stats": {
37501
37930
  capName: "vector-store",
37502
37931
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-rtsp",
3
- "version": "1.2.42",
3
+ "version": "1.2.45",
4
4
  "description": "Generic RTSP camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",