@camstack/addon-provider-wyze 0.2.46 → 0.2.49

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
@@ -8071,18 +8071,61 @@ var RelocateFootageInputSchema = object({
8071
8071
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8072
8072
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8073
8073
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8074
+ /**
8075
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8076
+ * mover (the engine already walks both collections with a timestamp cursor and
8077
+ * already has a stamp-without-copy path).
8078
+ *
8079
+ * - `move` — the default and the historical behaviour: event-media and
8080
+ * retrain blobs move to `toLocationId` and their rows are
8081
+ * stamped. The enrolled gallery is skipped (D197).
8082
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8083
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8084
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8085
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8086
+ * instant a repoint moves that pointer the row reads from the
8087
+ * new disk while its bytes are on the old one.
8088
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8089
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8090
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8091
+ * never run beside a live second location: it is stop-the-world
8092
+ * by construction, which is acceptable only because the gallery
8093
+ * is a few KB per enrolled sample.
8094
+ */
8095
+ var MediaRelocateModeSchema = _enum([
8096
+ "move",
8097
+ "seal",
8098
+ "gallery"
8099
+ ]);
8074
8100
  var RelocateMediaInputSchema = object({
8075
8101
  toLocationId: string(),
8076
- throttleMbps: number().min(1).max(1e3).optional()
8102
+ throttleMbps: number().min(1).max(1e3).optional(),
8103
+ /** Omitted = `move`, the pre-existing behaviour. */
8104
+ mode: MediaRelocateModeSchema.optional()
8105
+ });
8106
+ /** How many rows still carry NO `locationId` — the population a repoint would
8107
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8108
+ * value that permits a non-blocking `eventMedia` cutover. */
8109
+ var UnstampedEventMediaCountSchema = object({
8110
+ media: number().int().nonnegative(),
8111
+ retrainFrames: number().int().nonnegative(),
8112
+ total: number().int().nonnegative()
8077
8113
  });
8078
8114
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8079
- /** The independently selectable logical storage classes. `recordings`
8080
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8081
- * segments; `eventMedia` is post-analysis blobs. */
8115
+ /** The independently selectable logical storage classes — every class
8116
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8117
+ * Zod enum error where they should meet an explanation.
8118
+ *
8119
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8120
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8121
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8122
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8082
8123
  var StorageMigrationClassSchema = _enum([
8083
8124
  "recordings",
8084
8125
  "recordingsLow",
8085
- "eventMedia"
8126
+ "eventMedia",
8127
+ "backups",
8128
+ "galleryMedia"
8086
8129
  ]);
8087
8130
  /** A destination is always an existing, fully-qualified location id. The
8088
8131
  * migration API intentionally never changes a source location's `basePath`:
@@ -8090,20 +8133,56 @@ var StorageMigrationClassSchema = _enum([
8090
8133
  var StorageMigrationDestinationsSchema = object({
8091
8134
  recordings: string().min(1).optional(),
8092
8135
  recordingsLow: string().min(1).optional(),
8093
- eventMedia: string().min(1).optional()
8136
+ eventMedia: string().min(1).optional(),
8137
+ backups: string().min(1).optional(),
8138
+ galleryMedia: string().min(1).optional()
8094
8139
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8140
+ /**
8141
+ * How a migration sequences the cutover against the byte move.
8142
+ *
8143
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8144
+ * resume. Recording is stopped for the whole move. Right
8145
+ * for a small or a cold class, and the only legal mode for
8146
+ * a `cardinality: 'single'` class.
8147
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8148
+ * refresh, resume, then move the past with everything
8149
+ * running. The pause is three bounded instants (a detach +
8150
+ * attach round, a write-gate drain, a lease) instead of one
8151
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8152
+ * stopped recording under `blocking`; the same move is
8153
+ * seconds of stopped recording under `nonBlocking`.
8154
+ *
8155
+ * The mode is on the JOB, not only on the input, because `status` is where an
8156
+ * operator finds out which one is running.
8157
+ */
8158
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8095
8159
  /** Shared input for planning and starting an orchestrated storage migration. */
8096
8160
  var StorageMigrationInputSchema = object({
8097
8161
  destinations: StorageMigrationDestinationsSchema,
8098
- throttleMbps: number().min(1).max(1e3).optional()
8162
+ throttleMbps: number().min(1).max(1e3).optional(),
8163
+ /** Omitted = `blocking`, which stays the default. */
8164
+ mode: StorageMigrationModeSchema.optional()
8099
8165
  });
8100
- /** The durable coordinator state machine. The only phase that changes default
8101
- * locations is `repointing`, after every selected mover has completed and been
8102
- * verified. */
8166
+ /**
8167
+ * The durable coordinator state machine.
8168
+ *
8169
+ * `blocking`:
8170
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8171
+ *
8172
+ * `nonBlocking`:
8173
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8174
+ *
8175
+ * Same phases, different order plus two new ones — not a second mover.
8176
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8177
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8178
+ * `repointing` is still the only phase that changes a default location.
8179
+ */
8103
8180
  var StorageMigrationPhaseSchema = _enum([
8104
8181
  "planning",
8182
+ "sealing",
8105
8183
  "pausing",
8106
8184
  "moving",
8185
+ "draining",
8107
8186
  "verifying",
8108
8187
  "repointing",
8109
8188
  "refreshing",
@@ -8117,17 +8196,56 @@ var StorageMigrationParticipantSchema = _enum([
8117
8196
  "recorder",
8118
8197
  "analytics"
8119
8198
  ]);
8199
+ /**
8200
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8201
+ *
8202
+ * The long half of a non-blocking migration is `draining`, and it is measured
8203
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8204
+ * existed the only place those numbers appeared was a Loki line, so an operator
8205
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8206
+ * afternoon.
8207
+ *
8208
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8209
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8210
+ * mover — which is the exact failure this is meant to end. The coordinator's
8211
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8212
+ * read `state`; folding the counters costs no extra read and makes the durable
8213
+ * record say afterwards how far a move actually got.
8214
+ *
8215
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8216
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8217
+ * cannot say M, and a 0 there would render as "100 % done".
8218
+ */
8219
+ var StorageMigrationMoveProgressSchema = object({
8220
+ filesMoved: number().int().nonnegative(),
8221
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8222
+ filesTotal: number().int().nonnegative().nullable(),
8223
+ bytesMoved: number().int().nonnegative(),
8224
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8225
+ * crash gets a new mover, and a rate computed from the migration's start
8226
+ * would silently average in the time nothing was running. */
8227
+ startedAt: number(),
8228
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8229
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8230
+ * subtract its own. */
8231
+ observedAt: number()
8232
+ });
8120
8233
  var StorageMigrationMoveSchema = object({
8121
8234
  storageClass: StorageMigrationClassSchema,
8122
8235
  fromLocationId: string(),
8123
8236
  toLocationId: string(),
8124
8237
  moverJobId: string().nullable(),
8125
8238
  state: RelocateJobStateSchema.nullable(),
8126
- error: string().nullable()
8239
+ error: string().nullable(),
8240
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8241
+ progress: StorageMigrationMoveProgressSchema.nullable()
8127
8242
  });
8128
8243
  var StorageMigrationJobSchema = object({
8129
8244
  jobId: string(),
8130
8245
  phase: StorageMigrationPhaseSchema,
8246
+ /** Which order this job is running. `status` is the only place an operator
8247
+ * can tell a seconds-long cutover from a thirty-hour one. */
8248
+ mode: StorageMigrationModeSchema,
8131
8249
  destinations: StorageMigrationDestinationsSchema,
8132
8250
  throttleMbps: number(),
8133
8251
  moves: array(StorageMigrationMoveSchema),
@@ -8140,13 +8258,122 @@ var StorageMigrationJobSchema = object({
8140
8258
  finishedAt: number().nullable(),
8141
8259
  error: string().nullable()
8142
8260
  });
8261
+ var StorageMigrationFindingSchema = object({
8262
+ code: _enum([
8263
+ "sharesDeviceWithSource",
8264
+ "deviceIdentityUnknown",
8265
+ "unstampedEventMediaRows",
8266
+ "blockingOnly",
8267
+ "noMover"
8268
+ ]),
8269
+ storageClass: StorageMigrationClassSchema,
8270
+ /** Human-readable, already carrying the ids and counts. */
8271
+ message: string()
8272
+ });
8143
8273
  var StorageMigrationPlanSchema = object({
8144
8274
  destinations: StorageMigrationDestinationsSchema,
8275
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8276
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8277
+ * it. */
8278
+ mode: StorageMigrationModeSchema,
8145
8279
  moves: array(object({
8146
8280
  storageClass: StorageMigrationClassSchema,
8147
8281
  fromLocationId: string(),
8148
8282
  toLocationId: string()
8149
- }))
8283
+ })),
8284
+ findings: array(StorageMigrationFindingSchema)
8285
+ });
8286
+ /**
8287
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8288
+ *
8289
+ * The coordinator's job record is the state of record for a migration, and its
8290
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8291
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8292
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8293
+ * way because no supported UI path existed. A mover armed like that has no job
8294
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8295
+ *
8296
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8297
+ * orchestrated it.
8298
+ */
8299
+ var StorageMigrationMoverSchema = object({
8300
+ lane: _enum(["footage", "media"]),
8301
+ job: RelocateJobSchema,
8302
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8303
+ * directly against the owning addon. */
8304
+ migrationJobId: string().nullable(),
8305
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8306
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8307
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8308
+ * rate made of two different clocks. */
8309
+ observedAt: number()
8310
+ });
8311
+ /**
8312
+ * What a SOURCE still holds for one storage class — the number that makes a
8313
+ * "drain remaining" action honest rather than hopeful.
8314
+ *
8315
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8316
+ * engine's own selection count for media), never from the resident index: a
8317
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8318
+ * never been told about (D295).
8319
+ *
8320
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8321
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8322
+ * because refusing on an unanswerable read would hide exactly the case an
8323
+ * operator needs to act on.
8324
+ */
8325
+ var StorageMigrationResidueSchema = object({
8326
+ storageClass: StorageMigrationClassSchema,
8327
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8328
+ * move from wherever they are rather than from one named source. */
8329
+ fromLocationId: string(),
8330
+ /** Where a drain would move it — the class's CURRENT default. */
8331
+ toLocationId: string(),
8332
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8333
+ items: number().int().nonnegative().nullable(),
8334
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8335
+ bytes: number().int().nonnegative().nullable()
8336
+ });
8337
+ /**
8338
+ * Run the DRAIN half and nothing else.
8339
+ *
8340
+ * A migration that reached `done` has already repointed, so `start` correctly
8341
+ * refuses its destination ("already the default") — there is nothing left to
8342
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8343
+ * or finish against a work list that was a tenth of the archive (D295), and
8344
+ * before this there was no supported way to run only that half: the only way
8345
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8346
+ *
8347
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8348
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8349
+ * re-repoint a class that is already migrated.
8350
+ */
8351
+ var StorageMigrationDrainInputSchema = object({
8352
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8353
+ * a class whose source is already empty is refused rather than started. */
8354
+ classes: array(StorageMigrationClassSchema).min(1),
8355
+ throttleMbps: number().min(1).max(1e3).optional()
8356
+ });
8357
+ /** What a footage source still holds, asked of the durable hour ledger. */
8358
+ var RelocateResidueInputSchema = object({
8359
+ fromLocationId: string().min(1),
8360
+ /** Narrow to one logical class; omit for every profile on the location. */
8361
+ footageClass: RelocateFootageClassSchema.optional()
8362
+ });
8363
+ /** `null` = the archive could not answer (no ledger on this node, or the
8364
+ * aggregate failed). Never conflated with an empty source. */
8365
+ var RelocateResidueSchema = object({
8366
+ segments: number().int().nonnegative(),
8367
+ bytes: number().int().nonnegative()
8368
+ }).nullable();
8369
+ /** How many rows a media pass would still act on against a given target — the
8370
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8371
+ * never disagree. `null` = the count could not be taken. */
8372
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8373
+ var RelocatableMediaCountInputSchema = object({
8374
+ toLocationId: string().min(1),
8375
+ /** Omitted = `move`. */
8376
+ mode: MediaRelocateModeSchema.optional()
8150
8377
  });
8151
8378
  /**
8152
8379
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8252,6 +8479,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8252
8479
  * two addons declaring the same `id` must agree on `cardinality` (validated
8253
8480
  * at kernel aggregation time, not here).
8254
8481
  */
8482
+ /**
8483
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8484
+ * actually reaches the bytes. It is the constraint that decides which
8485
+ * `storage-provider`s may back a location of that kind.
8486
+ *
8487
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8488
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8489
+ * post-analysis media roots). Only a provider that serves a genuine local
8490
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8491
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8492
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8493
+ * against a same-named local directory that is something else entirely.
8494
+ *
8495
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8496
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8497
+ * service never sees a path, so any provider can back it. `backups` is the
8498
+ * one kind that qualifies today.
8499
+ *
8500
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8501
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8502
+ * refused the configuration; the first write simply went somewhere wrong, and
8503
+ * a recording write that goes wrong surfaces as a silent black window rather
8504
+ * than an error (the read path does not `stat`). This turns that accident into
8505
+ * a declared, enforced, testable refusal.
8506
+ */
8507
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8255
8508
  var StorageLocationDeclarationSchema = object({
8256
8509
  /**
8257
8510
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8271,6 +8524,19 @@ var StorageLocationDeclarationSchema = object({
8271
8524
  */
8272
8525
  cardinality: _enum(["single", "multi"]),
8273
8526
  /**
8527
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8528
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8529
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8530
+ *
8531
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8532
+ * can only over-restrict (refuse a remote provider for a kind that might
8533
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8534
+ * permissive direction and is therefore never inferred — a repo guard
8535
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8536
+ * reached by omission.
8537
+ */
8538
+ access: StorageAccessSchema.optional(),
8539
+ /**
8274
8540
  * When set, the default instance for this location inherits its resolved
8275
8541
  * root from the named location's default instance. Useful for derivative
8276
8542
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18155,8 +18421,10 @@ var TrackSchema = object({
18155
18421
  lastSeen: number(),
18156
18422
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18157
18423
  positions: array(TrackPositionSchema).readonly(),
18158
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18159
- * saveThumbnails policy). */
18424
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18425
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18426
+ * the retired `saveThumbnails` used to gate this and the rolling
18427
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18160
18428
  snapshots: array(TrackSnapshotSchema).readonly(),
18161
18429
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18162
18430
  zonesVisited: array(string()).readonly(),
@@ -19016,6 +19284,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19016
19284
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19017
19285
  kind: "mutation",
19018
19286
  auth: "admin"
19287
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19288
+ kind: "query",
19289
+ auth: "admin"
19019
19290
  }), method(object({}), array(RelocateJobSchema).readonly(), {
19020
19291
  kind: "query",
19021
19292
  auth: "admin"
@@ -21027,7 +21298,10 @@ method(object({
21027
21298
  }), StorageLocationSchema, {
21028
21299
  kind: "mutation",
21029
21300
  auth: "admin"
21030
- }), method(object({ id: string() }), _void(), {
21301
+ }), method(object({
21302
+ id: string(),
21303
+ force: boolean().optional()
21304
+ }), _void(), {
21031
21305
  kind: "mutation",
21032
21306
  auth: "admin"
21033
21307
  }), method(object({ id: string() }), object({
@@ -21076,6 +21350,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21076
21350
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21077
21351
  kind: "mutation",
21078
21352
  auth: "admin"
21353
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21354
+ kind: "mutation",
21355
+ auth: "admin"
21079
21356
  });
21080
21357
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21081
21358
  providerId: string().min(1),
@@ -21474,12 +21751,38 @@ response: record(string(), unknown()) }), object({
21474
21751
  *
21475
21752
  * ## Why this is a capability and not a helper
21476
21753
  *
21477
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21478
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21479
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21480
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21481
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21482
- * load 5,000 rows before ranking anything.
21754
+ * This capability was introduced with the claim that SIX stores in
21755
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21756
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21757
+ * claim was never true, and leaving it here made five stores look like pending
21758
+ * work when three of them have no vector at all. Counted column by column on
21759
+ * 2026-08-30, exactly THREE ever held one:
21760
+ *
21761
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21762
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21763
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21764
+ * face, migrated 2026-08-30 into its OWN index (see below).
21765
+ *
21766
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21767
+ * and `identities` store a name; the event store stores no derivative vector.
21768
+ * They are not migration candidates and never were.
21769
+ *
21770
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21771
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21772
+ * rows before ranking anything.
21773
+ *
21774
+ * ## One index per COMPARISON, never per encoder
21775
+ *
21776
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21777
+ * model, and they still get two indexes. An index is a set of things that are
21778
+ * ranked against each other and that live and die together, and these two are
21779
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21780
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21781
+ * forever and is the gallery every recognition ranks against. One index would
21782
+ * mean every gallery load and every reconcile carried a filter whose failure
21783
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21784
+ * person's only sample. The dimension they share is not a reason to share an
21785
+ * index; the question they answer is, and it differs.
21483
21786
  *
21484
21787
  * The fix is not a faster loop, it is a different backend — and the backend
21485
21788
  * should be replaceable without touching six callers. So: a singleton
@@ -21584,7 +21887,20 @@ var VectorQueryResultSchema = object({
21584
21887
  */
21585
21888
  scanned: number(),
21586
21889
  /** True when the backend could not consider every row that passed the filter. */
21587
- truncated: boolean()
21890
+ truncated: boolean(),
21891
+ /**
21892
+ * The `topK` the backend actually ran with.
21893
+ *
21894
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21895
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21896
+ * own log rather than in its answer. That is how an audit asking for 20,000
21897
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21898
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21899
+ * MUCH, in the return value, where the caller cannot fail to see it.
21900
+ *
21901
+ * Equals the requested `topK` whenever nothing was lowered.
21902
+ */
21903
+ effectiveTopK: number().int().positive()
21588
21904
  });
21589
21905
  var VectorDeleteInputSchema = object({
21590
21906
  index: string(),
@@ -21613,6 +21929,68 @@ var VectorGetResultSchema = object({ items: array(object({
21613
21929
  id: string(),
21614
21930
  metadata: VectorMetadataSchema
21615
21931
  })) });
21932
+ /**
21933
+ * Ids to read back WITH their vectors.
21934
+ *
21935
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21936
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21937
+ * caller depends on that promise. This one promises the opposite.
21938
+ *
21939
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21940
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21941
+ * a per-face cross-process KNN would be a network round trip inside the
21942
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21943
+ * it requires the index to hand the floats back. Without this method the only
21944
+ * way to keep a readable vector is a JSON column, which is the thing this
21945
+ * capability exists to delete.
21946
+ *
21947
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21948
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21949
+ */
21950
+ var VectorFetchInputSchema = object({
21951
+ index: string(),
21952
+ ids: array(string())
21953
+ });
21954
+ var VectorFetchResultSchema = object({ items: array(object({
21955
+ id: string(),
21956
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21957
+ vector: string(),
21958
+ metadata: VectorMetadataSchema
21959
+ })) });
21960
+ /**
21961
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21962
+ *
21963
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21964
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21965
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21966
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21967
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21968
+ * looked" for as long as anyone cared to read it.
21969
+ *
21970
+ * This is the primitive that question actually needs: a bounded page, ordered
21971
+ * by the backend's own row order, costing no distance computation at all.
21972
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21973
+ * the full-table read this capability was built to stop.
21974
+ */
21975
+ var VectorScanInputSchema = object({
21976
+ index: string(),
21977
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21978
+ cursor: number().int().nonnegative().default(0),
21979
+ limit: number().int().positive()
21980
+ });
21981
+ var VectorScanResultSchema = object({
21982
+ items: array(object({
21983
+ id: string(),
21984
+ metadata: VectorMetadataSchema
21985
+ })),
21986
+ /**
21987
+ * Where the next page starts, or `null` when the walk reached the end.
21988
+ *
21989
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21990
+ * from a short page: a backend is free to return fewer rows than asked.
21991
+ */
21992
+ nextCursor: number().int().nonnegative().nullable()
21993
+ });
21616
21994
  var VectorStatsInputSchema = object({ index: string() });
21617
21995
  var VectorStatsResultSchema = object({
21618
21996
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21631,7 +22009,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21631
22009
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21632
22010
  kind: "mutation",
21633
22011
  auth: "admin"
21634
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22012
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21635
22013
  kind: "mutation",
21636
22014
  auth: "admin"
21637
22015
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28258,6 +28636,9 @@ method(object({
28258
28636
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28259
28637
  kind: "query",
28260
28638
  auth: "admin"
28639
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28640
+ kind: "query",
28641
+ auth: "admin"
28261
28642
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28262
28643
  kind: "mutation",
28263
28644
  auth: "admin"
@@ -34892,6 +35273,18 @@ Object.freeze({
34892
35273
  addonId: null,
34893
35274
  access: "create"
34894
35275
  },
35276
+ "pipelineAnalytics.countRelocatableMedia": {
35277
+ capName: "pipeline-analytics",
35278
+ capScope: "device",
35279
+ addonId: null,
35280
+ access: "view"
35281
+ },
35282
+ "pipelineAnalytics.countUnstampedEventMedia": {
35283
+ capName: "pipeline-analytics",
35284
+ capScope: "device",
35285
+ addonId: null,
35286
+ access: "view"
35287
+ },
34895
35288
  "pipelineAnalytics.deleteDeviceEvents": {
34896
35289
  capName: "pipeline-analytics",
34897
35290
  capScope: "device",
@@ -36050,6 +36443,12 @@ Object.freeze({
36050
36443
  addonId: null,
36051
36444
  access: "view"
36052
36445
  },
36446
+ "recording.getRelocateResidue": {
36447
+ capName: "recording",
36448
+ capScope: "system",
36449
+ addonId: null,
36450
+ access: "view"
36451
+ },
36053
36452
  "recording.getStorageMigrationMoveStatus": {
36054
36453
  capName: "recording",
36055
36454
  capScope: "system",
@@ -36596,12 +36995,30 @@ Object.freeze({
36596
36995
  addonId: null,
36597
36996
  access: "create"
36598
36997
  },
36998
+ "storageMigration.drain": {
36999
+ capName: "storage-migration",
37000
+ capScope: "system",
37001
+ addonId: null,
37002
+ access: "create"
37003
+ },
37004
+ "storageMigration.movers": {
37005
+ capName: "storage-migration",
37006
+ capScope: "system",
37007
+ addonId: null,
37008
+ access: "view"
37009
+ },
36599
37010
  "storageMigration.plan": {
36600
37011
  capName: "storage-migration",
36601
37012
  capScope: "system",
36602
37013
  addonId: null,
36603
37014
  access: "view"
36604
37015
  },
37016
+ "storageMigration.residue": {
37017
+ capName: "storage-migration",
37018
+ capScope: "system",
37019
+ addonId: null,
37020
+ access: "view"
37021
+ },
36605
37022
  "storageMigration.start": {
36606
37023
  capName: "storage-migration",
36607
37024
  capScope: "system",
@@ -37436,6 +37853,12 @@ Object.freeze({
37436
37853
  addonId: null,
37437
37854
  access: "delete"
37438
37855
  },
37856
+ "vectorStore.fetchByIds": {
37857
+ capName: "vector-store",
37858
+ capScope: "system",
37859
+ addonId: null,
37860
+ access: "view"
37861
+ },
37439
37862
  "vectorStore.getByIds": {
37440
37863
  capName: "vector-store",
37441
37864
  capScope: "system",
@@ -37448,6 +37871,12 @@ Object.freeze({
37448
37871
  addonId: null,
37449
37872
  access: "view"
37450
37873
  },
37874
+ "vectorStore.scan": {
37875
+ capName: "vector-store",
37876
+ capScope: "system",
37877
+ addonId: null,
37878
+ access: "view"
37879
+ },
37451
37880
  "vectorStore.stats": {
37452
37881
  capName: "vector-store",
37453
37882
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8050,18 +8050,61 @@ var RelocateFootageInputSchema = object({
8050
8050
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8051
8051
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8052
8052
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8053
+ /**
8054
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8055
+ * mover (the engine already walks both collections with a timestamp cursor and
8056
+ * already has a stamp-without-copy path).
8057
+ *
8058
+ * - `move` — the default and the historical behaviour: event-media and
8059
+ * retrain blobs move to `toLocationId` and their rows are
8060
+ * stamped. The enrolled gallery is skipped (D197).
8061
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8062
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8063
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8064
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8065
+ * instant a repoint moves that pointer the row reads from the
8066
+ * new disk while its bytes are on the old one.
8067
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8068
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8069
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8070
+ * never run beside a live second location: it is stop-the-world
8071
+ * by construction, which is acceptable only because the gallery
8072
+ * is a few KB per enrolled sample.
8073
+ */
8074
+ var MediaRelocateModeSchema = _enum([
8075
+ "move",
8076
+ "seal",
8077
+ "gallery"
8078
+ ]);
8053
8079
  var RelocateMediaInputSchema = object({
8054
8080
  toLocationId: string(),
8055
- throttleMbps: number().min(1).max(1e3).optional()
8081
+ throttleMbps: number().min(1).max(1e3).optional(),
8082
+ /** Omitted = `move`, the pre-existing behaviour. */
8083
+ mode: MediaRelocateModeSchema.optional()
8084
+ });
8085
+ /** How many rows still carry NO `locationId` — the population a repoint would
8086
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8087
+ * value that permits a non-blocking `eventMedia` cutover. */
8088
+ var UnstampedEventMediaCountSchema = object({
8089
+ media: number().int().nonnegative(),
8090
+ retrainFrames: number().int().nonnegative(),
8091
+ total: number().int().nonnegative()
8056
8092
  });
8057
8093
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8058
- /** The independently selectable logical storage classes. `recordings`
8059
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8060
- * segments; `eventMedia` is post-analysis blobs. */
8094
+ /** The independently selectable logical storage classes — every class
8095
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8096
+ * Zod enum error where they should meet an explanation.
8097
+ *
8098
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8099
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8100
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8101
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8061
8102
  var StorageMigrationClassSchema = _enum([
8062
8103
  "recordings",
8063
8104
  "recordingsLow",
8064
- "eventMedia"
8105
+ "eventMedia",
8106
+ "backups",
8107
+ "galleryMedia"
8065
8108
  ]);
8066
8109
  /** A destination is always an existing, fully-qualified location id. The
8067
8110
  * migration API intentionally never changes a source location's `basePath`:
@@ -8069,20 +8112,56 @@ var StorageMigrationClassSchema = _enum([
8069
8112
  var StorageMigrationDestinationsSchema = object({
8070
8113
  recordings: string().min(1).optional(),
8071
8114
  recordingsLow: string().min(1).optional(),
8072
- eventMedia: string().min(1).optional()
8115
+ eventMedia: string().min(1).optional(),
8116
+ backups: string().min(1).optional(),
8117
+ galleryMedia: string().min(1).optional()
8073
8118
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8119
+ /**
8120
+ * How a migration sequences the cutover against the byte move.
8121
+ *
8122
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8123
+ * resume. Recording is stopped for the whole move. Right
8124
+ * for a small or a cold class, and the only legal mode for
8125
+ * a `cardinality: 'single'` class.
8126
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8127
+ * refresh, resume, then move the past with everything
8128
+ * running. The pause is three bounded instants (a detach +
8129
+ * attach round, a write-gate drain, a lease) instead of one
8130
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8131
+ * stopped recording under `blocking`; the same move is
8132
+ * seconds of stopped recording under `nonBlocking`.
8133
+ *
8134
+ * The mode is on the JOB, not only on the input, because `status` is where an
8135
+ * operator finds out which one is running.
8136
+ */
8137
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8074
8138
  /** Shared input for planning and starting an orchestrated storage migration. */
8075
8139
  var StorageMigrationInputSchema = object({
8076
8140
  destinations: StorageMigrationDestinationsSchema,
8077
- throttleMbps: number().min(1).max(1e3).optional()
8141
+ throttleMbps: number().min(1).max(1e3).optional(),
8142
+ /** Omitted = `blocking`, which stays the default. */
8143
+ mode: StorageMigrationModeSchema.optional()
8078
8144
  });
8079
- /** The durable coordinator state machine. The only phase that changes default
8080
- * locations is `repointing`, after every selected mover has completed and been
8081
- * verified. */
8145
+ /**
8146
+ * The durable coordinator state machine.
8147
+ *
8148
+ * `blocking`:
8149
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8150
+ *
8151
+ * `nonBlocking`:
8152
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8153
+ *
8154
+ * Same phases, different order plus two new ones — not a second mover.
8155
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8156
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8157
+ * `repointing` is still the only phase that changes a default location.
8158
+ */
8082
8159
  var StorageMigrationPhaseSchema = _enum([
8083
8160
  "planning",
8161
+ "sealing",
8084
8162
  "pausing",
8085
8163
  "moving",
8164
+ "draining",
8086
8165
  "verifying",
8087
8166
  "repointing",
8088
8167
  "refreshing",
@@ -8096,17 +8175,56 @@ var StorageMigrationParticipantSchema = _enum([
8096
8175
  "recorder",
8097
8176
  "analytics"
8098
8177
  ]);
8178
+ /**
8179
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8180
+ *
8181
+ * The long half of a non-blocking migration is `draining`, and it is measured
8182
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8183
+ * existed the only place those numbers appeared was a Loki line, so an operator
8184
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8185
+ * afternoon.
8186
+ *
8187
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8188
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8189
+ * mover — which is the exact failure this is meant to end. The coordinator's
8190
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8191
+ * read `state`; folding the counters costs no extra read and makes the durable
8192
+ * record say afterwards how far a move actually got.
8193
+ *
8194
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8195
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8196
+ * cannot say M, and a 0 there would render as "100 % done".
8197
+ */
8198
+ var StorageMigrationMoveProgressSchema = object({
8199
+ filesMoved: number().int().nonnegative(),
8200
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8201
+ filesTotal: number().int().nonnegative().nullable(),
8202
+ bytesMoved: number().int().nonnegative(),
8203
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8204
+ * crash gets a new mover, and a rate computed from the migration's start
8205
+ * would silently average in the time nothing was running. */
8206
+ startedAt: number(),
8207
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8208
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8209
+ * subtract its own. */
8210
+ observedAt: number()
8211
+ });
8099
8212
  var StorageMigrationMoveSchema = object({
8100
8213
  storageClass: StorageMigrationClassSchema,
8101
8214
  fromLocationId: string(),
8102
8215
  toLocationId: string(),
8103
8216
  moverJobId: string().nullable(),
8104
8217
  state: RelocateJobStateSchema.nullable(),
8105
- error: string().nullable()
8218
+ error: string().nullable(),
8219
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8220
+ progress: StorageMigrationMoveProgressSchema.nullable()
8106
8221
  });
8107
8222
  var StorageMigrationJobSchema = object({
8108
8223
  jobId: string(),
8109
8224
  phase: StorageMigrationPhaseSchema,
8225
+ /** Which order this job is running. `status` is the only place an operator
8226
+ * can tell a seconds-long cutover from a thirty-hour one. */
8227
+ mode: StorageMigrationModeSchema,
8110
8228
  destinations: StorageMigrationDestinationsSchema,
8111
8229
  throttleMbps: number(),
8112
8230
  moves: array(StorageMigrationMoveSchema),
@@ -8119,13 +8237,122 @@ var StorageMigrationJobSchema = object({
8119
8237
  finishedAt: number().nullable(),
8120
8238
  error: string().nullable()
8121
8239
  });
8240
+ var StorageMigrationFindingSchema = object({
8241
+ code: _enum([
8242
+ "sharesDeviceWithSource",
8243
+ "deviceIdentityUnknown",
8244
+ "unstampedEventMediaRows",
8245
+ "blockingOnly",
8246
+ "noMover"
8247
+ ]),
8248
+ storageClass: StorageMigrationClassSchema,
8249
+ /** Human-readable, already carrying the ids and counts. */
8250
+ message: string()
8251
+ });
8122
8252
  var StorageMigrationPlanSchema = object({
8123
8253
  destinations: StorageMigrationDestinationsSchema,
8254
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8255
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8256
+ * it. */
8257
+ mode: StorageMigrationModeSchema,
8124
8258
  moves: array(object({
8125
8259
  storageClass: StorageMigrationClassSchema,
8126
8260
  fromLocationId: string(),
8127
8261
  toLocationId: string()
8128
- }))
8262
+ })),
8263
+ findings: array(StorageMigrationFindingSchema)
8264
+ });
8265
+ /**
8266
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8267
+ *
8268
+ * The coordinator's job record is the state of record for a migration, and its
8269
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8270
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8271
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8272
+ * way because no supported UI path existed. A mover armed like that has no job
8273
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8274
+ *
8275
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8276
+ * orchestrated it.
8277
+ */
8278
+ var StorageMigrationMoverSchema = object({
8279
+ lane: _enum(["footage", "media"]),
8280
+ job: RelocateJobSchema,
8281
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8282
+ * directly against the owning addon. */
8283
+ migrationJobId: string().nullable(),
8284
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8285
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8286
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8287
+ * rate made of two different clocks. */
8288
+ observedAt: number()
8289
+ });
8290
+ /**
8291
+ * What a SOURCE still holds for one storage class — the number that makes a
8292
+ * "drain remaining" action honest rather than hopeful.
8293
+ *
8294
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8295
+ * engine's own selection count for media), never from the resident index: a
8296
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8297
+ * never been told about (D295).
8298
+ *
8299
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8300
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8301
+ * because refusing on an unanswerable read would hide exactly the case an
8302
+ * operator needs to act on.
8303
+ */
8304
+ var StorageMigrationResidueSchema = object({
8305
+ storageClass: StorageMigrationClassSchema,
8306
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8307
+ * move from wherever they are rather than from one named source. */
8308
+ fromLocationId: string(),
8309
+ /** Where a drain would move it — the class's CURRENT default. */
8310
+ toLocationId: string(),
8311
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8312
+ items: number().int().nonnegative().nullable(),
8313
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8314
+ bytes: number().int().nonnegative().nullable()
8315
+ });
8316
+ /**
8317
+ * Run the DRAIN half and nothing else.
8318
+ *
8319
+ * A migration that reached `done` has already repointed, so `start` correctly
8320
+ * refuses its destination ("already the default") — there is nothing left to
8321
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8322
+ * or finish against a work list that was a tenth of the archive (D295), and
8323
+ * before this there was no supported way to run only that half: the only way
8324
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8325
+ *
8326
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8327
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8328
+ * re-repoint a class that is already migrated.
8329
+ */
8330
+ var StorageMigrationDrainInputSchema = object({
8331
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8332
+ * a class whose source is already empty is refused rather than started. */
8333
+ classes: array(StorageMigrationClassSchema).min(1),
8334
+ throttleMbps: number().min(1).max(1e3).optional()
8335
+ });
8336
+ /** What a footage source still holds, asked of the durable hour ledger. */
8337
+ var RelocateResidueInputSchema = object({
8338
+ fromLocationId: string().min(1),
8339
+ /** Narrow to one logical class; omit for every profile on the location. */
8340
+ footageClass: RelocateFootageClassSchema.optional()
8341
+ });
8342
+ /** `null` = the archive could not answer (no ledger on this node, or the
8343
+ * aggregate failed). Never conflated with an empty source. */
8344
+ var RelocateResidueSchema = object({
8345
+ segments: number().int().nonnegative(),
8346
+ bytes: number().int().nonnegative()
8347
+ }).nullable();
8348
+ /** How many rows a media pass would still act on against a given target — the
8349
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8350
+ * never disagree. `null` = the count could not be taken. */
8351
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8352
+ var RelocatableMediaCountInputSchema = object({
8353
+ toLocationId: string().min(1),
8354
+ /** Omitted = `move`. */
8355
+ mode: MediaRelocateModeSchema.optional()
8129
8356
  });
8130
8357
  /**
8131
8358
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8231,6 +8458,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8231
8458
  * two addons declaring the same `id` must agree on `cardinality` (validated
8232
8459
  * at kernel aggregation time, not here).
8233
8460
  */
8461
+ /**
8462
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8463
+ * actually reaches the bytes. It is the constraint that decides which
8464
+ * `storage-provider`s may back a location of that kind.
8465
+ *
8466
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8467
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8468
+ * post-analysis media roots). Only a provider that serves a genuine local
8469
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8470
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8471
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8472
+ * against a same-named local directory that is something else entirely.
8473
+ *
8474
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8475
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8476
+ * service never sees a path, so any provider can back it. `backups` is the
8477
+ * one kind that qualifies today.
8478
+ *
8479
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8480
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8481
+ * refused the configuration; the first write simply went somewhere wrong, and
8482
+ * a recording write that goes wrong surfaces as a silent black window rather
8483
+ * than an error (the read path does not `stat`). This turns that accident into
8484
+ * a declared, enforced, testable refusal.
8485
+ */
8486
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8234
8487
  var StorageLocationDeclarationSchema = object({
8235
8488
  /**
8236
8489
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8250,6 +8503,19 @@ var StorageLocationDeclarationSchema = object({
8250
8503
  */
8251
8504
  cardinality: _enum(["single", "multi"]),
8252
8505
  /**
8506
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8507
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8508
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8509
+ *
8510
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8511
+ * can only over-restrict (refuse a remote provider for a kind that might
8512
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8513
+ * permissive direction and is therefore never inferred — a repo guard
8514
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8515
+ * reached by omission.
8516
+ */
8517
+ access: StorageAccessSchema.optional(),
8518
+ /**
8253
8519
  * When set, the default instance for this location inherits its resolved
8254
8520
  * root from the named location's default instance. Useful for derivative
8255
8521
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18134,8 +18400,10 @@ var TrackSchema = object({
18134
18400
  lastSeen: number(),
18135
18401
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18136
18402
  positions: array(TrackPositionSchema).readonly(),
18137
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18138
- * saveThumbnails policy). */
18403
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18404
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18405
+ * the retired `saveThumbnails` used to gate this and the rolling
18406
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18139
18407
  snapshots: array(TrackSnapshotSchema).readonly(),
18140
18408
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18141
18409
  zonesVisited: array(string()).readonly(),
@@ -18995,6 +19263,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18995
19263
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18996
19264
  kind: "mutation",
18997
19265
  auth: "admin"
19266
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19267
+ kind: "query",
19268
+ auth: "admin"
18998
19269
  }), method(object({}), array(RelocateJobSchema).readonly(), {
18999
19270
  kind: "query",
19000
19271
  auth: "admin"
@@ -21006,7 +21277,10 @@ method(object({
21006
21277
  }), StorageLocationSchema, {
21007
21278
  kind: "mutation",
21008
21279
  auth: "admin"
21009
- }), method(object({ id: string() }), _void(), {
21280
+ }), method(object({
21281
+ id: string(),
21282
+ force: boolean().optional()
21283
+ }), _void(), {
21010
21284
  kind: "mutation",
21011
21285
  auth: "admin"
21012
21286
  }), method(object({ id: string() }), object({
@@ -21055,6 +21329,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21055
21329
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21056
21330
  kind: "mutation",
21057
21331
  auth: "admin"
21332
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21333
+ kind: "mutation",
21334
+ auth: "admin"
21058
21335
  });
21059
21336
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21060
21337
  providerId: string().min(1),
@@ -21453,12 +21730,38 @@ response: record(string(), unknown()) }), object({
21453
21730
  *
21454
21731
  * ## Why this is a capability and not a helper
21455
21732
  *
21456
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21457
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21458
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21459
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21460
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21461
- * load 5,000 rows before ranking anything.
21733
+ * This capability was introduced with the claim that SIX stores in
21734
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21735
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21736
+ * claim was never true, and leaving it here made five stores look like pending
21737
+ * work when three of them have no vector at all. Counted column by column on
21738
+ * 2026-08-30, exactly THREE ever held one:
21739
+ *
21740
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21741
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21742
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21743
+ * face, migrated 2026-08-30 into its OWN index (see below).
21744
+ *
21745
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21746
+ * and `identities` store a name; the event store stores no derivative vector.
21747
+ * They are not migration candidates and never were.
21748
+ *
21749
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21750
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21751
+ * rows before ranking anything.
21752
+ *
21753
+ * ## One index per COMPARISON, never per encoder
21754
+ *
21755
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21756
+ * model, and they still get two indexes. An index is a set of things that are
21757
+ * ranked against each other and that live and die together, and these two are
21758
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21759
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21760
+ * forever and is the gallery every recognition ranks against. One index would
21761
+ * mean every gallery load and every reconcile carried a filter whose failure
21762
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21763
+ * person's only sample. The dimension they share is not a reason to share an
21764
+ * index; the question they answer is, and it differs.
21462
21765
  *
21463
21766
  * The fix is not a faster loop, it is a different backend — and the backend
21464
21767
  * should be replaceable without touching six callers. So: a singleton
@@ -21563,7 +21866,20 @@ var VectorQueryResultSchema = object({
21563
21866
  */
21564
21867
  scanned: number(),
21565
21868
  /** True when the backend could not consider every row that passed the filter. */
21566
- truncated: boolean()
21869
+ truncated: boolean(),
21870
+ /**
21871
+ * The `topK` the backend actually ran with.
21872
+ *
21873
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21874
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21875
+ * own log rather than in its answer. That is how an audit asking for 20,000
21876
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21877
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21878
+ * MUCH, in the return value, where the caller cannot fail to see it.
21879
+ *
21880
+ * Equals the requested `topK` whenever nothing was lowered.
21881
+ */
21882
+ effectiveTopK: number().int().positive()
21567
21883
  });
21568
21884
  var VectorDeleteInputSchema = object({
21569
21885
  index: string(),
@@ -21592,6 +21908,68 @@ var VectorGetResultSchema = object({ items: array(object({
21592
21908
  id: string(),
21593
21909
  metadata: VectorMetadataSchema
21594
21910
  })) });
21911
+ /**
21912
+ * Ids to read back WITH their vectors.
21913
+ *
21914
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21915
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21916
+ * caller depends on that promise. This one promises the opposite.
21917
+ *
21918
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21919
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21920
+ * a per-face cross-process KNN would be a network round trip inside the
21921
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21922
+ * it requires the index to hand the floats back. Without this method the only
21923
+ * way to keep a readable vector is a JSON column, which is the thing this
21924
+ * capability exists to delete.
21925
+ *
21926
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21927
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21928
+ */
21929
+ var VectorFetchInputSchema = object({
21930
+ index: string(),
21931
+ ids: array(string())
21932
+ });
21933
+ var VectorFetchResultSchema = object({ items: array(object({
21934
+ id: string(),
21935
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21936
+ vector: string(),
21937
+ metadata: VectorMetadataSchema
21938
+ })) });
21939
+ /**
21940
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21941
+ *
21942
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21943
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21944
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21945
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21946
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21947
+ * looked" for as long as anyone cared to read it.
21948
+ *
21949
+ * This is the primitive that question actually needs: a bounded page, ordered
21950
+ * by the backend's own row order, costing no distance computation at all.
21951
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21952
+ * the full-table read this capability was built to stop.
21953
+ */
21954
+ var VectorScanInputSchema = object({
21955
+ index: string(),
21956
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21957
+ cursor: number().int().nonnegative().default(0),
21958
+ limit: number().int().positive()
21959
+ });
21960
+ var VectorScanResultSchema = object({
21961
+ items: array(object({
21962
+ id: string(),
21963
+ metadata: VectorMetadataSchema
21964
+ })),
21965
+ /**
21966
+ * Where the next page starts, or `null` when the walk reached the end.
21967
+ *
21968
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21969
+ * from a short page: a backend is free to return fewer rows than asked.
21970
+ */
21971
+ nextCursor: number().int().nonnegative().nullable()
21972
+ });
21595
21973
  var VectorStatsInputSchema = object({ index: string() });
21596
21974
  var VectorStatsResultSchema = object({
21597
21975
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21610,7 +21988,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21610
21988
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21611
21989
  kind: "mutation",
21612
21990
  auth: "admin"
21613
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21991
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21614
21992
  kind: "mutation",
21615
21993
  auth: "admin"
21616
21994
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28237,6 +28615,9 @@ method(object({
28237
28615
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28238
28616
  kind: "query",
28239
28617
  auth: "admin"
28618
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28619
+ kind: "query",
28620
+ auth: "admin"
28240
28621
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28241
28622
  kind: "mutation",
28242
28623
  auth: "admin"
@@ -34871,6 +35252,18 @@ Object.freeze({
34871
35252
  addonId: null,
34872
35253
  access: "create"
34873
35254
  },
35255
+ "pipelineAnalytics.countRelocatableMedia": {
35256
+ capName: "pipeline-analytics",
35257
+ capScope: "device",
35258
+ addonId: null,
35259
+ access: "view"
35260
+ },
35261
+ "pipelineAnalytics.countUnstampedEventMedia": {
35262
+ capName: "pipeline-analytics",
35263
+ capScope: "device",
35264
+ addonId: null,
35265
+ access: "view"
35266
+ },
34874
35267
  "pipelineAnalytics.deleteDeviceEvents": {
34875
35268
  capName: "pipeline-analytics",
34876
35269
  capScope: "device",
@@ -36029,6 +36422,12 @@ Object.freeze({
36029
36422
  addonId: null,
36030
36423
  access: "view"
36031
36424
  },
36425
+ "recording.getRelocateResidue": {
36426
+ capName: "recording",
36427
+ capScope: "system",
36428
+ addonId: null,
36429
+ access: "view"
36430
+ },
36032
36431
  "recording.getStorageMigrationMoveStatus": {
36033
36432
  capName: "recording",
36034
36433
  capScope: "system",
@@ -36575,12 +36974,30 @@ Object.freeze({
36575
36974
  addonId: null,
36576
36975
  access: "create"
36577
36976
  },
36977
+ "storageMigration.drain": {
36978
+ capName: "storage-migration",
36979
+ capScope: "system",
36980
+ addonId: null,
36981
+ access: "create"
36982
+ },
36983
+ "storageMigration.movers": {
36984
+ capName: "storage-migration",
36985
+ capScope: "system",
36986
+ addonId: null,
36987
+ access: "view"
36988
+ },
36578
36989
  "storageMigration.plan": {
36579
36990
  capName: "storage-migration",
36580
36991
  capScope: "system",
36581
36992
  addonId: null,
36582
36993
  access: "view"
36583
36994
  },
36995
+ "storageMigration.residue": {
36996
+ capName: "storage-migration",
36997
+ capScope: "system",
36998
+ addonId: null,
36999
+ access: "view"
37000
+ },
36584
37001
  "storageMigration.start": {
36585
37002
  capName: "storage-migration",
36586
37003
  capScope: "system",
@@ -37415,6 +37832,12 @@ Object.freeze({
37415
37832
  addonId: null,
37416
37833
  access: "delete"
37417
37834
  },
37835
+ "vectorStore.fetchByIds": {
37836
+ capName: "vector-store",
37837
+ capScope: "system",
37838
+ addonId: null,
37839
+ access: "view"
37840
+ },
37418
37841
  "vectorStore.getByIds": {
37419
37842
  capName: "vector-store",
37420
37843
  capScope: "system",
@@ -37427,6 +37850,12 @@ Object.freeze({
37427
37850
  addonId: null,
37428
37851
  access: "view"
37429
37852
  },
37853
+ "vectorStore.scan": {
37854
+ capName: "vector-store",
37855
+ capScope: "system",
37856
+ addonId: null,
37857
+ access: "view"
37858
+ },
37430
37859
  "vectorStore.stats": {
37431
37860
  capName: "vector-store",
37432
37861
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-wyze",
3
- "version": "0.2.46",
3
+ "version": "0.2.49",
4
4
  "description": "Wyze camera device-provider addon for CamStack — wraps the @apocaliss92/wyze-bridge-js P2P/DTLS client, feeding the stream-broker via the pull-rfc4571 lazy-publish path (a structural twin of addon-provider-reolink)",
5
5
  "keywords": [
6
6
  "camstack",