@camstack/addon-mqtt-broker 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.
@@ -8068,18 +8068,61 @@ var RelocateFootageInputSchema = object({
8068
8068
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8069
8069
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8070
8070
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8071
+ /**
8072
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8073
+ * mover (the engine already walks both collections with a timestamp cursor and
8074
+ * already has a stamp-without-copy path).
8075
+ *
8076
+ * - `move` — the default and the historical behaviour: event-media and
8077
+ * retrain blobs move to `toLocationId` and their rows are
8078
+ * stamped. The enrolled gallery is skipped (D197).
8079
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8080
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8081
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8082
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8083
+ * instant a repoint moves that pointer the row reads from the
8084
+ * new disk while its bytes are on the old one.
8085
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8086
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8087
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8088
+ * never run beside a live second location: it is stop-the-world
8089
+ * by construction, which is acceptable only because the gallery
8090
+ * is a few KB per enrolled sample.
8091
+ */
8092
+ var MediaRelocateModeSchema = _enum([
8093
+ "move",
8094
+ "seal",
8095
+ "gallery"
8096
+ ]);
8071
8097
  var RelocateMediaInputSchema = object({
8072
8098
  toLocationId: string(),
8073
- throttleMbps: number().min(1).max(1e3).optional()
8099
+ throttleMbps: number().min(1).max(1e3).optional(),
8100
+ /** Omitted = `move`, the pre-existing behaviour. */
8101
+ mode: MediaRelocateModeSchema.optional()
8102
+ });
8103
+ /** How many rows still carry NO `locationId` — the population a repoint would
8104
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8105
+ * value that permits a non-blocking `eventMedia` cutover. */
8106
+ var UnstampedEventMediaCountSchema = object({
8107
+ media: number().int().nonnegative(),
8108
+ retrainFrames: number().int().nonnegative(),
8109
+ total: number().int().nonnegative()
8074
8110
  });
8075
8111
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8076
- /** The independently selectable logical storage classes. `recordings`
8077
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8078
- * segments; `eventMedia` is post-analysis blobs. */
8112
+ /** The independently selectable logical storage classes — every class
8113
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8114
+ * Zod enum error where they should meet an explanation.
8115
+ *
8116
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8117
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8118
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8119
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8079
8120
  var StorageMigrationClassSchema = _enum([
8080
8121
  "recordings",
8081
8122
  "recordingsLow",
8082
- "eventMedia"
8123
+ "eventMedia",
8124
+ "backups",
8125
+ "galleryMedia"
8083
8126
  ]);
8084
8127
  /** A destination is always an existing, fully-qualified location id. The
8085
8128
  * migration API intentionally never changes a source location's `basePath`:
@@ -8087,20 +8130,56 @@ var StorageMigrationClassSchema = _enum([
8087
8130
  var StorageMigrationDestinationsSchema = object({
8088
8131
  recordings: string().min(1).optional(),
8089
8132
  recordingsLow: string().min(1).optional(),
8090
- eventMedia: string().min(1).optional()
8133
+ eventMedia: string().min(1).optional(),
8134
+ backups: string().min(1).optional(),
8135
+ galleryMedia: string().min(1).optional()
8091
8136
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8137
+ /**
8138
+ * How a migration sequences the cutover against the byte move.
8139
+ *
8140
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8141
+ * resume. Recording is stopped for the whole move. Right
8142
+ * for a small or a cold class, and the only legal mode for
8143
+ * a `cardinality: 'single'` class.
8144
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8145
+ * refresh, resume, then move the past with everything
8146
+ * running. The pause is three bounded instants (a detach +
8147
+ * attach round, a write-gate drain, a lease) instead of one
8148
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8149
+ * stopped recording under `blocking`; the same move is
8150
+ * seconds of stopped recording under `nonBlocking`.
8151
+ *
8152
+ * The mode is on the JOB, not only on the input, because `status` is where an
8153
+ * operator finds out which one is running.
8154
+ */
8155
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8092
8156
  /** Shared input for planning and starting an orchestrated storage migration. */
8093
8157
  var StorageMigrationInputSchema = object({
8094
8158
  destinations: StorageMigrationDestinationsSchema,
8095
- throttleMbps: number().min(1).max(1e3).optional()
8159
+ throttleMbps: number().min(1).max(1e3).optional(),
8160
+ /** Omitted = `blocking`, which stays the default. */
8161
+ mode: StorageMigrationModeSchema.optional()
8096
8162
  });
8097
- /** The durable coordinator state machine. The only phase that changes default
8098
- * locations is `repointing`, after every selected mover has completed and been
8099
- * verified. */
8163
+ /**
8164
+ * The durable coordinator state machine.
8165
+ *
8166
+ * `blocking`:
8167
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8168
+ *
8169
+ * `nonBlocking`:
8170
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8171
+ *
8172
+ * Same phases, different order plus two new ones — not a second mover.
8173
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8174
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8175
+ * `repointing` is still the only phase that changes a default location.
8176
+ */
8100
8177
  var StorageMigrationPhaseSchema = _enum([
8101
8178
  "planning",
8179
+ "sealing",
8102
8180
  "pausing",
8103
8181
  "moving",
8182
+ "draining",
8104
8183
  "verifying",
8105
8184
  "repointing",
8106
8185
  "refreshing",
@@ -8114,17 +8193,56 @@ var StorageMigrationParticipantSchema = _enum([
8114
8193
  "recorder",
8115
8194
  "analytics"
8116
8195
  ]);
8196
+ /**
8197
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8198
+ *
8199
+ * The long half of a non-blocking migration is `draining`, and it is measured
8200
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8201
+ * existed the only place those numbers appeared was a Loki line, so an operator
8202
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8203
+ * afternoon.
8204
+ *
8205
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8206
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8207
+ * mover — which is the exact failure this is meant to end. The coordinator's
8208
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8209
+ * read `state`; folding the counters costs no extra read and makes the durable
8210
+ * record say afterwards how far a move actually got.
8211
+ *
8212
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8213
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8214
+ * cannot say M, and a 0 there would render as "100 % done".
8215
+ */
8216
+ var StorageMigrationMoveProgressSchema = object({
8217
+ filesMoved: number().int().nonnegative(),
8218
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8219
+ filesTotal: number().int().nonnegative().nullable(),
8220
+ bytesMoved: number().int().nonnegative(),
8221
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8222
+ * crash gets a new mover, and a rate computed from the migration's start
8223
+ * would silently average in the time nothing was running. */
8224
+ startedAt: number(),
8225
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8226
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8227
+ * subtract its own. */
8228
+ observedAt: number()
8229
+ });
8117
8230
  var StorageMigrationMoveSchema = object({
8118
8231
  storageClass: StorageMigrationClassSchema,
8119
8232
  fromLocationId: string(),
8120
8233
  toLocationId: string(),
8121
8234
  moverJobId: string().nullable(),
8122
8235
  state: RelocateJobStateSchema.nullable(),
8123
- error: string().nullable()
8236
+ error: string().nullable(),
8237
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8238
+ progress: StorageMigrationMoveProgressSchema.nullable()
8124
8239
  });
8125
8240
  var StorageMigrationJobSchema = object({
8126
8241
  jobId: string(),
8127
8242
  phase: StorageMigrationPhaseSchema,
8243
+ /** Which order this job is running. `status` is the only place an operator
8244
+ * can tell a seconds-long cutover from a thirty-hour one. */
8245
+ mode: StorageMigrationModeSchema,
8128
8246
  destinations: StorageMigrationDestinationsSchema,
8129
8247
  throttleMbps: number(),
8130
8248
  moves: array(StorageMigrationMoveSchema),
@@ -8137,13 +8255,122 @@ var StorageMigrationJobSchema = object({
8137
8255
  finishedAt: number().nullable(),
8138
8256
  error: string().nullable()
8139
8257
  });
8258
+ var StorageMigrationFindingSchema = object({
8259
+ code: _enum([
8260
+ "sharesDeviceWithSource",
8261
+ "deviceIdentityUnknown",
8262
+ "unstampedEventMediaRows",
8263
+ "blockingOnly",
8264
+ "noMover"
8265
+ ]),
8266
+ storageClass: StorageMigrationClassSchema,
8267
+ /** Human-readable, already carrying the ids and counts. */
8268
+ message: string()
8269
+ });
8140
8270
  var StorageMigrationPlanSchema = object({
8141
8271
  destinations: StorageMigrationDestinationsSchema,
8272
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8273
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8274
+ * it. */
8275
+ mode: StorageMigrationModeSchema,
8142
8276
  moves: array(object({
8143
8277
  storageClass: StorageMigrationClassSchema,
8144
8278
  fromLocationId: string(),
8145
8279
  toLocationId: string()
8146
- }))
8280
+ })),
8281
+ findings: array(StorageMigrationFindingSchema)
8282
+ });
8283
+ /**
8284
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8285
+ *
8286
+ * The coordinator's job record is the state of record for a migration, and its
8287
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8288
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8289
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8290
+ * way because no supported UI path existed. A mover armed like that has no job
8291
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8292
+ *
8293
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8294
+ * orchestrated it.
8295
+ */
8296
+ var StorageMigrationMoverSchema = object({
8297
+ lane: _enum(["footage", "media"]),
8298
+ job: RelocateJobSchema,
8299
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8300
+ * directly against the owning addon. */
8301
+ migrationJobId: string().nullable(),
8302
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8303
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8304
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8305
+ * rate made of two different clocks. */
8306
+ observedAt: number()
8307
+ });
8308
+ /**
8309
+ * What a SOURCE still holds for one storage class — the number that makes a
8310
+ * "drain remaining" action honest rather than hopeful.
8311
+ *
8312
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8313
+ * engine's own selection count for media), never from the resident index: a
8314
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8315
+ * never been told about (D295).
8316
+ *
8317
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8318
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8319
+ * because refusing on an unanswerable read would hide exactly the case an
8320
+ * operator needs to act on.
8321
+ */
8322
+ var StorageMigrationResidueSchema = object({
8323
+ storageClass: StorageMigrationClassSchema,
8324
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8325
+ * move from wherever they are rather than from one named source. */
8326
+ fromLocationId: string(),
8327
+ /** Where a drain would move it — the class's CURRENT default. */
8328
+ toLocationId: string(),
8329
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8330
+ items: number().int().nonnegative().nullable(),
8331
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8332
+ bytes: number().int().nonnegative().nullable()
8333
+ });
8334
+ /**
8335
+ * Run the DRAIN half and nothing else.
8336
+ *
8337
+ * A migration that reached `done` has already repointed, so `start` correctly
8338
+ * refuses its destination ("already the default") — there is nothing left to
8339
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8340
+ * or finish against a work list that was a tenth of the archive (D295), and
8341
+ * before this there was no supported way to run only that half: the only way
8342
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8343
+ *
8344
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8345
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8346
+ * re-repoint a class that is already migrated.
8347
+ */
8348
+ var StorageMigrationDrainInputSchema = object({
8349
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8350
+ * a class whose source is already empty is refused rather than started. */
8351
+ classes: array(StorageMigrationClassSchema).min(1),
8352
+ throttleMbps: number().min(1).max(1e3).optional()
8353
+ });
8354
+ /** What a footage source still holds, asked of the durable hour ledger. */
8355
+ var RelocateResidueInputSchema = object({
8356
+ fromLocationId: string().min(1),
8357
+ /** Narrow to one logical class; omit for every profile on the location. */
8358
+ footageClass: RelocateFootageClassSchema.optional()
8359
+ });
8360
+ /** `null` = the archive could not answer (no ledger on this node, or the
8361
+ * aggregate failed). Never conflated with an empty source. */
8362
+ var RelocateResidueSchema = object({
8363
+ segments: number().int().nonnegative(),
8364
+ bytes: number().int().nonnegative()
8365
+ }).nullable();
8366
+ /** How many rows a media pass would still act on against a given target — the
8367
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8368
+ * never disagree. `null` = the count could not be taken. */
8369
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8370
+ var RelocatableMediaCountInputSchema = object({
8371
+ toLocationId: string().min(1),
8372
+ /** Omitted = `move`. */
8373
+ mode: MediaRelocateModeSchema.optional()
8147
8374
  });
8148
8375
  /**
8149
8376
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8249,6 +8476,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8249
8476
  * two addons declaring the same `id` must agree on `cardinality` (validated
8250
8477
  * at kernel aggregation time, not here).
8251
8478
  */
8479
+ /**
8480
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8481
+ * actually reaches the bytes. It is the constraint that decides which
8482
+ * `storage-provider`s may back a location of that kind.
8483
+ *
8484
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8485
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8486
+ * post-analysis media roots). Only a provider that serves a genuine local
8487
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8488
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8489
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8490
+ * against a same-named local directory that is something else entirely.
8491
+ *
8492
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8493
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8494
+ * service never sees a path, so any provider can back it. `backups` is the
8495
+ * one kind that qualifies today.
8496
+ *
8497
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8498
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8499
+ * refused the configuration; the first write simply went somewhere wrong, and
8500
+ * a recording write that goes wrong surfaces as a silent black window rather
8501
+ * than an error (the read path does not `stat`). This turns that accident into
8502
+ * a declared, enforced, testable refusal.
8503
+ */
8504
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8252
8505
  var StorageLocationDeclarationSchema = object({
8253
8506
  /**
8254
8507
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8268,6 +8521,19 @@ var StorageLocationDeclarationSchema = object({
8268
8521
  */
8269
8522
  cardinality: _enum(["single", "multi"]),
8270
8523
  /**
8524
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8525
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8526
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8527
+ *
8528
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8529
+ * can only over-restrict (refuse a remote provider for a kind that might
8530
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8531
+ * permissive direction and is therefore never inferred — a repo guard
8532
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8533
+ * reached by omission.
8534
+ */
8535
+ access: StorageAccessSchema.optional(),
8536
+ /**
8271
8537
  * When set, the default instance for this location inherits its resolved
8272
8538
  * root from the named location's default instance. Useful for derivative
8273
8539
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17861,8 +18127,10 @@ var TrackSchema = object({
17861
18127
  lastSeen: number(),
17862
18128
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17863
18129
  positions: array(TrackPositionSchema).readonly(),
17864
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17865
- * saveThumbnails policy). */
18130
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18131
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18132
+ * the retired `saveThumbnails` used to gate this and the rolling
18133
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17866
18134
  snapshots: array(TrackSnapshotSchema).readonly(),
17867
18135
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17868
18136
  zonesVisited: array(string()).readonly(),
@@ -18722,6 +18990,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18722
18990
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18723
18991
  kind: "mutation",
18724
18992
  auth: "admin"
18993
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
18994
+ kind: "query",
18995
+ auth: "admin"
18725
18996
  }), method(object({}), array(RelocateJobSchema).readonly(), {
18726
18997
  kind: "query",
18727
18998
  auth: "admin"
@@ -20629,7 +20900,10 @@ method(object({
20629
20900
  }), StorageLocationSchema, {
20630
20901
  kind: "mutation",
20631
20902
  auth: "admin"
20632
- }), method(object({ id: string() }), _void(), {
20903
+ }), method(object({
20904
+ id: string(),
20905
+ force: boolean().optional()
20906
+ }), _void(), {
20633
20907
  kind: "mutation",
20634
20908
  auth: "admin"
20635
20909
  }), method(object({ id: string() }), object({
@@ -20678,6 +20952,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20678
20952
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20679
20953
  kind: "mutation",
20680
20954
  auth: "admin"
20955
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
20956
+ kind: "mutation",
20957
+ auth: "admin"
20681
20958
  });
20682
20959
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20683
20960
  providerId: string().min(1),
@@ -21076,12 +21353,38 @@ response: record(string(), unknown()) }), object({
21076
21353
  *
21077
21354
  * ## Why this is a capability and not a helper
21078
21355
  *
21079
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21080
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21081
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21082
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21083
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21084
- * load 5,000 rows before ranking anything.
21356
+ * This capability was introduced with the claim that SIX stores in
21357
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21358
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21359
+ * claim was never true, and leaving it here made five stores look like pending
21360
+ * work when three of them have no vector at all. Counted column by column on
21361
+ * 2026-08-30, exactly THREE ever held one:
21362
+ *
21363
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21364
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21365
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21366
+ * face, migrated 2026-08-30 into its OWN index (see below).
21367
+ *
21368
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21369
+ * and `identities` store a name; the event store stores no derivative vector.
21370
+ * They are not migration candidates and never were.
21371
+ *
21372
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21373
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21374
+ * rows before ranking anything.
21375
+ *
21376
+ * ## One index per COMPARISON, never per encoder
21377
+ *
21378
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21379
+ * model, and they still get two indexes. An index is a set of things that are
21380
+ * ranked against each other and that live and die together, and these two are
21381
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21382
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21383
+ * forever and is the gallery every recognition ranks against. One index would
21384
+ * mean every gallery load and every reconcile carried a filter whose failure
21385
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21386
+ * person's only sample. The dimension they share is not a reason to share an
21387
+ * index; the question they answer is, and it differs.
21085
21388
  *
21086
21389
  * The fix is not a faster loop, it is a different backend — and the backend
21087
21390
  * should be replaceable without touching six callers. So: a singleton
@@ -21186,7 +21489,20 @@ var VectorQueryResultSchema = object({
21186
21489
  */
21187
21490
  scanned: number(),
21188
21491
  /** True when the backend could not consider every row that passed the filter. */
21189
- truncated: boolean()
21492
+ truncated: boolean(),
21493
+ /**
21494
+ * The `topK` the backend actually ran with.
21495
+ *
21496
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21497
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21498
+ * own log rather than in its answer. That is how an audit asking for 20,000
21499
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21500
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21501
+ * MUCH, in the return value, where the caller cannot fail to see it.
21502
+ *
21503
+ * Equals the requested `topK` whenever nothing was lowered.
21504
+ */
21505
+ effectiveTopK: number().int().positive()
21190
21506
  });
21191
21507
  var VectorDeleteInputSchema = object({
21192
21508
  index: string(),
@@ -21215,6 +21531,68 @@ var VectorGetResultSchema = object({ items: array(object({
21215
21531
  id: string(),
21216
21532
  metadata: VectorMetadataSchema
21217
21533
  })) });
21534
+ /**
21535
+ * Ids to read back WITH their vectors.
21536
+ *
21537
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21538
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21539
+ * caller depends on that promise. This one promises the opposite.
21540
+ *
21541
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21542
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21543
+ * a per-face cross-process KNN would be a network round trip inside the
21544
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21545
+ * it requires the index to hand the floats back. Without this method the only
21546
+ * way to keep a readable vector is a JSON column, which is the thing this
21547
+ * capability exists to delete.
21548
+ *
21549
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21550
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21551
+ */
21552
+ var VectorFetchInputSchema = object({
21553
+ index: string(),
21554
+ ids: array(string())
21555
+ });
21556
+ var VectorFetchResultSchema = object({ items: array(object({
21557
+ id: string(),
21558
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21559
+ vector: string(),
21560
+ metadata: VectorMetadataSchema
21561
+ })) });
21562
+ /**
21563
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21564
+ *
21565
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21566
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21567
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21568
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21569
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21570
+ * looked" for as long as anyone cared to read it.
21571
+ *
21572
+ * This is the primitive that question actually needs: a bounded page, ordered
21573
+ * by the backend's own row order, costing no distance computation at all.
21574
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21575
+ * the full-table read this capability was built to stop.
21576
+ */
21577
+ var VectorScanInputSchema = object({
21578
+ index: string(),
21579
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21580
+ cursor: number().int().nonnegative().default(0),
21581
+ limit: number().int().positive()
21582
+ });
21583
+ var VectorScanResultSchema = object({
21584
+ items: array(object({
21585
+ id: string(),
21586
+ metadata: VectorMetadataSchema
21587
+ })),
21588
+ /**
21589
+ * Where the next page starts, or `null` when the walk reached the end.
21590
+ *
21591
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21592
+ * from a short page: a backend is free to return fewer rows than asked.
21593
+ */
21594
+ nextCursor: number().int().nonnegative().nullable()
21595
+ });
21218
21596
  var VectorStatsInputSchema = object({ index: string() });
21219
21597
  var VectorStatsResultSchema = object({
21220
21598
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21233,7 +21611,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21233
21611
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21234
21612
  kind: "mutation",
21235
21613
  auth: "admin"
21236
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21614
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21237
21615
  kind: "mutation",
21238
21616
  auth: "admin"
21239
21617
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26137,6 +26515,9 @@ method(object({
26137
26515
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26138
26516
  kind: "query",
26139
26517
  auth: "admin"
26518
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26519
+ kind: "query",
26520
+ auth: "admin"
26140
26521
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26141
26522
  kind: "mutation",
26142
26523
  auth: "admin"
@@ -31102,6 +31483,18 @@ Object.freeze({
31102
31483
  addonId: null,
31103
31484
  access: "create"
31104
31485
  },
31486
+ "pipelineAnalytics.countRelocatableMedia": {
31487
+ capName: "pipeline-analytics",
31488
+ capScope: "device",
31489
+ addonId: null,
31490
+ access: "view"
31491
+ },
31492
+ "pipelineAnalytics.countUnstampedEventMedia": {
31493
+ capName: "pipeline-analytics",
31494
+ capScope: "device",
31495
+ addonId: null,
31496
+ access: "view"
31497
+ },
31105
31498
  "pipelineAnalytics.deleteDeviceEvents": {
31106
31499
  capName: "pipeline-analytics",
31107
31500
  capScope: "device",
@@ -32260,6 +32653,12 @@ Object.freeze({
32260
32653
  addonId: null,
32261
32654
  access: "view"
32262
32655
  },
32656
+ "recording.getRelocateResidue": {
32657
+ capName: "recording",
32658
+ capScope: "system",
32659
+ addonId: null,
32660
+ access: "view"
32661
+ },
32263
32662
  "recording.getStorageMigrationMoveStatus": {
32264
32663
  capName: "recording",
32265
32664
  capScope: "system",
@@ -32806,12 +33205,30 @@ Object.freeze({
32806
33205
  addonId: null,
32807
33206
  access: "create"
32808
33207
  },
33208
+ "storageMigration.drain": {
33209
+ capName: "storage-migration",
33210
+ capScope: "system",
33211
+ addonId: null,
33212
+ access: "create"
33213
+ },
33214
+ "storageMigration.movers": {
33215
+ capName: "storage-migration",
33216
+ capScope: "system",
33217
+ addonId: null,
33218
+ access: "view"
33219
+ },
32809
33220
  "storageMigration.plan": {
32810
33221
  capName: "storage-migration",
32811
33222
  capScope: "system",
32812
33223
  addonId: null,
32813
33224
  access: "view"
32814
33225
  },
33226
+ "storageMigration.residue": {
33227
+ capName: "storage-migration",
33228
+ capScope: "system",
33229
+ addonId: null,
33230
+ access: "view"
33231
+ },
32815
33232
  "storageMigration.start": {
32816
33233
  capName: "storage-migration",
32817
33234
  capScope: "system",
@@ -33646,6 +34063,12 @@ Object.freeze({
33646
34063
  addonId: null,
33647
34064
  access: "delete"
33648
34065
  },
34066
+ "vectorStore.fetchByIds": {
34067
+ capName: "vector-store",
34068
+ capScope: "system",
34069
+ addonId: null,
34070
+ access: "view"
34071
+ },
33649
34072
  "vectorStore.getByIds": {
33650
34073
  capName: "vector-store",
33651
34074
  capScope: "system",
@@ -33658,6 +34081,12 @@ Object.freeze({
33658
34081
  addonId: null,
33659
34082
  access: "view"
33660
34083
  },
34084
+ "vectorStore.scan": {
34085
+ capName: "vector-store",
34086
+ capScope: "system",
34087
+ addonId: null,
34088
+ access: "view"
34089
+ },
33661
34090
  "vectorStore.stats": {
33662
34091
  capName: "vector-store",
33663
34092
  capScope: "system",
@@ -8063,18 +8063,61 @@ var RelocateFootageInputSchema = object({
8063
8063
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8064
8064
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8065
8065
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8066
+ /**
8067
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8068
+ * mover (the engine already walks both collections with a timestamp cursor and
8069
+ * already has a stamp-without-copy path).
8070
+ *
8071
+ * - `move` — the default and the historical behaviour: event-media and
8072
+ * retrain blobs move to `toLocationId` and their rows are
8073
+ * stamped. The enrolled gallery is skipped (D197).
8074
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8075
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8076
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8077
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8078
+ * instant a repoint moves that pointer the row reads from the
8079
+ * new disk while its bytes are on the old one.
8080
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8081
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8082
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8083
+ * never run beside a live second location: it is stop-the-world
8084
+ * by construction, which is acceptable only because the gallery
8085
+ * is a few KB per enrolled sample.
8086
+ */
8087
+ var MediaRelocateModeSchema = _enum([
8088
+ "move",
8089
+ "seal",
8090
+ "gallery"
8091
+ ]);
8066
8092
  var RelocateMediaInputSchema = object({
8067
8093
  toLocationId: string(),
8068
- throttleMbps: number().min(1).max(1e3).optional()
8094
+ throttleMbps: number().min(1).max(1e3).optional(),
8095
+ /** Omitted = `move`, the pre-existing behaviour. */
8096
+ mode: MediaRelocateModeSchema.optional()
8097
+ });
8098
+ /** How many rows still carry NO `locationId` — the population a repoint would
8099
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8100
+ * value that permits a non-blocking `eventMedia` cutover. */
8101
+ var UnstampedEventMediaCountSchema = object({
8102
+ media: number().int().nonnegative(),
8103
+ retrainFrames: number().int().nonnegative(),
8104
+ total: number().int().nonnegative()
8069
8105
  });
8070
8106
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8071
- /** The independently selectable logical storage classes. `recordings`
8072
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8073
- * segments; `eventMedia` is post-analysis blobs. */
8107
+ /** The independently selectable logical storage classes — every class
8108
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8109
+ * Zod enum error where they should meet an explanation.
8110
+ *
8111
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8112
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8113
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8114
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8074
8115
  var StorageMigrationClassSchema = _enum([
8075
8116
  "recordings",
8076
8117
  "recordingsLow",
8077
- "eventMedia"
8118
+ "eventMedia",
8119
+ "backups",
8120
+ "galleryMedia"
8078
8121
  ]);
8079
8122
  /** A destination is always an existing, fully-qualified location id. The
8080
8123
  * migration API intentionally never changes a source location's `basePath`:
@@ -8082,20 +8125,56 @@ var StorageMigrationClassSchema = _enum([
8082
8125
  var StorageMigrationDestinationsSchema = object({
8083
8126
  recordings: string().min(1).optional(),
8084
8127
  recordingsLow: string().min(1).optional(),
8085
- eventMedia: string().min(1).optional()
8128
+ eventMedia: string().min(1).optional(),
8129
+ backups: string().min(1).optional(),
8130
+ galleryMedia: string().min(1).optional()
8086
8131
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8132
+ /**
8133
+ * How a migration sequences the cutover against the byte move.
8134
+ *
8135
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8136
+ * resume. Recording is stopped for the whole move. Right
8137
+ * for a small or a cold class, and the only legal mode for
8138
+ * a `cardinality: 'single'` class.
8139
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8140
+ * refresh, resume, then move the past with everything
8141
+ * running. The pause is three bounded instants (a detach +
8142
+ * attach round, a write-gate drain, a lease) instead of one
8143
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8144
+ * stopped recording under `blocking`; the same move is
8145
+ * seconds of stopped recording under `nonBlocking`.
8146
+ *
8147
+ * The mode is on the JOB, not only on the input, because `status` is where an
8148
+ * operator finds out which one is running.
8149
+ */
8150
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8087
8151
  /** Shared input for planning and starting an orchestrated storage migration. */
8088
8152
  var StorageMigrationInputSchema = object({
8089
8153
  destinations: StorageMigrationDestinationsSchema,
8090
- throttleMbps: number().min(1).max(1e3).optional()
8154
+ throttleMbps: number().min(1).max(1e3).optional(),
8155
+ /** Omitted = `blocking`, which stays the default. */
8156
+ mode: StorageMigrationModeSchema.optional()
8091
8157
  });
8092
- /** The durable coordinator state machine. The only phase that changes default
8093
- * locations is `repointing`, after every selected mover has completed and been
8094
- * verified. */
8158
+ /**
8159
+ * The durable coordinator state machine.
8160
+ *
8161
+ * `blocking`:
8162
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8163
+ *
8164
+ * `nonBlocking`:
8165
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8166
+ *
8167
+ * Same phases, different order plus two new ones — not a second mover.
8168
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8169
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8170
+ * `repointing` is still the only phase that changes a default location.
8171
+ */
8095
8172
  var StorageMigrationPhaseSchema = _enum([
8096
8173
  "planning",
8174
+ "sealing",
8097
8175
  "pausing",
8098
8176
  "moving",
8177
+ "draining",
8099
8178
  "verifying",
8100
8179
  "repointing",
8101
8180
  "refreshing",
@@ -8109,17 +8188,56 @@ var StorageMigrationParticipantSchema = _enum([
8109
8188
  "recorder",
8110
8189
  "analytics"
8111
8190
  ]);
8191
+ /**
8192
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8193
+ *
8194
+ * The long half of a non-blocking migration is `draining`, and it is measured
8195
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8196
+ * existed the only place those numbers appeared was a Loki line, so an operator
8197
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8198
+ * afternoon.
8199
+ *
8200
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8201
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8202
+ * mover — which is the exact failure this is meant to end. The coordinator's
8203
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8204
+ * read `state`; folding the counters costs no extra read and makes the durable
8205
+ * record say afterwards how far a move actually got.
8206
+ *
8207
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8208
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8209
+ * cannot say M, and a 0 there would render as "100 % done".
8210
+ */
8211
+ var StorageMigrationMoveProgressSchema = object({
8212
+ filesMoved: number().int().nonnegative(),
8213
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8214
+ filesTotal: number().int().nonnegative().nullable(),
8215
+ bytesMoved: number().int().nonnegative(),
8216
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8217
+ * crash gets a new mover, and a rate computed from the migration's start
8218
+ * would silently average in the time nothing was running. */
8219
+ startedAt: number(),
8220
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8221
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8222
+ * subtract its own. */
8223
+ observedAt: number()
8224
+ });
8112
8225
  var StorageMigrationMoveSchema = object({
8113
8226
  storageClass: StorageMigrationClassSchema,
8114
8227
  fromLocationId: string(),
8115
8228
  toLocationId: string(),
8116
8229
  moverJobId: string().nullable(),
8117
8230
  state: RelocateJobStateSchema.nullable(),
8118
- error: string().nullable()
8231
+ error: string().nullable(),
8232
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8233
+ progress: StorageMigrationMoveProgressSchema.nullable()
8119
8234
  });
8120
8235
  var StorageMigrationJobSchema = object({
8121
8236
  jobId: string(),
8122
8237
  phase: StorageMigrationPhaseSchema,
8238
+ /** Which order this job is running. `status` is the only place an operator
8239
+ * can tell a seconds-long cutover from a thirty-hour one. */
8240
+ mode: StorageMigrationModeSchema,
8123
8241
  destinations: StorageMigrationDestinationsSchema,
8124
8242
  throttleMbps: number(),
8125
8243
  moves: array(StorageMigrationMoveSchema),
@@ -8132,13 +8250,122 @@ var StorageMigrationJobSchema = object({
8132
8250
  finishedAt: number().nullable(),
8133
8251
  error: string().nullable()
8134
8252
  });
8253
+ var StorageMigrationFindingSchema = object({
8254
+ code: _enum([
8255
+ "sharesDeviceWithSource",
8256
+ "deviceIdentityUnknown",
8257
+ "unstampedEventMediaRows",
8258
+ "blockingOnly",
8259
+ "noMover"
8260
+ ]),
8261
+ storageClass: StorageMigrationClassSchema,
8262
+ /** Human-readable, already carrying the ids and counts. */
8263
+ message: string()
8264
+ });
8135
8265
  var StorageMigrationPlanSchema = object({
8136
8266
  destinations: StorageMigrationDestinationsSchema,
8267
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8268
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8269
+ * it. */
8270
+ mode: StorageMigrationModeSchema,
8137
8271
  moves: array(object({
8138
8272
  storageClass: StorageMigrationClassSchema,
8139
8273
  fromLocationId: string(),
8140
8274
  toLocationId: string()
8141
- }))
8275
+ })),
8276
+ findings: array(StorageMigrationFindingSchema)
8277
+ });
8278
+ /**
8279
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8280
+ *
8281
+ * The coordinator's job record is the state of record for a migration, and its
8282
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8283
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8284
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8285
+ * way because no supported UI path existed. A mover armed like that has no job
8286
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8287
+ *
8288
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8289
+ * orchestrated it.
8290
+ */
8291
+ var StorageMigrationMoverSchema = object({
8292
+ lane: _enum(["footage", "media"]),
8293
+ job: RelocateJobSchema,
8294
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8295
+ * directly against the owning addon. */
8296
+ migrationJobId: string().nullable(),
8297
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8298
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8299
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8300
+ * rate made of two different clocks. */
8301
+ observedAt: number()
8302
+ });
8303
+ /**
8304
+ * What a SOURCE still holds for one storage class — the number that makes a
8305
+ * "drain remaining" action honest rather than hopeful.
8306
+ *
8307
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8308
+ * engine's own selection count for media), never from the resident index: a
8309
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8310
+ * never been told about (D295).
8311
+ *
8312
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8313
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8314
+ * because refusing on an unanswerable read would hide exactly the case an
8315
+ * operator needs to act on.
8316
+ */
8317
+ var StorageMigrationResidueSchema = object({
8318
+ storageClass: StorageMigrationClassSchema,
8319
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8320
+ * move from wherever they are rather than from one named source. */
8321
+ fromLocationId: string(),
8322
+ /** Where a drain would move it — the class's CURRENT default. */
8323
+ toLocationId: string(),
8324
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8325
+ items: number().int().nonnegative().nullable(),
8326
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8327
+ bytes: number().int().nonnegative().nullable()
8328
+ });
8329
+ /**
8330
+ * Run the DRAIN half and nothing else.
8331
+ *
8332
+ * A migration that reached `done` has already repointed, so `start` correctly
8333
+ * refuses its destination ("already the default") — there is nothing left to
8334
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8335
+ * or finish against a work list that was a tenth of the archive (D295), and
8336
+ * before this there was no supported way to run only that half: the only way
8337
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8338
+ *
8339
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8340
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8341
+ * re-repoint a class that is already migrated.
8342
+ */
8343
+ var StorageMigrationDrainInputSchema = object({
8344
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8345
+ * a class whose source is already empty is refused rather than started. */
8346
+ classes: array(StorageMigrationClassSchema).min(1),
8347
+ throttleMbps: number().min(1).max(1e3).optional()
8348
+ });
8349
+ /** What a footage source still holds, asked of the durable hour ledger. */
8350
+ var RelocateResidueInputSchema = object({
8351
+ fromLocationId: string().min(1),
8352
+ /** Narrow to one logical class; omit for every profile on the location. */
8353
+ footageClass: RelocateFootageClassSchema.optional()
8354
+ });
8355
+ /** `null` = the archive could not answer (no ledger on this node, or the
8356
+ * aggregate failed). Never conflated with an empty source. */
8357
+ var RelocateResidueSchema = object({
8358
+ segments: number().int().nonnegative(),
8359
+ bytes: number().int().nonnegative()
8360
+ }).nullable();
8361
+ /** How many rows a media pass would still act on against a given target — the
8362
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8363
+ * never disagree. `null` = the count could not be taken. */
8364
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8365
+ var RelocatableMediaCountInputSchema = object({
8366
+ toLocationId: string().min(1),
8367
+ /** Omitted = `move`. */
8368
+ mode: MediaRelocateModeSchema.optional()
8142
8369
  });
8143
8370
  /**
8144
8371
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8244,6 +8471,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8244
8471
  * two addons declaring the same `id` must agree on `cardinality` (validated
8245
8472
  * at kernel aggregation time, not here).
8246
8473
  */
8474
+ /**
8475
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8476
+ * actually reaches the bytes. It is the constraint that decides which
8477
+ * `storage-provider`s may back a location of that kind.
8478
+ *
8479
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8480
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8481
+ * post-analysis media roots). Only a provider that serves a genuine local
8482
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8483
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8484
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8485
+ * against a same-named local directory that is something else entirely.
8486
+ *
8487
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8488
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8489
+ * service never sees a path, so any provider can back it. `backups` is the
8490
+ * one kind that qualifies today.
8491
+ *
8492
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8493
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8494
+ * refused the configuration; the first write simply went somewhere wrong, and
8495
+ * a recording write that goes wrong surfaces as a silent black window rather
8496
+ * than an error (the read path does not `stat`). This turns that accident into
8497
+ * a declared, enforced, testable refusal.
8498
+ */
8499
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8247
8500
  var StorageLocationDeclarationSchema = object({
8248
8501
  /**
8249
8502
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8263,6 +8516,19 @@ var StorageLocationDeclarationSchema = object({
8263
8516
  */
8264
8517
  cardinality: _enum(["single", "multi"]),
8265
8518
  /**
8519
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8520
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8521
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8522
+ *
8523
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8524
+ * can only over-restrict (refuse a remote provider for a kind that might
8525
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8526
+ * permissive direction and is therefore never inferred — a repo guard
8527
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8528
+ * reached by omission.
8529
+ */
8530
+ access: StorageAccessSchema.optional(),
8531
+ /**
8266
8532
  * When set, the default instance for this location inherits its resolved
8267
8533
  * root from the named location's default instance. Useful for derivative
8268
8534
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17856,8 +18122,10 @@ var TrackSchema = object({
17856
18122
  lastSeen: number(),
17857
18123
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17858
18124
  positions: array(TrackPositionSchema).readonly(),
17859
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17860
- * saveThumbnails policy). */
18125
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18126
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18127
+ * the retired `saveThumbnails` used to gate this and the rolling
18128
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17861
18129
  snapshots: array(TrackSnapshotSchema).readonly(),
17862
18130
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17863
18131
  zonesVisited: array(string()).readonly(),
@@ -18717,6 +18985,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18717
18985
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18718
18986
  kind: "mutation",
18719
18987
  auth: "admin"
18988
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
18989
+ kind: "query",
18990
+ auth: "admin"
18720
18991
  }), method(object({}), array(RelocateJobSchema).readonly(), {
18721
18992
  kind: "query",
18722
18993
  auth: "admin"
@@ -20624,7 +20895,10 @@ method(object({
20624
20895
  }), StorageLocationSchema, {
20625
20896
  kind: "mutation",
20626
20897
  auth: "admin"
20627
- }), method(object({ id: string() }), _void(), {
20898
+ }), method(object({
20899
+ id: string(),
20900
+ force: boolean().optional()
20901
+ }), _void(), {
20628
20902
  kind: "mutation",
20629
20903
  auth: "admin"
20630
20904
  }), method(object({ id: string() }), object({
@@ -20673,6 +20947,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20673
20947
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20674
20948
  kind: "mutation",
20675
20949
  auth: "admin"
20950
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
20951
+ kind: "mutation",
20952
+ auth: "admin"
20676
20953
  });
20677
20954
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20678
20955
  providerId: string().min(1),
@@ -21071,12 +21348,38 @@ response: record(string(), unknown()) }), object({
21071
21348
  *
21072
21349
  * ## Why this is a capability and not a helper
21073
21350
  *
21074
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21075
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21076
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21077
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21078
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21079
- * load 5,000 rows before ranking anything.
21351
+ * This capability was introduced with the claim that SIX stores in
21352
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21353
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21354
+ * claim was never true, and leaving it here made five stores look like pending
21355
+ * work when three of them have no vector at all. Counted column by column on
21356
+ * 2026-08-30, exactly THREE ever held one:
21357
+ *
21358
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21359
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21360
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21361
+ * face, migrated 2026-08-30 into its OWN index (see below).
21362
+ *
21363
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21364
+ * and `identities` store a name; the event store stores no derivative vector.
21365
+ * They are not migration candidates and never were.
21366
+ *
21367
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21368
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21369
+ * rows before ranking anything.
21370
+ *
21371
+ * ## One index per COMPARISON, never per encoder
21372
+ *
21373
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21374
+ * model, and they still get two indexes. An index is a set of things that are
21375
+ * ranked against each other and that live and die together, and these two are
21376
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21377
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21378
+ * forever and is the gallery every recognition ranks against. One index would
21379
+ * mean every gallery load and every reconcile carried a filter whose failure
21380
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21381
+ * person's only sample. The dimension they share is not a reason to share an
21382
+ * index; the question they answer is, and it differs.
21080
21383
  *
21081
21384
  * The fix is not a faster loop, it is a different backend — and the backend
21082
21385
  * should be replaceable without touching six callers. So: a singleton
@@ -21181,7 +21484,20 @@ var VectorQueryResultSchema = object({
21181
21484
  */
21182
21485
  scanned: number(),
21183
21486
  /** True when the backend could not consider every row that passed the filter. */
21184
- truncated: boolean()
21487
+ truncated: boolean(),
21488
+ /**
21489
+ * The `topK` the backend actually ran with.
21490
+ *
21491
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21492
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21493
+ * own log rather than in its answer. That is how an audit asking for 20,000
21494
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21495
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21496
+ * MUCH, in the return value, where the caller cannot fail to see it.
21497
+ *
21498
+ * Equals the requested `topK` whenever nothing was lowered.
21499
+ */
21500
+ effectiveTopK: number().int().positive()
21185
21501
  });
21186
21502
  var VectorDeleteInputSchema = object({
21187
21503
  index: string(),
@@ -21210,6 +21526,68 @@ var VectorGetResultSchema = object({ items: array(object({
21210
21526
  id: string(),
21211
21527
  metadata: VectorMetadataSchema
21212
21528
  })) });
21529
+ /**
21530
+ * Ids to read back WITH their vectors.
21531
+ *
21532
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21533
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21534
+ * caller depends on that promise. This one promises the opposite.
21535
+ *
21536
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21537
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21538
+ * a per-face cross-process KNN would be a network round trip inside the
21539
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21540
+ * it requires the index to hand the floats back. Without this method the only
21541
+ * way to keep a readable vector is a JSON column, which is the thing this
21542
+ * capability exists to delete.
21543
+ *
21544
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21545
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21546
+ */
21547
+ var VectorFetchInputSchema = object({
21548
+ index: string(),
21549
+ ids: array(string())
21550
+ });
21551
+ var VectorFetchResultSchema = object({ items: array(object({
21552
+ id: string(),
21553
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21554
+ vector: string(),
21555
+ metadata: VectorMetadataSchema
21556
+ })) });
21557
+ /**
21558
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21559
+ *
21560
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21561
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21562
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21563
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21564
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21565
+ * looked" for as long as anyone cared to read it.
21566
+ *
21567
+ * This is the primitive that question actually needs: a bounded page, ordered
21568
+ * by the backend's own row order, costing no distance computation at all.
21569
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21570
+ * the full-table read this capability was built to stop.
21571
+ */
21572
+ var VectorScanInputSchema = object({
21573
+ index: string(),
21574
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21575
+ cursor: number().int().nonnegative().default(0),
21576
+ limit: number().int().positive()
21577
+ });
21578
+ var VectorScanResultSchema = object({
21579
+ items: array(object({
21580
+ id: string(),
21581
+ metadata: VectorMetadataSchema
21582
+ })),
21583
+ /**
21584
+ * Where the next page starts, or `null` when the walk reached the end.
21585
+ *
21586
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21587
+ * from a short page: a backend is free to return fewer rows than asked.
21588
+ */
21589
+ nextCursor: number().int().nonnegative().nullable()
21590
+ });
21213
21591
  var VectorStatsInputSchema = object({ index: string() });
21214
21592
  var VectorStatsResultSchema = object({
21215
21593
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21228,7 +21606,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21228
21606
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21229
21607
  kind: "mutation",
21230
21608
  auth: "admin"
21231
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21609
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21232
21610
  kind: "mutation",
21233
21611
  auth: "admin"
21234
21612
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26132,6 +26510,9 @@ method(object({
26132
26510
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26133
26511
  kind: "query",
26134
26512
  auth: "admin"
26513
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26514
+ kind: "query",
26515
+ auth: "admin"
26135
26516
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26136
26517
  kind: "mutation",
26137
26518
  auth: "admin"
@@ -31097,6 +31478,18 @@ Object.freeze({
31097
31478
  addonId: null,
31098
31479
  access: "create"
31099
31480
  },
31481
+ "pipelineAnalytics.countRelocatableMedia": {
31482
+ capName: "pipeline-analytics",
31483
+ capScope: "device",
31484
+ addonId: null,
31485
+ access: "view"
31486
+ },
31487
+ "pipelineAnalytics.countUnstampedEventMedia": {
31488
+ capName: "pipeline-analytics",
31489
+ capScope: "device",
31490
+ addonId: null,
31491
+ access: "view"
31492
+ },
31100
31493
  "pipelineAnalytics.deleteDeviceEvents": {
31101
31494
  capName: "pipeline-analytics",
31102
31495
  capScope: "device",
@@ -32255,6 +32648,12 @@ Object.freeze({
32255
32648
  addonId: null,
32256
32649
  access: "view"
32257
32650
  },
32651
+ "recording.getRelocateResidue": {
32652
+ capName: "recording",
32653
+ capScope: "system",
32654
+ addonId: null,
32655
+ access: "view"
32656
+ },
32258
32657
  "recording.getStorageMigrationMoveStatus": {
32259
32658
  capName: "recording",
32260
32659
  capScope: "system",
@@ -32801,12 +33200,30 @@ Object.freeze({
32801
33200
  addonId: null,
32802
33201
  access: "create"
32803
33202
  },
33203
+ "storageMigration.drain": {
33204
+ capName: "storage-migration",
33205
+ capScope: "system",
33206
+ addonId: null,
33207
+ access: "create"
33208
+ },
33209
+ "storageMigration.movers": {
33210
+ capName: "storage-migration",
33211
+ capScope: "system",
33212
+ addonId: null,
33213
+ access: "view"
33214
+ },
32804
33215
  "storageMigration.plan": {
32805
33216
  capName: "storage-migration",
32806
33217
  capScope: "system",
32807
33218
  addonId: null,
32808
33219
  access: "view"
32809
33220
  },
33221
+ "storageMigration.residue": {
33222
+ capName: "storage-migration",
33223
+ capScope: "system",
33224
+ addonId: null,
33225
+ access: "view"
33226
+ },
32810
33227
  "storageMigration.start": {
32811
33228
  capName: "storage-migration",
32812
33229
  capScope: "system",
@@ -33641,6 +34058,12 @@ Object.freeze({
33641
34058
  addonId: null,
33642
34059
  access: "delete"
33643
34060
  },
34061
+ "vectorStore.fetchByIds": {
34062
+ capName: "vector-store",
34063
+ capScope: "system",
34064
+ addonId: null,
34065
+ access: "view"
34066
+ },
33644
34067
  "vectorStore.getByIds": {
33645
34068
  capName: "vector-store",
33646
34069
  capScope: "system",
@@ -33653,6 +34076,12 @@ Object.freeze({
33653
34076
  addonId: null,
33654
34077
  access: "view"
33655
34078
  },
34079
+ "vectorStore.scan": {
34080
+ capName: "vector-store",
34081
+ capScope: "system",
34082
+ addonId: null,
34083
+ access: "view"
34084
+ },
33656
34085
  "vectorStore.stats": {
33657
34086
  capName: "vector-store",
33658
34087
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-mqtt-broker",
3
- "version": "1.2.42",
3
+ "version": "1.2.45",
4
4
  "description": "MQTT broker registry addon for CamStack — manages external broker entries + an optional embedded aedes broker. Consumers spin up their own `mqtt.js` clients via the `mqtt-broker` cap.",
5
5
  "keywords": [
6
6
  "camstack",