@camstack/addon-export-hap 1.2.54 → 1.2.57

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.
@@ -8669,6 +8669,21 @@ var RelocateJobSchema = object({
8669
8669
  bytesMoved: number().int(),
8670
8670
  /** Total files discovered up front; null while (or when) unknown. */
8671
8671
  filesTotal: number().int().nullable(),
8672
+ /**
8673
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8674
+ * made that nobody asked for, so it is reported where the operator reads the
8675
+ * job rather than only in a log line.
8676
+ *
8677
+ * A footage segment records its byte count in its own NAME, and the durable
8678
+ * hour row derives its aggregates from those names. A file that does not
8679
+ * match its name therefore makes the ledger's sums — and with them quota and
8680
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8681
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8682
+ *
8683
+ * Absent on lanes where the question has no meaning: a media blob's size is
8684
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8685
+ */
8686
+ rowsReconciled: number().int().nonnegative().optional(),
8672
8687
  startedAt: number(),
8673
8688
  finishedAt: number().nullable(),
8674
8689
  error: string().nullable()
@@ -8737,14 +8752,42 @@ var RelocateMediaInputSchema = object({
8737
8752
  /** Omitted = `move`, the pre-existing behaviour. */
8738
8753
  mode: MediaRelocateModeSchema.optional()
8739
8754
  });
8740
- /** How many rows still carry NO `locationId` — the population a repoint would
8741
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8742
- * value that permits a non-blocking `eventMedia` cutover. */
8743
- var UnstampedEventMediaCountSchema = object({
8744
- media: number().int().nonnegative(),
8745
- retrainFrames: number().int().nonnegative(),
8746
- total: number().int().nonnegative()
8755
+ /**
8756
+ * The unstamped population of ONE collection split, because the gate and the
8757
+ * operator ask two different questions and only one of them has to be cheap.
8758
+ *
8759
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8760
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8761
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8762
+ * that matters — after a seal, when the population is empty.
8763
+ *
8764
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8765
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8766
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8767
+ * and useful answer: "there are some, and this read could not say how many"
8768
+ * still refuses the cutover, which is the whole job.
8769
+ */
8770
+ var UnstampedRowsSchema = object({
8771
+ present: boolean(),
8772
+ rows: number().int().nonnegative().nullable()
8747
8773
  });
8774
+ /**
8775
+ * How many rows still carry NO `locationId` — the population a repoint would
8776
+ * silently re-aim at a disk that does not hold their bytes.
8777
+ *
8778
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8779
+ * over. The gate opens on a measured absence and on nothing else; an unread
8780
+ * collection and an empty one are different facts, and this repo has already
8781
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8782
+ */
8783
+ var UnstampedEventMediaCountSchema = object({
8784
+ media: UnstampedRowsSchema,
8785
+ retrainFrames: UnstampedRowsSchema,
8786
+ /** True when EITHER collection holds one. The refusal reads this. */
8787
+ anyPresent: boolean(),
8788
+ /** Sum across both, or `null` when either lane could not be counted. */
8789
+ total: number().int().nonnegative().nullable()
8790
+ }).nullable();
8748
8791
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8749
8792
  /** The independently selectable logical storage classes — every class
8750
8793
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8830,13 +8873,53 @@ var StorageMigrationParticipantSchema = _enum([
8830
8873
  "recorder",
8831
8874
  "analytics"
8832
8875
  ]);
8876
+ /**
8877
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8878
+ *
8879
+ * The long half of a non-blocking migration is `draining`, and it is measured
8880
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8881
+ * existed the only place those numbers appeared was a Loki line, so an operator
8882
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8883
+ * afternoon.
8884
+ *
8885
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8886
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8887
+ * mover — which is the exact failure this is meant to end. The coordinator's
8888
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8889
+ * read `state`; folding the counters costs no extra read and makes the durable
8890
+ * record say afterwards how far a move actually got.
8891
+ *
8892
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8893
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8894
+ * cannot say M, and a 0 there would render as "100 % done".
8895
+ */
8896
+ var StorageMigrationMoveProgressSchema = object({
8897
+ filesMoved: number().int().nonnegative(),
8898
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8899
+ filesTotal: number().int().nonnegative().nullable(),
8900
+ bytesMoved: number().int().nonnegative(),
8901
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8902
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8903
+ * rows would be the same failure as one that silently skipped them. */
8904
+ rowsReconciled: number().int().nonnegative().optional(),
8905
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8906
+ * crash gets a new mover, and a rate computed from the migration's start
8907
+ * would silently average in the time nothing was running. */
8908
+ startedAt: number(),
8909
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8910
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8911
+ * subtract its own. */
8912
+ observedAt: number()
8913
+ });
8833
8914
  var StorageMigrationMoveSchema = object({
8834
8915
  storageClass: StorageMigrationClassSchema,
8835
8916
  fromLocationId: string(),
8836
8917
  toLocationId: string(),
8837
8918
  moverJobId: string().nullable(),
8838
8919
  state: RelocateJobStateSchema.nullable(),
8839
- error: string().nullable()
8920
+ error: string().nullable(),
8921
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8922
+ progress: StorageMigrationMoveProgressSchema.nullable()
8840
8923
  });
8841
8924
  var StorageMigrationJobSchema = object({
8842
8925
  jobId: string(),
@@ -8882,6 +8965,98 @@ var StorageMigrationPlanSchema = object({
8882
8965
  findings: array(StorageMigrationFindingSchema)
8883
8966
  });
8884
8967
  /**
8968
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8969
+ *
8970
+ * The coordinator's job record is the state of record for a migration, and its
8971
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8972
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8973
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8974
+ * way because no supported UI path existed. A mover armed like that has no job
8975
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8976
+ *
8977
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8978
+ * orchestrated it.
8979
+ */
8980
+ var StorageMigrationMoverSchema = object({
8981
+ lane: _enum(["footage", "media"]),
8982
+ job: RelocateJobSchema,
8983
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8984
+ * directly against the owning addon. */
8985
+ migrationJobId: string().nullable(),
8986
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8987
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8988
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8989
+ * rate made of two different clocks. */
8990
+ observedAt: number()
8991
+ });
8992
+ /**
8993
+ * What a SOURCE still holds for one storage class — the number that makes a
8994
+ * "drain remaining" action honest rather than hopeful.
8995
+ *
8996
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8997
+ * engine's own selection count for media), never from the resident index: a
8998
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8999
+ * never been told about (D295).
9000
+ *
9001
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
9002
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
9003
+ * because refusing on an unanswerable read would hide exactly the case an
9004
+ * operator needs to act on.
9005
+ */
9006
+ var StorageMigrationResidueSchema = object({
9007
+ storageClass: StorageMigrationClassSchema,
9008
+ /** The location still holding the data. `'*'` for the media lane, whose rows
9009
+ * move from wherever they are rather than from one named source. */
9010
+ fromLocationId: string(),
9011
+ /** Where a drain would move it — the class's CURRENT default. */
9012
+ toLocationId: string(),
9013
+ /** Segments (footage lane) or rows (media lane) still on the source. */
9014
+ items: number().int().nonnegative().nullable(),
9015
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
9016
+ bytes: number().int().nonnegative().nullable()
9017
+ });
9018
+ /**
9019
+ * Run the DRAIN half and nothing else.
9020
+ *
9021
+ * A migration that reached `done` has already repointed, so `start` correctly
9022
+ * refuses its destination ("already the default") — there is nothing left to
9023
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
9024
+ * or finish against a work list that was a tenth of the archive (D295), and
9025
+ * before this there was no supported way to run only that half: the only way
9026
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
9027
+ *
9028
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
9029
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
9030
+ * re-repoint a class that is already migrated.
9031
+ */
9032
+ var StorageMigrationDrainInputSchema = object({
9033
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
9034
+ * a class whose source is already empty is refused rather than started. */
9035
+ classes: array(StorageMigrationClassSchema).min(1),
9036
+ throttleMbps: number().min(1).max(1e3).optional()
9037
+ });
9038
+ /** What a footage source still holds, asked of the durable hour ledger. */
9039
+ var RelocateResidueInputSchema = object({
9040
+ fromLocationId: string().min(1),
9041
+ /** Narrow to one logical class; omit for every profile on the location. */
9042
+ footageClass: RelocateFootageClassSchema.optional()
9043
+ });
9044
+ /** `null` = the archive could not answer (no ledger on this node, or the
9045
+ * aggregate failed). Never conflated with an empty source. */
9046
+ var RelocateResidueSchema = object({
9047
+ segments: number().int().nonnegative(),
9048
+ bytes: number().int().nonnegative()
9049
+ }).nullable();
9050
+ /** How many rows a media pass would still act on against a given target — the
9051
+ * media lane's denominator AND its residue, from ONE derivation so the two can
9052
+ * never disagree. `null` = the count could not be taken. */
9053
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
9054
+ var RelocatableMediaCountInputSchema = object({
9055
+ toLocationId: string().min(1),
9056
+ /** Omitted = `move`. */
9057
+ mode: MediaRelocateModeSchema.optional()
9058
+ });
9059
+ /**
8885
9060
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8886
9061
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8887
9062
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8985,6 +9160,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8985
9160
  * two addons declaring the same `id` must agree on `cardinality` (validated
8986
9161
  * at kernel aggregation time, not here).
8987
9162
  */
9163
+ /**
9164
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
9165
+ * actually reaches the bytes. It is the constraint that decides which
9166
+ * `storage-provider`s may back a location of that kind.
9167
+ *
9168
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
9169
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
9170
+ * post-analysis media roots). Only a provider that serves a genuine local
9171
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
9172
+ * remote provider's `resolve` returns a path on the REMOTE host, and
9173
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
9174
+ * against a same-named local directory that is something else entirely.
9175
+ *
9176
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
9177
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
9178
+ * service never sees a path, so any provider can back it. `backups` is the
9179
+ * one kind that qualifies today.
9180
+ *
9181
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
9182
+ * an EMERGENT property of how the recorder happened to be written. Nothing
9183
+ * refused the configuration; the first write simply went somewhere wrong, and
9184
+ * a recording write that goes wrong surfaces as a silent black window rather
9185
+ * than an error (the read path does not `stat`). This turns that accident into
9186
+ * a declared, enforced, testable refusal.
9187
+ */
9188
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8988
9189
  var StorageLocationDeclarationSchema = object({
8989
9190
  /**
8990
9191
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -9004,6 +9205,19 @@ var StorageLocationDeclarationSchema = object({
9004
9205
  */
9005
9206
  cardinality: _enum(["single", "multi"]),
9006
9207
  /**
9208
+ * HOW the declaring service reaches the bytes — and therefore WHICH
9209
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
9210
+ * and {@link STORAGE_ACCESS_FALLBACK}.
9211
+ *
9212
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
9213
+ * can only over-restrict (refuse a remote provider for a kind that might
9214
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
9215
+ * permissive direction and is therefore never inferred — a repo guard
9216
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
9217
+ * reached by omission.
9218
+ */
9219
+ access: StorageAccessSchema.optional(),
9220
+ /**
9007
9221
  * When set, the default instance for this location inherits its resolved
9008
9222
  * root from the named location's default instance. Useful for derivative
9009
9223
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18664,8 +18878,10 @@ var TrackSchema = object({
18664
18878
  lastSeen: number(),
18665
18879
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18666
18880
  positions: array(TrackPositionSchema).readonly(),
18667
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18668
- * saveThumbnails policy). */
18881
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18882
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18883
+ * the retired `saveThumbnails` used to gate this and the rolling
18884
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18669
18885
  snapshots: array(TrackSnapshotSchema).readonly(),
18670
18886
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18671
18887
  zonesVisited: array(string()).readonly(),
@@ -19525,7 +19741,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19525
19741
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19526
19742
  kind: "mutation",
19527
19743
  auth: "admin"
19528
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19744
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19745
+ kind: "query",
19746
+ auth: "admin"
19747
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19529
19748
  kind: "query",
19530
19749
  auth: "admin"
19531
19750
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21484,6 +21703,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21484
21703
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21485
21704
  kind: "mutation",
21486
21705
  auth: "admin"
21706
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21707
+ kind: "mutation",
21708
+ auth: "admin"
21487
21709
  });
21488
21710
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21489
21711
  providerId: string().min(1),
@@ -21882,12 +22104,38 @@ response: record(string(), unknown()) }), object({
21882
22104
  *
21883
22105
  * ## Why this is a capability and not a helper
21884
22106
  *
21885
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21886
- * plate, vehicle, identity, and the event store's derivativesand every one of
21887
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21888
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21889
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21890
- * load 5,000 rows before ranking anything.
22107
+ * This capability was introduced with the claim that SIX stores in
22108
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
22109
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
22110
+ * claim was never true, and leaving it here made five stores look like pending
22111
+ * work when three of them have no vector at all. Counted column by column on
22112
+ * 2026-08-30, exactly THREE ever held one:
22113
+ *
22114
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
22115
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
22116
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
22117
+ * face, migrated 2026-08-30 into its OWN index (see below).
22118
+ *
22119
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
22120
+ * and `identities` store a name; the event store stores no derivative vector.
22121
+ * They are not migration candidates and never were.
22122
+ *
22123
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
22124
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
22125
+ * rows before ranking anything.
22126
+ *
22127
+ * ## One index per COMPARISON, never per encoder
22128
+ *
22129
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
22130
+ * model, and they still get two indexes. An index is a set of things that are
22131
+ * ranked against each other and that live and die together, and these two are
22132
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
22133
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
22134
+ * forever and is the gallery every recognition ranks against. One index would
22135
+ * mean every gallery load and every reconcile carried a filter whose failure
22136
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
22137
+ * person's only sample. The dimension they share is not a reason to share an
22138
+ * index; the question they answer is, and it differs.
21891
22139
  *
21892
22140
  * The fix is not a faster loop, it is a different backend — and the backend
21893
22141
  * should be replaceable without touching six callers. So: a singleton
@@ -21992,7 +22240,20 @@ var VectorQueryResultSchema = object({
21992
22240
  */
21993
22241
  scanned: number(),
21994
22242
  /** True when the backend could not consider every row that passed the filter. */
21995
- truncated: boolean()
22243
+ truncated: boolean(),
22244
+ /**
22245
+ * The `topK` the backend actually ran with.
22246
+ *
22247
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
22248
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
22249
+ * own log rather than in its answer. That is how an audit asking for 20,000
22250
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
22251
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
22252
+ * MUCH, in the return value, where the caller cannot fail to see it.
22253
+ *
22254
+ * Equals the requested `topK` whenever nothing was lowered.
22255
+ */
22256
+ effectiveTopK: number().int().positive()
21996
22257
  });
21997
22258
  var VectorDeleteInputSchema = object({
21998
22259
  index: string(),
@@ -22021,6 +22282,68 @@ var VectorGetResultSchema = object({ items: array(object({
22021
22282
  id: string(),
22022
22283
  metadata: VectorMetadataSchema
22023
22284
  })) });
22285
+ /**
22286
+ * Ids to read back WITH their vectors.
22287
+ *
22288
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22289
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22290
+ * caller depends on that promise. This one promises the opposite.
22291
+ *
22292
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22293
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22294
+ * a per-face cross-process KNN would be a network round trip inside the
22295
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22296
+ * it requires the index to hand the floats back. Without this method the only
22297
+ * way to keep a readable vector is a JSON column, which is the thing this
22298
+ * capability exists to delete.
22299
+ *
22300
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22301
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22302
+ */
22303
+ var VectorFetchInputSchema = object({
22304
+ index: string(),
22305
+ ids: array(string())
22306
+ });
22307
+ var VectorFetchResultSchema = object({ items: array(object({
22308
+ id: string(),
22309
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22310
+ vector: string(),
22311
+ metadata: VectorMetadataSchema
22312
+ })) });
22313
+ /**
22314
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22315
+ *
22316
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22317
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22318
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22319
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22320
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22321
+ * looked" for as long as anyone cared to read it.
22322
+ *
22323
+ * This is the primitive that question actually needs: a bounded page, ordered
22324
+ * by the backend's own row order, costing no distance computation at all.
22325
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22326
+ * the full-table read this capability was built to stop.
22327
+ */
22328
+ var VectorScanInputSchema = object({
22329
+ index: string(),
22330
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22331
+ cursor: number().int().nonnegative().default(0),
22332
+ limit: number().int().positive()
22333
+ });
22334
+ var VectorScanResultSchema = object({
22335
+ items: array(object({
22336
+ id: string(),
22337
+ metadata: VectorMetadataSchema
22338
+ })),
22339
+ /**
22340
+ * Where the next page starts, or `null` when the walk reached the end.
22341
+ *
22342
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22343
+ * from a short page: a backend is free to return fewer rows than asked.
22344
+ */
22345
+ nextCursor: number().int().nonnegative().nullable()
22346
+ });
22024
22347
  var VectorStatsInputSchema = object({ index: string() });
22025
22348
  var VectorStatsResultSchema = object({
22026
22349
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -22039,7 +22362,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
22039
22362
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
22040
22363
  kind: "mutation",
22041
22364
  auth: "admin"
22042
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22365
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22043
22366
  kind: "mutation",
22044
22367
  auth: "admin"
22045
22368
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26991,6 +27314,9 @@ method(object({
26991
27314
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26992
27315
  kind: "query",
26993
27316
  auth: "admin"
27317
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
27318
+ kind: "query",
27319
+ auth: "admin"
26994
27320
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26995
27321
  kind: "mutation",
26996
27322
  auth: "admin"
@@ -31981,6 +32307,12 @@ Object.freeze({
31981
32307
  addonId: null,
31982
32308
  access: "create"
31983
32309
  },
32310
+ "pipelineAnalytics.countRelocatableMedia": {
32311
+ capName: "pipeline-analytics",
32312
+ capScope: "device",
32313
+ addonId: null,
32314
+ access: "view"
32315
+ },
31984
32316
  "pipelineAnalytics.countUnstampedEventMedia": {
31985
32317
  capName: "pipeline-analytics",
31986
32318
  capScope: "device",
@@ -33145,6 +33477,12 @@ Object.freeze({
33145
33477
  addonId: null,
33146
33478
  access: "view"
33147
33479
  },
33480
+ "recording.getRelocateResidue": {
33481
+ capName: "recording",
33482
+ capScope: "system",
33483
+ addonId: null,
33484
+ access: "view"
33485
+ },
33148
33486
  "recording.getStorageMigrationMoveStatus": {
33149
33487
  capName: "recording",
33150
33488
  capScope: "system",
@@ -33691,12 +34029,30 @@ Object.freeze({
33691
34029
  addonId: null,
33692
34030
  access: "create"
33693
34031
  },
34032
+ "storageMigration.drain": {
34033
+ capName: "storage-migration",
34034
+ capScope: "system",
34035
+ addonId: null,
34036
+ access: "create"
34037
+ },
34038
+ "storageMigration.movers": {
34039
+ capName: "storage-migration",
34040
+ capScope: "system",
34041
+ addonId: null,
34042
+ access: "view"
34043
+ },
33694
34044
  "storageMigration.plan": {
33695
34045
  capName: "storage-migration",
33696
34046
  capScope: "system",
33697
34047
  addonId: null,
33698
34048
  access: "view"
33699
34049
  },
34050
+ "storageMigration.residue": {
34051
+ capName: "storage-migration",
34052
+ capScope: "system",
34053
+ addonId: null,
34054
+ access: "view"
34055
+ },
33700
34056
  "storageMigration.start": {
33701
34057
  capName: "storage-migration",
33702
34058
  capScope: "system",
@@ -34531,6 +34887,12 @@ Object.freeze({
34531
34887
  addonId: null,
34532
34888
  access: "delete"
34533
34889
  },
34890
+ "vectorStore.fetchByIds": {
34891
+ capName: "vector-store",
34892
+ capScope: "system",
34893
+ addonId: null,
34894
+ access: "view"
34895
+ },
34534
34896
  "vectorStore.getByIds": {
34535
34897
  capName: "vector-store",
34536
34898
  capScope: "system",
@@ -34543,6 +34905,12 @@ Object.freeze({
34543
34905
  addonId: null,
34544
34906
  access: "view"
34545
34907
  },
34908
+ "vectorStore.scan": {
34909
+ capName: "vector-store",
34910
+ capScope: "system",
34911
+ addonId: null,
34912
+ access: "view"
34913
+ },
34546
34914
  "vectorStore.stats": {
34547
34915
  capName: "vector-store",
34548
34916
  capScope: "system",
@@ -8657,6 +8657,21 @@ var RelocateJobSchema = object({
8657
8657
  bytesMoved: number().int(),
8658
8658
  /** Total files discovered up front; null while (or when) unknown. */
8659
8659
  filesTotal: number().int().nullable(),
8660
+ /**
8661
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8662
+ * made that nobody asked for, so it is reported where the operator reads the
8663
+ * job rather than only in a log line.
8664
+ *
8665
+ * A footage segment records its byte count in its own NAME, and the durable
8666
+ * hour row derives its aggregates from those names. A file that does not
8667
+ * match its name therefore makes the ledger's sums — and with them quota and
8668
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8669
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8670
+ *
8671
+ * Absent on lanes where the question has no meaning: a media blob's size is
8672
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8673
+ */
8674
+ rowsReconciled: number().int().nonnegative().optional(),
8660
8675
  startedAt: number(),
8661
8676
  finishedAt: number().nullable(),
8662
8677
  error: string().nullable()
@@ -8725,14 +8740,42 @@ var RelocateMediaInputSchema = object({
8725
8740
  /** Omitted = `move`, the pre-existing behaviour. */
8726
8741
  mode: MediaRelocateModeSchema.optional()
8727
8742
  });
8728
- /** How many rows still carry NO `locationId` — the population a repoint would
8729
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8730
- * value that permits a non-blocking `eventMedia` cutover. */
8731
- var UnstampedEventMediaCountSchema = object({
8732
- media: number().int().nonnegative(),
8733
- retrainFrames: number().int().nonnegative(),
8734
- total: number().int().nonnegative()
8743
+ /**
8744
+ * The unstamped population of ONE collection split, because the gate and the
8745
+ * operator ask two different questions and only one of them has to be cheap.
8746
+ *
8747
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8748
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8749
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8750
+ * that matters — after a seal, when the population is empty.
8751
+ *
8752
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8753
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8754
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8755
+ * and useful answer: "there are some, and this read could not say how many"
8756
+ * still refuses the cutover, which is the whole job.
8757
+ */
8758
+ var UnstampedRowsSchema = object({
8759
+ present: boolean(),
8760
+ rows: number().int().nonnegative().nullable()
8735
8761
  });
8762
+ /**
8763
+ * How many rows still carry NO `locationId` — the population a repoint would
8764
+ * silently re-aim at a disk that does not hold their bytes.
8765
+ *
8766
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8767
+ * over. The gate opens on a measured absence and on nothing else; an unread
8768
+ * collection and an empty one are different facts, and this repo has already
8769
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8770
+ */
8771
+ var UnstampedEventMediaCountSchema = object({
8772
+ media: UnstampedRowsSchema,
8773
+ retrainFrames: UnstampedRowsSchema,
8774
+ /** True when EITHER collection holds one. The refusal reads this. */
8775
+ anyPresent: boolean(),
8776
+ /** Sum across both, or `null` when either lane could not be counted. */
8777
+ total: number().int().nonnegative().nullable()
8778
+ }).nullable();
8736
8779
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8737
8780
  /** The independently selectable logical storage classes — every class
8738
8781
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8818,13 +8861,53 @@ var StorageMigrationParticipantSchema = _enum([
8818
8861
  "recorder",
8819
8862
  "analytics"
8820
8863
  ]);
8864
+ /**
8865
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8866
+ *
8867
+ * The long half of a non-blocking migration is `draining`, and it is measured
8868
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8869
+ * existed the only place those numbers appeared was a Loki line, so an operator
8870
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8871
+ * afternoon.
8872
+ *
8873
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8874
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8875
+ * mover — which is the exact failure this is meant to end. The coordinator's
8876
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8877
+ * read `state`; folding the counters costs no extra read and makes the durable
8878
+ * record say afterwards how far a move actually got.
8879
+ *
8880
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8881
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8882
+ * cannot say M, and a 0 there would render as "100 % done".
8883
+ */
8884
+ var StorageMigrationMoveProgressSchema = object({
8885
+ filesMoved: number().int().nonnegative(),
8886
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8887
+ filesTotal: number().int().nonnegative().nullable(),
8888
+ bytesMoved: number().int().nonnegative(),
8889
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8890
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8891
+ * rows would be the same failure as one that silently skipped them. */
8892
+ rowsReconciled: number().int().nonnegative().optional(),
8893
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8894
+ * crash gets a new mover, and a rate computed from the migration's start
8895
+ * would silently average in the time nothing was running. */
8896
+ startedAt: number(),
8897
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8898
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8899
+ * subtract its own. */
8900
+ observedAt: number()
8901
+ });
8821
8902
  var StorageMigrationMoveSchema = object({
8822
8903
  storageClass: StorageMigrationClassSchema,
8823
8904
  fromLocationId: string(),
8824
8905
  toLocationId: string(),
8825
8906
  moverJobId: string().nullable(),
8826
8907
  state: RelocateJobStateSchema.nullable(),
8827
- error: string().nullable()
8908
+ error: string().nullable(),
8909
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8910
+ progress: StorageMigrationMoveProgressSchema.nullable()
8828
8911
  });
8829
8912
  var StorageMigrationJobSchema = object({
8830
8913
  jobId: string(),
@@ -8870,6 +8953,98 @@ var StorageMigrationPlanSchema = object({
8870
8953
  findings: array(StorageMigrationFindingSchema)
8871
8954
  });
8872
8955
  /**
8956
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8957
+ *
8958
+ * The coordinator's job record is the state of record for a migration, and its
8959
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8960
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8961
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8962
+ * way because no supported UI path existed. A mover armed like that has no job
8963
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8964
+ *
8965
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8966
+ * orchestrated it.
8967
+ */
8968
+ var StorageMigrationMoverSchema = object({
8969
+ lane: _enum(["footage", "media"]),
8970
+ job: RelocateJobSchema,
8971
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8972
+ * directly against the owning addon. */
8973
+ migrationJobId: string().nullable(),
8974
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8975
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8976
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8977
+ * rate made of two different clocks. */
8978
+ observedAt: number()
8979
+ });
8980
+ /**
8981
+ * What a SOURCE still holds for one storage class — the number that makes a
8982
+ * "drain remaining" action honest rather than hopeful.
8983
+ *
8984
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8985
+ * engine's own selection count for media), never from the resident index: a
8986
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8987
+ * never been told about (D295).
8988
+ *
8989
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8990
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8991
+ * because refusing on an unanswerable read would hide exactly the case an
8992
+ * operator needs to act on.
8993
+ */
8994
+ var StorageMigrationResidueSchema = object({
8995
+ storageClass: StorageMigrationClassSchema,
8996
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8997
+ * move from wherever they are rather than from one named source. */
8998
+ fromLocationId: string(),
8999
+ /** Where a drain would move it — the class's CURRENT default. */
9000
+ toLocationId: string(),
9001
+ /** Segments (footage lane) or rows (media lane) still on the source. */
9002
+ items: number().int().nonnegative().nullable(),
9003
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
9004
+ bytes: number().int().nonnegative().nullable()
9005
+ });
9006
+ /**
9007
+ * Run the DRAIN half and nothing else.
9008
+ *
9009
+ * A migration that reached `done` has already repointed, so `start` correctly
9010
+ * refuses its destination ("already the default") — there is nothing left to
9011
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
9012
+ * or finish against a work list that was a tenth of the archive (D295), and
9013
+ * before this there was no supported way to run only that half: the only way
9014
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
9015
+ *
9016
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
9017
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
9018
+ * re-repoint a class that is already migrated.
9019
+ */
9020
+ var StorageMigrationDrainInputSchema = object({
9021
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
9022
+ * a class whose source is already empty is refused rather than started. */
9023
+ classes: array(StorageMigrationClassSchema).min(1),
9024
+ throttleMbps: number().min(1).max(1e3).optional()
9025
+ });
9026
+ /** What a footage source still holds, asked of the durable hour ledger. */
9027
+ var RelocateResidueInputSchema = object({
9028
+ fromLocationId: string().min(1),
9029
+ /** Narrow to one logical class; omit for every profile on the location. */
9030
+ footageClass: RelocateFootageClassSchema.optional()
9031
+ });
9032
+ /** `null` = the archive could not answer (no ledger on this node, or the
9033
+ * aggregate failed). Never conflated with an empty source. */
9034
+ var RelocateResidueSchema = object({
9035
+ segments: number().int().nonnegative(),
9036
+ bytes: number().int().nonnegative()
9037
+ }).nullable();
9038
+ /** How many rows a media pass would still act on against a given target — the
9039
+ * media lane's denominator AND its residue, from ONE derivation so the two can
9040
+ * never disagree. `null` = the count could not be taken. */
9041
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
9042
+ var RelocatableMediaCountInputSchema = object({
9043
+ toLocationId: string().min(1),
9044
+ /** Omitted = `move`. */
9045
+ mode: MediaRelocateModeSchema.optional()
9046
+ });
9047
+ /**
8873
9048
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8874
9049
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8875
9050
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8973,6 +9148,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8973
9148
  * two addons declaring the same `id` must agree on `cardinality` (validated
8974
9149
  * at kernel aggregation time, not here).
8975
9150
  */
9151
+ /**
9152
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
9153
+ * actually reaches the bytes. It is the constraint that decides which
9154
+ * `storage-provider`s may back a location of that kind.
9155
+ *
9156
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
9157
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
9158
+ * post-analysis media roots). Only a provider that serves a genuine local
9159
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
9160
+ * remote provider's `resolve` returns a path on the REMOTE host, and
9161
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
9162
+ * against a same-named local directory that is something else entirely.
9163
+ *
9164
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
9165
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
9166
+ * service never sees a path, so any provider can back it. `backups` is the
9167
+ * one kind that qualifies today.
9168
+ *
9169
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
9170
+ * an EMERGENT property of how the recorder happened to be written. Nothing
9171
+ * refused the configuration; the first write simply went somewhere wrong, and
9172
+ * a recording write that goes wrong surfaces as a silent black window rather
9173
+ * than an error (the read path does not `stat`). This turns that accident into
9174
+ * a declared, enforced, testable refusal.
9175
+ */
9176
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8976
9177
  var StorageLocationDeclarationSchema = object({
8977
9178
  /**
8978
9179
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8992,6 +9193,19 @@ var StorageLocationDeclarationSchema = object({
8992
9193
  */
8993
9194
  cardinality: _enum(["single", "multi"]),
8994
9195
  /**
9196
+ * HOW the declaring service reaches the bytes — and therefore WHICH
9197
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
9198
+ * and {@link STORAGE_ACCESS_FALLBACK}.
9199
+ *
9200
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
9201
+ * can only over-restrict (refuse a remote provider for a kind that might
9202
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
9203
+ * permissive direction and is therefore never inferred — a repo guard
9204
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
9205
+ * reached by omission.
9206
+ */
9207
+ access: StorageAccessSchema.optional(),
9208
+ /**
8995
9209
  * When set, the default instance for this location inherits its resolved
8996
9210
  * root from the named location's default instance. Useful for derivative
8997
9211
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18652,8 +18866,10 @@ var TrackSchema = object({
18652
18866
  lastSeen: number(),
18653
18867
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18654
18868
  positions: array(TrackPositionSchema).readonly(),
18655
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18656
- * saveThumbnails policy). */
18869
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18870
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18871
+ * the retired `saveThumbnails` used to gate this and the rolling
18872
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18657
18873
  snapshots: array(TrackSnapshotSchema).readonly(),
18658
18874
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18659
18875
  zonesVisited: array(string()).readonly(),
@@ -19513,7 +19729,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19513
19729
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19514
19730
  kind: "mutation",
19515
19731
  auth: "admin"
19516
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19732
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19733
+ kind: "query",
19734
+ auth: "admin"
19735
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19517
19736
  kind: "query",
19518
19737
  auth: "admin"
19519
19738
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21472,6 +21691,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21472
21691
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21473
21692
  kind: "mutation",
21474
21693
  auth: "admin"
21694
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21695
+ kind: "mutation",
21696
+ auth: "admin"
21475
21697
  });
21476
21698
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21477
21699
  providerId: string().min(1),
@@ -21870,12 +22092,38 @@ response: record(string(), unknown()) }), object({
21870
22092
  *
21871
22093
  * ## Why this is a capability and not a helper
21872
22094
  *
21873
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21874
- * plate, vehicle, identity, and the event store's derivativesand every one of
21875
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21876
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21877
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21878
- * load 5,000 rows before ranking anything.
22095
+ * This capability was introduced with the claim that SIX stores in
22096
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
22097
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
22098
+ * claim was never true, and leaving it here made five stores look like pending
22099
+ * work when three of them have no vector at all. Counted column by column on
22100
+ * 2026-08-30, exactly THREE ever held one:
22101
+ *
22102
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
22103
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
22104
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
22105
+ * face, migrated 2026-08-30 into its OWN index (see below).
22106
+ *
22107
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
22108
+ * and `identities` store a name; the event store stores no derivative vector.
22109
+ * They are not migration candidates and never were.
22110
+ *
22111
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
22112
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
22113
+ * rows before ranking anything.
22114
+ *
22115
+ * ## One index per COMPARISON, never per encoder
22116
+ *
22117
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
22118
+ * model, and they still get two indexes. An index is a set of things that are
22119
+ * ranked against each other and that live and die together, and these two are
22120
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
22121
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
22122
+ * forever and is the gallery every recognition ranks against. One index would
22123
+ * mean every gallery load and every reconcile carried a filter whose failure
22124
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
22125
+ * person's only sample. The dimension they share is not a reason to share an
22126
+ * index; the question they answer is, and it differs.
21879
22127
  *
21880
22128
  * The fix is not a faster loop, it is a different backend — and the backend
21881
22129
  * should be replaceable without touching six callers. So: a singleton
@@ -21980,7 +22228,20 @@ var VectorQueryResultSchema = object({
21980
22228
  */
21981
22229
  scanned: number(),
21982
22230
  /** True when the backend could not consider every row that passed the filter. */
21983
- truncated: boolean()
22231
+ truncated: boolean(),
22232
+ /**
22233
+ * The `topK` the backend actually ran with.
22234
+ *
22235
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
22236
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
22237
+ * own log rather than in its answer. That is how an audit asking for 20,000
22238
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
22239
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
22240
+ * MUCH, in the return value, where the caller cannot fail to see it.
22241
+ *
22242
+ * Equals the requested `topK` whenever nothing was lowered.
22243
+ */
22244
+ effectiveTopK: number().int().positive()
21984
22245
  });
21985
22246
  var VectorDeleteInputSchema = object({
21986
22247
  index: string(),
@@ -22009,6 +22270,68 @@ var VectorGetResultSchema = object({ items: array(object({
22009
22270
  id: string(),
22010
22271
  metadata: VectorMetadataSchema
22011
22272
  })) });
22273
+ /**
22274
+ * Ids to read back WITH their vectors.
22275
+ *
22276
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22277
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22278
+ * caller depends on that promise. This one promises the opposite.
22279
+ *
22280
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22281
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22282
+ * a per-face cross-process KNN would be a network round trip inside the
22283
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22284
+ * it requires the index to hand the floats back. Without this method the only
22285
+ * way to keep a readable vector is a JSON column, which is the thing this
22286
+ * capability exists to delete.
22287
+ *
22288
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22289
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22290
+ */
22291
+ var VectorFetchInputSchema = object({
22292
+ index: string(),
22293
+ ids: array(string())
22294
+ });
22295
+ var VectorFetchResultSchema = object({ items: array(object({
22296
+ id: string(),
22297
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22298
+ vector: string(),
22299
+ metadata: VectorMetadataSchema
22300
+ })) });
22301
+ /**
22302
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22303
+ *
22304
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22305
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22306
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22307
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22308
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22309
+ * looked" for as long as anyone cared to read it.
22310
+ *
22311
+ * This is the primitive that question actually needs: a bounded page, ordered
22312
+ * by the backend's own row order, costing no distance computation at all.
22313
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22314
+ * the full-table read this capability was built to stop.
22315
+ */
22316
+ var VectorScanInputSchema = object({
22317
+ index: string(),
22318
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22319
+ cursor: number().int().nonnegative().default(0),
22320
+ limit: number().int().positive()
22321
+ });
22322
+ var VectorScanResultSchema = object({
22323
+ items: array(object({
22324
+ id: string(),
22325
+ metadata: VectorMetadataSchema
22326
+ })),
22327
+ /**
22328
+ * Where the next page starts, or `null` when the walk reached the end.
22329
+ *
22330
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22331
+ * from a short page: a backend is free to return fewer rows than asked.
22332
+ */
22333
+ nextCursor: number().int().nonnegative().nullable()
22334
+ });
22012
22335
  var VectorStatsInputSchema = object({ index: string() });
22013
22336
  var VectorStatsResultSchema = object({
22014
22337
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -22027,7 +22350,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
22027
22350
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
22028
22351
  kind: "mutation",
22029
22352
  auth: "admin"
22030
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22353
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22031
22354
  kind: "mutation",
22032
22355
  auth: "admin"
22033
22356
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26979,6 +27302,9 @@ method(object({
26979
27302
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26980
27303
  kind: "query",
26981
27304
  auth: "admin"
27305
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
27306
+ kind: "query",
27307
+ auth: "admin"
26982
27308
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26983
27309
  kind: "mutation",
26984
27310
  auth: "admin"
@@ -31969,6 +32295,12 @@ Object.freeze({
31969
32295
  addonId: null,
31970
32296
  access: "create"
31971
32297
  },
32298
+ "pipelineAnalytics.countRelocatableMedia": {
32299
+ capName: "pipeline-analytics",
32300
+ capScope: "device",
32301
+ addonId: null,
32302
+ access: "view"
32303
+ },
31972
32304
  "pipelineAnalytics.countUnstampedEventMedia": {
31973
32305
  capName: "pipeline-analytics",
31974
32306
  capScope: "device",
@@ -33133,6 +33465,12 @@ Object.freeze({
33133
33465
  addonId: null,
33134
33466
  access: "view"
33135
33467
  },
33468
+ "recording.getRelocateResidue": {
33469
+ capName: "recording",
33470
+ capScope: "system",
33471
+ addonId: null,
33472
+ access: "view"
33473
+ },
33136
33474
  "recording.getStorageMigrationMoveStatus": {
33137
33475
  capName: "recording",
33138
33476
  capScope: "system",
@@ -33679,12 +34017,30 @@ Object.freeze({
33679
34017
  addonId: null,
33680
34018
  access: "create"
33681
34019
  },
34020
+ "storageMigration.drain": {
34021
+ capName: "storage-migration",
34022
+ capScope: "system",
34023
+ addonId: null,
34024
+ access: "create"
34025
+ },
34026
+ "storageMigration.movers": {
34027
+ capName: "storage-migration",
34028
+ capScope: "system",
34029
+ addonId: null,
34030
+ access: "view"
34031
+ },
33682
34032
  "storageMigration.plan": {
33683
34033
  capName: "storage-migration",
33684
34034
  capScope: "system",
33685
34035
  addonId: null,
33686
34036
  access: "view"
33687
34037
  },
34038
+ "storageMigration.residue": {
34039
+ capName: "storage-migration",
34040
+ capScope: "system",
34041
+ addonId: null,
34042
+ access: "view"
34043
+ },
33688
34044
  "storageMigration.start": {
33689
34045
  capName: "storage-migration",
33690
34046
  capScope: "system",
@@ -34519,6 +34875,12 @@ Object.freeze({
34519
34875
  addonId: null,
34520
34876
  access: "delete"
34521
34877
  },
34878
+ "vectorStore.fetchByIds": {
34879
+ capName: "vector-store",
34880
+ capScope: "system",
34881
+ addonId: null,
34882
+ access: "view"
34883
+ },
34522
34884
  "vectorStore.getByIds": {
34523
34885
  capName: "vector-store",
34524
34886
  capScope: "system",
@@ -34531,6 +34893,12 @@ Object.freeze({
34531
34893
  addonId: null,
34532
34894
  access: "view"
34533
34895
  },
34896
+ "vectorStore.scan": {
34897
+ capName: "vector-store",
34898
+ capScope: "system",
34899
+ addonId: null,
34900
+ access: "view"
34901
+ },
34534
34902
  "vectorStore.stats": {
34535
34903
  capName: "vector-store",
34536
34904
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-hap",
3
- "version": "1.2.54",
3
+ "version": "1.2.57",
4
4
  "description": "HomeKit (HAP) exporter for CamStack devices. Publishes each exposed device as its own HomeKit accessory: cameras and doorbells with SRTP streaming, HomeKit Secure Video, motion, two-way audio, PTZ and battery; switches, lights, locks and sensors through a capability→service table.",
5
5
  "keywords": [
6
6
  "camstack",