@camstack/addon-provider-onvif 1.2.42 → 1.2.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +387 -19
  2. package/dist/addon.mjs +387 -19
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8002,6 +8002,21 @@ var RelocateJobSchema = object({
8002
8002
  bytesMoved: number().int(),
8003
8003
  /** Total files discovered up front; null while (or when) unknown. */
8004
8004
  filesTotal: number().int().nullable(),
8005
+ /**
8006
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8007
+ * made that nobody asked for, so it is reported where the operator reads the
8008
+ * job rather than only in a log line.
8009
+ *
8010
+ * A footage segment records its byte count in its own NAME, and the durable
8011
+ * hour row derives its aggregates from those names. A file that does not
8012
+ * match its name therefore makes the ledger's sums — and with them quota and
8013
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8014
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8015
+ *
8016
+ * Absent on lanes where the question has no meaning: a media blob's size is
8017
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8018
+ */
8019
+ rowsReconciled: number().int().nonnegative().optional(),
8005
8020
  startedAt: number(),
8006
8021
  finishedAt: number().nullable(),
8007
8022
  error: string().nullable()
@@ -8070,14 +8085,42 @@ var RelocateMediaInputSchema = object({
8070
8085
  /** Omitted = `move`, the pre-existing behaviour. */
8071
8086
  mode: MediaRelocateModeSchema.optional()
8072
8087
  });
8073
- /** How many rows still carry NO `locationId` — the population a repoint would
8074
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8075
- * value that permits a non-blocking `eventMedia` cutover. */
8076
- var UnstampedEventMediaCountSchema = object({
8077
- media: number().int().nonnegative(),
8078
- retrainFrames: number().int().nonnegative(),
8079
- total: number().int().nonnegative()
8088
+ /**
8089
+ * The unstamped population of ONE collection split, because the gate and the
8090
+ * operator ask two different questions and only one of them has to be cheap.
8091
+ *
8092
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8093
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8094
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8095
+ * that matters — after a seal, when the population is empty.
8096
+ *
8097
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8098
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8099
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8100
+ * and useful answer: "there are some, and this read could not say how many"
8101
+ * still refuses the cutover, which is the whole job.
8102
+ */
8103
+ var UnstampedRowsSchema = object({
8104
+ present: boolean(),
8105
+ rows: number().int().nonnegative().nullable()
8080
8106
  });
8107
+ /**
8108
+ * How many rows still carry NO `locationId` — the population a repoint would
8109
+ * silently re-aim at a disk that does not hold their bytes.
8110
+ *
8111
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8112
+ * over. The gate opens on a measured absence and on nothing else; an unread
8113
+ * collection and an empty one are different facts, and this repo has already
8114
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8115
+ */
8116
+ var UnstampedEventMediaCountSchema = object({
8117
+ media: UnstampedRowsSchema,
8118
+ retrainFrames: UnstampedRowsSchema,
8119
+ /** True when EITHER collection holds one. The refusal reads this. */
8120
+ anyPresent: boolean(),
8121
+ /** Sum across both, or `null` when either lane could not be counted. */
8122
+ total: number().int().nonnegative().nullable()
8123
+ }).nullable();
8081
8124
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8082
8125
  /** The independently selectable logical storage classes — every class
8083
8126
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8163,13 +8206,53 @@ var StorageMigrationParticipantSchema = _enum([
8163
8206
  "recorder",
8164
8207
  "analytics"
8165
8208
  ]);
8209
+ /**
8210
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8211
+ *
8212
+ * The long half of a non-blocking migration is `draining`, and it is measured
8213
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8214
+ * existed the only place those numbers appeared was a Loki line, so an operator
8215
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8216
+ * afternoon.
8217
+ *
8218
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8219
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8220
+ * mover — which is the exact failure this is meant to end. The coordinator's
8221
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8222
+ * read `state`; folding the counters costs no extra read and makes the durable
8223
+ * record say afterwards how far a move actually got.
8224
+ *
8225
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8226
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8227
+ * cannot say M, and a 0 there would render as "100 % done".
8228
+ */
8229
+ var StorageMigrationMoveProgressSchema = object({
8230
+ filesMoved: number().int().nonnegative(),
8231
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8232
+ filesTotal: number().int().nonnegative().nullable(),
8233
+ bytesMoved: number().int().nonnegative(),
8234
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8235
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8236
+ * rows would be the same failure as one that silently skipped them. */
8237
+ rowsReconciled: number().int().nonnegative().optional(),
8238
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8239
+ * crash gets a new mover, and a rate computed from the migration's start
8240
+ * would silently average in the time nothing was running. */
8241
+ startedAt: number(),
8242
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8243
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8244
+ * subtract its own. */
8245
+ observedAt: number()
8246
+ });
8166
8247
  var StorageMigrationMoveSchema = object({
8167
8248
  storageClass: StorageMigrationClassSchema,
8168
8249
  fromLocationId: string(),
8169
8250
  toLocationId: string(),
8170
8251
  moverJobId: string().nullable(),
8171
8252
  state: RelocateJobStateSchema.nullable(),
8172
- error: string().nullable()
8253
+ error: string().nullable(),
8254
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8255
+ progress: StorageMigrationMoveProgressSchema.nullable()
8173
8256
  });
8174
8257
  var StorageMigrationJobSchema = object({
8175
8258
  jobId: string(),
@@ -8215,6 +8298,98 @@ var StorageMigrationPlanSchema = object({
8215
8298
  findings: array(StorageMigrationFindingSchema)
8216
8299
  });
8217
8300
  /**
8301
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8302
+ *
8303
+ * The coordinator's job record is the state of record for a migration, and its
8304
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8305
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8306
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8307
+ * way because no supported UI path existed. A mover armed like that has no job
8308
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8309
+ *
8310
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8311
+ * orchestrated it.
8312
+ */
8313
+ var StorageMigrationMoverSchema = object({
8314
+ lane: _enum(["footage", "media"]),
8315
+ job: RelocateJobSchema,
8316
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8317
+ * directly against the owning addon. */
8318
+ migrationJobId: string().nullable(),
8319
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8320
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8321
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8322
+ * rate made of two different clocks. */
8323
+ observedAt: number()
8324
+ });
8325
+ /**
8326
+ * What a SOURCE still holds for one storage class — the number that makes a
8327
+ * "drain remaining" action honest rather than hopeful.
8328
+ *
8329
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8330
+ * engine's own selection count for media), never from the resident index: a
8331
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8332
+ * never been told about (D295).
8333
+ *
8334
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8335
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8336
+ * because refusing on an unanswerable read would hide exactly the case an
8337
+ * operator needs to act on.
8338
+ */
8339
+ var StorageMigrationResidueSchema = object({
8340
+ storageClass: StorageMigrationClassSchema,
8341
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8342
+ * move from wherever they are rather than from one named source. */
8343
+ fromLocationId: string(),
8344
+ /** Where a drain would move it — the class's CURRENT default. */
8345
+ toLocationId: string(),
8346
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8347
+ items: number().int().nonnegative().nullable(),
8348
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8349
+ bytes: number().int().nonnegative().nullable()
8350
+ });
8351
+ /**
8352
+ * Run the DRAIN half and nothing else.
8353
+ *
8354
+ * A migration that reached `done` has already repointed, so `start` correctly
8355
+ * refuses its destination ("already the default") — there is nothing left to
8356
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8357
+ * or finish against a work list that was a tenth of the archive (D295), and
8358
+ * before this there was no supported way to run only that half: the only way
8359
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8360
+ *
8361
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8362
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8363
+ * re-repoint a class that is already migrated.
8364
+ */
8365
+ var StorageMigrationDrainInputSchema = object({
8366
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8367
+ * a class whose source is already empty is refused rather than started. */
8368
+ classes: array(StorageMigrationClassSchema).min(1),
8369
+ throttleMbps: number().min(1).max(1e3).optional()
8370
+ });
8371
+ /** What a footage source still holds, asked of the durable hour ledger. */
8372
+ var RelocateResidueInputSchema = object({
8373
+ fromLocationId: string().min(1),
8374
+ /** Narrow to one logical class; omit for every profile on the location. */
8375
+ footageClass: RelocateFootageClassSchema.optional()
8376
+ });
8377
+ /** `null` = the archive could not answer (no ledger on this node, or the
8378
+ * aggregate failed). Never conflated with an empty source. */
8379
+ var RelocateResidueSchema = object({
8380
+ segments: number().int().nonnegative(),
8381
+ bytes: number().int().nonnegative()
8382
+ }).nullable();
8383
+ /** How many rows a media pass would still act on against a given target — the
8384
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8385
+ * never disagree. `null` = the count could not be taken. */
8386
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8387
+ var RelocatableMediaCountInputSchema = object({
8388
+ toLocationId: string().min(1),
8389
+ /** Omitted = `move`. */
8390
+ mode: MediaRelocateModeSchema.optional()
8391
+ });
8392
+ /**
8218
8393
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8219
8394
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8220
8395
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8318,6 +8493,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8318
8493
  * two addons declaring the same `id` must agree on `cardinality` (validated
8319
8494
  * at kernel aggregation time, not here).
8320
8495
  */
8496
+ /**
8497
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8498
+ * actually reaches the bytes. It is the constraint that decides which
8499
+ * `storage-provider`s may back a location of that kind.
8500
+ *
8501
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8502
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8503
+ * post-analysis media roots). Only a provider that serves a genuine local
8504
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8505
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8506
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8507
+ * against a same-named local directory that is something else entirely.
8508
+ *
8509
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8510
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8511
+ * service never sees a path, so any provider can back it. `backups` is the
8512
+ * one kind that qualifies today.
8513
+ *
8514
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8515
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8516
+ * refused the configuration; the first write simply went somewhere wrong, and
8517
+ * a recording write that goes wrong surfaces as a silent black window rather
8518
+ * than an error (the read path does not `stat`). This turns that accident into
8519
+ * a declared, enforced, testable refusal.
8520
+ */
8521
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8321
8522
  var StorageLocationDeclarationSchema = object({
8322
8523
  /**
8323
8524
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8337,6 +8538,19 @@ var StorageLocationDeclarationSchema = object({
8337
8538
  */
8338
8539
  cardinality: _enum(["single", "multi"]),
8339
8540
  /**
8541
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8542
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8543
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8544
+ *
8545
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8546
+ * can only over-restrict (refuse a remote provider for a kind that might
8547
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8548
+ * permissive direction and is therefore never inferred — a repo guard
8549
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8550
+ * reached by omission.
8551
+ */
8552
+ access: StorageAccessSchema.optional(),
8553
+ /**
8340
8554
  * When set, the default instance for this location inherits its resolved
8341
8555
  * root from the named location's default instance. Useful for derivative
8342
8556
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17917,8 +18131,10 @@ var TrackSchema = object({
17917
18131
  lastSeen: number(),
17918
18132
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17919
18133
  positions: array(TrackPositionSchema).readonly(),
17920
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17921
- * saveThumbnails policy). */
18134
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18135
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18136
+ * the retired `saveThumbnails` used to gate this and the rolling
18137
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17922
18138
  snapshots: array(TrackSnapshotSchema).readonly(),
17923
18139
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17924
18140
  zonesVisited: array(string()).readonly(),
@@ -18778,7 +18994,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18778
18994
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18779
18995
  kind: "mutation",
18780
18996
  auth: "admin"
18781
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
18997
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
18998
+ kind: "query",
18999
+ auth: "admin"
19000
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18782
19001
  kind: "query",
18783
19002
  auth: "admin"
18784
19003
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -20841,6 +21060,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20841
21060
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20842
21061
  kind: "mutation",
20843
21062
  auth: "admin"
21063
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21064
+ kind: "mutation",
21065
+ auth: "admin"
20844
21066
  });
20845
21067
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20846
21068
  providerId: string().min(1),
@@ -21239,12 +21461,38 @@ response: record(string(), unknown()) }), object({
21239
21461
  *
21240
21462
  * ## Why this is a capability and not a helper
21241
21463
  *
21242
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21243
- * plate, vehicle, identity, and the event store's derivativesand every one of
21244
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21245
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21246
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21247
- * load 5,000 rows before ranking anything.
21464
+ * This capability was introduced with the claim that SIX stores in
21465
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21466
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21467
+ * claim was never true, and leaving it here made five stores look like pending
21468
+ * work when three of them have no vector at all. Counted column by column on
21469
+ * 2026-08-30, exactly THREE ever held one:
21470
+ *
21471
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21472
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21473
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21474
+ * face, migrated 2026-08-30 into its OWN index (see below).
21475
+ *
21476
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21477
+ * and `identities` store a name; the event store stores no derivative vector.
21478
+ * They are not migration candidates and never were.
21479
+ *
21480
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21481
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21482
+ * rows before ranking anything.
21483
+ *
21484
+ * ## One index per COMPARISON, never per encoder
21485
+ *
21486
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21487
+ * model, and they still get two indexes. An index is a set of things that are
21488
+ * ranked against each other and that live and die together, and these two are
21489
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21490
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21491
+ * forever and is the gallery every recognition ranks against. One index would
21492
+ * mean every gallery load and every reconcile carried a filter whose failure
21493
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21494
+ * person's only sample. The dimension they share is not a reason to share an
21495
+ * index; the question they answer is, and it differs.
21248
21496
  *
21249
21497
  * The fix is not a faster loop, it is a different backend — and the backend
21250
21498
  * should be replaceable without touching six callers. So: a singleton
@@ -21349,7 +21597,20 @@ var VectorQueryResultSchema = object({
21349
21597
  */
21350
21598
  scanned: number(),
21351
21599
  /** True when the backend could not consider every row that passed the filter. */
21352
- truncated: boolean()
21600
+ truncated: boolean(),
21601
+ /**
21602
+ * The `topK` the backend actually ran with.
21603
+ *
21604
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21605
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21606
+ * own log rather than in its answer. That is how an audit asking for 20,000
21607
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21608
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21609
+ * MUCH, in the return value, where the caller cannot fail to see it.
21610
+ *
21611
+ * Equals the requested `topK` whenever nothing was lowered.
21612
+ */
21613
+ effectiveTopK: number().int().positive()
21353
21614
  });
21354
21615
  var VectorDeleteInputSchema = object({
21355
21616
  index: string(),
@@ -21378,6 +21639,68 @@ var VectorGetResultSchema = object({ items: array(object({
21378
21639
  id: string(),
21379
21640
  metadata: VectorMetadataSchema
21380
21641
  })) });
21642
+ /**
21643
+ * Ids to read back WITH their vectors.
21644
+ *
21645
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21646
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21647
+ * caller depends on that promise. This one promises the opposite.
21648
+ *
21649
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21650
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21651
+ * a per-face cross-process KNN would be a network round trip inside the
21652
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21653
+ * it requires the index to hand the floats back. Without this method the only
21654
+ * way to keep a readable vector is a JSON column, which is the thing this
21655
+ * capability exists to delete.
21656
+ *
21657
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21658
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21659
+ */
21660
+ var VectorFetchInputSchema = object({
21661
+ index: string(),
21662
+ ids: array(string())
21663
+ });
21664
+ var VectorFetchResultSchema = object({ items: array(object({
21665
+ id: string(),
21666
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21667
+ vector: string(),
21668
+ metadata: VectorMetadataSchema
21669
+ })) });
21670
+ /**
21671
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21672
+ *
21673
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21674
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21675
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21676
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21677
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21678
+ * looked" for as long as anyone cared to read it.
21679
+ *
21680
+ * This is the primitive that question actually needs: a bounded page, ordered
21681
+ * by the backend's own row order, costing no distance computation at all.
21682
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21683
+ * the full-table read this capability was built to stop.
21684
+ */
21685
+ var VectorScanInputSchema = object({
21686
+ index: string(),
21687
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21688
+ cursor: number().int().nonnegative().default(0),
21689
+ limit: number().int().positive()
21690
+ });
21691
+ var VectorScanResultSchema = object({
21692
+ items: array(object({
21693
+ id: string(),
21694
+ metadata: VectorMetadataSchema
21695
+ })),
21696
+ /**
21697
+ * Where the next page starts, or `null` when the walk reached the end.
21698
+ *
21699
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21700
+ * from a short page: a backend is free to return fewer rows than asked.
21701
+ */
21702
+ nextCursor: number().int().nonnegative().nullable()
21703
+ });
21381
21704
  var VectorStatsInputSchema = object({ index: string() });
21382
21705
  var VectorStatsResultSchema = object({
21383
21706
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21396,7 +21719,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21396
21719
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21397
21720
  kind: "mutation",
21398
21721
  auth: "admin"
21399
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21722
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21400
21723
  kind: "mutation",
21401
21724
  auth: "admin"
21402
21725
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26342,6 +26665,9 @@ method(object({
26342
26665
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26343
26666
  kind: "query",
26344
26667
  auth: "admin"
26668
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26669
+ kind: "query",
26670
+ auth: "admin"
26345
26671
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26346
26672
  kind: "mutation",
26347
26673
  auth: "admin"
@@ -31717,6 +32043,12 @@ Object.freeze({
31717
32043
  addonId: null,
31718
32044
  access: "create"
31719
32045
  },
32046
+ "pipelineAnalytics.countRelocatableMedia": {
32047
+ capName: "pipeline-analytics",
32048
+ capScope: "device",
32049
+ addonId: null,
32050
+ access: "view"
32051
+ },
31720
32052
  "pipelineAnalytics.countUnstampedEventMedia": {
31721
32053
  capName: "pipeline-analytics",
31722
32054
  capScope: "device",
@@ -32881,6 +33213,12 @@ Object.freeze({
32881
33213
  addonId: null,
32882
33214
  access: "view"
32883
33215
  },
33216
+ "recording.getRelocateResidue": {
33217
+ capName: "recording",
33218
+ capScope: "system",
33219
+ addonId: null,
33220
+ access: "view"
33221
+ },
32884
33222
  "recording.getStorageMigrationMoveStatus": {
32885
33223
  capName: "recording",
32886
33224
  capScope: "system",
@@ -33427,12 +33765,30 @@ Object.freeze({
33427
33765
  addonId: null,
33428
33766
  access: "create"
33429
33767
  },
33768
+ "storageMigration.drain": {
33769
+ capName: "storage-migration",
33770
+ capScope: "system",
33771
+ addonId: null,
33772
+ access: "create"
33773
+ },
33774
+ "storageMigration.movers": {
33775
+ capName: "storage-migration",
33776
+ capScope: "system",
33777
+ addonId: null,
33778
+ access: "view"
33779
+ },
33430
33780
  "storageMigration.plan": {
33431
33781
  capName: "storage-migration",
33432
33782
  capScope: "system",
33433
33783
  addonId: null,
33434
33784
  access: "view"
33435
33785
  },
33786
+ "storageMigration.residue": {
33787
+ capName: "storage-migration",
33788
+ capScope: "system",
33789
+ addonId: null,
33790
+ access: "view"
33791
+ },
33436
33792
  "storageMigration.start": {
33437
33793
  capName: "storage-migration",
33438
33794
  capScope: "system",
@@ -34267,6 +34623,12 @@ Object.freeze({
34267
34623
  addonId: null,
34268
34624
  access: "delete"
34269
34625
  },
34626
+ "vectorStore.fetchByIds": {
34627
+ capName: "vector-store",
34628
+ capScope: "system",
34629
+ addonId: null,
34630
+ access: "view"
34631
+ },
34270
34632
  "vectorStore.getByIds": {
34271
34633
  capName: "vector-store",
34272
34634
  capScope: "system",
@@ -34279,6 +34641,12 @@ Object.freeze({
34279
34641
  addonId: null,
34280
34642
  access: "view"
34281
34643
  },
34644
+ "vectorStore.scan": {
34645
+ capName: "vector-store",
34646
+ capScope: "system",
34647
+ addonId: null,
34648
+ access: "view"
34649
+ },
34282
34650
  "vectorStore.stats": {
34283
34651
  capName: "vector-store",
34284
34652
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8003,6 +8003,21 @@ var RelocateJobSchema = object({
8003
8003
  bytesMoved: number().int(),
8004
8004
  /** Total files discovered up front; null while (or when) unknown. */
8005
8005
  filesTotal: number().int().nullable(),
8006
+ /**
8007
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8008
+ * made that nobody asked for, so it is reported where the operator reads the
8009
+ * job rather than only in a log line.
8010
+ *
8011
+ * A footage segment records its byte count in its own NAME, and the durable
8012
+ * hour row derives its aggregates from those names. A file that does not
8013
+ * match its name therefore makes the ledger's sums — and with them quota and
8014
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8015
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8016
+ *
8017
+ * Absent on lanes where the question has no meaning: a media blob's size is
8018
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8019
+ */
8020
+ rowsReconciled: number().int().nonnegative().optional(),
8006
8021
  startedAt: number(),
8007
8022
  finishedAt: number().nullable(),
8008
8023
  error: string().nullable()
@@ -8071,14 +8086,42 @@ var RelocateMediaInputSchema = object({
8071
8086
  /** Omitted = `move`, the pre-existing behaviour. */
8072
8087
  mode: MediaRelocateModeSchema.optional()
8073
8088
  });
8074
- /** How many rows still carry NO `locationId` — the population a repoint would
8075
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8076
- * value that permits a non-blocking `eventMedia` cutover. */
8077
- var UnstampedEventMediaCountSchema = object({
8078
- media: number().int().nonnegative(),
8079
- retrainFrames: number().int().nonnegative(),
8080
- total: number().int().nonnegative()
8089
+ /**
8090
+ * The unstamped population of ONE collection split, because the gate and the
8091
+ * operator ask two different questions and only one of them has to be cheap.
8092
+ *
8093
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8094
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8095
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8096
+ * that matters — after a seal, when the population is empty.
8097
+ *
8098
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8099
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8100
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8101
+ * and useful answer: "there are some, and this read could not say how many"
8102
+ * still refuses the cutover, which is the whole job.
8103
+ */
8104
+ var UnstampedRowsSchema = object({
8105
+ present: boolean(),
8106
+ rows: number().int().nonnegative().nullable()
8081
8107
  });
8108
+ /**
8109
+ * How many rows still carry NO `locationId` — the population a repoint would
8110
+ * silently re-aim at a disk that does not hold their bytes.
8111
+ *
8112
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8113
+ * over. The gate opens on a measured absence and on nothing else; an unread
8114
+ * collection and an empty one are different facts, and this repo has already
8115
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8116
+ */
8117
+ var UnstampedEventMediaCountSchema = object({
8118
+ media: UnstampedRowsSchema,
8119
+ retrainFrames: UnstampedRowsSchema,
8120
+ /** True when EITHER collection holds one. The refusal reads this. */
8121
+ anyPresent: boolean(),
8122
+ /** Sum across both, or `null` when either lane could not be counted. */
8123
+ total: number().int().nonnegative().nullable()
8124
+ }).nullable();
8082
8125
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8083
8126
  /** The independently selectable logical storage classes — every class
8084
8127
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8164,13 +8207,53 @@ var StorageMigrationParticipantSchema = _enum([
8164
8207
  "recorder",
8165
8208
  "analytics"
8166
8209
  ]);
8210
+ /**
8211
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8212
+ *
8213
+ * The long half of a non-blocking migration is `draining`, and it is measured
8214
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8215
+ * existed the only place those numbers appeared was a Loki line, so an operator
8216
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8217
+ * afternoon.
8218
+ *
8219
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8220
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8221
+ * mover — which is the exact failure this is meant to end. The coordinator's
8222
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8223
+ * read `state`; folding the counters costs no extra read and makes the durable
8224
+ * record say afterwards how far a move actually got.
8225
+ *
8226
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8227
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8228
+ * cannot say M, and a 0 there would render as "100 % done".
8229
+ */
8230
+ var StorageMigrationMoveProgressSchema = object({
8231
+ filesMoved: number().int().nonnegative(),
8232
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8233
+ filesTotal: number().int().nonnegative().nullable(),
8234
+ bytesMoved: number().int().nonnegative(),
8235
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8236
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8237
+ * rows would be the same failure as one that silently skipped them. */
8238
+ rowsReconciled: number().int().nonnegative().optional(),
8239
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8240
+ * crash gets a new mover, and a rate computed from the migration's start
8241
+ * would silently average in the time nothing was running. */
8242
+ startedAt: number(),
8243
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8244
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8245
+ * subtract its own. */
8246
+ observedAt: number()
8247
+ });
8167
8248
  var StorageMigrationMoveSchema = object({
8168
8249
  storageClass: StorageMigrationClassSchema,
8169
8250
  fromLocationId: string(),
8170
8251
  toLocationId: string(),
8171
8252
  moverJobId: string().nullable(),
8172
8253
  state: RelocateJobStateSchema.nullable(),
8173
- error: string().nullable()
8254
+ error: string().nullable(),
8255
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8256
+ progress: StorageMigrationMoveProgressSchema.nullable()
8174
8257
  });
8175
8258
  var StorageMigrationJobSchema = object({
8176
8259
  jobId: string(),
@@ -8216,6 +8299,98 @@ var StorageMigrationPlanSchema = object({
8216
8299
  findings: array(StorageMigrationFindingSchema)
8217
8300
  });
8218
8301
  /**
8302
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8303
+ *
8304
+ * The coordinator's job record is the state of record for a migration, and its
8305
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8306
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8307
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8308
+ * way because no supported UI path existed. A mover armed like that has no job
8309
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8310
+ *
8311
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8312
+ * orchestrated it.
8313
+ */
8314
+ var StorageMigrationMoverSchema = object({
8315
+ lane: _enum(["footage", "media"]),
8316
+ job: RelocateJobSchema,
8317
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8318
+ * directly against the owning addon. */
8319
+ migrationJobId: string().nullable(),
8320
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8321
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8322
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8323
+ * rate made of two different clocks. */
8324
+ observedAt: number()
8325
+ });
8326
+ /**
8327
+ * What a SOURCE still holds for one storage class — the number that makes a
8328
+ * "drain remaining" action honest rather than hopeful.
8329
+ *
8330
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8331
+ * engine's own selection count for media), never from the resident index: a
8332
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8333
+ * never been told about (D295).
8334
+ *
8335
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8336
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8337
+ * because refusing on an unanswerable read would hide exactly the case an
8338
+ * operator needs to act on.
8339
+ */
8340
+ var StorageMigrationResidueSchema = object({
8341
+ storageClass: StorageMigrationClassSchema,
8342
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8343
+ * move from wherever they are rather than from one named source. */
8344
+ fromLocationId: string(),
8345
+ /** Where a drain would move it — the class's CURRENT default. */
8346
+ toLocationId: string(),
8347
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8348
+ items: number().int().nonnegative().nullable(),
8349
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8350
+ bytes: number().int().nonnegative().nullable()
8351
+ });
8352
+ /**
8353
+ * Run the DRAIN half and nothing else.
8354
+ *
8355
+ * A migration that reached `done` has already repointed, so `start` correctly
8356
+ * refuses its destination ("already the default") — there is nothing left to
8357
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8358
+ * or finish against a work list that was a tenth of the archive (D295), and
8359
+ * before this there was no supported way to run only that half: the only way
8360
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8361
+ *
8362
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8363
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8364
+ * re-repoint a class that is already migrated.
8365
+ */
8366
+ var StorageMigrationDrainInputSchema = object({
8367
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8368
+ * a class whose source is already empty is refused rather than started. */
8369
+ classes: array(StorageMigrationClassSchema).min(1),
8370
+ throttleMbps: number().min(1).max(1e3).optional()
8371
+ });
8372
+ /** What a footage source still holds, asked of the durable hour ledger. */
8373
+ var RelocateResidueInputSchema = object({
8374
+ fromLocationId: string().min(1),
8375
+ /** Narrow to one logical class; omit for every profile on the location. */
8376
+ footageClass: RelocateFootageClassSchema.optional()
8377
+ });
8378
+ /** `null` = the archive could not answer (no ledger on this node, or the
8379
+ * aggregate failed). Never conflated with an empty source. */
8380
+ var RelocateResidueSchema = object({
8381
+ segments: number().int().nonnegative(),
8382
+ bytes: number().int().nonnegative()
8383
+ }).nullable();
8384
+ /** How many rows a media pass would still act on against a given target — the
8385
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8386
+ * never disagree. `null` = the count could not be taken. */
8387
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8388
+ var RelocatableMediaCountInputSchema = object({
8389
+ toLocationId: string().min(1),
8390
+ /** Omitted = `move`. */
8391
+ mode: MediaRelocateModeSchema.optional()
8392
+ });
8393
+ /**
8219
8394
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8220
8395
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8221
8396
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8319,6 +8494,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8319
8494
  * two addons declaring the same `id` must agree on `cardinality` (validated
8320
8495
  * at kernel aggregation time, not here).
8321
8496
  */
8497
+ /**
8498
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8499
+ * actually reaches the bytes. It is the constraint that decides which
8500
+ * `storage-provider`s may back a location of that kind.
8501
+ *
8502
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8503
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8504
+ * post-analysis media roots). Only a provider that serves a genuine local
8505
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8506
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8507
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8508
+ * against a same-named local directory that is something else entirely.
8509
+ *
8510
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8511
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8512
+ * service never sees a path, so any provider can back it. `backups` is the
8513
+ * one kind that qualifies today.
8514
+ *
8515
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8516
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8517
+ * refused the configuration; the first write simply went somewhere wrong, and
8518
+ * a recording write that goes wrong surfaces as a silent black window rather
8519
+ * than an error (the read path does not `stat`). This turns that accident into
8520
+ * a declared, enforced, testable refusal.
8521
+ */
8522
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8322
8523
  var StorageLocationDeclarationSchema = object({
8323
8524
  /**
8324
8525
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8338,6 +8539,19 @@ var StorageLocationDeclarationSchema = object({
8338
8539
  */
8339
8540
  cardinality: _enum(["single", "multi"]),
8340
8541
  /**
8542
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8543
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8544
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8545
+ *
8546
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8547
+ * can only over-restrict (refuse a remote provider for a kind that might
8548
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8549
+ * permissive direction and is therefore never inferred — a repo guard
8550
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8551
+ * reached by omission.
8552
+ */
8553
+ access: StorageAccessSchema.optional(),
8554
+ /**
8341
8555
  * When set, the default instance for this location inherits its resolved
8342
8556
  * root from the named location's default instance. Useful for derivative
8343
8557
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17918,8 +18132,10 @@ var TrackSchema = object({
17918
18132
  lastSeen: number(),
17919
18133
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17920
18134
  positions: array(TrackPositionSchema).readonly(),
17921
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17922
- * saveThumbnails policy). */
18135
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18136
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18137
+ * the retired `saveThumbnails` used to gate this and the rolling
18138
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17923
18139
  snapshots: array(TrackSnapshotSchema).readonly(),
17924
18140
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17925
18141
  zonesVisited: array(string()).readonly(),
@@ -18779,7 +18995,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18779
18995
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18780
18996
  kind: "mutation",
18781
18997
  auth: "admin"
18782
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
18998
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
18999
+ kind: "query",
19000
+ auth: "admin"
19001
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18783
19002
  kind: "query",
18784
19003
  auth: "admin"
18785
19004
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -20842,6 +21061,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20842
21061
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20843
21062
  kind: "mutation",
20844
21063
  auth: "admin"
21064
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21065
+ kind: "mutation",
21066
+ auth: "admin"
20845
21067
  });
20846
21068
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20847
21069
  providerId: string().min(1),
@@ -21240,12 +21462,38 @@ response: record(string(), unknown()) }), object({
21240
21462
  *
21241
21463
  * ## Why this is a capability and not a helper
21242
21464
  *
21243
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21244
- * plate, vehicle, identity, and the event store's derivativesand every one of
21245
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21246
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21247
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21248
- * load 5,000 rows before ranking anything.
21465
+ * This capability was introduced with the claim that SIX stores in
21466
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21467
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21468
+ * claim was never true, and leaving it here made five stores look like pending
21469
+ * work when three of them have no vector at all. Counted column by column on
21470
+ * 2026-08-30, exactly THREE ever held one:
21471
+ *
21472
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21473
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21474
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21475
+ * face, migrated 2026-08-30 into its OWN index (see below).
21476
+ *
21477
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21478
+ * and `identities` store a name; the event store stores no derivative vector.
21479
+ * They are not migration candidates and never were.
21480
+ *
21481
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21482
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21483
+ * rows before ranking anything.
21484
+ *
21485
+ * ## One index per COMPARISON, never per encoder
21486
+ *
21487
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21488
+ * model, and they still get two indexes. An index is a set of things that are
21489
+ * ranked against each other and that live and die together, and these two are
21490
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21491
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21492
+ * forever and is the gallery every recognition ranks against. One index would
21493
+ * mean every gallery load and every reconcile carried a filter whose failure
21494
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21495
+ * person's only sample. The dimension they share is not a reason to share an
21496
+ * index; the question they answer is, and it differs.
21249
21497
  *
21250
21498
  * The fix is not a faster loop, it is a different backend — and the backend
21251
21499
  * should be replaceable without touching six callers. So: a singleton
@@ -21350,7 +21598,20 @@ var VectorQueryResultSchema = object({
21350
21598
  */
21351
21599
  scanned: number(),
21352
21600
  /** True when the backend could not consider every row that passed the filter. */
21353
- truncated: boolean()
21601
+ truncated: boolean(),
21602
+ /**
21603
+ * The `topK` the backend actually ran with.
21604
+ *
21605
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21606
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21607
+ * own log rather than in its answer. That is how an audit asking for 20,000
21608
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21609
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21610
+ * MUCH, in the return value, where the caller cannot fail to see it.
21611
+ *
21612
+ * Equals the requested `topK` whenever nothing was lowered.
21613
+ */
21614
+ effectiveTopK: number().int().positive()
21354
21615
  });
21355
21616
  var VectorDeleteInputSchema = object({
21356
21617
  index: string(),
@@ -21379,6 +21640,68 @@ var VectorGetResultSchema = object({ items: array(object({
21379
21640
  id: string(),
21380
21641
  metadata: VectorMetadataSchema
21381
21642
  })) });
21643
+ /**
21644
+ * Ids to read back WITH their vectors.
21645
+ *
21646
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21647
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21648
+ * caller depends on that promise. This one promises the opposite.
21649
+ *
21650
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21651
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21652
+ * a per-face cross-process KNN would be a network round trip inside the
21653
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21654
+ * it requires the index to hand the floats back. Without this method the only
21655
+ * way to keep a readable vector is a JSON column, which is the thing this
21656
+ * capability exists to delete.
21657
+ *
21658
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21659
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21660
+ */
21661
+ var VectorFetchInputSchema = object({
21662
+ index: string(),
21663
+ ids: array(string())
21664
+ });
21665
+ var VectorFetchResultSchema = object({ items: array(object({
21666
+ id: string(),
21667
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21668
+ vector: string(),
21669
+ metadata: VectorMetadataSchema
21670
+ })) });
21671
+ /**
21672
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21673
+ *
21674
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21675
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21676
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21677
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21678
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21679
+ * looked" for as long as anyone cared to read it.
21680
+ *
21681
+ * This is the primitive that question actually needs: a bounded page, ordered
21682
+ * by the backend's own row order, costing no distance computation at all.
21683
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21684
+ * the full-table read this capability was built to stop.
21685
+ */
21686
+ var VectorScanInputSchema = object({
21687
+ index: string(),
21688
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21689
+ cursor: number().int().nonnegative().default(0),
21690
+ limit: number().int().positive()
21691
+ });
21692
+ var VectorScanResultSchema = object({
21693
+ items: array(object({
21694
+ id: string(),
21695
+ metadata: VectorMetadataSchema
21696
+ })),
21697
+ /**
21698
+ * Where the next page starts, or `null` when the walk reached the end.
21699
+ *
21700
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21701
+ * from a short page: a backend is free to return fewer rows than asked.
21702
+ */
21703
+ nextCursor: number().int().nonnegative().nullable()
21704
+ });
21382
21705
  var VectorStatsInputSchema = object({ index: string() });
21383
21706
  var VectorStatsResultSchema = object({
21384
21707
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21397,7 +21720,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21397
21720
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21398
21721
  kind: "mutation",
21399
21722
  auth: "admin"
21400
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21723
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21401
21724
  kind: "mutation",
21402
21725
  auth: "admin"
21403
21726
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26343,6 +26666,9 @@ method(object({
26343
26666
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26344
26667
  kind: "query",
26345
26668
  auth: "admin"
26669
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26670
+ kind: "query",
26671
+ auth: "admin"
26346
26672
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26347
26673
  kind: "mutation",
26348
26674
  auth: "admin"
@@ -31718,6 +32044,12 @@ Object.freeze({
31718
32044
  addonId: null,
31719
32045
  access: "create"
31720
32046
  },
32047
+ "pipelineAnalytics.countRelocatableMedia": {
32048
+ capName: "pipeline-analytics",
32049
+ capScope: "device",
32050
+ addonId: null,
32051
+ access: "view"
32052
+ },
31721
32053
  "pipelineAnalytics.countUnstampedEventMedia": {
31722
32054
  capName: "pipeline-analytics",
31723
32055
  capScope: "device",
@@ -32882,6 +33214,12 @@ Object.freeze({
32882
33214
  addonId: null,
32883
33215
  access: "view"
32884
33216
  },
33217
+ "recording.getRelocateResidue": {
33218
+ capName: "recording",
33219
+ capScope: "system",
33220
+ addonId: null,
33221
+ access: "view"
33222
+ },
32885
33223
  "recording.getStorageMigrationMoveStatus": {
32886
33224
  capName: "recording",
32887
33225
  capScope: "system",
@@ -33428,12 +33766,30 @@ Object.freeze({
33428
33766
  addonId: null,
33429
33767
  access: "create"
33430
33768
  },
33769
+ "storageMigration.drain": {
33770
+ capName: "storage-migration",
33771
+ capScope: "system",
33772
+ addonId: null,
33773
+ access: "create"
33774
+ },
33775
+ "storageMigration.movers": {
33776
+ capName: "storage-migration",
33777
+ capScope: "system",
33778
+ addonId: null,
33779
+ access: "view"
33780
+ },
33431
33781
  "storageMigration.plan": {
33432
33782
  capName: "storage-migration",
33433
33783
  capScope: "system",
33434
33784
  addonId: null,
33435
33785
  access: "view"
33436
33786
  },
33787
+ "storageMigration.residue": {
33788
+ capName: "storage-migration",
33789
+ capScope: "system",
33790
+ addonId: null,
33791
+ access: "view"
33792
+ },
33437
33793
  "storageMigration.start": {
33438
33794
  capName: "storage-migration",
33439
33795
  capScope: "system",
@@ -34268,6 +34624,12 @@ Object.freeze({
34268
34624
  addonId: null,
34269
34625
  access: "delete"
34270
34626
  },
34627
+ "vectorStore.fetchByIds": {
34628
+ capName: "vector-store",
34629
+ capScope: "system",
34630
+ addonId: null,
34631
+ access: "view"
34632
+ },
34271
34633
  "vectorStore.getByIds": {
34272
34634
  capName: "vector-store",
34273
34635
  capScope: "system",
@@ -34280,6 +34642,12 @@ Object.freeze({
34280
34642
  addonId: null,
34281
34643
  access: "view"
34282
34644
  },
34645
+ "vectorStore.scan": {
34646
+ capName: "vector-store",
34647
+ capScope: "system",
34648
+ addonId: null,
34649
+ access: "view"
34650
+ },
34283
34651
  "vectorStore.stats": {
34284
34652
  capName: "vector-store",
34285
34653
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-onvif",
3
- "version": "1.2.42",
3
+ "version": "1.2.45",
4
4
  "description": "ONVIF camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",