@camstack/addon-post-analysis 1.2.148 → 1.2.150

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.
@@ -8434,13 +8434,49 @@ var StorageMigrationParticipantSchema = _enum([
8434
8434
  "recorder",
8435
8435
  "analytics"
8436
8436
  ]);
8437
+ /**
8438
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8439
+ *
8440
+ * The long half of a non-blocking migration is `draining`, and it is measured
8441
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8442
+ * existed the only place those numbers appeared was a Loki line, so an operator
8443
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8444
+ * afternoon.
8445
+ *
8446
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8447
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8448
+ * mover — which is the exact failure this is meant to end. The coordinator's
8449
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8450
+ * read `state`; folding the counters costs no extra read and makes the durable
8451
+ * record say afterwards how far a move actually got.
8452
+ *
8453
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8454
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8455
+ * cannot say M, and a 0 there would render as "100 % done".
8456
+ */
8457
+ var StorageMigrationMoveProgressSchema = object({
8458
+ filesMoved: number().int().nonnegative(),
8459
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8460
+ filesTotal: number().int().nonnegative().nullable(),
8461
+ bytesMoved: number().int().nonnegative(),
8462
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8463
+ * crash gets a new mover, and a rate computed from the migration's start
8464
+ * would silently average in the time nothing was running. */
8465
+ startedAt: number(),
8466
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8467
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8468
+ * subtract its own. */
8469
+ observedAt: number()
8470
+ });
8437
8471
  var StorageMigrationMoveSchema = object({
8438
8472
  storageClass: StorageMigrationClassSchema,
8439
8473
  fromLocationId: string(),
8440
8474
  toLocationId: string(),
8441
8475
  moverJobId: string().nullable(),
8442
8476
  state: RelocateJobStateSchema.nullable(),
8443
- error: string().nullable()
8477
+ error: string().nullable(),
8478
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8479
+ progress: StorageMigrationMoveProgressSchema.nullable()
8444
8480
  });
8445
8481
  var StorageMigrationJobSchema = object({
8446
8482
  jobId: string(),
@@ -8486,6 +8522,98 @@ var StorageMigrationPlanSchema = object({
8486
8522
  findings: array(StorageMigrationFindingSchema)
8487
8523
  });
8488
8524
  /**
8525
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8526
+ *
8527
+ * The coordinator's job record is the state of record for a migration, and its
8528
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8529
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8530
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8531
+ * way because no supported UI path existed. A mover armed like that has no job
8532
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8533
+ *
8534
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8535
+ * orchestrated it.
8536
+ */
8537
+ var StorageMigrationMoverSchema = object({
8538
+ lane: _enum(["footage", "media"]),
8539
+ job: RelocateJobSchema,
8540
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8541
+ * directly against the owning addon. */
8542
+ migrationJobId: string().nullable(),
8543
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8544
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8545
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8546
+ * rate made of two different clocks. */
8547
+ observedAt: number()
8548
+ });
8549
+ /**
8550
+ * What a SOURCE still holds for one storage class — the number that makes a
8551
+ * "drain remaining" action honest rather than hopeful.
8552
+ *
8553
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8554
+ * engine's own selection count for media), never from the resident index: a
8555
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8556
+ * never been told about (D295).
8557
+ *
8558
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8559
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8560
+ * because refusing on an unanswerable read would hide exactly the case an
8561
+ * operator needs to act on.
8562
+ */
8563
+ var StorageMigrationResidueSchema = object({
8564
+ storageClass: StorageMigrationClassSchema,
8565
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8566
+ * move from wherever they are rather than from one named source. */
8567
+ fromLocationId: string(),
8568
+ /** Where a drain would move it — the class's CURRENT default. */
8569
+ toLocationId: string(),
8570
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8571
+ items: number().int().nonnegative().nullable(),
8572
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8573
+ bytes: number().int().nonnegative().nullable()
8574
+ });
8575
+ /**
8576
+ * Run the DRAIN half and nothing else.
8577
+ *
8578
+ * A migration that reached `done` has already repointed, so `start` correctly
8579
+ * refuses its destination ("already the default") — there is nothing left to
8580
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8581
+ * or finish against a work list that was a tenth of the archive (D295), and
8582
+ * before this there was no supported way to run only that half: the only way
8583
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8584
+ *
8585
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8586
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8587
+ * re-repoint a class that is already migrated.
8588
+ */
8589
+ var StorageMigrationDrainInputSchema = object({
8590
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8591
+ * a class whose source is already empty is refused rather than started. */
8592
+ classes: array(StorageMigrationClassSchema).min(1),
8593
+ throttleMbps: number().min(1).max(1e3).optional()
8594
+ });
8595
+ /** What a footage source still holds, asked of the durable hour ledger. */
8596
+ var RelocateResidueInputSchema = object({
8597
+ fromLocationId: string().min(1),
8598
+ /** Narrow to one logical class; omit for every profile on the location. */
8599
+ footageClass: RelocateFootageClassSchema.optional()
8600
+ });
8601
+ /** `null` = the archive could not answer (no ledger on this node, or the
8602
+ * aggregate failed). Never conflated with an empty source. */
8603
+ var RelocateResidueSchema = object({
8604
+ segments: number().int().nonnegative(),
8605
+ bytes: number().int().nonnegative()
8606
+ }).nullable();
8607
+ /** How many rows a media pass would still act on against a given target — the
8608
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8609
+ * never disagree. `null` = the count could not be taken. */
8610
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8611
+ var RelocatableMediaCountInputSchema = object({
8612
+ toLocationId: string().min(1),
8613
+ /** Omitted = `move`. */
8614
+ mode: MediaRelocateModeSchema.optional()
8615
+ });
8616
+ /**
8489
8617
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8490
8618
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8491
8619
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8589,6 +8717,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8589
8717
  * two addons declaring the same `id` must agree on `cardinality` (validated
8590
8718
  * at kernel aggregation time, not here).
8591
8719
  */
8720
+ /**
8721
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8722
+ * actually reaches the bytes. It is the constraint that decides which
8723
+ * `storage-provider`s may back a location of that kind.
8724
+ *
8725
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8726
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8727
+ * post-analysis media roots). Only a provider that serves a genuine local
8728
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8729
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8730
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8731
+ * against a same-named local directory that is something else entirely.
8732
+ *
8733
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8734
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8735
+ * service never sees a path, so any provider can back it. `backups` is the
8736
+ * one kind that qualifies today.
8737
+ *
8738
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8739
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8740
+ * refused the configuration; the first write simply went somewhere wrong, and
8741
+ * a recording write that goes wrong surfaces as a silent black window rather
8742
+ * than an error (the read path does not `stat`). This turns that accident into
8743
+ * a declared, enforced, testable refusal.
8744
+ */
8745
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8592
8746
  var StorageLocationDeclarationSchema = object({
8593
8747
  /**
8594
8748
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8608,6 +8762,19 @@ var StorageLocationDeclarationSchema = object({
8608
8762
  */
8609
8763
  cardinality: _enum(["single", "multi"]),
8610
8764
  /**
8765
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8766
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8767
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8768
+ *
8769
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8770
+ * can only over-restrict (refuse a remote provider for a kind that might
8771
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8772
+ * permissive direction and is therefore never inferred — a repo guard
8773
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8774
+ * reached by omission.
8775
+ */
8776
+ access: StorageAccessSchema.optional(),
8777
+ /**
8611
8778
  * When set, the default instance for this location inherits its resolved
8612
8779
  * root from the named location's default instance. Useful for derivative
8613
8780
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -19235,8 +19402,10 @@ var TrackSchema = object({
19235
19402
  lastSeen: number(),
19236
19403
  /** Frame-rate position history (subject to maxPositionHistory cap). */
19237
19404
  positions: array(TrackPositionSchema).readonly(),
19238
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
19239
- * saveThumbnails policy). */
19405
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
19406
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
19407
+ * the retired `saveThumbnails` used to gate this and the rolling
19408
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
19240
19409
  snapshots: array(TrackSnapshotSchema).readonly(),
19241
19410
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
19242
19411
  zonesVisited: array(string()).readonly(),
@@ -20319,6 +20488,21 @@ var pipelineAnalyticsCapability = {
20319
20488
  * it to zero.
20320
20489
  */
20321
20490
  countUnstampedEventMedia: method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }),
20491
+ /**
20492
+ * How many rows a pass would STILL act on against `toLocationId`.
20493
+ *
20494
+ * One derivation, two consumers: it is the media lane's denominator (the
20495
+ * **M** the footage lane gets from the ledger census — D295) and it is the
20496
+ * residue behind "drain remaining". Deriving them separately is how "N of M"
20497
+ * ends up comparing two different populations.
20498
+ *
20499
+ * `null` means the count could not be taken; it is never zero-filled,
20500
+ * because a zero here reads as "nothing left to move".
20501
+ */
20502
+ countRelocatableMedia: method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
20503
+ kind: "query",
20504
+ auth: "admin"
20505
+ }),
20322
20506
  /** Every relocate job this addon knows about, newest first (in RAM: the
20323
20507
  * move is resumable, so a lost list costs nothing but the display). */
20324
20508
  listRelocateMediaJobs: method(object({}), array(RelocateJobSchema).readonly(), {
@@ -22534,6 +22718,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22534
22718
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
22535
22719
  kind: "mutation",
22536
22720
  auth: "admin"
22721
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
22722
+ kind: "mutation",
22723
+ auth: "admin"
22537
22724
  });
22538
22725
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22539
22726
  providerId: string().min(1),
@@ -22932,12 +23119,38 @@ response: record(string(), unknown()) }), object({
22932
23119
  *
22933
23120
  * ## Why this is a capability and not a helper
22934
23121
  *
22935
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
22936
- * plate, vehicle, identity, and the event store's derivatives — and every one of
22937
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
22938
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
22939
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
22940
- * load 5,000 rows before ranking anything.
23122
+ * This capability was introduced with the claim that SIX stores in
23123
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
23124
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
23125
+ * claim was never true, and leaving it here made five stores look like pending
23126
+ * work when three of them have no vector at all. Counted column by column on
23127
+ * 2026-08-30, exactly THREE ever held one:
23128
+ *
23129
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
23130
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
23131
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
23132
+ * face, migrated 2026-08-30 into its OWN index (see below).
23133
+ *
23134
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
23135
+ * and `identities` store a name; the event store stores no derivative vector.
23136
+ * They are not migration candidates and never were.
23137
+ *
23138
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
23139
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
23140
+ * rows before ranking anything.
23141
+ *
23142
+ * ## One index per COMPARISON, never per encoder
23143
+ *
23144
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
23145
+ * model, and they still get two indexes. An index is a set of things that are
23146
+ * ranked against each other and that live and die together, and these two are
23147
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
23148
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
23149
+ * forever and is the gallery every recognition ranks against. One index would
23150
+ * mean every gallery load and every reconcile carried a filter whose failure
23151
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
23152
+ * person's only sample. The dimension they share is not a reason to share an
23153
+ * index; the question they answer is, and it differs.
22941
23154
  *
22942
23155
  * The fix is not a faster loop, it is a different backend — and the backend
22943
23156
  * should be replaceable without touching six callers. So: a singleton
@@ -23042,7 +23255,20 @@ var VectorQueryResultSchema = object({
23042
23255
  */
23043
23256
  scanned: number(),
23044
23257
  /** True when the backend could not consider every row that passed the filter. */
23045
- truncated: boolean()
23258
+ truncated: boolean(),
23259
+ /**
23260
+ * The `topK` the backend actually ran with.
23261
+ *
23262
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
23263
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
23264
+ * own log rather than in its answer. That is how an audit asking for 20,000
23265
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
23266
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
23267
+ * MUCH, in the return value, where the caller cannot fail to see it.
23268
+ *
23269
+ * Equals the requested `topK` whenever nothing was lowered.
23270
+ */
23271
+ effectiveTopK: number().int().positive()
23046
23272
  });
23047
23273
  var VectorDeleteInputSchema = object({
23048
23274
  index: string(),
@@ -23071,6 +23297,68 @@ var VectorGetResultSchema = object({ items: array(object({
23071
23297
  id: string(),
23072
23298
  metadata: VectorMetadataSchema
23073
23299
  })) });
23300
+ /**
23301
+ * Ids to read back WITH their vectors.
23302
+ *
23303
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
23304
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
23305
+ * caller depends on that promise. This one promises the opposite.
23306
+ *
23307
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
23308
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
23309
+ * a per-face cross-process KNN would be a network round trip inside the
23310
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
23311
+ * it requires the index to hand the floats back. Without this method the only
23312
+ * way to keep a readable vector is a JSON column, which is the thing this
23313
+ * capability exists to delete.
23314
+ *
23315
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
23316
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
23317
+ */
23318
+ var VectorFetchInputSchema = object({
23319
+ index: string(),
23320
+ ids: array(string())
23321
+ });
23322
+ var VectorFetchResultSchema = object({ items: array(object({
23323
+ id: string(),
23324
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
23325
+ vector: string(),
23326
+ metadata: VectorMetadataSchema
23327
+ })) });
23328
+ /**
23329
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
23330
+ *
23331
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
23332
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
23333
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
23334
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
23335
+ * distance to every row is degenerate. `examined: 4096` then read as "we
23336
+ * looked" for as long as anyone cared to read it.
23337
+ *
23338
+ * This is the primitive that question actually needs: a bounded page, ordered
23339
+ * by the backend's own row order, costing no distance computation at all.
23340
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
23341
+ * the full-table read this capability was built to stop.
23342
+ */
23343
+ var VectorScanInputSchema = object({
23344
+ index: string(),
23345
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
23346
+ cursor: number().int().nonnegative().default(0),
23347
+ limit: number().int().positive()
23348
+ });
23349
+ var VectorScanResultSchema = object({
23350
+ items: array(object({
23351
+ id: string(),
23352
+ metadata: VectorMetadataSchema
23353
+ })),
23354
+ /**
23355
+ * Where the next page starts, or `null` when the walk reached the end.
23356
+ *
23357
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
23358
+ * from a short page: a backend is free to return fewer rows than asked.
23359
+ */
23360
+ nextCursor: number().int().nonnegative().nullable()
23361
+ });
23074
23362
  var VectorStatsInputSchema = object({ index: string() });
23075
23363
  var VectorStatsResultSchema = object({
23076
23364
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -23089,7 +23377,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
23089
23377
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
23090
23378
  kind: "mutation",
23091
23379
  auth: "admin"
23092
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
23380
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
23093
23381
  kind: "mutation",
23094
23382
  auth: "admin"
23095
23383
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -29782,6 +30070,9 @@ method(object({
29782
30070
  }), method(object({}), array(RelocateJobSchema).readonly(), {
29783
30071
  kind: "query",
29784
30072
  auth: "admin"
30073
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
30074
+ kind: "query",
30075
+ auth: "admin"
29785
30076
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
29786
30077
  kind: "mutation",
29787
30078
  auth: "admin"
@@ -32272,6 +32563,146 @@ function readDeviceStateFrom(runtimeState) {
32272
32563
  }
32273
32564
  }
32274
32565
  /**
32566
+ * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
32567
+ * valutatore puro del suo FRONTE.
32568
+ *
32569
+ * Viveva dentro il builtin virtual-doorbell
32570
+ * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
32571
+ * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
32572
+ * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
32573
+ * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
32574
+ * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
32575
+ * SPOSTA qui e il doorbell la ri-esporta.
32576
+ *
32577
+ * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
32578
+ * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
32579
+ * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
32580
+ * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
32581
+ */
32582
+ /**
32583
+ * Known binary / switch source caps → the boolean slice field whose
32584
+ * false→true rise counts as ACTIVE. Every entry is "fire on active".
32585
+ * Sensors whose "active" reading is not a plain boolean (presence's string
32586
+ * state, connectivity's connected flag) are deliberately excluded — a
32587
+ * reconnect is not a doorbell press, and it is not a recording either.
32588
+ */
32589
+ var SOURCE_CAP_ACTIVE_FIELD = {
32590
+ contact: "entryOpen",
32591
+ binary: "on",
32592
+ switch: "on",
32593
+ motion: "detected",
32594
+ flood: "flooded",
32595
+ gas: "detected",
32596
+ smoke: "detected",
32597
+ "carbon-monoxide": "detected",
32598
+ vibration: "detected",
32599
+ tamper: "tampered"
32600
+ };
32601
+ /**
32602
+ * The same caps → the slice field carrying the ms-epoch timestamp of the
32603
+ * last transition. Every source cap MUST appear here (guarded by a spec):
32604
+ * without a transition timestamp the evaluator cannot tell a genuine rise
32605
+ * from a boot-time hydration when the FIRST slice it ever sees is already
32606
+ * active, and errs towards silence — swallowing the rise.
32607
+ *
32608
+ * These timestamps are UPSTREAM ones, not ingest ones: the Home Assistant
32609
+ * provider derives them from `state.last_changed`, so they survive our own
32610
+ * restarts and correctly read as "hours ago" for a state that has been
32611
+ * active for hours. `motion` names its rise timestamp `lastDetectedAt`.
32612
+ */
32613
+ var SOURCE_CAP_CHANGED_AT_FIELD = {
32614
+ contact: "lastChangedAt",
32615
+ binary: "lastChangedAt",
32616
+ switch: "lastChangedAt",
32617
+ motion: "lastDetectedAt",
32618
+ flood: "lastChangedAt",
32619
+ gas: "lastChangedAt",
32620
+ smoke: "lastChangedAt",
32621
+ "carbon-monoxide": "lastChangedAt",
32622
+ vibration: "lastChangedAt",
32623
+ tamper: "lastChangedAt"
32624
+ };
32625
+ /** True when a cap is a recognised binary/switch source. */
32626
+ function isSourceCap(capName) {
32627
+ return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
32628
+ }
32629
+ /** Extract the "active" boolean a source cap's slice carries, or null when
32630
+ * the cap is unknown or the field is missing / non-boolean. */
32631
+ function sliceActiveValue(capName, slice) {
32632
+ const field = SOURCE_CAP_ACTIVE_FIELD[capName];
32633
+ if (field === void 0) return null;
32634
+ const raw = slice[field];
32635
+ return typeof raw === "boolean" ? raw : null;
32636
+ }
32637
+ /** Ms-epoch transition timestamp a source cap's slice carries, or null when
32638
+ * it is absent, non-numeric or the zero "never observed" sentinel. */
32639
+ function sliceChangedAt(capName, slice) {
32640
+ const field = SOURCE_CAP_CHANGED_AT_FIELD[capName];
32641
+ if (field === void 0) return null;
32642
+ const raw = slice[field];
32643
+ if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return null;
32644
+ return raw;
32645
+ }
32646
+ /**
32647
+ * How recent a source's own transition timestamp must be for a FIRST
32648
+ * sighting that is already active to count as a genuine rise rather than a
32649
+ * hydration of long-standing state.
32650
+ */
32651
+ var DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = 3e4;
32652
+ /**
32653
+ * IL fronte. Puro: nessun orologio proprio, nessuna memoria — il chiamante
32654
+ * porta `prior`, `nowMs` e il proprio `startedAtMs`.
32655
+ *
32656
+ * Il caso della PRIMA slice già attiva è trattato esplicitamente e vale come
32657
+ * fronte solo se il timestamp UPSTREAM della transizione è posteriore a
32658
+ * `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
32659
+ * servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
32660
+ * stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
32661
+ * iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
32662
+ * adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
32663
+ * SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
32664
+ */
32665
+ function evaluateSensorEdge(input) {
32666
+ const value = sliceActiveValue(input.capName, input.slice);
32667
+ if (value === null) return {
32668
+ edge: "none",
32669
+ value: null,
32670
+ reason: isSourceCap(input.capName) ? "non-boolean-value" : "unknown-cap"
32671
+ };
32672
+ if (input.prior === void 0) {
32673
+ if (!value) return {
32674
+ edge: "none",
32675
+ value,
32676
+ reason: "baseline-seeded-inactive"
32677
+ };
32678
+ const changedAt = sliceChangedAt(input.capName, input.slice);
32679
+ const floor = Math.max(input.startedAtMs, input.nowMs - input.firstSightingFreshnessMs);
32680
+ if (changedAt === null || changedAt < floor) return {
32681
+ edge: "none",
32682
+ value,
32683
+ reason: "baseline-seeded-stale-active"
32684
+ };
32685
+ return {
32686
+ edge: "rising",
32687
+ value: true
32688
+ };
32689
+ }
32690
+ if (input.prior === value) return {
32691
+ edge: "none",
32692
+ value,
32693
+ reason: "no-change"
32694
+ };
32695
+ if (!value) return {
32696
+ edge: "none",
32697
+ value,
32698
+ reason: "falling-edge"
32699
+ };
32700
+ return {
32701
+ edge: "rising",
32702
+ value: true
32703
+ };
32704
+ }
32705
+ /**
32275
32706
  * Accessory device helpers — shared across drivers.
32276
32707
  *
32277
32708
  * Many vendor-specific drivers register accessory child devices on
@@ -36493,6 +36924,12 @@ Object.freeze({
36493
36924
  addonId: null,
36494
36925
  access: "create"
36495
36926
  },
36927
+ "pipelineAnalytics.countRelocatableMedia": {
36928
+ capName: "pipeline-analytics",
36929
+ capScope: "device",
36930
+ addonId: null,
36931
+ access: "view"
36932
+ },
36496
36933
  "pipelineAnalytics.countUnstampedEventMedia": {
36497
36934
  capName: "pipeline-analytics",
36498
36935
  capScope: "device",
@@ -37657,6 +38094,12 @@ Object.freeze({
37657
38094
  addonId: null,
37658
38095
  access: "view"
37659
38096
  },
38097
+ "recording.getRelocateResidue": {
38098
+ capName: "recording",
38099
+ capScope: "system",
38100
+ addonId: null,
38101
+ access: "view"
38102
+ },
37660
38103
  "recording.getStorageMigrationMoveStatus": {
37661
38104
  capName: "recording",
37662
38105
  capScope: "system",
@@ -38203,12 +38646,30 @@ Object.freeze({
38203
38646
  addonId: null,
38204
38647
  access: "create"
38205
38648
  },
38649
+ "storageMigration.drain": {
38650
+ capName: "storage-migration",
38651
+ capScope: "system",
38652
+ addonId: null,
38653
+ access: "create"
38654
+ },
38655
+ "storageMigration.movers": {
38656
+ capName: "storage-migration",
38657
+ capScope: "system",
38658
+ addonId: null,
38659
+ access: "view"
38660
+ },
38206
38661
  "storageMigration.plan": {
38207
38662
  capName: "storage-migration",
38208
38663
  capScope: "system",
38209
38664
  addonId: null,
38210
38665
  access: "view"
38211
38666
  },
38667
+ "storageMigration.residue": {
38668
+ capName: "storage-migration",
38669
+ capScope: "system",
38670
+ addonId: null,
38671
+ access: "view"
38672
+ },
38212
38673
  "storageMigration.start": {
38213
38674
  capName: "storage-migration",
38214
38675
  capScope: "system",
@@ -39043,6 +39504,12 @@ Object.freeze({
39043
39504
  addonId: null,
39044
39505
  access: "delete"
39045
39506
  },
39507
+ "vectorStore.fetchByIds": {
39508
+ capName: "vector-store",
39509
+ capScope: "system",
39510
+ addonId: null,
39511
+ access: "view"
39512
+ },
39046
39513
  "vectorStore.getByIds": {
39047
39514
  capName: "vector-store",
39048
39515
  capScope: "system",
@@ -39055,6 +39522,12 @@ Object.freeze({
39055
39522
  addonId: null,
39056
39523
  access: "view"
39057
39524
  },
39525
+ "vectorStore.scan": {
39526
+ capName: "vector-store",
39527
+ capScope: "system",
39528
+ addonId: null,
39529
+ access: "view"
39530
+ },
39058
39531
  "vectorStore.stats": {
39059
39532
  capName: "vector-store",
39060
39533
  capScope: "system",
@@ -42132,6 +42605,12 @@ Object.defineProperty(exports, "DEFAULT_EVENT_COLOR", {
42132
42605
  return DEFAULT_EVENT_COLOR;
42133
42606
  }
42134
42607
  });
42608
+ Object.defineProperty(exports, "DEFAULT_FIRST_SIGHTING_FRESHNESS_MS", {
42609
+ enumerable: true,
42610
+ get: function() {
42611
+ return DEFAULT_FIRST_SIGHTING_FRESHNESS_MS;
42612
+ }
42613
+ });
42135
42614
  Object.defineProperty(exports, "DEFAULT_TIMELAPSE_PREVIEW_TEXT", {
42136
42615
  enumerable: true,
42137
42616
  get: function() {
@@ -42510,6 +42989,12 @@ Object.defineProperty(exports, "errMsg", {
42510
42989
  return errMsg;
42511
42990
  }
42512
42991
  });
42992
+ Object.defineProperty(exports, "evaluateSensorEdge", {
42993
+ enumerable: true,
42994
+ get: function() {
42995
+ return evaluateSensorEdge;
42996
+ }
42997
+ });
42513
42998
  Object.defineProperty(exports, "faceGalleryCapability", {
42514
42999
  enumerable: true,
42515
43000
  get: function() {
@@ -42552,6 +43037,12 @@ Object.defineProperty(exports, "isScheduleActive", {
42552
43037
  return isScheduleActive;
42553
43038
  }
42554
43039
  });
43040
+ Object.defineProperty(exports, "isSourceCap", {
43041
+ enumerable: true,
43042
+ get: function() {
43043
+ return isSourceCap;
43044
+ }
43045
+ });
42555
43046
  Object.defineProperty(exports, "kebabToCamel", {
42556
43047
  enumerable: true,
42557
43048
  get: function() {