@camstack/addon-provider-rademacher 0.2.42 → 0.2.45

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
@@ -8988,6 +8988,21 @@ var RelocateJobSchema = object({
8988
8988
  bytesMoved: number().int(),
8989
8989
  /** Total files discovered up front; null while (or when) unknown. */
8990
8990
  filesTotal: number().int().nullable(),
8991
+ /**
8992
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8993
+ * made that nobody asked for, so it is reported where the operator reads the
8994
+ * job rather than only in a log line.
8995
+ *
8996
+ * A footage segment records its byte count in its own NAME, and the durable
8997
+ * hour row derives its aggregates from those names. A file that does not
8998
+ * match its name therefore makes the ledger's sums — and with them quota and
8999
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
9000
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
9001
+ *
9002
+ * Absent on lanes where the question has no meaning: a media blob's size is
9003
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
9004
+ */
9005
+ rowsReconciled: number().int().nonnegative().optional(),
8991
9006
  startedAt: number(),
8992
9007
  finishedAt: number().nullable(),
8993
9008
  error: string().nullable()
@@ -9056,14 +9071,42 @@ var RelocateMediaInputSchema = object({
9056
9071
  /** Omitted = `move`, the pre-existing behaviour. */
9057
9072
  mode: MediaRelocateModeSchema.optional()
9058
9073
  });
9059
- /** How many rows still carry NO `locationId` — the population a repoint would
9060
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
9061
- * value that permits a non-blocking `eventMedia` cutover. */
9062
- var UnstampedEventMediaCountSchema = object({
9063
- media: number().int().nonnegative(),
9064
- retrainFrames: number().int().nonnegative(),
9065
- total: number().int().nonnegative()
9074
+ /**
9075
+ * The unstamped population of ONE collection split, because the gate and the
9076
+ * operator ask two different questions and only one of them has to be cheap.
9077
+ *
9078
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
9079
+ * repoint". It is a single indexed seek to the first matching row, so it stays
9080
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
9081
+ * that matters — after a seal, when the population is empty.
9082
+ *
9083
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
9084
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
9085
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
9086
+ * and useful answer: "there are some, and this read could not say how many"
9087
+ * still refuses the cutover, which is the whole job.
9088
+ */
9089
+ var UnstampedRowsSchema = object({
9090
+ present: boolean(),
9091
+ rows: number().int().nonnegative().nullable()
9066
9092
  });
9093
+ /**
9094
+ * How many rows still carry NO `locationId` — the population a repoint would
9095
+ * silently re-aim at a disk that does not hold their bytes.
9096
+ *
9097
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
9098
+ * over. The gate opens on a measured absence and on nothing else; an unread
9099
+ * collection and an empty one are different facts, and this repo has already
9100
+ * paid for conflating them (`RelocateResidueSchema`, D295).
9101
+ */
9102
+ var UnstampedEventMediaCountSchema = object({
9103
+ media: UnstampedRowsSchema,
9104
+ retrainFrames: UnstampedRowsSchema,
9105
+ /** True when EITHER collection holds one. The refusal reads this. */
9106
+ anyPresent: boolean(),
9107
+ /** Sum across both, or `null` when either lane could not be counted. */
9108
+ total: number().int().nonnegative().nullable()
9109
+ }).nullable();
9067
9110
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
9068
9111
  /** The independently selectable logical storage classes — every class
9069
9112
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -9149,13 +9192,53 @@ var StorageMigrationParticipantSchema = _enum([
9149
9192
  "recorder",
9150
9193
  "analytics"
9151
9194
  ]);
9195
+ /**
9196
+ * The mover's own numbers, folded onto the coordinator's durable move record.
9197
+ *
9198
+ * The long half of a non-blocking migration is `draining`, and it is measured
9199
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
9200
+ * existed the only place those numbers appeared was a Loki line, so an operator
9201
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
9202
+ * afternoon.
9203
+ *
9204
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
9205
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
9206
+ * mover — which is the exact failure this is meant to end. The coordinator's
9207
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
9208
+ * read `state`; folding the counters costs no extra read and makes the durable
9209
+ * record say afterwards how far a move actually got.
9210
+ *
9211
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
9212
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
9213
+ * cannot say M, and a 0 there would render as "100 % done".
9214
+ */
9215
+ var StorageMigrationMoveProgressSchema = object({
9216
+ filesMoved: number().int().nonnegative(),
9217
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
9218
+ filesTotal: number().int().nonnegative().nullable(),
9219
+ bytesMoved: number().int().nonnegative(),
9220
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
9221
+ * a lane that cannot reconcile. A migration that silently rewrote durable
9222
+ * rows would be the same failure as one that silently skipped them. */
9223
+ rowsReconciled: number().int().nonnegative().optional(),
9224
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
9225
+ * crash gets a new mover, and a rate computed from the migration's start
9226
+ * would silently average in the time nothing was running. */
9227
+ startedAt: number(),
9228
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
9229
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
9230
+ * subtract its own. */
9231
+ observedAt: number()
9232
+ });
9152
9233
  var StorageMigrationMoveSchema = object({
9153
9234
  storageClass: StorageMigrationClassSchema,
9154
9235
  fromLocationId: string(),
9155
9236
  toLocationId: string(),
9156
9237
  moverJobId: string().nullable(),
9157
9238
  state: RelocateJobStateSchema.nullable(),
9158
- error: string().nullable()
9239
+ error: string().nullable(),
9240
+ /** Last observed mover counters; `null` until the mover has been polled once. */
9241
+ progress: StorageMigrationMoveProgressSchema.nullable()
9159
9242
  });
9160
9243
  var StorageMigrationJobSchema = object({
9161
9244
  jobId: string(),
@@ -9201,6 +9284,98 @@ var StorageMigrationPlanSchema = object({
9201
9284
  findings: array(StorageMigrationFindingSchema)
9202
9285
  });
9203
9286
  /**
9287
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
9288
+ *
9289
+ * The coordinator's job record is the state of record for a migration, and its
9290
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
9291
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
9292
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
9293
+ * way because no supported UI path existed. A mover armed like that has no job
9294
+ * to fold progress into, so it has to be readable on its own or it is invisible.
9295
+ *
9296
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
9297
+ * orchestrated it.
9298
+ */
9299
+ var StorageMigrationMoverSchema = object({
9300
+ lane: _enum(["footage", "media"]),
9301
+ job: RelocateJobSchema,
9302
+ /** The coordinator job that armed this mover, or `null` for a mover armed
9303
+ * directly against the owning addon. */
9304
+ migrationJobId: string().nullable(),
9305
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
9306
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
9307
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
9308
+ * rate made of two different clocks. */
9309
+ observedAt: number()
9310
+ });
9311
+ /**
9312
+ * What a SOURCE still holds for one storage class — the number that makes a
9313
+ * "drain remaining" action honest rather than hopeful.
9314
+ *
9315
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
9316
+ * engine's own selection count for media), never from the resident index: a
9317
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
9318
+ * never been told about (D295).
9319
+ *
9320
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
9321
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
9322
+ * because refusing on an unanswerable read would hide exactly the case an
9323
+ * operator needs to act on.
9324
+ */
9325
+ var StorageMigrationResidueSchema = object({
9326
+ storageClass: StorageMigrationClassSchema,
9327
+ /** The location still holding the data. `'*'` for the media lane, whose rows
9328
+ * move from wherever they are rather than from one named source. */
9329
+ fromLocationId: string(),
9330
+ /** Where a drain would move it — the class's CURRENT default. */
9331
+ toLocationId: string(),
9332
+ /** Segments (footage lane) or rows (media lane) still on the source. */
9333
+ items: number().int().nonnegative().nullable(),
9334
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
9335
+ bytes: number().int().nonnegative().nullable()
9336
+ });
9337
+ /**
9338
+ * Run the DRAIN half and nothing else.
9339
+ *
9340
+ * A migration that reached `done` has already repointed, so `start` correctly
9341
+ * refuses its destination ("already the default") — there is nothing left to
9342
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
9343
+ * or finish against a work list that was a tenth of the archive (D295), and
9344
+ * before this there was no supported way to run only that half: the only way
9345
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
9346
+ *
9347
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
9348
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
9349
+ * re-repoint a class that is already migrated.
9350
+ */
9351
+ var StorageMigrationDrainInputSchema = object({
9352
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
9353
+ * a class whose source is already empty is refused rather than started. */
9354
+ classes: array(StorageMigrationClassSchema).min(1),
9355
+ throttleMbps: number().min(1).max(1e3).optional()
9356
+ });
9357
+ /** What a footage source still holds, asked of the durable hour ledger. */
9358
+ var RelocateResidueInputSchema = object({
9359
+ fromLocationId: string().min(1),
9360
+ /** Narrow to one logical class; omit for every profile on the location. */
9361
+ footageClass: RelocateFootageClassSchema.optional()
9362
+ });
9363
+ /** `null` = the archive could not answer (no ledger on this node, or the
9364
+ * aggregate failed). Never conflated with an empty source. */
9365
+ var RelocateResidueSchema = object({
9366
+ segments: number().int().nonnegative(),
9367
+ bytes: number().int().nonnegative()
9368
+ }).nullable();
9369
+ /** How many rows a media pass would still act on against a given target — the
9370
+ * media lane's denominator AND its residue, from ONE derivation so the two can
9371
+ * never disagree. `null` = the count could not be taken. */
9372
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
9373
+ var RelocatableMediaCountInputSchema = object({
9374
+ toLocationId: string().min(1),
9375
+ /** Omitted = `move`. */
9376
+ mode: MediaRelocateModeSchema.optional()
9377
+ });
9378
+ /**
9204
9379
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
9205
9380
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
9206
9381
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -9304,6 +9479,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
9304
9479
  * two addons declaring the same `id` must agree on `cardinality` (validated
9305
9480
  * at kernel aggregation time, not here).
9306
9481
  */
9482
+ /**
9483
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
9484
+ * actually reaches the bytes. It is the constraint that decides which
9485
+ * `storage-provider`s may back a location of that kind.
9486
+ *
9487
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
9488
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
9489
+ * post-analysis media roots). Only a provider that serves a genuine local
9490
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
9491
+ * remote provider's `resolve` returns a path on the REMOTE host, and
9492
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
9493
+ * against a same-named local directory that is something else entirely.
9494
+ *
9495
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
9496
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
9497
+ * service never sees a path, so any provider can back it. `backups` is the
9498
+ * one kind that qualifies today.
9499
+ *
9500
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
9501
+ * an EMERGENT property of how the recorder happened to be written. Nothing
9502
+ * refused the configuration; the first write simply went somewhere wrong, and
9503
+ * a recording write that goes wrong surfaces as a silent black window rather
9504
+ * than an error (the read path does not `stat`). This turns that accident into
9505
+ * a declared, enforced, testable refusal.
9506
+ */
9507
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
9307
9508
  var StorageLocationDeclarationSchema = object({
9308
9509
  /**
9309
9510
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -9323,6 +9524,19 @@ var StorageLocationDeclarationSchema = object({
9323
9524
  */
9324
9525
  cardinality: _enum(["single", "multi"]),
9325
9526
  /**
9527
+ * HOW the declaring service reaches the bytes — and therefore WHICH
9528
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
9529
+ * and {@link STORAGE_ACCESS_FALLBACK}.
9530
+ *
9531
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
9532
+ * can only over-restrict (refuse a remote provider for a kind that might
9533
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
9534
+ * permissive direction and is therefore never inferred — a repo guard
9535
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
9536
+ * reached by omission.
9537
+ */
9538
+ access: StorageAccessSchema.optional(),
9539
+ /**
9326
9540
  * When set, the default instance for this location inherits its resolved
9327
9541
  * root from the named location's default instance. Useful for derivative
9328
9542
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -19190,8 +19404,10 @@ var TrackSchema = object({
19190
19404
  lastSeen: number(),
19191
19405
  /** Frame-rate position history (subject to maxPositionHistory cap). */
19192
19406
  positions: array(TrackPositionSchema).readonly(),
19193
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
19194
- * saveThumbnails policy). */
19407
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
19408
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
19409
+ * the retired `saveThumbnails` used to gate this and the rolling
19410
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
19195
19411
  snapshots: array(TrackSnapshotSchema).readonly(),
19196
19412
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
19197
19413
  zonesVisited: array(string()).readonly(),
@@ -20051,7 +20267,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
20051
20267
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
20052
20268
  kind: "mutation",
20053
20269
  auth: "admin"
20054
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
20270
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
20271
+ kind: "query",
20272
+ auth: "admin"
20273
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
20055
20274
  kind: "query",
20056
20275
  auth: "admin"
20057
20276
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -22010,6 +22229,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22010
22229
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
22011
22230
  kind: "mutation",
22012
22231
  auth: "admin"
22232
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
22233
+ kind: "mutation",
22234
+ auth: "admin"
22013
22235
  });
22014
22236
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22015
22237
  providerId: string().min(1),
@@ -22408,12 +22630,38 @@ response: record(string(), unknown()) }), object({
22408
22630
  *
22409
22631
  * ## Why this is a capability and not a helper
22410
22632
  *
22411
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
22412
- * plate, vehicle, identity, and the event store's derivativesand every one of
22413
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
22414
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
22415
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
22416
- * load 5,000 rows before ranking anything.
22633
+ * This capability was introduced with the claim that SIX stores in
22634
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
22635
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
22636
+ * claim was never true, and leaving it here made five stores look like pending
22637
+ * work when three of them have no vector at all. Counted column by column on
22638
+ * 2026-08-30, exactly THREE ever held one:
22639
+ *
22640
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
22641
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
22642
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
22643
+ * face, migrated 2026-08-30 into its OWN index (see below).
22644
+ *
22645
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
22646
+ * and `identities` store a name; the event store stores no derivative vector.
22647
+ * They are not migration candidates and never were.
22648
+ *
22649
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
22650
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
22651
+ * rows before ranking anything.
22652
+ *
22653
+ * ## One index per COMPARISON, never per encoder
22654
+ *
22655
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
22656
+ * model, and they still get two indexes. An index is a set of things that are
22657
+ * ranked against each other and that live and die together, and these two are
22658
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
22659
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
22660
+ * forever and is the gallery every recognition ranks against. One index would
22661
+ * mean every gallery load and every reconcile carried a filter whose failure
22662
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
22663
+ * person's only sample. The dimension they share is not a reason to share an
22664
+ * index; the question they answer is, and it differs.
22417
22665
  *
22418
22666
  * The fix is not a faster loop, it is a different backend — and the backend
22419
22667
  * should be replaceable without touching six callers. So: a singleton
@@ -22518,7 +22766,20 @@ var VectorQueryResultSchema = object({
22518
22766
  */
22519
22767
  scanned: number(),
22520
22768
  /** True when the backend could not consider every row that passed the filter. */
22521
- truncated: boolean()
22769
+ truncated: boolean(),
22770
+ /**
22771
+ * The `topK` the backend actually ran with.
22772
+ *
22773
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
22774
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
22775
+ * own log rather than in its answer. That is how an audit asking for 20,000
22776
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
22777
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
22778
+ * MUCH, in the return value, where the caller cannot fail to see it.
22779
+ *
22780
+ * Equals the requested `topK` whenever nothing was lowered.
22781
+ */
22782
+ effectiveTopK: number().int().positive()
22522
22783
  });
22523
22784
  var VectorDeleteInputSchema = object({
22524
22785
  index: string(),
@@ -22547,6 +22808,68 @@ var VectorGetResultSchema = object({ items: array(object({
22547
22808
  id: string(),
22548
22809
  metadata: VectorMetadataSchema
22549
22810
  })) });
22811
+ /**
22812
+ * Ids to read back WITH their vectors.
22813
+ *
22814
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22815
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22816
+ * caller depends on that promise. This one promises the opposite.
22817
+ *
22818
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22819
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22820
+ * a per-face cross-process KNN would be a network round trip inside the
22821
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22822
+ * it requires the index to hand the floats back. Without this method the only
22823
+ * way to keep a readable vector is a JSON column, which is the thing this
22824
+ * capability exists to delete.
22825
+ *
22826
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22827
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22828
+ */
22829
+ var VectorFetchInputSchema = object({
22830
+ index: string(),
22831
+ ids: array(string())
22832
+ });
22833
+ var VectorFetchResultSchema = object({ items: array(object({
22834
+ id: string(),
22835
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22836
+ vector: string(),
22837
+ metadata: VectorMetadataSchema
22838
+ })) });
22839
+ /**
22840
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22841
+ *
22842
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22843
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22844
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22845
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22846
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22847
+ * looked" for as long as anyone cared to read it.
22848
+ *
22849
+ * This is the primitive that question actually needs: a bounded page, ordered
22850
+ * by the backend's own row order, costing no distance computation at all.
22851
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22852
+ * the full-table read this capability was built to stop.
22853
+ */
22854
+ var VectorScanInputSchema = object({
22855
+ index: string(),
22856
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22857
+ cursor: number().int().nonnegative().default(0),
22858
+ limit: number().int().positive()
22859
+ });
22860
+ var VectorScanResultSchema = object({
22861
+ items: array(object({
22862
+ id: string(),
22863
+ metadata: VectorMetadataSchema
22864
+ })),
22865
+ /**
22866
+ * Where the next page starts, or `null` when the walk reached the end.
22867
+ *
22868
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22869
+ * from a short page: a backend is free to return fewer rows than asked.
22870
+ */
22871
+ nextCursor: number().int().nonnegative().nullable()
22872
+ });
22550
22873
  var VectorStatsInputSchema = object({ index: string() });
22551
22874
  var VectorStatsResultSchema = object({
22552
22875
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -22565,7 +22888,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
22565
22888
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
22566
22889
  kind: "mutation",
22567
22890
  auth: "admin"
22568
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22891
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22569
22892
  kind: "mutation",
22570
22893
  auth: "admin"
22571
22894
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -29184,6 +29507,9 @@ method(object({
29184
29507
  }), method(object({}), array(RelocateJobSchema).readonly(), {
29185
29508
  kind: "query",
29186
29509
  auth: "admin"
29510
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
29511
+ kind: "query",
29512
+ auth: "admin"
29187
29513
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
29188
29514
  kind: "mutation",
29189
29515
  auth: "admin"
@@ -35818,6 +36144,12 @@ Object.freeze({
35818
36144
  addonId: null,
35819
36145
  access: "create"
35820
36146
  },
36147
+ "pipelineAnalytics.countRelocatableMedia": {
36148
+ capName: "pipeline-analytics",
36149
+ capScope: "device",
36150
+ addonId: null,
36151
+ access: "view"
36152
+ },
35821
36153
  "pipelineAnalytics.countUnstampedEventMedia": {
35822
36154
  capName: "pipeline-analytics",
35823
36155
  capScope: "device",
@@ -36982,6 +37314,12 @@ Object.freeze({
36982
37314
  addonId: null,
36983
37315
  access: "view"
36984
37316
  },
37317
+ "recording.getRelocateResidue": {
37318
+ capName: "recording",
37319
+ capScope: "system",
37320
+ addonId: null,
37321
+ access: "view"
37322
+ },
36985
37323
  "recording.getStorageMigrationMoveStatus": {
36986
37324
  capName: "recording",
36987
37325
  capScope: "system",
@@ -37528,12 +37866,30 @@ Object.freeze({
37528
37866
  addonId: null,
37529
37867
  access: "create"
37530
37868
  },
37869
+ "storageMigration.drain": {
37870
+ capName: "storage-migration",
37871
+ capScope: "system",
37872
+ addonId: null,
37873
+ access: "create"
37874
+ },
37875
+ "storageMigration.movers": {
37876
+ capName: "storage-migration",
37877
+ capScope: "system",
37878
+ addonId: null,
37879
+ access: "view"
37880
+ },
37531
37881
  "storageMigration.plan": {
37532
37882
  capName: "storage-migration",
37533
37883
  capScope: "system",
37534
37884
  addonId: null,
37535
37885
  access: "view"
37536
37886
  },
37887
+ "storageMigration.residue": {
37888
+ capName: "storage-migration",
37889
+ capScope: "system",
37890
+ addonId: null,
37891
+ access: "view"
37892
+ },
37537
37893
  "storageMigration.start": {
37538
37894
  capName: "storage-migration",
37539
37895
  capScope: "system",
@@ -38368,6 +38724,12 @@ Object.freeze({
38368
38724
  addonId: null,
38369
38725
  access: "delete"
38370
38726
  },
38727
+ "vectorStore.fetchByIds": {
38728
+ capName: "vector-store",
38729
+ capScope: "system",
38730
+ addonId: null,
38731
+ access: "view"
38732
+ },
38371
38733
  "vectorStore.getByIds": {
38372
38734
  capName: "vector-store",
38373
38735
  capScope: "system",
@@ -38380,6 +38742,12 @@ Object.freeze({
38380
38742
  addonId: null,
38381
38743
  access: "view"
38382
38744
  },
38745
+ "vectorStore.scan": {
38746
+ capName: "vector-store",
38747
+ capScope: "system",
38748
+ addonId: null,
38749
+ access: "view"
38750
+ },
38383
38751
  "vectorStore.stats": {
38384
38752
  capName: "vector-store",
38385
38753
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8987,6 +8987,21 @@ var RelocateJobSchema = object({
8987
8987
  bytesMoved: number().int(),
8988
8988
  /** Total files discovered up front; null while (or when) unknown. */
8989
8989
  filesTotal: number().int().nullable(),
8990
+ /**
8991
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8992
+ * made that nobody asked for, so it is reported where the operator reads the
8993
+ * job rather than only in a log line.
8994
+ *
8995
+ * A footage segment records its byte count in its own NAME, and the durable
8996
+ * hour row derives its aggregates from those names. A file that does not
8997
+ * match its name therefore makes the ledger's sums — and with them quota and
8998
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8999
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
9000
+ *
9001
+ * Absent on lanes where the question has no meaning: a media blob's size is
9002
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
9003
+ */
9004
+ rowsReconciled: number().int().nonnegative().optional(),
8990
9005
  startedAt: number(),
8991
9006
  finishedAt: number().nullable(),
8992
9007
  error: string().nullable()
@@ -9055,14 +9070,42 @@ var RelocateMediaInputSchema = object({
9055
9070
  /** Omitted = `move`, the pre-existing behaviour. */
9056
9071
  mode: MediaRelocateModeSchema.optional()
9057
9072
  });
9058
- /** How many rows still carry NO `locationId` — the population a repoint would
9059
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
9060
- * value that permits a non-blocking `eventMedia` cutover. */
9061
- var UnstampedEventMediaCountSchema = object({
9062
- media: number().int().nonnegative(),
9063
- retrainFrames: number().int().nonnegative(),
9064
- total: number().int().nonnegative()
9073
+ /**
9074
+ * The unstamped population of ONE collection split, because the gate and the
9075
+ * operator ask two different questions and only one of them has to be cheap.
9076
+ *
9077
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
9078
+ * repoint". It is a single indexed seek to the first matching row, so it stays
9079
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
9080
+ * that matters — after a seal, when the population is empty.
9081
+ *
9082
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
9083
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
9084
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
9085
+ * and useful answer: "there are some, and this read could not say how many"
9086
+ * still refuses the cutover, which is the whole job.
9087
+ */
9088
+ var UnstampedRowsSchema = object({
9089
+ present: boolean(),
9090
+ rows: number().int().nonnegative().nullable()
9065
9091
  });
9092
+ /**
9093
+ * How many rows still carry NO `locationId` — the population a repoint would
9094
+ * silently re-aim at a disk that does not hold their bytes.
9095
+ *
9096
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
9097
+ * over. The gate opens on a measured absence and on nothing else; an unread
9098
+ * collection and an empty one are different facts, and this repo has already
9099
+ * paid for conflating them (`RelocateResidueSchema`, D295).
9100
+ */
9101
+ var UnstampedEventMediaCountSchema = object({
9102
+ media: UnstampedRowsSchema,
9103
+ retrainFrames: UnstampedRowsSchema,
9104
+ /** True when EITHER collection holds one. The refusal reads this. */
9105
+ anyPresent: boolean(),
9106
+ /** Sum across both, or `null` when either lane could not be counted. */
9107
+ total: number().int().nonnegative().nullable()
9108
+ }).nullable();
9066
9109
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
9067
9110
  /** The independently selectable logical storage classes — every class
9068
9111
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -9148,13 +9191,53 @@ var StorageMigrationParticipantSchema = _enum([
9148
9191
  "recorder",
9149
9192
  "analytics"
9150
9193
  ]);
9194
+ /**
9195
+ * The mover's own numbers, folded onto the coordinator's durable move record.
9196
+ *
9197
+ * The long half of a non-blocking migration is `draining`, and it is measured
9198
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
9199
+ * existed the only place those numbers appeared was a Loki line, so an operator
9200
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
9201
+ * afternoon.
9202
+ *
9203
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
9204
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
9205
+ * mover — which is the exact failure this is meant to end. The coordinator's
9206
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
9207
+ * read `state`; folding the counters costs no extra read and makes the durable
9208
+ * record say afterwards how far a move actually got.
9209
+ *
9210
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
9211
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
9212
+ * cannot say M, and a 0 there would render as "100 % done".
9213
+ */
9214
+ var StorageMigrationMoveProgressSchema = object({
9215
+ filesMoved: number().int().nonnegative(),
9216
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
9217
+ filesTotal: number().int().nonnegative().nullable(),
9218
+ bytesMoved: number().int().nonnegative(),
9219
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
9220
+ * a lane that cannot reconcile. A migration that silently rewrote durable
9221
+ * rows would be the same failure as one that silently skipped them. */
9222
+ rowsReconciled: number().int().nonnegative().optional(),
9223
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
9224
+ * crash gets a new mover, and a rate computed from the migration's start
9225
+ * would silently average in the time nothing was running. */
9226
+ startedAt: number(),
9227
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
9228
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
9229
+ * subtract its own. */
9230
+ observedAt: number()
9231
+ });
9151
9232
  var StorageMigrationMoveSchema = object({
9152
9233
  storageClass: StorageMigrationClassSchema,
9153
9234
  fromLocationId: string(),
9154
9235
  toLocationId: string(),
9155
9236
  moverJobId: string().nullable(),
9156
9237
  state: RelocateJobStateSchema.nullable(),
9157
- error: string().nullable()
9238
+ error: string().nullable(),
9239
+ /** Last observed mover counters; `null` until the mover has been polled once. */
9240
+ progress: StorageMigrationMoveProgressSchema.nullable()
9158
9241
  });
9159
9242
  var StorageMigrationJobSchema = object({
9160
9243
  jobId: string(),
@@ -9200,6 +9283,98 @@ var StorageMigrationPlanSchema = object({
9200
9283
  findings: array(StorageMigrationFindingSchema)
9201
9284
  });
9202
9285
  /**
9286
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
9287
+ *
9288
+ * The coordinator's job record is the state of record for a migration, and its
9289
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
9290
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
9291
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
9292
+ * way because no supported UI path existed. A mover armed like that has no job
9293
+ * to fold progress into, so it has to be readable on its own or it is invisible.
9294
+ *
9295
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
9296
+ * orchestrated it.
9297
+ */
9298
+ var StorageMigrationMoverSchema = object({
9299
+ lane: _enum(["footage", "media"]),
9300
+ job: RelocateJobSchema,
9301
+ /** The coordinator job that armed this mover, or `null` for a mover armed
9302
+ * directly against the owning addon. */
9303
+ migrationJobId: string().nullable(),
9304
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
9305
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
9306
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
9307
+ * rate made of two different clocks. */
9308
+ observedAt: number()
9309
+ });
9310
+ /**
9311
+ * What a SOURCE still holds for one storage class — the number that makes a
9312
+ * "drain remaining" action honest rather than hopeful.
9313
+ *
9314
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
9315
+ * engine's own selection count for media), never from the resident index: a
9316
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
9317
+ * never been told about (D295).
9318
+ *
9319
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
9320
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
9321
+ * because refusing on an unanswerable read would hide exactly the case an
9322
+ * operator needs to act on.
9323
+ */
9324
+ var StorageMigrationResidueSchema = object({
9325
+ storageClass: StorageMigrationClassSchema,
9326
+ /** The location still holding the data. `'*'` for the media lane, whose rows
9327
+ * move from wherever they are rather than from one named source. */
9328
+ fromLocationId: string(),
9329
+ /** Where a drain would move it — the class's CURRENT default. */
9330
+ toLocationId: string(),
9331
+ /** Segments (footage lane) or rows (media lane) still on the source. */
9332
+ items: number().int().nonnegative().nullable(),
9333
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
9334
+ bytes: number().int().nonnegative().nullable()
9335
+ });
9336
+ /**
9337
+ * Run the DRAIN half and nothing else.
9338
+ *
9339
+ * A migration that reached `done` has already repointed, so `start` correctly
9340
+ * refuses its destination ("already the default") — there is nothing left to
9341
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
9342
+ * or finish against a work list that was a tenth of the archive (D295), and
9343
+ * before this there was no supported way to run only that half: the only way
9344
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
9345
+ *
9346
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
9347
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
9348
+ * re-repoint a class that is already migrated.
9349
+ */
9350
+ var StorageMigrationDrainInputSchema = object({
9351
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
9352
+ * a class whose source is already empty is refused rather than started. */
9353
+ classes: array(StorageMigrationClassSchema).min(1),
9354
+ throttleMbps: number().min(1).max(1e3).optional()
9355
+ });
9356
+ /** What a footage source still holds, asked of the durable hour ledger. */
9357
+ var RelocateResidueInputSchema = object({
9358
+ fromLocationId: string().min(1),
9359
+ /** Narrow to one logical class; omit for every profile on the location. */
9360
+ footageClass: RelocateFootageClassSchema.optional()
9361
+ });
9362
+ /** `null` = the archive could not answer (no ledger on this node, or the
9363
+ * aggregate failed). Never conflated with an empty source. */
9364
+ var RelocateResidueSchema = object({
9365
+ segments: number().int().nonnegative(),
9366
+ bytes: number().int().nonnegative()
9367
+ }).nullable();
9368
+ /** How many rows a media pass would still act on against a given target — the
9369
+ * media lane's denominator AND its residue, from ONE derivation so the two can
9370
+ * never disagree. `null` = the count could not be taken. */
9371
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
9372
+ var RelocatableMediaCountInputSchema = object({
9373
+ toLocationId: string().min(1),
9374
+ /** Omitted = `move`. */
9375
+ mode: MediaRelocateModeSchema.optional()
9376
+ });
9377
+ /**
9203
9378
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
9204
9379
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
9205
9380
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -9303,6 +9478,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
9303
9478
  * two addons declaring the same `id` must agree on `cardinality` (validated
9304
9479
  * at kernel aggregation time, not here).
9305
9480
  */
9481
+ /**
9482
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
9483
+ * actually reaches the bytes. It is the constraint that decides which
9484
+ * `storage-provider`s may back a location of that kind.
9485
+ *
9486
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
9487
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
9488
+ * post-analysis media roots). Only a provider that serves a genuine local
9489
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
9490
+ * remote provider's `resolve` returns a path on the REMOTE host, and
9491
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
9492
+ * against a same-named local directory that is something else entirely.
9493
+ *
9494
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
9495
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
9496
+ * service never sees a path, so any provider can back it. `backups` is the
9497
+ * one kind that qualifies today.
9498
+ *
9499
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
9500
+ * an EMERGENT property of how the recorder happened to be written. Nothing
9501
+ * refused the configuration; the first write simply went somewhere wrong, and
9502
+ * a recording write that goes wrong surfaces as a silent black window rather
9503
+ * than an error (the read path does not `stat`). This turns that accident into
9504
+ * a declared, enforced, testable refusal.
9505
+ */
9506
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
9306
9507
  var StorageLocationDeclarationSchema = object({
9307
9508
  /**
9308
9509
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -9322,6 +9523,19 @@ var StorageLocationDeclarationSchema = object({
9322
9523
  */
9323
9524
  cardinality: _enum(["single", "multi"]),
9324
9525
  /**
9526
+ * HOW the declaring service reaches the bytes — and therefore WHICH
9527
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
9528
+ * and {@link STORAGE_ACCESS_FALLBACK}.
9529
+ *
9530
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
9531
+ * can only over-restrict (refuse a remote provider for a kind that might
9532
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
9533
+ * permissive direction and is therefore never inferred — a repo guard
9534
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
9535
+ * reached by omission.
9536
+ */
9537
+ access: StorageAccessSchema.optional(),
9538
+ /**
9325
9539
  * When set, the default instance for this location inherits its resolved
9326
9540
  * root from the named location's default instance. Useful for derivative
9327
9541
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -19189,8 +19403,10 @@ var TrackSchema = object({
19189
19403
  lastSeen: number(),
19190
19404
  /** Frame-rate position history (subject to maxPositionHistory cap). */
19191
19405
  positions: array(TrackPositionSchema).readonly(),
19192
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
19193
- * saveThumbnails policy). */
19406
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
19407
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
19408
+ * the retired `saveThumbnails` used to gate this and the rolling
19409
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
19194
19410
  snapshots: array(TrackSnapshotSchema).readonly(),
19195
19411
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
19196
19412
  zonesVisited: array(string()).readonly(),
@@ -20050,7 +20266,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
20050
20266
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
20051
20267
  kind: "mutation",
20052
20268
  auth: "admin"
20053
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
20269
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
20270
+ kind: "query",
20271
+ auth: "admin"
20272
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
20054
20273
  kind: "query",
20055
20274
  auth: "admin"
20056
20275
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -22009,6 +22228,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22009
22228
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
22010
22229
  kind: "mutation",
22011
22230
  auth: "admin"
22231
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
22232
+ kind: "mutation",
22233
+ auth: "admin"
22012
22234
  });
22013
22235
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22014
22236
  providerId: string().min(1),
@@ -22407,12 +22629,38 @@ response: record(string(), unknown()) }), object({
22407
22629
  *
22408
22630
  * ## Why this is a capability and not a helper
22409
22631
  *
22410
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
22411
- * plate, vehicle, identity, and the event store's derivativesand every one of
22412
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
22413
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
22414
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
22415
- * load 5,000 rows before ranking anything.
22632
+ * This capability was introduced with the claim that SIX stores in
22633
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
22634
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
22635
+ * claim was never true, and leaving it here made five stores look like pending
22636
+ * work when three of them have no vector at all. Counted column by column on
22637
+ * 2026-08-30, exactly THREE ever held one:
22638
+ *
22639
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
22640
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
22641
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
22642
+ * face, migrated 2026-08-30 into its OWN index (see below).
22643
+ *
22644
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
22645
+ * and `identities` store a name; the event store stores no derivative vector.
22646
+ * They are not migration candidates and never were.
22647
+ *
22648
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
22649
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
22650
+ * rows before ranking anything.
22651
+ *
22652
+ * ## One index per COMPARISON, never per encoder
22653
+ *
22654
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
22655
+ * model, and they still get two indexes. An index is a set of things that are
22656
+ * ranked against each other and that live and die together, and these two are
22657
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
22658
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
22659
+ * forever and is the gallery every recognition ranks against. One index would
22660
+ * mean every gallery load and every reconcile carried a filter whose failure
22661
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
22662
+ * person's only sample. The dimension they share is not a reason to share an
22663
+ * index; the question they answer is, and it differs.
22416
22664
  *
22417
22665
  * The fix is not a faster loop, it is a different backend — and the backend
22418
22666
  * should be replaceable without touching six callers. So: a singleton
@@ -22517,7 +22765,20 @@ var VectorQueryResultSchema = object({
22517
22765
  */
22518
22766
  scanned: number(),
22519
22767
  /** True when the backend could not consider every row that passed the filter. */
22520
- truncated: boolean()
22768
+ truncated: boolean(),
22769
+ /**
22770
+ * The `topK` the backend actually ran with.
22771
+ *
22772
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
22773
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
22774
+ * own log rather than in its answer. That is how an audit asking for 20,000
22775
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
22776
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
22777
+ * MUCH, in the return value, where the caller cannot fail to see it.
22778
+ *
22779
+ * Equals the requested `topK` whenever nothing was lowered.
22780
+ */
22781
+ effectiveTopK: number().int().positive()
22521
22782
  });
22522
22783
  var VectorDeleteInputSchema = object({
22523
22784
  index: string(),
@@ -22546,6 +22807,68 @@ var VectorGetResultSchema = object({ items: array(object({
22546
22807
  id: string(),
22547
22808
  metadata: VectorMetadataSchema
22548
22809
  })) });
22810
+ /**
22811
+ * Ids to read back WITH their vectors.
22812
+ *
22813
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22814
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22815
+ * caller depends on that promise. This one promises the opposite.
22816
+ *
22817
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22818
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22819
+ * a per-face cross-process KNN would be a network round trip inside the
22820
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22821
+ * it requires the index to hand the floats back. Without this method the only
22822
+ * way to keep a readable vector is a JSON column, which is the thing this
22823
+ * capability exists to delete.
22824
+ *
22825
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22826
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22827
+ */
22828
+ var VectorFetchInputSchema = object({
22829
+ index: string(),
22830
+ ids: array(string())
22831
+ });
22832
+ var VectorFetchResultSchema = object({ items: array(object({
22833
+ id: string(),
22834
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22835
+ vector: string(),
22836
+ metadata: VectorMetadataSchema
22837
+ })) });
22838
+ /**
22839
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22840
+ *
22841
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22842
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22843
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22844
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22845
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22846
+ * looked" for as long as anyone cared to read it.
22847
+ *
22848
+ * This is the primitive that question actually needs: a bounded page, ordered
22849
+ * by the backend's own row order, costing no distance computation at all.
22850
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22851
+ * the full-table read this capability was built to stop.
22852
+ */
22853
+ var VectorScanInputSchema = object({
22854
+ index: string(),
22855
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22856
+ cursor: number().int().nonnegative().default(0),
22857
+ limit: number().int().positive()
22858
+ });
22859
+ var VectorScanResultSchema = object({
22860
+ items: array(object({
22861
+ id: string(),
22862
+ metadata: VectorMetadataSchema
22863
+ })),
22864
+ /**
22865
+ * Where the next page starts, or `null` when the walk reached the end.
22866
+ *
22867
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22868
+ * from a short page: a backend is free to return fewer rows than asked.
22869
+ */
22870
+ nextCursor: number().int().nonnegative().nullable()
22871
+ });
22549
22872
  var VectorStatsInputSchema = object({ index: string() });
22550
22873
  var VectorStatsResultSchema = object({
22551
22874
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -22564,7 +22887,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
22564
22887
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
22565
22888
  kind: "mutation",
22566
22889
  auth: "admin"
22567
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22890
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22568
22891
  kind: "mutation",
22569
22892
  auth: "admin"
22570
22893
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -29183,6 +29506,9 @@ method(object({
29183
29506
  }), method(object({}), array(RelocateJobSchema).readonly(), {
29184
29507
  kind: "query",
29185
29508
  auth: "admin"
29509
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
29510
+ kind: "query",
29511
+ auth: "admin"
29186
29512
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
29187
29513
  kind: "mutation",
29188
29514
  auth: "admin"
@@ -35817,6 +36143,12 @@ Object.freeze({
35817
36143
  addonId: null,
35818
36144
  access: "create"
35819
36145
  },
36146
+ "pipelineAnalytics.countRelocatableMedia": {
36147
+ capName: "pipeline-analytics",
36148
+ capScope: "device",
36149
+ addonId: null,
36150
+ access: "view"
36151
+ },
35820
36152
  "pipelineAnalytics.countUnstampedEventMedia": {
35821
36153
  capName: "pipeline-analytics",
35822
36154
  capScope: "device",
@@ -36981,6 +37313,12 @@ Object.freeze({
36981
37313
  addonId: null,
36982
37314
  access: "view"
36983
37315
  },
37316
+ "recording.getRelocateResidue": {
37317
+ capName: "recording",
37318
+ capScope: "system",
37319
+ addonId: null,
37320
+ access: "view"
37321
+ },
36984
37322
  "recording.getStorageMigrationMoveStatus": {
36985
37323
  capName: "recording",
36986
37324
  capScope: "system",
@@ -37527,12 +37865,30 @@ Object.freeze({
37527
37865
  addonId: null,
37528
37866
  access: "create"
37529
37867
  },
37868
+ "storageMigration.drain": {
37869
+ capName: "storage-migration",
37870
+ capScope: "system",
37871
+ addonId: null,
37872
+ access: "create"
37873
+ },
37874
+ "storageMigration.movers": {
37875
+ capName: "storage-migration",
37876
+ capScope: "system",
37877
+ addonId: null,
37878
+ access: "view"
37879
+ },
37530
37880
  "storageMigration.plan": {
37531
37881
  capName: "storage-migration",
37532
37882
  capScope: "system",
37533
37883
  addonId: null,
37534
37884
  access: "view"
37535
37885
  },
37886
+ "storageMigration.residue": {
37887
+ capName: "storage-migration",
37888
+ capScope: "system",
37889
+ addonId: null,
37890
+ access: "view"
37891
+ },
37536
37892
  "storageMigration.start": {
37537
37893
  capName: "storage-migration",
37538
37894
  capScope: "system",
@@ -38367,6 +38723,12 @@ Object.freeze({
38367
38723
  addonId: null,
38368
38724
  access: "delete"
38369
38725
  },
38726
+ "vectorStore.fetchByIds": {
38727
+ capName: "vector-store",
38728
+ capScope: "system",
38729
+ addonId: null,
38730
+ access: "view"
38731
+ },
38370
38732
  "vectorStore.getByIds": {
38371
38733
  capName: "vector-store",
38372
38734
  capScope: "system",
@@ -38379,6 +38741,12 @@ Object.freeze({
38379
38741
  addonId: null,
38380
38742
  access: "view"
38381
38743
  },
38744
+ "vectorStore.scan": {
38745
+ capName: "vector-store",
38746
+ capScope: "system",
38747
+ addonId: null,
38748
+ access: "view"
38749
+ },
38382
38750
  "vectorStore.stats": {
38383
38751
  capName: "vector-store",
38384
38752
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-rademacher",
3
- "version": "0.2.42",
3
+ "version": "0.2.45",
4
4
  "description": "Rademacher HomePilot device-provider addon for CamStack — wraps the @apocaliss92/noderademacher local-hub client (roller shutters over the cover cap)",
5
5
  "keywords": [
6
6
  "camstack",