@camstack/addon-decoder-ffmpeg 1.2.43 → 1.2.46

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 +387 -19
  2. package/dist/index.mjs +387 -19
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8004,6 +8004,21 @@ var RelocateJobSchema = object({
8004
8004
  bytesMoved: number().int(),
8005
8005
  /** Total files discovered up front; null while (or when) unknown. */
8006
8006
  filesTotal: number().int().nullable(),
8007
+ /**
8008
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8009
+ * made that nobody asked for, so it is reported where the operator reads the
8010
+ * job rather than only in a log line.
8011
+ *
8012
+ * A footage segment records its byte count in its own NAME, and the durable
8013
+ * hour row derives its aggregates from those names. A file that does not
8014
+ * match its name therefore makes the ledger's sums — and with them quota and
8015
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8016
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8017
+ *
8018
+ * Absent on lanes where the question has no meaning: a media blob's size is
8019
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8020
+ */
8021
+ rowsReconciled: number().int().nonnegative().optional(),
8007
8022
  startedAt: number(),
8008
8023
  finishedAt: number().nullable(),
8009
8024
  error: string().nullable()
@@ -8072,14 +8087,42 @@ var RelocateMediaInputSchema = object({
8072
8087
  /** Omitted = `move`, the pre-existing behaviour. */
8073
8088
  mode: MediaRelocateModeSchema.optional()
8074
8089
  });
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()
8090
+ /**
8091
+ * The unstamped population of ONE collection split, because the gate and the
8092
+ * operator ask two different questions and only one of them has to be cheap.
8093
+ *
8094
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8095
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8096
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8097
+ * that matters — after a seal, when the population is empty.
8098
+ *
8099
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8100
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8101
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8102
+ * and useful answer: "there are some, and this read could not say how many"
8103
+ * still refuses the cutover, which is the whole job.
8104
+ */
8105
+ var UnstampedRowsSchema = object({
8106
+ present: boolean(),
8107
+ rows: number().int().nonnegative().nullable()
8082
8108
  });
8109
+ /**
8110
+ * How many rows still carry NO `locationId` — the population a repoint would
8111
+ * silently re-aim at a disk that does not hold their bytes.
8112
+ *
8113
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8114
+ * over. The gate opens on a measured absence and on nothing else; an unread
8115
+ * collection and an empty one are different facts, and this repo has already
8116
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8117
+ */
8118
+ var UnstampedEventMediaCountSchema = object({
8119
+ media: UnstampedRowsSchema,
8120
+ retrainFrames: UnstampedRowsSchema,
8121
+ /** True when EITHER collection holds one. The refusal reads this. */
8122
+ anyPresent: boolean(),
8123
+ /** Sum across both, or `null` when either lane could not be counted. */
8124
+ total: number().int().nonnegative().nullable()
8125
+ }).nullable();
8083
8126
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8084
8127
  /** The independently selectable logical storage classes — every class
8085
8128
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8165,13 +8208,53 @@ var StorageMigrationParticipantSchema = _enum([
8165
8208
  "recorder",
8166
8209
  "analytics"
8167
8210
  ]);
8211
+ /**
8212
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8213
+ *
8214
+ * The long half of a non-blocking migration is `draining`, and it is measured
8215
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8216
+ * existed the only place those numbers appeared was a Loki line, so an operator
8217
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8218
+ * afternoon.
8219
+ *
8220
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8221
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8222
+ * mover — which is the exact failure this is meant to end. The coordinator's
8223
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8224
+ * read `state`; folding the counters costs no extra read and makes the durable
8225
+ * record say afterwards how far a move actually got.
8226
+ *
8227
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8228
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8229
+ * cannot say M, and a 0 there would render as "100 % done".
8230
+ */
8231
+ var StorageMigrationMoveProgressSchema = object({
8232
+ filesMoved: number().int().nonnegative(),
8233
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8234
+ filesTotal: number().int().nonnegative().nullable(),
8235
+ bytesMoved: number().int().nonnegative(),
8236
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8237
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8238
+ * rows would be the same failure as one that silently skipped them. */
8239
+ rowsReconciled: number().int().nonnegative().optional(),
8240
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8241
+ * crash gets a new mover, and a rate computed from the migration's start
8242
+ * would silently average in the time nothing was running. */
8243
+ startedAt: number(),
8244
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8245
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8246
+ * subtract its own. */
8247
+ observedAt: number()
8248
+ });
8168
8249
  var StorageMigrationMoveSchema = object({
8169
8250
  storageClass: StorageMigrationClassSchema,
8170
8251
  fromLocationId: string(),
8171
8252
  toLocationId: string(),
8172
8253
  moverJobId: string().nullable(),
8173
8254
  state: RelocateJobStateSchema.nullable(),
8174
- error: string().nullable()
8255
+ error: string().nullable(),
8256
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8257
+ progress: StorageMigrationMoveProgressSchema.nullable()
8175
8258
  });
8176
8259
  var StorageMigrationJobSchema = object({
8177
8260
  jobId: string(),
@@ -8217,6 +8300,98 @@ var StorageMigrationPlanSchema = object({
8217
8300
  findings: array(StorageMigrationFindingSchema)
8218
8301
  });
8219
8302
  /**
8303
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8304
+ *
8305
+ * The coordinator's job record is the state of record for a migration, and its
8306
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8307
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8308
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8309
+ * way because no supported UI path existed. A mover armed like that has no job
8310
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8311
+ *
8312
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8313
+ * orchestrated it.
8314
+ */
8315
+ var StorageMigrationMoverSchema = object({
8316
+ lane: _enum(["footage", "media"]),
8317
+ job: RelocateJobSchema,
8318
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8319
+ * directly against the owning addon. */
8320
+ migrationJobId: string().nullable(),
8321
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8322
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8323
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8324
+ * rate made of two different clocks. */
8325
+ observedAt: number()
8326
+ });
8327
+ /**
8328
+ * What a SOURCE still holds for one storage class — the number that makes a
8329
+ * "drain remaining" action honest rather than hopeful.
8330
+ *
8331
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8332
+ * engine's own selection count for media), never from the resident index: a
8333
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8334
+ * never been told about (D295).
8335
+ *
8336
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8337
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8338
+ * because refusing on an unanswerable read would hide exactly the case an
8339
+ * operator needs to act on.
8340
+ */
8341
+ var StorageMigrationResidueSchema = object({
8342
+ storageClass: StorageMigrationClassSchema,
8343
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8344
+ * move from wherever they are rather than from one named source. */
8345
+ fromLocationId: string(),
8346
+ /** Where a drain would move it — the class's CURRENT default. */
8347
+ toLocationId: string(),
8348
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8349
+ items: number().int().nonnegative().nullable(),
8350
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8351
+ bytes: number().int().nonnegative().nullable()
8352
+ });
8353
+ /**
8354
+ * Run the DRAIN half and nothing else.
8355
+ *
8356
+ * A migration that reached `done` has already repointed, so `start` correctly
8357
+ * refuses its destination ("already the default") — there is nothing left to
8358
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8359
+ * or finish against a work list that was a tenth of the archive (D295), and
8360
+ * before this there was no supported way to run only that half: the only way
8361
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8362
+ *
8363
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8364
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8365
+ * re-repoint a class that is already migrated.
8366
+ */
8367
+ var StorageMigrationDrainInputSchema = object({
8368
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8369
+ * a class whose source is already empty is refused rather than started. */
8370
+ classes: array(StorageMigrationClassSchema).min(1),
8371
+ throttleMbps: number().min(1).max(1e3).optional()
8372
+ });
8373
+ /** What a footage source still holds, asked of the durable hour ledger. */
8374
+ var RelocateResidueInputSchema = object({
8375
+ fromLocationId: string().min(1),
8376
+ /** Narrow to one logical class; omit for every profile on the location. */
8377
+ footageClass: RelocateFootageClassSchema.optional()
8378
+ });
8379
+ /** `null` = the archive could not answer (no ledger on this node, or the
8380
+ * aggregate failed). Never conflated with an empty source. */
8381
+ var RelocateResidueSchema = object({
8382
+ segments: number().int().nonnegative(),
8383
+ bytes: number().int().nonnegative()
8384
+ }).nullable();
8385
+ /** How many rows a media pass would still act on against a given target — the
8386
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8387
+ * never disagree. `null` = the count could not be taken. */
8388
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8389
+ var RelocatableMediaCountInputSchema = object({
8390
+ toLocationId: string().min(1),
8391
+ /** Omitted = `move`. */
8392
+ mode: MediaRelocateModeSchema.optional()
8393
+ });
8394
+ /**
8220
8395
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8221
8396
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8222
8397
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8320,6 +8495,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8320
8495
  * two addons declaring the same `id` must agree on `cardinality` (validated
8321
8496
  * at kernel aggregation time, not here).
8322
8497
  */
8498
+ /**
8499
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8500
+ * actually reaches the bytes. It is the constraint that decides which
8501
+ * `storage-provider`s may back a location of that kind.
8502
+ *
8503
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8504
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8505
+ * post-analysis media roots). Only a provider that serves a genuine local
8506
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8507
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8508
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8509
+ * against a same-named local directory that is something else entirely.
8510
+ *
8511
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8512
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8513
+ * service never sees a path, so any provider can back it. `backups` is the
8514
+ * one kind that qualifies today.
8515
+ *
8516
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8517
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8518
+ * refused the configuration; the first write simply went somewhere wrong, and
8519
+ * a recording write that goes wrong surfaces as a silent black window rather
8520
+ * than an error (the read path does not `stat`). This turns that accident into
8521
+ * a declared, enforced, testable refusal.
8522
+ */
8523
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8323
8524
  var StorageLocationDeclarationSchema = object({
8324
8525
  /**
8325
8526
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8339,6 +8540,19 @@ var StorageLocationDeclarationSchema = object({
8339
8540
  */
8340
8541
  cardinality: _enum(["single", "multi"]),
8341
8542
  /**
8543
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8544
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8545
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8546
+ *
8547
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8548
+ * can only over-restrict (refuse a remote provider for a kind that might
8549
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8550
+ * permissive direction and is therefore never inferred — a repo guard
8551
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8552
+ * reached by omission.
8553
+ */
8554
+ access: StorageAccessSchema.optional(),
8555
+ /**
8342
8556
  * When set, the default instance for this location inherits its resolved
8343
8557
  * root from the named location's default instance. Useful for derivative
8344
8558
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17994,8 +18208,10 @@ var TrackSchema = object({
17994
18208
  lastSeen: number(),
17995
18209
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17996
18210
  positions: array(TrackPositionSchema).readonly(),
17997
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17998
- * saveThumbnails policy). */
18211
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18212
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18213
+ * the retired `saveThumbnails` used to gate this and the rolling
18214
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17999
18215
  snapshots: array(TrackSnapshotSchema).readonly(),
18000
18216
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18001
18217
  zonesVisited: array(string()).readonly(),
@@ -18855,7 +19071,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18855
19071
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18856
19072
  kind: "mutation",
18857
19073
  auth: "admin"
18858
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19074
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19075
+ kind: "query",
19076
+ auth: "admin"
19077
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18859
19078
  kind: "query",
18860
19079
  auth: "admin"
18861
19080
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -20814,6 +21033,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20814
21033
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20815
21034
  kind: "mutation",
20816
21035
  auth: "admin"
21036
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21037
+ kind: "mutation",
21038
+ auth: "admin"
20817
21039
  });
20818
21040
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20819
21041
  providerId: string().min(1),
@@ -21212,12 +21434,38 @@ response: record(string(), unknown()) }), object({
21212
21434
  *
21213
21435
  * ## Why this is a capability and not a helper
21214
21436
  *
21215
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21216
- * plate, vehicle, identity, and the event store's derivativesand every one of
21217
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21218
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21219
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21220
- * load 5,000 rows before ranking anything.
21437
+ * This capability was introduced with the claim that SIX stores in
21438
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21439
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21440
+ * claim was never true, and leaving it here made five stores look like pending
21441
+ * work when three of them have no vector at all. Counted column by column on
21442
+ * 2026-08-30, exactly THREE ever held one:
21443
+ *
21444
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21445
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21446
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21447
+ * face, migrated 2026-08-30 into its OWN index (see below).
21448
+ *
21449
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21450
+ * and `identities` store a name; the event store stores no derivative vector.
21451
+ * They are not migration candidates and never were.
21452
+ *
21453
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21454
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21455
+ * rows before ranking anything.
21456
+ *
21457
+ * ## One index per COMPARISON, never per encoder
21458
+ *
21459
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21460
+ * model, and they still get two indexes. An index is a set of things that are
21461
+ * ranked against each other and that live and die together, and these two are
21462
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21463
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21464
+ * forever and is the gallery every recognition ranks against. One index would
21465
+ * mean every gallery load and every reconcile carried a filter whose failure
21466
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21467
+ * person's only sample. The dimension they share is not a reason to share an
21468
+ * index; the question they answer is, and it differs.
21221
21469
  *
21222
21470
  * The fix is not a faster loop, it is a different backend — and the backend
21223
21471
  * should be replaceable without touching six callers. So: a singleton
@@ -21322,7 +21570,20 @@ var VectorQueryResultSchema = object({
21322
21570
  */
21323
21571
  scanned: number(),
21324
21572
  /** True when the backend could not consider every row that passed the filter. */
21325
- truncated: boolean()
21573
+ truncated: boolean(),
21574
+ /**
21575
+ * The `topK` the backend actually ran with.
21576
+ *
21577
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21578
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21579
+ * own log rather than in its answer. That is how an audit asking for 20,000
21580
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21581
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21582
+ * MUCH, in the return value, where the caller cannot fail to see it.
21583
+ *
21584
+ * Equals the requested `topK` whenever nothing was lowered.
21585
+ */
21586
+ effectiveTopK: number().int().positive()
21326
21587
  });
21327
21588
  var VectorDeleteInputSchema = object({
21328
21589
  index: string(),
@@ -21351,6 +21612,68 @@ var VectorGetResultSchema = object({ items: array(object({
21351
21612
  id: string(),
21352
21613
  metadata: VectorMetadataSchema
21353
21614
  })) });
21615
+ /**
21616
+ * Ids to read back WITH their vectors.
21617
+ *
21618
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21619
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21620
+ * caller depends on that promise. This one promises the opposite.
21621
+ *
21622
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21623
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21624
+ * a per-face cross-process KNN would be a network round trip inside the
21625
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21626
+ * it requires the index to hand the floats back. Without this method the only
21627
+ * way to keep a readable vector is a JSON column, which is the thing this
21628
+ * capability exists to delete.
21629
+ *
21630
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21631
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21632
+ */
21633
+ var VectorFetchInputSchema = object({
21634
+ index: string(),
21635
+ ids: array(string())
21636
+ });
21637
+ var VectorFetchResultSchema = object({ items: array(object({
21638
+ id: string(),
21639
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21640
+ vector: string(),
21641
+ metadata: VectorMetadataSchema
21642
+ })) });
21643
+ /**
21644
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21645
+ *
21646
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21647
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21648
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21649
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21650
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21651
+ * looked" for as long as anyone cared to read it.
21652
+ *
21653
+ * This is the primitive that question actually needs: a bounded page, ordered
21654
+ * by the backend's own row order, costing no distance computation at all.
21655
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21656
+ * the full-table read this capability was built to stop.
21657
+ */
21658
+ var VectorScanInputSchema = object({
21659
+ index: string(),
21660
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21661
+ cursor: number().int().nonnegative().default(0),
21662
+ limit: number().int().positive()
21663
+ });
21664
+ var VectorScanResultSchema = object({
21665
+ items: array(object({
21666
+ id: string(),
21667
+ metadata: VectorMetadataSchema
21668
+ })),
21669
+ /**
21670
+ * Where the next page starts, or `null` when the walk reached the end.
21671
+ *
21672
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21673
+ * from a short page: a backend is free to return fewer rows than asked.
21674
+ */
21675
+ nextCursor: number().int().nonnegative().nullable()
21676
+ });
21354
21677
  var VectorStatsInputSchema = object({ index: string() });
21355
21678
  var VectorStatsResultSchema = object({
21356
21679
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21369,7 +21692,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21369
21692
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21370
21693
  kind: "mutation",
21371
21694
  auth: "admin"
21372
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21695
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21373
21696
  kind: "mutation",
21374
21697
  auth: "admin"
21375
21698
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26273,6 +26596,9 @@ method(object({
26273
26596
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26274
26597
  kind: "query",
26275
26598
  auth: "admin"
26599
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26600
+ kind: "query",
26601
+ auth: "admin"
26276
26602
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26277
26603
  kind: "mutation",
26278
26604
  auth: "admin"
@@ -31238,6 +31564,12 @@ Object.freeze({
31238
31564
  addonId: null,
31239
31565
  access: "create"
31240
31566
  },
31567
+ "pipelineAnalytics.countRelocatableMedia": {
31568
+ capName: "pipeline-analytics",
31569
+ capScope: "device",
31570
+ addonId: null,
31571
+ access: "view"
31572
+ },
31241
31573
  "pipelineAnalytics.countUnstampedEventMedia": {
31242
31574
  capName: "pipeline-analytics",
31243
31575
  capScope: "device",
@@ -32402,6 +32734,12 @@ Object.freeze({
32402
32734
  addonId: null,
32403
32735
  access: "view"
32404
32736
  },
32737
+ "recording.getRelocateResidue": {
32738
+ capName: "recording",
32739
+ capScope: "system",
32740
+ addonId: null,
32741
+ access: "view"
32742
+ },
32405
32743
  "recording.getStorageMigrationMoveStatus": {
32406
32744
  capName: "recording",
32407
32745
  capScope: "system",
@@ -32948,12 +33286,30 @@ Object.freeze({
32948
33286
  addonId: null,
32949
33287
  access: "create"
32950
33288
  },
33289
+ "storageMigration.drain": {
33290
+ capName: "storage-migration",
33291
+ capScope: "system",
33292
+ addonId: null,
33293
+ access: "create"
33294
+ },
33295
+ "storageMigration.movers": {
33296
+ capName: "storage-migration",
33297
+ capScope: "system",
33298
+ addonId: null,
33299
+ access: "view"
33300
+ },
32951
33301
  "storageMigration.plan": {
32952
33302
  capName: "storage-migration",
32953
33303
  capScope: "system",
32954
33304
  addonId: null,
32955
33305
  access: "view"
32956
33306
  },
33307
+ "storageMigration.residue": {
33308
+ capName: "storage-migration",
33309
+ capScope: "system",
33310
+ addonId: null,
33311
+ access: "view"
33312
+ },
32957
33313
  "storageMigration.start": {
32958
33314
  capName: "storage-migration",
32959
33315
  capScope: "system",
@@ -33788,6 +34144,12 @@ Object.freeze({
33788
34144
  addonId: null,
33789
34145
  access: "delete"
33790
34146
  },
34147
+ "vectorStore.fetchByIds": {
34148
+ capName: "vector-store",
34149
+ capScope: "system",
34150
+ addonId: null,
34151
+ access: "view"
34152
+ },
33791
34153
  "vectorStore.getByIds": {
33792
34154
  capName: "vector-store",
33793
34155
  capScope: "system",
@@ -33800,6 +34162,12 @@ Object.freeze({
33800
34162
  addonId: null,
33801
34163
  access: "view"
33802
34164
  },
34165
+ "vectorStore.scan": {
34166
+ capName: "vector-store",
34167
+ capScope: "system",
34168
+ addonId: null,
34169
+ access: "view"
34170
+ },
33803
34171
  "vectorStore.stats": {
33804
34172
  capName: "vector-store",
33805
34173
  capScope: "system",
package/dist/index.mjs CHANGED
@@ -8000,6 +8000,21 @@ var RelocateJobSchema = object({
8000
8000
  bytesMoved: number().int(),
8001
8001
  /** Total files discovered up front; null while (or when) unknown. */
8002
8002
  filesTotal: number().int().nullable(),
8003
+ /**
8004
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8005
+ * made that nobody asked for, so it is reported where the operator reads the
8006
+ * job rather than only in a log line.
8007
+ *
8008
+ * A footage segment records its byte count in its own NAME, and the durable
8009
+ * hour row derives its aggregates from those names. A file that does not
8010
+ * match its name therefore makes the ledger's sums — and with them quota and
8011
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8012
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8013
+ *
8014
+ * Absent on lanes where the question has no meaning: a media blob's size is
8015
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8016
+ */
8017
+ rowsReconciled: number().int().nonnegative().optional(),
8003
8018
  startedAt: number(),
8004
8019
  finishedAt: number().nullable(),
8005
8020
  error: string().nullable()
@@ -8068,14 +8083,42 @@ var RelocateMediaInputSchema = object({
8068
8083
  /** Omitted = `move`, the pre-existing behaviour. */
8069
8084
  mode: MediaRelocateModeSchema.optional()
8070
8085
  });
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()
8086
+ /**
8087
+ * The unstamped population of ONE collection split, because the gate and the
8088
+ * operator ask two different questions and only one of them has to be cheap.
8089
+ *
8090
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8091
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8092
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8093
+ * that matters — after a seal, when the population is empty.
8094
+ *
8095
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8096
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8097
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8098
+ * and useful answer: "there are some, and this read could not say how many"
8099
+ * still refuses the cutover, which is the whole job.
8100
+ */
8101
+ var UnstampedRowsSchema = object({
8102
+ present: boolean(),
8103
+ rows: number().int().nonnegative().nullable()
8078
8104
  });
8105
+ /**
8106
+ * How many rows still carry NO `locationId` — the population a repoint would
8107
+ * silently re-aim at a disk that does not hold their bytes.
8108
+ *
8109
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8110
+ * over. The gate opens on a measured absence and on nothing else; an unread
8111
+ * collection and an empty one are different facts, and this repo has already
8112
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8113
+ */
8114
+ var UnstampedEventMediaCountSchema = object({
8115
+ media: UnstampedRowsSchema,
8116
+ retrainFrames: UnstampedRowsSchema,
8117
+ /** True when EITHER collection holds one. The refusal reads this. */
8118
+ anyPresent: boolean(),
8119
+ /** Sum across both, or `null` when either lane could not be counted. */
8120
+ total: number().int().nonnegative().nullable()
8121
+ }).nullable();
8079
8122
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8080
8123
  /** The independently selectable logical storage classes — every class
8081
8124
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8161,13 +8204,53 @@ var StorageMigrationParticipantSchema = _enum([
8161
8204
  "recorder",
8162
8205
  "analytics"
8163
8206
  ]);
8207
+ /**
8208
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8209
+ *
8210
+ * The long half of a non-blocking migration is `draining`, and it is measured
8211
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8212
+ * existed the only place those numbers appeared was a Loki line, so an operator
8213
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8214
+ * afternoon.
8215
+ *
8216
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8217
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8218
+ * mover — which is the exact failure this is meant to end. The coordinator's
8219
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8220
+ * read `state`; folding the counters costs no extra read and makes the durable
8221
+ * record say afterwards how far a move actually got.
8222
+ *
8223
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8224
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8225
+ * cannot say M, and a 0 there would render as "100 % done".
8226
+ */
8227
+ var StorageMigrationMoveProgressSchema = object({
8228
+ filesMoved: number().int().nonnegative(),
8229
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8230
+ filesTotal: number().int().nonnegative().nullable(),
8231
+ bytesMoved: number().int().nonnegative(),
8232
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8233
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8234
+ * rows would be the same failure as one that silently skipped them. */
8235
+ rowsReconciled: number().int().nonnegative().optional(),
8236
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8237
+ * crash gets a new mover, and a rate computed from the migration's start
8238
+ * would silently average in the time nothing was running. */
8239
+ startedAt: number(),
8240
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8241
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8242
+ * subtract its own. */
8243
+ observedAt: number()
8244
+ });
8164
8245
  var StorageMigrationMoveSchema = object({
8165
8246
  storageClass: StorageMigrationClassSchema,
8166
8247
  fromLocationId: string(),
8167
8248
  toLocationId: string(),
8168
8249
  moverJobId: string().nullable(),
8169
8250
  state: RelocateJobStateSchema.nullable(),
8170
- error: string().nullable()
8251
+ error: string().nullable(),
8252
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8253
+ progress: StorageMigrationMoveProgressSchema.nullable()
8171
8254
  });
8172
8255
  var StorageMigrationJobSchema = object({
8173
8256
  jobId: string(),
@@ -8213,6 +8296,98 @@ var StorageMigrationPlanSchema = object({
8213
8296
  findings: array(StorageMigrationFindingSchema)
8214
8297
  });
8215
8298
  /**
8299
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8300
+ *
8301
+ * The coordinator's job record is the state of record for a migration, and its
8302
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8303
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8304
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8305
+ * way because no supported UI path existed. A mover armed like that has no job
8306
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8307
+ *
8308
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8309
+ * orchestrated it.
8310
+ */
8311
+ var StorageMigrationMoverSchema = object({
8312
+ lane: _enum(["footage", "media"]),
8313
+ job: RelocateJobSchema,
8314
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8315
+ * directly against the owning addon. */
8316
+ migrationJobId: string().nullable(),
8317
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8318
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8319
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8320
+ * rate made of two different clocks. */
8321
+ observedAt: number()
8322
+ });
8323
+ /**
8324
+ * What a SOURCE still holds for one storage class — the number that makes a
8325
+ * "drain remaining" action honest rather than hopeful.
8326
+ *
8327
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8328
+ * engine's own selection count for media), never from the resident index: a
8329
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8330
+ * never been told about (D295).
8331
+ *
8332
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8333
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8334
+ * because refusing on an unanswerable read would hide exactly the case an
8335
+ * operator needs to act on.
8336
+ */
8337
+ var StorageMigrationResidueSchema = object({
8338
+ storageClass: StorageMigrationClassSchema,
8339
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8340
+ * move from wherever they are rather than from one named source. */
8341
+ fromLocationId: string(),
8342
+ /** Where a drain would move it — the class's CURRENT default. */
8343
+ toLocationId: string(),
8344
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8345
+ items: number().int().nonnegative().nullable(),
8346
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8347
+ bytes: number().int().nonnegative().nullable()
8348
+ });
8349
+ /**
8350
+ * Run the DRAIN half and nothing else.
8351
+ *
8352
+ * A migration that reached `done` has already repointed, so `start` correctly
8353
+ * refuses its destination ("already the default") — there is nothing left to
8354
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8355
+ * or finish against a work list that was a tenth of the archive (D295), and
8356
+ * before this there was no supported way to run only that half: the only way
8357
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8358
+ *
8359
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8360
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8361
+ * re-repoint a class that is already migrated.
8362
+ */
8363
+ var StorageMigrationDrainInputSchema = object({
8364
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8365
+ * a class whose source is already empty is refused rather than started. */
8366
+ classes: array(StorageMigrationClassSchema).min(1),
8367
+ throttleMbps: number().min(1).max(1e3).optional()
8368
+ });
8369
+ /** What a footage source still holds, asked of the durable hour ledger. */
8370
+ var RelocateResidueInputSchema = object({
8371
+ fromLocationId: string().min(1),
8372
+ /** Narrow to one logical class; omit for every profile on the location. */
8373
+ footageClass: RelocateFootageClassSchema.optional()
8374
+ });
8375
+ /** `null` = the archive could not answer (no ledger on this node, or the
8376
+ * aggregate failed). Never conflated with an empty source. */
8377
+ var RelocateResidueSchema = object({
8378
+ segments: number().int().nonnegative(),
8379
+ bytes: number().int().nonnegative()
8380
+ }).nullable();
8381
+ /** How many rows a media pass would still act on against a given target — the
8382
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8383
+ * never disagree. `null` = the count could not be taken. */
8384
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8385
+ var RelocatableMediaCountInputSchema = object({
8386
+ toLocationId: string().min(1),
8387
+ /** Omitted = `move`. */
8388
+ mode: MediaRelocateModeSchema.optional()
8389
+ });
8390
+ /**
8216
8391
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8217
8392
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8218
8393
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8316,6 +8491,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8316
8491
  * two addons declaring the same `id` must agree on `cardinality` (validated
8317
8492
  * at kernel aggregation time, not here).
8318
8493
  */
8494
+ /**
8495
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8496
+ * actually reaches the bytes. It is the constraint that decides which
8497
+ * `storage-provider`s may back a location of that kind.
8498
+ *
8499
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8500
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8501
+ * post-analysis media roots). Only a provider that serves a genuine local
8502
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8503
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8504
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8505
+ * against a same-named local directory that is something else entirely.
8506
+ *
8507
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8508
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8509
+ * service never sees a path, so any provider can back it. `backups` is the
8510
+ * one kind that qualifies today.
8511
+ *
8512
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8513
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8514
+ * refused the configuration; the first write simply went somewhere wrong, and
8515
+ * a recording write that goes wrong surfaces as a silent black window rather
8516
+ * than an error (the read path does not `stat`). This turns that accident into
8517
+ * a declared, enforced, testable refusal.
8518
+ */
8519
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8319
8520
  var StorageLocationDeclarationSchema = object({
8320
8521
  /**
8321
8522
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8335,6 +8536,19 @@ var StorageLocationDeclarationSchema = object({
8335
8536
  */
8336
8537
  cardinality: _enum(["single", "multi"]),
8337
8538
  /**
8539
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8540
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8541
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8542
+ *
8543
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8544
+ * can only over-restrict (refuse a remote provider for a kind that might
8545
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8546
+ * permissive direction and is therefore never inferred — a repo guard
8547
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8548
+ * reached by omission.
8549
+ */
8550
+ access: StorageAccessSchema.optional(),
8551
+ /**
8338
8552
  * When set, the default instance for this location inherits its resolved
8339
8553
  * root from the named location's default instance. Useful for derivative
8340
8554
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17990,8 +18204,10 @@ var TrackSchema = object({
17990
18204
  lastSeen: number(),
17991
18205
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17992
18206
  positions: array(TrackPositionSchema).readonly(),
17993
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17994
- * saveThumbnails policy). */
18207
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18208
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18209
+ * the retired `saveThumbnails` used to gate this and the rolling
18210
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17995
18211
  snapshots: array(TrackSnapshotSchema).readonly(),
17996
18212
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17997
18213
  zonesVisited: array(string()).readonly(),
@@ -18851,7 +19067,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18851
19067
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18852
19068
  kind: "mutation",
18853
19069
  auth: "admin"
18854
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19070
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19071
+ kind: "query",
19072
+ auth: "admin"
19073
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18855
19074
  kind: "query",
18856
19075
  auth: "admin"
18857
19076
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -20810,6 +21029,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20810
21029
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20811
21030
  kind: "mutation",
20812
21031
  auth: "admin"
21032
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21033
+ kind: "mutation",
21034
+ auth: "admin"
20813
21035
  });
20814
21036
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20815
21037
  providerId: string().min(1),
@@ -21208,12 +21430,38 @@ response: record(string(), unknown()) }), object({
21208
21430
  *
21209
21431
  * ## Why this is a capability and not a helper
21210
21432
  *
21211
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21212
- * plate, vehicle, identity, and the event store's derivativesand every one of
21213
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21214
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21215
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21216
- * load 5,000 rows before ranking anything.
21433
+ * This capability was introduced with the claim that SIX stores in
21434
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21435
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21436
+ * claim was never true, and leaving it here made five stores look like pending
21437
+ * work when three of them have no vector at all. Counted column by column on
21438
+ * 2026-08-30, exactly THREE ever held one:
21439
+ *
21440
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21441
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21442
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21443
+ * face, migrated 2026-08-30 into its OWN index (see below).
21444
+ *
21445
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21446
+ * and `identities` store a name; the event store stores no derivative vector.
21447
+ * They are not migration candidates and never were.
21448
+ *
21449
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21450
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21451
+ * rows before ranking anything.
21452
+ *
21453
+ * ## One index per COMPARISON, never per encoder
21454
+ *
21455
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21456
+ * model, and they still get two indexes. An index is a set of things that are
21457
+ * ranked against each other and that live and die together, and these two are
21458
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21459
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21460
+ * forever and is the gallery every recognition ranks against. One index would
21461
+ * mean every gallery load and every reconcile carried a filter whose failure
21462
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21463
+ * person's only sample. The dimension they share is not a reason to share an
21464
+ * index; the question they answer is, and it differs.
21217
21465
  *
21218
21466
  * The fix is not a faster loop, it is a different backend — and the backend
21219
21467
  * should be replaceable without touching six callers. So: a singleton
@@ -21318,7 +21566,20 @@ var VectorQueryResultSchema = object({
21318
21566
  */
21319
21567
  scanned: number(),
21320
21568
  /** True when the backend could not consider every row that passed the filter. */
21321
- truncated: boolean()
21569
+ truncated: boolean(),
21570
+ /**
21571
+ * The `topK` the backend actually ran with.
21572
+ *
21573
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21574
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21575
+ * own log rather than in its answer. That is how an audit asking for 20,000
21576
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21577
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21578
+ * MUCH, in the return value, where the caller cannot fail to see it.
21579
+ *
21580
+ * Equals the requested `topK` whenever nothing was lowered.
21581
+ */
21582
+ effectiveTopK: number().int().positive()
21322
21583
  });
21323
21584
  var VectorDeleteInputSchema = object({
21324
21585
  index: string(),
@@ -21347,6 +21608,68 @@ var VectorGetResultSchema = object({ items: array(object({
21347
21608
  id: string(),
21348
21609
  metadata: VectorMetadataSchema
21349
21610
  })) });
21611
+ /**
21612
+ * Ids to read back WITH their vectors.
21613
+ *
21614
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21615
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21616
+ * caller depends on that promise. This one promises the opposite.
21617
+ *
21618
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21619
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21620
+ * a per-face cross-process KNN would be a network round trip inside the
21621
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21622
+ * it requires the index to hand the floats back. Without this method the only
21623
+ * way to keep a readable vector is a JSON column, which is the thing this
21624
+ * capability exists to delete.
21625
+ *
21626
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21627
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21628
+ */
21629
+ var VectorFetchInputSchema = object({
21630
+ index: string(),
21631
+ ids: array(string())
21632
+ });
21633
+ var VectorFetchResultSchema = object({ items: array(object({
21634
+ id: string(),
21635
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21636
+ vector: string(),
21637
+ metadata: VectorMetadataSchema
21638
+ })) });
21639
+ /**
21640
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21641
+ *
21642
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21643
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21644
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21645
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21646
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21647
+ * looked" for as long as anyone cared to read it.
21648
+ *
21649
+ * This is the primitive that question actually needs: a bounded page, ordered
21650
+ * by the backend's own row order, costing no distance computation at all.
21651
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21652
+ * the full-table read this capability was built to stop.
21653
+ */
21654
+ var VectorScanInputSchema = object({
21655
+ index: string(),
21656
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21657
+ cursor: number().int().nonnegative().default(0),
21658
+ limit: number().int().positive()
21659
+ });
21660
+ var VectorScanResultSchema = object({
21661
+ items: array(object({
21662
+ id: string(),
21663
+ metadata: VectorMetadataSchema
21664
+ })),
21665
+ /**
21666
+ * Where the next page starts, or `null` when the walk reached the end.
21667
+ *
21668
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21669
+ * from a short page: a backend is free to return fewer rows than asked.
21670
+ */
21671
+ nextCursor: number().int().nonnegative().nullable()
21672
+ });
21350
21673
  var VectorStatsInputSchema = object({ index: string() });
21351
21674
  var VectorStatsResultSchema = object({
21352
21675
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21365,7 +21688,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21365
21688
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21366
21689
  kind: "mutation",
21367
21690
  auth: "admin"
21368
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21691
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21369
21692
  kind: "mutation",
21370
21693
  auth: "admin"
21371
21694
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26269,6 +26592,9 @@ method(object({
26269
26592
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26270
26593
  kind: "query",
26271
26594
  auth: "admin"
26595
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26596
+ kind: "query",
26597
+ auth: "admin"
26272
26598
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26273
26599
  kind: "mutation",
26274
26600
  auth: "admin"
@@ -31234,6 +31560,12 @@ Object.freeze({
31234
31560
  addonId: null,
31235
31561
  access: "create"
31236
31562
  },
31563
+ "pipelineAnalytics.countRelocatableMedia": {
31564
+ capName: "pipeline-analytics",
31565
+ capScope: "device",
31566
+ addonId: null,
31567
+ access: "view"
31568
+ },
31237
31569
  "pipelineAnalytics.countUnstampedEventMedia": {
31238
31570
  capName: "pipeline-analytics",
31239
31571
  capScope: "device",
@@ -32398,6 +32730,12 @@ Object.freeze({
32398
32730
  addonId: null,
32399
32731
  access: "view"
32400
32732
  },
32733
+ "recording.getRelocateResidue": {
32734
+ capName: "recording",
32735
+ capScope: "system",
32736
+ addonId: null,
32737
+ access: "view"
32738
+ },
32401
32739
  "recording.getStorageMigrationMoveStatus": {
32402
32740
  capName: "recording",
32403
32741
  capScope: "system",
@@ -32944,12 +33282,30 @@ Object.freeze({
32944
33282
  addonId: null,
32945
33283
  access: "create"
32946
33284
  },
33285
+ "storageMigration.drain": {
33286
+ capName: "storage-migration",
33287
+ capScope: "system",
33288
+ addonId: null,
33289
+ access: "create"
33290
+ },
33291
+ "storageMigration.movers": {
33292
+ capName: "storage-migration",
33293
+ capScope: "system",
33294
+ addonId: null,
33295
+ access: "view"
33296
+ },
32947
33297
  "storageMigration.plan": {
32948
33298
  capName: "storage-migration",
32949
33299
  capScope: "system",
32950
33300
  addonId: null,
32951
33301
  access: "view"
32952
33302
  },
33303
+ "storageMigration.residue": {
33304
+ capName: "storage-migration",
33305
+ capScope: "system",
33306
+ addonId: null,
33307
+ access: "view"
33308
+ },
32953
33309
  "storageMigration.start": {
32954
33310
  capName: "storage-migration",
32955
33311
  capScope: "system",
@@ -33784,6 +34140,12 @@ Object.freeze({
33784
34140
  addonId: null,
33785
34141
  access: "delete"
33786
34142
  },
34143
+ "vectorStore.fetchByIds": {
34144
+ capName: "vector-store",
34145
+ capScope: "system",
34146
+ addonId: null,
34147
+ access: "view"
34148
+ },
33787
34149
  "vectorStore.getByIds": {
33788
34150
  capName: "vector-store",
33789
34151
  capScope: "system",
@@ -33796,6 +34158,12 @@ Object.freeze({
33796
34158
  addonId: null,
33797
34159
  access: "view"
33798
34160
  },
34161
+ "vectorStore.scan": {
34162
+ capName: "vector-store",
34163
+ capScope: "system",
34164
+ addonId: null,
34165
+ access: "view"
34166
+ },
33799
34167
  "vectorStore.stats": {
33800
34168
  capName: "vector-store",
33801
34169
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-decoder-ffmpeg",
3
- "version": "1.2.43",
3
+ "version": "1.2.46",
4
4
  "description": "Standalone ffmpeg-subprocess decoder fallback addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",