@camstack/addon-provider-homeassistant 1.2.56 → 1.2.59

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.
package/dist/addon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_dist = require("./dist-DuEiH0D0.js");
2
+ const require_dist = require("./dist-D_63yMoB.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  let node_zlib = require("node:zlib");
5
5
  //#region src/ha-device-source.ts
package/dist/addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-DQlMgQbg.mjs";
1
+ import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-C6W8WY0m.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { brotliCompressSync, deflateSync, gzipSync } from "node:zlib";
4
4
  //#region src/ha-device-source.ts
@@ -8206,6 +8206,21 @@ var RelocateJobSchema = object({
8206
8206
  bytesMoved: number().int(),
8207
8207
  /** Total files discovered up front; null while (or when) unknown. */
8208
8208
  filesTotal: number().int().nullable(),
8209
+ /**
8210
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8211
+ * made that nobody asked for, so it is reported where the operator reads the
8212
+ * job rather than only in a log line.
8213
+ *
8214
+ * A footage segment records its byte count in its own NAME, and the durable
8215
+ * hour row derives its aggregates from those names. A file that does not
8216
+ * match its name therefore makes the ledger's sums — and with them quota and
8217
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8218
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8219
+ *
8220
+ * Absent on lanes where the question has no meaning: a media blob's size is
8221
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8222
+ */
8223
+ rowsReconciled: number().int().nonnegative().optional(),
8209
8224
  startedAt: number(),
8210
8225
  finishedAt: number().nullable(),
8211
8226
  error: string().nullable()
@@ -8274,14 +8289,42 @@ var RelocateMediaInputSchema = object({
8274
8289
  /** Omitted = `move`, the pre-existing behaviour. */
8275
8290
  mode: MediaRelocateModeSchema.optional()
8276
8291
  });
8277
- /** How many rows still carry NO `locationId` — the population a repoint would
8278
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8279
- * value that permits a non-blocking `eventMedia` cutover. */
8280
- var UnstampedEventMediaCountSchema = object({
8281
- media: number().int().nonnegative(),
8282
- retrainFrames: number().int().nonnegative(),
8283
- total: number().int().nonnegative()
8292
+ /**
8293
+ * The unstamped population of ONE collection split, because the gate and the
8294
+ * operator ask two different questions and only one of them has to be cheap.
8295
+ *
8296
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8297
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8298
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8299
+ * that matters — after a seal, when the population is empty.
8300
+ *
8301
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8302
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8303
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8304
+ * and useful answer: "there are some, and this read could not say how many"
8305
+ * still refuses the cutover, which is the whole job.
8306
+ */
8307
+ var UnstampedRowsSchema = object({
8308
+ present: boolean(),
8309
+ rows: number().int().nonnegative().nullable()
8284
8310
  });
8311
+ /**
8312
+ * How many rows still carry NO `locationId` — the population a repoint would
8313
+ * silently re-aim at a disk that does not hold their bytes.
8314
+ *
8315
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8316
+ * over. The gate opens on a measured absence and on nothing else; an unread
8317
+ * collection and an empty one are different facts, and this repo has already
8318
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8319
+ */
8320
+ var UnstampedEventMediaCountSchema = object({
8321
+ media: UnstampedRowsSchema,
8322
+ retrainFrames: UnstampedRowsSchema,
8323
+ /** True when EITHER collection holds one. The refusal reads this. */
8324
+ anyPresent: boolean(),
8325
+ /** Sum across both, or `null` when either lane could not be counted. */
8326
+ total: number().int().nonnegative().nullable()
8327
+ }).nullable();
8285
8328
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8286
8329
  /** The independently selectable logical storage classes — every class
8287
8330
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8367,13 +8410,53 @@ var StorageMigrationParticipantSchema = _enum([
8367
8410
  "recorder",
8368
8411
  "analytics"
8369
8412
  ]);
8413
+ /**
8414
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8415
+ *
8416
+ * The long half of a non-blocking migration is `draining`, and it is measured
8417
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8418
+ * existed the only place those numbers appeared was a Loki line, so an operator
8419
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8420
+ * afternoon.
8421
+ *
8422
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8423
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8424
+ * mover — which is the exact failure this is meant to end. The coordinator's
8425
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8426
+ * read `state`; folding the counters costs no extra read and makes the durable
8427
+ * record say afterwards how far a move actually got.
8428
+ *
8429
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8430
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8431
+ * cannot say M, and a 0 there would render as "100 % done".
8432
+ */
8433
+ var StorageMigrationMoveProgressSchema = object({
8434
+ filesMoved: number().int().nonnegative(),
8435
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8436
+ filesTotal: number().int().nonnegative().nullable(),
8437
+ bytesMoved: number().int().nonnegative(),
8438
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8439
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8440
+ * rows would be the same failure as one that silently skipped them. */
8441
+ rowsReconciled: number().int().nonnegative().optional(),
8442
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8443
+ * crash gets a new mover, and a rate computed from the migration's start
8444
+ * would silently average in the time nothing was running. */
8445
+ startedAt: number(),
8446
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8447
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8448
+ * subtract its own. */
8449
+ observedAt: number()
8450
+ });
8370
8451
  var StorageMigrationMoveSchema = object({
8371
8452
  storageClass: StorageMigrationClassSchema,
8372
8453
  fromLocationId: string(),
8373
8454
  toLocationId: string(),
8374
8455
  moverJobId: string().nullable(),
8375
8456
  state: RelocateJobStateSchema.nullable(),
8376
- error: string().nullable()
8457
+ error: string().nullable(),
8458
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8459
+ progress: StorageMigrationMoveProgressSchema.nullable()
8377
8460
  });
8378
8461
  var StorageMigrationJobSchema = object({
8379
8462
  jobId: string(),
@@ -8419,6 +8502,98 @@ var StorageMigrationPlanSchema = object({
8419
8502
  findings: array(StorageMigrationFindingSchema)
8420
8503
  });
8421
8504
  /**
8505
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8506
+ *
8507
+ * The coordinator's job record is the state of record for a migration, and its
8508
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8509
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8510
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8511
+ * way because no supported UI path existed. A mover armed like that has no job
8512
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8513
+ *
8514
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8515
+ * orchestrated it.
8516
+ */
8517
+ var StorageMigrationMoverSchema = object({
8518
+ lane: _enum(["footage", "media"]),
8519
+ job: RelocateJobSchema,
8520
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8521
+ * directly against the owning addon. */
8522
+ migrationJobId: string().nullable(),
8523
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8524
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8525
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8526
+ * rate made of two different clocks. */
8527
+ observedAt: number()
8528
+ });
8529
+ /**
8530
+ * What a SOURCE still holds for one storage class — the number that makes a
8531
+ * "drain remaining" action honest rather than hopeful.
8532
+ *
8533
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8534
+ * engine's own selection count for media), never from the resident index: a
8535
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8536
+ * never been told about (D295).
8537
+ *
8538
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8539
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8540
+ * because refusing on an unanswerable read would hide exactly the case an
8541
+ * operator needs to act on.
8542
+ */
8543
+ var StorageMigrationResidueSchema = object({
8544
+ storageClass: StorageMigrationClassSchema,
8545
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8546
+ * move from wherever they are rather than from one named source. */
8547
+ fromLocationId: string(),
8548
+ /** Where a drain would move it — the class's CURRENT default. */
8549
+ toLocationId: string(),
8550
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8551
+ items: number().int().nonnegative().nullable(),
8552
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8553
+ bytes: number().int().nonnegative().nullable()
8554
+ });
8555
+ /**
8556
+ * Run the DRAIN half and nothing else.
8557
+ *
8558
+ * A migration that reached `done` has already repointed, so `start` correctly
8559
+ * refuses its destination ("already the default") — there is nothing left to
8560
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8561
+ * or finish against a work list that was a tenth of the archive (D295), and
8562
+ * before this there was no supported way to run only that half: the only way
8563
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8564
+ *
8565
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8566
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8567
+ * re-repoint a class that is already migrated.
8568
+ */
8569
+ var StorageMigrationDrainInputSchema = object({
8570
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8571
+ * a class whose source is already empty is refused rather than started. */
8572
+ classes: array(StorageMigrationClassSchema).min(1),
8573
+ throttleMbps: number().min(1).max(1e3).optional()
8574
+ });
8575
+ /** What a footage source still holds, asked of the durable hour ledger. */
8576
+ var RelocateResidueInputSchema = object({
8577
+ fromLocationId: string().min(1),
8578
+ /** Narrow to one logical class; omit for every profile on the location. */
8579
+ footageClass: RelocateFootageClassSchema.optional()
8580
+ });
8581
+ /** `null` = the archive could not answer (no ledger on this node, or the
8582
+ * aggregate failed). Never conflated with an empty source. */
8583
+ var RelocateResidueSchema = object({
8584
+ segments: number().int().nonnegative(),
8585
+ bytes: number().int().nonnegative()
8586
+ }).nullable();
8587
+ /** How many rows a media pass would still act on against a given target — the
8588
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8589
+ * never disagree. `null` = the count could not be taken. */
8590
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8591
+ var RelocatableMediaCountInputSchema = object({
8592
+ toLocationId: string().min(1),
8593
+ /** Omitted = `move`. */
8594
+ mode: MediaRelocateModeSchema.optional()
8595
+ });
8596
+ /**
8422
8597
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8423
8598
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8424
8599
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8522,6 +8697,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8522
8697
  * two addons declaring the same `id` must agree on `cardinality` (validated
8523
8698
  * at kernel aggregation time, not here).
8524
8699
  */
8700
+ /**
8701
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8702
+ * actually reaches the bytes. It is the constraint that decides which
8703
+ * `storage-provider`s may back a location of that kind.
8704
+ *
8705
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8706
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8707
+ * post-analysis media roots). Only a provider that serves a genuine local
8708
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8709
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8710
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8711
+ * against a same-named local directory that is something else entirely.
8712
+ *
8713
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8714
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8715
+ * service never sees a path, so any provider can back it. `backups` is the
8716
+ * one kind that qualifies today.
8717
+ *
8718
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8719
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8720
+ * refused the configuration; the first write simply went somewhere wrong, and
8721
+ * a recording write that goes wrong surfaces as a silent black window rather
8722
+ * than an error (the read path does not `stat`). This turns that accident into
8723
+ * a declared, enforced, testable refusal.
8724
+ */
8725
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8525
8726
  var StorageLocationDeclarationSchema = object({
8526
8727
  /**
8527
8728
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8541,6 +8742,19 @@ var StorageLocationDeclarationSchema = object({
8541
8742
  */
8542
8743
  cardinality: _enum(["single", "multi"]),
8543
8744
  /**
8745
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8746
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8747
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8748
+ *
8749
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8750
+ * can only over-restrict (refuse a remote provider for a kind that might
8751
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8752
+ * permissive direction and is therefore never inferred — a repo guard
8753
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8754
+ * reached by omission.
8755
+ */
8756
+ access: StorageAccessSchema.optional(),
8757
+ /**
8544
8758
  * When set, the default instance for this location inherits its resolved
8545
8759
  * root from the named location's default instance. Useful for derivative
8546
8760
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18593,8 +18807,10 @@ var TrackSchema = object({
18593
18807
  lastSeen: number(),
18594
18808
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18595
18809
  positions: array(TrackPositionSchema).readonly(),
18596
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18597
- * saveThumbnails policy). */
18810
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18811
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18812
+ * the retired `saveThumbnails` used to gate this and the rolling
18813
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18598
18814
  snapshots: array(TrackSnapshotSchema).readonly(),
18599
18815
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18600
18816
  zonesVisited: array(string()).readonly(),
@@ -19454,7 +19670,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19454
19670
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19455
19671
  kind: "mutation",
19456
19672
  auth: "admin"
19457
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19673
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19674
+ kind: "query",
19675
+ auth: "admin"
19676
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19458
19677
  kind: "query",
19459
19678
  auth: "admin"
19460
19679
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21413,6 +21632,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21413
21632
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21414
21633
  kind: "mutation",
21415
21634
  auth: "admin"
21635
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21636
+ kind: "mutation",
21637
+ auth: "admin"
21416
21638
  });
21417
21639
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21418
21640
  providerId: string().min(1),
@@ -21811,12 +22033,38 @@ response: record(string(), unknown()) }), object({
21811
22033
  *
21812
22034
  * ## Why this is a capability and not a helper
21813
22035
  *
21814
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21815
- * plate, vehicle, identity, and the event store's derivativesand every one of
21816
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21817
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21818
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21819
- * load 5,000 rows before ranking anything.
22036
+ * This capability was introduced with the claim that SIX stores in
22037
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
22038
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
22039
+ * claim was never true, and leaving it here made five stores look like pending
22040
+ * work when three of them have no vector at all. Counted column by column on
22041
+ * 2026-08-30, exactly THREE ever held one:
22042
+ *
22043
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
22044
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
22045
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
22046
+ * face, migrated 2026-08-30 into its OWN index (see below).
22047
+ *
22048
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
22049
+ * and `identities` store a name; the event store stores no derivative vector.
22050
+ * They are not migration candidates and never were.
22051
+ *
22052
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
22053
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
22054
+ * rows before ranking anything.
22055
+ *
22056
+ * ## One index per COMPARISON, never per encoder
22057
+ *
22058
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
22059
+ * model, and they still get two indexes. An index is a set of things that are
22060
+ * ranked against each other and that live and die together, and these two are
22061
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
22062
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
22063
+ * forever and is the gallery every recognition ranks against. One index would
22064
+ * mean every gallery load and every reconcile carried a filter whose failure
22065
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
22066
+ * person's only sample. The dimension they share is not a reason to share an
22067
+ * index; the question they answer is, and it differs.
21820
22068
  *
21821
22069
  * The fix is not a faster loop, it is a different backend — and the backend
21822
22070
  * should be replaceable without touching six callers. So: a singleton
@@ -21921,7 +22169,20 @@ var VectorQueryResultSchema = object({
21921
22169
  */
21922
22170
  scanned: number(),
21923
22171
  /** True when the backend could not consider every row that passed the filter. */
21924
- truncated: boolean()
22172
+ truncated: boolean(),
22173
+ /**
22174
+ * The `topK` the backend actually ran with.
22175
+ *
22176
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
22177
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
22178
+ * own log rather than in its answer. That is how an audit asking for 20,000
22179
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
22180
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
22181
+ * MUCH, in the return value, where the caller cannot fail to see it.
22182
+ *
22183
+ * Equals the requested `topK` whenever nothing was lowered.
22184
+ */
22185
+ effectiveTopK: number().int().positive()
21925
22186
  });
21926
22187
  var VectorDeleteInputSchema = object({
21927
22188
  index: string(),
@@ -21950,6 +22211,68 @@ var VectorGetResultSchema = object({ items: array(object({
21950
22211
  id: string(),
21951
22212
  metadata: VectorMetadataSchema
21952
22213
  })) });
22214
+ /**
22215
+ * Ids to read back WITH their vectors.
22216
+ *
22217
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22218
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22219
+ * caller depends on that promise. This one promises the opposite.
22220
+ *
22221
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22222
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22223
+ * a per-face cross-process KNN would be a network round trip inside the
22224
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22225
+ * it requires the index to hand the floats back. Without this method the only
22226
+ * way to keep a readable vector is a JSON column, which is the thing this
22227
+ * capability exists to delete.
22228
+ *
22229
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22230
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22231
+ */
22232
+ var VectorFetchInputSchema = object({
22233
+ index: string(),
22234
+ ids: array(string())
22235
+ });
22236
+ var VectorFetchResultSchema = object({ items: array(object({
22237
+ id: string(),
22238
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22239
+ vector: string(),
22240
+ metadata: VectorMetadataSchema
22241
+ })) });
22242
+ /**
22243
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22244
+ *
22245
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22246
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22247
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22248
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22249
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22250
+ * looked" for as long as anyone cared to read it.
22251
+ *
22252
+ * This is the primitive that question actually needs: a bounded page, ordered
22253
+ * by the backend's own row order, costing no distance computation at all.
22254
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22255
+ * the full-table read this capability was built to stop.
22256
+ */
22257
+ var VectorScanInputSchema = object({
22258
+ index: string(),
22259
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22260
+ cursor: number().int().nonnegative().default(0),
22261
+ limit: number().int().positive()
22262
+ });
22263
+ var VectorScanResultSchema = object({
22264
+ items: array(object({
22265
+ id: string(),
22266
+ metadata: VectorMetadataSchema
22267
+ })),
22268
+ /**
22269
+ * Where the next page starts, or `null` when the walk reached the end.
22270
+ *
22271
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22272
+ * from a short page: a backend is free to return fewer rows than asked.
22273
+ */
22274
+ nextCursor: number().int().nonnegative().nullable()
22275
+ });
21953
22276
  var VectorStatsInputSchema = object({ index: string() });
21954
22277
  var VectorStatsResultSchema = object({
21955
22278
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21968,7 +22291,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21968
22291
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21969
22292
  kind: "mutation",
21970
22293
  auth: "admin"
21971
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22294
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21972
22295
  kind: "mutation",
21973
22296
  auth: "admin"
21974
22297
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28676,6 +28999,9 @@ method(object({
28676
28999
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28677
29000
  kind: "query",
28678
29001
  auth: "admin"
29002
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
29003
+ kind: "query",
29004
+ auth: "admin"
28679
29005
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28680
29006
  kind: "mutation",
28681
29007
  auth: "admin"
@@ -35310,6 +35636,12 @@ Object.freeze({
35310
35636
  addonId: null,
35311
35637
  access: "create"
35312
35638
  },
35639
+ "pipelineAnalytics.countRelocatableMedia": {
35640
+ capName: "pipeline-analytics",
35641
+ capScope: "device",
35642
+ addonId: null,
35643
+ access: "view"
35644
+ },
35313
35645
  "pipelineAnalytics.countUnstampedEventMedia": {
35314
35646
  capName: "pipeline-analytics",
35315
35647
  capScope: "device",
@@ -36474,6 +36806,12 @@ Object.freeze({
36474
36806
  addonId: null,
36475
36807
  access: "view"
36476
36808
  },
36809
+ "recording.getRelocateResidue": {
36810
+ capName: "recording",
36811
+ capScope: "system",
36812
+ addonId: null,
36813
+ access: "view"
36814
+ },
36477
36815
  "recording.getStorageMigrationMoveStatus": {
36478
36816
  capName: "recording",
36479
36817
  capScope: "system",
@@ -37020,12 +37358,30 @@ Object.freeze({
37020
37358
  addonId: null,
37021
37359
  access: "create"
37022
37360
  },
37361
+ "storageMigration.drain": {
37362
+ capName: "storage-migration",
37363
+ capScope: "system",
37364
+ addonId: null,
37365
+ access: "create"
37366
+ },
37367
+ "storageMigration.movers": {
37368
+ capName: "storage-migration",
37369
+ capScope: "system",
37370
+ addonId: null,
37371
+ access: "view"
37372
+ },
37023
37373
  "storageMigration.plan": {
37024
37374
  capName: "storage-migration",
37025
37375
  capScope: "system",
37026
37376
  addonId: null,
37027
37377
  access: "view"
37028
37378
  },
37379
+ "storageMigration.residue": {
37380
+ capName: "storage-migration",
37381
+ capScope: "system",
37382
+ addonId: null,
37383
+ access: "view"
37384
+ },
37029
37385
  "storageMigration.start": {
37030
37386
  capName: "storage-migration",
37031
37387
  capScope: "system",
@@ -37860,6 +38216,12 @@ Object.freeze({
37860
38216
  addonId: null,
37861
38217
  access: "delete"
37862
38218
  },
38219
+ "vectorStore.fetchByIds": {
38220
+ capName: "vector-store",
38221
+ capScope: "system",
38222
+ addonId: null,
38223
+ access: "view"
38224
+ },
37863
38225
  "vectorStore.getByIds": {
37864
38226
  capName: "vector-store",
37865
38227
  capScope: "system",
@@ -37872,6 +38234,12 @@ Object.freeze({
37872
38234
  addonId: null,
37873
38235
  access: "view"
37874
38236
  },
38237
+ "vectorStore.scan": {
38238
+ capName: "vector-store",
38239
+ capScope: "system",
38240
+ addonId: null,
38241
+ access: "view"
38242
+ },
37875
38243
  "vectorStore.stats": {
37876
38244
  capName: "vector-store",
37877
38245
  capScope: "system",
@@ -8206,6 +8206,21 @@ var RelocateJobSchema = object({
8206
8206
  bytesMoved: number().int(),
8207
8207
  /** Total files discovered up front; null while (or when) unknown. */
8208
8208
  filesTotal: number().int().nullable(),
8209
+ /**
8210
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8211
+ * made that nobody asked for, so it is reported where the operator reads the
8212
+ * job rather than only in a log line.
8213
+ *
8214
+ * A footage segment records its byte count in its own NAME, and the durable
8215
+ * hour row derives its aggregates from those names. A file that does not
8216
+ * match its name therefore makes the ledger's sums — and with them quota and
8217
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8218
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8219
+ *
8220
+ * Absent on lanes where the question has no meaning: a media blob's size is
8221
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8222
+ */
8223
+ rowsReconciled: number().int().nonnegative().optional(),
8209
8224
  startedAt: number(),
8210
8225
  finishedAt: number().nullable(),
8211
8226
  error: string().nullable()
@@ -8274,14 +8289,42 @@ var RelocateMediaInputSchema = object({
8274
8289
  /** Omitted = `move`, the pre-existing behaviour. */
8275
8290
  mode: MediaRelocateModeSchema.optional()
8276
8291
  });
8277
- /** How many rows still carry NO `locationId` — the population a repoint would
8278
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8279
- * value that permits a non-blocking `eventMedia` cutover. */
8280
- var UnstampedEventMediaCountSchema = object({
8281
- media: number().int().nonnegative(),
8282
- retrainFrames: number().int().nonnegative(),
8283
- total: number().int().nonnegative()
8292
+ /**
8293
+ * The unstamped population of ONE collection split, because the gate and the
8294
+ * operator ask two different questions and only one of them has to be cheap.
8295
+ *
8296
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8297
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8298
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8299
+ * that matters — after a seal, when the population is empty.
8300
+ *
8301
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8302
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8303
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8304
+ * and useful answer: "there are some, and this read could not say how many"
8305
+ * still refuses the cutover, which is the whole job.
8306
+ */
8307
+ var UnstampedRowsSchema = object({
8308
+ present: boolean(),
8309
+ rows: number().int().nonnegative().nullable()
8284
8310
  });
8311
+ /**
8312
+ * How many rows still carry NO `locationId` — the population a repoint would
8313
+ * silently re-aim at a disk that does not hold their bytes.
8314
+ *
8315
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8316
+ * over. The gate opens on a measured absence and on nothing else; an unread
8317
+ * collection and an empty one are different facts, and this repo has already
8318
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8319
+ */
8320
+ var UnstampedEventMediaCountSchema = object({
8321
+ media: UnstampedRowsSchema,
8322
+ retrainFrames: UnstampedRowsSchema,
8323
+ /** True when EITHER collection holds one. The refusal reads this. */
8324
+ anyPresent: boolean(),
8325
+ /** Sum across both, or `null` when either lane could not be counted. */
8326
+ total: number().int().nonnegative().nullable()
8327
+ }).nullable();
8285
8328
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8286
8329
  /** The independently selectable logical storage classes — every class
8287
8330
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8367,13 +8410,53 @@ var StorageMigrationParticipantSchema = _enum([
8367
8410
  "recorder",
8368
8411
  "analytics"
8369
8412
  ]);
8413
+ /**
8414
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8415
+ *
8416
+ * The long half of a non-blocking migration is `draining`, and it is measured
8417
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8418
+ * existed the only place those numbers appeared was a Loki line, so an operator
8419
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8420
+ * afternoon.
8421
+ *
8422
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8423
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8424
+ * mover — which is the exact failure this is meant to end. The coordinator's
8425
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8426
+ * read `state`; folding the counters costs no extra read and makes the durable
8427
+ * record say afterwards how far a move actually got.
8428
+ *
8429
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8430
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8431
+ * cannot say M, and a 0 there would render as "100 % done".
8432
+ */
8433
+ var StorageMigrationMoveProgressSchema = object({
8434
+ filesMoved: number().int().nonnegative(),
8435
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8436
+ filesTotal: number().int().nonnegative().nullable(),
8437
+ bytesMoved: number().int().nonnegative(),
8438
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8439
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8440
+ * rows would be the same failure as one that silently skipped them. */
8441
+ rowsReconciled: number().int().nonnegative().optional(),
8442
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8443
+ * crash gets a new mover, and a rate computed from the migration's start
8444
+ * would silently average in the time nothing was running. */
8445
+ startedAt: number(),
8446
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8447
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8448
+ * subtract its own. */
8449
+ observedAt: number()
8450
+ });
8370
8451
  var StorageMigrationMoveSchema = object({
8371
8452
  storageClass: StorageMigrationClassSchema,
8372
8453
  fromLocationId: string(),
8373
8454
  toLocationId: string(),
8374
8455
  moverJobId: string().nullable(),
8375
8456
  state: RelocateJobStateSchema.nullable(),
8376
- error: string().nullable()
8457
+ error: string().nullable(),
8458
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8459
+ progress: StorageMigrationMoveProgressSchema.nullable()
8377
8460
  });
8378
8461
  var StorageMigrationJobSchema = object({
8379
8462
  jobId: string(),
@@ -8419,6 +8502,98 @@ var StorageMigrationPlanSchema = object({
8419
8502
  findings: array(StorageMigrationFindingSchema)
8420
8503
  });
8421
8504
  /**
8505
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8506
+ *
8507
+ * The coordinator's job record is the state of record for a migration, and its
8508
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8509
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8510
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8511
+ * way because no supported UI path existed. A mover armed like that has no job
8512
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8513
+ *
8514
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8515
+ * orchestrated it.
8516
+ */
8517
+ var StorageMigrationMoverSchema = object({
8518
+ lane: _enum(["footage", "media"]),
8519
+ job: RelocateJobSchema,
8520
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8521
+ * directly against the owning addon. */
8522
+ migrationJobId: string().nullable(),
8523
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8524
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8525
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8526
+ * rate made of two different clocks. */
8527
+ observedAt: number()
8528
+ });
8529
+ /**
8530
+ * What a SOURCE still holds for one storage class — the number that makes a
8531
+ * "drain remaining" action honest rather than hopeful.
8532
+ *
8533
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8534
+ * engine's own selection count for media), never from the resident index: a
8535
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8536
+ * never been told about (D295).
8537
+ *
8538
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8539
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8540
+ * because refusing on an unanswerable read would hide exactly the case an
8541
+ * operator needs to act on.
8542
+ */
8543
+ var StorageMigrationResidueSchema = object({
8544
+ storageClass: StorageMigrationClassSchema,
8545
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8546
+ * move from wherever they are rather than from one named source. */
8547
+ fromLocationId: string(),
8548
+ /** Where a drain would move it — the class's CURRENT default. */
8549
+ toLocationId: string(),
8550
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8551
+ items: number().int().nonnegative().nullable(),
8552
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8553
+ bytes: number().int().nonnegative().nullable()
8554
+ });
8555
+ /**
8556
+ * Run the DRAIN half and nothing else.
8557
+ *
8558
+ * A migration that reached `done` has already repointed, so `start` correctly
8559
+ * refuses its destination ("already the default") — there is nothing left to
8560
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8561
+ * or finish against a work list that was a tenth of the archive (D295), and
8562
+ * before this there was no supported way to run only that half: the only way
8563
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8564
+ *
8565
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8566
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8567
+ * re-repoint a class that is already migrated.
8568
+ */
8569
+ var StorageMigrationDrainInputSchema = object({
8570
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8571
+ * a class whose source is already empty is refused rather than started. */
8572
+ classes: array(StorageMigrationClassSchema).min(1),
8573
+ throttleMbps: number().min(1).max(1e3).optional()
8574
+ });
8575
+ /** What a footage source still holds, asked of the durable hour ledger. */
8576
+ var RelocateResidueInputSchema = object({
8577
+ fromLocationId: string().min(1),
8578
+ /** Narrow to one logical class; omit for every profile on the location. */
8579
+ footageClass: RelocateFootageClassSchema.optional()
8580
+ });
8581
+ /** `null` = the archive could not answer (no ledger on this node, or the
8582
+ * aggregate failed). Never conflated with an empty source. */
8583
+ var RelocateResidueSchema = object({
8584
+ segments: number().int().nonnegative(),
8585
+ bytes: number().int().nonnegative()
8586
+ }).nullable();
8587
+ /** How many rows a media pass would still act on against a given target — the
8588
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8589
+ * never disagree. `null` = the count could not be taken. */
8590
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8591
+ var RelocatableMediaCountInputSchema = object({
8592
+ toLocationId: string().min(1),
8593
+ /** Omitted = `move`. */
8594
+ mode: MediaRelocateModeSchema.optional()
8595
+ });
8596
+ /**
8422
8597
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8423
8598
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8424
8599
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8522,6 +8697,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8522
8697
  * two addons declaring the same `id` must agree on `cardinality` (validated
8523
8698
  * at kernel aggregation time, not here).
8524
8699
  */
8700
+ /**
8701
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8702
+ * actually reaches the bytes. It is the constraint that decides which
8703
+ * `storage-provider`s may back a location of that kind.
8704
+ *
8705
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8706
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8707
+ * post-analysis media roots). Only a provider that serves a genuine local
8708
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8709
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8710
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8711
+ * against a same-named local directory that is something else entirely.
8712
+ *
8713
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8714
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8715
+ * service never sees a path, so any provider can back it. `backups` is the
8716
+ * one kind that qualifies today.
8717
+ *
8718
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8719
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8720
+ * refused the configuration; the first write simply went somewhere wrong, and
8721
+ * a recording write that goes wrong surfaces as a silent black window rather
8722
+ * than an error (the read path does not `stat`). This turns that accident into
8723
+ * a declared, enforced, testable refusal.
8724
+ */
8725
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8525
8726
  var StorageLocationDeclarationSchema = object({
8526
8727
  /**
8527
8728
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8541,6 +8742,19 @@ var StorageLocationDeclarationSchema = object({
8541
8742
  */
8542
8743
  cardinality: _enum(["single", "multi"]),
8543
8744
  /**
8745
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8746
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8747
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8748
+ *
8749
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8750
+ * can only over-restrict (refuse a remote provider for a kind that might
8751
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8752
+ * permissive direction and is therefore never inferred — a repo guard
8753
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8754
+ * reached by omission.
8755
+ */
8756
+ access: StorageAccessSchema.optional(),
8757
+ /**
8544
8758
  * When set, the default instance for this location inherits its resolved
8545
8759
  * root from the named location's default instance. Useful for derivative
8546
8760
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18593,8 +18807,10 @@ var TrackSchema = object({
18593
18807
  lastSeen: number(),
18594
18808
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18595
18809
  positions: array(TrackPositionSchema).readonly(),
18596
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18597
- * saveThumbnails policy). */
18810
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18811
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18812
+ * the retired `saveThumbnails` used to gate this and the rolling
18813
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18598
18814
  snapshots: array(TrackSnapshotSchema).readonly(),
18599
18815
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18600
18816
  zonesVisited: array(string()).readonly(),
@@ -19454,7 +19670,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19454
19670
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19455
19671
  kind: "mutation",
19456
19672
  auth: "admin"
19457
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19673
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19674
+ kind: "query",
19675
+ auth: "admin"
19676
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19458
19677
  kind: "query",
19459
19678
  auth: "admin"
19460
19679
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21413,6 +21632,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21413
21632
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21414
21633
  kind: "mutation",
21415
21634
  auth: "admin"
21635
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21636
+ kind: "mutation",
21637
+ auth: "admin"
21416
21638
  });
21417
21639
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21418
21640
  providerId: string().min(1),
@@ -21811,12 +22033,38 @@ response: record(string(), unknown()) }), object({
21811
22033
  *
21812
22034
  * ## Why this is a capability and not a helper
21813
22035
  *
21814
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21815
- * plate, vehicle, identity, and the event store's derivativesand every one of
21816
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21817
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21818
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21819
- * load 5,000 rows before ranking anything.
22036
+ * This capability was introduced with the claim that SIX stores in
22037
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
22038
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
22039
+ * claim was never true, and leaving it here made five stores look like pending
22040
+ * work when three of them have no vector at all. Counted column by column on
22041
+ * 2026-08-30, exactly THREE ever held one:
22042
+ *
22043
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
22044
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
22045
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
22046
+ * face, migrated 2026-08-30 into its OWN index (see below).
22047
+ *
22048
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
22049
+ * and `identities` store a name; the event store stores no derivative vector.
22050
+ * They are not migration candidates and never were.
22051
+ *
22052
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
22053
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
22054
+ * rows before ranking anything.
22055
+ *
22056
+ * ## One index per COMPARISON, never per encoder
22057
+ *
22058
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
22059
+ * model, and they still get two indexes. An index is a set of things that are
22060
+ * ranked against each other and that live and die together, and these two are
22061
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
22062
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
22063
+ * forever and is the gallery every recognition ranks against. One index would
22064
+ * mean every gallery load and every reconcile carried a filter whose failure
22065
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
22066
+ * person's only sample. The dimension they share is not a reason to share an
22067
+ * index; the question they answer is, and it differs.
21820
22068
  *
21821
22069
  * The fix is not a faster loop, it is a different backend — and the backend
21822
22070
  * should be replaceable without touching six callers. So: a singleton
@@ -21921,7 +22169,20 @@ var VectorQueryResultSchema = object({
21921
22169
  */
21922
22170
  scanned: number(),
21923
22171
  /** True when the backend could not consider every row that passed the filter. */
21924
- truncated: boolean()
22172
+ truncated: boolean(),
22173
+ /**
22174
+ * The `topK` the backend actually ran with.
22175
+ *
22176
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
22177
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
22178
+ * own log rather than in its answer. That is how an audit asking for 20,000
22179
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
22180
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
22181
+ * MUCH, in the return value, where the caller cannot fail to see it.
22182
+ *
22183
+ * Equals the requested `topK` whenever nothing was lowered.
22184
+ */
22185
+ effectiveTopK: number().int().positive()
21925
22186
  });
21926
22187
  var VectorDeleteInputSchema = object({
21927
22188
  index: string(),
@@ -21950,6 +22211,68 @@ var VectorGetResultSchema = object({ items: array(object({
21950
22211
  id: string(),
21951
22212
  metadata: VectorMetadataSchema
21952
22213
  })) });
22214
+ /**
22215
+ * Ids to read back WITH their vectors.
22216
+ *
22217
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22218
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22219
+ * caller depends on that promise. This one promises the opposite.
22220
+ *
22221
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22222
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22223
+ * a per-face cross-process KNN would be a network round trip inside the
22224
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22225
+ * it requires the index to hand the floats back. Without this method the only
22226
+ * way to keep a readable vector is a JSON column, which is the thing this
22227
+ * capability exists to delete.
22228
+ *
22229
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22230
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22231
+ */
22232
+ var VectorFetchInputSchema = object({
22233
+ index: string(),
22234
+ ids: array(string())
22235
+ });
22236
+ var VectorFetchResultSchema = object({ items: array(object({
22237
+ id: string(),
22238
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22239
+ vector: string(),
22240
+ metadata: VectorMetadataSchema
22241
+ })) });
22242
+ /**
22243
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22244
+ *
22245
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22246
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22247
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22248
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22249
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22250
+ * looked" for as long as anyone cared to read it.
22251
+ *
22252
+ * This is the primitive that question actually needs: a bounded page, ordered
22253
+ * by the backend's own row order, costing no distance computation at all.
22254
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22255
+ * the full-table read this capability was built to stop.
22256
+ */
22257
+ var VectorScanInputSchema = object({
22258
+ index: string(),
22259
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22260
+ cursor: number().int().nonnegative().default(0),
22261
+ limit: number().int().positive()
22262
+ });
22263
+ var VectorScanResultSchema = object({
22264
+ items: array(object({
22265
+ id: string(),
22266
+ metadata: VectorMetadataSchema
22267
+ })),
22268
+ /**
22269
+ * Where the next page starts, or `null` when the walk reached the end.
22270
+ *
22271
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22272
+ * from a short page: a backend is free to return fewer rows than asked.
22273
+ */
22274
+ nextCursor: number().int().nonnegative().nullable()
22275
+ });
21953
22276
  var VectorStatsInputSchema = object({ index: string() });
21954
22277
  var VectorStatsResultSchema = object({
21955
22278
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21968,7 +22291,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21968
22291
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21969
22292
  kind: "mutation",
21970
22293
  auth: "admin"
21971
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22294
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21972
22295
  kind: "mutation",
21973
22296
  auth: "admin"
21974
22297
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28676,6 +28999,9 @@ method(object({
28676
28999
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28677
29000
  kind: "query",
28678
29001
  auth: "admin"
29002
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
29003
+ kind: "query",
29004
+ auth: "admin"
28679
29005
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28680
29006
  kind: "mutation",
28681
29007
  auth: "admin"
@@ -35310,6 +35636,12 @@ Object.freeze({
35310
35636
  addonId: null,
35311
35637
  access: "create"
35312
35638
  },
35639
+ "pipelineAnalytics.countRelocatableMedia": {
35640
+ capName: "pipeline-analytics",
35641
+ capScope: "device",
35642
+ addonId: null,
35643
+ access: "view"
35644
+ },
35313
35645
  "pipelineAnalytics.countUnstampedEventMedia": {
35314
35646
  capName: "pipeline-analytics",
35315
35647
  capScope: "device",
@@ -36474,6 +36806,12 @@ Object.freeze({
36474
36806
  addonId: null,
36475
36807
  access: "view"
36476
36808
  },
36809
+ "recording.getRelocateResidue": {
36810
+ capName: "recording",
36811
+ capScope: "system",
36812
+ addonId: null,
36813
+ access: "view"
36814
+ },
36477
36815
  "recording.getStorageMigrationMoveStatus": {
36478
36816
  capName: "recording",
36479
36817
  capScope: "system",
@@ -37020,12 +37358,30 @@ Object.freeze({
37020
37358
  addonId: null,
37021
37359
  access: "create"
37022
37360
  },
37361
+ "storageMigration.drain": {
37362
+ capName: "storage-migration",
37363
+ capScope: "system",
37364
+ addonId: null,
37365
+ access: "create"
37366
+ },
37367
+ "storageMigration.movers": {
37368
+ capName: "storage-migration",
37369
+ capScope: "system",
37370
+ addonId: null,
37371
+ access: "view"
37372
+ },
37023
37373
  "storageMigration.plan": {
37024
37374
  capName: "storage-migration",
37025
37375
  capScope: "system",
37026
37376
  addonId: null,
37027
37377
  access: "view"
37028
37378
  },
37379
+ "storageMigration.residue": {
37380
+ capName: "storage-migration",
37381
+ capScope: "system",
37382
+ addonId: null,
37383
+ access: "view"
37384
+ },
37029
37385
  "storageMigration.start": {
37030
37386
  capName: "storage-migration",
37031
37387
  capScope: "system",
@@ -37860,6 +38216,12 @@ Object.freeze({
37860
38216
  addonId: null,
37861
38217
  access: "delete"
37862
38218
  },
38219
+ "vectorStore.fetchByIds": {
38220
+ capName: "vector-store",
38221
+ capScope: "system",
38222
+ addonId: null,
38223
+ access: "view"
38224
+ },
37863
38225
  "vectorStore.getByIds": {
37864
38226
  capName: "vector-store",
37865
38227
  capScope: "system",
@@ -37872,6 +38234,12 @@ Object.freeze({
37872
38234
  addonId: null,
37873
38235
  access: "view"
37874
38236
  },
38237
+ "vectorStore.scan": {
38238
+ capName: "vector-store",
38239
+ capScope: "system",
38240
+ addonId: null,
38241
+ access: "view"
38242
+ },
37875
38243
  "vectorStore.stats": {
37876
38244
  capName: "vector-store",
37877
38245
  capScope: "system",
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  //#endregion
6
- const require_dist = require("../dist-DuEiH0D0.js");
6
+ const require_dist = require("../dist-D_63yMoB.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  //#region src/ha-export/topics.ts
9
9
  /**
@@ -1,4 +1,4 @@
1
- import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-DQlMgQbg.mjs";
1
+ import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-C6W8WY0m.mjs";
2
2
  import { createHmac, timingSafeEqual } from "node:crypto";
3
3
  //#region src/ha-export/topics.ts
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-homeassistant",
3
- "version": "1.2.56",
3
+ "version": "1.2.59",
4
4
  "description": "Home Assistant device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",