@camstack/addon-decoder-ffmpeg 1.2.42 → 1.2.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +452 -23
  2. package/dist/index.mjs +452 -23
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8040,18 +8040,61 @@ var RelocateFootageInputSchema = object({
8040
8040
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8041
8041
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8042
8042
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8043
+ /**
8044
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8045
+ * mover (the engine already walks both collections with a timestamp cursor and
8046
+ * already has a stamp-without-copy path).
8047
+ *
8048
+ * - `move` — the default and the historical behaviour: event-media and
8049
+ * retrain blobs move to `toLocationId` and their rows are
8050
+ * stamped. The enrolled gallery is skipped (D197).
8051
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8052
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8053
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8054
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8055
+ * instant a repoint moves that pointer the row reads from the
8056
+ * new disk while its bytes are on the old one.
8057
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8058
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8059
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8060
+ * never run beside a live second location: it is stop-the-world
8061
+ * by construction, which is acceptable only because the gallery
8062
+ * is a few KB per enrolled sample.
8063
+ */
8064
+ var MediaRelocateModeSchema = _enum([
8065
+ "move",
8066
+ "seal",
8067
+ "gallery"
8068
+ ]);
8043
8069
  var RelocateMediaInputSchema = object({
8044
8070
  toLocationId: string(),
8045
- throttleMbps: number().min(1).max(1e3).optional()
8071
+ throttleMbps: number().min(1).max(1e3).optional(),
8072
+ /** Omitted = `move`, the pre-existing behaviour. */
8073
+ mode: MediaRelocateModeSchema.optional()
8074
+ });
8075
+ /** How many rows still carry NO `locationId` — the population a repoint would
8076
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8077
+ * value that permits a non-blocking `eventMedia` cutover. */
8078
+ var UnstampedEventMediaCountSchema = object({
8079
+ media: number().int().nonnegative(),
8080
+ retrainFrames: number().int().nonnegative(),
8081
+ total: number().int().nonnegative()
8046
8082
  });
8047
8083
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8048
- /** The independently selectable logical storage classes. `recordings`
8049
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8050
- * segments; `eventMedia` is post-analysis blobs. */
8084
+ /** The independently selectable logical storage classes — every class
8085
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8086
+ * Zod enum error where they should meet an explanation.
8087
+ *
8088
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8089
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8090
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8091
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8051
8092
  var StorageMigrationClassSchema = _enum([
8052
8093
  "recordings",
8053
8094
  "recordingsLow",
8054
- "eventMedia"
8095
+ "eventMedia",
8096
+ "backups",
8097
+ "galleryMedia"
8055
8098
  ]);
8056
8099
  /** A destination is always an existing, fully-qualified location id. The
8057
8100
  * migration API intentionally never changes a source location's `basePath`:
@@ -8059,20 +8102,56 @@ var StorageMigrationClassSchema = _enum([
8059
8102
  var StorageMigrationDestinationsSchema = object({
8060
8103
  recordings: string().min(1).optional(),
8061
8104
  recordingsLow: string().min(1).optional(),
8062
- eventMedia: string().min(1).optional()
8105
+ eventMedia: string().min(1).optional(),
8106
+ backups: string().min(1).optional(),
8107
+ galleryMedia: string().min(1).optional()
8063
8108
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8109
+ /**
8110
+ * How a migration sequences the cutover against the byte move.
8111
+ *
8112
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8113
+ * resume. Recording is stopped for the whole move. Right
8114
+ * for a small or a cold class, and the only legal mode for
8115
+ * a `cardinality: 'single'` class.
8116
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8117
+ * refresh, resume, then move the past with everything
8118
+ * running. The pause is three bounded instants (a detach +
8119
+ * attach round, a write-gate drain, a lease) instead of one
8120
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8121
+ * stopped recording under `blocking`; the same move is
8122
+ * seconds of stopped recording under `nonBlocking`.
8123
+ *
8124
+ * The mode is on the JOB, not only on the input, because `status` is where an
8125
+ * operator finds out which one is running.
8126
+ */
8127
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8064
8128
  /** Shared input for planning and starting an orchestrated storage migration. */
8065
8129
  var StorageMigrationInputSchema = object({
8066
8130
  destinations: StorageMigrationDestinationsSchema,
8067
- throttleMbps: number().min(1).max(1e3).optional()
8131
+ throttleMbps: number().min(1).max(1e3).optional(),
8132
+ /** Omitted = `blocking`, which stays the default. */
8133
+ mode: StorageMigrationModeSchema.optional()
8068
8134
  });
8069
- /** The durable coordinator state machine. The only phase that changes default
8070
- * locations is `repointing`, after every selected mover has completed and been
8071
- * verified. */
8135
+ /**
8136
+ * The durable coordinator state machine.
8137
+ *
8138
+ * `blocking`:
8139
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8140
+ *
8141
+ * `nonBlocking`:
8142
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8143
+ *
8144
+ * Same phases, different order plus two new ones — not a second mover.
8145
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8146
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8147
+ * `repointing` is still the only phase that changes a default location.
8148
+ */
8072
8149
  var StorageMigrationPhaseSchema = _enum([
8073
8150
  "planning",
8151
+ "sealing",
8074
8152
  "pausing",
8075
8153
  "moving",
8154
+ "draining",
8076
8155
  "verifying",
8077
8156
  "repointing",
8078
8157
  "refreshing",
@@ -8086,17 +8165,56 @@ var StorageMigrationParticipantSchema = _enum([
8086
8165
  "recorder",
8087
8166
  "analytics"
8088
8167
  ]);
8168
+ /**
8169
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8170
+ *
8171
+ * The long half of a non-blocking migration is `draining`, and it is measured
8172
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8173
+ * existed the only place those numbers appeared was a Loki line, so an operator
8174
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8175
+ * afternoon.
8176
+ *
8177
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8178
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8179
+ * mover — which is the exact failure this is meant to end. The coordinator's
8180
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8181
+ * read `state`; folding the counters costs no extra read and makes the durable
8182
+ * record say afterwards how far a move actually got.
8183
+ *
8184
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8185
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8186
+ * cannot say M, and a 0 there would render as "100 % done".
8187
+ */
8188
+ var StorageMigrationMoveProgressSchema = object({
8189
+ filesMoved: number().int().nonnegative(),
8190
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8191
+ filesTotal: number().int().nonnegative().nullable(),
8192
+ bytesMoved: number().int().nonnegative(),
8193
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8194
+ * crash gets a new mover, and a rate computed from the migration's start
8195
+ * would silently average in the time nothing was running. */
8196
+ startedAt: number(),
8197
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8198
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8199
+ * subtract its own. */
8200
+ observedAt: number()
8201
+ });
8089
8202
  var StorageMigrationMoveSchema = object({
8090
8203
  storageClass: StorageMigrationClassSchema,
8091
8204
  fromLocationId: string(),
8092
8205
  toLocationId: string(),
8093
8206
  moverJobId: string().nullable(),
8094
8207
  state: RelocateJobStateSchema.nullable(),
8095
- error: string().nullable()
8208
+ error: string().nullable(),
8209
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8210
+ progress: StorageMigrationMoveProgressSchema.nullable()
8096
8211
  });
8097
8212
  var StorageMigrationJobSchema = object({
8098
8213
  jobId: string(),
8099
8214
  phase: StorageMigrationPhaseSchema,
8215
+ /** Which order this job is running. `status` is the only place an operator
8216
+ * can tell a seconds-long cutover from a thirty-hour one. */
8217
+ mode: StorageMigrationModeSchema,
8100
8218
  destinations: StorageMigrationDestinationsSchema,
8101
8219
  throttleMbps: number(),
8102
8220
  moves: array(StorageMigrationMoveSchema),
@@ -8109,13 +8227,122 @@ var StorageMigrationJobSchema = object({
8109
8227
  finishedAt: number().nullable(),
8110
8228
  error: string().nullable()
8111
8229
  });
8230
+ var StorageMigrationFindingSchema = object({
8231
+ code: _enum([
8232
+ "sharesDeviceWithSource",
8233
+ "deviceIdentityUnknown",
8234
+ "unstampedEventMediaRows",
8235
+ "blockingOnly",
8236
+ "noMover"
8237
+ ]),
8238
+ storageClass: StorageMigrationClassSchema,
8239
+ /** Human-readable, already carrying the ids and counts. */
8240
+ message: string()
8241
+ });
8112
8242
  var StorageMigrationPlanSchema = object({
8113
8243
  destinations: StorageMigrationDestinationsSchema,
8244
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8245
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8246
+ * it. */
8247
+ mode: StorageMigrationModeSchema,
8114
8248
  moves: array(object({
8115
8249
  storageClass: StorageMigrationClassSchema,
8116
8250
  fromLocationId: string(),
8117
8251
  toLocationId: string()
8118
- }))
8252
+ })),
8253
+ findings: array(StorageMigrationFindingSchema)
8254
+ });
8255
+ /**
8256
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8257
+ *
8258
+ * The coordinator's job record is the state of record for a migration, and its
8259
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8260
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8261
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8262
+ * way because no supported UI path existed. A mover armed like that has no job
8263
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8264
+ *
8265
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8266
+ * orchestrated it.
8267
+ */
8268
+ var StorageMigrationMoverSchema = object({
8269
+ lane: _enum(["footage", "media"]),
8270
+ job: RelocateJobSchema,
8271
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8272
+ * directly against the owning addon. */
8273
+ migrationJobId: string().nullable(),
8274
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8275
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8276
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8277
+ * rate made of two different clocks. */
8278
+ observedAt: number()
8279
+ });
8280
+ /**
8281
+ * What a SOURCE still holds for one storage class — the number that makes a
8282
+ * "drain remaining" action honest rather than hopeful.
8283
+ *
8284
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8285
+ * engine's own selection count for media), never from the resident index: a
8286
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8287
+ * never been told about (D295).
8288
+ *
8289
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8290
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8291
+ * because refusing on an unanswerable read would hide exactly the case an
8292
+ * operator needs to act on.
8293
+ */
8294
+ var StorageMigrationResidueSchema = object({
8295
+ storageClass: StorageMigrationClassSchema,
8296
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8297
+ * move from wherever they are rather than from one named source. */
8298
+ fromLocationId: string(),
8299
+ /** Where a drain would move it — the class's CURRENT default. */
8300
+ toLocationId: string(),
8301
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8302
+ items: number().int().nonnegative().nullable(),
8303
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8304
+ bytes: number().int().nonnegative().nullable()
8305
+ });
8306
+ /**
8307
+ * Run the DRAIN half and nothing else.
8308
+ *
8309
+ * A migration that reached `done` has already repointed, so `start` correctly
8310
+ * refuses its destination ("already the default") — there is nothing left to
8311
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8312
+ * or finish against a work list that was a tenth of the archive (D295), and
8313
+ * before this there was no supported way to run only that half: the only way
8314
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8315
+ *
8316
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8317
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8318
+ * re-repoint a class that is already migrated.
8319
+ */
8320
+ var StorageMigrationDrainInputSchema = object({
8321
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8322
+ * a class whose source is already empty is refused rather than started. */
8323
+ classes: array(StorageMigrationClassSchema).min(1),
8324
+ throttleMbps: number().min(1).max(1e3).optional()
8325
+ });
8326
+ /** What a footage source still holds, asked of the durable hour ledger. */
8327
+ var RelocateResidueInputSchema = object({
8328
+ fromLocationId: string().min(1),
8329
+ /** Narrow to one logical class; omit for every profile on the location. */
8330
+ footageClass: RelocateFootageClassSchema.optional()
8331
+ });
8332
+ /** `null` = the archive could not answer (no ledger on this node, or the
8333
+ * aggregate failed). Never conflated with an empty source. */
8334
+ var RelocateResidueSchema = object({
8335
+ segments: number().int().nonnegative(),
8336
+ bytes: number().int().nonnegative()
8337
+ }).nullable();
8338
+ /** How many rows a media pass would still act on against a given target — the
8339
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8340
+ * never disagree. `null` = the count could not be taken. */
8341
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8342
+ var RelocatableMediaCountInputSchema = object({
8343
+ toLocationId: string().min(1),
8344
+ /** Omitted = `move`. */
8345
+ mode: MediaRelocateModeSchema.optional()
8119
8346
  });
8120
8347
  /**
8121
8348
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8221,6 +8448,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8221
8448
  * two addons declaring the same `id` must agree on `cardinality` (validated
8222
8449
  * at kernel aggregation time, not here).
8223
8450
  */
8451
+ /**
8452
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8453
+ * actually reaches the bytes. It is the constraint that decides which
8454
+ * `storage-provider`s may back a location of that kind.
8455
+ *
8456
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8457
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8458
+ * post-analysis media roots). Only a provider that serves a genuine local
8459
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8460
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8461
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8462
+ * against a same-named local directory that is something else entirely.
8463
+ *
8464
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8465
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8466
+ * service never sees a path, so any provider can back it. `backups` is the
8467
+ * one kind that qualifies today.
8468
+ *
8469
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8470
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8471
+ * refused the configuration; the first write simply went somewhere wrong, and
8472
+ * a recording write that goes wrong surfaces as a silent black window rather
8473
+ * than an error (the read path does not `stat`). This turns that accident into
8474
+ * a declared, enforced, testable refusal.
8475
+ */
8476
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8224
8477
  var StorageLocationDeclarationSchema = object({
8225
8478
  /**
8226
8479
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8240,6 +8493,19 @@ var StorageLocationDeclarationSchema = object({
8240
8493
  */
8241
8494
  cardinality: _enum(["single", "multi"]),
8242
8495
  /**
8496
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8497
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8498
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8499
+ *
8500
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8501
+ * can only over-restrict (refuse a remote provider for a kind that might
8502
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8503
+ * permissive direction and is therefore never inferred — a repo guard
8504
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8505
+ * reached by omission.
8506
+ */
8507
+ access: StorageAccessSchema.optional(),
8508
+ /**
8243
8509
  * When set, the default instance for this location inherits its resolved
8244
8510
  * root from the named location's default instance. Useful for derivative
8245
8511
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17895,8 +18161,10 @@ var TrackSchema = object({
17895
18161
  lastSeen: number(),
17896
18162
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17897
18163
  positions: array(TrackPositionSchema).readonly(),
17898
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17899
- * saveThumbnails policy). */
18164
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18165
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18166
+ * the retired `saveThumbnails` used to gate this and the rolling
18167
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17900
18168
  snapshots: array(TrackSnapshotSchema).readonly(),
17901
18169
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17902
18170
  zonesVisited: array(string()).readonly(),
@@ -18756,6 +19024,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18756
19024
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18757
19025
  kind: "mutation",
18758
19026
  auth: "admin"
19027
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19028
+ kind: "query",
19029
+ auth: "admin"
18759
19030
  }), method(object({}), array(RelocateJobSchema).readonly(), {
18760
19031
  kind: "query",
18761
19032
  auth: "admin"
@@ -20663,7 +20934,10 @@ method(object({
20663
20934
  }), StorageLocationSchema, {
20664
20935
  kind: "mutation",
20665
20936
  auth: "admin"
20666
- }), method(object({ id: string() }), _void(), {
20937
+ }), method(object({
20938
+ id: string(),
20939
+ force: boolean().optional()
20940
+ }), _void(), {
20667
20941
  kind: "mutation",
20668
20942
  auth: "admin"
20669
20943
  }), method(object({ id: string() }), object({
@@ -20712,6 +20986,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20712
20986
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20713
20987
  kind: "mutation",
20714
20988
  auth: "admin"
20989
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
20990
+ kind: "mutation",
20991
+ auth: "admin"
20715
20992
  });
20716
20993
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20717
20994
  providerId: string().min(1),
@@ -21110,12 +21387,38 @@ response: record(string(), unknown()) }), object({
21110
21387
  *
21111
21388
  * ## Why this is a capability and not a helper
21112
21389
  *
21113
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21114
- * plate, vehicle, identity, and the event store's derivativesand every one of
21115
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21116
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21117
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21118
- * load 5,000 rows before ranking anything.
21390
+ * This capability was introduced with the claim that SIX stores in
21391
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21392
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21393
+ * claim was never true, and leaving it here made five stores look like pending
21394
+ * work when three of them have no vector at all. Counted column by column on
21395
+ * 2026-08-30, exactly THREE ever held one:
21396
+ *
21397
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21398
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21399
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21400
+ * face, migrated 2026-08-30 into its OWN index (see below).
21401
+ *
21402
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21403
+ * and `identities` store a name; the event store stores no derivative vector.
21404
+ * They are not migration candidates and never were.
21405
+ *
21406
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21407
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21408
+ * rows before ranking anything.
21409
+ *
21410
+ * ## One index per COMPARISON, never per encoder
21411
+ *
21412
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21413
+ * model, and they still get two indexes. An index is a set of things that are
21414
+ * ranked against each other and that live and die together, and these two are
21415
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21416
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21417
+ * forever and is the gallery every recognition ranks against. One index would
21418
+ * mean every gallery load and every reconcile carried a filter whose failure
21419
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21420
+ * person's only sample. The dimension they share is not a reason to share an
21421
+ * index; the question they answer is, and it differs.
21119
21422
  *
21120
21423
  * The fix is not a faster loop, it is a different backend — and the backend
21121
21424
  * should be replaceable without touching six callers. So: a singleton
@@ -21220,7 +21523,20 @@ var VectorQueryResultSchema = object({
21220
21523
  */
21221
21524
  scanned: number(),
21222
21525
  /** True when the backend could not consider every row that passed the filter. */
21223
- truncated: boolean()
21526
+ truncated: boolean(),
21527
+ /**
21528
+ * The `topK` the backend actually ran with.
21529
+ *
21530
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21531
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21532
+ * own log rather than in its answer. That is how an audit asking for 20,000
21533
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21534
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21535
+ * MUCH, in the return value, where the caller cannot fail to see it.
21536
+ *
21537
+ * Equals the requested `topK` whenever nothing was lowered.
21538
+ */
21539
+ effectiveTopK: number().int().positive()
21224
21540
  });
21225
21541
  var VectorDeleteInputSchema = object({
21226
21542
  index: string(),
@@ -21249,6 +21565,68 @@ var VectorGetResultSchema = object({ items: array(object({
21249
21565
  id: string(),
21250
21566
  metadata: VectorMetadataSchema
21251
21567
  })) });
21568
+ /**
21569
+ * Ids to read back WITH their vectors.
21570
+ *
21571
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21572
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21573
+ * caller depends on that promise. This one promises the opposite.
21574
+ *
21575
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21576
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21577
+ * a per-face cross-process KNN would be a network round trip inside the
21578
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21579
+ * it requires the index to hand the floats back. Without this method the only
21580
+ * way to keep a readable vector is a JSON column, which is the thing this
21581
+ * capability exists to delete.
21582
+ *
21583
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21584
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21585
+ */
21586
+ var VectorFetchInputSchema = object({
21587
+ index: string(),
21588
+ ids: array(string())
21589
+ });
21590
+ var VectorFetchResultSchema = object({ items: array(object({
21591
+ id: string(),
21592
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21593
+ vector: string(),
21594
+ metadata: VectorMetadataSchema
21595
+ })) });
21596
+ /**
21597
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21598
+ *
21599
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21600
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21601
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21602
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21603
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21604
+ * looked" for as long as anyone cared to read it.
21605
+ *
21606
+ * This is the primitive that question actually needs: a bounded page, ordered
21607
+ * by the backend's own row order, costing no distance computation at all.
21608
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21609
+ * the full-table read this capability was built to stop.
21610
+ */
21611
+ var VectorScanInputSchema = object({
21612
+ index: string(),
21613
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21614
+ cursor: number().int().nonnegative().default(0),
21615
+ limit: number().int().positive()
21616
+ });
21617
+ var VectorScanResultSchema = object({
21618
+ items: array(object({
21619
+ id: string(),
21620
+ metadata: VectorMetadataSchema
21621
+ })),
21622
+ /**
21623
+ * Where the next page starts, or `null` when the walk reached the end.
21624
+ *
21625
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21626
+ * from a short page: a backend is free to return fewer rows than asked.
21627
+ */
21628
+ nextCursor: number().int().nonnegative().nullable()
21629
+ });
21252
21630
  var VectorStatsInputSchema = object({ index: string() });
21253
21631
  var VectorStatsResultSchema = object({
21254
21632
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21267,7 +21645,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21267
21645
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21268
21646
  kind: "mutation",
21269
21647
  auth: "admin"
21270
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21648
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21271
21649
  kind: "mutation",
21272
21650
  auth: "admin"
21273
21651
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26171,6 +26549,9 @@ method(object({
26171
26549
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26172
26550
  kind: "query",
26173
26551
  auth: "admin"
26552
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26553
+ kind: "query",
26554
+ auth: "admin"
26174
26555
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26175
26556
  kind: "mutation",
26176
26557
  auth: "admin"
@@ -31136,6 +31517,18 @@ Object.freeze({
31136
31517
  addonId: null,
31137
31518
  access: "create"
31138
31519
  },
31520
+ "pipelineAnalytics.countRelocatableMedia": {
31521
+ capName: "pipeline-analytics",
31522
+ capScope: "device",
31523
+ addonId: null,
31524
+ access: "view"
31525
+ },
31526
+ "pipelineAnalytics.countUnstampedEventMedia": {
31527
+ capName: "pipeline-analytics",
31528
+ capScope: "device",
31529
+ addonId: null,
31530
+ access: "view"
31531
+ },
31139
31532
  "pipelineAnalytics.deleteDeviceEvents": {
31140
31533
  capName: "pipeline-analytics",
31141
31534
  capScope: "device",
@@ -32294,6 +32687,12 @@ Object.freeze({
32294
32687
  addonId: null,
32295
32688
  access: "view"
32296
32689
  },
32690
+ "recording.getRelocateResidue": {
32691
+ capName: "recording",
32692
+ capScope: "system",
32693
+ addonId: null,
32694
+ access: "view"
32695
+ },
32297
32696
  "recording.getStorageMigrationMoveStatus": {
32298
32697
  capName: "recording",
32299
32698
  capScope: "system",
@@ -32840,12 +33239,30 @@ Object.freeze({
32840
33239
  addonId: null,
32841
33240
  access: "create"
32842
33241
  },
33242
+ "storageMigration.drain": {
33243
+ capName: "storage-migration",
33244
+ capScope: "system",
33245
+ addonId: null,
33246
+ access: "create"
33247
+ },
33248
+ "storageMigration.movers": {
33249
+ capName: "storage-migration",
33250
+ capScope: "system",
33251
+ addonId: null,
33252
+ access: "view"
33253
+ },
32843
33254
  "storageMigration.plan": {
32844
33255
  capName: "storage-migration",
32845
33256
  capScope: "system",
32846
33257
  addonId: null,
32847
33258
  access: "view"
32848
33259
  },
33260
+ "storageMigration.residue": {
33261
+ capName: "storage-migration",
33262
+ capScope: "system",
33263
+ addonId: null,
33264
+ access: "view"
33265
+ },
32849
33266
  "storageMigration.start": {
32850
33267
  capName: "storage-migration",
32851
33268
  capScope: "system",
@@ -33680,6 +34097,12 @@ Object.freeze({
33680
34097
  addonId: null,
33681
34098
  access: "delete"
33682
34099
  },
34100
+ "vectorStore.fetchByIds": {
34101
+ capName: "vector-store",
34102
+ capScope: "system",
34103
+ addonId: null,
34104
+ access: "view"
34105
+ },
33683
34106
  "vectorStore.getByIds": {
33684
34107
  capName: "vector-store",
33685
34108
  capScope: "system",
@@ -33692,6 +34115,12 @@ Object.freeze({
33692
34115
  addonId: null,
33693
34116
  access: "view"
33694
34117
  },
34118
+ "vectorStore.scan": {
34119
+ capName: "vector-store",
34120
+ capScope: "system",
34121
+ addonId: null,
34122
+ access: "view"
34123
+ },
33695
34124
  "vectorStore.stats": {
33696
34125
  capName: "vector-store",
33697
34126
  capScope: "system",
package/dist/index.mjs CHANGED
@@ -8036,18 +8036,61 @@ var RelocateFootageInputSchema = object({
8036
8036
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8037
8037
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8038
8038
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8039
+ /**
8040
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8041
+ * mover (the engine already walks both collections with a timestamp cursor and
8042
+ * already has a stamp-without-copy path).
8043
+ *
8044
+ * - `move` — the default and the historical behaviour: event-media and
8045
+ * retrain blobs move to `toLocationId` and their rows are
8046
+ * stamped. The enrolled gallery is skipped (D197).
8047
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8048
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8049
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8050
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8051
+ * instant a repoint moves that pointer the row reads from the
8052
+ * new disk while its bytes are on the old one.
8053
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8054
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8055
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8056
+ * never run beside a live second location: it is stop-the-world
8057
+ * by construction, which is acceptable only because the gallery
8058
+ * is a few KB per enrolled sample.
8059
+ */
8060
+ var MediaRelocateModeSchema = _enum([
8061
+ "move",
8062
+ "seal",
8063
+ "gallery"
8064
+ ]);
8039
8065
  var RelocateMediaInputSchema = object({
8040
8066
  toLocationId: string(),
8041
- throttleMbps: number().min(1).max(1e3).optional()
8067
+ throttleMbps: number().min(1).max(1e3).optional(),
8068
+ /** Omitted = `move`, the pre-existing behaviour. */
8069
+ mode: MediaRelocateModeSchema.optional()
8070
+ });
8071
+ /** How many rows still carry NO `locationId` — the population a repoint would
8072
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8073
+ * value that permits a non-blocking `eventMedia` cutover. */
8074
+ var UnstampedEventMediaCountSchema = object({
8075
+ media: number().int().nonnegative(),
8076
+ retrainFrames: number().int().nonnegative(),
8077
+ total: number().int().nonnegative()
8042
8078
  });
8043
8079
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8044
- /** The independently selectable logical storage classes. `recordings`
8045
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8046
- * segments; `eventMedia` is post-analysis blobs. */
8080
+ /** The independently selectable logical storage classes — every class
8081
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8082
+ * Zod enum error where they should meet an explanation.
8083
+ *
8084
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8085
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8086
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8087
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8047
8088
  var StorageMigrationClassSchema = _enum([
8048
8089
  "recordings",
8049
8090
  "recordingsLow",
8050
- "eventMedia"
8091
+ "eventMedia",
8092
+ "backups",
8093
+ "galleryMedia"
8051
8094
  ]);
8052
8095
  /** A destination is always an existing, fully-qualified location id. The
8053
8096
  * migration API intentionally never changes a source location's `basePath`:
@@ -8055,20 +8098,56 @@ var StorageMigrationClassSchema = _enum([
8055
8098
  var StorageMigrationDestinationsSchema = object({
8056
8099
  recordings: string().min(1).optional(),
8057
8100
  recordingsLow: string().min(1).optional(),
8058
- eventMedia: string().min(1).optional()
8101
+ eventMedia: string().min(1).optional(),
8102
+ backups: string().min(1).optional(),
8103
+ galleryMedia: string().min(1).optional()
8059
8104
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8105
+ /**
8106
+ * How a migration sequences the cutover against the byte move.
8107
+ *
8108
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8109
+ * resume. Recording is stopped for the whole move. Right
8110
+ * for a small or a cold class, and the only legal mode for
8111
+ * a `cardinality: 'single'` class.
8112
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8113
+ * refresh, resume, then move the past with everything
8114
+ * running. The pause is three bounded instants (a detach +
8115
+ * attach round, a write-gate drain, a lease) instead of one
8116
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8117
+ * stopped recording under `blocking`; the same move is
8118
+ * seconds of stopped recording under `nonBlocking`.
8119
+ *
8120
+ * The mode is on the JOB, not only on the input, because `status` is where an
8121
+ * operator finds out which one is running.
8122
+ */
8123
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8060
8124
  /** Shared input for planning and starting an orchestrated storage migration. */
8061
8125
  var StorageMigrationInputSchema = object({
8062
8126
  destinations: StorageMigrationDestinationsSchema,
8063
- throttleMbps: number().min(1).max(1e3).optional()
8127
+ throttleMbps: number().min(1).max(1e3).optional(),
8128
+ /** Omitted = `blocking`, which stays the default. */
8129
+ mode: StorageMigrationModeSchema.optional()
8064
8130
  });
8065
- /** The durable coordinator state machine. The only phase that changes default
8066
- * locations is `repointing`, after every selected mover has completed and been
8067
- * verified. */
8131
+ /**
8132
+ * The durable coordinator state machine.
8133
+ *
8134
+ * `blocking`:
8135
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8136
+ *
8137
+ * `nonBlocking`:
8138
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8139
+ *
8140
+ * Same phases, different order plus two new ones — not a second mover.
8141
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8142
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8143
+ * `repointing` is still the only phase that changes a default location.
8144
+ */
8068
8145
  var StorageMigrationPhaseSchema = _enum([
8069
8146
  "planning",
8147
+ "sealing",
8070
8148
  "pausing",
8071
8149
  "moving",
8150
+ "draining",
8072
8151
  "verifying",
8073
8152
  "repointing",
8074
8153
  "refreshing",
@@ -8082,17 +8161,56 @@ var StorageMigrationParticipantSchema = _enum([
8082
8161
  "recorder",
8083
8162
  "analytics"
8084
8163
  ]);
8164
+ /**
8165
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8166
+ *
8167
+ * The long half of a non-blocking migration is `draining`, and it is measured
8168
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8169
+ * existed the only place those numbers appeared was a Loki line, so an operator
8170
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8171
+ * afternoon.
8172
+ *
8173
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8174
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8175
+ * mover — which is the exact failure this is meant to end. The coordinator's
8176
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8177
+ * read `state`; folding the counters costs no extra read and makes the durable
8178
+ * record say afterwards how far a move actually got.
8179
+ *
8180
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8181
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8182
+ * cannot say M, and a 0 there would render as "100 % done".
8183
+ */
8184
+ var StorageMigrationMoveProgressSchema = object({
8185
+ filesMoved: number().int().nonnegative(),
8186
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8187
+ filesTotal: number().int().nonnegative().nullable(),
8188
+ bytesMoved: number().int().nonnegative(),
8189
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8190
+ * crash gets a new mover, and a rate computed from the migration's start
8191
+ * would silently average in the time nothing was running. */
8192
+ startedAt: number(),
8193
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8194
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8195
+ * subtract its own. */
8196
+ observedAt: number()
8197
+ });
8085
8198
  var StorageMigrationMoveSchema = object({
8086
8199
  storageClass: StorageMigrationClassSchema,
8087
8200
  fromLocationId: string(),
8088
8201
  toLocationId: string(),
8089
8202
  moverJobId: string().nullable(),
8090
8203
  state: RelocateJobStateSchema.nullable(),
8091
- error: string().nullable()
8204
+ error: string().nullable(),
8205
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8206
+ progress: StorageMigrationMoveProgressSchema.nullable()
8092
8207
  });
8093
8208
  var StorageMigrationJobSchema = object({
8094
8209
  jobId: string(),
8095
8210
  phase: StorageMigrationPhaseSchema,
8211
+ /** Which order this job is running. `status` is the only place an operator
8212
+ * can tell a seconds-long cutover from a thirty-hour one. */
8213
+ mode: StorageMigrationModeSchema,
8096
8214
  destinations: StorageMigrationDestinationsSchema,
8097
8215
  throttleMbps: number(),
8098
8216
  moves: array(StorageMigrationMoveSchema),
@@ -8105,13 +8223,122 @@ var StorageMigrationJobSchema = object({
8105
8223
  finishedAt: number().nullable(),
8106
8224
  error: string().nullable()
8107
8225
  });
8226
+ var StorageMigrationFindingSchema = object({
8227
+ code: _enum([
8228
+ "sharesDeviceWithSource",
8229
+ "deviceIdentityUnknown",
8230
+ "unstampedEventMediaRows",
8231
+ "blockingOnly",
8232
+ "noMover"
8233
+ ]),
8234
+ storageClass: StorageMigrationClassSchema,
8235
+ /** Human-readable, already carrying the ids and counts. */
8236
+ message: string()
8237
+ });
8108
8238
  var StorageMigrationPlanSchema = object({
8109
8239
  destinations: StorageMigrationDestinationsSchema,
8240
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8241
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8242
+ * it. */
8243
+ mode: StorageMigrationModeSchema,
8110
8244
  moves: array(object({
8111
8245
  storageClass: StorageMigrationClassSchema,
8112
8246
  fromLocationId: string(),
8113
8247
  toLocationId: string()
8114
- }))
8248
+ })),
8249
+ findings: array(StorageMigrationFindingSchema)
8250
+ });
8251
+ /**
8252
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8253
+ *
8254
+ * The coordinator's job record is the state of record for a migration, and its
8255
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8256
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8257
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8258
+ * way because no supported UI path existed. A mover armed like that has no job
8259
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8260
+ *
8261
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8262
+ * orchestrated it.
8263
+ */
8264
+ var StorageMigrationMoverSchema = object({
8265
+ lane: _enum(["footage", "media"]),
8266
+ job: RelocateJobSchema,
8267
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8268
+ * directly against the owning addon. */
8269
+ migrationJobId: string().nullable(),
8270
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8271
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8272
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8273
+ * rate made of two different clocks. */
8274
+ observedAt: number()
8275
+ });
8276
+ /**
8277
+ * What a SOURCE still holds for one storage class — the number that makes a
8278
+ * "drain remaining" action honest rather than hopeful.
8279
+ *
8280
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8281
+ * engine's own selection count for media), never from the resident index: a
8282
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8283
+ * never been told about (D295).
8284
+ *
8285
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8286
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8287
+ * because refusing on an unanswerable read would hide exactly the case an
8288
+ * operator needs to act on.
8289
+ */
8290
+ var StorageMigrationResidueSchema = object({
8291
+ storageClass: StorageMigrationClassSchema,
8292
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8293
+ * move from wherever they are rather than from one named source. */
8294
+ fromLocationId: string(),
8295
+ /** Where a drain would move it — the class's CURRENT default. */
8296
+ toLocationId: string(),
8297
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8298
+ items: number().int().nonnegative().nullable(),
8299
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8300
+ bytes: number().int().nonnegative().nullable()
8301
+ });
8302
+ /**
8303
+ * Run the DRAIN half and nothing else.
8304
+ *
8305
+ * A migration that reached `done` has already repointed, so `start` correctly
8306
+ * refuses its destination ("already the default") — there is nothing left to
8307
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8308
+ * or finish against a work list that was a tenth of the archive (D295), and
8309
+ * before this there was no supported way to run only that half: the only way
8310
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8311
+ *
8312
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8313
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8314
+ * re-repoint a class that is already migrated.
8315
+ */
8316
+ var StorageMigrationDrainInputSchema = object({
8317
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8318
+ * a class whose source is already empty is refused rather than started. */
8319
+ classes: array(StorageMigrationClassSchema).min(1),
8320
+ throttleMbps: number().min(1).max(1e3).optional()
8321
+ });
8322
+ /** What a footage source still holds, asked of the durable hour ledger. */
8323
+ var RelocateResidueInputSchema = object({
8324
+ fromLocationId: string().min(1),
8325
+ /** Narrow to one logical class; omit for every profile on the location. */
8326
+ footageClass: RelocateFootageClassSchema.optional()
8327
+ });
8328
+ /** `null` = the archive could not answer (no ledger on this node, or the
8329
+ * aggregate failed). Never conflated with an empty source. */
8330
+ var RelocateResidueSchema = object({
8331
+ segments: number().int().nonnegative(),
8332
+ bytes: number().int().nonnegative()
8333
+ }).nullable();
8334
+ /** How many rows a media pass would still act on against a given target — the
8335
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8336
+ * never disagree. `null` = the count could not be taken. */
8337
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8338
+ var RelocatableMediaCountInputSchema = object({
8339
+ toLocationId: string().min(1),
8340
+ /** Omitted = `move`. */
8341
+ mode: MediaRelocateModeSchema.optional()
8115
8342
  });
8116
8343
  /**
8117
8344
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8217,6 +8444,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8217
8444
  * two addons declaring the same `id` must agree on `cardinality` (validated
8218
8445
  * at kernel aggregation time, not here).
8219
8446
  */
8447
+ /**
8448
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8449
+ * actually reaches the bytes. It is the constraint that decides which
8450
+ * `storage-provider`s may back a location of that kind.
8451
+ *
8452
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8453
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8454
+ * post-analysis media roots). Only a provider that serves a genuine local
8455
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8456
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8457
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8458
+ * against a same-named local directory that is something else entirely.
8459
+ *
8460
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8461
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8462
+ * service never sees a path, so any provider can back it. `backups` is the
8463
+ * one kind that qualifies today.
8464
+ *
8465
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8466
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8467
+ * refused the configuration; the first write simply went somewhere wrong, and
8468
+ * a recording write that goes wrong surfaces as a silent black window rather
8469
+ * than an error (the read path does not `stat`). This turns that accident into
8470
+ * a declared, enforced, testable refusal.
8471
+ */
8472
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8220
8473
  var StorageLocationDeclarationSchema = object({
8221
8474
  /**
8222
8475
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8236,6 +8489,19 @@ var StorageLocationDeclarationSchema = object({
8236
8489
  */
8237
8490
  cardinality: _enum(["single", "multi"]),
8238
8491
  /**
8492
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8493
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8494
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8495
+ *
8496
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8497
+ * can only over-restrict (refuse a remote provider for a kind that might
8498
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8499
+ * permissive direction and is therefore never inferred — a repo guard
8500
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8501
+ * reached by omission.
8502
+ */
8503
+ access: StorageAccessSchema.optional(),
8504
+ /**
8239
8505
  * When set, the default instance for this location inherits its resolved
8240
8506
  * root from the named location's default instance. Useful for derivative
8241
8507
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17891,8 +18157,10 @@ var TrackSchema = object({
17891
18157
  lastSeen: number(),
17892
18158
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17893
18159
  positions: array(TrackPositionSchema).readonly(),
17894
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17895
- * saveThumbnails policy). */
18160
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18161
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18162
+ * the retired `saveThumbnails` used to gate this and the rolling
18163
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17896
18164
  snapshots: array(TrackSnapshotSchema).readonly(),
17897
18165
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17898
18166
  zonesVisited: array(string()).readonly(),
@@ -18752,6 +19020,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18752
19020
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18753
19021
  kind: "mutation",
18754
19022
  auth: "admin"
19023
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19024
+ kind: "query",
19025
+ auth: "admin"
18755
19026
  }), method(object({}), array(RelocateJobSchema).readonly(), {
18756
19027
  kind: "query",
18757
19028
  auth: "admin"
@@ -20659,7 +20930,10 @@ method(object({
20659
20930
  }), StorageLocationSchema, {
20660
20931
  kind: "mutation",
20661
20932
  auth: "admin"
20662
- }), method(object({ id: string() }), _void(), {
20933
+ }), method(object({
20934
+ id: string(),
20935
+ force: boolean().optional()
20936
+ }), _void(), {
20663
20937
  kind: "mutation",
20664
20938
  auth: "admin"
20665
20939
  }), method(object({ id: string() }), object({
@@ -20708,6 +20982,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20708
20982
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20709
20983
  kind: "mutation",
20710
20984
  auth: "admin"
20985
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
20986
+ kind: "mutation",
20987
+ auth: "admin"
20711
20988
  });
20712
20989
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20713
20990
  providerId: string().min(1),
@@ -21106,12 +21383,38 @@ response: record(string(), unknown()) }), object({
21106
21383
  *
21107
21384
  * ## Why this is a capability and not a helper
21108
21385
  *
21109
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21110
- * plate, vehicle, identity, and the event store's derivativesand every one of
21111
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21112
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21113
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21114
- * load 5,000 rows before ranking anything.
21386
+ * This capability was introduced with the claim that SIX stores in
21387
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21388
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21389
+ * claim was never true, and leaving it here made five stores look like pending
21390
+ * work when three of them have no vector at all. Counted column by column on
21391
+ * 2026-08-30, exactly THREE ever held one:
21392
+ *
21393
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21394
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21395
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21396
+ * face, migrated 2026-08-30 into its OWN index (see below).
21397
+ *
21398
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21399
+ * and `identities` store a name; the event store stores no derivative vector.
21400
+ * They are not migration candidates and never were.
21401
+ *
21402
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21403
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21404
+ * rows before ranking anything.
21405
+ *
21406
+ * ## One index per COMPARISON, never per encoder
21407
+ *
21408
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21409
+ * model, and they still get two indexes. An index is a set of things that are
21410
+ * ranked against each other and that live and die together, and these two are
21411
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21412
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21413
+ * forever and is the gallery every recognition ranks against. One index would
21414
+ * mean every gallery load and every reconcile carried a filter whose failure
21415
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21416
+ * person's only sample. The dimension they share is not a reason to share an
21417
+ * index; the question they answer is, and it differs.
21115
21418
  *
21116
21419
  * The fix is not a faster loop, it is a different backend — and the backend
21117
21420
  * should be replaceable without touching six callers. So: a singleton
@@ -21216,7 +21519,20 @@ var VectorQueryResultSchema = object({
21216
21519
  */
21217
21520
  scanned: number(),
21218
21521
  /** True when the backend could not consider every row that passed the filter. */
21219
- truncated: boolean()
21522
+ truncated: boolean(),
21523
+ /**
21524
+ * The `topK` the backend actually ran with.
21525
+ *
21526
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21527
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21528
+ * own log rather than in its answer. That is how an audit asking for 20,000
21529
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21530
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21531
+ * MUCH, in the return value, where the caller cannot fail to see it.
21532
+ *
21533
+ * Equals the requested `topK` whenever nothing was lowered.
21534
+ */
21535
+ effectiveTopK: number().int().positive()
21220
21536
  });
21221
21537
  var VectorDeleteInputSchema = object({
21222
21538
  index: string(),
@@ -21245,6 +21561,68 @@ var VectorGetResultSchema = object({ items: array(object({
21245
21561
  id: string(),
21246
21562
  metadata: VectorMetadataSchema
21247
21563
  })) });
21564
+ /**
21565
+ * Ids to read back WITH their vectors.
21566
+ *
21567
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21568
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21569
+ * caller depends on that promise. This one promises the opposite.
21570
+ *
21571
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21572
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21573
+ * a per-face cross-process KNN would be a network round trip inside the
21574
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21575
+ * it requires the index to hand the floats back. Without this method the only
21576
+ * way to keep a readable vector is a JSON column, which is the thing this
21577
+ * capability exists to delete.
21578
+ *
21579
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21580
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21581
+ */
21582
+ var VectorFetchInputSchema = object({
21583
+ index: string(),
21584
+ ids: array(string())
21585
+ });
21586
+ var VectorFetchResultSchema = object({ items: array(object({
21587
+ id: string(),
21588
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21589
+ vector: string(),
21590
+ metadata: VectorMetadataSchema
21591
+ })) });
21592
+ /**
21593
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21594
+ *
21595
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21596
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21597
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21598
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21599
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21600
+ * looked" for as long as anyone cared to read it.
21601
+ *
21602
+ * This is the primitive that question actually needs: a bounded page, ordered
21603
+ * by the backend's own row order, costing no distance computation at all.
21604
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21605
+ * the full-table read this capability was built to stop.
21606
+ */
21607
+ var VectorScanInputSchema = object({
21608
+ index: string(),
21609
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21610
+ cursor: number().int().nonnegative().default(0),
21611
+ limit: number().int().positive()
21612
+ });
21613
+ var VectorScanResultSchema = object({
21614
+ items: array(object({
21615
+ id: string(),
21616
+ metadata: VectorMetadataSchema
21617
+ })),
21618
+ /**
21619
+ * Where the next page starts, or `null` when the walk reached the end.
21620
+ *
21621
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21622
+ * from a short page: a backend is free to return fewer rows than asked.
21623
+ */
21624
+ nextCursor: number().int().nonnegative().nullable()
21625
+ });
21248
21626
  var VectorStatsInputSchema = object({ index: string() });
21249
21627
  var VectorStatsResultSchema = object({
21250
21628
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21263,7 +21641,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21263
21641
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21264
21642
  kind: "mutation",
21265
21643
  auth: "admin"
21266
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21644
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21267
21645
  kind: "mutation",
21268
21646
  auth: "admin"
21269
21647
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26167,6 +26545,9 @@ method(object({
26167
26545
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26168
26546
  kind: "query",
26169
26547
  auth: "admin"
26548
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26549
+ kind: "query",
26550
+ auth: "admin"
26170
26551
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26171
26552
  kind: "mutation",
26172
26553
  auth: "admin"
@@ -31132,6 +31513,18 @@ Object.freeze({
31132
31513
  addonId: null,
31133
31514
  access: "create"
31134
31515
  },
31516
+ "pipelineAnalytics.countRelocatableMedia": {
31517
+ capName: "pipeline-analytics",
31518
+ capScope: "device",
31519
+ addonId: null,
31520
+ access: "view"
31521
+ },
31522
+ "pipelineAnalytics.countUnstampedEventMedia": {
31523
+ capName: "pipeline-analytics",
31524
+ capScope: "device",
31525
+ addonId: null,
31526
+ access: "view"
31527
+ },
31135
31528
  "pipelineAnalytics.deleteDeviceEvents": {
31136
31529
  capName: "pipeline-analytics",
31137
31530
  capScope: "device",
@@ -32290,6 +32683,12 @@ Object.freeze({
32290
32683
  addonId: null,
32291
32684
  access: "view"
32292
32685
  },
32686
+ "recording.getRelocateResidue": {
32687
+ capName: "recording",
32688
+ capScope: "system",
32689
+ addonId: null,
32690
+ access: "view"
32691
+ },
32293
32692
  "recording.getStorageMigrationMoveStatus": {
32294
32693
  capName: "recording",
32295
32694
  capScope: "system",
@@ -32836,12 +33235,30 @@ Object.freeze({
32836
33235
  addonId: null,
32837
33236
  access: "create"
32838
33237
  },
33238
+ "storageMigration.drain": {
33239
+ capName: "storage-migration",
33240
+ capScope: "system",
33241
+ addonId: null,
33242
+ access: "create"
33243
+ },
33244
+ "storageMigration.movers": {
33245
+ capName: "storage-migration",
33246
+ capScope: "system",
33247
+ addonId: null,
33248
+ access: "view"
33249
+ },
32839
33250
  "storageMigration.plan": {
32840
33251
  capName: "storage-migration",
32841
33252
  capScope: "system",
32842
33253
  addonId: null,
32843
33254
  access: "view"
32844
33255
  },
33256
+ "storageMigration.residue": {
33257
+ capName: "storage-migration",
33258
+ capScope: "system",
33259
+ addonId: null,
33260
+ access: "view"
33261
+ },
32845
33262
  "storageMigration.start": {
32846
33263
  capName: "storage-migration",
32847
33264
  capScope: "system",
@@ -33676,6 +34093,12 @@ Object.freeze({
33676
34093
  addonId: null,
33677
34094
  access: "delete"
33678
34095
  },
34096
+ "vectorStore.fetchByIds": {
34097
+ capName: "vector-store",
34098
+ capScope: "system",
34099
+ addonId: null,
34100
+ access: "view"
34101
+ },
33679
34102
  "vectorStore.getByIds": {
33680
34103
  capName: "vector-store",
33681
34104
  capScope: "system",
@@ -33688,6 +34111,12 @@ Object.freeze({
33688
34111
  addonId: null,
33689
34112
  access: "view"
33690
34113
  },
34114
+ "vectorStore.scan": {
34115
+ capName: "vector-store",
34116
+ capScope: "system",
34117
+ addonId: null,
34118
+ access: "view"
34119
+ },
33691
34120
  "vectorStore.stats": {
33692
34121
  capName: "vector-store",
33693
34122
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-decoder-ffmpeg",
3
- "version": "1.2.42",
3
+ "version": "1.2.45",
4
4
  "description": "Standalone ffmpeg-subprocess decoder fallback addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",