@camstack/addon-provider-homematic 1.2.44 → 1.2.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +387 -19
  2. package/dist/addon.mjs +387 -19
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8012,6 +8012,21 @@ var RelocateJobSchema = object({
8012
8012
  bytesMoved: number().int(),
8013
8013
  /** Total files discovered up front; null while (or when) unknown. */
8014
8014
  filesTotal: number().int().nullable(),
8015
+ /**
8016
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8017
+ * made that nobody asked for, so it is reported where the operator reads the
8018
+ * job rather than only in a log line.
8019
+ *
8020
+ * A footage segment records its byte count in its own NAME, and the durable
8021
+ * hour row derives its aggregates from those names. A file that does not
8022
+ * match its name therefore makes the ledger's sums — and with them quota and
8023
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8024
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8025
+ *
8026
+ * Absent on lanes where the question has no meaning: a media blob's size is
8027
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8028
+ */
8029
+ rowsReconciled: number().int().nonnegative().optional(),
8015
8030
  startedAt: number(),
8016
8031
  finishedAt: number().nullable(),
8017
8032
  error: string().nullable()
@@ -8080,14 +8095,42 @@ var RelocateMediaInputSchema = object({
8080
8095
  /** Omitted = `move`, the pre-existing behaviour. */
8081
8096
  mode: MediaRelocateModeSchema.optional()
8082
8097
  });
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()
8098
+ /**
8099
+ * The unstamped population of ONE collection — split, because the gate and the
8100
+ * operator ask two different questions and only one of them has to be cheap.
8101
+ *
8102
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8103
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8104
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8105
+ * that matters — after a seal, when the population is empty.
8106
+ *
8107
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8108
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8109
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8110
+ * and useful answer: "there are some, and this read could not say how many"
8111
+ * still refuses the cutover, which is the whole job.
8112
+ */
8113
+ var UnstampedRowsSchema = object({
8114
+ present: boolean(),
8115
+ rows: number().int().nonnegative().nullable()
8090
8116
  });
8117
+ /**
8118
+ * How many rows still carry NO `locationId` — the population a repoint would
8119
+ * silently re-aim at a disk that does not hold their bytes.
8120
+ *
8121
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8122
+ * over. The gate opens on a measured absence and on nothing else; an unread
8123
+ * collection and an empty one are different facts, and this repo has already
8124
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8125
+ */
8126
+ var UnstampedEventMediaCountSchema = object({
8127
+ media: UnstampedRowsSchema,
8128
+ retrainFrames: UnstampedRowsSchema,
8129
+ /** True when EITHER collection holds one. The refusal reads this. */
8130
+ anyPresent: boolean(),
8131
+ /** Sum across both, or `null` when either lane could not be counted. */
8132
+ total: number().int().nonnegative().nullable()
8133
+ }).nullable();
8091
8134
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8092
8135
  /** The independently selectable logical storage classes — every class
8093
8136
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8173,13 +8216,53 @@ var StorageMigrationParticipantSchema = _enum([
8173
8216
  "recorder",
8174
8217
  "analytics"
8175
8218
  ]);
8219
+ /**
8220
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8221
+ *
8222
+ * The long half of a non-blocking migration is `draining`, and it is measured
8223
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8224
+ * existed the only place those numbers appeared was a Loki line, so an operator
8225
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8226
+ * afternoon.
8227
+ *
8228
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8229
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8230
+ * mover — which is the exact failure this is meant to end. The coordinator's
8231
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8232
+ * read `state`; folding the counters costs no extra read and makes the durable
8233
+ * record say afterwards how far a move actually got.
8234
+ *
8235
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8236
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8237
+ * cannot say M, and a 0 there would render as "100 % done".
8238
+ */
8239
+ var StorageMigrationMoveProgressSchema = object({
8240
+ filesMoved: number().int().nonnegative(),
8241
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8242
+ filesTotal: number().int().nonnegative().nullable(),
8243
+ bytesMoved: number().int().nonnegative(),
8244
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8245
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8246
+ * rows would be the same failure as one that silently skipped them. */
8247
+ rowsReconciled: number().int().nonnegative().optional(),
8248
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8249
+ * crash gets a new mover, and a rate computed from the migration's start
8250
+ * would silently average in the time nothing was running. */
8251
+ startedAt: number(),
8252
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8253
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8254
+ * subtract its own. */
8255
+ observedAt: number()
8256
+ });
8176
8257
  var StorageMigrationMoveSchema = object({
8177
8258
  storageClass: StorageMigrationClassSchema,
8178
8259
  fromLocationId: string(),
8179
8260
  toLocationId: string(),
8180
8261
  moverJobId: string().nullable(),
8181
8262
  state: RelocateJobStateSchema.nullable(),
8182
- error: string().nullable()
8263
+ error: string().nullable(),
8264
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8265
+ progress: StorageMigrationMoveProgressSchema.nullable()
8183
8266
  });
8184
8267
  var StorageMigrationJobSchema = object({
8185
8268
  jobId: string(),
@@ -8225,6 +8308,98 @@ var StorageMigrationPlanSchema = object({
8225
8308
  findings: array(StorageMigrationFindingSchema)
8226
8309
  });
8227
8310
  /**
8311
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8312
+ *
8313
+ * The coordinator's job record is the state of record for a migration, and its
8314
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8315
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8316
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8317
+ * way because no supported UI path existed. A mover armed like that has no job
8318
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8319
+ *
8320
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8321
+ * orchestrated it.
8322
+ */
8323
+ var StorageMigrationMoverSchema = object({
8324
+ lane: _enum(["footage", "media"]),
8325
+ job: RelocateJobSchema,
8326
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8327
+ * directly against the owning addon. */
8328
+ migrationJobId: string().nullable(),
8329
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8330
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8331
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8332
+ * rate made of two different clocks. */
8333
+ observedAt: number()
8334
+ });
8335
+ /**
8336
+ * What a SOURCE still holds for one storage class — the number that makes a
8337
+ * "drain remaining" action honest rather than hopeful.
8338
+ *
8339
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8340
+ * engine's own selection count for media), never from the resident index: a
8341
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8342
+ * never been told about (D295).
8343
+ *
8344
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8345
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8346
+ * because refusing on an unanswerable read would hide exactly the case an
8347
+ * operator needs to act on.
8348
+ */
8349
+ var StorageMigrationResidueSchema = object({
8350
+ storageClass: StorageMigrationClassSchema,
8351
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8352
+ * move from wherever they are rather than from one named source. */
8353
+ fromLocationId: string(),
8354
+ /** Where a drain would move it — the class's CURRENT default. */
8355
+ toLocationId: string(),
8356
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8357
+ items: number().int().nonnegative().nullable(),
8358
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8359
+ bytes: number().int().nonnegative().nullable()
8360
+ });
8361
+ /**
8362
+ * Run the DRAIN half and nothing else.
8363
+ *
8364
+ * A migration that reached `done` has already repointed, so `start` correctly
8365
+ * refuses its destination ("already the default") — there is nothing left to
8366
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8367
+ * or finish against a work list that was a tenth of the archive (D295), and
8368
+ * before this there was no supported way to run only that half: the only way
8369
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8370
+ *
8371
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8372
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8373
+ * re-repoint a class that is already migrated.
8374
+ */
8375
+ var StorageMigrationDrainInputSchema = object({
8376
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8377
+ * a class whose source is already empty is refused rather than started. */
8378
+ classes: array(StorageMigrationClassSchema).min(1),
8379
+ throttleMbps: number().min(1).max(1e3).optional()
8380
+ });
8381
+ /** What a footage source still holds, asked of the durable hour ledger. */
8382
+ var RelocateResidueInputSchema = object({
8383
+ fromLocationId: string().min(1),
8384
+ /** Narrow to one logical class; omit for every profile on the location. */
8385
+ footageClass: RelocateFootageClassSchema.optional()
8386
+ });
8387
+ /** `null` = the archive could not answer (no ledger on this node, or the
8388
+ * aggregate failed). Never conflated with an empty source. */
8389
+ var RelocateResidueSchema = object({
8390
+ segments: number().int().nonnegative(),
8391
+ bytes: number().int().nonnegative()
8392
+ }).nullable();
8393
+ /** How many rows a media pass would still act on against a given target — the
8394
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8395
+ * never disagree. `null` = the count could not be taken. */
8396
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8397
+ var RelocatableMediaCountInputSchema = object({
8398
+ toLocationId: string().min(1),
8399
+ /** Omitted = `move`. */
8400
+ mode: MediaRelocateModeSchema.optional()
8401
+ });
8402
+ /**
8228
8403
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8229
8404
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8230
8405
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8328,6 +8503,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8328
8503
  * two addons declaring the same `id` must agree on `cardinality` (validated
8329
8504
  * at kernel aggregation time, not here).
8330
8505
  */
8506
+ /**
8507
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8508
+ * actually reaches the bytes. It is the constraint that decides which
8509
+ * `storage-provider`s may back a location of that kind.
8510
+ *
8511
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8512
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8513
+ * post-analysis media roots). Only a provider that serves a genuine local
8514
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8515
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8516
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8517
+ * against a same-named local directory that is something else entirely.
8518
+ *
8519
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8520
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8521
+ * service never sees a path, so any provider can back it. `backups` is the
8522
+ * one kind that qualifies today.
8523
+ *
8524
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8525
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8526
+ * refused the configuration; the first write simply went somewhere wrong, and
8527
+ * a recording write that goes wrong surfaces as a silent black window rather
8528
+ * than an error (the read path does not `stat`). This turns that accident into
8529
+ * a declared, enforced, testable refusal.
8530
+ */
8531
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8331
8532
  var StorageLocationDeclarationSchema = object({
8332
8533
  /**
8333
8534
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8347,6 +8548,19 @@ var StorageLocationDeclarationSchema = object({
8347
8548
  */
8348
8549
  cardinality: _enum(["single", "multi"]),
8349
8550
  /**
8551
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8552
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8553
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8554
+ *
8555
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8556
+ * can only over-restrict (refuse a remote provider for a kind that might
8557
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8558
+ * permissive direction and is therefore never inferred — a repo guard
8559
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8560
+ * reached by omission.
8561
+ */
8562
+ access: StorageAccessSchema.optional(),
8563
+ /**
8350
8564
  * When set, the default instance for this location inherits its resolved
8351
8565
  * root from the named location's default instance. Useful for derivative
8352
8566
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18280,8 +18494,10 @@ var TrackSchema = object({
18280
18494
  lastSeen: number(),
18281
18495
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18282
18496
  positions: array(TrackPositionSchema).readonly(),
18283
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18284
- * saveThumbnails policy). */
18497
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18498
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18499
+ * the retired `saveThumbnails` used to gate this and the rolling
18500
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18285
18501
  snapshots: array(TrackSnapshotSchema).readonly(),
18286
18502
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18287
18503
  zonesVisited: array(string()).readonly(),
@@ -19141,7 +19357,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19141
19357
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19142
19358
  kind: "mutation",
19143
19359
  auth: "admin"
19144
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19360
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19361
+ kind: "query",
19362
+ auth: "admin"
19363
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19145
19364
  kind: "query",
19146
19365
  auth: "admin"
19147
19366
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21100,6 +21319,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21100
21319
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21101
21320
  kind: "mutation",
21102
21321
  auth: "admin"
21322
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21323
+ kind: "mutation",
21324
+ auth: "admin"
21103
21325
  });
21104
21326
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21105
21327
  providerId: string().min(1),
@@ -21498,12 +21720,38 @@ response: record(string(), unknown()) }), object({
21498
21720
  *
21499
21721
  * ## Why this is a capability and not a helper
21500
21722
  *
21501
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21502
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21503
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21504
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21505
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21506
- * load 5,000 rows before ranking anything.
21723
+ * This capability was introduced with the claim that SIX stores in
21724
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21725
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21726
+ * claim was never true, and leaving it here made five stores look like pending
21727
+ * work when three of them have no vector at all. Counted column by column on
21728
+ * 2026-08-30, exactly THREE ever held one:
21729
+ *
21730
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21731
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21732
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21733
+ * face, migrated 2026-08-30 into its OWN index (see below).
21734
+ *
21735
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21736
+ * and `identities` store a name; the event store stores no derivative vector.
21737
+ * They are not migration candidates and never were.
21738
+ *
21739
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21740
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21741
+ * rows before ranking anything.
21742
+ *
21743
+ * ## One index per COMPARISON, never per encoder
21744
+ *
21745
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21746
+ * model, and they still get two indexes. An index is a set of things that are
21747
+ * ranked against each other and that live and die together, and these two are
21748
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21749
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21750
+ * forever and is the gallery every recognition ranks against. One index would
21751
+ * mean every gallery load and every reconcile carried a filter whose failure
21752
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21753
+ * person's only sample. The dimension they share is not a reason to share an
21754
+ * index; the question they answer is, and it differs.
21507
21755
  *
21508
21756
  * The fix is not a faster loop, it is a different backend — and the backend
21509
21757
  * should be replaceable without touching six callers. So: a singleton
@@ -21608,7 +21856,20 @@ var VectorQueryResultSchema = object({
21608
21856
  */
21609
21857
  scanned: number(),
21610
21858
  /** True when the backend could not consider every row that passed the filter. */
21611
- truncated: boolean()
21859
+ truncated: boolean(),
21860
+ /**
21861
+ * The `topK` the backend actually ran with.
21862
+ *
21863
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21864
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21865
+ * own log rather than in its answer. That is how an audit asking for 20,000
21866
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21867
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21868
+ * MUCH, in the return value, where the caller cannot fail to see it.
21869
+ *
21870
+ * Equals the requested `topK` whenever nothing was lowered.
21871
+ */
21872
+ effectiveTopK: number().int().positive()
21612
21873
  });
21613
21874
  var VectorDeleteInputSchema = object({
21614
21875
  index: string(),
@@ -21637,6 +21898,68 @@ var VectorGetResultSchema = object({ items: array(object({
21637
21898
  id: string(),
21638
21899
  metadata: VectorMetadataSchema
21639
21900
  })) });
21901
+ /**
21902
+ * Ids to read back WITH their vectors.
21903
+ *
21904
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21905
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21906
+ * caller depends on that promise. This one promises the opposite.
21907
+ *
21908
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21909
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21910
+ * a per-face cross-process KNN would be a network round trip inside the
21911
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21912
+ * it requires the index to hand the floats back. Without this method the only
21913
+ * way to keep a readable vector is a JSON column, which is the thing this
21914
+ * capability exists to delete.
21915
+ *
21916
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21917
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21918
+ */
21919
+ var VectorFetchInputSchema = object({
21920
+ index: string(),
21921
+ ids: array(string())
21922
+ });
21923
+ var VectorFetchResultSchema = object({ items: array(object({
21924
+ id: string(),
21925
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21926
+ vector: string(),
21927
+ metadata: VectorMetadataSchema
21928
+ })) });
21929
+ /**
21930
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21931
+ *
21932
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21933
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21934
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21935
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21936
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21937
+ * looked" for as long as anyone cared to read it.
21938
+ *
21939
+ * This is the primitive that question actually needs: a bounded page, ordered
21940
+ * by the backend's own row order, costing no distance computation at all.
21941
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21942
+ * the full-table read this capability was built to stop.
21943
+ */
21944
+ var VectorScanInputSchema = object({
21945
+ index: string(),
21946
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21947
+ cursor: number().int().nonnegative().default(0),
21948
+ limit: number().int().positive()
21949
+ });
21950
+ var VectorScanResultSchema = object({
21951
+ items: array(object({
21952
+ id: string(),
21953
+ metadata: VectorMetadataSchema
21954
+ })),
21955
+ /**
21956
+ * Where the next page starts, or `null` when the walk reached the end.
21957
+ *
21958
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21959
+ * from a short page: a backend is free to return fewer rows than asked.
21960
+ */
21961
+ nextCursor: number().int().nonnegative().nullable()
21962
+ });
21640
21963
  var VectorStatsInputSchema = object({ index: string() });
21641
21964
  var VectorStatsResultSchema = object({
21642
21965
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21655,7 +21978,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21655
21978
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21656
21979
  kind: "mutation",
21657
21980
  auth: "admin"
21658
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21981
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21659
21982
  kind: "mutation",
21660
21983
  auth: "admin"
21661
21984
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28274,6 +28597,9 @@ method(object({
28274
28597
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28275
28598
  kind: "query",
28276
28599
  auth: "admin"
28600
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28601
+ kind: "query",
28602
+ auth: "admin"
28277
28603
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28278
28604
  kind: "mutation",
28279
28605
  auth: "admin"
@@ -34908,6 +35234,12 @@ Object.freeze({
34908
35234
  addonId: null,
34909
35235
  access: "create"
34910
35236
  },
35237
+ "pipelineAnalytics.countRelocatableMedia": {
35238
+ capName: "pipeline-analytics",
35239
+ capScope: "device",
35240
+ addonId: null,
35241
+ access: "view"
35242
+ },
34911
35243
  "pipelineAnalytics.countUnstampedEventMedia": {
34912
35244
  capName: "pipeline-analytics",
34913
35245
  capScope: "device",
@@ -36072,6 +36404,12 @@ Object.freeze({
36072
36404
  addonId: null,
36073
36405
  access: "view"
36074
36406
  },
36407
+ "recording.getRelocateResidue": {
36408
+ capName: "recording",
36409
+ capScope: "system",
36410
+ addonId: null,
36411
+ access: "view"
36412
+ },
36075
36413
  "recording.getStorageMigrationMoveStatus": {
36076
36414
  capName: "recording",
36077
36415
  capScope: "system",
@@ -36618,12 +36956,30 @@ Object.freeze({
36618
36956
  addonId: null,
36619
36957
  access: "create"
36620
36958
  },
36959
+ "storageMigration.drain": {
36960
+ capName: "storage-migration",
36961
+ capScope: "system",
36962
+ addonId: null,
36963
+ access: "create"
36964
+ },
36965
+ "storageMigration.movers": {
36966
+ capName: "storage-migration",
36967
+ capScope: "system",
36968
+ addonId: null,
36969
+ access: "view"
36970
+ },
36621
36971
  "storageMigration.plan": {
36622
36972
  capName: "storage-migration",
36623
36973
  capScope: "system",
36624
36974
  addonId: null,
36625
36975
  access: "view"
36626
36976
  },
36977
+ "storageMigration.residue": {
36978
+ capName: "storage-migration",
36979
+ capScope: "system",
36980
+ addonId: null,
36981
+ access: "view"
36982
+ },
36627
36983
  "storageMigration.start": {
36628
36984
  capName: "storage-migration",
36629
36985
  capScope: "system",
@@ -37458,6 +37814,12 @@ Object.freeze({
37458
37814
  addonId: null,
37459
37815
  access: "delete"
37460
37816
  },
37817
+ "vectorStore.fetchByIds": {
37818
+ capName: "vector-store",
37819
+ capScope: "system",
37820
+ addonId: null,
37821
+ access: "view"
37822
+ },
37461
37823
  "vectorStore.getByIds": {
37462
37824
  capName: "vector-store",
37463
37825
  capScope: "system",
@@ -37470,6 +37832,12 @@ Object.freeze({
37470
37832
  addonId: null,
37471
37833
  access: "view"
37472
37834
  },
37835
+ "vectorStore.scan": {
37836
+ capName: "vector-store",
37837
+ capScope: "system",
37838
+ addonId: null,
37839
+ access: "view"
37840
+ },
37473
37841
  "vectorStore.stats": {
37474
37842
  capName: "vector-store",
37475
37843
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8013,6 +8013,21 @@ var RelocateJobSchema = object({
8013
8013
  bytesMoved: number().int(),
8014
8014
  /** Total files discovered up front; null while (or when) unknown. */
8015
8015
  filesTotal: number().int().nullable(),
8016
+ /**
8017
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8018
+ * made that nobody asked for, so it is reported where the operator reads the
8019
+ * job rather than only in a log line.
8020
+ *
8021
+ * A footage segment records its byte count in its own NAME, and the durable
8022
+ * hour row derives its aggregates from those names. A file that does not
8023
+ * match its name therefore makes the ledger's sums — and with them quota and
8024
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8025
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8026
+ *
8027
+ * Absent on lanes where the question has no meaning: a media blob's size is
8028
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8029
+ */
8030
+ rowsReconciled: number().int().nonnegative().optional(),
8016
8031
  startedAt: number(),
8017
8032
  finishedAt: number().nullable(),
8018
8033
  error: string().nullable()
@@ -8081,14 +8096,42 @@ var RelocateMediaInputSchema = object({
8081
8096
  /** Omitted = `move`, the pre-existing behaviour. */
8082
8097
  mode: MediaRelocateModeSchema.optional()
8083
8098
  });
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()
8099
+ /**
8100
+ * The unstamped population of ONE collection — split, because the gate and the
8101
+ * operator ask two different questions and only one of them has to be cheap.
8102
+ *
8103
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8104
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8105
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8106
+ * that matters — after a seal, when the population is empty.
8107
+ *
8108
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8109
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8110
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8111
+ * and useful answer: "there are some, and this read could not say how many"
8112
+ * still refuses the cutover, which is the whole job.
8113
+ */
8114
+ var UnstampedRowsSchema = object({
8115
+ present: boolean(),
8116
+ rows: number().int().nonnegative().nullable()
8091
8117
  });
8118
+ /**
8119
+ * How many rows still carry NO `locationId` — the population a repoint would
8120
+ * silently re-aim at a disk that does not hold their bytes.
8121
+ *
8122
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8123
+ * over. The gate opens on a measured absence and on nothing else; an unread
8124
+ * collection and an empty one are different facts, and this repo has already
8125
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8126
+ */
8127
+ var UnstampedEventMediaCountSchema = object({
8128
+ media: UnstampedRowsSchema,
8129
+ retrainFrames: UnstampedRowsSchema,
8130
+ /** True when EITHER collection holds one. The refusal reads this. */
8131
+ anyPresent: boolean(),
8132
+ /** Sum across both, or `null` when either lane could not be counted. */
8133
+ total: number().int().nonnegative().nullable()
8134
+ }).nullable();
8092
8135
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8093
8136
  /** The independently selectable logical storage classes — every class
8094
8137
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8174,13 +8217,53 @@ var StorageMigrationParticipantSchema = _enum([
8174
8217
  "recorder",
8175
8218
  "analytics"
8176
8219
  ]);
8220
+ /**
8221
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8222
+ *
8223
+ * The long half of a non-blocking migration is `draining`, and it is measured
8224
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8225
+ * existed the only place those numbers appeared was a Loki line, so an operator
8226
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8227
+ * afternoon.
8228
+ *
8229
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8230
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8231
+ * mover — which is the exact failure this is meant to end. The coordinator's
8232
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8233
+ * read `state`; folding the counters costs no extra read and makes the durable
8234
+ * record say afterwards how far a move actually got.
8235
+ *
8236
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8237
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8238
+ * cannot say M, and a 0 there would render as "100 % done".
8239
+ */
8240
+ var StorageMigrationMoveProgressSchema = object({
8241
+ filesMoved: number().int().nonnegative(),
8242
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8243
+ filesTotal: number().int().nonnegative().nullable(),
8244
+ bytesMoved: number().int().nonnegative(),
8245
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8246
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8247
+ * rows would be the same failure as one that silently skipped them. */
8248
+ rowsReconciled: number().int().nonnegative().optional(),
8249
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8250
+ * crash gets a new mover, and a rate computed from the migration's start
8251
+ * would silently average in the time nothing was running. */
8252
+ startedAt: number(),
8253
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8254
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8255
+ * subtract its own. */
8256
+ observedAt: number()
8257
+ });
8177
8258
  var StorageMigrationMoveSchema = object({
8178
8259
  storageClass: StorageMigrationClassSchema,
8179
8260
  fromLocationId: string(),
8180
8261
  toLocationId: string(),
8181
8262
  moverJobId: string().nullable(),
8182
8263
  state: RelocateJobStateSchema.nullable(),
8183
- error: string().nullable()
8264
+ error: string().nullable(),
8265
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8266
+ progress: StorageMigrationMoveProgressSchema.nullable()
8184
8267
  });
8185
8268
  var StorageMigrationJobSchema = object({
8186
8269
  jobId: string(),
@@ -8226,6 +8309,98 @@ var StorageMigrationPlanSchema = object({
8226
8309
  findings: array(StorageMigrationFindingSchema)
8227
8310
  });
8228
8311
  /**
8312
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8313
+ *
8314
+ * The coordinator's job record is the state of record for a migration, and its
8315
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8316
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8317
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8318
+ * way because no supported UI path existed. A mover armed like that has no job
8319
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8320
+ *
8321
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8322
+ * orchestrated it.
8323
+ */
8324
+ var StorageMigrationMoverSchema = object({
8325
+ lane: _enum(["footage", "media"]),
8326
+ job: RelocateJobSchema,
8327
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8328
+ * directly against the owning addon. */
8329
+ migrationJobId: string().nullable(),
8330
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8331
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8332
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8333
+ * rate made of two different clocks. */
8334
+ observedAt: number()
8335
+ });
8336
+ /**
8337
+ * What a SOURCE still holds for one storage class — the number that makes a
8338
+ * "drain remaining" action honest rather than hopeful.
8339
+ *
8340
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8341
+ * engine's own selection count for media), never from the resident index: a
8342
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8343
+ * never been told about (D295).
8344
+ *
8345
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8346
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8347
+ * because refusing on an unanswerable read would hide exactly the case an
8348
+ * operator needs to act on.
8349
+ */
8350
+ var StorageMigrationResidueSchema = object({
8351
+ storageClass: StorageMigrationClassSchema,
8352
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8353
+ * move from wherever they are rather than from one named source. */
8354
+ fromLocationId: string(),
8355
+ /** Where a drain would move it — the class's CURRENT default. */
8356
+ toLocationId: string(),
8357
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8358
+ items: number().int().nonnegative().nullable(),
8359
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8360
+ bytes: number().int().nonnegative().nullable()
8361
+ });
8362
+ /**
8363
+ * Run the DRAIN half and nothing else.
8364
+ *
8365
+ * A migration that reached `done` has already repointed, so `start` correctly
8366
+ * refuses its destination ("already the default") — there is nothing left to
8367
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8368
+ * or finish against a work list that was a tenth of the archive (D295), and
8369
+ * before this there was no supported way to run only that half: the only way
8370
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8371
+ *
8372
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8373
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8374
+ * re-repoint a class that is already migrated.
8375
+ */
8376
+ var StorageMigrationDrainInputSchema = object({
8377
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8378
+ * a class whose source is already empty is refused rather than started. */
8379
+ classes: array(StorageMigrationClassSchema).min(1),
8380
+ throttleMbps: number().min(1).max(1e3).optional()
8381
+ });
8382
+ /** What a footage source still holds, asked of the durable hour ledger. */
8383
+ var RelocateResidueInputSchema = object({
8384
+ fromLocationId: string().min(1),
8385
+ /** Narrow to one logical class; omit for every profile on the location. */
8386
+ footageClass: RelocateFootageClassSchema.optional()
8387
+ });
8388
+ /** `null` = the archive could not answer (no ledger on this node, or the
8389
+ * aggregate failed). Never conflated with an empty source. */
8390
+ var RelocateResidueSchema = object({
8391
+ segments: number().int().nonnegative(),
8392
+ bytes: number().int().nonnegative()
8393
+ }).nullable();
8394
+ /** How many rows a media pass would still act on against a given target — the
8395
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8396
+ * never disagree. `null` = the count could not be taken. */
8397
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8398
+ var RelocatableMediaCountInputSchema = object({
8399
+ toLocationId: string().min(1),
8400
+ /** Omitted = `move`. */
8401
+ mode: MediaRelocateModeSchema.optional()
8402
+ });
8403
+ /**
8229
8404
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8230
8405
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8231
8406
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8329,6 +8504,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8329
8504
  * two addons declaring the same `id` must agree on `cardinality` (validated
8330
8505
  * at kernel aggregation time, not here).
8331
8506
  */
8507
+ /**
8508
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8509
+ * actually reaches the bytes. It is the constraint that decides which
8510
+ * `storage-provider`s may back a location of that kind.
8511
+ *
8512
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8513
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8514
+ * post-analysis media roots). Only a provider that serves a genuine local
8515
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8516
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8517
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8518
+ * against a same-named local directory that is something else entirely.
8519
+ *
8520
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8521
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8522
+ * service never sees a path, so any provider can back it. `backups` is the
8523
+ * one kind that qualifies today.
8524
+ *
8525
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8526
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8527
+ * refused the configuration; the first write simply went somewhere wrong, and
8528
+ * a recording write that goes wrong surfaces as a silent black window rather
8529
+ * than an error (the read path does not `stat`). This turns that accident into
8530
+ * a declared, enforced, testable refusal.
8531
+ */
8532
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8332
8533
  var StorageLocationDeclarationSchema = object({
8333
8534
  /**
8334
8535
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8348,6 +8549,19 @@ var StorageLocationDeclarationSchema = object({
8348
8549
  */
8349
8550
  cardinality: _enum(["single", "multi"]),
8350
8551
  /**
8552
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8553
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8554
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8555
+ *
8556
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8557
+ * can only over-restrict (refuse a remote provider for a kind that might
8558
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8559
+ * permissive direction and is therefore never inferred — a repo guard
8560
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8561
+ * reached by omission.
8562
+ */
8563
+ access: StorageAccessSchema.optional(),
8564
+ /**
8351
8565
  * When set, the default instance for this location inherits its resolved
8352
8566
  * root from the named location's default instance. Useful for derivative
8353
8567
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18281,8 +18495,10 @@ var TrackSchema = object({
18281
18495
  lastSeen: number(),
18282
18496
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18283
18497
  positions: array(TrackPositionSchema).readonly(),
18284
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18285
- * saveThumbnails policy). */
18498
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18499
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18500
+ * the retired `saveThumbnails` used to gate this and the rolling
18501
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18286
18502
  snapshots: array(TrackSnapshotSchema).readonly(),
18287
18503
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18288
18504
  zonesVisited: array(string()).readonly(),
@@ -19142,7 +19358,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19142
19358
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19143
19359
  kind: "mutation",
19144
19360
  auth: "admin"
19145
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19361
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19362
+ kind: "query",
19363
+ auth: "admin"
19364
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19146
19365
  kind: "query",
19147
19366
  auth: "admin"
19148
19367
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21101,6 +21320,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21101
21320
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21102
21321
  kind: "mutation",
21103
21322
  auth: "admin"
21323
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21324
+ kind: "mutation",
21325
+ auth: "admin"
21104
21326
  });
21105
21327
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21106
21328
  providerId: string().min(1),
@@ -21499,12 +21721,38 @@ response: record(string(), unknown()) }), object({
21499
21721
  *
21500
21722
  * ## Why this is a capability and not a helper
21501
21723
  *
21502
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21503
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21504
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21505
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21506
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21507
- * load 5,000 rows before ranking anything.
21724
+ * This capability was introduced with the claim that SIX stores in
21725
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21726
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21727
+ * claim was never true, and leaving it here made five stores look like pending
21728
+ * work when three of them have no vector at all. Counted column by column on
21729
+ * 2026-08-30, exactly THREE ever held one:
21730
+ *
21731
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21732
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21733
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21734
+ * face, migrated 2026-08-30 into its OWN index (see below).
21735
+ *
21736
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21737
+ * and `identities` store a name; the event store stores no derivative vector.
21738
+ * They are not migration candidates and never were.
21739
+ *
21740
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21741
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21742
+ * rows before ranking anything.
21743
+ *
21744
+ * ## One index per COMPARISON, never per encoder
21745
+ *
21746
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21747
+ * model, and they still get two indexes. An index is a set of things that are
21748
+ * ranked against each other and that live and die together, and these two are
21749
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21750
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21751
+ * forever and is the gallery every recognition ranks against. One index would
21752
+ * mean every gallery load and every reconcile carried a filter whose failure
21753
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21754
+ * person's only sample. The dimension they share is not a reason to share an
21755
+ * index; the question they answer is, and it differs.
21508
21756
  *
21509
21757
  * The fix is not a faster loop, it is a different backend — and the backend
21510
21758
  * should be replaceable without touching six callers. So: a singleton
@@ -21609,7 +21857,20 @@ var VectorQueryResultSchema = object({
21609
21857
  */
21610
21858
  scanned: number(),
21611
21859
  /** True when the backend could not consider every row that passed the filter. */
21612
- truncated: boolean()
21860
+ truncated: boolean(),
21861
+ /**
21862
+ * The `topK` the backend actually ran with.
21863
+ *
21864
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21865
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21866
+ * own log rather than in its answer. That is how an audit asking for 20,000
21867
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21868
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21869
+ * MUCH, in the return value, where the caller cannot fail to see it.
21870
+ *
21871
+ * Equals the requested `topK` whenever nothing was lowered.
21872
+ */
21873
+ effectiveTopK: number().int().positive()
21613
21874
  });
21614
21875
  var VectorDeleteInputSchema = object({
21615
21876
  index: string(),
@@ -21638,6 +21899,68 @@ var VectorGetResultSchema = object({ items: array(object({
21638
21899
  id: string(),
21639
21900
  metadata: VectorMetadataSchema
21640
21901
  })) });
21902
+ /**
21903
+ * Ids to read back WITH their vectors.
21904
+ *
21905
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21906
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21907
+ * caller depends on that promise. This one promises the opposite.
21908
+ *
21909
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21910
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21911
+ * a per-face cross-process KNN would be a network round trip inside the
21912
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21913
+ * it requires the index to hand the floats back. Without this method the only
21914
+ * way to keep a readable vector is a JSON column, which is the thing this
21915
+ * capability exists to delete.
21916
+ *
21917
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21918
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21919
+ */
21920
+ var VectorFetchInputSchema = object({
21921
+ index: string(),
21922
+ ids: array(string())
21923
+ });
21924
+ var VectorFetchResultSchema = object({ items: array(object({
21925
+ id: string(),
21926
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21927
+ vector: string(),
21928
+ metadata: VectorMetadataSchema
21929
+ })) });
21930
+ /**
21931
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21932
+ *
21933
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21934
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21935
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21936
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21937
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21938
+ * looked" for as long as anyone cared to read it.
21939
+ *
21940
+ * This is the primitive that question actually needs: a bounded page, ordered
21941
+ * by the backend's own row order, costing no distance computation at all.
21942
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21943
+ * the full-table read this capability was built to stop.
21944
+ */
21945
+ var VectorScanInputSchema = object({
21946
+ index: string(),
21947
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21948
+ cursor: number().int().nonnegative().default(0),
21949
+ limit: number().int().positive()
21950
+ });
21951
+ var VectorScanResultSchema = object({
21952
+ items: array(object({
21953
+ id: string(),
21954
+ metadata: VectorMetadataSchema
21955
+ })),
21956
+ /**
21957
+ * Where the next page starts, or `null` when the walk reached the end.
21958
+ *
21959
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21960
+ * from a short page: a backend is free to return fewer rows than asked.
21961
+ */
21962
+ nextCursor: number().int().nonnegative().nullable()
21963
+ });
21641
21964
  var VectorStatsInputSchema = object({ index: string() });
21642
21965
  var VectorStatsResultSchema = object({
21643
21966
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21656,7 +21979,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21656
21979
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21657
21980
  kind: "mutation",
21658
21981
  auth: "admin"
21659
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21982
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21660
21983
  kind: "mutation",
21661
21984
  auth: "admin"
21662
21985
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28275,6 +28598,9 @@ method(object({
28275
28598
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28276
28599
  kind: "query",
28277
28600
  auth: "admin"
28601
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28602
+ kind: "query",
28603
+ auth: "admin"
28278
28604
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28279
28605
  kind: "mutation",
28280
28606
  auth: "admin"
@@ -34909,6 +35235,12 @@ Object.freeze({
34909
35235
  addonId: null,
34910
35236
  access: "create"
34911
35237
  },
35238
+ "pipelineAnalytics.countRelocatableMedia": {
35239
+ capName: "pipeline-analytics",
35240
+ capScope: "device",
35241
+ addonId: null,
35242
+ access: "view"
35243
+ },
34912
35244
  "pipelineAnalytics.countUnstampedEventMedia": {
34913
35245
  capName: "pipeline-analytics",
34914
35246
  capScope: "device",
@@ -36073,6 +36405,12 @@ Object.freeze({
36073
36405
  addonId: null,
36074
36406
  access: "view"
36075
36407
  },
36408
+ "recording.getRelocateResidue": {
36409
+ capName: "recording",
36410
+ capScope: "system",
36411
+ addonId: null,
36412
+ access: "view"
36413
+ },
36076
36414
  "recording.getStorageMigrationMoveStatus": {
36077
36415
  capName: "recording",
36078
36416
  capScope: "system",
@@ -36619,12 +36957,30 @@ Object.freeze({
36619
36957
  addonId: null,
36620
36958
  access: "create"
36621
36959
  },
36960
+ "storageMigration.drain": {
36961
+ capName: "storage-migration",
36962
+ capScope: "system",
36963
+ addonId: null,
36964
+ access: "create"
36965
+ },
36966
+ "storageMigration.movers": {
36967
+ capName: "storage-migration",
36968
+ capScope: "system",
36969
+ addonId: null,
36970
+ access: "view"
36971
+ },
36622
36972
  "storageMigration.plan": {
36623
36973
  capName: "storage-migration",
36624
36974
  capScope: "system",
36625
36975
  addonId: null,
36626
36976
  access: "view"
36627
36977
  },
36978
+ "storageMigration.residue": {
36979
+ capName: "storage-migration",
36980
+ capScope: "system",
36981
+ addonId: null,
36982
+ access: "view"
36983
+ },
36628
36984
  "storageMigration.start": {
36629
36985
  capName: "storage-migration",
36630
36986
  capScope: "system",
@@ -37459,6 +37815,12 @@ Object.freeze({
37459
37815
  addonId: null,
37460
37816
  access: "delete"
37461
37817
  },
37818
+ "vectorStore.fetchByIds": {
37819
+ capName: "vector-store",
37820
+ capScope: "system",
37821
+ addonId: null,
37822
+ access: "view"
37823
+ },
37462
37824
  "vectorStore.getByIds": {
37463
37825
  capName: "vector-store",
37464
37826
  capScope: "system",
@@ -37471,6 +37833,12 @@ Object.freeze({
37471
37833
  addonId: null,
37472
37834
  access: "view"
37473
37835
  },
37836
+ "vectorStore.scan": {
37837
+ capName: "vector-store",
37838
+ capScope: "system",
37839
+ addonId: null,
37840
+ access: "view"
37841
+ },
37474
37842
  "vectorStore.stats": {
37475
37843
  capName: "vector-store",
37476
37844
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-homematic",
3
- "version": "1.2.44",
3
+ "version": "1.2.47",
4
4
  "description": "Homematic / HomematicIP (CCU3 / RaspberryMatic) device-provider addon for CamStack — wraps the nodehomematic library",
5
5
  "keywords": [
6
6
  "camstack",