@camstack/addon-mqtt-broker 1.2.43 → 1.2.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8032,6 +8032,21 @@ var RelocateJobSchema = object({
8032
8032
  bytesMoved: number().int(),
8033
8033
  /** Total files discovered up front; null while (or when) unknown. */
8034
8034
  filesTotal: number().int().nullable(),
8035
+ /**
8036
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8037
+ * made that nobody asked for, so it is reported where the operator reads the
8038
+ * job rather than only in a log line.
8039
+ *
8040
+ * A footage segment records its byte count in its own NAME, and the durable
8041
+ * hour row derives its aggregates from those names. A file that does not
8042
+ * match its name therefore makes the ledger's sums — and with them quota and
8043
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8044
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8045
+ *
8046
+ * Absent on lanes where the question has no meaning: a media blob's size is
8047
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8048
+ */
8049
+ rowsReconciled: number().int().nonnegative().optional(),
8035
8050
  startedAt: number(),
8036
8051
  finishedAt: number().nullable(),
8037
8052
  error: string().nullable()
@@ -8100,14 +8115,42 @@ var RelocateMediaInputSchema = object({
8100
8115
  /** Omitted = `move`, the pre-existing behaviour. */
8101
8116
  mode: MediaRelocateModeSchema.optional()
8102
8117
  });
8103
- /** How many rows still carry NO `locationId` — the population a repoint would
8104
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8105
- * value that permits a non-blocking `eventMedia` cutover. */
8106
- var UnstampedEventMediaCountSchema = object({
8107
- media: number().int().nonnegative(),
8108
- retrainFrames: number().int().nonnegative(),
8109
- total: number().int().nonnegative()
8118
+ /**
8119
+ * The unstamped population of ONE collection — split, because the gate and the
8120
+ * operator ask two different questions and only one of them has to be cheap.
8121
+ *
8122
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8123
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8124
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8125
+ * that matters — after a seal, when the population is empty.
8126
+ *
8127
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8128
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8129
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8130
+ * and useful answer: "there are some, and this read could not say how many"
8131
+ * still refuses the cutover, which is the whole job.
8132
+ */
8133
+ var UnstampedRowsSchema = object({
8134
+ present: boolean(),
8135
+ rows: number().int().nonnegative().nullable()
8110
8136
  });
8137
+ /**
8138
+ * How many rows still carry NO `locationId` — the population a repoint would
8139
+ * silently re-aim at a disk that does not hold their bytes.
8140
+ *
8141
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8142
+ * over. The gate opens on a measured absence and on nothing else; an unread
8143
+ * collection and an empty one are different facts, and this repo has already
8144
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8145
+ */
8146
+ var UnstampedEventMediaCountSchema = object({
8147
+ media: UnstampedRowsSchema,
8148
+ retrainFrames: UnstampedRowsSchema,
8149
+ /** True when EITHER collection holds one. The refusal reads this. */
8150
+ anyPresent: boolean(),
8151
+ /** Sum across both, or `null` when either lane could not be counted. */
8152
+ total: number().int().nonnegative().nullable()
8153
+ }).nullable();
8111
8154
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8112
8155
  /** The independently selectable logical storage classes — every class
8113
8156
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8193,13 +8236,53 @@ var StorageMigrationParticipantSchema = _enum([
8193
8236
  "recorder",
8194
8237
  "analytics"
8195
8238
  ]);
8239
+ /**
8240
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8241
+ *
8242
+ * The long half of a non-blocking migration is `draining`, and it is measured
8243
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8244
+ * existed the only place those numbers appeared was a Loki line, so an operator
8245
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8246
+ * afternoon.
8247
+ *
8248
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8249
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8250
+ * mover — which is the exact failure this is meant to end. The coordinator's
8251
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8252
+ * read `state`; folding the counters costs no extra read and makes the durable
8253
+ * record say afterwards how far a move actually got.
8254
+ *
8255
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8256
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8257
+ * cannot say M, and a 0 there would render as "100 % done".
8258
+ */
8259
+ var StorageMigrationMoveProgressSchema = object({
8260
+ filesMoved: number().int().nonnegative(),
8261
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8262
+ filesTotal: number().int().nonnegative().nullable(),
8263
+ bytesMoved: number().int().nonnegative(),
8264
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8265
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8266
+ * rows would be the same failure as one that silently skipped them. */
8267
+ rowsReconciled: number().int().nonnegative().optional(),
8268
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8269
+ * crash gets a new mover, and a rate computed from the migration's start
8270
+ * would silently average in the time nothing was running. */
8271
+ startedAt: number(),
8272
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8273
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8274
+ * subtract its own. */
8275
+ observedAt: number()
8276
+ });
8196
8277
  var StorageMigrationMoveSchema = object({
8197
8278
  storageClass: StorageMigrationClassSchema,
8198
8279
  fromLocationId: string(),
8199
8280
  toLocationId: string(),
8200
8281
  moverJobId: string().nullable(),
8201
8282
  state: RelocateJobStateSchema.nullable(),
8202
- error: string().nullable()
8283
+ error: string().nullable(),
8284
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8285
+ progress: StorageMigrationMoveProgressSchema.nullable()
8203
8286
  });
8204
8287
  var StorageMigrationJobSchema = object({
8205
8288
  jobId: string(),
@@ -8245,6 +8328,98 @@ var StorageMigrationPlanSchema = object({
8245
8328
  findings: array(StorageMigrationFindingSchema)
8246
8329
  });
8247
8330
  /**
8331
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8332
+ *
8333
+ * The coordinator's job record is the state of record for a migration, and its
8334
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8335
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8336
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8337
+ * way because no supported UI path existed. A mover armed like that has no job
8338
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8339
+ *
8340
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8341
+ * orchestrated it.
8342
+ */
8343
+ var StorageMigrationMoverSchema = object({
8344
+ lane: _enum(["footage", "media"]),
8345
+ job: RelocateJobSchema,
8346
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8347
+ * directly against the owning addon. */
8348
+ migrationJobId: string().nullable(),
8349
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8350
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8351
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8352
+ * rate made of two different clocks. */
8353
+ observedAt: number()
8354
+ });
8355
+ /**
8356
+ * What a SOURCE still holds for one storage class — the number that makes a
8357
+ * "drain remaining" action honest rather than hopeful.
8358
+ *
8359
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8360
+ * engine's own selection count for media), never from the resident index: a
8361
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8362
+ * never been told about (D295).
8363
+ *
8364
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8365
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8366
+ * because refusing on an unanswerable read would hide exactly the case an
8367
+ * operator needs to act on.
8368
+ */
8369
+ var StorageMigrationResidueSchema = object({
8370
+ storageClass: StorageMigrationClassSchema,
8371
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8372
+ * move from wherever they are rather than from one named source. */
8373
+ fromLocationId: string(),
8374
+ /** Where a drain would move it — the class's CURRENT default. */
8375
+ toLocationId: string(),
8376
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8377
+ items: number().int().nonnegative().nullable(),
8378
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8379
+ bytes: number().int().nonnegative().nullable()
8380
+ });
8381
+ /**
8382
+ * Run the DRAIN half and nothing else.
8383
+ *
8384
+ * A migration that reached `done` has already repointed, so `start` correctly
8385
+ * refuses its destination ("already the default") — there is nothing left to
8386
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8387
+ * or finish against a work list that was a tenth of the archive (D295), and
8388
+ * before this there was no supported way to run only that half: the only way
8389
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8390
+ *
8391
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8392
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8393
+ * re-repoint a class that is already migrated.
8394
+ */
8395
+ var StorageMigrationDrainInputSchema = object({
8396
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8397
+ * a class whose source is already empty is refused rather than started. */
8398
+ classes: array(StorageMigrationClassSchema).min(1),
8399
+ throttleMbps: number().min(1).max(1e3).optional()
8400
+ });
8401
+ /** What a footage source still holds, asked of the durable hour ledger. */
8402
+ var RelocateResidueInputSchema = object({
8403
+ fromLocationId: string().min(1),
8404
+ /** Narrow to one logical class; omit for every profile on the location. */
8405
+ footageClass: RelocateFootageClassSchema.optional()
8406
+ });
8407
+ /** `null` = the archive could not answer (no ledger on this node, or the
8408
+ * aggregate failed). Never conflated with an empty source. */
8409
+ var RelocateResidueSchema = object({
8410
+ segments: number().int().nonnegative(),
8411
+ bytes: number().int().nonnegative()
8412
+ }).nullable();
8413
+ /** How many rows a media pass would still act on against a given target — the
8414
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8415
+ * never disagree. `null` = the count could not be taken. */
8416
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8417
+ var RelocatableMediaCountInputSchema = object({
8418
+ toLocationId: string().min(1),
8419
+ /** Omitted = `move`. */
8420
+ mode: MediaRelocateModeSchema.optional()
8421
+ });
8422
+ /**
8248
8423
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8249
8424
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8250
8425
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8348,6 +8523,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8348
8523
  * two addons declaring the same `id` must agree on `cardinality` (validated
8349
8524
  * at kernel aggregation time, not here).
8350
8525
  */
8526
+ /**
8527
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8528
+ * actually reaches the bytes. It is the constraint that decides which
8529
+ * `storage-provider`s may back a location of that kind.
8530
+ *
8531
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8532
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8533
+ * post-analysis media roots). Only a provider that serves a genuine local
8534
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8535
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8536
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8537
+ * against a same-named local directory that is something else entirely.
8538
+ *
8539
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8540
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8541
+ * service never sees a path, so any provider can back it. `backups` is the
8542
+ * one kind that qualifies today.
8543
+ *
8544
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8545
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8546
+ * refused the configuration; the first write simply went somewhere wrong, and
8547
+ * a recording write that goes wrong surfaces as a silent black window rather
8548
+ * than an error (the read path does not `stat`). This turns that accident into
8549
+ * a declared, enforced, testable refusal.
8550
+ */
8551
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8351
8552
  var StorageLocationDeclarationSchema = object({
8352
8553
  /**
8353
8554
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8367,6 +8568,19 @@ var StorageLocationDeclarationSchema = object({
8367
8568
  */
8368
8569
  cardinality: _enum(["single", "multi"]),
8369
8570
  /**
8571
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8572
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8573
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8574
+ *
8575
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8576
+ * can only over-restrict (refuse a remote provider for a kind that might
8577
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8578
+ * permissive direction and is therefore never inferred — a repo guard
8579
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8580
+ * reached by omission.
8581
+ */
8582
+ access: StorageAccessSchema.optional(),
8583
+ /**
8370
8584
  * When set, the default instance for this location inherits its resolved
8371
8585
  * root from the named location's default instance. Useful for derivative
8372
8586
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17960,8 +18174,10 @@ var TrackSchema = object({
17960
18174
  lastSeen: number(),
17961
18175
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17962
18176
  positions: array(TrackPositionSchema).readonly(),
17963
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17964
- * saveThumbnails policy). */
18177
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18178
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18179
+ * the retired `saveThumbnails` used to gate this and the rolling
18180
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17965
18181
  snapshots: array(TrackSnapshotSchema).readonly(),
17966
18182
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17967
18183
  zonesVisited: array(string()).readonly(),
@@ -18821,7 +19037,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18821
19037
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18822
19038
  kind: "mutation",
18823
19039
  auth: "admin"
18824
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19040
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19041
+ kind: "query",
19042
+ auth: "admin"
19043
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18825
19044
  kind: "query",
18826
19045
  auth: "admin"
18827
19046
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -20780,6 +20999,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20780
20999
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20781
21000
  kind: "mutation",
20782
21001
  auth: "admin"
21002
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21003
+ kind: "mutation",
21004
+ auth: "admin"
20783
21005
  });
20784
21006
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20785
21007
  providerId: string().min(1),
@@ -21178,12 +21400,38 @@ response: record(string(), unknown()) }), object({
21178
21400
  *
21179
21401
  * ## Why this is a capability and not a helper
21180
21402
  *
21181
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21182
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21183
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21184
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21185
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21186
- * load 5,000 rows before ranking anything.
21403
+ * This capability was introduced with the claim that SIX stores in
21404
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21405
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21406
+ * claim was never true, and leaving it here made five stores look like pending
21407
+ * work when three of them have no vector at all. Counted column by column on
21408
+ * 2026-08-30, exactly THREE ever held one:
21409
+ *
21410
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21411
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21412
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21413
+ * face, migrated 2026-08-30 into its OWN index (see below).
21414
+ *
21415
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21416
+ * and `identities` store a name; the event store stores no derivative vector.
21417
+ * They are not migration candidates and never were.
21418
+ *
21419
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21420
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21421
+ * rows before ranking anything.
21422
+ *
21423
+ * ## One index per COMPARISON, never per encoder
21424
+ *
21425
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21426
+ * model, and they still get two indexes. An index is a set of things that are
21427
+ * ranked against each other and that live and die together, and these two are
21428
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21429
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21430
+ * forever and is the gallery every recognition ranks against. One index would
21431
+ * mean every gallery load and every reconcile carried a filter whose failure
21432
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21433
+ * person's only sample. The dimension they share is not a reason to share an
21434
+ * index; the question they answer is, and it differs.
21187
21435
  *
21188
21436
  * The fix is not a faster loop, it is a different backend — and the backend
21189
21437
  * should be replaceable without touching six callers. So: a singleton
@@ -21288,7 +21536,20 @@ var VectorQueryResultSchema = object({
21288
21536
  */
21289
21537
  scanned: number(),
21290
21538
  /** True when the backend could not consider every row that passed the filter. */
21291
- truncated: boolean()
21539
+ truncated: boolean(),
21540
+ /**
21541
+ * The `topK` the backend actually ran with.
21542
+ *
21543
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21544
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21545
+ * own log rather than in its answer. That is how an audit asking for 20,000
21546
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21547
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21548
+ * MUCH, in the return value, where the caller cannot fail to see it.
21549
+ *
21550
+ * Equals the requested `topK` whenever nothing was lowered.
21551
+ */
21552
+ effectiveTopK: number().int().positive()
21292
21553
  });
21293
21554
  var VectorDeleteInputSchema = object({
21294
21555
  index: string(),
@@ -21317,6 +21578,68 @@ var VectorGetResultSchema = object({ items: array(object({
21317
21578
  id: string(),
21318
21579
  metadata: VectorMetadataSchema
21319
21580
  })) });
21581
+ /**
21582
+ * Ids to read back WITH their vectors.
21583
+ *
21584
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21585
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21586
+ * caller depends on that promise. This one promises the opposite.
21587
+ *
21588
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21589
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21590
+ * a per-face cross-process KNN would be a network round trip inside the
21591
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21592
+ * it requires the index to hand the floats back. Without this method the only
21593
+ * way to keep a readable vector is a JSON column, which is the thing this
21594
+ * capability exists to delete.
21595
+ *
21596
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21597
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21598
+ */
21599
+ var VectorFetchInputSchema = object({
21600
+ index: string(),
21601
+ ids: array(string())
21602
+ });
21603
+ var VectorFetchResultSchema = object({ items: array(object({
21604
+ id: string(),
21605
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21606
+ vector: string(),
21607
+ metadata: VectorMetadataSchema
21608
+ })) });
21609
+ /**
21610
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21611
+ *
21612
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21613
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21614
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21615
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21616
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21617
+ * looked" for as long as anyone cared to read it.
21618
+ *
21619
+ * This is the primitive that question actually needs: a bounded page, ordered
21620
+ * by the backend's own row order, costing no distance computation at all.
21621
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21622
+ * the full-table read this capability was built to stop.
21623
+ */
21624
+ var VectorScanInputSchema = object({
21625
+ index: string(),
21626
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21627
+ cursor: number().int().nonnegative().default(0),
21628
+ limit: number().int().positive()
21629
+ });
21630
+ var VectorScanResultSchema = object({
21631
+ items: array(object({
21632
+ id: string(),
21633
+ metadata: VectorMetadataSchema
21634
+ })),
21635
+ /**
21636
+ * Where the next page starts, or `null` when the walk reached the end.
21637
+ *
21638
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21639
+ * from a short page: a backend is free to return fewer rows than asked.
21640
+ */
21641
+ nextCursor: number().int().nonnegative().nullable()
21642
+ });
21320
21643
  var VectorStatsInputSchema = object({ index: string() });
21321
21644
  var VectorStatsResultSchema = object({
21322
21645
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21335,7 +21658,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21335
21658
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21336
21659
  kind: "mutation",
21337
21660
  auth: "admin"
21338
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21661
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21339
21662
  kind: "mutation",
21340
21663
  auth: "admin"
21341
21664
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26239,6 +26562,9 @@ method(object({
26239
26562
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26240
26563
  kind: "query",
26241
26564
  auth: "admin"
26565
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26566
+ kind: "query",
26567
+ auth: "admin"
26242
26568
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26243
26569
  kind: "mutation",
26244
26570
  auth: "admin"
@@ -31204,6 +31530,12 @@ Object.freeze({
31204
31530
  addonId: null,
31205
31531
  access: "create"
31206
31532
  },
31533
+ "pipelineAnalytics.countRelocatableMedia": {
31534
+ capName: "pipeline-analytics",
31535
+ capScope: "device",
31536
+ addonId: null,
31537
+ access: "view"
31538
+ },
31207
31539
  "pipelineAnalytics.countUnstampedEventMedia": {
31208
31540
  capName: "pipeline-analytics",
31209
31541
  capScope: "device",
@@ -32368,6 +32700,12 @@ Object.freeze({
32368
32700
  addonId: null,
32369
32701
  access: "view"
32370
32702
  },
32703
+ "recording.getRelocateResidue": {
32704
+ capName: "recording",
32705
+ capScope: "system",
32706
+ addonId: null,
32707
+ access: "view"
32708
+ },
32371
32709
  "recording.getStorageMigrationMoveStatus": {
32372
32710
  capName: "recording",
32373
32711
  capScope: "system",
@@ -32914,12 +33252,30 @@ Object.freeze({
32914
33252
  addonId: null,
32915
33253
  access: "create"
32916
33254
  },
33255
+ "storageMigration.drain": {
33256
+ capName: "storage-migration",
33257
+ capScope: "system",
33258
+ addonId: null,
33259
+ access: "create"
33260
+ },
33261
+ "storageMigration.movers": {
33262
+ capName: "storage-migration",
33263
+ capScope: "system",
33264
+ addonId: null,
33265
+ access: "view"
33266
+ },
32917
33267
  "storageMigration.plan": {
32918
33268
  capName: "storage-migration",
32919
33269
  capScope: "system",
32920
33270
  addonId: null,
32921
33271
  access: "view"
32922
33272
  },
33273
+ "storageMigration.residue": {
33274
+ capName: "storage-migration",
33275
+ capScope: "system",
33276
+ addonId: null,
33277
+ access: "view"
33278
+ },
32923
33279
  "storageMigration.start": {
32924
33280
  capName: "storage-migration",
32925
33281
  capScope: "system",
@@ -33754,6 +34110,12 @@ Object.freeze({
33754
34110
  addonId: null,
33755
34111
  access: "delete"
33756
34112
  },
34113
+ "vectorStore.fetchByIds": {
34114
+ capName: "vector-store",
34115
+ capScope: "system",
34116
+ addonId: null,
34117
+ access: "view"
34118
+ },
33757
34119
  "vectorStore.getByIds": {
33758
34120
  capName: "vector-store",
33759
34121
  capScope: "system",
@@ -33766,6 +34128,12 @@ Object.freeze({
33766
34128
  addonId: null,
33767
34129
  access: "view"
33768
34130
  },
34131
+ "vectorStore.scan": {
34132
+ capName: "vector-store",
34133
+ capScope: "system",
34134
+ addonId: null,
34135
+ access: "view"
34136
+ },
33769
34137
  "vectorStore.stats": {
33770
34138
  capName: "vector-store",
33771
34139
  capScope: "system",
@@ -8027,6 +8027,21 @@ var RelocateJobSchema = object({
8027
8027
  bytesMoved: number().int(),
8028
8028
  /** Total files discovered up front; null while (or when) unknown. */
8029
8029
  filesTotal: number().int().nullable(),
8030
+ /**
8031
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8032
+ * made that nobody asked for, so it is reported where the operator reads the
8033
+ * job rather than only in a log line.
8034
+ *
8035
+ * A footage segment records its byte count in its own NAME, and the durable
8036
+ * hour row derives its aggregates from those names. A file that does not
8037
+ * match its name therefore makes the ledger's sums — and with them quota and
8038
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8039
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8040
+ *
8041
+ * Absent on lanes where the question has no meaning: a media blob's size is
8042
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8043
+ */
8044
+ rowsReconciled: number().int().nonnegative().optional(),
8030
8045
  startedAt: number(),
8031
8046
  finishedAt: number().nullable(),
8032
8047
  error: string().nullable()
@@ -8095,14 +8110,42 @@ var RelocateMediaInputSchema = object({
8095
8110
  /** Omitted = `move`, the pre-existing behaviour. */
8096
8111
  mode: MediaRelocateModeSchema.optional()
8097
8112
  });
8098
- /** How many rows still carry NO `locationId` — the population a repoint would
8099
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8100
- * value that permits a non-blocking `eventMedia` cutover. */
8101
- var UnstampedEventMediaCountSchema = object({
8102
- media: number().int().nonnegative(),
8103
- retrainFrames: number().int().nonnegative(),
8104
- total: number().int().nonnegative()
8113
+ /**
8114
+ * The unstamped population of ONE collection — split, because the gate and the
8115
+ * operator ask two different questions and only one of them has to be cheap.
8116
+ *
8117
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8118
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8119
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8120
+ * that matters — after a seal, when the population is empty.
8121
+ *
8122
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8123
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8124
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8125
+ * and useful answer: "there are some, and this read could not say how many"
8126
+ * still refuses the cutover, which is the whole job.
8127
+ */
8128
+ var UnstampedRowsSchema = object({
8129
+ present: boolean(),
8130
+ rows: number().int().nonnegative().nullable()
8105
8131
  });
8132
+ /**
8133
+ * How many rows still carry NO `locationId` — the population a repoint would
8134
+ * silently re-aim at a disk that does not hold their bytes.
8135
+ *
8136
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8137
+ * over. The gate opens on a measured absence and on nothing else; an unread
8138
+ * collection and an empty one are different facts, and this repo has already
8139
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8140
+ */
8141
+ var UnstampedEventMediaCountSchema = object({
8142
+ media: UnstampedRowsSchema,
8143
+ retrainFrames: UnstampedRowsSchema,
8144
+ /** True when EITHER collection holds one. The refusal reads this. */
8145
+ anyPresent: boolean(),
8146
+ /** Sum across both, or `null` when either lane could not be counted. */
8147
+ total: number().int().nonnegative().nullable()
8148
+ }).nullable();
8106
8149
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8107
8150
  /** The independently selectable logical storage classes — every class
8108
8151
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8188,13 +8231,53 @@ var StorageMigrationParticipantSchema = _enum([
8188
8231
  "recorder",
8189
8232
  "analytics"
8190
8233
  ]);
8234
+ /**
8235
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8236
+ *
8237
+ * The long half of a non-blocking migration is `draining`, and it is measured
8238
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8239
+ * existed the only place those numbers appeared was a Loki line, so an operator
8240
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8241
+ * afternoon.
8242
+ *
8243
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8244
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8245
+ * mover — which is the exact failure this is meant to end. The coordinator's
8246
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8247
+ * read `state`; folding the counters costs no extra read and makes the durable
8248
+ * record say afterwards how far a move actually got.
8249
+ *
8250
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8251
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8252
+ * cannot say M, and a 0 there would render as "100 % done".
8253
+ */
8254
+ var StorageMigrationMoveProgressSchema = object({
8255
+ filesMoved: number().int().nonnegative(),
8256
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8257
+ filesTotal: number().int().nonnegative().nullable(),
8258
+ bytesMoved: number().int().nonnegative(),
8259
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8260
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8261
+ * rows would be the same failure as one that silently skipped them. */
8262
+ rowsReconciled: number().int().nonnegative().optional(),
8263
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8264
+ * crash gets a new mover, and a rate computed from the migration's start
8265
+ * would silently average in the time nothing was running. */
8266
+ startedAt: number(),
8267
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8268
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8269
+ * subtract its own. */
8270
+ observedAt: number()
8271
+ });
8191
8272
  var StorageMigrationMoveSchema = object({
8192
8273
  storageClass: StorageMigrationClassSchema,
8193
8274
  fromLocationId: string(),
8194
8275
  toLocationId: string(),
8195
8276
  moverJobId: string().nullable(),
8196
8277
  state: RelocateJobStateSchema.nullable(),
8197
- error: string().nullable()
8278
+ error: string().nullable(),
8279
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8280
+ progress: StorageMigrationMoveProgressSchema.nullable()
8198
8281
  });
8199
8282
  var StorageMigrationJobSchema = object({
8200
8283
  jobId: string(),
@@ -8240,6 +8323,98 @@ var StorageMigrationPlanSchema = object({
8240
8323
  findings: array(StorageMigrationFindingSchema)
8241
8324
  });
8242
8325
  /**
8326
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8327
+ *
8328
+ * The coordinator's job record is the state of record for a migration, and its
8329
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8330
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8331
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8332
+ * way because no supported UI path existed. A mover armed like that has no job
8333
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8334
+ *
8335
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8336
+ * orchestrated it.
8337
+ */
8338
+ var StorageMigrationMoverSchema = object({
8339
+ lane: _enum(["footage", "media"]),
8340
+ job: RelocateJobSchema,
8341
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8342
+ * directly against the owning addon. */
8343
+ migrationJobId: string().nullable(),
8344
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8345
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8346
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8347
+ * rate made of two different clocks. */
8348
+ observedAt: number()
8349
+ });
8350
+ /**
8351
+ * What a SOURCE still holds for one storage class — the number that makes a
8352
+ * "drain remaining" action honest rather than hopeful.
8353
+ *
8354
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8355
+ * engine's own selection count for media), never from the resident index: a
8356
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8357
+ * never been told about (D295).
8358
+ *
8359
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8360
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8361
+ * because refusing on an unanswerable read would hide exactly the case an
8362
+ * operator needs to act on.
8363
+ */
8364
+ var StorageMigrationResidueSchema = object({
8365
+ storageClass: StorageMigrationClassSchema,
8366
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8367
+ * move from wherever they are rather than from one named source. */
8368
+ fromLocationId: string(),
8369
+ /** Where a drain would move it — the class's CURRENT default. */
8370
+ toLocationId: string(),
8371
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8372
+ items: number().int().nonnegative().nullable(),
8373
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8374
+ bytes: number().int().nonnegative().nullable()
8375
+ });
8376
+ /**
8377
+ * Run the DRAIN half and nothing else.
8378
+ *
8379
+ * A migration that reached `done` has already repointed, so `start` correctly
8380
+ * refuses its destination ("already the default") — there is nothing left to
8381
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8382
+ * or finish against a work list that was a tenth of the archive (D295), and
8383
+ * before this there was no supported way to run only that half: the only way
8384
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8385
+ *
8386
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8387
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8388
+ * re-repoint a class that is already migrated.
8389
+ */
8390
+ var StorageMigrationDrainInputSchema = object({
8391
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8392
+ * a class whose source is already empty is refused rather than started. */
8393
+ classes: array(StorageMigrationClassSchema).min(1),
8394
+ throttleMbps: number().min(1).max(1e3).optional()
8395
+ });
8396
+ /** What a footage source still holds, asked of the durable hour ledger. */
8397
+ var RelocateResidueInputSchema = object({
8398
+ fromLocationId: string().min(1),
8399
+ /** Narrow to one logical class; omit for every profile on the location. */
8400
+ footageClass: RelocateFootageClassSchema.optional()
8401
+ });
8402
+ /** `null` = the archive could not answer (no ledger on this node, or the
8403
+ * aggregate failed). Never conflated with an empty source. */
8404
+ var RelocateResidueSchema = object({
8405
+ segments: number().int().nonnegative(),
8406
+ bytes: number().int().nonnegative()
8407
+ }).nullable();
8408
+ /** How many rows a media pass would still act on against a given target — the
8409
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8410
+ * never disagree. `null` = the count could not be taken. */
8411
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8412
+ var RelocatableMediaCountInputSchema = object({
8413
+ toLocationId: string().min(1),
8414
+ /** Omitted = `move`. */
8415
+ mode: MediaRelocateModeSchema.optional()
8416
+ });
8417
+ /**
8243
8418
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8244
8419
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8245
8420
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8343,6 +8518,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8343
8518
  * two addons declaring the same `id` must agree on `cardinality` (validated
8344
8519
  * at kernel aggregation time, not here).
8345
8520
  */
8521
+ /**
8522
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8523
+ * actually reaches the bytes. It is the constraint that decides which
8524
+ * `storage-provider`s may back a location of that kind.
8525
+ *
8526
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8527
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8528
+ * post-analysis media roots). Only a provider that serves a genuine local
8529
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8530
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8531
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8532
+ * against a same-named local directory that is something else entirely.
8533
+ *
8534
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8535
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8536
+ * service never sees a path, so any provider can back it. `backups` is the
8537
+ * one kind that qualifies today.
8538
+ *
8539
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8540
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8541
+ * refused the configuration; the first write simply went somewhere wrong, and
8542
+ * a recording write that goes wrong surfaces as a silent black window rather
8543
+ * than an error (the read path does not `stat`). This turns that accident into
8544
+ * a declared, enforced, testable refusal.
8545
+ */
8546
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8346
8547
  var StorageLocationDeclarationSchema = object({
8347
8548
  /**
8348
8549
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8362,6 +8563,19 @@ var StorageLocationDeclarationSchema = object({
8362
8563
  */
8363
8564
  cardinality: _enum(["single", "multi"]),
8364
8565
  /**
8566
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8567
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8568
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8569
+ *
8570
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8571
+ * can only over-restrict (refuse a remote provider for a kind that might
8572
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8573
+ * permissive direction and is therefore never inferred — a repo guard
8574
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8575
+ * reached by omission.
8576
+ */
8577
+ access: StorageAccessSchema.optional(),
8578
+ /**
8365
8579
  * When set, the default instance for this location inherits its resolved
8366
8580
  * root from the named location's default instance. Useful for derivative
8367
8581
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17955,8 +18169,10 @@ var TrackSchema = object({
17955
18169
  lastSeen: number(),
17956
18170
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17957
18171
  positions: array(TrackPositionSchema).readonly(),
17958
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17959
- * saveThumbnails policy). */
18172
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18173
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18174
+ * the retired `saveThumbnails` used to gate this and the rolling
18175
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17960
18176
  snapshots: array(TrackSnapshotSchema).readonly(),
17961
18177
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17962
18178
  zonesVisited: array(string()).readonly(),
@@ -18816,7 +19032,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18816
19032
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18817
19033
  kind: "mutation",
18818
19034
  auth: "admin"
18819
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19035
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19036
+ kind: "query",
19037
+ auth: "admin"
19038
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18820
19039
  kind: "query",
18821
19040
  auth: "admin"
18822
19041
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -20775,6 +20994,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20775
20994
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20776
20995
  kind: "mutation",
20777
20996
  auth: "admin"
20997
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
20998
+ kind: "mutation",
20999
+ auth: "admin"
20778
21000
  });
20779
21001
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20780
21002
  providerId: string().min(1),
@@ -21173,12 +21395,38 @@ response: record(string(), unknown()) }), object({
21173
21395
  *
21174
21396
  * ## Why this is a capability and not a helper
21175
21397
  *
21176
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21177
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21178
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21179
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21180
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21181
- * load 5,000 rows before ranking anything.
21398
+ * This capability was introduced with the claim that SIX stores in
21399
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21400
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21401
+ * claim was never true, and leaving it here made five stores look like pending
21402
+ * work when three of them have no vector at all. Counted column by column on
21403
+ * 2026-08-30, exactly THREE ever held one:
21404
+ *
21405
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21406
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21407
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21408
+ * face, migrated 2026-08-30 into its OWN index (see below).
21409
+ *
21410
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21411
+ * and `identities` store a name; the event store stores no derivative vector.
21412
+ * They are not migration candidates and never were.
21413
+ *
21414
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21415
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21416
+ * rows before ranking anything.
21417
+ *
21418
+ * ## One index per COMPARISON, never per encoder
21419
+ *
21420
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21421
+ * model, and they still get two indexes. An index is a set of things that are
21422
+ * ranked against each other and that live and die together, and these two are
21423
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21424
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21425
+ * forever and is the gallery every recognition ranks against. One index would
21426
+ * mean every gallery load and every reconcile carried a filter whose failure
21427
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21428
+ * person's only sample. The dimension they share is not a reason to share an
21429
+ * index; the question they answer is, and it differs.
21182
21430
  *
21183
21431
  * The fix is not a faster loop, it is a different backend — and the backend
21184
21432
  * should be replaceable without touching six callers. So: a singleton
@@ -21283,7 +21531,20 @@ var VectorQueryResultSchema = object({
21283
21531
  */
21284
21532
  scanned: number(),
21285
21533
  /** True when the backend could not consider every row that passed the filter. */
21286
- truncated: boolean()
21534
+ truncated: boolean(),
21535
+ /**
21536
+ * The `topK` the backend actually ran with.
21537
+ *
21538
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21539
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21540
+ * own log rather than in its answer. That is how an audit asking for 20,000
21541
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21542
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21543
+ * MUCH, in the return value, where the caller cannot fail to see it.
21544
+ *
21545
+ * Equals the requested `topK` whenever nothing was lowered.
21546
+ */
21547
+ effectiveTopK: number().int().positive()
21287
21548
  });
21288
21549
  var VectorDeleteInputSchema = object({
21289
21550
  index: string(),
@@ -21312,6 +21573,68 @@ var VectorGetResultSchema = object({ items: array(object({
21312
21573
  id: string(),
21313
21574
  metadata: VectorMetadataSchema
21314
21575
  })) });
21576
+ /**
21577
+ * Ids to read back WITH their vectors.
21578
+ *
21579
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21580
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21581
+ * caller depends on that promise. This one promises the opposite.
21582
+ *
21583
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21584
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21585
+ * a per-face cross-process KNN would be a network round trip inside the
21586
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21587
+ * it requires the index to hand the floats back. Without this method the only
21588
+ * way to keep a readable vector is a JSON column, which is the thing this
21589
+ * capability exists to delete.
21590
+ *
21591
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21592
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21593
+ */
21594
+ var VectorFetchInputSchema = object({
21595
+ index: string(),
21596
+ ids: array(string())
21597
+ });
21598
+ var VectorFetchResultSchema = object({ items: array(object({
21599
+ id: string(),
21600
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21601
+ vector: string(),
21602
+ metadata: VectorMetadataSchema
21603
+ })) });
21604
+ /**
21605
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21606
+ *
21607
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21608
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21609
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21610
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21611
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21612
+ * looked" for as long as anyone cared to read it.
21613
+ *
21614
+ * This is the primitive that question actually needs: a bounded page, ordered
21615
+ * by the backend's own row order, costing no distance computation at all.
21616
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21617
+ * the full-table read this capability was built to stop.
21618
+ */
21619
+ var VectorScanInputSchema = object({
21620
+ index: string(),
21621
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21622
+ cursor: number().int().nonnegative().default(0),
21623
+ limit: number().int().positive()
21624
+ });
21625
+ var VectorScanResultSchema = object({
21626
+ items: array(object({
21627
+ id: string(),
21628
+ metadata: VectorMetadataSchema
21629
+ })),
21630
+ /**
21631
+ * Where the next page starts, or `null` when the walk reached the end.
21632
+ *
21633
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21634
+ * from a short page: a backend is free to return fewer rows than asked.
21635
+ */
21636
+ nextCursor: number().int().nonnegative().nullable()
21637
+ });
21315
21638
  var VectorStatsInputSchema = object({ index: string() });
21316
21639
  var VectorStatsResultSchema = object({
21317
21640
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21330,7 +21653,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21330
21653
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21331
21654
  kind: "mutation",
21332
21655
  auth: "admin"
21333
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21656
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21334
21657
  kind: "mutation",
21335
21658
  auth: "admin"
21336
21659
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26234,6 +26557,9 @@ method(object({
26234
26557
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26235
26558
  kind: "query",
26236
26559
  auth: "admin"
26560
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26561
+ kind: "query",
26562
+ auth: "admin"
26237
26563
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26238
26564
  kind: "mutation",
26239
26565
  auth: "admin"
@@ -31199,6 +31525,12 @@ Object.freeze({
31199
31525
  addonId: null,
31200
31526
  access: "create"
31201
31527
  },
31528
+ "pipelineAnalytics.countRelocatableMedia": {
31529
+ capName: "pipeline-analytics",
31530
+ capScope: "device",
31531
+ addonId: null,
31532
+ access: "view"
31533
+ },
31202
31534
  "pipelineAnalytics.countUnstampedEventMedia": {
31203
31535
  capName: "pipeline-analytics",
31204
31536
  capScope: "device",
@@ -32363,6 +32695,12 @@ Object.freeze({
32363
32695
  addonId: null,
32364
32696
  access: "view"
32365
32697
  },
32698
+ "recording.getRelocateResidue": {
32699
+ capName: "recording",
32700
+ capScope: "system",
32701
+ addonId: null,
32702
+ access: "view"
32703
+ },
32366
32704
  "recording.getStorageMigrationMoveStatus": {
32367
32705
  capName: "recording",
32368
32706
  capScope: "system",
@@ -32909,12 +33247,30 @@ Object.freeze({
32909
33247
  addonId: null,
32910
33248
  access: "create"
32911
33249
  },
33250
+ "storageMigration.drain": {
33251
+ capName: "storage-migration",
33252
+ capScope: "system",
33253
+ addonId: null,
33254
+ access: "create"
33255
+ },
33256
+ "storageMigration.movers": {
33257
+ capName: "storage-migration",
33258
+ capScope: "system",
33259
+ addonId: null,
33260
+ access: "view"
33261
+ },
32912
33262
  "storageMigration.plan": {
32913
33263
  capName: "storage-migration",
32914
33264
  capScope: "system",
32915
33265
  addonId: null,
32916
33266
  access: "view"
32917
33267
  },
33268
+ "storageMigration.residue": {
33269
+ capName: "storage-migration",
33270
+ capScope: "system",
33271
+ addonId: null,
33272
+ access: "view"
33273
+ },
32918
33274
  "storageMigration.start": {
32919
33275
  capName: "storage-migration",
32920
33276
  capScope: "system",
@@ -33749,6 +34105,12 @@ Object.freeze({
33749
34105
  addonId: null,
33750
34106
  access: "delete"
33751
34107
  },
34108
+ "vectorStore.fetchByIds": {
34109
+ capName: "vector-store",
34110
+ capScope: "system",
34111
+ addonId: null,
34112
+ access: "view"
34113
+ },
33752
34114
  "vectorStore.getByIds": {
33753
34115
  capName: "vector-store",
33754
34116
  capScope: "system",
@@ -33761,6 +34123,12 @@ Object.freeze({
33761
34123
  addonId: null,
33762
34124
  access: "view"
33763
34125
  },
34126
+ "vectorStore.scan": {
34127
+ capName: "vector-store",
34128
+ capScope: "system",
34129
+ addonId: null,
34130
+ access: "view"
34131
+ },
33764
34132
  "vectorStore.stats": {
33765
34133
  capName: "vector-store",
33766
34134
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-mqtt-broker",
3
- "version": "1.2.43",
3
+ "version": "1.2.46",
4
4
  "description": "MQTT broker registry addon for CamStack — manages external broker entries + an optional embedded aedes broker. Consumers spin up their own `mqtt.js` clients via the `mqtt-broker` cap.",
5
5
  "keywords": [
6
6
  "camstack",