@camstack/addon-provider-wyze 0.2.47 → 0.2.50

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
@@ -8035,6 +8035,21 @@ var RelocateJobSchema = object({
8035
8035
  bytesMoved: number().int(),
8036
8036
  /** Total files discovered up front; null while (or when) unknown. */
8037
8037
  filesTotal: number().int().nullable(),
8038
+ /**
8039
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8040
+ * made that nobody asked for, so it is reported where the operator reads the
8041
+ * job rather than only in a log line.
8042
+ *
8043
+ * A footage segment records its byte count in its own NAME, and the durable
8044
+ * hour row derives its aggregates from those names. A file that does not
8045
+ * match its name therefore makes the ledger's sums — and with them quota and
8046
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8047
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8048
+ *
8049
+ * Absent on lanes where the question has no meaning: a media blob's size is
8050
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8051
+ */
8052
+ rowsReconciled: number().int().nonnegative().optional(),
8038
8053
  startedAt: number(),
8039
8054
  finishedAt: number().nullable(),
8040
8055
  error: string().nullable()
@@ -8103,14 +8118,42 @@ var RelocateMediaInputSchema = object({
8103
8118
  /** Omitted = `move`, the pre-existing behaviour. */
8104
8119
  mode: MediaRelocateModeSchema.optional()
8105
8120
  });
8106
- /** How many rows still carry NO `locationId` — the population a repoint would
8107
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8108
- * value that permits a non-blocking `eventMedia` cutover. */
8109
- var UnstampedEventMediaCountSchema = object({
8110
- media: number().int().nonnegative(),
8111
- retrainFrames: number().int().nonnegative(),
8112
- total: number().int().nonnegative()
8121
+ /**
8122
+ * The unstamped population of ONE collection — split, because the gate and the
8123
+ * operator ask two different questions and only one of them has to be cheap.
8124
+ *
8125
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8126
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8127
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8128
+ * that matters — after a seal, when the population is empty.
8129
+ *
8130
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8131
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8132
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8133
+ * and useful answer: "there are some, and this read could not say how many"
8134
+ * still refuses the cutover, which is the whole job.
8135
+ */
8136
+ var UnstampedRowsSchema = object({
8137
+ present: boolean(),
8138
+ rows: number().int().nonnegative().nullable()
8113
8139
  });
8140
+ /**
8141
+ * How many rows still carry NO `locationId` — the population a repoint would
8142
+ * silently re-aim at a disk that does not hold their bytes.
8143
+ *
8144
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8145
+ * over. The gate opens on a measured absence and on nothing else; an unread
8146
+ * collection and an empty one are different facts, and this repo has already
8147
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8148
+ */
8149
+ var UnstampedEventMediaCountSchema = object({
8150
+ media: UnstampedRowsSchema,
8151
+ retrainFrames: UnstampedRowsSchema,
8152
+ /** True when EITHER collection holds one. The refusal reads this. */
8153
+ anyPresent: boolean(),
8154
+ /** Sum across both, or `null` when either lane could not be counted. */
8155
+ total: number().int().nonnegative().nullable()
8156
+ }).nullable();
8114
8157
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8115
8158
  /** The independently selectable logical storage classes — every class
8116
8159
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8196,13 +8239,53 @@ var StorageMigrationParticipantSchema = _enum([
8196
8239
  "recorder",
8197
8240
  "analytics"
8198
8241
  ]);
8242
+ /**
8243
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8244
+ *
8245
+ * The long half of a non-blocking migration is `draining`, and it is measured
8246
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8247
+ * existed the only place those numbers appeared was a Loki line, so an operator
8248
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8249
+ * afternoon.
8250
+ *
8251
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8252
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8253
+ * mover — which is the exact failure this is meant to end. The coordinator's
8254
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8255
+ * read `state`; folding the counters costs no extra read and makes the durable
8256
+ * record say afterwards how far a move actually got.
8257
+ *
8258
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8259
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8260
+ * cannot say M, and a 0 there would render as "100 % done".
8261
+ */
8262
+ var StorageMigrationMoveProgressSchema = object({
8263
+ filesMoved: number().int().nonnegative(),
8264
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8265
+ filesTotal: number().int().nonnegative().nullable(),
8266
+ bytesMoved: number().int().nonnegative(),
8267
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8268
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8269
+ * rows would be the same failure as one that silently skipped them. */
8270
+ rowsReconciled: number().int().nonnegative().optional(),
8271
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8272
+ * crash gets a new mover, and a rate computed from the migration's start
8273
+ * would silently average in the time nothing was running. */
8274
+ startedAt: number(),
8275
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8276
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8277
+ * subtract its own. */
8278
+ observedAt: number()
8279
+ });
8199
8280
  var StorageMigrationMoveSchema = object({
8200
8281
  storageClass: StorageMigrationClassSchema,
8201
8282
  fromLocationId: string(),
8202
8283
  toLocationId: string(),
8203
8284
  moverJobId: string().nullable(),
8204
8285
  state: RelocateJobStateSchema.nullable(),
8205
- error: string().nullable()
8286
+ error: string().nullable(),
8287
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8288
+ progress: StorageMigrationMoveProgressSchema.nullable()
8206
8289
  });
8207
8290
  var StorageMigrationJobSchema = object({
8208
8291
  jobId: string(),
@@ -8248,6 +8331,98 @@ var StorageMigrationPlanSchema = object({
8248
8331
  findings: array(StorageMigrationFindingSchema)
8249
8332
  });
8250
8333
  /**
8334
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8335
+ *
8336
+ * The coordinator's job record is the state of record for a migration, and its
8337
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8338
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8339
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8340
+ * way because no supported UI path existed. A mover armed like that has no job
8341
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8342
+ *
8343
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8344
+ * orchestrated it.
8345
+ */
8346
+ var StorageMigrationMoverSchema = object({
8347
+ lane: _enum(["footage", "media"]),
8348
+ job: RelocateJobSchema,
8349
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8350
+ * directly against the owning addon. */
8351
+ migrationJobId: string().nullable(),
8352
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8353
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8354
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8355
+ * rate made of two different clocks. */
8356
+ observedAt: number()
8357
+ });
8358
+ /**
8359
+ * What a SOURCE still holds for one storage class — the number that makes a
8360
+ * "drain remaining" action honest rather than hopeful.
8361
+ *
8362
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8363
+ * engine's own selection count for media), never from the resident index: a
8364
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8365
+ * never been told about (D295).
8366
+ *
8367
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8368
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8369
+ * because refusing on an unanswerable read would hide exactly the case an
8370
+ * operator needs to act on.
8371
+ */
8372
+ var StorageMigrationResidueSchema = object({
8373
+ storageClass: StorageMigrationClassSchema,
8374
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8375
+ * move from wherever they are rather than from one named source. */
8376
+ fromLocationId: string(),
8377
+ /** Where a drain would move it — the class's CURRENT default. */
8378
+ toLocationId: string(),
8379
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8380
+ items: number().int().nonnegative().nullable(),
8381
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8382
+ bytes: number().int().nonnegative().nullable()
8383
+ });
8384
+ /**
8385
+ * Run the DRAIN half and nothing else.
8386
+ *
8387
+ * A migration that reached `done` has already repointed, so `start` correctly
8388
+ * refuses its destination ("already the default") — there is nothing left to
8389
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8390
+ * or finish against a work list that was a tenth of the archive (D295), and
8391
+ * before this there was no supported way to run only that half: the only way
8392
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8393
+ *
8394
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8395
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8396
+ * re-repoint a class that is already migrated.
8397
+ */
8398
+ var StorageMigrationDrainInputSchema = object({
8399
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8400
+ * a class whose source is already empty is refused rather than started. */
8401
+ classes: array(StorageMigrationClassSchema).min(1),
8402
+ throttleMbps: number().min(1).max(1e3).optional()
8403
+ });
8404
+ /** What a footage source still holds, asked of the durable hour ledger. */
8405
+ var RelocateResidueInputSchema = object({
8406
+ fromLocationId: string().min(1),
8407
+ /** Narrow to one logical class; omit for every profile on the location. */
8408
+ footageClass: RelocateFootageClassSchema.optional()
8409
+ });
8410
+ /** `null` = the archive could not answer (no ledger on this node, or the
8411
+ * aggregate failed). Never conflated with an empty source. */
8412
+ var RelocateResidueSchema = object({
8413
+ segments: number().int().nonnegative(),
8414
+ bytes: number().int().nonnegative()
8415
+ }).nullable();
8416
+ /** How many rows a media pass would still act on against a given target — the
8417
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8418
+ * never disagree. `null` = the count could not be taken. */
8419
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8420
+ var RelocatableMediaCountInputSchema = object({
8421
+ toLocationId: string().min(1),
8422
+ /** Omitted = `move`. */
8423
+ mode: MediaRelocateModeSchema.optional()
8424
+ });
8425
+ /**
8251
8426
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8252
8427
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8253
8428
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8351,6 +8526,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8351
8526
  * two addons declaring the same `id` must agree on `cardinality` (validated
8352
8527
  * at kernel aggregation time, not here).
8353
8528
  */
8529
+ /**
8530
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8531
+ * actually reaches the bytes. It is the constraint that decides which
8532
+ * `storage-provider`s may back a location of that kind.
8533
+ *
8534
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8535
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8536
+ * post-analysis media roots). Only a provider that serves a genuine local
8537
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8538
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8539
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8540
+ * against a same-named local directory that is something else entirely.
8541
+ *
8542
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8543
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8544
+ * service never sees a path, so any provider can back it. `backups` is the
8545
+ * one kind that qualifies today.
8546
+ *
8547
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8548
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8549
+ * refused the configuration; the first write simply went somewhere wrong, and
8550
+ * a recording write that goes wrong surfaces as a silent black window rather
8551
+ * than an error (the read path does not `stat`). This turns that accident into
8552
+ * a declared, enforced, testable refusal.
8553
+ */
8554
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8354
8555
  var StorageLocationDeclarationSchema = object({
8355
8556
  /**
8356
8557
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8370,6 +8571,19 @@ var StorageLocationDeclarationSchema = object({
8370
8571
  */
8371
8572
  cardinality: _enum(["single", "multi"]),
8372
8573
  /**
8574
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8575
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8576
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8577
+ *
8578
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8579
+ * can only over-restrict (refuse a remote provider for a kind that might
8580
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8581
+ * permissive direction and is therefore never inferred — a repo guard
8582
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8583
+ * reached by omission.
8584
+ */
8585
+ access: StorageAccessSchema.optional(),
8586
+ /**
8373
8587
  * When set, the default instance for this location inherits its resolved
8374
8588
  * root from the named location's default instance. Useful for derivative
8375
8589
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18254,8 +18468,10 @@ var TrackSchema = object({
18254
18468
  lastSeen: number(),
18255
18469
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18256
18470
  positions: array(TrackPositionSchema).readonly(),
18257
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18258
- * saveThumbnails policy). */
18471
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18472
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18473
+ * the retired `saveThumbnails` used to gate this and the rolling
18474
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18259
18475
  snapshots: array(TrackSnapshotSchema).readonly(),
18260
18476
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18261
18477
  zonesVisited: array(string()).readonly(),
@@ -19115,7 +19331,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19115
19331
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19116
19332
  kind: "mutation",
19117
19333
  auth: "admin"
19118
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19334
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19335
+ kind: "query",
19336
+ auth: "admin"
19337
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19119
19338
  kind: "query",
19120
19339
  auth: "admin"
19121
19340
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21178,6 +21397,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21178
21397
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21179
21398
  kind: "mutation",
21180
21399
  auth: "admin"
21400
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21401
+ kind: "mutation",
21402
+ auth: "admin"
21181
21403
  });
21182
21404
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21183
21405
  providerId: string().min(1),
@@ -21576,12 +21798,38 @@ response: record(string(), unknown()) }), object({
21576
21798
  *
21577
21799
  * ## Why this is a capability and not a helper
21578
21800
  *
21579
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21580
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21581
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21582
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21583
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21584
- * load 5,000 rows before ranking anything.
21801
+ * This capability was introduced with the claim that SIX stores in
21802
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21803
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21804
+ * claim was never true, and leaving it here made five stores look like pending
21805
+ * work when three of them have no vector at all. Counted column by column on
21806
+ * 2026-08-30, exactly THREE ever held one:
21807
+ *
21808
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21809
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21810
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21811
+ * face, migrated 2026-08-30 into its OWN index (see below).
21812
+ *
21813
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21814
+ * and `identities` store a name; the event store stores no derivative vector.
21815
+ * They are not migration candidates and never were.
21816
+ *
21817
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21818
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21819
+ * rows before ranking anything.
21820
+ *
21821
+ * ## One index per COMPARISON, never per encoder
21822
+ *
21823
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21824
+ * model, and they still get two indexes. An index is a set of things that are
21825
+ * ranked against each other and that live and die together, and these two are
21826
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21827
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21828
+ * forever and is the gallery every recognition ranks against. One index would
21829
+ * mean every gallery load and every reconcile carried a filter whose failure
21830
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21831
+ * person's only sample. The dimension they share is not a reason to share an
21832
+ * index; the question they answer is, and it differs.
21585
21833
  *
21586
21834
  * The fix is not a faster loop, it is a different backend — and the backend
21587
21835
  * should be replaceable without touching six callers. So: a singleton
@@ -21686,7 +21934,20 @@ var VectorQueryResultSchema = object({
21686
21934
  */
21687
21935
  scanned: number(),
21688
21936
  /** True when the backend could not consider every row that passed the filter. */
21689
- truncated: boolean()
21937
+ truncated: boolean(),
21938
+ /**
21939
+ * The `topK` the backend actually ran with.
21940
+ *
21941
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21942
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21943
+ * own log rather than in its answer. That is how an audit asking for 20,000
21944
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21945
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21946
+ * MUCH, in the return value, where the caller cannot fail to see it.
21947
+ *
21948
+ * Equals the requested `topK` whenever nothing was lowered.
21949
+ */
21950
+ effectiveTopK: number().int().positive()
21690
21951
  });
21691
21952
  var VectorDeleteInputSchema = object({
21692
21953
  index: string(),
@@ -21715,6 +21976,68 @@ var VectorGetResultSchema = object({ items: array(object({
21715
21976
  id: string(),
21716
21977
  metadata: VectorMetadataSchema
21717
21978
  })) });
21979
+ /**
21980
+ * Ids to read back WITH their vectors.
21981
+ *
21982
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21983
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21984
+ * caller depends on that promise. This one promises the opposite.
21985
+ *
21986
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21987
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21988
+ * a per-face cross-process KNN would be a network round trip inside the
21989
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21990
+ * it requires the index to hand the floats back. Without this method the only
21991
+ * way to keep a readable vector is a JSON column, which is the thing this
21992
+ * capability exists to delete.
21993
+ *
21994
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21995
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21996
+ */
21997
+ var VectorFetchInputSchema = object({
21998
+ index: string(),
21999
+ ids: array(string())
22000
+ });
22001
+ var VectorFetchResultSchema = object({ items: array(object({
22002
+ id: string(),
22003
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22004
+ vector: string(),
22005
+ metadata: VectorMetadataSchema
22006
+ })) });
22007
+ /**
22008
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22009
+ *
22010
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22011
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22012
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22013
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22014
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22015
+ * looked" for as long as anyone cared to read it.
22016
+ *
22017
+ * This is the primitive that question actually needs: a bounded page, ordered
22018
+ * by the backend's own row order, costing no distance computation at all.
22019
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22020
+ * the full-table read this capability was built to stop.
22021
+ */
22022
+ var VectorScanInputSchema = object({
22023
+ index: string(),
22024
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22025
+ cursor: number().int().nonnegative().default(0),
22026
+ limit: number().int().positive()
22027
+ });
22028
+ var VectorScanResultSchema = object({
22029
+ items: array(object({
22030
+ id: string(),
22031
+ metadata: VectorMetadataSchema
22032
+ })),
22033
+ /**
22034
+ * Where the next page starts, or `null` when the walk reached the end.
22035
+ *
22036
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22037
+ * from a short page: a backend is free to return fewer rows than asked.
22038
+ */
22039
+ nextCursor: number().int().nonnegative().nullable()
22040
+ });
21718
22041
  var VectorStatsInputSchema = object({ index: string() });
21719
22042
  var VectorStatsResultSchema = object({
21720
22043
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21733,7 +22056,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21733
22056
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21734
22057
  kind: "mutation",
21735
22058
  auth: "admin"
21736
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22059
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21737
22060
  kind: "mutation",
21738
22061
  auth: "admin"
21739
22062
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28360,6 +28683,9 @@ method(object({
28360
28683
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28361
28684
  kind: "query",
28362
28685
  auth: "admin"
28686
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28687
+ kind: "query",
28688
+ auth: "admin"
28363
28689
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28364
28690
  kind: "mutation",
28365
28691
  auth: "admin"
@@ -34994,6 +35320,12 @@ Object.freeze({
34994
35320
  addonId: null,
34995
35321
  access: "create"
34996
35322
  },
35323
+ "pipelineAnalytics.countRelocatableMedia": {
35324
+ capName: "pipeline-analytics",
35325
+ capScope: "device",
35326
+ addonId: null,
35327
+ access: "view"
35328
+ },
34997
35329
  "pipelineAnalytics.countUnstampedEventMedia": {
34998
35330
  capName: "pipeline-analytics",
34999
35331
  capScope: "device",
@@ -36158,6 +36490,12 @@ Object.freeze({
36158
36490
  addonId: null,
36159
36491
  access: "view"
36160
36492
  },
36493
+ "recording.getRelocateResidue": {
36494
+ capName: "recording",
36495
+ capScope: "system",
36496
+ addonId: null,
36497
+ access: "view"
36498
+ },
36161
36499
  "recording.getStorageMigrationMoveStatus": {
36162
36500
  capName: "recording",
36163
36501
  capScope: "system",
@@ -36704,12 +37042,30 @@ Object.freeze({
36704
37042
  addonId: null,
36705
37043
  access: "create"
36706
37044
  },
37045
+ "storageMigration.drain": {
37046
+ capName: "storage-migration",
37047
+ capScope: "system",
37048
+ addonId: null,
37049
+ access: "create"
37050
+ },
37051
+ "storageMigration.movers": {
37052
+ capName: "storage-migration",
37053
+ capScope: "system",
37054
+ addonId: null,
37055
+ access: "view"
37056
+ },
36707
37057
  "storageMigration.plan": {
36708
37058
  capName: "storage-migration",
36709
37059
  capScope: "system",
36710
37060
  addonId: null,
36711
37061
  access: "view"
36712
37062
  },
37063
+ "storageMigration.residue": {
37064
+ capName: "storage-migration",
37065
+ capScope: "system",
37066
+ addonId: null,
37067
+ access: "view"
37068
+ },
36713
37069
  "storageMigration.start": {
36714
37070
  capName: "storage-migration",
36715
37071
  capScope: "system",
@@ -37544,6 +37900,12 @@ Object.freeze({
37544
37900
  addonId: null,
37545
37901
  access: "delete"
37546
37902
  },
37903
+ "vectorStore.fetchByIds": {
37904
+ capName: "vector-store",
37905
+ capScope: "system",
37906
+ addonId: null,
37907
+ access: "view"
37908
+ },
37547
37909
  "vectorStore.getByIds": {
37548
37910
  capName: "vector-store",
37549
37911
  capScope: "system",
@@ -37556,6 +37918,12 @@ Object.freeze({
37556
37918
  addonId: null,
37557
37919
  access: "view"
37558
37920
  },
37921
+ "vectorStore.scan": {
37922
+ capName: "vector-store",
37923
+ capScope: "system",
37924
+ addonId: null,
37925
+ access: "view"
37926
+ },
37559
37927
  "vectorStore.stats": {
37560
37928
  capName: "vector-store",
37561
37929
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8014,6 +8014,21 @@ var RelocateJobSchema = object({
8014
8014
  bytesMoved: number().int(),
8015
8015
  /** Total files discovered up front; null while (or when) unknown. */
8016
8016
  filesTotal: number().int().nullable(),
8017
+ /**
8018
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8019
+ * made that nobody asked for, so it is reported where the operator reads the
8020
+ * job rather than only in a log line.
8021
+ *
8022
+ * A footage segment records its byte count in its own NAME, and the durable
8023
+ * hour row derives its aggregates from those names. A file that does not
8024
+ * match its name therefore makes the ledger's sums — and with them quota and
8025
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8026
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8027
+ *
8028
+ * Absent on lanes where the question has no meaning: a media blob's size is
8029
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8030
+ */
8031
+ rowsReconciled: number().int().nonnegative().optional(),
8017
8032
  startedAt: number(),
8018
8033
  finishedAt: number().nullable(),
8019
8034
  error: string().nullable()
@@ -8082,14 +8097,42 @@ var RelocateMediaInputSchema = object({
8082
8097
  /** Omitted = `move`, the pre-existing behaviour. */
8083
8098
  mode: MediaRelocateModeSchema.optional()
8084
8099
  });
8085
- /** How many rows still carry NO `locationId` — the population a repoint would
8086
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8087
- * value that permits a non-blocking `eventMedia` cutover. */
8088
- var UnstampedEventMediaCountSchema = object({
8089
- media: number().int().nonnegative(),
8090
- retrainFrames: number().int().nonnegative(),
8091
- total: number().int().nonnegative()
8100
+ /**
8101
+ * The unstamped population of ONE collection — split, because the gate and the
8102
+ * operator ask two different questions and only one of them has to be cheap.
8103
+ *
8104
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8105
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8106
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8107
+ * that matters — after a seal, when the population is empty.
8108
+ *
8109
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8110
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8111
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8112
+ * and useful answer: "there are some, and this read could not say how many"
8113
+ * still refuses the cutover, which is the whole job.
8114
+ */
8115
+ var UnstampedRowsSchema = object({
8116
+ present: boolean(),
8117
+ rows: number().int().nonnegative().nullable()
8092
8118
  });
8119
+ /**
8120
+ * How many rows still carry NO `locationId` — the population a repoint would
8121
+ * silently re-aim at a disk that does not hold their bytes.
8122
+ *
8123
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8124
+ * over. The gate opens on a measured absence and on nothing else; an unread
8125
+ * collection and an empty one are different facts, and this repo has already
8126
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8127
+ */
8128
+ var UnstampedEventMediaCountSchema = object({
8129
+ media: UnstampedRowsSchema,
8130
+ retrainFrames: UnstampedRowsSchema,
8131
+ /** True when EITHER collection holds one. The refusal reads this. */
8132
+ anyPresent: boolean(),
8133
+ /** Sum across both, or `null` when either lane could not be counted. */
8134
+ total: number().int().nonnegative().nullable()
8135
+ }).nullable();
8093
8136
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8094
8137
  /** The independently selectable logical storage classes — every class
8095
8138
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8175,13 +8218,53 @@ var StorageMigrationParticipantSchema = _enum([
8175
8218
  "recorder",
8176
8219
  "analytics"
8177
8220
  ]);
8221
+ /**
8222
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8223
+ *
8224
+ * The long half of a non-blocking migration is `draining`, and it is measured
8225
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8226
+ * existed the only place those numbers appeared was a Loki line, so an operator
8227
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8228
+ * afternoon.
8229
+ *
8230
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8231
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8232
+ * mover — which is the exact failure this is meant to end. The coordinator's
8233
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8234
+ * read `state`; folding the counters costs no extra read and makes the durable
8235
+ * record say afterwards how far a move actually got.
8236
+ *
8237
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8238
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8239
+ * cannot say M, and a 0 there would render as "100 % done".
8240
+ */
8241
+ var StorageMigrationMoveProgressSchema = object({
8242
+ filesMoved: number().int().nonnegative(),
8243
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8244
+ filesTotal: number().int().nonnegative().nullable(),
8245
+ bytesMoved: number().int().nonnegative(),
8246
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8247
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8248
+ * rows would be the same failure as one that silently skipped them. */
8249
+ rowsReconciled: number().int().nonnegative().optional(),
8250
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8251
+ * crash gets a new mover, and a rate computed from the migration's start
8252
+ * would silently average in the time nothing was running. */
8253
+ startedAt: number(),
8254
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8255
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8256
+ * subtract its own. */
8257
+ observedAt: number()
8258
+ });
8178
8259
  var StorageMigrationMoveSchema = object({
8179
8260
  storageClass: StorageMigrationClassSchema,
8180
8261
  fromLocationId: string(),
8181
8262
  toLocationId: string(),
8182
8263
  moverJobId: string().nullable(),
8183
8264
  state: RelocateJobStateSchema.nullable(),
8184
- error: string().nullable()
8265
+ error: string().nullable(),
8266
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8267
+ progress: StorageMigrationMoveProgressSchema.nullable()
8185
8268
  });
8186
8269
  var StorageMigrationJobSchema = object({
8187
8270
  jobId: string(),
@@ -8227,6 +8310,98 @@ var StorageMigrationPlanSchema = object({
8227
8310
  findings: array(StorageMigrationFindingSchema)
8228
8311
  });
8229
8312
  /**
8313
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8314
+ *
8315
+ * The coordinator's job record is the state of record for a migration, and its
8316
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8317
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8318
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8319
+ * way because no supported UI path existed. A mover armed like that has no job
8320
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8321
+ *
8322
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8323
+ * orchestrated it.
8324
+ */
8325
+ var StorageMigrationMoverSchema = object({
8326
+ lane: _enum(["footage", "media"]),
8327
+ job: RelocateJobSchema,
8328
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8329
+ * directly against the owning addon. */
8330
+ migrationJobId: string().nullable(),
8331
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8332
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8333
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8334
+ * rate made of two different clocks. */
8335
+ observedAt: number()
8336
+ });
8337
+ /**
8338
+ * What a SOURCE still holds for one storage class — the number that makes a
8339
+ * "drain remaining" action honest rather than hopeful.
8340
+ *
8341
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8342
+ * engine's own selection count for media), never from the resident index: a
8343
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8344
+ * never been told about (D295).
8345
+ *
8346
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8347
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8348
+ * because refusing on an unanswerable read would hide exactly the case an
8349
+ * operator needs to act on.
8350
+ */
8351
+ var StorageMigrationResidueSchema = object({
8352
+ storageClass: StorageMigrationClassSchema,
8353
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8354
+ * move from wherever they are rather than from one named source. */
8355
+ fromLocationId: string(),
8356
+ /** Where a drain would move it — the class's CURRENT default. */
8357
+ toLocationId: string(),
8358
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8359
+ items: number().int().nonnegative().nullable(),
8360
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8361
+ bytes: number().int().nonnegative().nullable()
8362
+ });
8363
+ /**
8364
+ * Run the DRAIN half and nothing else.
8365
+ *
8366
+ * A migration that reached `done` has already repointed, so `start` correctly
8367
+ * refuses its destination ("already the default") — there is nothing left to
8368
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8369
+ * or finish against a work list that was a tenth of the archive (D295), and
8370
+ * before this there was no supported way to run only that half: the only way
8371
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8372
+ *
8373
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8374
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8375
+ * re-repoint a class that is already migrated.
8376
+ */
8377
+ var StorageMigrationDrainInputSchema = object({
8378
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8379
+ * a class whose source is already empty is refused rather than started. */
8380
+ classes: array(StorageMigrationClassSchema).min(1),
8381
+ throttleMbps: number().min(1).max(1e3).optional()
8382
+ });
8383
+ /** What a footage source still holds, asked of the durable hour ledger. */
8384
+ var RelocateResidueInputSchema = object({
8385
+ fromLocationId: string().min(1),
8386
+ /** Narrow to one logical class; omit for every profile on the location. */
8387
+ footageClass: RelocateFootageClassSchema.optional()
8388
+ });
8389
+ /** `null` = the archive could not answer (no ledger on this node, or the
8390
+ * aggregate failed). Never conflated with an empty source. */
8391
+ var RelocateResidueSchema = object({
8392
+ segments: number().int().nonnegative(),
8393
+ bytes: number().int().nonnegative()
8394
+ }).nullable();
8395
+ /** How many rows a media pass would still act on against a given target — the
8396
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8397
+ * never disagree. `null` = the count could not be taken. */
8398
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8399
+ var RelocatableMediaCountInputSchema = object({
8400
+ toLocationId: string().min(1),
8401
+ /** Omitted = `move`. */
8402
+ mode: MediaRelocateModeSchema.optional()
8403
+ });
8404
+ /**
8230
8405
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8231
8406
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8232
8407
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8330,6 +8505,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8330
8505
  * two addons declaring the same `id` must agree on `cardinality` (validated
8331
8506
  * at kernel aggregation time, not here).
8332
8507
  */
8508
+ /**
8509
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8510
+ * actually reaches the bytes. It is the constraint that decides which
8511
+ * `storage-provider`s may back a location of that kind.
8512
+ *
8513
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8514
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8515
+ * post-analysis media roots). Only a provider that serves a genuine local
8516
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8517
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8518
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8519
+ * against a same-named local directory that is something else entirely.
8520
+ *
8521
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8522
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8523
+ * service never sees a path, so any provider can back it. `backups` is the
8524
+ * one kind that qualifies today.
8525
+ *
8526
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8527
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8528
+ * refused the configuration; the first write simply went somewhere wrong, and
8529
+ * a recording write that goes wrong surfaces as a silent black window rather
8530
+ * than an error (the read path does not `stat`). This turns that accident into
8531
+ * a declared, enforced, testable refusal.
8532
+ */
8533
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8333
8534
  var StorageLocationDeclarationSchema = object({
8334
8535
  /**
8335
8536
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8349,6 +8550,19 @@ var StorageLocationDeclarationSchema = object({
8349
8550
  */
8350
8551
  cardinality: _enum(["single", "multi"]),
8351
8552
  /**
8553
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8554
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8555
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8556
+ *
8557
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8558
+ * can only over-restrict (refuse a remote provider for a kind that might
8559
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8560
+ * permissive direction and is therefore never inferred — a repo guard
8561
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8562
+ * reached by omission.
8563
+ */
8564
+ access: StorageAccessSchema.optional(),
8565
+ /**
8352
8566
  * When set, the default instance for this location inherits its resolved
8353
8567
  * root from the named location's default instance. Useful for derivative
8354
8568
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18233,8 +18447,10 @@ var TrackSchema = object({
18233
18447
  lastSeen: number(),
18234
18448
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18235
18449
  positions: array(TrackPositionSchema).readonly(),
18236
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18237
- * saveThumbnails policy). */
18450
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18451
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18452
+ * the retired `saveThumbnails` used to gate this and the rolling
18453
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18238
18454
  snapshots: array(TrackSnapshotSchema).readonly(),
18239
18455
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18240
18456
  zonesVisited: array(string()).readonly(),
@@ -19094,7 +19310,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19094
19310
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19095
19311
  kind: "mutation",
19096
19312
  auth: "admin"
19097
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19313
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19314
+ kind: "query",
19315
+ auth: "admin"
19316
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19098
19317
  kind: "query",
19099
19318
  auth: "admin"
19100
19319
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21157,6 +21376,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21157
21376
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21158
21377
  kind: "mutation",
21159
21378
  auth: "admin"
21379
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21380
+ kind: "mutation",
21381
+ auth: "admin"
21160
21382
  });
21161
21383
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21162
21384
  providerId: string().min(1),
@@ -21555,12 +21777,38 @@ response: record(string(), unknown()) }), object({
21555
21777
  *
21556
21778
  * ## Why this is a capability and not a helper
21557
21779
  *
21558
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21559
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21560
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21561
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21562
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21563
- * load 5,000 rows before ranking anything.
21780
+ * This capability was introduced with the claim that SIX stores in
21781
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21782
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21783
+ * claim was never true, and leaving it here made five stores look like pending
21784
+ * work when three of them have no vector at all. Counted column by column on
21785
+ * 2026-08-30, exactly THREE ever held one:
21786
+ *
21787
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21788
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21789
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21790
+ * face, migrated 2026-08-30 into its OWN index (see below).
21791
+ *
21792
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21793
+ * and `identities` store a name; the event store stores no derivative vector.
21794
+ * They are not migration candidates and never were.
21795
+ *
21796
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21797
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21798
+ * rows before ranking anything.
21799
+ *
21800
+ * ## One index per COMPARISON, never per encoder
21801
+ *
21802
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21803
+ * model, and they still get two indexes. An index is a set of things that are
21804
+ * ranked against each other and that live and die together, and these two are
21805
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21806
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21807
+ * forever and is the gallery every recognition ranks against. One index would
21808
+ * mean every gallery load and every reconcile carried a filter whose failure
21809
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21810
+ * person's only sample. The dimension they share is not a reason to share an
21811
+ * index; the question they answer is, and it differs.
21564
21812
  *
21565
21813
  * The fix is not a faster loop, it is a different backend — and the backend
21566
21814
  * should be replaceable without touching six callers. So: a singleton
@@ -21665,7 +21913,20 @@ var VectorQueryResultSchema = object({
21665
21913
  */
21666
21914
  scanned: number(),
21667
21915
  /** True when the backend could not consider every row that passed the filter. */
21668
- truncated: boolean()
21916
+ truncated: boolean(),
21917
+ /**
21918
+ * The `topK` the backend actually ran with.
21919
+ *
21920
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21921
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21922
+ * own log rather than in its answer. That is how an audit asking for 20,000
21923
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21924
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21925
+ * MUCH, in the return value, where the caller cannot fail to see it.
21926
+ *
21927
+ * Equals the requested `topK` whenever nothing was lowered.
21928
+ */
21929
+ effectiveTopK: number().int().positive()
21669
21930
  });
21670
21931
  var VectorDeleteInputSchema = object({
21671
21932
  index: string(),
@@ -21694,6 +21955,68 @@ var VectorGetResultSchema = object({ items: array(object({
21694
21955
  id: string(),
21695
21956
  metadata: VectorMetadataSchema
21696
21957
  })) });
21958
+ /**
21959
+ * Ids to read back WITH their vectors.
21960
+ *
21961
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21962
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21963
+ * caller depends on that promise. This one promises the opposite.
21964
+ *
21965
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21966
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21967
+ * a per-face cross-process KNN would be a network round trip inside the
21968
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21969
+ * it requires the index to hand the floats back. Without this method the only
21970
+ * way to keep a readable vector is a JSON column, which is the thing this
21971
+ * capability exists to delete.
21972
+ *
21973
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21974
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21975
+ */
21976
+ var VectorFetchInputSchema = object({
21977
+ index: string(),
21978
+ ids: array(string())
21979
+ });
21980
+ var VectorFetchResultSchema = object({ items: array(object({
21981
+ id: string(),
21982
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21983
+ vector: string(),
21984
+ metadata: VectorMetadataSchema
21985
+ })) });
21986
+ /**
21987
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21988
+ *
21989
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21990
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21991
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21992
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21993
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21994
+ * looked" for as long as anyone cared to read it.
21995
+ *
21996
+ * This is the primitive that question actually needs: a bounded page, ordered
21997
+ * by the backend's own row order, costing no distance computation at all.
21998
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21999
+ * the full-table read this capability was built to stop.
22000
+ */
22001
+ var VectorScanInputSchema = object({
22002
+ index: string(),
22003
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22004
+ cursor: number().int().nonnegative().default(0),
22005
+ limit: number().int().positive()
22006
+ });
22007
+ var VectorScanResultSchema = object({
22008
+ items: array(object({
22009
+ id: string(),
22010
+ metadata: VectorMetadataSchema
22011
+ })),
22012
+ /**
22013
+ * Where the next page starts, or `null` when the walk reached the end.
22014
+ *
22015
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22016
+ * from a short page: a backend is free to return fewer rows than asked.
22017
+ */
22018
+ nextCursor: number().int().nonnegative().nullable()
22019
+ });
21697
22020
  var VectorStatsInputSchema = object({ index: string() });
21698
22021
  var VectorStatsResultSchema = object({
21699
22022
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21712,7 +22035,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21712
22035
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21713
22036
  kind: "mutation",
21714
22037
  auth: "admin"
21715
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22038
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21716
22039
  kind: "mutation",
21717
22040
  auth: "admin"
21718
22041
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28339,6 +28662,9 @@ method(object({
28339
28662
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28340
28663
  kind: "query",
28341
28664
  auth: "admin"
28665
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28666
+ kind: "query",
28667
+ auth: "admin"
28342
28668
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28343
28669
  kind: "mutation",
28344
28670
  auth: "admin"
@@ -34973,6 +35299,12 @@ Object.freeze({
34973
35299
  addonId: null,
34974
35300
  access: "create"
34975
35301
  },
35302
+ "pipelineAnalytics.countRelocatableMedia": {
35303
+ capName: "pipeline-analytics",
35304
+ capScope: "device",
35305
+ addonId: null,
35306
+ access: "view"
35307
+ },
34976
35308
  "pipelineAnalytics.countUnstampedEventMedia": {
34977
35309
  capName: "pipeline-analytics",
34978
35310
  capScope: "device",
@@ -36137,6 +36469,12 @@ Object.freeze({
36137
36469
  addonId: null,
36138
36470
  access: "view"
36139
36471
  },
36472
+ "recording.getRelocateResidue": {
36473
+ capName: "recording",
36474
+ capScope: "system",
36475
+ addonId: null,
36476
+ access: "view"
36477
+ },
36140
36478
  "recording.getStorageMigrationMoveStatus": {
36141
36479
  capName: "recording",
36142
36480
  capScope: "system",
@@ -36683,12 +37021,30 @@ Object.freeze({
36683
37021
  addonId: null,
36684
37022
  access: "create"
36685
37023
  },
37024
+ "storageMigration.drain": {
37025
+ capName: "storage-migration",
37026
+ capScope: "system",
37027
+ addonId: null,
37028
+ access: "create"
37029
+ },
37030
+ "storageMigration.movers": {
37031
+ capName: "storage-migration",
37032
+ capScope: "system",
37033
+ addonId: null,
37034
+ access: "view"
37035
+ },
36686
37036
  "storageMigration.plan": {
36687
37037
  capName: "storage-migration",
36688
37038
  capScope: "system",
36689
37039
  addonId: null,
36690
37040
  access: "view"
36691
37041
  },
37042
+ "storageMigration.residue": {
37043
+ capName: "storage-migration",
37044
+ capScope: "system",
37045
+ addonId: null,
37046
+ access: "view"
37047
+ },
36692
37048
  "storageMigration.start": {
36693
37049
  capName: "storage-migration",
36694
37050
  capScope: "system",
@@ -37523,6 +37879,12 @@ Object.freeze({
37523
37879
  addonId: null,
37524
37880
  access: "delete"
37525
37881
  },
37882
+ "vectorStore.fetchByIds": {
37883
+ capName: "vector-store",
37884
+ capScope: "system",
37885
+ addonId: null,
37886
+ access: "view"
37887
+ },
37526
37888
  "vectorStore.getByIds": {
37527
37889
  capName: "vector-store",
37528
37890
  capScope: "system",
@@ -37535,6 +37897,12 @@ Object.freeze({
37535
37897
  addonId: null,
37536
37898
  access: "view"
37537
37899
  },
37900
+ "vectorStore.scan": {
37901
+ capName: "vector-store",
37902
+ capScope: "system",
37903
+ addonId: null,
37904
+ access: "view"
37905
+ },
37538
37906
  "vectorStore.stats": {
37539
37907
  capName: "vector-store",
37540
37908
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-wyze",
3
- "version": "0.2.47",
3
+ "version": "0.2.50",
4
4
  "description": "Wyze camera device-provider addon for CamStack — wraps the @apocaliss92/wyze-bridge-js P2P/DTLS client, feeding the stream-broker via the pull-rfc4571 lazy-publish path (a structural twin of addon-provider-reolink)",
5
5
  "keywords": [
6
6
  "camstack",