@camstack/addon-provider-homematic 1.2.43 → 1.2.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +452 -23
  2. package/dist/addon.mjs +452 -23
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8048,18 +8048,61 @@ var RelocateFootageInputSchema = object({
8048
8048
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8049
8049
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8050
8050
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8051
+ /**
8052
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8053
+ * mover (the engine already walks both collections with a timestamp cursor and
8054
+ * already has a stamp-without-copy path).
8055
+ *
8056
+ * - `move` — the default and the historical behaviour: event-media and
8057
+ * retrain blobs move to `toLocationId` and their rows are
8058
+ * stamped. The enrolled gallery is skipped (D197).
8059
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8060
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8061
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8062
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8063
+ * instant a repoint moves that pointer the row reads from the
8064
+ * new disk while its bytes are on the old one.
8065
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8066
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8067
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8068
+ * never run beside a live second location: it is stop-the-world
8069
+ * by construction, which is acceptable only because the gallery
8070
+ * is a few KB per enrolled sample.
8071
+ */
8072
+ var MediaRelocateModeSchema = _enum([
8073
+ "move",
8074
+ "seal",
8075
+ "gallery"
8076
+ ]);
8051
8077
  var RelocateMediaInputSchema = object({
8052
8078
  toLocationId: string(),
8053
- throttleMbps: number().min(1).max(1e3).optional()
8079
+ throttleMbps: number().min(1).max(1e3).optional(),
8080
+ /** Omitted = `move`, the pre-existing behaviour. */
8081
+ mode: MediaRelocateModeSchema.optional()
8082
+ });
8083
+ /** How many rows still carry NO `locationId` — the population a repoint would
8084
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8085
+ * value that permits a non-blocking `eventMedia` cutover. */
8086
+ var UnstampedEventMediaCountSchema = object({
8087
+ media: number().int().nonnegative(),
8088
+ retrainFrames: number().int().nonnegative(),
8089
+ total: number().int().nonnegative()
8054
8090
  });
8055
8091
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8056
- /** The independently selectable logical storage classes. `recordings`
8057
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8058
- * segments; `eventMedia` is post-analysis blobs. */
8092
+ /** The independently selectable logical storage classes — every class
8093
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8094
+ * Zod enum error where they should meet an explanation.
8095
+ *
8096
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8097
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8098
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8099
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8059
8100
  var StorageMigrationClassSchema = _enum([
8060
8101
  "recordings",
8061
8102
  "recordingsLow",
8062
- "eventMedia"
8103
+ "eventMedia",
8104
+ "backups",
8105
+ "galleryMedia"
8063
8106
  ]);
8064
8107
  /** A destination is always an existing, fully-qualified location id. The
8065
8108
  * migration API intentionally never changes a source location's `basePath`:
@@ -8067,20 +8110,56 @@ var StorageMigrationClassSchema = _enum([
8067
8110
  var StorageMigrationDestinationsSchema = object({
8068
8111
  recordings: string().min(1).optional(),
8069
8112
  recordingsLow: string().min(1).optional(),
8070
- eventMedia: string().min(1).optional()
8113
+ eventMedia: string().min(1).optional(),
8114
+ backups: string().min(1).optional(),
8115
+ galleryMedia: string().min(1).optional()
8071
8116
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8117
+ /**
8118
+ * How a migration sequences the cutover against the byte move.
8119
+ *
8120
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8121
+ * resume. Recording is stopped for the whole move. Right
8122
+ * for a small or a cold class, and the only legal mode for
8123
+ * a `cardinality: 'single'` class.
8124
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8125
+ * refresh, resume, then move the past with everything
8126
+ * running. The pause is three bounded instants (a detach +
8127
+ * attach round, a write-gate drain, a lease) instead of one
8128
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8129
+ * stopped recording under `blocking`; the same move is
8130
+ * seconds of stopped recording under `nonBlocking`.
8131
+ *
8132
+ * The mode is on the JOB, not only on the input, because `status` is where an
8133
+ * operator finds out which one is running.
8134
+ */
8135
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8072
8136
  /** Shared input for planning and starting an orchestrated storage migration. */
8073
8137
  var StorageMigrationInputSchema = object({
8074
8138
  destinations: StorageMigrationDestinationsSchema,
8075
- throttleMbps: number().min(1).max(1e3).optional()
8139
+ throttleMbps: number().min(1).max(1e3).optional(),
8140
+ /** Omitted = `blocking`, which stays the default. */
8141
+ mode: StorageMigrationModeSchema.optional()
8076
8142
  });
8077
- /** The durable coordinator state machine. The only phase that changes default
8078
- * locations is `repointing`, after every selected mover has completed and been
8079
- * verified. */
8143
+ /**
8144
+ * The durable coordinator state machine.
8145
+ *
8146
+ * `blocking`:
8147
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8148
+ *
8149
+ * `nonBlocking`:
8150
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8151
+ *
8152
+ * Same phases, different order plus two new ones — not a second mover.
8153
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8154
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8155
+ * `repointing` is still the only phase that changes a default location.
8156
+ */
8080
8157
  var StorageMigrationPhaseSchema = _enum([
8081
8158
  "planning",
8159
+ "sealing",
8082
8160
  "pausing",
8083
8161
  "moving",
8162
+ "draining",
8084
8163
  "verifying",
8085
8164
  "repointing",
8086
8165
  "refreshing",
@@ -8094,17 +8173,56 @@ var StorageMigrationParticipantSchema = _enum([
8094
8173
  "recorder",
8095
8174
  "analytics"
8096
8175
  ]);
8176
+ /**
8177
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8178
+ *
8179
+ * The long half of a non-blocking migration is `draining`, and it is measured
8180
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8181
+ * existed the only place those numbers appeared was a Loki line, so an operator
8182
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8183
+ * afternoon.
8184
+ *
8185
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8186
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8187
+ * mover — which is the exact failure this is meant to end. The coordinator's
8188
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8189
+ * read `state`; folding the counters costs no extra read and makes the durable
8190
+ * record say afterwards how far a move actually got.
8191
+ *
8192
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8193
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8194
+ * cannot say M, and a 0 there would render as "100 % done".
8195
+ */
8196
+ var StorageMigrationMoveProgressSchema = object({
8197
+ filesMoved: number().int().nonnegative(),
8198
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8199
+ filesTotal: number().int().nonnegative().nullable(),
8200
+ bytesMoved: number().int().nonnegative(),
8201
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8202
+ * crash gets a new mover, and a rate computed from the migration's start
8203
+ * would silently average in the time nothing was running. */
8204
+ startedAt: number(),
8205
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8206
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8207
+ * subtract its own. */
8208
+ observedAt: number()
8209
+ });
8097
8210
  var StorageMigrationMoveSchema = object({
8098
8211
  storageClass: StorageMigrationClassSchema,
8099
8212
  fromLocationId: string(),
8100
8213
  toLocationId: string(),
8101
8214
  moverJobId: string().nullable(),
8102
8215
  state: RelocateJobStateSchema.nullable(),
8103
- error: string().nullable()
8216
+ error: string().nullable(),
8217
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8218
+ progress: StorageMigrationMoveProgressSchema.nullable()
8104
8219
  });
8105
8220
  var StorageMigrationJobSchema = object({
8106
8221
  jobId: string(),
8107
8222
  phase: StorageMigrationPhaseSchema,
8223
+ /** Which order this job is running. `status` is the only place an operator
8224
+ * can tell a seconds-long cutover from a thirty-hour one. */
8225
+ mode: StorageMigrationModeSchema,
8108
8226
  destinations: StorageMigrationDestinationsSchema,
8109
8227
  throttleMbps: number(),
8110
8228
  moves: array(StorageMigrationMoveSchema),
@@ -8117,13 +8235,122 @@ var StorageMigrationJobSchema = object({
8117
8235
  finishedAt: number().nullable(),
8118
8236
  error: string().nullable()
8119
8237
  });
8238
+ var StorageMigrationFindingSchema = object({
8239
+ code: _enum([
8240
+ "sharesDeviceWithSource",
8241
+ "deviceIdentityUnknown",
8242
+ "unstampedEventMediaRows",
8243
+ "blockingOnly",
8244
+ "noMover"
8245
+ ]),
8246
+ storageClass: StorageMigrationClassSchema,
8247
+ /** Human-readable, already carrying the ids and counts. */
8248
+ message: string()
8249
+ });
8120
8250
  var StorageMigrationPlanSchema = object({
8121
8251
  destinations: StorageMigrationDestinationsSchema,
8252
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8253
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8254
+ * it. */
8255
+ mode: StorageMigrationModeSchema,
8122
8256
  moves: array(object({
8123
8257
  storageClass: StorageMigrationClassSchema,
8124
8258
  fromLocationId: string(),
8125
8259
  toLocationId: string()
8126
- }))
8260
+ })),
8261
+ findings: array(StorageMigrationFindingSchema)
8262
+ });
8263
+ /**
8264
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8265
+ *
8266
+ * The coordinator's job record is the state of record for a migration, and its
8267
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8268
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8269
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8270
+ * way because no supported UI path existed. A mover armed like that has no job
8271
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8272
+ *
8273
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8274
+ * orchestrated it.
8275
+ */
8276
+ var StorageMigrationMoverSchema = object({
8277
+ lane: _enum(["footage", "media"]),
8278
+ job: RelocateJobSchema,
8279
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8280
+ * directly against the owning addon. */
8281
+ migrationJobId: string().nullable(),
8282
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8283
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8284
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8285
+ * rate made of two different clocks. */
8286
+ observedAt: number()
8287
+ });
8288
+ /**
8289
+ * What a SOURCE still holds for one storage class — the number that makes a
8290
+ * "drain remaining" action honest rather than hopeful.
8291
+ *
8292
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8293
+ * engine's own selection count for media), never from the resident index: a
8294
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8295
+ * never been told about (D295).
8296
+ *
8297
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8298
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8299
+ * because refusing on an unanswerable read would hide exactly the case an
8300
+ * operator needs to act on.
8301
+ */
8302
+ var StorageMigrationResidueSchema = object({
8303
+ storageClass: StorageMigrationClassSchema,
8304
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8305
+ * move from wherever they are rather than from one named source. */
8306
+ fromLocationId: string(),
8307
+ /** Where a drain would move it — the class's CURRENT default. */
8308
+ toLocationId: string(),
8309
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8310
+ items: number().int().nonnegative().nullable(),
8311
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8312
+ bytes: number().int().nonnegative().nullable()
8313
+ });
8314
+ /**
8315
+ * Run the DRAIN half and nothing else.
8316
+ *
8317
+ * A migration that reached `done` has already repointed, so `start` correctly
8318
+ * refuses its destination ("already the default") — there is nothing left to
8319
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8320
+ * or finish against a work list that was a tenth of the archive (D295), and
8321
+ * before this there was no supported way to run only that half: the only way
8322
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8323
+ *
8324
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8325
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8326
+ * re-repoint a class that is already migrated.
8327
+ */
8328
+ var StorageMigrationDrainInputSchema = object({
8329
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8330
+ * a class whose source is already empty is refused rather than started. */
8331
+ classes: array(StorageMigrationClassSchema).min(1),
8332
+ throttleMbps: number().min(1).max(1e3).optional()
8333
+ });
8334
+ /** What a footage source still holds, asked of the durable hour ledger. */
8335
+ var RelocateResidueInputSchema = object({
8336
+ fromLocationId: string().min(1),
8337
+ /** Narrow to one logical class; omit for every profile on the location. */
8338
+ footageClass: RelocateFootageClassSchema.optional()
8339
+ });
8340
+ /** `null` = the archive could not answer (no ledger on this node, or the
8341
+ * aggregate failed). Never conflated with an empty source. */
8342
+ var RelocateResidueSchema = object({
8343
+ segments: number().int().nonnegative(),
8344
+ bytes: number().int().nonnegative()
8345
+ }).nullable();
8346
+ /** How many rows a media pass would still act on against a given target — the
8347
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8348
+ * never disagree. `null` = the count could not be taken. */
8349
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8350
+ var RelocatableMediaCountInputSchema = object({
8351
+ toLocationId: string().min(1),
8352
+ /** Omitted = `move`. */
8353
+ mode: MediaRelocateModeSchema.optional()
8127
8354
  });
8128
8355
  /**
8129
8356
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8229,6 +8456,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8229
8456
  * two addons declaring the same `id` must agree on `cardinality` (validated
8230
8457
  * at kernel aggregation time, not here).
8231
8458
  */
8459
+ /**
8460
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8461
+ * actually reaches the bytes. It is the constraint that decides which
8462
+ * `storage-provider`s may back a location of that kind.
8463
+ *
8464
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8465
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8466
+ * post-analysis media roots). Only a provider that serves a genuine local
8467
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8468
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8469
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8470
+ * against a same-named local directory that is something else entirely.
8471
+ *
8472
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8473
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8474
+ * service never sees a path, so any provider can back it. `backups` is the
8475
+ * one kind that qualifies today.
8476
+ *
8477
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8478
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8479
+ * refused the configuration; the first write simply went somewhere wrong, and
8480
+ * a recording write that goes wrong surfaces as a silent black window rather
8481
+ * than an error (the read path does not `stat`). This turns that accident into
8482
+ * a declared, enforced, testable refusal.
8483
+ */
8484
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8232
8485
  var StorageLocationDeclarationSchema = object({
8233
8486
  /**
8234
8487
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8248,6 +8501,19 @@ var StorageLocationDeclarationSchema = object({
8248
8501
  */
8249
8502
  cardinality: _enum(["single", "multi"]),
8250
8503
  /**
8504
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8505
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8506
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8507
+ *
8508
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8509
+ * can only over-restrict (refuse a remote provider for a kind that might
8510
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8511
+ * permissive direction and is therefore never inferred — a repo guard
8512
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8513
+ * reached by omission.
8514
+ */
8515
+ access: StorageAccessSchema.optional(),
8516
+ /**
8251
8517
  * When set, the default instance for this location inherits its resolved
8252
8518
  * root from the named location's default instance. Useful for derivative
8253
8519
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18181,8 +18447,10 @@ var TrackSchema = object({
18181
18447
  lastSeen: number(),
18182
18448
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18183
18449
  positions: array(TrackPositionSchema).readonly(),
18184
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18185
- * saveThumbnails policy). */
18450
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18451
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18452
+ * the retired `saveThumbnails` used to gate this and the rolling
18453
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18186
18454
  snapshots: array(TrackSnapshotSchema).readonly(),
18187
18455
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18188
18456
  zonesVisited: array(string()).readonly(),
@@ -19042,6 +19310,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19042
19310
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19043
19311
  kind: "mutation",
19044
19312
  auth: "admin"
19313
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19314
+ kind: "query",
19315
+ auth: "admin"
19045
19316
  }), method(object({}), array(RelocateJobSchema).readonly(), {
19046
19317
  kind: "query",
19047
19318
  auth: "admin"
@@ -20949,7 +21220,10 @@ method(object({
20949
21220
  }), StorageLocationSchema, {
20950
21221
  kind: "mutation",
20951
21222
  auth: "admin"
20952
- }), method(object({ id: string() }), _void(), {
21223
+ }), method(object({
21224
+ id: string(),
21225
+ force: boolean().optional()
21226
+ }), _void(), {
20953
21227
  kind: "mutation",
20954
21228
  auth: "admin"
20955
21229
  }), method(object({ id: string() }), object({
@@ -20998,6 +21272,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20998
21272
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20999
21273
  kind: "mutation",
21000
21274
  auth: "admin"
21275
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21276
+ kind: "mutation",
21277
+ auth: "admin"
21001
21278
  });
21002
21279
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21003
21280
  providerId: string().min(1),
@@ -21396,12 +21673,38 @@ response: record(string(), unknown()) }), object({
21396
21673
  *
21397
21674
  * ## Why this is a capability and not a helper
21398
21675
  *
21399
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21400
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21401
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21402
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21403
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21404
- * load 5,000 rows before ranking anything.
21676
+ * This capability was introduced with the claim that SIX stores in
21677
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21678
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21679
+ * claim was never true, and leaving it here made five stores look like pending
21680
+ * work when three of them have no vector at all. Counted column by column on
21681
+ * 2026-08-30, exactly THREE ever held one:
21682
+ *
21683
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21684
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21685
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21686
+ * face, migrated 2026-08-30 into its OWN index (see below).
21687
+ *
21688
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21689
+ * and `identities` store a name; the event store stores no derivative vector.
21690
+ * They are not migration candidates and never were.
21691
+ *
21692
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21693
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21694
+ * rows before ranking anything.
21695
+ *
21696
+ * ## One index per COMPARISON, never per encoder
21697
+ *
21698
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21699
+ * model, and they still get two indexes. An index is a set of things that are
21700
+ * ranked against each other and that live and die together, and these two are
21701
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21702
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21703
+ * forever and is the gallery every recognition ranks against. One index would
21704
+ * mean every gallery load and every reconcile carried a filter whose failure
21705
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21706
+ * person's only sample. The dimension they share is not a reason to share an
21707
+ * index; the question they answer is, and it differs.
21405
21708
  *
21406
21709
  * The fix is not a faster loop, it is a different backend — and the backend
21407
21710
  * should be replaceable without touching six callers. So: a singleton
@@ -21506,7 +21809,20 @@ var VectorQueryResultSchema = object({
21506
21809
  */
21507
21810
  scanned: number(),
21508
21811
  /** True when the backend could not consider every row that passed the filter. */
21509
- truncated: boolean()
21812
+ truncated: boolean(),
21813
+ /**
21814
+ * The `topK` the backend actually ran with.
21815
+ *
21816
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21817
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21818
+ * own log rather than in its answer. That is how an audit asking for 20,000
21819
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21820
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21821
+ * MUCH, in the return value, where the caller cannot fail to see it.
21822
+ *
21823
+ * Equals the requested `topK` whenever nothing was lowered.
21824
+ */
21825
+ effectiveTopK: number().int().positive()
21510
21826
  });
21511
21827
  var VectorDeleteInputSchema = object({
21512
21828
  index: string(),
@@ -21535,6 +21851,68 @@ var VectorGetResultSchema = object({ items: array(object({
21535
21851
  id: string(),
21536
21852
  metadata: VectorMetadataSchema
21537
21853
  })) });
21854
+ /**
21855
+ * Ids to read back WITH their vectors.
21856
+ *
21857
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21858
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21859
+ * caller depends on that promise. This one promises the opposite.
21860
+ *
21861
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21862
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21863
+ * a per-face cross-process KNN would be a network round trip inside the
21864
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21865
+ * it requires the index to hand the floats back. Without this method the only
21866
+ * way to keep a readable vector is a JSON column, which is the thing this
21867
+ * capability exists to delete.
21868
+ *
21869
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21870
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21871
+ */
21872
+ var VectorFetchInputSchema = object({
21873
+ index: string(),
21874
+ ids: array(string())
21875
+ });
21876
+ var VectorFetchResultSchema = object({ items: array(object({
21877
+ id: string(),
21878
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21879
+ vector: string(),
21880
+ metadata: VectorMetadataSchema
21881
+ })) });
21882
+ /**
21883
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21884
+ *
21885
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21886
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21887
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21888
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21889
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21890
+ * looked" for as long as anyone cared to read it.
21891
+ *
21892
+ * This is the primitive that question actually needs: a bounded page, ordered
21893
+ * by the backend's own row order, costing no distance computation at all.
21894
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21895
+ * the full-table read this capability was built to stop.
21896
+ */
21897
+ var VectorScanInputSchema = object({
21898
+ index: string(),
21899
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21900
+ cursor: number().int().nonnegative().default(0),
21901
+ limit: number().int().positive()
21902
+ });
21903
+ var VectorScanResultSchema = object({
21904
+ items: array(object({
21905
+ id: string(),
21906
+ metadata: VectorMetadataSchema
21907
+ })),
21908
+ /**
21909
+ * Where the next page starts, or `null` when the walk reached the end.
21910
+ *
21911
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21912
+ * from a short page: a backend is free to return fewer rows than asked.
21913
+ */
21914
+ nextCursor: number().int().nonnegative().nullable()
21915
+ });
21538
21916
  var VectorStatsInputSchema = object({ index: string() });
21539
21917
  var VectorStatsResultSchema = object({
21540
21918
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21553,7 +21931,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21553
21931
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21554
21932
  kind: "mutation",
21555
21933
  auth: "admin"
21556
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21934
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21557
21935
  kind: "mutation",
21558
21936
  auth: "admin"
21559
21937
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28172,6 +28550,9 @@ method(object({
28172
28550
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28173
28551
  kind: "query",
28174
28552
  auth: "admin"
28553
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28554
+ kind: "query",
28555
+ auth: "admin"
28175
28556
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28176
28557
  kind: "mutation",
28177
28558
  auth: "admin"
@@ -34806,6 +35187,18 @@ Object.freeze({
34806
35187
  addonId: null,
34807
35188
  access: "create"
34808
35189
  },
35190
+ "pipelineAnalytics.countRelocatableMedia": {
35191
+ capName: "pipeline-analytics",
35192
+ capScope: "device",
35193
+ addonId: null,
35194
+ access: "view"
35195
+ },
35196
+ "pipelineAnalytics.countUnstampedEventMedia": {
35197
+ capName: "pipeline-analytics",
35198
+ capScope: "device",
35199
+ addonId: null,
35200
+ access: "view"
35201
+ },
34809
35202
  "pipelineAnalytics.deleteDeviceEvents": {
34810
35203
  capName: "pipeline-analytics",
34811
35204
  capScope: "device",
@@ -35964,6 +36357,12 @@ Object.freeze({
35964
36357
  addonId: null,
35965
36358
  access: "view"
35966
36359
  },
36360
+ "recording.getRelocateResidue": {
36361
+ capName: "recording",
36362
+ capScope: "system",
36363
+ addonId: null,
36364
+ access: "view"
36365
+ },
35967
36366
  "recording.getStorageMigrationMoveStatus": {
35968
36367
  capName: "recording",
35969
36368
  capScope: "system",
@@ -36510,12 +36909,30 @@ Object.freeze({
36510
36909
  addonId: null,
36511
36910
  access: "create"
36512
36911
  },
36912
+ "storageMigration.drain": {
36913
+ capName: "storage-migration",
36914
+ capScope: "system",
36915
+ addonId: null,
36916
+ access: "create"
36917
+ },
36918
+ "storageMigration.movers": {
36919
+ capName: "storage-migration",
36920
+ capScope: "system",
36921
+ addonId: null,
36922
+ access: "view"
36923
+ },
36513
36924
  "storageMigration.plan": {
36514
36925
  capName: "storage-migration",
36515
36926
  capScope: "system",
36516
36927
  addonId: null,
36517
36928
  access: "view"
36518
36929
  },
36930
+ "storageMigration.residue": {
36931
+ capName: "storage-migration",
36932
+ capScope: "system",
36933
+ addonId: null,
36934
+ access: "view"
36935
+ },
36519
36936
  "storageMigration.start": {
36520
36937
  capName: "storage-migration",
36521
36938
  capScope: "system",
@@ -37350,6 +37767,12 @@ Object.freeze({
37350
37767
  addonId: null,
37351
37768
  access: "delete"
37352
37769
  },
37770
+ "vectorStore.fetchByIds": {
37771
+ capName: "vector-store",
37772
+ capScope: "system",
37773
+ addonId: null,
37774
+ access: "view"
37775
+ },
37353
37776
  "vectorStore.getByIds": {
37354
37777
  capName: "vector-store",
37355
37778
  capScope: "system",
@@ -37362,6 +37785,12 @@ Object.freeze({
37362
37785
  addonId: null,
37363
37786
  access: "view"
37364
37787
  },
37788
+ "vectorStore.scan": {
37789
+ capName: "vector-store",
37790
+ capScope: "system",
37791
+ addonId: null,
37792
+ access: "view"
37793
+ },
37365
37794
  "vectorStore.stats": {
37366
37795
  capName: "vector-store",
37367
37796
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8049,18 +8049,61 @@ var RelocateFootageInputSchema = object({
8049
8049
  * `RecordingConfig.enabled` or camera wrapper bindings. */
8050
8050
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
8051
8051
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
8052
+ /**
8053
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
8054
+ * mover (the engine already walks both collections with a timestamp cursor and
8055
+ * already has a stamp-without-copy path).
8056
+ *
8057
+ * - `move` — the default and the historical behaviour: event-media and
8058
+ * retrain blobs move to `toLocationId` and their rows are
8059
+ * stamped. The enrolled gallery is skipped (D197).
8060
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
8061
+ * stamped with `toLocationId`. `toLocationId` here is the id the
8062
+ * bytes ALREADY sit on — today's `eventMedia` default — because
8063
+ * a NULL row means "wherever `eventMedia` points *now*", and the
8064
+ * instant a repoint moves that pointer the row reads from the
8065
+ * new disk while its bytes are on the old one.
8066
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
8067
+ * (enrolled-gallery) rows, which `move` deliberately skips.
8068
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
8069
+ * never run beside a live second location: it is stop-the-world
8070
+ * by construction, which is acceptable only because the gallery
8071
+ * is a few KB per enrolled sample.
8072
+ */
8073
+ var MediaRelocateModeSchema = _enum([
8074
+ "move",
8075
+ "seal",
8076
+ "gallery"
8077
+ ]);
8052
8078
  var RelocateMediaInputSchema = object({
8053
8079
  toLocationId: string(),
8054
- throttleMbps: number().min(1).max(1e3).optional()
8080
+ throttleMbps: number().min(1).max(1e3).optional(),
8081
+ /** Omitted = `move`, the pre-existing behaviour. */
8082
+ mode: MediaRelocateModeSchema.optional()
8083
+ });
8084
+ /** How many rows still carry NO `locationId` — the population a repoint would
8085
+ * silently re-aim at a disk that does not hold their bytes. Zero is the only
8086
+ * value that permits a non-blocking `eventMedia` cutover. */
8087
+ var UnstampedEventMediaCountSchema = object({
8088
+ media: number().int().nonnegative(),
8089
+ retrainFrames: number().int().nonnegative(),
8090
+ total: number().int().nonnegative()
8055
8091
  });
8056
8092
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8057
- /** The independently selectable logical storage classes. `recordings`
8058
- * encompasses the high and mid segment profiles; `recordingsLow` is low
8059
- * segments; `eventMedia` is post-analysis blobs. */
8093
+ /** The independently selectable logical storage classes — every class
8094
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
8095
+ * Zod enum error where they should meet an explanation.
8096
+ *
8097
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
8098
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
8099
+ * enrolled gallery; `backups` is the system backup archive. The last two have
8100
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
8060
8101
  var StorageMigrationClassSchema = _enum([
8061
8102
  "recordings",
8062
8103
  "recordingsLow",
8063
- "eventMedia"
8104
+ "eventMedia",
8105
+ "backups",
8106
+ "galleryMedia"
8064
8107
  ]);
8065
8108
  /** A destination is always an existing, fully-qualified location id. The
8066
8109
  * migration API intentionally never changes a source location's `basePath`:
@@ -8068,20 +8111,56 @@ var StorageMigrationClassSchema = _enum([
8068
8111
  var StorageMigrationDestinationsSchema = object({
8069
8112
  recordings: string().min(1).optional(),
8070
8113
  recordingsLow: string().min(1).optional(),
8071
- eventMedia: string().min(1).optional()
8114
+ eventMedia: string().min(1).optional(),
8115
+ backups: string().min(1).optional(),
8116
+ galleryMedia: string().min(1).optional()
8072
8117
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
8118
+ /**
8119
+ * How a migration sequences the cutover against the byte move.
8120
+ *
8121
+ * - `blocking` — the historical order: pause, move every byte, repoint,
8122
+ * resume. Recording is stopped for the whole move. Right
8123
+ * for a small or a cold class, and the only legal mode for
8124
+ * a `cardinality: 'single'` class.
8125
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
8126
+ * refresh, resume, then move the past with everything
8127
+ * running. The pause is three bounded instants (a detach +
8128
+ * attach round, a write-gate drain, a lease) instead of one
8129
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
8130
+ * stopped recording under `blocking`; the same move is
8131
+ * seconds of stopped recording under `nonBlocking`.
8132
+ *
8133
+ * The mode is on the JOB, not only on the input, because `status` is where an
8134
+ * operator finds out which one is running.
8135
+ */
8136
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
8073
8137
  /** Shared input for planning and starting an orchestrated storage migration. */
8074
8138
  var StorageMigrationInputSchema = object({
8075
8139
  destinations: StorageMigrationDestinationsSchema,
8076
- throttleMbps: number().min(1).max(1e3).optional()
8140
+ throttleMbps: number().min(1).max(1e3).optional(),
8141
+ /** Omitted = `blocking`, which stays the default. */
8142
+ mode: StorageMigrationModeSchema.optional()
8077
8143
  });
8078
- /** The durable coordinator state machine. The only phase that changes default
8079
- * locations is `repointing`, after every selected mover has completed and been
8080
- * verified. */
8144
+ /**
8145
+ * The durable coordinator state machine.
8146
+ *
8147
+ * `blocking`:
8148
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
8149
+ *
8150
+ * `nonBlocking`:
8151
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
8152
+ *
8153
+ * Same phases, different order plus two new ones — not a second mover.
8154
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
8155
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
8156
+ * `repointing` is still the only phase that changes a default location.
8157
+ */
8081
8158
  var StorageMigrationPhaseSchema = _enum([
8082
8159
  "planning",
8160
+ "sealing",
8083
8161
  "pausing",
8084
8162
  "moving",
8163
+ "draining",
8085
8164
  "verifying",
8086
8165
  "repointing",
8087
8166
  "refreshing",
@@ -8095,17 +8174,56 @@ var StorageMigrationParticipantSchema = _enum([
8095
8174
  "recorder",
8096
8175
  "analytics"
8097
8176
  ]);
8177
+ /**
8178
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8179
+ *
8180
+ * The long half of a non-blocking migration is `draining`, and it is measured
8181
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8182
+ * existed the only place those numbers appeared was a Loki line, so an operator
8183
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8184
+ * afternoon.
8185
+ *
8186
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8187
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8188
+ * mover — which is the exact failure this is meant to end. The coordinator's
8189
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8190
+ * read `state`; folding the counters costs no extra read and makes the durable
8191
+ * record say afterwards how far a move actually got.
8192
+ *
8193
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8194
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8195
+ * cannot say M, and a 0 there would render as "100 % done".
8196
+ */
8197
+ var StorageMigrationMoveProgressSchema = object({
8198
+ filesMoved: number().int().nonnegative(),
8199
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8200
+ filesTotal: number().int().nonnegative().nullable(),
8201
+ bytesMoved: number().int().nonnegative(),
8202
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8203
+ * crash gets a new mover, and a rate computed from the migration's start
8204
+ * would silently average in the time nothing was running. */
8205
+ startedAt: number(),
8206
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8207
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8208
+ * subtract its own. */
8209
+ observedAt: number()
8210
+ });
8098
8211
  var StorageMigrationMoveSchema = object({
8099
8212
  storageClass: StorageMigrationClassSchema,
8100
8213
  fromLocationId: string(),
8101
8214
  toLocationId: string(),
8102
8215
  moverJobId: string().nullable(),
8103
8216
  state: RelocateJobStateSchema.nullable(),
8104
- error: string().nullable()
8217
+ error: string().nullable(),
8218
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8219
+ progress: StorageMigrationMoveProgressSchema.nullable()
8105
8220
  });
8106
8221
  var StorageMigrationJobSchema = object({
8107
8222
  jobId: string(),
8108
8223
  phase: StorageMigrationPhaseSchema,
8224
+ /** Which order this job is running. `status` is the only place an operator
8225
+ * can tell a seconds-long cutover from a thirty-hour one. */
8226
+ mode: StorageMigrationModeSchema,
8109
8227
  destinations: StorageMigrationDestinationsSchema,
8110
8228
  throttleMbps: number(),
8111
8229
  moves: array(StorageMigrationMoveSchema),
@@ -8118,13 +8236,122 @@ var StorageMigrationJobSchema = object({
8118
8236
  finishedAt: number().nullable(),
8119
8237
  error: string().nullable()
8120
8238
  });
8239
+ var StorageMigrationFindingSchema = object({
8240
+ code: _enum([
8241
+ "sharesDeviceWithSource",
8242
+ "deviceIdentityUnknown",
8243
+ "unstampedEventMediaRows",
8244
+ "blockingOnly",
8245
+ "noMover"
8246
+ ]),
8247
+ storageClass: StorageMigrationClassSchema,
8248
+ /** Human-readable, already carrying the ids and counts. */
8249
+ message: string()
8250
+ });
8121
8251
  var StorageMigrationPlanSchema = object({
8122
8252
  destinations: StorageMigrationDestinationsSchema,
8253
+ /** The mode this plan was built for. A plan is only valid for its mode: the
8254
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
8255
+ * it. */
8256
+ mode: StorageMigrationModeSchema,
8123
8257
  moves: array(object({
8124
8258
  storageClass: StorageMigrationClassSchema,
8125
8259
  fromLocationId: string(),
8126
8260
  toLocationId: string()
8127
- }))
8261
+ })),
8262
+ findings: array(StorageMigrationFindingSchema)
8263
+ });
8264
+ /**
8265
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8266
+ *
8267
+ * The coordinator's job record is the state of record for a migration, and its
8268
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8269
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8270
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8271
+ * way because no supported UI path existed. A mover armed like that has no job
8272
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8273
+ *
8274
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8275
+ * orchestrated it.
8276
+ */
8277
+ var StorageMigrationMoverSchema = object({
8278
+ lane: _enum(["footage", "media"]),
8279
+ job: RelocateJobSchema,
8280
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8281
+ * directly against the owning addon. */
8282
+ migrationJobId: string().nullable(),
8283
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8284
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8285
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8286
+ * rate made of two different clocks. */
8287
+ observedAt: number()
8288
+ });
8289
+ /**
8290
+ * What a SOURCE still holds for one storage class — the number that makes a
8291
+ * "drain remaining" action honest rather than hopeful.
8292
+ *
8293
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8294
+ * engine's own selection count for media), never from the resident index: a
8295
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8296
+ * never been told about (D295).
8297
+ *
8298
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8299
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8300
+ * because refusing on an unanswerable read would hide exactly the case an
8301
+ * operator needs to act on.
8302
+ */
8303
+ var StorageMigrationResidueSchema = object({
8304
+ storageClass: StorageMigrationClassSchema,
8305
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8306
+ * move from wherever they are rather than from one named source. */
8307
+ fromLocationId: string(),
8308
+ /** Where a drain would move it — the class's CURRENT default. */
8309
+ toLocationId: string(),
8310
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8311
+ items: number().int().nonnegative().nullable(),
8312
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8313
+ bytes: number().int().nonnegative().nullable()
8314
+ });
8315
+ /**
8316
+ * Run the DRAIN half and nothing else.
8317
+ *
8318
+ * A migration that reached `done` has already repointed, so `start` correctly
8319
+ * refuses its destination ("already the default") — there is nothing left to
8320
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8321
+ * or finish against a work list that was a tenth of the archive (D295), and
8322
+ * before this there was no supported way to run only that half: the only way
8323
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8324
+ *
8325
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8326
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8327
+ * re-repoint a class that is already migrated.
8328
+ */
8329
+ var StorageMigrationDrainInputSchema = object({
8330
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8331
+ * a class whose source is already empty is refused rather than started. */
8332
+ classes: array(StorageMigrationClassSchema).min(1),
8333
+ throttleMbps: number().min(1).max(1e3).optional()
8334
+ });
8335
+ /** What a footage source still holds, asked of the durable hour ledger. */
8336
+ var RelocateResidueInputSchema = object({
8337
+ fromLocationId: string().min(1),
8338
+ /** Narrow to one logical class; omit for every profile on the location. */
8339
+ footageClass: RelocateFootageClassSchema.optional()
8340
+ });
8341
+ /** `null` = the archive could not answer (no ledger on this node, or the
8342
+ * aggregate failed). Never conflated with an empty source. */
8343
+ var RelocateResidueSchema = object({
8344
+ segments: number().int().nonnegative(),
8345
+ bytes: number().int().nonnegative()
8346
+ }).nullable();
8347
+ /** How many rows a media pass would still act on against a given target — the
8348
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8349
+ * never disagree. `null` = the count could not be taken. */
8350
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8351
+ var RelocatableMediaCountInputSchema = object({
8352
+ toLocationId: string().min(1),
8353
+ /** Omitted = `move`. */
8354
+ mode: MediaRelocateModeSchema.optional()
8128
8355
  });
8129
8356
  /**
8130
8357
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -8230,6 +8457,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8230
8457
  * two addons declaring the same `id` must agree on `cardinality` (validated
8231
8458
  * at kernel aggregation time, not here).
8232
8459
  */
8460
+ /**
8461
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8462
+ * actually reaches the bytes. It is the constraint that decides which
8463
+ * `storage-provider`s may back a location of that kind.
8464
+ *
8465
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8466
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8467
+ * post-analysis media roots). Only a provider that serves a genuine local
8468
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8469
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8470
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8471
+ * against a same-named local directory that is something else entirely.
8472
+ *
8473
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8474
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8475
+ * service never sees a path, so any provider can back it. `backups` is the
8476
+ * one kind that qualifies today.
8477
+ *
8478
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8479
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8480
+ * refused the configuration; the first write simply went somewhere wrong, and
8481
+ * a recording write that goes wrong surfaces as a silent black window rather
8482
+ * than an error (the read path does not `stat`). This turns that accident into
8483
+ * a declared, enforced, testable refusal.
8484
+ */
8485
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8233
8486
  var StorageLocationDeclarationSchema = object({
8234
8487
  /**
8235
8488
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8249,6 +8502,19 @@ var StorageLocationDeclarationSchema = object({
8249
8502
  */
8250
8503
  cardinality: _enum(["single", "multi"]),
8251
8504
  /**
8505
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8506
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8507
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8508
+ *
8509
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8510
+ * can only over-restrict (refuse a remote provider for a kind that might
8511
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8512
+ * permissive direction and is therefore never inferred — a repo guard
8513
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8514
+ * reached by omission.
8515
+ */
8516
+ access: StorageAccessSchema.optional(),
8517
+ /**
8252
8518
  * When set, the default instance for this location inherits its resolved
8253
8519
  * root from the named location's default instance. Useful for derivative
8254
8520
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18182,8 +18448,10 @@ var TrackSchema = object({
18182
18448
  lastSeen: number(),
18183
18449
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18184
18450
  positions: array(TrackPositionSchema).readonly(),
18185
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18186
- * saveThumbnails policy). */
18451
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18452
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18453
+ * the retired `saveThumbnails` used to gate this and the rolling
18454
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18187
18455
  snapshots: array(TrackSnapshotSchema).readonly(),
18188
18456
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18189
18457
  zonesVisited: array(string()).readonly(),
@@ -19043,6 +19311,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19043
19311
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19044
19312
  kind: "mutation",
19045
19313
  auth: "admin"
19314
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19315
+ kind: "query",
19316
+ auth: "admin"
19046
19317
  }), method(object({}), array(RelocateJobSchema).readonly(), {
19047
19318
  kind: "query",
19048
19319
  auth: "admin"
@@ -20950,7 +21221,10 @@ method(object({
20950
21221
  }), StorageLocationSchema, {
20951
21222
  kind: "mutation",
20952
21223
  auth: "admin"
20953
- }), method(object({ id: string() }), _void(), {
21224
+ }), method(object({
21225
+ id: string(),
21226
+ force: boolean().optional()
21227
+ }), _void(), {
20954
21228
  kind: "mutation",
20955
21229
  auth: "admin"
20956
21230
  }), method(object({ id: string() }), object({
@@ -20999,6 +21273,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20999
21273
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21000
21274
  kind: "mutation",
21001
21275
  auth: "admin"
21276
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21277
+ kind: "mutation",
21278
+ auth: "admin"
21002
21279
  });
21003
21280
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21004
21281
  providerId: string().min(1),
@@ -21397,12 +21674,38 @@ response: record(string(), unknown()) }), object({
21397
21674
  *
21398
21675
  * ## Why this is a capability and not a helper
21399
21676
  *
21400
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21401
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21402
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21403
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21404
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21405
- * load 5,000 rows before ranking anything.
21677
+ * This capability was introduced with the claim that SIX stores in
21678
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21679
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21680
+ * claim was never true, and leaving it here made five stores look like pending
21681
+ * work when three of them have no vector at all. Counted column by column on
21682
+ * 2026-08-30, exactly THREE ever held one:
21683
+ *
21684
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21685
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21686
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21687
+ * face, migrated 2026-08-30 into its OWN index (see below).
21688
+ *
21689
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21690
+ * and `identities` store a name; the event store stores no derivative vector.
21691
+ * They are not migration candidates and never were.
21692
+ *
21693
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21694
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21695
+ * rows before ranking anything.
21696
+ *
21697
+ * ## One index per COMPARISON, never per encoder
21698
+ *
21699
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21700
+ * model, and they still get two indexes. An index is a set of things that are
21701
+ * ranked against each other and that live and die together, and these two are
21702
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21703
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21704
+ * forever and is the gallery every recognition ranks against. One index would
21705
+ * mean every gallery load and every reconcile carried a filter whose failure
21706
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21707
+ * person's only sample. The dimension they share is not a reason to share an
21708
+ * index; the question they answer is, and it differs.
21406
21709
  *
21407
21710
  * The fix is not a faster loop, it is a different backend — and the backend
21408
21711
  * should be replaceable without touching six callers. So: a singleton
@@ -21507,7 +21810,20 @@ var VectorQueryResultSchema = object({
21507
21810
  */
21508
21811
  scanned: number(),
21509
21812
  /** True when the backend could not consider every row that passed the filter. */
21510
- truncated: boolean()
21813
+ truncated: boolean(),
21814
+ /**
21815
+ * The `topK` the backend actually ran with.
21816
+ *
21817
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21818
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21819
+ * own log rather than in its answer. That is how an audit asking for 20,000
21820
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21821
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21822
+ * MUCH, in the return value, where the caller cannot fail to see it.
21823
+ *
21824
+ * Equals the requested `topK` whenever nothing was lowered.
21825
+ */
21826
+ effectiveTopK: number().int().positive()
21511
21827
  });
21512
21828
  var VectorDeleteInputSchema = object({
21513
21829
  index: string(),
@@ -21536,6 +21852,68 @@ var VectorGetResultSchema = object({ items: array(object({
21536
21852
  id: string(),
21537
21853
  metadata: VectorMetadataSchema
21538
21854
  })) });
21855
+ /**
21856
+ * Ids to read back WITH their vectors.
21857
+ *
21858
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21859
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21860
+ * caller depends on that promise. This one promises the opposite.
21861
+ *
21862
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21863
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21864
+ * a per-face cross-process KNN would be a network round trip inside the
21865
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21866
+ * it requires the index to hand the floats back. Without this method the only
21867
+ * way to keep a readable vector is a JSON column, which is the thing this
21868
+ * capability exists to delete.
21869
+ *
21870
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21871
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21872
+ */
21873
+ var VectorFetchInputSchema = object({
21874
+ index: string(),
21875
+ ids: array(string())
21876
+ });
21877
+ var VectorFetchResultSchema = object({ items: array(object({
21878
+ id: string(),
21879
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21880
+ vector: string(),
21881
+ metadata: VectorMetadataSchema
21882
+ })) });
21883
+ /**
21884
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21885
+ *
21886
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21887
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21888
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21889
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21890
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21891
+ * looked" for as long as anyone cared to read it.
21892
+ *
21893
+ * This is the primitive that question actually needs: a bounded page, ordered
21894
+ * by the backend's own row order, costing no distance computation at all.
21895
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21896
+ * the full-table read this capability was built to stop.
21897
+ */
21898
+ var VectorScanInputSchema = object({
21899
+ index: string(),
21900
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21901
+ cursor: number().int().nonnegative().default(0),
21902
+ limit: number().int().positive()
21903
+ });
21904
+ var VectorScanResultSchema = object({
21905
+ items: array(object({
21906
+ id: string(),
21907
+ metadata: VectorMetadataSchema
21908
+ })),
21909
+ /**
21910
+ * Where the next page starts, or `null` when the walk reached the end.
21911
+ *
21912
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21913
+ * from a short page: a backend is free to return fewer rows than asked.
21914
+ */
21915
+ nextCursor: number().int().nonnegative().nullable()
21916
+ });
21539
21917
  var VectorStatsInputSchema = object({ index: string() });
21540
21918
  var VectorStatsResultSchema = object({
21541
21919
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21554,7 +21932,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21554
21932
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21555
21933
  kind: "mutation",
21556
21934
  auth: "admin"
21557
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21935
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21558
21936
  kind: "mutation",
21559
21937
  auth: "admin"
21560
21938
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28173,6 +28551,9 @@ method(object({
28173
28551
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28174
28552
  kind: "query",
28175
28553
  auth: "admin"
28554
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28555
+ kind: "query",
28556
+ auth: "admin"
28176
28557
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28177
28558
  kind: "mutation",
28178
28559
  auth: "admin"
@@ -34807,6 +35188,18 @@ Object.freeze({
34807
35188
  addonId: null,
34808
35189
  access: "create"
34809
35190
  },
35191
+ "pipelineAnalytics.countRelocatableMedia": {
35192
+ capName: "pipeline-analytics",
35193
+ capScope: "device",
35194
+ addonId: null,
35195
+ access: "view"
35196
+ },
35197
+ "pipelineAnalytics.countUnstampedEventMedia": {
35198
+ capName: "pipeline-analytics",
35199
+ capScope: "device",
35200
+ addonId: null,
35201
+ access: "view"
35202
+ },
34810
35203
  "pipelineAnalytics.deleteDeviceEvents": {
34811
35204
  capName: "pipeline-analytics",
34812
35205
  capScope: "device",
@@ -35965,6 +36358,12 @@ Object.freeze({
35965
36358
  addonId: null,
35966
36359
  access: "view"
35967
36360
  },
36361
+ "recording.getRelocateResidue": {
36362
+ capName: "recording",
36363
+ capScope: "system",
36364
+ addonId: null,
36365
+ access: "view"
36366
+ },
35968
36367
  "recording.getStorageMigrationMoveStatus": {
35969
36368
  capName: "recording",
35970
36369
  capScope: "system",
@@ -36511,12 +36910,30 @@ Object.freeze({
36511
36910
  addonId: null,
36512
36911
  access: "create"
36513
36912
  },
36913
+ "storageMigration.drain": {
36914
+ capName: "storage-migration",
36915
+ capScope: "system",
36916
+ addonId: null,
36917
+ access: "create"
36918
+ },
36919
+ "storageMigration.movers": {
36920
+ capName: "storage-migration",
36921
+ capScope: "system",
36922
+ addonId: null,
36923
+ access: "view"
36924
+ },
36514
36925
  "storageMigration.plan": {
36515
36926
  capName: "storage-migration",
36516
36927
  capScope: "system",
36517
36928
  addonId: null,
36518
36929
  access: "view"
36519
36930
  },
36931
+ "storageMigration.residue": {
36932
+ capName: "storage-migration",
36933
+ capScope: "system",
36934
+ addonId: null,
36935
+ access: "view"
36936
+ },
36520
36937
  "storageMigration.start": {
36521
36938
  capName: "storage-migration",
36522
36939
  capScope: "system",
@@ -37351,6 +37768,12 @@ Object.freeze({
37351
37768
  addonId: null,
37352
37769
  access: "delete"
37353
37770
  },
37771
+ "vectorStore.fetchByIds": {
37772
+ capName: "vector-store",
37773
+ capScope: "system",
37774
+ addonId: null,
37775
+ access: "view"
37776
+ },
37354
37777
  "vectorStore.getByIds": {
37355
37778
  capName: "vector-store",
37356
37779
  capScope: "system",
@@ -37363,6 +37786,12 @@ Object.freeze({
37363
37786
  addonId: null,
37364
37787
  access: "view"
37365
37788
  },
37789
+ "vectorStore.scan": {
37790
+ capName: "vector-store",
37791
+ capScope: "system",
37792
+ addonId: null,
37793
+ access: "view"
37794
+ },
37366
37795
  "vectorStore.stats": {
37367
37796
  capName: "vector-store",
37368
37797
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-homematic",
3
- "version": "1.2.43",
3
+ "version": "1.2.46",
4
4
  "description": "Homematic / HomematicIP (CCU3 / RaspberryMatic) device-provider addon for CamStack — wraps the nodehomematic library",
5
5
  "keywords": [
6
6
  "camstack",