@camstack/addon-matter-broker 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
@@ -8017,6 +8017,21 @@ var RelocateJobSchema = object({
8017
8017
  bytesMoved: number().int(),
8018
8018
  /** Total files discovered up front; null while (or when) unknown. */
8019
8019
  filesTotal: number().int().nullable(),
8020
+ /**
8021
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8022
+ * made that nobody asked for, so it is reported where the operator reads the
8023
+ * job rather than only in a log line.
8024
+ *
8025
+ * A footage segment records its byte count in its own NAME, and the durable
8026
+ * hour row derives its aggregates from those names. A file that does not
8027
+ * match its name therefore makes the ledger's sums — and with them quota and
8028
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8029
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8030
+ *
8031
+ * Absent on lanes where the question has no meaning: a media blob's size is
8032
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8033
+ */
8034
+ rowsReconciled: number().int().nonnegative().optional(),
8020
8035
  startedAt: number(),
8021
8036
  finishedAt: number().nullable(),
8022
8037
  error: string$2().nullable()
@@ -8085,14 +8100,42 @@ var RelocateMediaInputSchema = object({
8085
8100
  /** Omitted = `move`, the pre-existing behaviour. */
8086
8101
  mode: MediaRelocateModeSchema.optional()
8087
8102
  });
8088
- /** How many rows still carry NO `locationId` — the population a repoint would
8089
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8090
- * value that permits a non-blocking `eventMedia` cutover. */
8091
- var UnstampedEventMediaCountSchema = object({
8092
- media: number().int().nonnegative(),
8093
- retrainFrames: number().int().nonnegative(),
8094
- total: number().int().nonnegative()
8103
+ /**
8104
+ * The unstamped population of ONE collection — split, because the gate and the
8105
+ * operator ask two different questions and only one of them has to be cheap.
8106
+ *
8107
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8108
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8109
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8110
+ * that matters — after a seal, when the population is empty.
8111
+ *
8112
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8113
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8114
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8115
+ * and useful answer: "there are some, and this read could not say how many"
8116
+ * still refuses the cutover, which is the whole job.
8117
+ */
8118
+ var UnstampedRowsSchema = object({
8119
+ present: boolean(),
8120
+ rows: number().int().nonnegative().nullable()
8095
8121
  });
8122
+ /**
8123
+ * How many rows still carry NO `locationId` — the population a repoint would
8124
+ * silently re-aim at a disk that does not hold their bytes.
8125
+ *
8126
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8127
+ * over. The gate opens on a measured absence and on nothing else; an unread
8128
+ * collection and an empty one are different facts, and this repo has already
8129
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8130
+ */
8131
+ var UnstampedEventMediaCountSchema = object({
8132
+ media: UnstampedRowsSchema,
8133
+ retrainFrames: UnstampedRowsSchema,
8134
+ /** True when EITHER collection holds one. The refusal reads this. */
8135
+ anyPresent: boolean(),
8136
+ /** Sum across both, or `null` when either lane could not be counted. */
8137
+ total: number().int().nonnegative().nullable()
8138
+ }).nullable();
8096
8139
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string$2().min(1) });
8097
8140
  /** The independently selectable logical storage classes — every class
8098
8141
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8178,13 +8221,53 @@ var StorageMigrationParticipantSchema = _enum([
8178
8221
  "recorder",
8179
8222
  "analytics"
8180
8223
  ]);
8224
+ /**
8225
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8226
+ *
8227
+ * The long half of a non-blocking migration is `draining`, and it is measured
8228
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8229
+ * existed the only place those numbers appeared was a Loki line, so an operator
8230
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8231
+ * afternoon.
8232
+ *
8233
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8234
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8235
+ * mover — which is the exact failure this is meant to end. The coordinator's
8236
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8237
+ * read `state`; folding the counters costs no extra read and makes the durable
8238
+ * record say afterwards how far a move actually got.
8239
+ *
8240
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8241
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8242
+ * cannot say M, and a 0 there would render as "100 % done".
8243
+ */
8244
+ var StorageMigrationMoveProgressSchema = object({
8245
+ filesMoved: number().int().nonnegative(),
8246
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8247
+ filesTotal: number().int().nonnegative().nullable(),
8248
+ bytesMoved: number().int().nonnegative(),
8249
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8250
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8251
+ * rows would be the same failure as one that silently skipped them. */
8252
+ rowsReconciled: number().int().nonnegative().optional(),
8253
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8254
+ * crash gets a new mover, and a rate computed from the migration's start
8255
+ * would silently average in the time nothing was running. */
8256
+ startedAt: number(),
8257
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8258
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8259
+ * subtract its own. */
8260
+ observedAt: number()
8261
+ });
8181
8262
  var StorageMigrationMoveSchema = object({
8182
8263
  storageClass: StorageMigrationClassSchema,
8183
8264
  fromLocationId: string$2(),
8184
8265
  toLocationId: string$2(),
8185
8266
  moverJobId: string$2().nullable(),
8186
8267
  state: RelocateJobStateSchema.nullable(),
8187
- error: string$2().nullable()
8268
+ error: string$2().nullable(),
8269
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8270
+ progress: StorageMigrationMoveProgressSchema.nullable()
8188
8271
  });
8189
8272
  var StorageMigrationJobSchema = object({
8190
8273
  jobId: string$2(),
@@ -8230,6 +8313,98 @@ var StorageMigrationPlanSchema = object({
8230
8313
  findings: array(StorageMigrationFindingSchema)
8231
8314
  });
8232
8315
  /**
8316
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8317
+ *
8318
+ * The coordinator's job record is the state of record for a migration, and its
8319
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8320
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8321
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8322
+ * way because no supported UI path existed. A mover armed like that has no job
8323
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8324
+ *
8325
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8326
+ * orchestrated it.
8327
+ */
8328
+ var StorageMigrationMoverSchema = object({
8329
+ lane: _enum(["footage", "media"]),
8330
+ job: RelocateJobSchema,
8331
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8332
+ * directly against the owning addon. */
8333
+ migrationJobId: string$2().nullable(),
8334
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8335
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8336
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8337
+ * rate made of two different clocks. */
8338
+ observedAt: number()
8339
+ });
8340
+ /**
8341
+ * What a SOURCE still holds for one storage class — the number that makes a
8342
+ * "drain remaining" action honest rather than hopeful.
8343
+ *
8344
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8345
+ * engine's own selection count for media), never from the resident index: a
8346
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8347
+ * never been told about (D295).
8348
+ *
8349
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8350
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8351
+ * because refusing on an unanswerable read would hide exactly the case an
8352
+ * operator needs to act on.
8353
+ */
8354
+ var StorageMigrationResidueSchema = object({
8355
+ storageClass: StorageMigrationClassSchema,
8356
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8357
+ * move from wherever they are rather than from one named source. */
8358
+ fromLocationId: string$2(),
8359
+ /** Where a drain would move it — the class's CURRENT default. */
8360
+ toLocationId: string$2(),
8361
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8362
+ items: number().int().nonnegative().nullable(),
8363
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8364
+ bytes: number().int().nonnegative().nullable()
8365
+ });
8366
+ /**
8367
+ * Run the DRAIN half and nothing else.
8368
+ *
8369
+ * A migration that reached `done` has already repointed, so `start` correctly
8370
+ * refuses its destination ("already the default") — there is nothing left to
8371
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8372
+ * or finish against a work list that was a tenth of the archive (D295), and
8373
+ * before this there was no supported way to run only that half: the only way
8374
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8375
+ *
8376
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8377
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8378
+ * re-repoint a class that is already migrated.
8379
+ */
8380
+ var StorageMigrationDrainInputSchema = object({
8381
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8382
+ * a class whose source is already empty is refused rather than started. */
8383
+ classes: array(StorageMigrationClassSchema).min(1),
8384
+ throttleMbps: number().min(1).max(1e3).optional()
8385
+ });
8386
+ /** What a footage source still holds, asked of the durable hour ledger. */
8387
+ var RelocateResidueInputSchema = object({
8388
+ fromLocationId: string$2().min(1),
8389
+ /** Narrow to one logical class; omit for every profile on the location. */
8390
+ footageClass: RelocateFootageClassSchema.optional()
8391
+ });
8392
+ /** `null` = the archive could not answer (no ledger on this node, or the
8393
+ * aggregate failed). Never conflated with an empty source. */
8394
+ var RelocateResidueSchema = object({
8395
+ segments: number().int().nonnegative(),
8396
+ bytes: number().int().nonnegative()
8397
+ }).nullable();
8398
+ /** How many rows a media pass would still act on against a given target — the
8399
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8400
+ * never disagree. `null` = the count could not be taken. */
8401
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8402
+ var RelocatableMediaCountInputSchema = object({
8403
+ toLocationId: string$2().min(1),
8404
+ /** Omitted = `move`. */
8405
+ mode: MediaRelocateModeSchema.optional()
8406
+ });
8407
+ /**
8233
8408
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8234
8409
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8235
8410
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8333,6 +8508,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string$2().rege
8333
8508
  * two addons declaring the same `id` must agree on `cardinality` (validated
8334
8509
  * at kernel aggregation time, not here).
8335
8510
  */
8511
+ /**
8512
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8513
+ * actually reaches the bytes. It is the constraint that decides which
8514
+ * `storage-provider`s may back a location of that kind.
8515
+ *
8516
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8517
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8518
+ * post-analysis media roots). Only a provider that serves a genuine local
8519
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8520
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8521
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8522
+ * against a same-named local directory that is something else entirely.
8523
+ *
8524
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8525
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8526
+ * service never sees a path, so any provider can back it. `backups` is the
8527
+ * one kind that qualifies today.
8528
+ *
8529
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8530
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8531
+ * refused the configuration; the first write simply went somewhere wrong, and
8532
+ * a recording write that goes wrong surfaces as a silent black window rather
8533
+ * than an error (the read path does not `stat`). This turns that accident into
8534
+ * a declared, enforced, testable refusal.
8535
+ */
8536
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8336
8537
  var StorageLocationDeclarationSchema = object({
8337
8538
  /**
8338
8539
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8352,6 +8553,19 @@ var StorageLocationDeclarationSchema = object({
8352
8553
  */
8353
8554
  cardinality: _enum(["single", "multi"]),
8354
8555
  /**
8556
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8557
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8558
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8559
+ *
8560
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8561
+ * can only over-restrict (refuse a remote provider for a kind that might
8562
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8563
+ * permissive direction and is therefore never inferred — a repo guard
8564
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8565
+ * reached by omission.
8566
+ */
8567
+ access: StorageAccessSchema.optional(),
8568
+ /**
8355
8569
  * When set, the default instance for this location inherits its resolved
8356
8570
  * root from the named location's default instance. Useful for derivative
8357
8571
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18285,8 +18499,10 @@ var TrackSchema = object({
18285
18499
  lastSeen: number(),
18286
18500
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18287
18501
  positions: array(TrackPositionSchema).readonly(),
18288
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18289
- * saveThumbnails policy). */
18502
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18503
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18504
+ * the retired `saveThumbnails` used to gate this and the rolling
18505
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18290
18506
  snapshots: array(TrackSnapshotSchema).readonly(),
18291
18507
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18292
18508
  zonesVisited: array(string$2()).readonly(),
@@ -19146,7 +19362,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19146
19362
  }), method(RelocateMediaInputSchema, object({ jobId: string$2() }), {
19147
19363
  kind: "mutation",
19148
19364
  auth: "admin"
19149
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19365
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19366
+ kind: "query",
19367
+ auth: "admin"
19368
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19150
19369
  kind: "query",
19151
19370
  auth: "admin"
19152
19371
  }), method(object({ jobId: string$2() }), object({ cancelled: boolean() }), {
@@ -21105,6 +21324,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21105
21324
  }), method(object({ jobId: string$2().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string$2() }), object({ cancelled: boolean() }), {
21106
21325
  kind: "mutation",
21107
21326
  auth: "admin"
21327
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string$2() }), {
21328
+ kind: "mutation",
21329
+ auth: "admin"
21108
21330
  });
21109
21331
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21110
21332
  providerId: string$2().min(1),
@@ -21503,12 +21725,38 @@ response: record(string$2(), unknown()) }), object({
21503
21725
  *
21504
21726
  * ## Why this is a capability and not a helper
21505
21727
  *
21506
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21507
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21508
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21509
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21510
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21511
- * load 5,000 rows before ranking anything.
21728
+ * This capability was introduced with the claim that SIX stores in
21729
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21730
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21731
+ * claim was never true, and leaving it here made five stores look like pending
21732
+ * work when three of them have no vector at all. Counted column by column on
21733
+ * 2026-08-30, exactly THREE ever held one:
21734
+ *
21735
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21736
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21737
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21738
+ * face, migrated 2026-08-30 into its OWN index (see below).
21739
+ *
21740
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21741
+ * and `identities` store a name; the event store stores no derivative vector.
21742
+ * They are not migration candidates and never were.
21743
+ *
21744
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21745
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21746
+ * rows before ranking anything.
21747
+ *
21748
+ * ## One index per COMPARISON, never per encoder
21749
+ *
21750
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21751
+ * model, and they still get two indexes. An index is a set of things that are
21752
+ * ranked against each other and that live and die together, and these two are
21753
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21754
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21755
+ * forever and is the gallery every recognition ranks against. One index would
21756
+ * mean every gallery load and every reconcile carried a filter whose failure
21757
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21758
+ * person's only sample. The dimension they share is not a reason to share an
21759
+ * index; the question they answer is, and it differs.
21512
21760
  *
21513
21761
  * The fix is not a faster loop, it is a different backend — and the backend
21514
21762
  * should be replaceable without touching six callers. So: a singleton
@@ -21613,7 +21861,20 @@ var VectorQueryResultSchema = object({
21613
21861
  */
21614
21862
  scanned: number(),
21615
21863
  /** True when the backend could not consider every row that passed the filter. */
21616
- truncated: boolean()
21864
+ truncated: boolean(),
21865
+ /**
21866
+ * The `topK` the backend actually ran with.
21867
+ *
21868
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21869
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21870
+ * own log rather than in its answer. That is how an audit asking for 20,000
21871
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21872
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21873
+ * MUCH, in the return value, where the caller cannot fail to see it.
21874
+ *
21875
+ * Equals the requested `topK` whenever nothing was lowered.
21876
+ */
21877
+ effectiveTopK: number().int().positive()
21617
21878
  });
21618
21879
  var VectorDeleteInputSchema = object({
21619
21880
  index: string$2(),
@@ -21642,6 +21903,68 @@ var VectorGetResultSchema = object({ items: array(object({
21642
21903
  id: string$2(),
21643
21904
  metadata: VectorMetadataSchema
21644
21905
  })) });
21906
+ /**
21907
+ * Ids to read back WITH their vectors.
21908
+ *
21909
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21910
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21911
+ * caller depends on that promise. This one promises the opposite.
21912
+ *
21913
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21914
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21915
+ * a per-face cross-process KNN would be a network round trip inside the
21916
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21917
+ * it requires the index to hand the floats back. Without this method the only
21918
+ * way to keep a readable vector is a JSON column, which is the thing this
21919
+ * capability exists to delete.
21920
+ *
21921
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21922
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21923
+ */
21924
+ var VectorFetchInputSchema = object({
21925
+ index: string$2(),
21926
+ ids: array(string$2())
21927
+ });
21928
+ var VectorFetchResultSchema = object({ items: array(object({
21929
+ id: string$2(),
21930
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21931
+ vector: string$2(),
21932
+ metadata: VectorMetadataSchema
21933
+ })) });
21934
+ /**
21935
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21936
+ *
21937
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21938
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21939
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21940
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21941
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21942
+ * looked" for as long as anyone cared to read it.
21943
+ *
21944
+ * This is the primitive that question actually needs: a bounded page, ordered
21945
+ * by the backend's own row order, costing no distance computation at all.
21946
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21947
+ * the full-table read this capability was built to stop.
21948
+ */
21949
+ var VectorScanInputSchema = object({
21950
+ index: string$2(),
21951
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21952
+ cursor: number().int().nonnegative().default(0),
21953
+ limit: number().int().positive()
21954
+ });
21955
+ var VectorScanResultSchema = object({
21956
+ items: array(object({
21957
+ id: string$2(),
21958
+ metadata: VectorMetadataSchema
21959
+ })),
21960
+ /**
21961
+ * Where the next page starts, or `null` when the walk reached the end.
21962
+ *
21963
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21964
+ * from a short page: a backend is free to return fewer rows than asked.
21965
+ */
21966
+ nextCursor: number().int().nonnegative().nullable()
21967
+ });
21645
21968
  var VectorStatsInputSchema = object({ index: string$2() });
21646
21969
  var VectorStatsResultSchema = object({
21647
21970
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21660,7 +21983,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21660
21983
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21661
21984
  kind: "mutation",
21662
21985
  auth: "admin"
21663
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21986
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21664
21987
  kind: "mutation",
21665
21988
  auth: "admin"
21666
21989
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28296,6 +28619,9 @@ method(object({
28296
28619
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28297
28620
  kind: "query",
28298
28621
  auth: "admin"
28622
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28623
+ kind: "query",
28624
+ auth: "admin"
28299
28625
  }), method(object({ jobId: string$2() }), object({ cancelled: boolean() }), {
28300
28626
  kind: "mutation",
28301
28627
  auth: "admin"
@@ -34930,6 +35256,12 @@ Object.freeze({
34930
35256
  addonId: null,
34931
35257
  access: "create"
34932
35258
  },
35259
+ "pipelineAnalytics.countRelocatableMedia": {
35260
+ capName: "pipeline-analytics",
35261
+ capScope: "device",
35262
+ addonId: null,
35263
+ access: "view"
35264
+ },
34933
35265
  "pipelineAnalytics.countUnstampedEventMedia": {
34934
35266
  capName: "pipeline-analytics",
34935
35267
  capScope: "device",
@@ -36094,6 +36426,12 @@ Object.freeze({
36094
36426
  addonId: null,
36095
36427
  access: "view"
36096
36428
  },
36429
+ "recording.getRelocateResidue": {
36430
+ capName: "recording",
36431
+ capScope: "system",
36432
+ addonId: null,
36433
+ access: "view"
36434
+ },
36097
36435
  "recording.getStorageMigrationMoveStatus": {
36098
36436
  capName: "recording",
36099
36437
  capScope: "system",
@@ -36640,12 +36978,30 @@ Object.freeze({
36640
36978
  addonId: null,
36641
36979
  access: "create"
36642
36980
  },
36981
+ "storageMigration.drain": {
36982
+ capName: "storage-migration",
36983
+ capScope: "system",
36984
+ addonId: null,
36985
+ access: "create"
36986
+ },
36987
+ "storageMigration.movers": {
36988
+ capName: "storage-migration",
36989
+ capScope: "system",
36990
+ addonId: null,
36991
+ access: "view"
36992
+ },
36643
36993
  "storageMigration.plan": {
36644
36994
  capName: "storage-migration",
36645
36995
  capScope: "system",
36646
36996
  addonId: null,
36647
36997
  access: "view"
36648
36998
  },
36999
+ "storageMigration.residue": {
37000
+ capName: "storage-migration",
37001
+ capScope: "system",
37002
+ addonId: null,
37003
+ access: "view"
37004
+ },
36649
37005
  "storageMigration.start": {
36650
37006
  capName: "storage-migration",
36651
37007
  capScope: "system",
@@ -37480,6 +37836,12 @@ Object.freeze({
37480
37836
  addonId: null,
37481
37837
  access: "delete"
37482
37838
  },
37839
+ "vectorStore.fetchByIds": {
37840
+ capName: "vector-store",
37841
+ capScope: "system",
37842
+ addonId: null,
37843
+ access: "view"
37844
+ },
37483
37845
  "vectorStore.getByIds": {
37484
37846
  capName: "vector-store",
37485
37847
  capScope: "system",
@@ -37492,6 +37854,12 @@ Object.freeze({
37492
37854
  addonId: null,
37493
37855
  access: "view"
37494
37856
  },
37857
+ "vectorStore.scan": {
37858
+ capName: "vector-store",
37859
+ capScope: "system",
37860
+ addonId: null,
37861
+ access: "view"
37862
+ },
37495
37863
  "vectorStore.stats": {
37496
37864
  capName: "vector-store",
37497
37865
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8015,6 +8015,21 @@ var RelocateJobSchema = object({
8015
8015
  bytesMoved: number().int(),
8016
8016
  /** Total files discovered up front; null while (or when) unknown. */
8017
8017
  filesTotal: number().int().nullable(),
8018
+ /**
8019
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8020
+ * made that nobody asked for, so it is reported where the operator reads the
8021
+ * job rather than only in a log line.
8022
+ *
8023
+ * A footage segment records its byte count in its own NAME, and the durable
8024
+ * hour row derives its aggregates from those names. A file that does not
8025
+ * match its name therefore makes the ledger's sums — and with them quota and
8026
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8027
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8028
+ *
8029
+ * Absent on lanes where the question has no meaning: a media blob's size is
8030
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8031
+ */
8032
+ rowsReconciled: number().int().nonnegative().optional(),
8018
8033
  startedAt: number(),
8019
8034
  finishedAt: number().nullable(),
8020
8035
  error: string$2().nullable()
@@ -8083,14 +8098,42 @@ var RelocateMediaInputSchema = object({
8083
8098
  /** Omitted = `move`, the pre-existing behaviour. */
8084
8099
  mode: MediaRelocateModeSchema.optional()
8085
8100
  });
8086
- /** How many rows still carry NO `locationId` — the population a repoint would
8087
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8088
- * value that permits a non-blocking `eventMedia` cutover. */
8089
- var UnstampedEventMediaCountSchema = object({
8090
- media: number().int().nonnegative(),
8091
- retrainFrames: number().int().nonnegative(),
8092
- total: number().int().nonnegative()
8101
+ /**
8102
+ * The unstamped population of ONE collection — split, because the gate and the
8103
+ * operator ask two different questions and only one of them has to be cheap.
8104
+ *
8105
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8106
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8107
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8108
+ * that matters — after a seal, when the population is empty.
8109
+ *
8110
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8111
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8112
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8113
+ * and useful answer: "there are some, and this read could not say how many"
8114
+ * still refuses the cutover, which is the whole job.
8115
+ */
8116
+ var UnstampedRowsSchema = object({
8117
+ present: boolean(),
8118
+ rows: number().int().nonnegative().nullable()
8093
8119
  });
8120
+ /**
8121
+ * How many rows still carry NO `locationId` — the population a repoint would
8122
+ * silently re-aim at a disk that does not hold their bytes.
8123
+ *
8124
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8125
+ * over. The gate opens on a measured absence and on nothing else; an unread
8126
+ * collection and an empty one are different facts, and this repo has already
8127
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8128
+ */
8129
+ var UnstampedEventMediaCountSchema = object({
8130
+ media: UnstampedRowsSchema,
8131
+ retrainFrames: UnstampedRowsSchema,
8132
+ /** True when EITHER collection holds one. The refusal reads this. */
8133
+ anyPresent: boolean(),
8134
+ /** Sum across both, or `null` when either lane could not be counted. */
8135
+ total: number().int().nonnegative().nullable()
8136
+ }).nullable();
8094
8137
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string$2().min(1) });
8095
8138
  /** The independently selectable logical storage classes — every class
8096
8139
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8176,13 +8219,53 @@ var StorageMigrationParticipantSchema = _enum([
8176
8219
  "recorder",
8177
8220
  "analytics"
8178
8221
  ]);
8222
+ /**
8223
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8224
+ *
8225
+ * The long half of a non-blocking migration is `draining`, and it is measured
8226
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8227
+ * existed the only place those numbers appeared was a Loki line, so an operator
8228
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8229
+ * afternoon.
8230
+ *
8231
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8232
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8233
+ * mover — which is the exact failure this is meant to end. The coordinator's
8234
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8235
+ * read `state`; folding the counters costs no extra read and makes the durable
8236
+ * record say afterwards how far a move actually got.
8237
+ *
8238
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8239
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8240
+ * cannot say M, and a 0 there would render as "100 % done".
8241
+ */
8242
+ var StorageMigrationMoveProgressSchema = object({
8243
+ filesMoved: number().int().nonnegative(),
8244
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8245
+ filesTotal: number().int().nonnegative().nullable(),
8246
+ bytesMoved: number().int().nonnegative(),
8247
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8248
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8249
+ * rows would be the same failure as one that silently skipped them. */
8250
+ rowsReconciled: number().int().nonnegative().optional(),
8251
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8252
+ * crash gets a new mover, and a rate computed from the migration's start
8253
+ * would silently average in the time nothing was running. */
8254
+ startedAt: number(),
8255
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8256
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8257
+ * subtract its own. */
8258
+ observedAt: number()
8259
+ });
8179
8260
  var StorageMigrationMoveSchema = object({
8180
8261
  storageClass: StorageMigrationClassSchema,
8181
8262
  fromLocationId: string$2(),
8182
8263
  toLocationId: string$2(),
8183
8264
  moverJobId: string$2().nullable(),
8184
8265
  state: RelocateJobStateSchema.nullable(),
8185
- error: string$2().nullable()
8266
+ error: string$2().nullable(),
8267
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8268
+ progress: StorageMigrationMoveProgressSchema.nullable()
8186
8269
  });
8187
8270
  var StorageMigrationJobSchema = object({
8188
8271
  jobId: string$2(),
@@ -8228,6 +8311,98 @@ var StorageMigrationPlanSchema = object({
8228
8311
  findings: array(StorageMigrationFindingSchema)
8229
8312
  });
8230
8313
  /**
8314
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8315
+ *
8316
+ * The coordinator's job record is the state of record for a migration, and its
8317
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8318
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8319
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8320
+ * way because no supported UI path existed. A mover armed like that has no job
8321
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8322
+ *
8323
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8324
+ * orchestrated it.
8325
+ */
8326
+ var StorageMigrationMoverSchema = object({
8327
+ lane: _enum(["footage", "media"]),
8328
+ job: RelocateJobSchema,
8329
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8330
+ * directly against the owning addon. */
8331
+ migrationJobId: string$2().nullable(),
8332
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8333
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8334
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8335
+ * rate made of two different clocks. */
8336
+ observedAt: number()
8337
+ });
8338
+ /**
8339
+ * What a SOURCE still holds for one storage class — the number that makes a
8340
+ * "drain remaining" action honest rather than hopeful.
8341
+ *
8342
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8343
+ * engine's own selection count for media), never from the resident index: a
8344
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8345
+ * never been told about (D295).
8346
+ *
8347
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8348
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8349
+ * because refusing on an unanswerable read would hide exactly the case an
8350
+ * operator needs to act on.
8351
+ */
8352
+ var StorageMigrationResidueSchema = object({
8353
+ storageClass: StorageMigrationClassSchema,
8354
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8355
+ * move from wherever they are rather than from one named source. */
8356
+ fromLocationId: string$2(),
8357
+ /** Where a drain would move it — the class's CURRENT default. */
8358
+ toLocationId: string$2(),
8359
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8360
+ items: number().int().nonnegative().nullable(),
8361
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8362
+ bytes: number().int().nonnegative().nullable()
8363
+ });
8364
+ /**
8365
+ * Run the DRAIN half and nothing else.
8366
+ *
8367
+ * A migration that reached `done` has already repointed, so `start` correctly
8368
+ * refuses its destination ("already the default") — there is nothing left to
8369
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8370
+ * or finish against a work list that was a tenth of the archive (D295), and
8371
+ * before this there was no supported way to run only that half: the only way
8372
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8373
+ *
8374
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8375
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8376
+ * re-repoint a class that is already migrated.
8377
+ */
8378
+ var StorageMigrationDrainInputSchema = object({
8379
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8380
+ * a class whose source is already empty is refused rather than started. */
8381
+ classes: array(StorageMigrationClassSchema).min(1),
8382
+ throttleMbps: number().min(1).max(1e3).optional()
8383
+ });
8384
+ /** What a footage source still holds, asked of the durable hour ledger. */
8385
+ var RelocateResidueInputSchema = object({
8386
+ fromLocationId: string$2().min(1),
8387
+ /** Narrow to one logical class; omit for every profile on the location. */
8388
+ footageClass: RelocateFootageClassSchema.optional()
8389
+ });
8390
+ /** `null` = the archive could not answer (no ledger on this node, or the
8391
+ * aggregate failed). Never conflated with an empty source. */
8392
+ var RelocateResidueSchema = object({
8393
+ segments: number().int().nonnegative(),
8394
+ bytes: number().int().nonnegative()
8395
+ }).nullable();
8396
+ /** How many rows a media pass would still act on against a given target — the
8397
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8398
+ * never disagree. `null` = the count could not be taken. */
8399
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8400
+ var RelocatableMediaCountInputSchema = object({
8401
+ toLocationId: string$2().min(1),
8402
+ /** Omitted = `move`. */
8403
+ mode: MediaRelocateModeSchema.optional()
8404
+ });
8405
+ /**
8231
8406
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8232
8407
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8233
8408
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8331,6 +8506,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string$2().rege
8331
8506
  * two addons declaring the same `id` must agree on `cardinality` (validated
8332
8507
  * at kernel aggregation time, not here).
8333
8508
  */
8509
+ /**
8510
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8511
+ * actually reaches the bytes. It is the constraint that decides which
8512
+ * `storage-provider`s may back a location of that kind.
8513
+ *
8514
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8515
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8516
+ * post-analysis media roots). Only a provider that serves a genuine local
8517
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8518
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8519
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8520
+ * against a same-named local directory that is something else entirely.
8521
+ *
8522
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8523
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8524
+ * service never sees a path, so any provider can back it. `backups` is the
8525
+ * one kind that qualifies today.
8526
+ *
8527
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8528
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8529
+ * refused the configuration; the first write simply went somewhere wrong, and
8530
+ * a recording write that goes wrong surfaces as a silent black window rather
8531
+ * than an error (the read path does not `stat`). This turns that accident into
8532
+ * a declared, enforced, testable refusal.
8533
+ */
8534
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8334
8535
  var StorageLocationDeclarationSchema = object({
8335
8536
  /**
8336
8537
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8350,6 +8551,19 @@ var StorageLocationDeclarationSchema = object({
8350
8551
  */
8351
8552
  cardinality: _enum(["single", "multi"]),
8352
8553
  /**
8554
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8555
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8556
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8557
+ *
8558
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8559
+ * can only over-restrict (refuse a remote provider for a kind that might
8560
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8561
+ * permissive direction and is therefore never inferred — a repo guard
8562
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8563
+ * reached by omission.
8564
+ */
8565
+ access: StorageAccessSchema.optional(),
8566
+ /**
8353
8567
  * When set, the default instance for this location inherits its resolved
8354
8568
  * root from the named location's default instance. Useful for derivative
8355
8569
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18283,8 +18497,10 @@ var TrackSchema = object({
18283
18497
  lastSeen: number(),
18284
18498
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18285
18499
  positions: array(TrackPositionSchema).readonly(),
18286
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18287
- * saveThumbnails policy). */
18500
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18501
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18502
+ * the retired `saveThumbnails` used to gate this and the rolling
18503
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18288
18504
  snapshots: array(TrackSnapshotSchema).readonly(),
18289
18505
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18290
18506
  zonesVisited: array(string$2()).readonly(),
@@ -19144,7 +19360,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19144
19360
  }), method(RelocateMediaInputSchema, object({ jobId: string$2() }), {
19145
19361
  kind: "mutation",
19146
19362
  auth: "admin"
19147
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19363
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19364
+ kind: "query",
19365
+ auth: "admin"
19366
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19148
19367
  kind: "query",
19149
19368
  auth: "admin"
19150
19369
  }), method(object({ jobId: string$2() }), object({ cancelled: boolean() }), {
@@ -21103,6 +21322,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21103
21322
  }), method(object({ jobId: string$2().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string$2() }), object({ cancelled: boolean() }), {
21104
21323
  kind: "mutation",
21105
21324
  auth: "admin"
21325
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string$2() }), {
21326
+ kind: "mutation",
21327
+ auth: "admin"
21106
21328
  });
21107
21329
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21108
21330
  providerId: string$2().min(1),
@@ -21501,12 +21723,38 @@ response: record(string$2(), unknown()) }), object({
21501
21723
  *
21502
21724
  * ## Why this is a capability and not a helper
21503
21725
  *
21504
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21505
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21506
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21507
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21508
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21509
- * load 5,000 rows before ranking anything.
21726
+ * This capability was introduced with the claim that SIX stores in
21727
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21728
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21729
+ * claim was never true, and leaving it here made five stores look like pending
21730
+ * work when three of them have no vector at all. Counted column by column on
21731
+ * 2026-08-30, exactly THREE ever held one:
21732
+ *
21733
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21734
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21735
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21736
+ * face, migrated 2026-08-30 into its OWN index (see below).
21737
+ *
21738
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21739
+ * and `identities` store a name; the event store stores no derivative vector.
21740
+ * They are not migration candidates and never were.
21741
+ *
21742
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21743
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21744
+ * rows before ranking anything.
21745
+ *
21746
+ * ## One index per COMPARISON, never per encoder
21747
+ *
21748
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21749
+ * model, and they still get two indexes. An index is a set of things that are
21750
+ * ranked against each other and that live and die together, and these two are
21751
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21752
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21753
+ * forever and is the gallery every recognition ranks against. One index would
21754
+ * mean every gallery load and every reconcile carried a filter whose failure
21755
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21756
+ * person's only sample. The dimension they share is not a reason to share an
21757
+ * index; the question they answer is, and it differs.
21510
21758
  *
21511
21759
  * The fix is not a faster loop, it is a different backend — and the backend
21512
21760
  * should be replaceable without touching six callers. So: a singleton
@@ -21611,7 +21859,20 @@ var VectorQueryResultSchema = object({
21611
21859
  */
21612
21860
  scanned: number(),
21613
21861
  /** True when the backend could not consider every row that passed the filter. */
21614
- truncated: boolean()
21862
+ truncated: boolean(),
21863
+ /**
21864
+ * The `topK` the backend actually ran with.
21865
+ *
21866
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21867
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21868
+ * own log rather than in its answer. That is how an audit asking for 20,000
21869
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21870
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21871
+ * MUCH, in the return value, where the caller cannot fail to see it.
21872
+ *
21873
+ * Equals the requested `topK` whenever nothing was lowered.
21874
+ */
21875
+ effectiveTopK: number().int().positive()
21615
21876
  });
21616
21877
  var VectorDeleteInputSchema = object({
21617
21878
  index: string$2(),
@@ -21640,6 +21901,68 @@ var VectorGetResultSchema = object({ items: array(object({
21640
21901
  id: string$2(),
21641
21902
  metadata: VectorMetadataSchema
21642
21903
  })) });
21904
+ /**
21905
+ * Ids to read back WITH their vectors.
21906
+ *
21907
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21908
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21909
+ * caller depends on that promise. This one promises the opposite.
21910
+ *
21911
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21912
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21913
+ * a per-face cross-process KNN would be a network round trip inside the
21914
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21915
+ * it requires the index to hand the floats back. Without this method the only
21916
+ * way to keep a readable vector is a JSON column, which is the thing this
21917
+ * capability exists to delete.
21918
+ *
21919
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21920
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21921
+ */
21922
+ var VectorFetchInputSchema = object({
21923
+ index: string$2(),
21924
+ ids: array(string$2())
21925
+ });
21926
+ var VectorFetchResultSchema = object({ items: array(object({
21927
+ id: string$2(),
21928
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21929
+ vector: string$2(),
21930
+ metadata: VectorMetadataSchema
21931
+ })) });
21932
+ /**
21933
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21934
+ *
21935
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21936
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21937
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21938
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21939
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21940
+ * looked" for as long as anyone cared to read it.
21941
+ *
21942
+ * This is the primitive that question actually needs: a bounded page, ordered
21943
+ * by the backend's own row order, costing no distance computation at all.
21944
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21945
+ * the full-table read this capability was built to stop.
21946
+ */
21947
+ var VectorScanInputSchema = object({
21948
+ index: string$2(),
21949
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21950
+ cursor: number().int().nonnegative().default(0),
21951
+ limit: number().int().positive()
21952
+ });
21953
+ var VectorScanResultSchema = object({
21954
+ items: array(object({
21955
+ id: string$2(),
21956
+ metadata: VectorMetadataSchema
21957
+ })),
21958
+ /**
21959
+ * Where the next page starts, or `null` when the walk reached the end.
21960
+ *
21961
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21962
+ * from a short page: a backend is free to return fewer rows than asked.
21963
+ */
21964
+ nextCursor: number().int().nonnegative().nullable()
21965
+ });
21643
21966
  var VectorStatsInputSchema = object({ index: string$2() });
21644
21967
  var VectorStatsResultSchema = object({
21645
21968
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21658,7 +21981,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21658
21981
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21659
21982
  kind: "mutation",
21660
21983
  auth: "admin"
21661
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21984
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21662
21985
  kind: "mutation",
21663
21986
  auth: "admin"
21664
21987
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28294,6 +28617,9 @@ method(object({
28294
28617
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28295
28618
  kind: "query",
28296
28619
  auth: "admin"
28620
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28621
+ kind: "query",
28622
+ auth: "admin"
28297
28623
  }), method(object({ jobId: string$2() }), object({ cancelled: boolean() }), {
28298
28624
  kind: "mutation",
28299
28625
  auth: "admin"
@@ -34928,6 +35254,12 @@ Object.freeze({
34928
35254
  addonId: null,
34929
35255
  access: "create"
34930
35256
  },
35257
+ "pipelineAnalytics.countRelocatableMedia": {
35258
+ capName: "pipeline-analytics",
35259
+ capScope: "device",
35260
+ addonId: null,
35261
+ access: "view"
35262
+ },
34931
35263
  "pipelineAnalytics.countUnstampedEventMedia": {
34932
35264
  capName: "pipeline-analytics",
34933
35265
  capScope: "device",
@@ -36092,6 +36424,12 @@ Object.freeze({
36092
36424
  addonId: null,
36093
36425
  access: "view"
36094
36426
  },
36427
+ "recording.getRelocateResidue": {
36428
+ capName: "recording",
36429
+ capScope: "system",
36430
+ addonId: null,
36431
+ access: "view"
36432
+ },
36095
36433
  "recording.getStorageMigrationMoveStatus": {
36096
36434
  capName: "recording",
36097
36435
  capScope: "system",
@@ -36638,12 +36976,30 @@ Object.freeze({
36638
36976
  addonId: null,
36639
36977
  access: "create"
36640
36978
  },
36979
+ "storageMigration.drain": {
36980
+ capName: "storage-migration",
36981
+ capScope: "system",
36982
+ addonId: null,
36983
+ access: "create"
36984
+ },
36985
+ "storageMigration.movers": {
36986
+ capName: "storage-migration",
36987
+ capScope: "system",
36988
+ addonId: null,
36989
+ access: "view"
36990
+ },
36641
36991
  "storageMigration.plan": {
36642
36992
  capName: "storage-migration",
36643
36993
  capScope: "system",
36644
36994
  addonId: null,
36645
36995
  access: "view"
36646
36996
  },
36997
+ "storageMigration.residue": {
36998
+ capName: "storage-migration",
36999
+ capScope: "system",
37000
+ addonId: null,
37001
+ access: "view"
37002
+ },
36647
37003
  "storageMigration.start": {
36648
37004
  capName: "storage-migration",
36649
37005
  capScope: "system",
@@ -37478,6 +37834,12 @@ Object.freeze({
37478
37834
  addonId: null,
37479
37835
  access: "delete"
37480
37836
  },
37837
+ "vectorStore.fetchByIds": {
37838
+ capName: "vector-store",
37839
+ capScope: "system",
37840
+ addonId: null,
37841
+ access: "view"
37842
+ },
37481
37843
  "vectorStore.getByIds": {
37482
37844
  capName: "vector-store",
37483
37845
  capScope: "system",
@@ -37490,6 +37852,12 @@ Object.freeze({
37490
37852
  addonId: null,
37491
37853
  access: "view"
37492
37854
  },
37855
+ "vectorStore.scan": {
37856
+ capName: "vector-store",
37857
+ capScope: "system",
37858
+ addonId: null,
37859
+ access: "view"
37860
+ },
37493
37861
  "vectorStore.stats": {
37494
37862
  capName: "vector-store",
37495
37863
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-matter-broker",
3
- "version": "0.2.42",
3
+ "version": "0.2.45",
4
4
  "description": "Matter broker addon for CamStack — owns a Matter fabric (commissioning + the long-lived controller) via the matter.js controller and brokers commissioned Matter nodes into CamStack",
5
5
  "keywords": [
6
6
  "camstack",