@camstack/addon-provider-onvif 1.2.41 → 1.2.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +452 -23
  2. package/dist/addon.mjs +452 -23
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8038,18 +8038,61 @@ var RelocateFootageInputSchema = object({
8038
8038
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8039
8039
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8040
8040
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8041
+ /**
8042
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8043
+ * mover (the engine already walks both collections with a timestamp cursor and
8044
+ * already has a stamp-without-copy path).
8045
+ *
8046
+ * - `move` — the default and the historical behaviour: event-media and
8047
+ * retrain blobs move to `toLocationId` and their rows are
8048
+ * stamped. The enrolled gallery is skipped (D197).
8049
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8050
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8051
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8052
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8053
+ * instant a repoint moves that pointer the row reads from the
8054
+ * new disk while its bytes are on the old one.
8055
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8056
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8057
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8058
+ * never run beside a live second location: it is stop-the-world
8059
+ * by construction, which is acceptable only because the gallery
8060
+ * is a few KB per enrolled sample.
8061
+ */
8062
+ var MediaRelocateModeSchema = _enum([
8063
+ "move",
8064
+ "seal",
8065
+ "gallery"
8066
+ ]);
8041
8067
  var RelocateMediaInputSchema = object({
8042
8068
  toLocationId: string(),
8043
- throttleMbps: number().min(1).max(1e3).optional()
8069
+ throttleMbps: number().min(1).max(1e3).optional(),
8070
+ /** Omitted = `move`, the pre-existing behaviour. */
8071
+ mode: MediaRelocateModeSchema.optional()
8072
+ });
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()
8044
8080
  });
8045
8081
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8046
- /** The independently selectable logical storage classes. `recordings`
8047
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8048
- * segments; `eventMedia` is post-analysis blobs. */
8082
+ /** The independently selectable logical storage classes — every class
8083
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8084
+ * Zod enum error where they should meet an explanation.
8085
+ *
8086
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8087
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8088
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8089
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8049
8090
  var StorageMigrationClassSchema = _enum([
8050
8091
  "recordings",
8051
8092
  "recordingsLow",
8052
- "eventMedia"
8093
+ "eventMedia",
8094
+ "backups",
8095
+ "galleryMedia"
8053
8096
  ]);
8054
8097
  /** A destination is always an existing, fully-qualified location id. The
8055
8098
  * migration API intentionally never changes a source location's `basePath`:
@@ -8057,20 +8100,56 @@ var StorageMigrationClassSchema = _enum([
8057
8100
  var StorageMigrationDestinationsSchema = object({
8058
8101
  recordings: string().min(1).optional(),
8059
8102
  recordingsLow: string().min(1).optional(),
8060
- eventMedia: string().min(1).optional()
8103
+ eventMedia: string().min(1).optional(),
8104
+ backups: string().min(1).optional(),
8105
+ galleryMedia: string().min(1).optional()
8061
8106
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8107
+ /**
8108
+ * How a migration sequences the cutover against the byte move.
8109
+ *
8110
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8111
+ * resume. Recording is stopped for the whole move. Right
8112
+ * for a small or a cold class, and the only legal mode for
8113
+ * a `cardinality: 'single'` class.
8114
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8115
+ * refresh, resume, then move the past with everything
8116
+ * running. The pause is three bounded instants (a detach +
8117
+ * attach round, a write-gate drain, a lease) instead of one
8118
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8119
+ * stopped recording under `blocking`; the same move is
8120
+ * seconds of stopped recording under `nonBlocking`.
8121
+ *
8122
+ * The mode is on the JOB, not only on the input, because `status` is where an
8123
+ * operator finds out which one is running.
8124
+ */
8125
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8062
8126
  /** Shared input for planning and starting an orchestrated storage migration. */
8063
8127
  var StorageMigrationInputSchema = object({
8064
8128
  destinations: StorageMigrationDestinationsSchema,
8065
- throttleMbps: number().min(1).max(1e3).optional()
8129
+ throttleMbps: number().min(1).max(1e3).optional(),
8130
+ /** Omitted = `blocking`, which stays the default. */
8131
+ mode: StorageMigrationModeSchema.optional()
8066
8132
  });
8067
- /** The durable coordinator state machine. The only phase that changes default
8068
- * locations is `repointing`, after every selected mover has completed and been
8069
- * verified. */
8133
+ /**
8134
+ * The durable coordinator state machine.
8135
+ *
8136
+ * `blocking`:
8137
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8138
+ *
8139
+ * `nonBlocking`:
8140
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8141
+ *
8142
+ * Same phases, different order plus two new ones — not a second mover.
8143
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8144
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8145
+ * `repointing` is still the only phase that changes a default location.
8146
+ */
8070
8147
  var StorageMigrationPhaseSchema = _enum([
8071
8148
  "planning",
8149
+ "sealing",
8072
8150
  "pausing",
8073
8151
  "moving",
8152
+ "draining",
8074
8153
  "verifying",
8075
8154
  "repointing",
8076
8155
  "refreshing",
@@ -8084,17 +8163,56 @@ var StorageMigrationParticipantSchema = _enum([
8084
8163
  "recorder",
8085
8164
  "analytics"
8086
8165
  ]);
8166
+ /**
8167
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8168
+ *
8169
+ * The long half of a non-blocking migration is `draining`, and it is measured
8170
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8171
+ * existed the only place those numbers appeared was a Loki line, so an operator
8172
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8173
+ * afternoon.
8174
+ *
8175
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8176
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8177
+ * mover — which is the exact failure this is meant to end. The coordinator's
8178
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8179
+ * read `state`; folding the counters costs no extra read and makes the durable
8180
+ * record say afterwards how far a move actually got.
8181
+ *
8182
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8183
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8184
+ * cannot say M, and a 0 there would render as "100 % done".
8185
+ */
8186
+ var StorageMigrationMoveProgressSchema = object({
8187
+ filesMoved: number().int().nonnegative(),
8188
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8189
+ filesTotal: number().int().nonnegative().nullable(),
8190
+ bytesMoved: number().int().nonnegative(),
8191
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8192
+ * crash gets a new mover, and a rate computed from the migration's start
8193
+ * would silently average in the time nothing was running. */
8194
+ startedAt: number(),
8195
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8196
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8197
+ * subtract its own. */
8198
+ observedAt: number()
8199
+ });
8087
8200
  var StorageMigrationMoveSchema = object({
8088
8201
  storageClass: StorageMigrationClassSchema,
8089
8202
  fromLocationId: string(),
8090
8203
  toLocationId: string(),
8091
8204
  moverJobId: string().nullable(),
8092
8205
  state: RelocateJobStateSchema.nullable(),
8093
- error: string().nullable()
8206
+ error: string().nullable(),
8207
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8208
+ progress: StorageMigrationMoveProgressSchema.nullable()
8094
8209
  });
8095
8210
  var StorageMigrationJobSchema = object({
8096
8211
  jobId: string(),
8097
8212
  phase: StorageMigrationPhaseSchema,
8213
+ /** Which order this job is running. `status` is the only place an operator
8214
+ * can tell a seconds-long cutover from a thirty-hour one. */
8215
+ mode: StorageMigrationModeSchema,
8098
8216
  destinations: StorageMigrationDestinationsSchema,
8099
8217
  throttleMbps: number(),
8100
8218
  moves: array(StorageMigrationMoveSchema),
@@ -8107,13 +8225,122 @@ var StorageMigrationJobSchema = object({
8107
8225
  finishedAt: number().nullable(),
8108
8226
  error: string().nullable()
8109
8227
  });
8228
+ var StorageMigrationFindingSchema = object({
8229
+ code: _enum([
8230
+ "sharesDeviceWithSource",
8231
+ "deviceIdentityUnknown",
8232
+ "unstampedEventMediaRows",
8233
+ "blockingOnly",
8234
+ "noMover"
8235
+ ]),
8236
+ storageClass: StorageMigrationClassSchema,
8237
+ /** Human-readable, already carrying the ids and counts. */
8238
+ message: string()
8239
+ });
8110
8240
  var StorageMigrationPlanSchema = object({
8111
8241
  destinations: StorageMigrationDestinationsSchema,
8242
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8243
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8244
+ * it. */
8245
+ mode: StorageMigrationModeSchema,
8112
8246
  moves: array(object({
8113
8247
  storageClass: StorageMigrationClassSchema,
8114
8248
  fromLocationId: string(),
8115
8249
  toLocationId: string()
8116
- }))
8250
+ })),
8251
+ findings: array(StorageMigrationFindingSchema)
8252
+ });
8253
+ /**
8254
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8255
+ *
8256
+ * The coordinator's job record is the state of record for a migration, and its
8257
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8258
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8259
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8260
+ * way because no supported UI path existed. A mover armed like that has no job
8261
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8262
+ *
8263
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8264
+ * orchestrated it.
8265
+ */
8266
+ var StorageMigrationMoverSchema = object({
8267
+ lane: _enum(["footage", "media"]),
8268
+ job: RelocateJobSchema,
8269
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8270
+ * directly against the owning addon. */
8271
+ migrationJobId: string().nullable(),
8272
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8273
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8274
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8275
+ * rate made of two different clocks. */
8276
+ observedAt: number()
8277
+ });
8278
+ /**
8279
+ * What a SOURCE still holds for one storage class — the number that makes a
8280
+ * "drain remaining" action honest rather than hopeful.
8281
+ *
8282
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8283
+ * engine's own selection count for media), never from the resident index: a
8284
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8285
+ * never been told about (D295).
8286
+ *
8287
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8288
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8289
+ * because refusing on an unanswerable read would hide exactly the case an
8290
+ * operator needs to act on.
8291
+ */
8292
+ var StorageMigrationResidueSchema = object({
8293
+ storageClass: StorageMigrationClassSchema,
8294
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8295
+ * move from wherever they are rather than from one named source. */
8296
+ fromLocationId: string(),
8297
+ /** Where a drain would move it — the class's CURRENT default. */
8298
+ toLocationId: string(),
8299
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8300
+ items: number().int().nonnegative().nullable(),
8301
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8302
+ bytes: number().int().nonnegative().nullable()
8303
+ });
8304
+ /**
8305
+ * Run the DRAIN half and nothing else.
8306
+ *
8307
+ * A migration that reached `done` has already repointed, so `start` correctly
8308
+ * refuses its destination ("already the default") — there is nothing left to
8309
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8310
+ * or finish against a work list that was a tenth of the archive (D295), and
8311
+ * before this there was no supported way to run only that half: the only way
8312
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8313
+ *
8314
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8315
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8316
+ * re-repoint a class that is already migrated.
8317
+ */
8318
+ var StorageMigrationDrainInputSchema = object({
8319
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8320
+ * a class whose source is already empty is refused rather than started. */
8321
+ classes: array(StorageMigrationClassSchema).min(1),
8322
+ throttleMbps: number().min(1).max(1e3).optional()
8323
+ });
8324
+ /** What a footage source still holds, asked of the durable hour ledger. */
8325
+ var RelocateResidueInputSchema = object({
8326
+ fromLocationId: string().min(1),
8327
+ /** Narrow to one logical class; omit for every profile on the location. */
8328
+ footageClass: RelocateFootageClassSchema.optional()
8329
+ });
8330
+ /** `null` = the archive could not answer (no ledger on this node, or the
8331
+ * aggregate failed). Never conflated with an empty source. */
8332
+ var RelocateResidueSchema = object({
8333
+ segments: number().int().nonnegative(),
8334
+ bytes: number().int().nonnegative()
8335
+ }).nullable();
8336
+ /** How many rows a media pass would still act on against a given target — the
8337
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8338
+ * never disagree. `null` = the count could not be taken. */
8339
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8340
+ var RelocatableMediaCountInputSchema = object({
8341
+ toLocationId: string().min(1),
8342
+ /** Omitted = `move`. */
8343
+ mode: MediaRelocateModeSchema.optional()
8117
8344
  });
8118
8345
  /**
8119
8346
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8219,6 +8446,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8219
8446
  * two addons declaring the same `id` must agree on `cardinality` (validated
8220
8447
  * at kernel aggregation time, not here).
8221
8448
  */
8449
+ /**
8450
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8451
+ * actually reaches the bytes. It is the constraint that decides which
8452
+ * `storage-provider`s may back a location of that kind.
8453
+ *
8454
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8455
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8456
+ * post-analysis media roots). Only a provider that serves a genuine local
8457
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8458
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8459
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8460
+ * against a same-named local directory that is something else entirely.
8461
+ *
8462
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8463
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8464
+ * service never sees a path, so any provider can back it. `backups` is the
8465
+ * one kind that qualifies today.
8466
+ *
8467
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8468
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8469
+ * refused the configuration; the first write simply went somewhere wrong, and
8470
+ * a recording write that goes wrong surfaces as a silent black window rather
8471
+ * than an error (the read path does not `stat`). This turns that accident into
8472
+ * a declared, enforced, testable refusal.
8473
+ */
8474
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8222
8475
  var StorageLocationDeclarationSchema = object({
8223
8476
  /**
8224
8477
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8238,6 +8491,19 @@ var StorageLocationDeclarationSchema = object({
8238
8491
  */
8239
8492
  cardinality: _enum(["single", "multi"]),
8240
8493
  /**
8494
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8495
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8496
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8497
+ *
8498
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8499
+ * can only over-restrict (refuse a remote provider for a kind that might
8500
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8501
+ * permissive direction and is therefore never inferred — a repo guard
8502
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8503
+ * reached by omission.
8504
+ */
8505
+ access: StorageAccessSchema.optional(),
8506
+ /**
8241
8507
  * When set, the default instance for this location inherits its resolved
8242
8508
  * root from the named location's default instance. Useful for derivative
8243
8509
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17818,8 +18084,10 @@ var TrackSchema = object({
17818
18084
  lastSeen: number(),
17819
18085
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17820
18086
  positions: array(TrackPositionSchema).readonly(),
17821
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17822
- * saveThumbnails policy). */
18087
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18088
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18089
+ * the retired `saveThumbnails` used to gate this and the rolling
18090
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17823
18091
  snapshots: array(TrackSnapshotSchema).readonly(),
17824
18092
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17825
18093
  zonesVisited: array(string()).readonly(),
@@ -18679,6 +18947,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18679
18947
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18680
18948
  kind: "mutation",
18681
18949
  auth: "admin"
18950
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
18951
+ kind: "query",
18952
+ auth: "admin"
18682
18953
  }), method(object({}), array(RelocateJobSchema).readonly(), {
18683
18954
  kind: "query",
18684
18955
  auth: "admin"
@@ -20690,7 +20961,10 @@ method(object({
20690
20961
  }), StorageLocationSchema, {
20691
20962
  kind: "mutation",
20692
20963
  auth: "admin"
20693
- }), method(object({ id: string() }), _void(), {
20964
+ }), method(object({
20965
+ id: string(),
20966
+ force: boolean().optional()
20967
+ }), _void(), {
20694
20968
  kind: "mutation",
20695
20969
  auth: "admin"
20696
20970
  }), method(object({ id: string() }), object({
@@ -20739,6 +21013,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20739
21013
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20740
21014
  kind: "mutation",
20741
21015
  auth: "admin"
21016
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21017
+ kind: "mutation",
21018
+ auth: "admin"
20742
21019
  });
20743
21020
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20744
21021
  providerId: string().min(1),
@@ -21137,12 +21414,38 @@ response: record(string(), unknown()) }), object({
21137
21414
  *
21138
21415
  * ## Why this is a capability and not a helper
21139
21416
  *
21140
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21141
- * plate, vehicle, identity, and the event store's derivativesand every one of
21142
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21143
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21144
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21145
- * load 5,000 rows before ranking anything.
21417
+ * This capability was introduced with the claim that SIX stores in
21418
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21419
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21420
+ * claim was never true, and leaving it here made five stores look like pending
21421
+ * work when three of them have no vector at all. Counted column by column on
21422
+ * 2026-08-30, exactly THREE ever held one:
21423
+ *
21424
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21425
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21426
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21427
+ * face, migrated 2026-08-30 into its OWN index (see below).
21428
+ *
21429
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21430
+ * and `identities` store a name; the event store stores no derivative vector.
21431
+ * They are not migration candidates and never were.
21432
+ *
21433
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21434
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21435
+ * rows before ranking anything.
21436
+ *
21437
+ * ## One index per COMPARISON, never per encoder
21438
+ *
21439
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21440
+ * model, and they still get two indexes. An index is a set of things that are
21441
+ * ranked against each other and that live and die together, and these two are
21442
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21443
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21444
+ * forever and is the gallery every recognition ranks against. One index would
21445
+ * mean every gallery load and every reconcile carried a filter whose failure
21446
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21447
+ * person's only sample. The dimension they share is not a reason to share an
21448
+ * index; the question they answer is, and it differs.
21146
21449
  *
21147
21450
  * The fix is not a faster loop, it is a different backend — and the backend
21148
21451
  * should be replaceable without touching six callers. So: a singleton
@@ -21247,7 +21550,20 @@ var VectorQueryResultSchema = object({
21247
21550
  */
21248
21551
  scanned: number(),
21249
21552
  /** True when the backend could not consider every row that passed the filter. */
21250
- truncated: boolean()
21553
+ truncated: boolean(),
21554
+ /**
21555
+ * The `topK` the backend actually ran with.
21556
+ *
21557
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21558
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21559
+ * own log rather than in its answer. That is how an audit asking for 20,000
21560
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21561
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21562
+ * MUCH, in the return value, where the caller cannot fail to see it.
21563
+ *
21564
+ * Equals the requested `topK` whenever nothing was lowered.
21565
+ */
21566
+ effectiveTopK: number().int().positive()
21251
21567
  });
21252
21568
  var VectorDeleteInputSchema = object({
21253
21569
  index: string(),
@@ -21276,6 +21592,68 @@ var VectorGetResultSchema = object({ items: array(object({
21276
21592
  id: string(),
21277
21593
  metadata: VectorMetadataSchema
21278
21594
  })) });
21595
+ /**
21596
+ * Ids to read back WITH their vectors.
21597
+ *
21598
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21599
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21600
+ * caller depends on that promise. This one promises the opposite.
21601
+ *
21602
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21603
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21604
+ * a per-face cross-process KNN would be a network round trip inside the
21605
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21606
+ * it requires the index to hand the floats back. Without this method the only
21607
+ * way to keep a readable vector is a JSON column, which is the thing this
21608
+ * capability exists to delete.
21609
+ *
21610
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21611
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21612
+ */
21613
+ var VectorFetchInputSchema = object({
21614
+ index: string(),
21615
+ ids: array(string())
21616
+ });
21617
+ var VectorFetchResultSchema = object({ items: array(object({
21618
+ id: string(),
21619
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21620
+ vector: string(),
21621
+ metadata: VectorMetadataSchema
21622
+ })) });
21623
+ /**
21624
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21625
+ *
21626
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21627
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21628
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21629
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21630
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21631
+ * looked" for as long as anyone cared to read it.
21632
+ *
21633
+ * This is the primitive that question actually needs: a bounded page, ordered
21634
+ * by the backend's own row order, costing no distance computation at all.
21635
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21636
+ * the full-table read this capability was built to stop.
21637
+ */
21638
+ var VectorScanInputSchema = object({
21639
+ index: string(),
21640
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21641
+ cursor: number().int().nonnegative().default(0),
21642
+ limit: number().int().positive()
21643
+ });
21644
+ var VectorScanResultSchema = object({
21645
+ items: array(object({
21646
+ id: string(),
21647
+ metadata: VectorMetadataSchema
21648
+ })),
21649
+ /**
21650
+ * Where the next page starts, or `null` when the walk reached the end.
21651
+ *
21652
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21653
+ * from a short page: a backend is free to return fewer rows than asked.
21654
+ */
21655
+ nextCursor: number().int().nonnegative().nullable()
21656
+ });
21279
21657
  var VectorStatsInputSchema = object({ index: string() });
21280
21658
  var VectorStatsResultSchema = object({
21281
21659
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21294,7 +21672,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21294
21672
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21295
21673
  kind: "mutation",
21296
21674
  auth: "admin"
21297
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21675
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21298
21676
  kind: "mutation",
21299
21677
  auth: "admin"
21300
21678
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26240,6 +26618,9 @@ method(object({
26240
26618
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26241
26619
  kind: "query",
26242
26620
  auth: "admin"
26621
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26622
+ kind: "query",
26623
+ auth: "admin"
26243
26624
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26244
26625
  kind: "mutation",
26245
26626
  auth: "admin"
@@ -31615,6 +31996,18 @@ Object.freeze({
31615
31996
  addonId: null,
31616
31997
  access: "create"
31617
31998
  },
31999
+ "pipelineAnalytics.countRelocatableMedia": {
32000
+ capName: "pipeline-analytics",
32001
+ capScope: "device",
32002
+ addonId: null,
32003
+ access: "view"
32004
+ },
32005
+ "pipelineAnalytics.countUnstampedEventMedia": {
32006
+ capName: "pipeline-analytics",
32007
+ capScope: "device",
32008
+ addonId: null,
32009
+ access: "view"
32010
+ },
31618
32011
  "pipelineAnalytics.deleteDeviceEvents": {
31619
32012
  capName: "pipeline-analytics",
31620
32013
  capScope: "device",
@@ -32773,6 +33166,12 @@ Object.freeze({
32773
33166
  addonId: null,
32774
33167
  access: "view"
32775
33168
  },
33169
+ "recording.getRelocateResidue": {
33170
+ capName: "recording",
33171
+ capScope: "system",
33172
+ addonId: null,
33173
+ access: "view"
33174
+ },
32776
33175
  "recording.getStorageMigrationMoveStatus": {
32777
33176
  capName: "recording",
32778
33177
  capScope: "system",
@@ -33319,12 +33718,30 @@ Object.freeze({
33319
33718
  addonId: null,
33320
33719
  access: "create"
33321
33720
  },
33721
+ "storageMigration.drain": {
33722
+ capName: "storage-migration",
33723
+ capScope: "system",
33724
+ addonId: null,
33725
+ access: "create"
33726
+ },
33727
+ "storageMigration.movers": {
33728
+ capName: "storage-migration",
33729
+ capScope: "system",
33730
+ addonId: null,
33731
+ access: "view"
33732
+ },
33322
33733
  "storageMigration.plan": {
33323
33734
  capName: "storage-migration",
33324
33735
  capScope: "system",
33325
33736
  addonId: null,
33326
33737
  access: "view"
33327
33738
  },
33739
+ "storageMigration.residue": {
33740
+ capName: "storage-migration",
33741
+ capScope: "system",
33742
+ addonId: null,
33743
+ access: "view"
33744
+ },
33328
33745
  "storageMigration.start": {
33329
33746
  capName: "storage-migration",
33330
33747
  capScope: "system",
@@ -34159,6 +34576,12 @@ Object.freeze({
34159
34576
  addonId: null,
34160
34577
  access: "delete"
34161
34578
  },
34579
+ "vectorStore.fetchByIds": {
34580
+ capName: "vector-store",
34581
+ capScope: "system",
34582
+ addonId: null,
34583
+ access: "view"
34584
+ },
34162
34585
  "vectorStore.getByIds": {
34163
34586
  capName: "vector-store",
34164
34587
  capScope: "system",
@@ -34171,6 +34594,12 @@ Object.freeze({
34171
34594
  addonId: null,
34172
34595
  access: "view"
34173
34596
  },
34597
+ "vectorStore.scan": {
34598
+ capName: "vector-store",
34599
+ capScope: "system",
34600
+ addonId: null,
34601
+ access: "view"
34602
+ },
34174
34603
  "vectorStore.stats": {
34175
34604
  capName: "vector-store",
34176
34605
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8039,18 +8039,61 @@ var RelocateFootageInputSchema = object({
8039
8039
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8040
8040
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8041
8041
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8042
+ /**
8043
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8044
+ * mover (the engine already walks both collections with a timestamp cursor and
8045
+ * already has a stamp-without-copy path).
8046
+ *
8047
+ * - `move` — the default and the historical behaviour: event-media and
8048
+ * retrain blobs move to `toLocationId` and their rows are
8049
+ * stamped. The enrolled gallery is skipped (D197).
8050
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8051
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8052
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8053
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8054
+ * instant a repoint moves that pointer the row reads from the
8055
+ * new disk while its bytes are on the old one.
8056
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8057
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8058
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8059
+ * never run beside a live second location: it is stop-the-world
8060
+ * by construction, which is acceptable only because the gallery
8061
+ * is a few KB per enrolled sample.
8062
+ */
8063
+ var MediaRelocateModeSchema = _enum([
8064
+ "move",
8065
+ "seal",
8066
+ "gallery"
8067
+ ]);
8042
8068
  var RelocateMediaInputSchema = object({
8043
8069
  toLocationId: string(),
8044
- throttleMbps: number().min(1).max(1e3).optional()
8070
+ throttleMbps: number().min(1).max(1e3).optional(),
8071
+ /** Omitted = `move`, the pre-existing behaviour. */
8072
+ mode: MediaRelocateModeSchema.optional()
8073
+ });
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()
8045
8081
  });
8046
8082
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8047
- /** The independently selectable logical storage classes. `recordings`
8048
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8049
- * segments; `eventMedia` is post-analysis blobs. */
8083
+ /** The independently selectable logical storage classes — every class
8084
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8085
+ * Zod enum error where they should meet an explanation.
8086
+ *
8087
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8088
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8089
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8090
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8050
8091
  var StorageMigrationClassSchema = _enum([
8051
8092
  "recordings",
8052
8093
  "recordingsLow",
8053
- "eventMedia"
8094
+ "eventMedia",
8095
+ "backups",
8096
+ "galleryMedia"
8054
8097
  ]);
8055
8098
  /** A destination is always an existing, fully-qualified location id. The
8056
8099
  * migration API intentionally never changes a source location's `basePath`:
@@ -8058,20 +8101,56 @@ var StorageMigrationClassSchema = _enum([
8058
8101
  var StorageMigrationDestinationsSchema = object({
8059
8102
  recordings: string().min(1).optional(),
8060
8103
  recordingsLow: string().min(1).optional(),
8061
- eventMedia: string().min(1).optional()
8104
+ eventMedia: string().min(1).optional(),
8105
+ backups: string().min(1).optional(),
8106
+ galleryMedia: string().min(1).optional()
8062
8107
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8108
+ /**
8109
+ * How a migration sequences the cutover against the byte move.
8110
+ *
8111
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8112
+ * resume. Recording is stopped for the whole move. Right
8113
+ * for a small or a cold class, and the only legal mode for
8114
+ * a `cardinality: 'single'` class.
8115
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8116
+ * refresh, resume, then move the past with everything
8117
+ * running. The pause is three bounded instants (a detach +
8118
+ * attach round, a write-gate drain, a lease) instead of one
8119
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8120
+ * stopped recording under `blocking`; the same move is
8121
+ * seconds of stopped recording under `nonBlocking`.
8122
+ *
8123
+ * The mode is on the JOB, not only on the input, because `status` is where an
8124
+ * operator finds out which one is running.
8125
+ */
8126
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8063
8127
  /** Shared input for planning and starting an orchestrated storage migration. */
8064
8128
  var StorageMigrationInputSchema = object({
8065
8129
  destinations: StorageMigrationDestinationsSchema,
8066
- throttleMbps: number().min(1).max(1e3).optional()
8130
+ throttleMbps: number().min(1).max(1e3).optional(),
8131
+ /** Omitted = `blocking`, which stays the default. */
8132
+ mode: StorageMigrationModeSchema.optional()
8067
8133
  });
8068
- /** The durable coordinator state machine. The only phase that changes default
8069
- * locations is `repointing`, after every selected mover has completed and been
8070
- * verified. */
8134
+ /**
8135
+ * The durable coordinator state machine.
8136
+ *
8137
+ * `blocking`:
8138
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8139
+ *
8140
+ * `nonBlocking`:
8141
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8142
+ *
8143
+ * Same phases, different order plus two new ones — not a second mover.
8144
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8145
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8146
+ * `repointing` is still the only phase that changes a default location.
8147
+ */
8071
8148
  var StorageMigrationPhaseSchema = _enum([
8072
8149
  "planning",
8150
+ "sealing",
8073
8151
  "pausing",
8074
8152
  "moving",
8153
+ "draining",
8075
8154
  "verifying",
8076
8155
  "repointing",
8077
8156
  "refreshing",
@@ -8085,17 +8164,56 @@ var StorageMigrationParticipantSchema = _enum([
8085
8164
  "recorder",
8086
8165
  "analytics"
8087
8166
  ]);
8167
+ /**
8168
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8169
+ *
8170
+ * The long half of a non-blocking migration is `draining`, and it is measured
8171
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8172
+ * existed the only place those numbers appeared was a Loki line, so an operator
8173
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8174
+ * afternoon.
8175
+ *
8176
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8177
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8178
+ * mover — which is the exact failure this is meant to end. The coordinator's
8179
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8180
+ * read `state`; folding the counters costs no extra read and makes the durable
8181
+ * record say afterwards how far a move actually got.
8182
+ *
8183
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8184
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8185
+ * cannot say M, and a 0 there would render as "100 % done".
8186
+ */
8187
+ var StorageMigrationMoveProgressSchema = object({
8188
+ filesMoved: number().int().nonnegative(),
8189
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8190
+ filesTotal: number().int().nonnegative().nullable(),
8191
+ bytesMoved: number().int().nonnegative(),
8192
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8193
+ * crash gets a new mover, and a rate computed from the migration's start
8194
+ * would silently average in the time nothing was running. */
8195
+ startedAt: number(),
8196
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8197
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8198
+ * subtract its own. */
8199
+ observedAt: number()
8200
+ });
8088
8201
  var StorageMigrationMoveSchema = object({
8089
8202
  storageClass: StorageMigrationClassSchema,
8090
8203
  fromLocationId: string(),
8091
8204
  toLocationId: string(),
8092
8205
  moverJobId: string().nullable(),
8093
8206
  state: RelocateJobStateSchema.nullable(),
8094
- error: string().nullable()
8207
+ error: string().nullable(),
8208
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8209
+ progress: StorageMigrationMoveProgressSchema.nullable()
8095
8210
  });
8096
8211
  var StorageMigrationJobSchema = object({
8097
8212
  jobId: string(),
8098
8213
  phase: StorageMigrationPhaseSchema,
8214
+ /** Which order this job is running. `status` is the only place an operator
8215
+ * can tell a seconds-long cutover from a thirty-hour one. */
8216
+ mode: StorageMigrationModeSchema,
8099
8217
  destinations: StorageMigrationDestinationsSchema,
8100
8218
  throttleMbps: number(),
8101
8219
  moves: array(StorageMigrationMoveSchema),
@@ -8108,13 +8226,122 @@ var StorageMigrationJobSchema = object({
8108
8226
  finishedAt: number().nullable(),
8109
8227
  error: string().nullable()
8110
8228
  });
8229
+ var StorageMigrationFindingSchema = object({
8230
+ code: _enum([
8231
+ "sharesDeviceWithSource",
8232
+ "deviceIdentityUnknown",
8233
+ "unstampedEventMediaRows",
8234
+ "blockingOnly",
8235
+ "noMover"
8236
+ ]),
8237
+ storageClass: StorageMigrationClassSchema,
8238
+ /** Human-readable, already carrying the ids and counts. */
8239
+ message: string()
8240
+ });
8111
8241
  var StorageMigrationPlanSchema = object({
8112
8242
  destinations: StorageMigrationDestinationsSchema,
8243
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8244
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8245
+ * it. */
8246
+ mode: StorageMigrationModeSchema,
8113
8247
  moves: array(object({
8114
8248
  storageClass: StorageMigrationClassSchema,
8115
8249
  fromLocationId: string(),
8116
8250
  toLocationId: string()
8117
- }))
8251
+ })),
8252
+ findings: array(StorageMigrationFindingSchema)
8253
+ });
8254
+ /**
8255
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8256
+ *
8257
+ * The coordinator's job record is the state of record for a migration, and its
8258
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8259
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8260
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8261
+ * way because no supported UI path existed. A mover armed like that has no job
8262
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8263
+ *
8264
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8265
+ * orchestrated it.
8266
+ */
8267
+ var StorageMigrationMoverSchema = object({
8268
+ lane: _enum(["footage", "media"]),
8269
+ job: RelocateJobSchema,
8270
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8271
+ * directly against the owning addon. */
8272
+ migrationJobId: string().nullable(),
8273
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8274
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8275
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8276
+ * rate made of two different clocks. */
8277
+ observedAt: number()
8278
+ });
8279
+ /**
8280
+ * What a SOURCE still holds for one storage class — the number that makes a
8281
+ * "drain remaining" action honest rather than hopeful.
8282
+ *
8283
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8284
+ * engine's own selection count for media), never from the resident index: a
8285
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8286
+ * never been told about (D295).
8287
+ *
8288
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8289
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8290
+ * because refusing on an unanswerable read would hide exactly the case an
8291
+ * operator needs to act on.
8292
+ */
8293
+ var StorageMigrationResidueSchema = object({
8294
+ storageClass: StorageMigrationClassSchema,
8295
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8296
+ * move from wherever they are rather than from one named source. */
8297
+ fromLocationId: string(),
8298
+ /** Where a drain would move it — the class's CURRENT default. */
8299
+ toLocationId: string(),
8300
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8301
+ items: number().int().nonnegative().nullable(),
8302
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8303
+ bytes: number().int().nonnegative().nullable()
8304
+ });
8305
+ /**
8306
+ * Run the DRAIN half and nothing else.
8307
+ *
8308
+ * A migration that reached `done` has already repointed, so `start` correctly
8309
+ * refuses its destination ("already the default") — there is nothing left to
8310
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8311
+ * or finish against a work list that was a tenth of the archive (D295), and
8312
+ * before this there was no supported way to run only that half: the only way
8313
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8314
+ *
8315
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8316
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8317
+ * re-repoint a class that is already migrated.
8318
+ */
8319
+ var StorageMigrationDrainInputSchema = object({
8320
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8321
+ * a class whose source is already empty is refused rather than started. */
8322
+ classes: array(StorageMigrationClassSchema).min(1),
8323
+ throttleMbps: number().min(1).max(1e3).optional()
8324
+ });
8325
+ /** What a footage source still holds, asked of the durable hour ledger. */
8326
+ var RelocateResidueInputSchema = object({
8327
+ fromLocationId: string().min(1),
8328
+ /** Narrow to one logical class; omit for every profile on the location. */
8329
+ footageClass: RelocateFootageClassSchema.optional()
8330
+ });
8331
+ /** `null` = the archive could not answer (no ledger on this node, or the
8332
+ * aggregate failed). Never conflated with an empty source. */
8333
+ var RelocateResidueSchema = object({
8334
+ segments: number().int().nonnegative(),
8335
+ bytes: number().int().nonnegative()
8336
+ }).nullable();
8337
+ /** How many rows a media pass would still act on against a given target — the
8338
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8339
+ * never disagree. `null` = the count could not be taken. */
8340
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8341
+ var RelocatableMediaCountInputSchema = object({
8342
+ toLocationId: string().min(1),
8343
+ /** Omitted = `move`. */
8344
+ mode: MediaRelocateModeSchema.optional()
8118
8345
  });
8119
8346
  /**
8120
8347
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8220,6 +8447,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8220
8447
  * two addons declaring the same `id` must agree on `cardinality` (validated
8221
8448
  * at kernel aggregation time, not here).
8222
8449
  */
8450
+ /**
8451
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8452
+ * actually reaches the bytes. It is the constraint that decides which
8453
+ * `storage-provider`s may back a location of that kind.
8454
+ *
8455
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8456
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8457
+ * post-analysis media roots). Only a provider that serves a genuine local
8458
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8459
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8460
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8461
+ * against a same-named local directory that is something else entirely.
8462
+ *
8463
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8464
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8465
+ * service never sees a path, so any provider can back it. `backups` is the
8466
+ * one kind that qualifies today.
8467
+ *
8468
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8469
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8470
+ * refused the configuration; the first write simply went somewhere wrong, and
8471
+ * a recording write that goes wrong surfaces as a silent black window rather
8472
+ * than an error (the read path does not `stat`). This turns that accident into
8473
+ * a declared, enforced, testable refusal.
8474
+ */
8475
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8223
8476
  var StorageLocationDeclarationSchema = object({
8224
8477
  /**
8225
8478
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8239,6 +8492,19 @@ var StorageLocationDeclarationSchema = object({
8239
8492
  */
8240
8493
  cardinality: _enum(["single", "multi"]),
8241
8494
  /**
8495
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8496
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8497
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8498
+ *
8499
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8500
+ * can only over-restrict (refuse a remote provider for a kind that might
8501
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8502
+ * permissive direction and is therefore never inferred — a repo guard
8503
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8504
+ * reached by omission.
8505
+ */
8506
+ access: StorageAccessSchema.optional(),
8507
+ /**
8242
8508
  * When set, the default instance for this location inherits its resolved
8243
8509
  * root from the named location's default instance. Useful for derivative
8244
8510
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17819,8 +18085,10 @@ var TrackSchema = object({
17819
18085
  lastSeen: number(),
17820
18086
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17821
18087
  positions: array(TrackPositionSchema).readonly(),
17822
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17823
- * saveThumbnails policy). */
18088
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18089
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18090
+ * the retired `saveThumbnails` used to gate this and the rolling
18091
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17824
18092
  snapshots: array(TrackSnapshotSchema).readonly(),
17825
18093
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17826
18094
  zonesVisited: array(string()).readonly(),
@@ -18680,6 +18948,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18680
18948
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18681
18949
  kind: "mutation",
18682
18950
  auth: "admin"
18951
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
18952
+ kind: "query",
18953
+ auth: "admin"
18683
18954
  }), method(object({}), array(RelocateJobSchema).readonly(), {
18684
18955
  kind: "query",
18685
18956
  auth: "admin"
@@ -20691,7 +20962,10 @@ method(object({
20691
20962
  }), StorageLocationSchema, {
20692
20963
  kind: "mutation",
20693
20964
  auth: "admin"
20694
- }), method(object({ id: string() }), _void(), {
20965
+ }), method(object({
20966
+ id: string(),
20967
+ force: boolean().optional()
20968
+ }), _void(), {
20695
20969
  kind: "mutation",
20696
20970
  auth: "admin"
20697
20971
  }), method(object({ id: string() }), object({
@@ -20740,6 +21014,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20740
21014
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20741
21015
  kind: "mutation",
20742
21016
  auth: "admin"
21017
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21018
+ kind: "mutation",
21019
+ auth: "admin"
20743
21020
  });
20744
21021
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20745
21022
  providerId: string().min(1),
@@ -21138,12 +21415,38 @@ response: record(string(), unknown()) }), object({
21138
21415
  *
21139
21416
  * ## Why this is a capability and not a helper
21140
21417
  *
21141
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21142
- * plate, vehicle, identity, and the event store's derivativesand every one of
21143
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21144
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21145
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21146
- * load 5,000 rows before ranking anything.
21418
+ * This capability was introduced with the claim that SIX stores in
21419
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21420
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21421
+ * claim was never true, and leaving it here made five stores look like pending
21422
+ * work when three of them have no vector at all. Counted column by column on
21423
+ * 2026-08-30, exactly THREE ever held one:
21424
+ *
21425
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21426
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21427
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21428
+ * face, migrated 2026-08-30 into its OWN index (see below).
21429
+ *
21430
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21431
+ * and `identities` store a name; the event store stores no derivative vector.
21432
+ * They are not migration candidates and never were.
21433
+ *
21434
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21435
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21436
+ * rows before ranking anything.
21437
+ *
21438
+ * ## One index per COMPARISON, never per encoder
21439
+ *
21440
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21441
+ * model, and they still get two indexes. An index is a set of things that are
21442
+ * ranked against each other and that live and die together, and these two are
21443
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21444
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21445
+ * forever and is the gallery every recognition ranks against. One index would
21446
+ * mean every gallery load and every reconcile carried a filter whose failure
21447
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21448
+ * person's only sample. The dimension they share is not a reason to share an
21449
+ * index; the question they answer is, and it differs.
21147
21450
  *
21148
21451
  * The fix is not a faster loop, it is a different backend — and the backend
21149
21452
  * should be replaceable without touching six callers. So: a singleton
@@ -21248,7 +21551,20 @@ var VectorQueryResultSchema = object({
21248
21551
  */
21249
21552
  scanned: number(),
21250
21553
  /** True when the backend could not consider every row that passed the filter. */
21251
- truncated: boolean()
21554
+ truncated: boolean(),
21555
+ /**
21556
+ * The `topK` the backend actually ran with.
21557
+ *
21558
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21559
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21560
+ * own log rather than in its answer. That is how an audit asking for 20,000
21561
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21562
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21563
+ * MUCH, in the return value, where the caller cannot fail to see it.
21564
+ *
21565
+ * Equals the requested `topK` whenever nothing was lowered.
21566
+ */
21567
+ effectiveTopK: number().int().positive()
21252
21568
  });
21253
21569
  var VectorDeleteInputSchema = object({
21254
21570
  index: string(),
@@ -21277,6 +21593,68 @@ var VectorGetResultSchema = object({ items: array(object({
21277
21593
  id: string(),
21278
21594
  metadata: VectorMetadataSchema
21279
21595
  })) });
21596
+ /**
21597
+ * Ids to read back WITH their vectors.
21598
+ *
21599
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21600
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21601
+ * caller depends on that promise. This one promises the opposite.
21602
+ *
21603
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21604
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21605
+ * a per-face cross-process KNN would be a network round trip inside the
21606
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21607
+ * it requires the index to hand the floats back. Without this method the only
21608
+ * way to keep a readable vector is a JSON column, which is the thing this
21609
+ * capability exists to delete.
21610
+ *
21611
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21612
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21613
+ */
21614
+ var VectorFetchInputSchema = object({
21615
+ index: string(),
21616
+ ids: array(string())
21617
+ });
21618
+ var VectorFetchResultSchema = object({ items: array(object({
21619
+ id: string(),
21620
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21621
+ vector: string(),
21622
+ metadata: VectorMetadataSchema
21623
+ })) });
21624
+ /**
21625
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21626
+ *
21627
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21628
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21629
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21630
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21631
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21632
+ * looked" for as long as anyone cared to read it.
21633
+ *
21634
+ * This is the primitive that question actually needs: a bounded page, ordered
21635
+ * by the backend's own row order, costing no distance computation at all.
21636
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21637
+ * the full-table read this capability was built to stop.
21638
+ */
21639
+ var VectorScanInputSchema = object({
21640
+ index: string(),
21641
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21642
+ cursor: number().int().nonnegative().default(0),
21643
+ limit: number().int().positive()
21644
+ });
21645
+ var VectorScanResultSchema = object({
21646
+ items: array(object({
21647
+ id: string(),
21648
+ metadata: VectorMetadataSchema
21649
+ })),
21650
+ /**
21651
+ * Where the next page starts, or `null` when the walk reached the end.
21652
+ *
21653
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21654
+ * from a short page: a backend is free to return fewer rows than asked.
21655
+ */
21656
+ nextCursor: number().int().nonnegative().nullable()
21657
+ });
21280
21658
  var VectorStatsInputSchema = object({ index: string() });
21281
21659
  var VectorStatsResultSchema = object({
21282
21660
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21295,7 +21673,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21295
21673
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21296
21674
  kind: "mutation",
21297
21675
  auth: "admin"
21298
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21676
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21299
21677
  kind: "mutation",
21300
21678
  auth: "admin"
21301
21679
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26241,6 +26619,9 @@ method(object({
26241
26619
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26242
26620
  kind: "query",
26243
26621
  auth: "admin"
26622
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26623
+ kind: "query",
26624
+ auth: "admin"
26244
26625
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26245
26626
  kind: "mutation",
26246
26627
  auth: "admin"
@@ -31616,6 +31997,18 @@ Object.freeze({
31616
31997
  addonId: null,
31617
31998
  access: "create"
31618
31999
  },
32000
+ "pipelineAnalytics.countRelocatableMedia": {
32001
+ capName: "pipeline-analytics",
32002
+ capScope: "device",
32003
+ addonId: null,
32004
+ access: "view"
32005
+ },
32006
+ "pipelineAnalytics.countUnstampedEventMedia": {
32007
+ capName: "pipeline-analytics",
32008
+ capScope: "device",
32009
+ addonId: null,
32010
+ access: "view"
32011
+ },
31619
32012
  "pipelineAnalytics.deleteDeviceEvents": {
31620
32013
  capName: "pipeline-analytics",
31621
32014
  capScope: "device",
@@ -32774,6 +33167,12 @@ Object.freeze({
32774
33167
  addonId: null,
32775
33168
  access: "view"
32776
33169
  },
33170
+ "recording.getRelocateResidue": {
33171
+ capName: "recording",
33172
+ capScope: "system",
33173
+ addonId: null,
33174
+ access: "view"
33175
+ },
32777
33176
  "recording.getStorageMigrationMoveStatus": {
32778
33177
  capName: "recording",
32779
33178
  capScope: "system",
@@ -33320,12 +33719,30 @@ Object.freeze({
33320
33719
  addonId: null,
33321
33720
  access: "create"
33322
33721
  },
33722
+ "storageMigration.drain": {
33723
+ capName: "storage-migration",
33724
+ capScope: "system",
33725
+ addonId: null,
33726
+ access: "create"
33727
+ },
33728
+ "storageMigration.movers": {
33729
+ capName: "storage-migration",
33730
+ capScope: "system",
33731
+ addonId: null,
33732
+ access: "view"
33733
+ },
33323
33734
  "storageMigration.plan": {
33324
33735
  capName: "storage-migration",
33325
33736
  capScope: "system",
33326
33737
  addonId: null,
33327
33738
  access: "view"
33328
33739
  },
33740
+ "storageMigration.residue": {
33741
+ capName: "storage-migration",
33742
+ capScope: "system",
33743
+ addonId: null,
33744
+ access: "view"
33745
+ },
33329
33746
  "storageMigration.start": {
33330
33747
  capName: "storage-migration",
33331
33748
  capScope: "system",
@@ -34160,6 +34577,12 @@ Object.freeze({
34160
34577
  addonId: null,
34161
34578
  access: "delete"
34162
34579
  },
34580
+ "vectorStore.fetchByIds": {
34581
+ capName: "vector-store",
34582
+ capScope: "system",
34583
+ addonId: null,
34584
+ access: "view"
34585
+ },
34163
34586
  "vectorStore.getByIds": {
34164
34587
  capName: "vector-store",
34165
34588
  capScope: "system",
@@ -34172,6 +34595,12 @@ Object.freeze({
34172
34595
  addonId: null,
34173
34596
  access: "view"
34174
34597
  },
34598
+ "vectorStore.scan": {
34599
+ capName: "vector-store",
34600
+ capScope: "system",
34601
+ addonId: null,
34602
+ access: "view"
34603
+ },
34175
34604
  "vectorStore.stats": {
34176
34605
  capName: "vector-store",
34177
34606
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-onvif",
3
- "version": "1.2.41",
3
+ "version": "1.2.44",
4
4
  "description": "ONVIF camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",