@camstack/addon-provider-hikvision 1.2.51 → 1.2.54

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
@@ -7998,6 +7998,21 @@ var RelocateJobSchema = object({
7998
7998
  bytesMoved: number().int(),
7999
7999
  /** Total files discovered up front; null while (or when) unknown. */
8000
8000
  filesTotal: number().int().nullable(),
8001
+ /**
8002
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8003
+ * made that nobody asked for, so it is reported where the operator reads the
8004
+ * job rather than only in a log line.
8005
+ *
8006
+ * A footage segment records its byte count in its own NAME, and the durable
8007
+ * hour row derives its aggregates from those names. A file that does not
8008
+ * match its name therefore makes the ledger's sums — and with them quota and
8009
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8010
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8011
+ *
8012
+ * Absent on lanes where the question has no meaning: a media blob's size is
8013
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8014
+ */
8015
+ rowsReconciled: number().int().nonnegative().optional(),
8001
8016
  startedAt: number(),
8002
8017
  finishedAt: number().nullable(),
8003
8018
  error: string().nullable()
@@ -8066,14 +8081,42 @@ var RelocateMediaInputSchema = object({
8066
8081
  /** Omitted = `move`, the pre-existing behaviour. */
8067
8082
  mode: MediaRelocateModeSchema.optional()
8068
8083
  });
8069
- /** How many rows still carry NO `locationId` — the population a repoint would
8070
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8071
- * value that permits a non-blocking `eventMedia` cutover. */
8072
- var UnstampedEventMediaCountSchema = object({
8073
- media: number().int().nonnegative(),
8074
- retrainFrames: number().int().nonnegative(),
8075
- total: number().int().nonnegative()
8084
+ /**
8085
+ * The unstamped population of ONE collection split, because the gate and the
8086
+ * operator ask two different questions and only one of them has to be cheap.
8087
+ *
8088
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8089
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8090
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8091
+ * that matters — after a seal, when the population is empty.
8092
+ *
8093
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8094
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8095
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8096
+ * and useful answer: "there are some, and this read could not say how many"
8097
+ * still refuses the cutover, which is the whole job.
8098
+ */
8099
+ var UnstampedRowsSchema = object({
8100
+ present: boolean(),
8101
+ rows: number().int().nonnegative().nullable()
8076
8102
  });
8103
+ /**
8104
+ * How many rows still carry NO `locationId` — the population a repoint would
8105
+ * silently re-aim at a disk that does not hold their bytes.
8106
+ *
8107
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8108
+ * over. The gate opens on a measured absence and on nothing else; an unread
8109
+ * collection and an empty one are different facts, and this repo has already
8110
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8111
+ */
8112
+ var UnstampedEventMediaCountSchema = object({
8113
+ media: UnstampedRowsSchema,
8114
+ retrainFrames: UnstampedRowsSchema,
8115
+ /** True when EITHER collection holds one. The refusal reads this. */
8116
+ anyPresent: boolean(),
8117
+ /** Sum across both, or `null` when either lane could not be counted. */
8118
+ total: number().int().nonnegative().nullable()
8119
+ }).nullable();
8077
8120
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8078
8121
  /** The independently selectable logical storage classes — every class
8079
8122
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8159,13 +8202,53 @@ var StorageMigrationParticipantSchema = _enum([
8159
8202
  "recorder",
8160
8203
  "analytics"
8161
8204
  ]);
8205
+ /**
8206
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8207
+ *
8208
+ * The long half of a non-blocking migration is `draining`, and it is measured
8209
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8210
+ * existed the only place those numbers appeared was a Loki line, so an operator
8211
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8212
+ * afternoon.
8213
+ *
8214
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8215
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8216
+ * mover — which is the exact failure this is meant to end. The coordinator's
8217
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8218
+ * read `state`; folding the counters costs no extra read and makes the durable
8219
+ * record say afterwards how far a move actually got.
8220
+ *
8221
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8222
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8223
+ * cannot say M, and a 0 there would render as "100 % done".
8224
+ */
8225
+ var StorageMigrationMoveProgressSchema = object({
8226
+ filesMoved: number().int().nonnegative(),
8227
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8228
+ filesTotal: number().int().nonnegative().nullable(),
8229
+ bytesMoved: number().int().nonnegative(),
8230
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8231
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8232
+ * rows would be the same failure as one that silently skipped them. */
8233
+ rowsReconciled: number().int().nonnegative().optional(),
8234
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8235
+ * crash gets a new mover, and a rate computed from the migration's start
8236
+ * would silently average in the time nothing was running. */
8237
+ startedAt: number(),
8238
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8239
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8240
+ * subtract its own. */
8241
+ observedAt: number()
8242
+ });
8162
8243
  var StorageMigrationMoveSchema = object({
8163
8244
  storageClass: StorageMigrationClassSchema,
8164
8245
  fromLocationId: string(),
8165
8246
  toLocationId: string(),
8166
8247
  moverJobId: string().nullable(),
8167
8248
  state: RelocateJobStateSchema.nullable(),
8168
- error: string().nullable()
8249
+ error: string().nullable(),
8250
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8251
+ progress: StorageMigrationMoveProgressSchema.nullable()
8169
8252
  });
8170
8253
  var StorageMigrationJobSchema = object({
8171
8254
  jobId: string(),
@@ -8211,6 +8294,98 @@ var StorageMigrationPlanSchema = object({
8211
8294
  findings: array(StorageMigrationFindingSchema)
8212
8295
  });
8213
8296
  /**
8297
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8298
+ *
8299
+ * The coordinator's job record is the state of record for a migration, and its
8300
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8301
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8302
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8303
+ * way because no supported UI path existed. A mover armed like that has no job
8304
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8305
+ *
8306
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8307
+ * orchestrated it.
8308
+ */
8309
+ var StorageMigrationMoverSchema = object({
8310
+ lane: _enum(["footage", "media"]),
8311
+ job: RelocateJobSchema,
8312
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8313
+ * directly against the owning addon. */
8314
+ migrationJobId: string().nullable(),
8315
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8316
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8317
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8318
+ * rate made of two different clocks. */
8319
+ observedAt: number()
8320
+ });
8321
+ /**
8322
+ * What a SOURCE still holds for one storage class — the number that makes a
8323
+ * "drain remaining" action honest rather than hopeful.
8324
+ *
8325
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8326
+ * engine's own selection count for media), never from the resident index: a
8327
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8328
+ * never been told about (D295).
8329
+ *
8330
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8331
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8332
+ * because refusing on an unanswerable read would hide exactly the case an
8333
+ * operator needs to act on.
8334
+ */
8335
+ var StorageMigrationResidueSchema = object({
8336
+ storageClass: StorageMigrationClassSchema,
8337
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8338
+ * move from wherever they are rather than from one named source. */
8339
+ fromLocationId: string(),
8340
+ /** Where a drain would move it — the class's CURRENT default. */
8341
+ toLocationId: string(),
8342
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8343
+ items: number().int().nonnegative().nullable(),
8344
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8345
+ bytes: number().int().nonnegative().nullable()
8346
+ });
8347
+ /**
8348
+ * Run the DRAIN half and nothing else.
8349
+ *
8350
+ * A migration that reached `done` has already repointed, so `start` correctly
8351
+ * refuses its destination ("already the default") — there is nothing left to
8352
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8353
+ * or finish against a work list that was a tenth of the archive (D295), and
8354
+ * before this there was no supported way to run only that half: the only way
8355
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8356
+ *
8357
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8358
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8359
+ * re-repoint a class that is already migrated.
8360
+ */
8361
+ var StorageMigrationDrainInputSchema = object({
8362
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8363
+ * a class whose source is already empty is refused rather than started. */
8364
+ classes: array(StorageMigrationClassSchema).min(1),
8365
+ throttleMbps: number().min(1).max(1e3).optional()
8366
+ });
8367
+ /** What a footage source still holds, asked of the durable hour ledger. */
8368
+ var RelocateResidueInputSchema = object({
8369
+ fromLocationId: string().min(1),
8370
+ /** Narrow to one logical class; omit for every profile on the location. */
8371
+ footageClass: RelocateFootageClassSchema.optional()
8372
+ });
8373
+ /** `null` = the archive could not answer (no ledger on this node, or the
8374
+ * aggregate failed). Never conflated with an empty source. */
8375
+ var RelocateResidueSchema = object({
8376
+ segments: number().int().nonnegative(),
8377
+ bytes: number().int().nonnegative()
8378
+ }).nullable();
8379
+ /** How many rows a media pass would still act on against a given target — the
8380
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8381
+ * never disagree. `null` = the count could not be taken. */
8382
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8383
+ var RelocatableMediaCountInputSchema = object({
8384
+ toLocationId: string().min(1),
8385
+ /** Omitted = `move`. */
8386
+ mode: MediaRelocateModeSchema.optional()
8387
+ });
8388
+ /**
8214
8389
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8215
8390
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8216
8391
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8314,6 +8489,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8314
8489
  * two addons declaring the same `id` must agree on `cardinality` (validated
8315
8490
  * at kernel aggregation time, not here).
8316
8491
  */
8492
+ /**
8493
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8494
+ * actually reaches the bytes. It is the constraint that decides which
8495
+ * `storage-provider`s may back a location of that kind.
8496
+ *
8497
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8498
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8499
+ * post-analysis media roots). Only a provider that serves a genuine local
8500
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8501
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8502
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8503
+ * against a same-named local directory that is something else entirely.
8504
+ *
8505
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8506
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8507
+ * service never sees a path, so any provider can back it. `backups` is the
8508
+ * one kind that qualifies today.
8509
+ *
8510
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8511
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8512
+ * refused the configuration; the first write simply went somewhere wrong, and
8513
+ * a recording write that goes wrong surfaces as a silent black window rather
8514
+ * than an error (the read path does not `stat`). This turns that accident into
8515
+ * a declared, enforced, testable refusal.
8516
+ */
8517
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8317
8518
  var StorageLocationDeclarationSchema = object({
8318
8519
  /**
8319
8520
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8333,6 +8534,19 @@ var StorageLocationDeclarationSchema = object({
8333
8534
  */
8334
8535
  cardinality: _enum(["single", "multi"]),
8335
8536
  /**
8537
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8538
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8539
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8540
+ *
8541
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8542
+ * can only over-restrict (refuse a remote provider for a kind that might
8543
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8544
+ * permissive direction and is therefore never inferred — a repo guard
8545
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8546
+ * reached by omission.
8547
+ */
8548
+ access: StorageAccessSchema.optional(),
8549
+ /**
8336
8550
  * When set, the default instance for this location inherits its resolved
8337
8551
  * root from the named location's default instance. Useful for derivative
8338
8552
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18512,8 +18726,10 @@ var TrackSchema = object({
18512
18726
  lastSeen: number(),
18513
18727
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18514
18728
  positions: array(TrackPositionSchema).readonly(),
18515
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18516
- * saveThumbnails policy). */
18729
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18730
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18731
+ * the retired `saveThumbnails` used to gate this and the rolling
18732
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18517
18733
  snapshots: array(TrackSnapshotSchema).readonly(),
18518
18734
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18519
18735
  zonesVisited: array(string()).readonly(),
@@ -19373,7 +19589,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19373
19589
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19374
19590
  kind: "mutation",
19375
19591
  auth: "admin"
19376
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19592
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19593
+ kind: "query",
19594
+ auth: "admin"
19595
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19377
19596
  kind: "query",
19378
19597
  auth: "admin"
19379
19598
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21436,6 +21655,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21436
21655
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21437
21656
  kind: "mutation",
21438
21657
  auth: "admin"
21658
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21659
+ kind: "mutation",
21660
+ auth: "admin"
21439
21661
  });
21440
21662
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21441
21663
  providerId: string().min(1),
@@ -21834,12 +22056,38 @@ response: record(string(), unknown()) }), object({
21834
22056
  *
21835
22057
  * ## Why this is a capability and not a helper
21836
22058
  *
21837
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21838
- * plate, vehicle, identity, and the event store's derivativesand every one of
21839
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21840
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21841
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21842
- * load 5,000 rows before ranking anything.
22059
+ * This capability was introduced with the claim that SIX stores in
22060
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
22061
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
22062
+ * claim was never true, and leaving it here made five stores look like pending
22063
+ * work when three of them have no vector at all. Counted column by column on
22064
+ * 2026-08-30, exactly THREE ever held one:
22065
+ *
22066
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
22067
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
22068
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
22069
+ * face, migrated 2026-08-30 into its OWN index (see below).
22070
+ *
22071
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
22072
+ * and `identities` store a name; the event store stores no derivative vector.
22073
+ * They are not migration candidates and never were.
22074
+ *
22075
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
22076
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
22077
+ * rows before ranking anything.
22078
+ *
22079
+ * ## One index per COMPARISON, never per encoder
22080
+ *
22081
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
22082
+ * model, and they still get two indexes. An index is a set of things that are
22083
+ * ranked against each other and that live and die together, and these two are
22084
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
22085
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
22086
+ * forever and is the gallery every recognition ranks against. One index would
22087
+ * mean every gallery load and every reconcile carried a filter whose failure
22088
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
22089
+ * person's only sample. The dimension they share is not a reason to share an
22090
+ * index; the question they answer is, and it differs.
21843
22091
  *
21844
22092
  * The fix is not a faster loop, it is a different backend — and the backend
21845
22093
  * should be replaceable without touching six callers. So: a singleton
@@ -21944,7 +22192,20 @@ var VectorQueryResultSchema = object({
21944
22192
  */
21945
22193
  scanned: number(),
21946
22194
  /** True when the backend could not consider every row that passed the filter. */
21947
- truncated: boolean()
22195
+ truncated: boolean(),
22196
+ /**
22197
+ * The `topK` the backend actually ran with.
22198
+ *
22199
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
22200
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
22201
+ * own log rather than in its answer. That is how an audit asking for 20,000
22202
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
22203
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
22204
+ * MUCH, in the return value, where the caller cannot fail to see it.
22205
+ *
22206
+ * Equals the requested `topK` whenever nothing was lowered.
22207
+ */
22208
+ effectiveTopK: number().int().positive()
21948
22209
  });
21949
22210
  var VectorDeleteInputSchema = object({
21950
22211
  index: string(),
@@ -21973,6 +22234,68 @@ var VectorGetResultSchema = object({ items: array(object({
21973
22234
  id: string(),
21974
22235
  metadata: VectorMetadataSchema
21975
22236
  })) });
22237
+ /**
22238
+ * Ids to read back WITH their vectors.
22239
+ *
22240
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22241
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22242
+ * caller depends on that promise. This one promises the opposite.
22243
+ *
22244
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22245
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22246
+ * a per-face cross-process KNN would be a network round trip inside the
22247
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22248
+ * it requires the index to hand the floats back. Without this method the only
22249
+ * way to keep a readable vector is a JSON column, which is the thing this
22250
+ * capability exists to delete.
22251
+ *
22252
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22253
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22254
+ */
22255
+ var VectorFetchInputSchema = object({
22256
+ index: string(),
22257
+ ids: array(string())
22258
+ });
22259
+ var VectorFetchResultSchema = object({ items: array(object({
22260
+ id: string(),
22261
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22262
+ vector: string(),
22263
+ metadata: VectorMetadataSchema
22264
+ })) });
22265
+ /**
22266
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22267
+ *
22268
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22269
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22270
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22271
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22272
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22273
+ * looked" for as long as anyone cared to read it.
22274
+ *
22275
+ * This is the primitive that question actually needs: a bounded page, ordered
22276
+ * by the backend's own row order, costing no distance computation at all.
22277
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22278
+ * the full-table read this capability was built to stop.
22279
+ */
22280
+ var VectorScanInputSchema = object({
22281
+ index: string(),
22282
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22283
+ cursor: number().int().nonnegative().default(0),
22284
+ limit: number().int().positive()
22285
+ });
22286
+ var VectorScanResultSchema = object({
22287
+ items: array(object({
22288
+ id: string(),
22289
+ metadata: VectorMetadataSchema
22290
+ })),
22291
+ /**
22292
+ * Where the next page starts, or `null` when the walk reached the end.
22293
+ *
22294
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22295
+ * from a short page: a backend is free to return fewer rows than asked.
22296
+ */
22297
+ nextCursor: number().int().nonnegative().nullable()
22298
+ });
21976
22299
  var VectorStatsInputSchema = object({ index: string() });
21977
22300
  var VectorStatsResultSchema = object({
21978
22301
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21991,7 +22314,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21991
22314
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21992
22315
  kind: "mutation",
21993
22316
  auth: "admin"
21994
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22317
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21995
22318
  kind: "mutation",
21996
22319
  auth: "admin"
21997
22320
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28743,6 +29066,9 @@ method(object({
28743
29066
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28744
29067
  kind: "query",
28745
29068
  auth: "admin"
29069
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
29070
+ kind: "query",
29071
+ auth: "admin"
28746
29072
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28747
29073
  kind: "mutation",
28748
29074
  auth: "admin"
@@ -35808,6 +36134,12 @@ Object.freeze({
35808
36134
  addonId: null,
35809
36135
  access: "create"
35810
36136
  },
36137
+ "pipelineAnalytics.countRelocatableMedia": {
36138
+ capName: "pipeline-analytics",
36139
+ capScope: "device",
36140
+ addonId: null,
36141
+ access: "view"
36142
+ },
35811
36143
  "pipelineAnalytics.countUnstampedEventMedia": {
35812
36144
  capName: "pipeline-analytics",
35813
36145
  capScope: "device",
@@ -36972,6 +37304,12 @@ Object.freeze({
36972
37304
  addonId: null,
36973
37305
  access: "view"
36974
37306
  },
37307
+ "recording.getRelocateResidue": {
37308
+ capName: "recording",
37309
+ capScope: "system",
37310
+ addonId: null,
37311
+ access: "view"
37312
+ },
36975
37313
  "recording.getStorageMigrationMoveStatus": {
36976
37314
  capName: "recording",
36977
37315
  capScope: "system",
@@ -37518,12 +37856,30 @@ Object.freeze({
37518
37856
  addonId: null,
37519
37857
  access: "create"
37520
37858
  },
37859
+ "storageMigration.drain": {
37860
+ capName: "storage-migration",
37861
+ capScope: "system",
37862
+ addonId: null,
37863
+ access: "create"
37864
+ },
37865
+ "storageMigration.movers": {
37866
+ capName: "storage-migration",
37867
+ capScope: "system",
37868
+ addonId: null,
37869
+ access: "view"
37870
+ },
37521
37871
  "storageMigration.plan": {
37522
37872
  capName: "storage-migration",
37523
37873
  capScope: "system",
37524
37874
  addonId: null,
37525
37875
  access: "view"
37526
37876
  },
37877
+ "storageMigration.residue": {
37878
+ capName: "storage-migration",
37879
+ capScope: "system",
37880
+ addonId: null,
37881
+ access: "view"
37882
+ },
37527
37883
  "storageMigration.start": {
37528
37884
  capName: "storage-migration",
37529
37885
  capScope: "system",
@@ -38358,6 +38714,12 @@ Object.freeze({
38358
38714
  addonId: null,
38359
38715
  access: "delete"
38360
38716
  },
38717
+ "vectorStore.fetchByIds": {
38718
+ capName: "vector-store",
38719
+ capScope: "system",
38720
+ addonId: null,
38721
+ access: "view"
38722
+ },
38361
38723
  "vectorStore.getByIds": {
38362
38724
  capName: "vector-store",
38363
38725
  capScope: "system",
@@ -38370,6 +38732,12 @@ Object.freeze({
38370
38732
  addonId: null,
38371
38733
  access: "view"
38372
38734
  },
38735
+ "vectorStore.scan": {
38736
+ capName: "vector-store",
38737
+ capScope: "system",
38738
+ addonId: null,
38739
+ access: "view"
38740
+ },
38373
38741
  "vectorStore.stats": {
38374
38742
  capName: "vector-store",
38375
38743
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -7999,6 +7999,21 @@ var RelocateJobSchema = object({
7999
7999
  bytesMoved: number().int(),
8000
8000
  /** Total files discovered up front; null while (or when) unknown. */
8001
8001
  filesTotal: number().int().nullable(),
8002
+ /**
8003
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8004
+ * made that nobody asked for, so it is reported where the operator reads the
8005
+ * job rather than only in a log line.
8006
+ *
8007
+ * A footage segment records its byte count in its own NAME, and the durable
8008
+ * hour row derives its aggregates from those names. A file that does not
8009
+ * match its name therefore makes the ledger's sums — and with them quota and
8010
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8011
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8012
+ *
8013
+ * Absent on lanes where the question has no meaning: a media blob's size is
8014
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8015
+ */
8016
+ rowsReconciled: number().int().nonnegative().optional(),
8002
8017
  startedAt: number(),
8003
8018
  finishedAt: number().nullable(),
8004
8019
  error: string().nullable()
@@ -8067,14 +8082,42 @@ var RelocateMediaInputSchema = object({
8067
8082
  /** Omitted = `move`, the pre-existing behaviour. */
8068
8083
  mode: MediaRelocateModeSchema.optional()
8069
8084
  });
8070
- /** How many rows still carry NO `locationId` — the population a repoint would
8071
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8072
- * value that permits a non-blocking `eventMedia` cutover. */
8073
- var UnstampedEventMediaCountSchema = object({
8074
- media: number().int().nonnegative(),
8075
- retrainFrames: number().int().nonnegative(),
8076
- total: number().int().nonnegative()
8085
+ /**
8086
+ * The unstamped population of ONE collection split, because the gate and the
8087
+ * operator ask two different questions and only one of them has to be cheap.
8088
+ *
8089
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8090
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8091
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8092
+ * that matters — after a seal, when the population is empty.
8093
+ *
8094
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8095
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8096
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8097
+ * and useful answer: "there are some, and this read could not say how many"
8098
+ * still refuses the cutover, which is the whole job.
8099
+ */
8100
+ var UnstampedRowsSchema = object({
8101
+ present: boolean(),
8102
+ rows: number().int().nonnegative().nullable()
8077
8103
  });
8104
+ /**
8105
+ * How many rows still carry NO `locationId` — the population a repoint would
8106
+ * silently re-aim at a disk that does not hold their bytes.
8107
+ *
8108
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8109
+ * over. The gate opens on a measured absence and on nothing else; an unread
8110
+ * collection and an empty one are different facts, and this repo has already
8111
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8112
+ */
8113
+ var UnstampedEventMediaCountSchema = object({
8114
+ media: UnstampedRowsSchema,
8115
+ retrainFrames: UnstampedRowsSchema,
8116
+ /** True when EITHER collection holds one. The refusal reads this. */
8117
+ anyPresent: boolean(),
8118
+ /** Sum across both, or `null` when either lane could not be counted. */
8119
+ total: number().int().nonnegative().nullable()
8120
+ }).nullable();
8078
8121
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8079
8122
  /** The independently selectable logical storage classes — every class
8080
8123
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8160,13 +8203,53 @@ var StorageMigrationParticipantSchema = _enum([
8160
8203
  "recorder",
8161
8204
  "analytics"
8162
8205
  ]);
8206
+ /**
8207
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8208
+ *
8209
+ * The long half of a non-blocking migration is `draining`, and it is measured
8210
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8211
+ * existed the only place those numbers appeared was a Loki line, so an operator
8212
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8213
+ * afternoon.
8214
+ *
8215
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8216
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8217
+ * mover — which is the exact failure this is meant to end. The coordinator's
8218
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8219
+ * read `state`; folding the counters costs no extra read and makes the durable
8220
+ * record say afterwards how far a move actually got.
8221
+ *
8222
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8223
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8224
+ * cannot say M, and a 0 there would render as "100 % done".
8225
+ */
8226
+ var StorageMigrationMoveProgressSchema = object({
8227
+ filesMoved: number().int().nonnegative(),
8228
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8229
+ filesTotal: number().int().nonnegative().nullable(),
8230
+ bytesMoved: number().int().nonnegative(),
8231
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8232
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8233
+ * rows would be the same failure as one that silently skipped them. */
8234
+ rowsReconciled: number().int().nonnegative().optional(),
8235
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8236
+ * crash gets a new mover, and a rate computed from the migration's start
8237
+ * would silently average in the time nothing was running. */
8238
+ startedAt: number(),
8239
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8240
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8241
+ * subtract its own. */
8242
+ observedAt: number()
8243
+ });
8163
8244
  var StorageMigrationMoveSchema = object({
8164
8245
  storageClass: StorageMigrationClassSchema,
8165
8246
  fromLocationId: string(),
8166
8247
  toLocationId: string(),
8167
8248
  moverJobId: string().nullable(),
8168
8249
  state: RelocateJobStateSchema.nullable(),
8169
- error: string().nullable()
8250
+ error: string().nullable(),
8251
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8252
+ progress: StorageMigrationMoveProgressSchema.nullable()
8170
8253
  });
8171
8254
  var StorageMigrationJobSchema = object({
8172
8255
  jobId: string(),
@@ -8212,6 +8295,98 @@ var StorageMigrationPlanSchema = object({
8212
8295
  findings: array(StorageMigrationFindingSchema)
8213
8296
  });
8214
8297
  /**
8298
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8299
+ *
8300
+ * The coordinator's job record is the state of record for a migration, and its
8301
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8302
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8303
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8304
+ * way because no supported UI path existed. A mover armed like that has no job
8305
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8306
+ *
8307
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8308
+ * orchestrated it.
8309
+ */
8310
+ var StorageMigrationMoverSchema = object({
8311
+ lane: _enum(["footage", "media"]),
8312
+ job: RelocateJobSchema,
8313
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8314
+ * directly against the owning addon. */
8315
+ migrationJobId: string().nullable(),
8316
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8317
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8318
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8319
+ * rate made of two different clocks. */
8320
+ observedAt: number()
8321
+ });
8322
+ /**
8323
+ * What a SOURCE still holds for one storage class — the number that makes a
8324
+ * "drain remaining" action honest rather than hopeful.
8325
+ *
8326
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8327
+ * engine's own selection count for media), never from the resident index: a
8328
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8329
+ * never been told about (D295).
8330
+ *
8331
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8332
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8333
+ * because refusing on an unanswerable read would hide exactly the case an
8334
+ * operator needs to act on.
8335
+ */
8336
+ var StorageMigrationResidueSchema = object({
8337
+ storageClass: StorageMigrationClassSchema,
8338
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8339
+ * move from wherever they are rather than from one named source. */
8340
+ fromLocationId: string(),
8341
+ /** Where a drain would move it — the class's CURRENT default. */
8342
+ toLocationId: string(),
8343
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8344
+ items: number().int().nonnegative().nullable(),
8345
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8346
+ bytes: number().int().nonnegative().nullable()
8347
+ });
8348
+ /**
8349
+ * Run the DRAIN half and nothing else.
8350
+ *
8351
+ * A migration that reached `done` has already repointed, so `start` correctly
8352
+ * refuses its destination ("already the default") — there is nothing left to
8353
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8354
+ * or finish against a work list that was a tenth of the archive (D295), and
8355
+ * before this there was no supported way to run only that half: the only way
8356
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8357
+ *
8358
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8359
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8360
+ * re-repoint a class that is already migrated.
8361
+ */
8362
+ var StorageMigrationDrainInputSchema = object({
8363
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8364
+ * a class whose source is already empty is refused rather than started. */
8365
+ classes: array(StorageMigrationClassSchema).min(1),
8366
+ throttleMbps: number().min(1).max(1e3).optional()
8367
+ });
8368
+ /** What a footage source still holds, asked of the durable hour ledger. */
8369
+ var RelocateResidueInputSchema = object({
8370
+ fromLocationId: string().min(1),
8371
+ /** Narrow to one logical class; omit for every profile on the location. */
8372
+ footageClass: RelocateFootageClassSchema.optional()
8373
+ });
8374
+ /** `null` = the archive could not answer (no ledger on this node, or the
8375
+ * aggregate failed). Never conflated with an empty source. */
8376
+ var RelocateResidueSchema = object({
8377
+ segments: number().int().nonnegative(),
8378
+ bytes: number().int().nonnegative()
8379
+ }).nullable();
8380
+ /** How many rows a media pass would still act on against a given target — the
8381
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8382
+ * never disagree. `null` = the count could not be taken. */
8383
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8384
+ var RelocatableMediaCountInputSchema = object({
8385
+ toLocationId: string().min(1),
8386
+ /** Omitted = `move`. */
8387
+ mode: MediaRelocateModeSchema.optional()
8388
+ });
8389
+ /**
8215
8390
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8216
8391
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8217
8392
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8315,6 +8490,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8315
8490
  * two addons declaring the same `id` must agree on `cardinality` (validated
8316
8491
  * at kernel aggregation time, not here).
8317
8492
  */
8493
+ /**
8494
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8495
+ * actually reaches the bytes. It is the constraint that decides which
8496
+ * `storage-provider`s may back a location of that kind.
8497
+ *
8498
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8499
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8500
+ * post-analysis media roots). Only a provider that serves a genuine local
8501
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8502
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8503
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8504
+ * against a same-named local directory that is something else entirely.
8505
+ *
8506
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8507
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8508
+ * service never sees a path, so any provider can back it. `backups` is the
8509
+ * one kind that qualifies today.
8510
+ *
8511
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8512
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8513
+ * refused the configuration; the first write simply went somewhere wrong, and
8514
+ * a recording write that goes wrong surfaces as a silent black window rather
8515
+ * than an error (the read path does not `stat`). This turns that accident into
8516
+ * a declared, enforced, testable refusal.
8517
+ */
8518
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8318
8519
  var StorageLocationDeclarationSchema = object({
8319
8520
  /**
8320
8521
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8334,6 +8535,19 @@ var StorageLocationDeclarationSchema = object({
8334
8535
  */
8335
8536
  cardinality: _enum(["single", "multi"]),
8336
8537
  /**
8538
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8539
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8540
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8541
+ *
8542
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8543
+ * can only over-restrict (refuse a remote provider for a kind that might
8544
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8545
+ * permissive direction and is therefore never inferred — a repo guard
8546
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8547
+ * reached by omission.
8548
+ */
8549
+ access: StorageAccessSchema.optional(),
8550
+ /**
8337
8551
  * When set, the default instance for this location inherits its resolved
8338
8552
  * root from the named location's default instance. Useful for derivative
8339
8553
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18513,8 +18727,10 @@ var TrackSchema = object({
18513
18727
  lastSeen: number(),
18514
18728
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18515
18729
  positions: array(TrackPositionSchema).readonly(),
18516
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18517
- * saveThumbnails policy). */
18730
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18731
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18732
+ * the retired `saveThumbnails` used to gate this and the rolling
18733
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18518
18734
  snapshots: array(TrackSnapshotSchema).readonly(),
18519
18735
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18520
18736
  zonesVisited: array(string()).readonly(),
@@ -19374,7 +19590,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19374
19590
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19375
19591
  kind: "mutation",
19376
19592
  auth: "admin"
19377
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19593
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19594
+ kind: "query",
19595
+ auth: "admin"
19596
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19378
19597
  kind: "query",
19379
19598
  auth: "admin"
19380
19599
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21437,6 +21656,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21437
21656
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21438
21657
  kind: "mutation",
21439
21658
  auth: "admin"
21659
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21660
+ kind: "mutation",
21661
+ auth: "admin"
21440
21662
  });
21441
21663
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21442
21664
  providerId: string().min(1),
@@ -21835,12 +22057,38 @@ response: record(string(), unknown()) }), object({
21835
22057
  *
21836
22058
  * ## Why this is a capability and not a helper
21837
22059
  *
21838
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21839
- * plate, vehicle, identity, and the event store's derivativesand every one of
21840
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21841
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21842
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21843
- * load 5,000 rows before ranking anything.
22060
+ * This capability was introduced with the claim that SIX stores in
22061
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
22062
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
22063
+ * claim was never true, and leaving it here made five stores look like pending
22064
+ * work when three of them have no vector at all. Counted column by column on
22065
+ * 2026-08-30, exactly THREE ever held one:
22066
+ *
22067
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
22068
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
22069
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
22070
+ * face, migrated 2026-08-30 into its OWN index (see below).
22071
+ *
22072
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
22073
+ * and `identities` store a name; the event store stores no derivative vector.
22074
+ * They are not migration candidates and never were.
22075
+ *
22076
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
22077
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
22078
+ * rows before ranking anything.
22079
+ *
22080
+ * ## One index per COMPARISON, never per encoder
22081
+ *
22082
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
22083
+ * model, and they still get two indexes. An index is a set of things that are
22084
+ * ranked against each other and that live and die together, and these two are
22085
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
22086
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
22087
+ * forever and is the gallery every recognition ranks against. One index would
22088
+ * mean every gallery load and every reconcile carried a filter whose failure
22089
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
22090
+ * person's only sample. The dimension they share is not a reason to share an
22091
+ * index; the question they answer is, and it differs.
21844
22092
  *
21845
22093
  * The fix is not a faster loop, it is a different backend — and the backend
21846
22094
  * should be replaceable without touching six callers. So: a singleton
@@ -21945,7 +22193,20 @@ var VectorQueryResultSchema = object({
21945
22193
  */
21946
22194
  scanned: number(),
21947
22195
  /** True when the backend could not consider every row that passed the filter. */
21948
- truncated: boolean()
22196
+ truncated: boolean(),
22197
+ /**
22198
+ * The `topK` the backend actually ran with.
22199
+ *
22200
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
22201
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
22202
+ * own log rather than in its answer. That is how an audit asking for 20,000
22203
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
22204
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
22205
+ * MUCH, in the return value, where the caller cannot fail to see it.
22206
+ *
22207
+ * Equals the requested `topK` whenever nothing was lowered.
22208
+ */
22209
+ effectiveTopK: number().int().positive()
21949
22210
  });
21950
22211
  var VectorDeleteInputSchema = object({
21951
22212
  index: string(),
@@ -21974,6 +22235,68 @@ var VectorGetResultSchema = object({ items: array(object({
21974
22235
  id: string(),
21975
22236
  metadata: VectorMetadataSchema
21976
22237
  })) });
22238
+ /**
22239
+ * Ids to read back WITH their vectors.
22240
+ *
22241
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22242
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22243
+ * caller depends on that promise. This one promises the opposite.
22244
+ *
22245
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22246
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22247
+ * a per-face cross-process KNN would be a network round trip inside the
22248
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22249
+ * it requires the index to hand the floats back. Without this method the only
22250
+ * way to keep a readable vector is a JSON column, which is the thing this
22251
+ * capability exists to delete.
22252
+ *
22253
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22254
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22255
+ */
22256
+ var VectorFetchInputSchema = object({
22257
+ index: string(),
22258
+ ids: array(string())
22259
+ });
22260
+ var VectorFetchResultSchema = object({ items: array(object({
22261
+ id: string(),
22262
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22263
+ vector: string(),
22264
+ metadata: VectorMetadataSchema
22265
+ })) });
22266
+ /**
22267
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22268
+ *
22269
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22270
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22271
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22272
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22273
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22274
+ * looked" for as long as anyone cared to read it.
22275
+ *
22276
+ * This is the primitive that question actually needs: a bounded page, ordered
22277
+ * by the backend's own row order, costing no distance computation at all.
22278
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22279
+ * the full-table read this capability was built to stop.
22280
+ */
22281
+ var VectorScanInputSchema = object({
22282
+ index: string(),
22283
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22284
+ cursor: number().int().nonnegative().default(0),
22285
+ limit: number().int().positive()
22286
+ });
22287
+ var VectorScanResultSchema = object({
22288
+ items: array(object({
22289
+ id: string(),
22290
+ metadata: VectorMetadataSchema
22291
+ })),
22292
+ /**
22293
+ * Where the next page starts, or `null` when the walk reached the end.
22294
+ *
22295
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22296
+ * from a short page: a backend is free to return fewer rows than asked.
22297
+ */
22298
+ nextCursor: number().int().nonnegative().nullable()
22299
+ });
21977
22300
  var VectorStatsInputSchema = object({ index: string() });
21978
22301
  var VectorStatsResultSchema = object({
21979
22302
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21992,7 +22315,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21992
22315
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21993
22316
  kind: "mutation",
21994
22317
  auth: "admin"
21995
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22318
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21996
22319
  kind: "mutation",
21997
22320
  auth: "admin"
21998
22321
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28744,6 +29067,9 @@ method(object({
28744
29067
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28745
29068
  kind: "query",
28746
29069
  auth: "admin"
29070
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
29071
+ kind: "query",
29072
+ auth: "admin"
28747
29073
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28748
29074
  kind: "mutation",
28749
29075
  auth: "admin"
@@ -35809,6 +36135,12 @@ Object.freeze({
35809
36135
  addonId: null,
35810
36136
  access: "create"
35811
36137
  },
36138
+ "pipelineAnalytics.countRelocatableMedia": {
36139
+ capName: "pipeline-analytics",
36140
+ capScope: "device",
36141
+ addonId: null,
36142
+ access: "view"
36143
+ },
35812
36144
  "pipelineAnalytics.countUnstampedEventMedia": {
35813
36145
  capName: "pipeline-analytics",
35814
36146
  capScope: "device",
@@ -36973,6 +37305,12 @@ Object.freeze({
36973
37305
  addonId: null,
36974
37306
  access: "view"
36975
37307
  },
37308
+ "recording.getRelocateResidue": {
37309
+ capName: "recording",
37310
+ capScope: "system",
37311
+ addonId: null,
37312
+ access: "view"
37313
+ },
36976
37314
  "recording.getStorageMigrationMoveStatus": {
36977
37315
  capName: "recording",
36978
37316
  capScope: "system",
@@ -37519,12 +37857,30 @@ Object.freeze({
37519
37857
  addonId: null,
37520
37858
  access: "create"
37521
37859
  },
37860
+ "storageMigration.drain": {
37861
+ capName: "storage-migration",
37862
+ capScope: "system",
37863
+ addonId: null,
37864
+ access: "create"
37865
+ },
37866
+ "storageMigration.movers": {
37867
+ capName: "storage-migration",
37868
+ capScope: "system",
37869
+ addonId: null,
37870
+ access: "view"
37871
+ },
37522
37872
  "storageMigration.plan": {
37523
37873
  capName: "storage-migration",
37524
37874
  capScope: "system",
37525
37875
  addonId: null,
37526
37876
  access: "view"
37527
37877
  },
37878
+ "storageMigration.residue": {
37879
+ capName: "storage-migration",
37880
+ capScope: "system",
37881
+ addonId: null,
37882
+ access: "view"
37883
+ },
37528
37884
  "storageMigration.start": {
37529
37885
  capName: "storage-migration",
37530
37886
  capScope: "system",
@@ -38359,6 +38715,12 @@ Object.freeze({
38359
38715
  addonId: null,
38360
38716
  access: "delete"
38361
38717
  },
38718
+ "vectorStore.fetchByIds": {
38719
+ capName: "vector-store",
38720
+ capScope: "system",
38721
+ addonId: null,
38722
+ access: "view"
38723
+ },
38362
38724
  "vectorStore.getByIds": {
38363
38725
  capName: "vector-store",
38364
38726
  capScope: "system",
@@ -38371,6 +38733,12 @@ Object.freeze({
38371
38733
  addonId: null,
38372
38734
  access: "view"
38373
38735
  },
38736
+ "vectorStore.scan": {
38737
+ capName: "vector-store",
38738
+ capScope: "system",
38739
+ addonId: null,
38740
+ access: "view"
38741
+ },
38374
38742
  "vectorStore.stats": {
38375
38743
  capName: "vector-store",
38376
38744
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-hikvision",
3
- "version": "1.2.51",
3
+ "version": "1.2.54",
4
4
  "description": "Hikvision camera device provider addon for CamStack — ISAPI over HTTP(S) with digest auth (snapshot, alarm stream, RTSP discovery)",
5
5
  "keywords": [
6
6
  "camstack",