@camstack/addon-smtp-nodemailer 1.2.41 → 1.2.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8060,18 +8060,61 @@ var RelocateFootageInputSchema = object({
8060
8060
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8061
8061
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8062
8062
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8063
+ /**
8064
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8065
+ * mover (the engine already walks both collections with a timestamp cursor and
8066
+ * already has a stamp-without-copy path).
8067
+ *
8068
+ * - `move` — the default and the historical behaviour: event-media and
8069
+ * retrain blobs move to `toLocationId` and their rows are
8070
+ * stamped. The enrolled gallery is skipped (D197).
8071
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8072
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8073
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8074
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8075
+ * instant a repoint moves that pointer the row reads from the
8076
+ * new disk while its bytes are on the old one.
8077
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8078
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8079
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8080
+ * never run beside a live second location: it is stop-the-world
8081
+ * by construction, which is acceptable only because the gallery
8082
+ * is a few KB per enrolled sample.
8083
+ */
8084
+ var MediaRelocateModeSchema = _enum([
8085
+ "move",
8086
+ "seal",
8087
+ "gallery"
8088
+ ]);
8063
8089
  var RelocateMediaInputSchema = object({
8064
8090
  toLocationId: string(),
8065
- throttleMbps: number().min(1).max(1e3).optional()
8091
+ throttleMbps: number().min(1).max(1e3).optional(),
8092
+ /** Omitted = `move`, the pre-existing behaviour. */
8093
+ mode: MediaRelocateModeSchema.optional()
8094
+ });
8095
+ /** How many rows still carry NO `locationId` — the population a repoint would
8096
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8097
+ * value that permits a non-blocking `eventMedia` cutover. */
8098
+ var UnstampedEventMediaCountSchema = object({
8099
+ media: number().int().nonnegative(),
8100
+ retrainFrames: number().int().nonnegative(),
8101
+ total: number().int().nonnegative()
8066
8102
  });
8067
8103
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8068
- /** The independently selectable logical storage classes. `recordings`
8069
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8070
- * segments; `eventMedia` is post-analysis blobs. */
8104
+ /** The independently selectable logical storage classes — every class
8105
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8106
+ * Zod enum error where they should meet an explanation.
8107
+ *
8108
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8109
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8110
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8111
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8071
8112
  var StorageMigrationClassSchema = _enum([
8072
8113
  "recordings",
8073
8114
  "recordingsLow",
8074
- "eventMedia"
8115
+ "eventMedia",
8116
+ "backups",
8117
+ "galleryMedia"
8075
8118
  ]);
8076
8119
  /** A destination is always an existing, fully-qualified location id. The
8077
8120
  * migration API intentionally never changes a source location's `basePath`:
@@ -8079,20 +8122,56 @@ var StorageMigrationClassSchema = _enum([
8079
8122
  var StorageMigrationDestinationsSchema = object({
8080
8123
  recordings: string().min(1).optional(),
8081
8124
  recordingsLow: string().min(1).optional(),
8082
- eventMedia: string().min(1).optional()
8125
+ eventMedia: string().min(1).optional(),
8126
+ backups: string().min(1).optional(),
8127
+ galleryMedia: string().min(1).optional()
8083
8128
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8129
+ /**
8130
+ * How a migration sequences the cutover against the byte move.
8131
+ *
8132
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8133
+ * resume. Recording is stopped for the whole move. Right
8134
+ * for a small or a cold class, and the only legal mode for
8135
+ * a `cardinality: 'single'` class.
8136
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8137
+ * refresh, resume, then move the past with everything
8138
+ * running. The pause is three bounded instants (a detach +
8139
+ * attach round, a write-gate drain, a lease) instead of one
8140
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8141
+ * stopped recording under `blocking`; the same move is
8142
+ * seconds of stopped recording under `nonBlocking`.
8143
+ *
8144
+ * The mode is on the JOB, not only on the input, because `status` is where an
8145
+ * operator finds out which one is running.
8146
+ */
8147
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8084
8148
  /** Shared input for planning and starting an orchestrated storage migration. */
8085
8149
  var StorageMigrationInputSchema = object({
8086
8150
  destinations: StorageMigrationDestinationsSchema,
8087
- throttleMbps: number().min(1).max(1e3).optional()
8151
+ throttleMbps: number().min(1).max(1e3).optional(),
8152
+ /** Omitted = `blocking`, which stays the default. */
8153
+ mode: StorageMigrationModeSchema.optional()
8088
8154
  });
8089
- /** The durable coordinator state machine. The only phase that changes default
8090
- * locations is `repointing`, after every selected mover has completed and been
8091
- * verified. */
8155
+ /**
8156
+ * The durable coordinator state machine.
8157
+ *
8158
+ * `blocking`:
8159
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8160
+ *
8161
+ * `nonBlocking`:
8162
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8163
+ *
8164
+ * Same phases, different order plus two new ones — not a second mover.
8165
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8166
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8167
+ * `repointing` is still the only phase that changes a default location.
8168
+ */
8092
8169
  var StorageMigrationPhaseSchema = _enum([
8093
8170
  "planning",
8171
+ "sealing",
8094
8172
  "pausing",
8095
8173
  "moving",
8174
+ "draining",
8096
8175
  "verifying",
8097
8176
  "repointing",
8098
8177
  "refreshing",
@@ -8106,17 +8185,56 @@ var StorageMigrationParticipantSchema = _enum([
8106
8185
  "recorder",
8107
8186
  "analytics"
8108
8187
  ]);
8188
+ /**
8189
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8190
+ *
8191
+ * The long half of a non-blocking migration is `draining`, and it is measured
8192
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8193
+ * existed the only place those numbers appeared was a Loki line, so an operator
8194
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8195
+ * afternoon.
8196
+ *
8197
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8198
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8199
+ * mover — which is the exact failure this is meant to end. The coordinator's
8200
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8201
+ * read `state`; folding the counters costs no extra read and makes the durable
8202
+ * record say afterwards how far a move actually got.
8203
+ *
8204
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8205
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8206
+ * cannot say M, and a 0 there would render as "100 % done".
8207
+ */
8208
+ var StorageMigrationMoveProgressSchema = object({
8209
+ filesMoved: number().int().nonnegative(),
8210
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8211
+ filesTotal: number().int().nonnegative().nullable(),
8212
+ bytesMoved: number().int().nonnegative(),
8213
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8214
+ * crash gets a new mover, and a rate computed from the migration's start
8215
+ * would silently average in the time nothing was running. */
8216
+ startedAt: number(),
8217
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8218
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8219
+ * subtract its own. */
8220
+ observedAt: number()
8221
+ });
8109
8222
  var StorageMigrationMoveSchema = object({
8110
8223
  storageClass: StorageMigrationClassSchema,
8111
8224
  fromLocationId: string(),
8112
8225
  toLocationId: string(),
8113
8226
  moverJobId: string().nullable(),
8114
8227
  state: RelocateJobStateSchema.nullable(),
8115
- error: string().nullable()
8228
+ error: string().nullable(),
8229
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8230
+ progress: StorageMigrationMoveProgressSchema.nullable()
8116
8231
  });
8117
8232
  var StorageMigrationJobSchema = object({
8118
8233
  jobId: string(),
8119
8234
  phase: StorageMigrationPhaseSchema,
8235
+ /** Which order this job is running. `status` is the only place an operator
8236
+ * can tell a seconds-long cutover from a thirty-hour one. */
8237
+ mode: StorageMigrationModeSchema,
8120
8238
  destinations: StorageMigrationDestinationsSchema,
8121
8239
  throttleMbps: number(),
8122
8240
  moves: array(StorageMigrationMoveSchema),
@@ -8129,13 +8247,122 @@ var StorageMigrationJobSchema = object({
8129
8247
  finishedAt: number().nullable(),
8130
8248
  error: string().nullable()
8131
8249
  });
8250
+ var StorageMigrationFindingSchema = object({
8251
+ code: _enum([
8252
+ "sharesDeviceWithSource",
8253
+ "deviceIdentityUnknown",
8254
+ "unstampedEventMediaRows",
8255
+ "blockingOnly",
8256
+ "noMover"
8257
+ ]),
8258
+ storageClass: StorageMigrationClassSchema,
8259
+ /** Human-readable, already carrying the ids and counts. */
8260
+ message: string()
8261
+ });
8132
8262
  var StorageMigrationPlanSchema = object({
8133
8263
  destinations: StorageMigrationDestinationsSchema,
8264
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8265
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8266
+ * it. */
8267
+ mode: StorageMigrationModeSchema,
8134
8268
  moves: array(object({
8135
8269
  storageClass: StorageMigrationClassSchema,
8136
8270
  fromLocationId: string(),
8137
8271
  toLocationId: string()
8138
- }))
8272
+ })),
8273
+ findings: array(StorageMigrationFindingSchema)
8274
+ });
8275
+ /**
8276
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8277
+ *
8278
+ * The coordinator's job record is the state of record for a migration, and its
8279
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8280
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8281
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8282
+ * way because no supported UI path existed. A mover armed like that has no job
8283
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8284
+ *
8285
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8286
+ * orchestrated it.
8287
+ */
8288
+ var StorageMigrationMoverSchema = object({
8289
+ lane: _enum(["footage", "media"]),
8290
+ job: RelocateJobSchema,
8291
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8292
+ * directly against the owning addon. */
8293
+ migrationJobId: string().nullable(),
8294
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8295
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8296
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8297
+ * rate made of two different clocks. */
8298
+ observedAt: number()
8299
+ });
8300
+ /**
8301
+ * What a SOURCE still holds for one storage class — the number that makes a
8302
+ * "drain remaining" action honest rather than hopeful.
8303
+ *
8304
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8305
+ * engine's own selection count for media), never from the resident index: a
8306
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8307
+ * never been told about (D295).
8308
+ *
8309
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8310
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8311
+ * because refusing on an unanswerable read would hide exactly the case an
8312
+ * operator needs to act on.
8313
+ */
8314
+ var StorageMigrationResidueSchema = object({
8315
+ storageClass: StorageMigrationClassSchema,
8316
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8317
+ * move from wherever they are rather than from one named source. */
8318
+ fromLocationId: string(),
8319
+ /** Where a drain would move it — the class's CURRENT default. */
8320
+ toLocationId: string(),
8321
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8322
+ items: number().int().nonnegative().nullable(),
8323
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8324
+ bytes: number().int().nonnegative().nullable()
8325
+ });
8326
+ /**
8327
+ * Run the DRAIN half and nothing else.
8328
+ *
8329
+ * A migration that reached `done` has already repointed, so `start` correctly
8330
+ * refuses its destination ("already the default") — there is nothing left to
8331
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8332
+ * or finish against a work list that was a tenth of the archive (D295), and
8333
+ * before this there was no supported way to run only that half: the only way
8334
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8335
+ *
8336
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8337
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8338
+ * re-repoint a class that is already migrated.
8339
+ */
8340
+ var StorageMigrationDrainInputSchema = object({
8341
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8342
+ * a class whose source is already empty is refused rather than started. */
8343
+ classes: array(StorageMigrationClassSchema).min(1),
8344
+ throttleMbps: number().min(1).max(1e3).optional()
8345
+ });
8346
+ /** What a footage source still holds, asked of the durable hour ledger. */
8347
+ var RelocateResidueInputSchema = object({
8348
+ fromLocationId: string().min(1),
8349
+ /** Narrow to one logical class; omit for every profile on the location. */
8350
+ footageClass: RelocateFootageClassSchema.optional()
8351
+ });
8352
+ /** `null` = the archive could not answer (no ledger on this node, or the
8353
+ * aggregate failed). Never conflated with an empty source. */
8354
+ var RelocateResidueSchema = object({
8355
+ segments: number().int().nonnegative(),
8356
+ bytes: number().int().nonnegative()
8357
+ }).nullable();
8358
+ /** How many rows a media pass would still act on against a given target — the
8359
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8360
+ * never disagree. `null` = the count could not be taken. */
8361
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8362
+ var RelocatableMediaCountInputSchema = object({
8363
+ toLocationId: string().min(1),
8364
+ /** Omitted = `move`. */
8365
+ mode: MediaRelocateModeSchema.optional()
8139
8366
  });
8140
8367
  /**
8141
8368
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8241,6 +8468,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8241
8468
  * two addons declaring the same `id` must agree on `cardinality` (validated
8242
8469
  * at kernel aggregation time, not here).
8243
8470
  */
8471
+ /**
8472
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8473
+ * actually reaches the bytes. It is the constraint that decides which
8474
+ * `storage-provider`s may back a location of that kind.
8475
+ *
8476
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8477
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8478
+ * post-analysis media roots). Only a provider that serves a genuine local
8479
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8480
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8481
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8482
+ * against a same-named local directory that is something else entirely.
8483
+ *
8484
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8485
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8486
+ * service never sees a path, so any provider can back it. `backups` is the
8487
+ * one kind that qualifies today.
8488
+ *
8489
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8490
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8491
+ * refused the configuration; the first write simply went somewhere wrong, and
8492
+ * a recording write that goes wrong surfaces as a silent black window rather
8493
+ * than an error (the read path does not `stat`). This turns that accident into
8494
+ * a declared, enforced, testable refusal.
8495
+ */
8496
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8244
8497
  var StorageLocationDeclarationSchema = object({
8245
8498
  /**
8246
8499
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8260,6 +8513,19 @@ var StorageLocationDeclarationSchema = object({
8260
8513
  */
8261
8514
  cardinality: _enum(["single", "multi"]),
8262
8515
  /**
8516
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8517
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8518
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8519
+ *
8520
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8521
+ * can only over-restrict (refuse a remote provider for a kind that might
8522
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8523
+ * permissive direction and is therefore never inferred — a repo guard
8524
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8525
+ * reached by omission.
8526
+ */
8527
+ access: StorageAccessSchema.optional(),
8528
+ /**
8263
8529
  * When set, the default instance for this location inherits its resolved
8264
8530
  * root from the named location's default instance. Useful for derivative
8265
8531
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17785,8 +18051,10 @@ var TrackSchema = object({
17785
18051
  lastSeen: number(),
17786
18052
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17787
18053
  positions: array(TrackPositionSchema).readonly(),
17788
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17789
- * saveThumbnails policy). */
18054
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18055
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18056
+ * the retired `saveThumbnails` used to gate this and the rolling
18057
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17790
18058
  snapshots: array(TrackSnapshotSchema).readonly(),
17791
18059
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17792
18060
  zonesVisited: array(string()).readonly(),
@@ -18646,6 +18914,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18646
18914
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18647
18915
  kind: "mutation",
18648
18916
  auth: "admin"
18917
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
18918
+ kind: "query",
18919
+ auth: "admin"
18649
18920
  }), method(object({}), array(RelocateJobSchema).readonly(), {
18650
18921
  kind: "query",
18651
18922
  auth: "admin"
@@ -20566,7 +20837,10 @@ method(object({
20566
20837
  }), StorageLocationSchema, {
20567
20838
  kind: "mutation",
20568
20839
  auth: "admin"
20569
- }), method(object({ id: string() }), _void(), {
20840
+ }), method(object({
20841
+ id: string(),
20842
+ force: boolean().optional()
20843
+ }), _void(), {
20570
20844
  kind: "mutation",
20571
20845
  auth: "admin"
20572
20846
  }), method(object({ id: string() }), object({
@@ -20615,6 +20889,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20615
20889
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20616
20890
  kind: "mutation",
20617
20891
  auth: "admin"
20892
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
20893
+ kind: "mutation",
20894
+ auth: "admin"
20618
20895
  });
20619
20896
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20620
20897
  providerId: string().min(1),
@@ -21013,12 +21290,38 @@ response: record(string(), unknown()) }), object({
21013
21290
  *
21014
21291
  * ## Why this is a capability and not a helper
21015
21292
  *
21016
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21017
- * plate, vehicle, identity, and the event store's derivativesand every one of
21018
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21019
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21020
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21021
- * load 5,000 rows before ranking anything.
21293
+ * This capability was introduced with the claim that SIX stores in
21294
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21295
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21296
+ * claim was never true, and leaving it here made five stores look like pending
21297
+ * work when three of them have no vector at all. Counted column by column on
21298
+ * 2026-08-30, exactly THREE ever held one:
21299
+ *
21300
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21301
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21302
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21303
+ * face, migrated 2026-08-30 into its OWN index (see below).
21304
+ *
21305
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21306
+ * and `identities` store a name; the event store stores no derivative vector.
21307
+ * They are not migration candidates and never were.
21308
+ *
21309
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21310
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21311
+ * rows before ranking anything.
21312
+ *
21313
+ * ## One index per COMPARISON, never per encoder
21314
+ *
21315
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21316
+ * model, and they still get two indexes. An index is a set of things that are
21317
+ * ranked against each other and that live and die together, and these two are
21318
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21319
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21320
+ * forever and is the gallery every recognition ranks against. One index would
21321
+ * mean every gallery load and every reconcile carried a filter whose failure
21322
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21323
+ * person's only sample. The dimension they share is not a reason to share an
21324
+ * index; the question they answer is, and it differs.
21022
21325
  *
21023
21326
  * The fix is not a faster loop, it is a different backend — and the backend
21024
21327
  * should be replaceable without touching six callers. So: a singleton
@@ -21123,7 +21426,20 @@ var VectorQueryResultSchema = object({
21123
21426
  */
21124
21427
  scanned: number(),
21125
21428
  /** True when the backend could not consider every row that passed the filter. */
21126
- truncated: boolean()
21429
+ truncated: boolean(),
21430
+ /**
21431
+ * The `topK` the backend actually ran with.
21432
+ *
21433
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21434
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21435
+ * own log rather than in its answer. That is how an audit asking for 20,000
21436
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21437
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21438
+ * MUCH, in the return value, where the caller cannot fail to see it.
21439
+ *
21440
+ * Equals the requested `topK` whenever nothing was lowered.
21441
+ */
21442
+ effectiveTopK: number().int().positive()
21127
21443
  });
21128
21444
  var VectorDeleteInputSchema = object({
21129
21445
  index: string(),
@@ -21152,6 +21468,68 @@ var VectorGetResultSchema = object({ items: array(object({
21152
21468
  id: string(),
21153
21469
  metadata: VectorMetadataSchema
21154
21470
  })) });
21471
+ /**
21472
+ * Ids to read back WITH their vectors.
21473
+ *
21474
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21475
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21476
+ * caller depends on that promise. This one promises the opposite.
21477
+ *
21478
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21479
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21480
+ * a per-face cross-process KNN would be a network round trip inside the
21481
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21482
+ * it requires the index to hand the floats back. Without this method the only
21483
+ * way to keep a readable vector is a JSON column, which is the thing this
21484
+ * capability exists to delete.
21485
+ *
21486
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21487
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21488
+ */
21489
+ var VectorFetchInputSchema = object({
21490
+ index: string(),
21491
+ ids: array(string())
21492
+ });
21493
+ var VectorFetchResultSchema = object({ items: array(object({
21494
+ id: string(),
21495
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21496
+ vector: string(),
21497
+ metadata: VectorMetadataSchema
21498
+ })) });
21499
+ /**
21500
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21501
+ *
21502
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21503
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21504
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21505
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21506
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21507
+ * looked" for as long as anyone cared to read it.
21508
+ *
21509
+ * This is the primitive that question actually needs: a bounded page, ordered
21510
+ * by the backend's own row order, costing no distance computation at all.
21511
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21512
+ * the full-table read this capability was built to stop.
21513
+ */
21514
+ var VectorScanInputSchema = object({
21515
+ index: string(),
21516
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21517
+ cursor: number().int().nonnegative().default(0),
21518
+ limit: number().int().positive()
21519
+ });
21520
+ var VectorScanResultSchema = object({
21521
+ items: array(object({
21522
+ id: string(),
21523
+ metadata: VectorMetadataSchema
21524
+ })),
21525
+ /**
21526
+ * Where the next page starts, or `null` when the walk reached the end.
21527
+ *
21528
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21529
+ * from a short page: a backend is free to return fewer rows than asked.
21530
+ */
21531
+ nextCursor: number().int().nonnegative().nullable()
21532
+ });
21155
21533
  var VectorStatsInputSchema = object({ index: string() });
21156
21534
  var VectorStatsResultSchema = object({
21157
21535
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21170,7 +21548,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21170
21548
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21171
21549
  kind: "mutation",
21172
21550
  auth: "admin"
21173
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21551
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21174
21552
  kind: "mutation",
21175
21553
  auth: "admin"
21176
21554
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26074,6 +26452,9 @@ method(object({
26074
26452
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26075
26453
  kind: "query",
26076
26454
  auth: "admin"
26455
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26456
+ kind: "query",
26457
+ auth: "admin"
26077
26458
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26078
26459
  kind: "mutation",
26079
26460
  auth: "admin"
@@ -31039,6 +31420,18 @@ Object.freeze({
31039
31420
  addonId: null,
31040
31421
  access: "create"
31041
31422
  },
31423
+ "pipelineAnalytics.countRelocatableMedia": {
31424
+ capName: "pipeline-analytics",
31425
+ capScope: "device",
31426
+ addonId: null,
31427
+ access: "view"
31428
+ },
31429
+ "pipelineAnalytics.countUnstampedEventMedia": {
31430
+ capName: "pipeline-analytics",
31431
+ capScope: "device",
31432
+ addonId: null,
31433
+ access: "view"
31434
+ },
31042
31435
  "pipelineAnalytics.deleteDeviceEvents": {
31043
31436
  capName: "pipeline-analytics",
31044
31437
  capScope: "device",
@@ -32197,6 +32590,12 @@ Object.freeze({
32197
32590
  addonId: null,
32198
32591
  access: "view"
32199
32592
  },
32593
+ "recording.getRelocateResidue": {
32594
+ capName: "recording",
32595
+ capScope: "system",
32596
+ addonId: null,
32597
+ access: "view"
32598
+ },
32200
32599
  "recording.getStorageMigrationMoveStatus": {
32201
32600
  capName: "recording",
32202
32601
  capScope: "system",
@@ -32743,12 +33142,30 @@ Object.freeze({
32743
33142
  addonId: null,
32744
33143
  access: "create"
32745
33144
  },
33145
+ "storageMigration.drain": {
33146
+ capName: "storage-migration",
33147
+ capScope: "system",
33148
+ addonId: null,
33149
+ access: "create"
33150
+ },
33151
+ "storageMigration.movers": {
33152
+ capName: "storage-migration",
33153
+ capScope: "system",
33154
+ addonId: null,
33155
+ access: "view"
33156
+ },
32746
33157
  "storageMigration.plan": {
32747
33158
  capName: "storage-migration",
32748
33159
  capScope: "system",
32749
33160
  addonId: null,
32750
33161
  access: "view"
32751
33162
  },
33163
+ "storageMigration.residue": {
33164
+ capName: "storage-migration",
33165
+ capScope: "system",
33166
+ addonId: null,
33167
+ access: "view"
33168
+ },
32752
33169
  "storageMigration.start": {
32753
33170
  capName: "storage-migration",
32754
33171
  capScope: "system",
@@ -33583,6 +34000,12 @@ Object.freeze({
33583
34000
  addonId: null,
33584
34001
  access: "delete"
33585
34002
  },
34003
+ "vectorStore.fetchByIds": {
34004
+ capName: "vector-store",
34005
+ capScope: "system",
34006
+ addonId: null,
34007
+ access: "view"
34008
+ },
33586
34009
  "vectorStore.getByIds": {
33587
34010
  capName: "vector-store",
33588
34011
  capScope: "system",
@@ -33595,6 +34018,12 @@ Object.freeze({
33595
34018
  addonId: null,
33596
34019
  access: "view"
33597
34020
  },
34021
+ "vectorStore.scan": {
34022
+ capName: "vector-store",
34023
+ capScope: "system",
34024
+ addonId: null,
34025
+ access: "view"
34026
+ },
33598
34027
  "vectorStore.stats": {
33599
34028
  capName: "vector-store",
33600
34029
  capScope: "system",
@@ -8058,18 +8058,61 @@ var RelocateFootageInputSchema = object({
8058
8058
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8059
8059
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8060
8060
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8061
+ /**
8062
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8063
+ * mover (the engine already walks both collections with a timestamp cursor and
8064
+ * already has a stamp-without-copy path).
8065
+ *
8066
+ * - `move` — the default and the historical behaviour: event-media and
8067
+ * retrain blobs move to `toLocationId` and their rows are
8068
+ * stamped. The enrolled gallery is skipped (D197).
8069
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8070
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8071
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8072
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8073
+ * instant a repoint moves that pointer the row reads from the
8074
+ * new disk while its bytes are on the old one.
8075
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8076
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8077
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8078
+ * never run beside a live second location: it is stop-the-world
8079
+ * by construction, which is acceptable only because the gallery
8080
+ * is a few KB per enrolled sample.
8081
+ */
8082
+ var MediaRelocateModeSchema = _enum([
8083
+ "move",
8084
+ "seal",
8085
+ "gallery"
8086
+ ]);
8061
8087
  var RelocateMediaInputSchema = object({
8062
8088
  toLocationId: string(),
8063
- throttleMbps: number().min(1).max(1e3).optional()
8089
+ throttleMbps: number().min(1).max(1e3).optional(),
8090
+ /** Omitted = `move`, the pre-existing behaviour. */
8091
+ mode: MediaRelocateModeSchema.optional()
8092
+ });
8093
+ /** How many rows still carry NO `locationId` — the population a repoint would
8094
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8095
+ * value that permits a non-blocking `eventMedia` cutover. */
8096
+ var UnstampedEventMediaCountSchema = object({
8097
+ media: number().int().nonnegative(),
8098
+ retrainFrames: number().int().nonnegative(),
8099
+ total: number().int().nonnegative()
8064
8100
  });
8065
8101
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8066
- /** The independently selectable logical storage classes. `recordings`
8067
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8068
- * segments; `eventMedia` is post-analysis blobs. */
8102
+ /** The independently selectable logical storage classes — every class
8103
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8104
+ * Zod enum error where they should meet an explanation.
8105
+ *
8106
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8107
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8108
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8109
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8069
8110
  var StorageMigrationClassSchema = _enum([
8070
8111
  "recordings",
8071
8112
  "recordingsLow",
8072
- "eventMedia"
8113
+ "eventMedia",
8114
+ "backups",
8115
+ "galleryMedia"
8073
8116
  ]);
8074
8117
  /** A destination is always an existing, fully-qualified location id. The
8075
8118
  * migration API intentionally never changes a source location's `basePath`:
@@ -8077,20 +8120,56 @@ var StorageMigrationClassSchema = _enum([
8077
8120
  var StorageMigrationDestinationsSchema = object({
8078
8121
  recordings: string().min(1).optional(),
8079
8122
  recordingsLow: string().min(1).optional(),
8080
- eventMedia: string().min(1).optional()
8123
+ eventMedia: string().min(1).optional(),
8124
+ backups: string().min(1).optional(),
8125
+ galleryMedia: string().min(1).optional()
8081
8126
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8127
+ /**
8128
+ * How a migration sequences the cutover against the byte move.
8129
+ *
8130
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8131
+ * resume. Recording is stopped for the whole move. Right
8132
+ * for a small or a cold class, and the only legal mode for
8133
+ * a `cardinality: 'single'` class.
8134
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8135
+ * refresh, resume, then move the past with everything
8136
+ * running. The pause is three bounded instants (a detach +
8137
+ * attach round, a write-gate drain, a lease) instead of one
8138
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8139
+ * stopped recording under `blocking`; the same move is
8140
+ * seconds of stopped recording under `nonBlocking`.
8141
+ *
8142
+ * The mode is on the JOB, not only on the input, because `status` is where an
8143
+ * operator finds out which one is running.
8144
+ */
8145
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8082
8146
  /** Shared input for planning and starting an orchestrated storage migration. */
8083
8147
  var StorageMigrationInputSchema = object({
8084
8148
  destinations: StorageMigrationDestinationsSchema,
8085
- throttleMbps: number().min(1).max(1e3).optional()
8149
+ throttleMbps: number().min(1).max(1e3).optional(),
8150
+ /** Omitted = `blocking`, which stays the default. */
8151
+ mode: StorageMigrationModeSchema.optional()
8086
8152
  });
8087
- /** The durable coordinator state machine. The only phase that changes default
8088
- * locations is `repointing`, after every selected mover has completed and been
8089
- * verified. */
8153
+ /**
8154
+ * The durable coordinator state machine.
8155
+ *
8156
+ * `blocking`:
8157
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8158
+ *
8159
+ * `nonBlocking`:
8160
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8161
+ *
8162
+ * Same phases, different order plus two new ones — not a second mover.
8163
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8164
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8165
+ * `repointing` is still the only phase that changes a default location.
8166
+ */
8090
8167
  var StorageMigrationPhaseSchema = _enum([
8091
8168
  "planning",
8169
+ "sealing",
8092
8170
  "pausing",
8093
8171
  "moving",
8172
+ "draining",
8094
8173
  "verifying",
8095
8174
  "repointing",
8096
8175
  "refreshing",
@@ -8104,17 +8183,56 @@ var StorageMigrationParticipantSchema = _enum([
8104
8183
  "recorder",
8105
8184
  "analytics"
8106
8185
  ]);
8186
+ /**
8187
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8188
+ *
8189
+ * The long half of a non-blocking migration is `draining`, and it is measured
8190
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8191
+ * existed the only place those numbers appeared was a Loki line, so an operator
8192
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8193
+ * afternoon.
8194
+ *
8195
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8196
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8197
+ * mover — which is the exact failure this is meant to end. The coordinator's
8198
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8199
+ * read `state`; folding the counters costs no extra read and makes the durable
8200
+ * record say afterwards how far a move actually got.
8201
+ *
8202
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8203
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8204
+ * cannot say M, and a 0 there would render as "100 % done".
8205
+ */
8206
+ var StorageMigrationMoveProgressSchema = object({
8207
+ filesMoved: number().int().nonnegative(),
8208
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8209
+ filesTotal: number().int().nonnegative().nullable(),
8210
+ bytesMoved: number().int().nonnegative(),
8211
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8212
+ * crash gets a new mover, and a rate computed from the migration's start
8213
+ * would silently average in the time nothing was running. */
8214
+ startedAt: number(),
8215
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8216
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8217
+ * subtract its own. */
8218
+ observedAt: number()
8219
+ });
8107
8220
  var StorageMigrationMoveSchema = object({
8108
8221
  storageClass: StorageMigrationClassSchema,
8109
8222
  fromLocationId: string(),
8110
8223
  toLocationId: string(),
8111
8224
  moverJobId: string().nullable(),
8112
8225
  state: RelocateJobStateSchema.nullable(),
8113
- error: string().nullable()
8226
+ error: string().nullable(),
8227
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8228
+ progress: StorageMigrationMoveProgressSchema.nullable()
8114
8229
  });
8115
8230
  var StorageMigrationJobSchema = object({
8116
8231
  jobId: string(),
8117
8232
  phase: StorageMigrationPhaseSchema,
8233
+ /** Which order this job is running. `status` is the only place an operator
8234
+ * can tell a seconds-long cutover from a thirty-hour one. */
8235
+ mode: StorageMigrationModeSchema,
8118
8236
  destinations: StorageMigrationDestinationsSchema,
8119
8237
  throttleMbps: number(),
8120
8238
  moves: array(StorageMigrationMoveSchema),
@@ -8127,13 +8245,122 @@ var StorageMigrationJobSchema = object({
8127
8245
  finishedAt: number().nullable(),
8128
8246
  error: string().nullable()
8129
8247
  });
8248
+ var StorageMigrationFindingSchema = object({
8249
+ code: _enum([
8250
+ "sharesDeviceWithSource",
8251
+ "deviceIdentityUnknown",
8252
+ "unstampedEventMediaRows",
8253
+ "blockingOnly",
8254
+ "noMover"
8255
+ ]),
8256
+ storageClass: StorageMigrationClassSchema,
8257
+ /** Human-readable, already carrying the ids and counts. */
8258
+ message: string()
8259
+ });
8130
8260
  var StorageMigrationPlanSchema = object({
8131
8261
  destinations: StorageMigrationDestinationsSchema,
8262
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8263
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8264
+ * it. */
8265
+ mode: StorageMigrationModeSchema,
8132
8266
  moves: array(object({
8133
8267
  storageClass: StorageMigrationClassSchema,
8134
8268
  fromLocationId: string(),
8135
8269
  toLocationId: string()
8136
- }))
8270
+ })),
8271
+ findings: array(StorageMigrationFindingSchema)
8272
+ });
8273
+ /**
8274
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8275
+ *
8276
+ * The coordinator's job record is the state of record for a migration, and its
8277
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8278
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8279
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8280
+ * way because no supported UI path existed. A mover armed like that has no job
8281
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8282
+ *
8283
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8284
+ * orchestrated it.
8285
+ */
8286
+ var StorageMigrationMoverSchema = object({
8287
+ lane: _enum(["footage", "media"]),
8288
+ job: RelocateJobSchema,
8289
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8290
+ * directly against the owning addon. */
8291
+ migrationJobId: string().nullable(),
8292
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8293
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8294
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8295
+ * rate made of two different clocks. */
8296
+ observedAt: number()
8297
+ });
8298
+ /**
8299
+ * What a SOURCE still holds for one storage class — the number that makes a
8300
+ * "drain remaining" action honest rather than hopeful.
8301
+ *
8302
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8303
+ * engine's own selection count for media), never from the resident index: a
8304
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8305
+ * never been told about (D295).
8306
+ *
8307
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8308
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8309
+ * because refusing on an unanswerable read would hide exactly the case an
8310
+ * operator needs to act on.
8311
+ */
8312
+ var StorageMigrationResidueSchema = object({
8313
+ storageClass: StorageMigrationClassSchema,
8314
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8315
+ * move from wherever they are rather than from one named source. */
8316
+ fromLocationId: string(),
8317
+ /** Where a drain would move it — the class's CURRENT default. */
8318
+ toLocationId: string(),
8319
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8320
+ items: number().int().nonnegative().nullable(),
8321
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8322
+ bytes: number().int().nonnegative().nullable()
8323
+ });
8324
+ /**
8325
+ * Run the DRAIN half and nothing else.
8326
+ *
8327
+ * A migration that reached `done` has already repointed, so `start` correctly
8328
+ * refuses its destination ("already the default") — there is nothing left to
8329
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8330
+ * or finish against a work list that was a tenth of the archive (D295), and
8331
+ * before this there was no supported way to run only that half: the only way
8332
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8333
+ *
8334
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8335
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8336
+ * re-repoint a class that is already migrated.
8337
+ */
8338
+ var StorageMigrationDrainInputSchema = object({
8339
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8340
+ * a class whose source is already empty is refused rather than started. */
8341
+ classes: array(StorageMigrationClassSchema).min(1),
8342
+ throttleMbps: number().min(1).max(1e3).optional()
8343
+ });
8344
+ /** What a footage source still holds, asked of the durable hour ledger. */
8345
+ var RelocateResidueInputSchema = object({
8346
+ fromLocationId: string().min(1),
8347
+ /** Narrow to one logical class; omit for every profile on the location. */
8348
+ footageClass: RelocateFootageClassSchema.optional()
8349
+ });
8350
+ /** `null` = the archive could not answer (no ledger on this node, or the
8351
+ * aggregate failed). Never conflated with an empty source. */
8352
+ var RelocateResidueSchema = object({
8353
+ segments: number().int().nonnegative(),
8354
+ bytes: number().int().nonnegative()
8355
+ }).nullable();
8356
+ /** How many rows a media pass would still act on against a given target — the
8357
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8358
+ * never disagree. `null` = the count could not be taken. */
8359
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8360
+ var RelocatableMediaCountInputSchema = object({
8361
+ toLocationId: string().min(1),
8362
+ /** Omitted = `move`. */
8363
+ mode: MediaRelocateModeSchema.optional()
8137
8364
  });
8138
8365
  /**
8139
8366
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8239,6 +8466,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8239
8466
  * two addons declaring the same `id` must agree on `cardinality` (validated
8240
8467
  * at kernel aggregation time, not here).
8241
8468
  */
8469
+ /**
8470
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8471
+ * actually reaches the bytes. It is the constraint that decides which
8472
+ * `storage-provider`s may back a location of that kind.
8473
+ *
8474
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8475
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8476
+ * post-analysis media roots). Only a provider that serves a genuine local
8477
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8478
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8479
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8480
+ * against a same-named local directory that is something else entirely.
8481
+ *
8482
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8483
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8484
+ * service never sees a path, so any provider can back it. `backups` is the
8485
+ * one kind that qualifies today.
8486
+ *
8487
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8488
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8489
+ * refused the configuration; the first write simply went somewhere wrong, and
8490
+ * a recording write that goes wrong surfaces as a silent black window rather
8491
+ * than an error (the read path does not `stat`). This turns that accident into
8492
+ * a declared, enforced, testable refusal.
8493
+ */
8494
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8242
8495
  var StorageLocationDeclarationSchema = object({
8243
8496
  /**
8244
8497
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8258,6 +8511,19 @@ var StorageLocationDeclarationSchema = object({
8258
8511
  */
8259
8512
  cardinality: _enum(["single", "multi"]),
8260
8513
  /**
8514
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8515
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8516
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8517
+ *
8518
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8519
+ * can only over-restrict (refuse a remote provider for a kind that might
8520
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8521
+ * permissive direction and is therefore never inferred — a repo guard
8522
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8523
+ * reached by omission.
8524
+ */
8525
+ access: StorageAccessSchema.optional(),
8526
+ /**
8261
8527
  * When set, the default instance for this location inherits its resolved
8262
8528
  * root from the named location's default instance. Useful for derivative
8263
8529
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17783,8 +18049,10 @@ var TrackSchema = object({
17783
18049
  lastSeen: number(),
17784
18050
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17785
18051
  positions: array(TrackPositionSchema).readonly(),
17786
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17787
- * saveThumbnails policy). */
18052
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18053
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18054
+ * the retired `saveThumbnails` used to gate this and the rolling
18055
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17788
18056
  snapshots: array(TrackSnapshotSchema).readonly(),
17789
18057
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17790
18058
  zonesVisited: array(string()).readonly(),
@@ -18644,6 +18912,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18644
18912
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18645
18913
  kind: "mutation",
18646
18914
  auth: "admin"
18915
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
18916
+ kind: "query",
18917
+ auth: "admin"
18647
18918
  }), method(object({}), array(RelocateJobSchema).readonly(), {
18648
18919
  kind: "query",
18649
18920
  auth: "admin"
@@ -20564,7 +20835,10 @@ method(object({
20564
20835
  }), StorageLocationSchema, {
20565
20836
  kind: "mutation",
20566
20837
  auth: "admin"
20567
- }), method(object({ id: string() }), _void(), {
20838
+ }), method(object({
20839
+ id: string(),
20840
+ force: boolean().optional()
20841
+ }), _void(), {
20568
20842
  kind: "mutation",
20569
20843
  auth: "admin"
20570
20844
  }), method(object({ id: string() }), object({
@@ -20613,6 +20887,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20613
20887
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20614
20888
  kind: "mutation",
20615
20889
  auth: "admin"
20890
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
20891
+ kind: "mutation",
20892
+ auth: "admin"
20616
20893
  });
20617
20894
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20618
20895
  providerId: string().min(1),
@@ -21011,12 +21288,38 @@ response: record(string(), unknown()) }), object({
21011
21288
  *
21012
21289
  * ## Why this is a capability and not a helper
21013
21290
  *
21014
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21015
- * plate, vehicle, identity, and the event store's derivativesand every one of
21016
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21017
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21018
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21019
- * load 5,000 rows before ranking anything.
21291
+ * This capability was introduced with the claim that SIX stores in
21292
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21293
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21294
+ * claim was never true, and leaving it here made five stores look like pending
21295
+ * work when three of them have no vector at all. Counted column by column on
21296
+ * 2026-08-30, exactly THREE ever held one:
21297
+ *
21298
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21299
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21300
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21301
+ * face, migrated 2026-08-30 into its OWN index (see below).
21302
+ *
21303
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21304
+ * and `identities` store a name; the event store stores no derivative vector.
21305
+ * They are not migration candidates and never were.
21306
+ *
21307
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21308
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21309
+ * rows before ranking anything.
21310
+ *
21311
+ * ## One index per COMPARISON, never per encoder
21312
+ *
21313
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21314
+ * model, and they still get two indexes. An index is a set of things that are
21315
+ * ranked against each other and that live and die together, and these two are
21316
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21317
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21318
+ * forever and is the gallery every recognition ranks against. One index would
21319
+ * mean every gallery load and every reconcile carried a filter whose failure
21320
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21321
+ * person's only sample. The dimension they share is not a reason to share an
21322
+ * index; the question they answer is, and it differs.
21020
21323
  *
21021
21324
  * The fix is not a faster loop, it is a different backend — and the backend
21022
21325
  * should be replaceable without touching six callers. So: a singleton
@@ -21121,7 +21424,20 @@ var VectorQueryResultSchema = object({
21121
21424
  */
21122
21425
  scanned: number(),
21123
21426
  /** True when the backend could not consider every row that passed the filter. */
21124
- truncated: boolean()
21427
+ truncated: boolean(),
21428
+ /**
21429
+ * The `topK` the backend actually ran with.
21430
+ *
21431
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21432
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21433
+ * own log rather than in its answer. That is how an audit asking for 20,000
21434
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21435
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21436
+ * MUCH, in the return value, where the caller cannot fail to see it.
21437
+ *
21438
+ * Equals the requested `topK` whenever nothing was lowered.
21439
+ */
21440
+ effectiveTopK: number().int().positive()
21125
21441
  });
21126
21442
  var VectorDeleteInputSchema = object({
21127
21443
  index: string(),
@@ -21150,6 +21466,68 @@ var VectorGetResultSchema = object({ items: array(object({
21150
21466
  id: string(),
21151
21467
  metadata: VectorMetadataSchema
21152
21468
  })) });
21469
+ /**
21470
+ * Ids to read back WITH their vectors.
21471
+ *
21472
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21473
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21474
+ * caller depends on that promise. This one promises the opposite.
21475
+ *
21476
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21477
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21478
+ * a per-face cross-process KNN would be a network round trip inside the
21479
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21480
+ * it requires the index to hand the floats back. Without this method the only
21481
+ * way to keep a readable vector is a JSON column, which is the thing this
21482
+ * capability exists to delete.
21483
+ *
21484
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21485
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21486
+ */
21487
+ var VectorFetchInputSchema = object({
21488
+ index: string(),
21489
+ ids: array(string())
21490
+ });
21491
+ var VectorFetchResultSchema = object({ items: array(object({
21492
+ id: string(),
21493
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21494
+ vector: string(),
21495
+ metadata: VectorMetadataSchema
21496
+ })) });
21497
+ /**
21498
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21499
+ *
21500
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21501
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21502
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21503
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21504
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21505
+ * looked" for as long as anyone cared to read it.
21506
+ *
21507
+ * This is the primitive that question actually needs: a bounded page, ordered
21508
+ * by the backend's own row order, costing no distance computation at all.
21509
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21510
+ * the full-table read this capability was built to stop.
21511
+ */
21512
+ var VectorScanInputSchema = object({
21513
+ index: string(),
21514
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21515
+ cursor: number().int().nonnegative().default(0),
21516
+ limit: number().int().positive()
21517
+ });
21518
+ var VectorScanResultSchema = object({
21519
+ items: array(object({
21520
+ id: string(),
21521
+ metadata: VectorMetadataSchema
21522
+ })),
21523
+ /**
21524
+ * Where the next page starts, or `null` when the walk reached the end.
21525
+ *
21526
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21527
+ * from a short page: a backend is free to return fewer rows than asked.
21528
+ */
21529
+ nextCursor: number().int().nonnegative().nullable()
21530
+ });
21153
21531
  var VectorStatsInputSchema = object({ index: string() });
21154
21532
  var VectorStatsResultSchema = object({
21155
21533
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21168,7 +21546,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21168
21546
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21169
21547
  kind: "mutation",
21170
21548
  auth: "admin"
21171
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21549
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21172
21550
  kind: "mutation",
21173
21551
  auth: "admin"
21174
21552
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26072,6 +26450,9 @@ method(object({
26072
26450
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26073
26451
  kind: "query",
26074
26452
  auth: "admin"
26453
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26454
+ kind: "query",
26455
+ auth: "admin"
26075
26456
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26076
26457
  kind: "mutation",
26077
26458
  auth: "admin"
@@ -31037,6 +31418,18 @@ Object.freeze({
31037
31418
  addonId: null,
31038
31419
  access: "create"
31039
31420
  },
31421
+ "pipelineAnalytics.countRelocatableMedia": {
31422
+ capName: "pipeline-analytics",
31423
+ capScope: "device",
31424
+ addonId: null,
31425
+ access: "view"
31426
+ },
31427
+ "pipelineAnalytics.countUnstampedEventMedia": {
31428
+ capName: "pipeline-analytics",
31429
+ capScope: "device",
31430
+ addonId: null,
31431
+ access: "view"
31432
+ },
31040
31433
  "pipelineAnalytics.deleteDeviceEvents": {
31041
31434
  capName: "pipeline-analytics",
31042
31435
  capScope: "device",
@@ -32195,6 +32588,12 @@ Object.freeze({
32195
32588
  addonId: null,
32196
32589
  access: "view"
32197
32590
  },
32591
+ "recording.getRelocateResidue": {
32592
+ capName: "recording",
32593
+ capScope: "system",
32594
+ addonId: null,
32595
+ access: "view"
32596
+ },
32198
32597
  "recording.getStorageMigrationMoveStatus": {
32199
32598
  capName: "recording",
32200
32599
  capScope: "system",
@@ -32741,12 +33140,30 @@ Object.freeze({
32741
33140
  addonId: null,
32742
33141
  access: "create"
32743
33142
  },
33143
+ "storageMigration.drain": {
33144
+ capName: "storage-migration",
33145
+ capScope: "system",
33146
+ addonId: null,
33147
+ access: "create"
33148
+ },
33149
+ "storageMigration.movers": {
33150
+ capName: "storage-migration",
33151
+ capScope: "system",
33152
+ addonId: null,
33153
+ access: "view"
33154
+ },
32744
33155
  "storageMigration.plan": {
32745
33156
  capName: "storage-migration",
32746
33157
  capScope: "system",
32747
33158
  addonId: null,
32748
33159
  access: "view"
32749
33160
  },
33161
+ "storageMigration.residue": {
33162
+ capName: "storage-migration",
33163
+ capScope: "system",
33164
+ addonId: null,
33165
+ access: "view"
33166
+ },
32750
33167
  "storageMigration.start": {
32751
33168
  capName: "storage-migration",
32752
33169
  capScope: "system",
@@ -33581,6 +33998,12 @@ Object.freeze({
33581
33998
  addonId: null,
33582
33999
  access: "delete"
33583
34000
  },
34001
+ "vectorStore.fetchByIds": {
34002
+ capName: "vector-store",
34003
+ capScope: "system",
34004
+ addonId: null,
34005
+ access: "view"
34006
+ },
33584
34007
  "vectorStore.getByIds": {
33585
34008
  capName: "vector-store",
33586
34009
  capScope: "system",
@@ -33593,6 +34016,12 @@ Object.freeze({
33593
34016
  addonId: null,
33594
34017
  access: "view"
33595
34018
  },
34019
+ "vectorStore.scan": {
34020
+ capName: "vector-store",
34021
+ capScope: "system",
34022
+ addonId: null,
34023
+ access: "view"
34024
+ },
33596
34025
  "vectorStore.stats": {
33597
34026
  capName: "vector-store",
33598
34027
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-smtp-nodemailer",
3
- "version": "1.2.41",
3
+ "version": "1.2.44",
4
4
  "description": "SMTP email provider addon for CamStack — wraps `nodemailer` and registers a `smtp-provider` cap collection entry. Used by magic-link login + notifier addons.",
5
5
  "keywords": [
6
6
  "camstack",