@camstack/addon-export-hap 1.2.56 → 1.2.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8669,6 +8669,21 @@ var RelocateJobSchema = object({
8669
8669
  bytesMoved: number().int(),
8670
8670
  /** Total files discovered up front; null while (or when) unknown. */
8671
8671
  filesTotal: number().int().nullable(),
8672
+ /**
8673
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8674
+ * made that nobody asked for, so it is reported where the operator reads the
8675
+ * job rather than only in a log line.
8676
+ *
8677
+ * A footage segment records its byte count in its own NAME, and the durable
8678
+ * hour row derives its aggregates from those names. A file that does not
8679
+ * match its name therefore makes the ledger's sums — and with them quota and
8680
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8681
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8682
+ *
8683
+ * Absent on lanes where the question has no meaning: a media blob's size is
8684
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8685
+ */
8686
+ rowsReconciled: number().int().nonnegative().optional(),
8672
8687
  startedAt: number(),
8673
8688
  finishedAt: number().nullable(),
8674
8689
  error: string().nullable()
@@ -8737,14 +8752,42 @@ var RelocateMediaInputSchema = object({
8737
8752
  /** Omitted = `move`, the pre-existing behaviour. */
8738
8753
  mode: MediaRelocateModeSchema.optional()
8739
8754
  });
8740
- /** How many rows still carry NO `locationId` — the population a repoint would
8741
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8742
- * value that permits a non-blocking `eventMedia` cutover. */
8743
- var UnstampedEventMediaCountSchema = object({
8744
- media: number().int().nonnegative(),
8745
- retrainFrames: number().int().nonnegative(),
8746
- total: number().int().nonnegative()
8755
+ /**
8756
+ * The unstamped population of ONE collection — split, because the gate and the
8757
+ * operator ask two different questions and only one of them has to be cheap.
8758
+ *
8759
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8760
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8761
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8762
+ * that matters — after a seal, when the population is empty.
8763
+ *
8764
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8765
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8766
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8767
+ * and useful answer: "there are some, and this read could not say how many"
8768
+ * still refuses the cutover, which is the whole job.
8769
+ */
8770
+ var UnstampedRowsSchema = object({
8771
+ present: boolean(),
8772
+ rows: number().int().nonnegative().nullable()
8747
8773
  });
8774
+ /**
8775
+ * How many rows still carry NO `locationId` — the population a repoint would
8776
+ * silently re-aim at a disk that does not hold their bytes.
8777
+ *
8778
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8779
+ * over. The gate opens on a measured absence and on nothing else; an unread
8780
+ * collection and an empty one are different facts, and this repo has already
8781
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8782
+ */
8783
+ var UnstampedEventMediaCountSchema = object({
8784
+ media: UnstampedRowsSchema,
8785
+ retrainFrames: UnstampedRowsSchema,
8786
+ /** True when EITHER collection holds one. The refusal reads this. */
8787
+ anyPresent: boolean(),
8788
+ /** Sum across both, or `null` when either lane could not be counted. */
8789
+ total: number().int().nonnegative().nullable()
8790
+ }).nullable();
8748
8791
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8749
8792
  /** The independently selectable logical storage classes — every class
8750
8793
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8855,6 +8898,10 @@ var StorageMigrationMoveProgressSchema = object({
8855
8898
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8856
8899
  filesTotal: number().int().nonnegative().nullable(),
8857
8900
  bytesMoved: number().int().nonnegative(),
8901
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8902
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8903
+ * rows would be the same failure as one that silently skipped them. */
8904
+ rowsReconciled: number().int().nonnegative().optional(),
8858
8905
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8859
8906
  * crash gets a new mover, and a rate computed from the migration's start
8860
8907
  * would silently average in the time nothing was running. */
@@ -13674,6 +13721,114 @@ method(object({
13674
13721
  height: number()
13675
13722
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13676
13723
  /**
13724
+ * `failure-contribution` — the capability an addon reports its OWN losses
13725
+ * through, per camera, with the denominator attached. It stores nothing.
13726
+ *
13727
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13728
+ *
13729
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13730
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13731
+ * copied: the contributor reports what it already knows, hub-main adds only
13732
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13733
+ * somebody to forget to edit.
13734
+ *
13735
+ * They are not merged, because their invariants are opposites:
13736
+ *
13737
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13738
+ * claim a camera cost nothing, which is a measurement nobody made;
13739
+ * - a `failure-contribution` zero is the **most valuable value on the
13740
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13741
+ * and it is exactly what an absent entry cannot say.
13742
+ *
13743
+ * Putting a loss counter on a cost entry would also break the reconciliation
13744
+ * that gives `load-contribution` its point: contributions are subtracted from
13745
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13746
+ * has no process.
13747
+ *
13748
+ * ## Why not a log line, since the counters already exist
13749
+ *
13750
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13751
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13752
+ * ends in a log line, and a log line is the thing the operator asked to stop
13753
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13754
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13755
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13756
+ * media blackout were both diagnosed. The counters stay; this is where they can
13757
+ * be READ.
13758
+ *
13759
+ * ## The rate is served with its denominator or not at all
13760
+ *
13761
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13762
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13763
+ * than yesterday" and was **flat across twelve hours** once divided by the
13764
+ * successes on the same path. A surface that publishes only the numerator
13765
+ * reproduces that mistake on every read.
13766
+ *
13767
+ * ## Shape
13768
+ *
13769
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13770
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13771
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13772
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13773
+ * a forked runner's entries reach hub-main over transport that already exists.
13774
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13775
+ * result through `system.getFailureContributions`.
13776
+ */
13777
+ var FailureReasonCountSchema = object({
13778
+ /**
13779
+ * Why the attempt did not land, in the contributor's own vocabulary —
13780
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13781
+ * strings that already appear in this repo's logs and, where one exists, the
13782
+ * same string the per-track `previewMissReason` records (D276): a second
13783
+ * vocabulary for the same loss would make the row and the counter
13784
+ * un-joinable.
13785
+ */
13786
+ reason: string(),
13787
+ count: number().int().nonnegative()
13788
+ });
13789
+ var FailureContributionSchema = object({
13790
+ /**
13791
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13792
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13793
+ * `unit` free: the families are owned by different addons and a shared enum
13794
+ * is a central list that rots invisibly.
13795
+ */
13796
+ family: string(),
13797
+ /**
13798
+ * The NUMERIC device id — the same value every log line carries as
13799
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13800
+ * cannot name the camera must not emit the entry, because a fleet total
13801
+ * cannot answer the only question anybody asks of this surface.
13802
+ */
13803
+ deviceId: number().int().positive(),
13804
+ /**
13805
+ * A second dimension inside the family: the model / step id for an inference
13806
+ * timeout, so "which camera AND which model" is one read. Absent when the
13807
+ * family has a single variant.
13808
+ */
13809
+ variant: string().optional(),
13810
+ /**
13811
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13812
+ * differencing two reads must drop the interval when it changes, because the
13813
+ * counter restarted from zero in a respawned runner. Same discipline as
13814
+ * `LoadContribution.startedAtMs`.
13815
+ */
13816
+ sinceMs: number(),
13817
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13818
+ atMs: number(),
13819
+ /**
13820
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13821
+ * window. A failure count published without it is the mistake this schema
13822
+ * exists to make impossible.
13823
+ */
13824
+ attempts: number().int().nonnegative(),
13825
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13826
+ succeeded: number().int().nonnegative(),
13827
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13828
+ reasons: array(FailureReasonCountSchema).readonly()
13829
+ });
13830
+ method(_void(), array(FailureContributionSchema).readonly());
13831
+ /**
13677
13832
  * filesystem-browse — per-node capability for browsing the node's local
13678
13833
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13679
13834
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -14195,6 +14350,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
14195
14350
  kind: "mutation",
14196
14351
  auth: "admin"
14197
14352
  });
14353
+ var LoadContributionSchema = object({
14354
+ role: _enum([
14355
+ "decode",
14356
+ "transcode",
14357
+ "recording",
14358
+ "streaming",
14359
+ "detection"
14360
+ ]),
14361
+ /**
14362
+ * The NUMERIC device id — the same value every log line carries as
14363
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14364
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
14365
+ * contributor that cannot name its camera must not emit the entry at all,
14366
+ * because an unnamed per-camera entry is indistinguishable from a shared one
14367
+ * and would quietly turn one camera's cost into everybody's.
14368
+ */
14369
+ deviceId: number().int().positive().nullable(),
14370
+ attribution: _enum([
14371
+ "measured",
14372
+ "accounted",
14373
+ "unattributable"
14374
+ ]),
14375
+ /**
14376
+ * What ONE entry is, in the contributor's own words — `615/high`,
14377
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14378
+ * family and inventing a common one would lose the only information that
14379
+ * makes two entries for the same camera distinguishable.
14380
+ */
14381
+ unit: string(),
14382
+ /**
14383
+ * The OS process this cost lives in, when there is one. Present so a
14384
+ * consumer can (a) tell two generations of the same unit apart across a
14385
+ * restart, and (b) subtract claimed processes from the node's process
14386
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14387
+ * process of its own.
14388
+ */
14389
+ pid: number().int().positive().optional(),
14390
+ /**
14391
+ * When this generation started. The pid's incarnation marker: a consumer
14392
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14393
+ * window when this changes, because the counter restarted from zero in a new
14394
+ * process.
14395
+ */
14396
+ startedAtMs: number().optional(),
14397
+ /**
14398
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14399
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
14400
+ * contribution is asked for.
14401
+ *
14402
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
14403
+ * needs a sampler, and a new per-node sampler is the defect half of
14404
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14405
+ * by whoever already keeps a history; a rate cannot be un-averaged.
14406
+ *
14407
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14408
+ * an entry with no process.
14409
+ */
14410
+ cpuSeconds: number().optional(),
14411
+ /** Resident bytes of this unit's process, same source and same rules. */
14412
+ rssBytes: number().optional()
14413
+ });
14414
+ method(_void(), array(LoadContributionSchema).readonly());
14198
14415
  /**
14199
14416
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
14200
14417
  * through. It stores nothing.
@@ -14271,176 +14488,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14271
14488
  tags: record(string(), string()).optional()
14272
14489
  }), array(LogEntrySchema).readonly());
14273
14490
  /**
14274
- * `failure-contribution` — the capability an addon reports its OWN losses
14275
- * through, per camera, with the denominator attached. It stores nothing.
14276
- *
14277
- * ## The twin of `load-contribution`, and why it is a twin and not a field
14278
- *
14279
- * `load-contribution` answers *what did this camera COST*. This answers *what
14280
- * did this camera LOSE*. The reporting discipline is identical and deliberately
14281
- * copied: the contributor reports what it already knows, hub-main adds only
14282
- * `addonId`, nothing needs global knowledge, and there is no central list for
14283
- * somebody to forget to edit.
14284
- *
14285
- * They are not merged, because their invariants are opposites:
14286
- *
14287
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
14288
- * claim a camera cost nothing, which is a measurement nobody made;
14289
- * - a `failure-contribution` zero is the **most valuable value on the
14290
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
14291
- * and it is exactly what an absent entry cannot say.
14292
- *
14293
- * Putting a loss counter on a cost entry would also break the reconciliation
14294
- * that gives `load-contribution` its point: contributions are subtracted from
14295
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
14296
- * has no process.
14297
- *
14298
- * ## Why not a log line, since the counters already exist
14299
- *
14300
- * Several of these paths already counted themselves — `CaptureScheduler`'s
14301
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
14302
- * ends in a log line, and a log line is the thing the operator asked to stop
14303
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
14304
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
14305
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
14306
- * media blackout were both diagnosed. The counters stay; this is where they can
14307
- * be READ.
14308
- *
14309
- * ## The rate is served with its denominator or not at all
14310
- *
14311
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
14312
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
14313
- * than yesterday" and was **flat across twelve hours** once divided by the
14314
- * successes on the same path. A surface that publishes only the numerator
14315
- * reproduces that mistake on every read.
14316
- *
14317
- * ## Shape
14318
- *
14319
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
14320
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
14321
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
14322
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
14323
- * a forked runner's entries reach hub-main over transport that already exists.
14324
- * No new UDS message, no second registry (D3). The operator reads the assembled
14325
- * result through `system.getFailureContributions`.
14326
- */
14327
- var FailureReasonCountSchema = object({
14328
- /**
14329
- * Why the attempt did not land, in the contributor's own vocabulary —
14330
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
14331
- * strings that already appear in this repo's logs and, where one exists, the
14332
- * same string the per-track `previewMissReason` records (D276): a second
14333
- * vocabulary for the same loss would make the row and the counter
14334
- * un-joinable.
14335
- */
14336
- reason: string(),
14337
- count: number().int().nonnegative()
14338
- });
14339
- var FailureContributionSchema = object({
14340
- /**
14341
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
14342
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
14343
- * `unit` free: the families are owned by different addons and a shared enum
14344
- * is a central list that rots invisibly.
14345
- */
14346
- family: string(),
14347
- /**
14348
- * The NUMERIC device id — the same value every log line carries as
14349
- * `tags.deviceId`. Never nullable and never absent: a contributor that
14350
- * cannot name the camera must not emit the entry, because a fleet total
14351
- * cannot answer the only question anybody asks of this surface.
14352
- */
14353
- deviceId: number().int().positive(),
14354
- /**
14355
- * A second dimension inside the family: the model / step id for an inference
14356
- * timeout, so "which camera AND which model" is one read. Absent when the
14357
- * family has a single variant.
14358
- */
14359
- variant: string().optional(),
14360
- /**
14361
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
14362
- * differencing two reads must drop the interval when it changes, because the
14363
- * counter restarted from zero in a respawned runner. Same discipline as
14364
- * `LoadContribution.startedAtMs`.
14365
- */
14366
- sinceMs: number(),
14367
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
14368
- atMs: number(),
14369
- /**
14370
- * THE DENOMINATOR — every attempt on this path for this camera in the
14371
- * window. A failure count published without it is the mistake this schema
14372
- * exists to make impossible.
14373
- */
14374
- attempts: number().int().nonnegative(),
14375
- /** Attempts that landed. `attempts - succeeded` is the loss. */
14376
- succeeded: number().int().nonnegative(),
14377
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
14378
- reasons: array(FailureReasonCountSchema).readonly()
14379
- });
14380
- method(_void(), array(FailureContributionSchema).readonly());
14381
- var LoadContributionSchema = object({
14382
- role: _enum([
14383
- "decode",
14384
- "transcode",
14385
- "recording",
14386
- "streaming",
14387
- "detection"
14388
- ]),
14389
- /**
14390
- * The NUMERIC device id — the same value every log line carries as
14391
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14392
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
14393
- * contributor that cannot name its camera must not emit the entry at all,
14394
- * because an unnamed per-camera entry is indistinguishable from a shared one
14395
- * and would quietly turn one camera's cost into everybody's.
14396
- */
14397
- deviceId: number().int().positive().nullable(),
14398
- attribution: _enum([
14399
- "measured",
14400
- "accounted",
14401
- "unattributable"
14402
- ]),
14403
- /**
14404
- * What ONE entry is, in the contributor's own words — `615/high`,
14405
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14406
- * family and inventing a common one would lose the only information that
14407
- * makes two entries for the same camera distinguishable.
14408
- */
14409
- unit: string(),
14410
- /**
14411
- * The OS process this cost lives in, when there is one. Present so a
14412
- * consumer can (a) tell two generations of the same unit apart across a
14413
- * restart, and (b) subtract claimed processes from the node's process
14414
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14415
- * process of its own.
14416
- */
14417
- pid: number().int().positive().optional(),
14418
- /**
14419
- * When this generation started. The pid's incarnation marker: a consumer
14420
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14421
- * window when this changes, because the counter restarted from zero in a new
14422
- * process.
14423
- */
14424
- startedAtMs: number().optional(),
14425
- /**
14426
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14427
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
14428
- * contribution is asked for.
14429
- *
14430
- * Cumulative and not a rate on purpose: a rate needs a window, a window
14431
- * needs a sampler, and a new per-node sampler is the defect half of
14432
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14433
- * by whoever already keeps a history; a rate cannot be un-averaged.
14434
- *
14435
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14436
- * an entry with no process.
14437
- */
14438
- cpuSeconds: number().optional(),
14439
- /** Resident bytes of this unit's process, same source and same rules. */
14440
- rssBytes: number().optional()
14441
- });
14442
- method(_void(), array(LoadContributionSchema).readonly());
14443
- /**
14444
14491
  * `login-method` — collection cap through which auth addons contribute
14445
14492
  * their pre-auth login surfaces to the login page. This is the SINGLE,
14446
14493
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -19100,12 +19147,53 @@ var MediaFileKindEnum = _enum([
19100
19147
  "keyFrameSmall",
19101
19148
  "thumbnailSmall"
19102
19149
  ]);
19150
+ /**
19151
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
19152
+ * ARE — never the bytes themselves.
19153
+ *
19154
+ * ## Why `url` and not `base64`
19155
+ *
19156
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
19157
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
19158
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
19159
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
19160
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
19161
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
19162
+ *
19163
+ * `url` points at the `event-media` data plane
19164
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
19165
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
19166
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
19167
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
19168
+ * no less protected than they were inside a `view`-level cap response — see
19169
+ * `data-plane-access.ts` for the rule and the one gap it does not close
19170
+ * (per-device scoping).
19171
+ *
19172
+ * The URL is built from the row's **stored** key, which is not always its
19173
+ * published `kind`: a track's face/plate crop is stored as `crop` under
19174
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
19175
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
19176
+ *
19177
+ * ## `base64` is TRANSITIONAL and is going away
19178
+ *
19179
+ * It is still populated for one reason: the deployed viewer's track-detail
19180
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
19181
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
19182
+ * triangle — not as absence. Removing the field before that viewer ships is an
19183
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
19184
+ * delete this line and the `withBytes` pass-through in
19185
+ * `analytics-query-facade.ts`; nothing else reads it.
19186
+ */
19103
19187
  var MediaFileSchema = object({
19104
19188
  key: string(),
19105
19189
  kind: MediaFileKindEnum,
19106
- base64: string(),
19107
19190
  sizeBytes: number(),
19108
19191
  timestamp: number()
19192
+ }).extend({
19193
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
19194
+ url: string(),
19195
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
19196
+ base64: string()
19109
19197
  });
19110
19198
  /**
19111
19199
  * One media row WITHOUT its bytes.
@@ -19117,7 +19205,9 @@ var MediaFileSchema = object({
19117
19205
  * blocks the whole view.
19118
19206
  *
19119
19207
  * `sizeBytes` is carried because it is what lets a client decide between the
19120
- * stored blob and a `?variant=thumb` rendering without fetching either.
19208
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
19209
+ * `url` because a client that had to build the plane path itself is a second
19210
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
19121
19211
  */
19122
19212
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
19123
19213
  /**
@@ -19806,6 +19896,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19806
19896
  }), array(MediaFileSchema).readonly()), method(object({
19807
19897
  trackId: string(),
19808
19898
  deviceId: number()
19899
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19900
+ eventId: string(),
19901
+ deviceId: number()
19809
19902
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19810
19903
  kind: "mutation",
19811
19904
  auth: "admin"
@@ -24086,10 +24179,24 @@ var FaceClusterSchema = object({
24086
24179
  size: number().int(),
24087
24180
  cohesion: number()
24088
24181
  });
24182
+ /**
24183
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
24184
+ * are — never the bytes.
24185
+ *
24186
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
24187
+ * track/event contract) is still populated because a deployed viewer requires
24188
+ * the field to parse a row at all; this method has no such reader. Its ONE
24189
+ * caller is the admin UI's detail modal, which was building
24190
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
24191
+ * dialog already rendering its key FRAME from the `event-media` plane.
24192
+ *
24193
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
24194
+ * media key directly, so this needed no new plane and no new access decision.
24195
+ */
24089
24196
  var MediaFileLiteSchema$1 = object({
24090
24197
  key: string(),
24091
24198
  kind: string(),
24092
- base64: string(),
24199
+ url: string(),
24093
24200
  sizeBytes: number(),
24094
24201
  timestamp: number()
24095
24202
  });
@@ -26369,10 +26476,24 @@ var PlateInfoSchema = object({
26369
26476
  */
26370
26477
  cropUrl: string().optional()
26371
26478
  });
26479
+ /**
26480
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
26481
+ * are — never the bytes.
26482
+ *
26483
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
26484
+ * track/event contract) is still populated because a deployed viewer requires
26485
+ * the field to parse a row at all; this method has no such reader. Its ONE
26486
+ * caller is the admin UI's detail modal, which was building
26487
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
26488
+ * dialog already rendering its key FRAME from the `event-media` plane.
26489
+ *
26490
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
26491
+ * media key directly, so this needed no new plane and no new access decision.
26492
+ */
26372
26493
  var MediaFileLiteSchema = object({
26373
26494
  key: string(),
26374
26495
  kind: string(),
26375
- base64: string(),
26496
+ url: string(),
26376
26497
  sizeBytes: number(),
26377
26498
  timestamp: number()
26378
26499
  });
@@ -32410,6 +32531,12 @@ Object.freeze({
32410
32531
  addonId: null,
32411
32532
  access: "view"
32412
32533
  },
32534
+ "pipelineAnalytics.listEventMedia": {
32535
+ capName: "pipeline-analytics",
32536
+ capScope: "device",
32537
+ addonId: null,
32538
+ access: "view"
32539
+ },
32413
32540
  "pipelineAnalytics.listGroups": {
32414
32541
  capName: "pipeline-analytics",
32415
32542
  capScope: "device",
@@ -36033,6 +36160,11 @@ Object.freeze({
36033
36160
  form: "array",
36034
36161
  optional: false
36035
36162
  }],
36163
+ "pipelineAnalytics.listEventMedia": [{
36164
+ name: "deviceId",
36165
+ form: "single",
36166
+ optional: false
36167
+ }],
36036
36168
  "pipelineAnalytics.listGroups": [{
36037
36169
  name: "deviceIds",
36038
36170
  form: "array",
@@ -8657,6 +8657,21 @@ var RelocateJobSchema = object({
8657
8657
  bytesMoved: number().int(),
8658
8658
  /** Total files discovered up front; null while (or when) unknown. */
8659
8659
  filesTotal: number().int().nullable(),
8660
+ /**
8661
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8662
+ * made that nobody asked for, so it is reported where the operator reads the
8663
+ * job rather than only in a log line.
8664
+ *
8665
+ * A footage segment records its byte count in its own NAME, and the durable
8666
+ * hour row derives its aggregates from those names. A file that does not
8667
+ * match its name therefore makes the ledger's sums — and with them quota and
8668
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8669
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8670
+ *
8671
+ * Absent on lanes where the question has no meaning: a media blob's size is
8672
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8673
+ */
8674
+ rowsReconciled: number().int().nonnegative().optional(),
8660
8675
  startedAt: number(),
8661
8676
  finishedAt: number().nullable(),
8662
8677
  error: string().nullable()
@@ -8725,14 +8740,42 @@ var RelocateMediaInputSchema = object({
8725
8740
  /** Omitted = `move`, the pre-existing behaviour. */
8726
8741
  mode: MediaRelocateModeSchema.optional()
8727
8742
  });
8728
- /** How many rows still carry NO `locationId` — the population a repoint would
8729
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8730
- * value that permits a non-blocking `eventMedia` cutover. */
8731
- var UnstampedEventMediaCountSchema = object({
8732
- media: number().int().nonnegative(),
8733
- retrainFrames: number().int().nonnegative(),
8734
- total: number().int().nonnegative()
8743
+ /**
8744
+ * The unstamped population of ONE collection — split, because the gate and the
8745
+ * operator ask two different questions and only one of them has to be cheap.
8746
+ *
8747
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8748
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8749
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8750
+ * that matters — after a seal, when the population is empty.
8751
+ *
8752
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8753
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8754
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8755
+ * and useful answer: "there are some, and this read could not say how many"
8756
+ * still refuses the cutover, which is the whole job.
8757
+ */
8758
+ var UnstampedRowsSchema = object({
8759
+ present: boolean(),
8760
+ rows: number().int().nonnegative().nullable()
8735
8761
  });
8762
+ /**
8763
+ * How many rows still carry NO `locationId` — the population a repoint would
8764
+ * silently re-aim at a disk that does not hold their bytes.
8765
+ *
8766
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8767
+ * over. The gate opens on a measured absence and on nothing else; an unread
8768
+ * collection and an empty one are different facts, and this repo has already
8769
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8770
+ */
8771
+ var UnstampedEventMediaCountSchema = object({
8772
+ media: UnstampedRowsSchema,
8773
+ retrainFrames: UnstampedRowsSchema,
8774
+ /** True when EITHER collection holds one. The refusal reads this. */
8775
+ anyPresent: boolean(),
8776
+ /** Sum across both, or `null` when either lane could not be counted. */
8777
+ total: number().int().nonnegative().nullable()
8778
+ }).nullable();
8736
8779
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8737
8780
  /** The independently selectable logical storage classes — every class
8738
8781
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8843,6 +8886,10 @@ var StorageMigrationMoveProgressSchema = object({
8843
8886
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8844
8887
  filesTotal: number().int().nonnegative().nullable(),
8845
8888
  bytesMoved: number().int().nonnegative(),
8889
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8890
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8891
+ * rows would be the same failure as one that silently skipped them. */
8892
+ rowsReconciled: number().int().nonnegative().optional(),
8846
8893
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8847
8894
  * crash gets a new mover, and a rate computed from the migration's start
8848
8895
  * would silently average in the time nothing was running. */
@@ -13662,6 +13709,114 @@ method(object({
13662
13709
  height: number()
13663
13710
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13664
13711
  /**
13712
+ * `failure-contribution` — the capability an addon reports its OWN losses
13713
+ * through, per camera, with the denominator attached. It stores nothing.
13714
+ *
13715
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13716
+ *
13717
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13718
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13719
+ * copied: the contributor reports what it already knows, hub-main adds only
13720
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13721
+ * somebody to forget to edit.
13722
+ *
13723
+ * They are not merged, because their invariants are opposites:
13724
+ *
13725
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13726
+ * claim a camera cost nothing, which is a measurement nobody made;
13727
+ * - a `failure-contribution` zero is the **most valuable value on the
13728
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13729
+ * and it is exactly what an absent entry cannot say.
13730
+ *
13731
+ * Putting a loss counter on a cost entry would also break the reconciliation
13732
+ * that gives `load-contribution` its point: contributions are subtracted from
13733
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13734
+ * has no process.
13735
+ *
13736
+ * ## Why not a log line, since the counters already exist
13737
+ *
13738
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13739
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13740
+ * ends in a log line, and a log line is the thing the operator asked to stop
13741
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13742
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13743
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13744
+ * media blackout were both diagnosed. The counters stay; this is where they can
13745
+ * be READ.
13746
+ *
13747
+ * ## The rate is served with its denominator or not at all
13748
+ *
13749
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13750
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13751
+ * than yesterday" and was **flat across twelve hours** once divided by the
13752
+ * successes on the same path. A surface that publishes only the numerator
13753
+ * reproduces that mistake on every read.
13754
+ *
13755
+ * ## Shape
13756
+ *
13757
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13758
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13759
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13760
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13761
+ * a forked runner's entries reach hub-main over transport that already exists.
13762
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13763
+ * result through `system.getFailureContributions`.
13764
+ */
13765
+ var FailureReasonCountSchema = object({
13766
+ /**
13767
+ * Why the attempt did not land, in the contributor's own vocabulary —
13768
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13769
+ * strings that already appear in this repo's logs and, where one exists, the
13770
+ * same string the per-track `previewMissReason` records (D276): a second
13771
+ * vocabulary for the same loss would make the row and the counter
13772
+ * un-joinable.
13773
+ */
13774
+ reason: string(),
13775
+ count: number().int().nonnegative()
13776
+ });
13777
+ var FailureContributionSchema = object({
13778
+ /**
13779
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13780
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13781
+ * `unit` free: the families are owned by different addons and a shared enum
13782
+ * is a central list that rots invisibly.
13783
+ */
13784
+ family: string(),
13785
+ /**
13786
+ * The NUMERIC device id — the same value every log line carries as
13787
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13788
+ * cannot name the camera must not emit the entry, because a fleet total
13789
+ * cannot answer the only question anybody asks of this surface.
13790
+ */
13791
+ deviceId: number().int().positive(),
13792
+ /**
13793
+ * A second dimension inside the family: the model / step id for an inference
13794
+ * timeout, so "which camera AND which model" is one read. Absent when the
13795
+ * family has a single variant.
13796
+ */
13797
+ variant: string().optional(),
13798
+ /**
13799
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13800
+ * differencing two reads must drop the interval when it changes, because the
13801
+ * counter restarted from zero in a respawned runner. Same discipline as
13802
+ * `LoadContribution.startedAtMs`.
13803
+ */
13804
+ sinceMs: number(),
13805
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13806
+ atMs: number(),
13807
+ /**
13808
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13809
+ * window. A failure count published without it is the mistake this schema
13810
+ * exists to make impossible.
13811
+ */
13812
+ attempts: number().int().nonnegative(),
13813
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13814
+ succeeded: number().int().nonnegative(),
13815
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13816
+ reasons: array(FailureReasonCountSchema).readonly()
13817
+ });
13818
+ method(_void(), array(FailureContributionSchema).readonly());
13819
+ /**
13665
13820
  * filesystem-browse — per-node capability for browsing the node's local
13666
13821
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13667
13822
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -14183,6 +14338,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
14183
14338
  kind: "mutation",
14184
14339
  auth: "admin"
14185
14340
  });
14341
+ var LoadContributionSchema = object({
14342
+ role: _enum([
14343
+ "decode",
14344
+ "transcode",
14345
+ "recording",
14346
+ "streaming",
14347
+ "detection"
14348
+ ]),
14349
+ /**
14350
+ * The NUMERIC device id — the same value every log line carries as
14351
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14352
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
14353
+ * contributor that cannot name its camera must not emit the entry at all,
14354
+ * because an unnamed per-camera entry is indistinguishable from a shared one
14355
+ * and would quietly turn one camera's cost into everybody's.
14356
+ */
14357
+ deviceId: number().int().positive().nullable(),
14358
+ attribution: _enum([
14359
+ "measured",
14360
+ "accounted",
14361
+ "unattributable"
14362
+ ]),
14363
+ /**
14364
+ * What ONE entry is, in the contributor's own words — `615/high`,
14365
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14366
+ * family and inventing a common one would lose the only information that
14367
+ * makes two entries for the same camera distinguishable.
14368
+ */
14369
+ unit: string(),
14370
+ /**
14371
+ * The OS process this cost lives in, when there is one. Present so a
14372
+ * consumer can (a) tell two generations of the same unit apart across a
14373
+ * restart, and (b) subtract claimed processes from the node's process
14374
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14375
+ * process of its own.
14376
+ */
14377
+ pid: number().int().positive().optional(),
14378
+ /**
14379
+ * When this generation started. The pid's incarnation marker: a consumer
14380
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14381
+ * window when this changes, because the counter restarted from zero in a new
14382
+ * process.
14383
+ */
14384
+ startedAtMs: number().optional(),
14385
+ /**
14386
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14387
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
14388
+ * contribution is asked for.
14389
+ *
14390
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
14391
+ * needs a sampler, and a new per-node sampler is the defect half of
14392
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14393
+ * by whoever already keeps a history; a rate cannot be un-averaged.
14394
+ *
14395
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14396
+ * an entry with no process.
14397
+ */
14398
+ cpuSeconds: number().optional(),
14399
+ /** Resident bytes of this unit's process, same source and same rules. */
14400
+ rssBytes: number().optional()
14401
+ });
14402
+ method(_void(), array(LoadContributionSchema).readonly());
14186
14403
  /**
14187
14404
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
14188
14405
  * through. It stores nothing.
@@ -14259,176 +14476,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14259
14476
  tags: record(string(), string()).optional()
14260
14477
  }), array(LogEntrySchema).readonly());
14261
14478
  /**
14262
- * `failure-contribution` — the capability an addon reports its OWN losses
14263
- * through, per camera, with the denominator attached. It stores nothing.
14264
- *
14265
- * ## The twin of `load-contribution`, and why it is a twin and not a field
14266
- *
14267
- * `load-contribution` answers *what did this camera COST*. This answers *what
14268
- * did this camera LOSE*. The reporting discipline is identical and deliberately
14269
- * copied: the contributor reports what it already knows, hub-main adds only
14270
- * `addonId`, nothing needs global knowledge, and there is no central list for
14271
- * somebody to forget to edit.
14272
- *
14273
- * They are not merged, because their invariants are opposites:
14274
- *
14275
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
14276
- * claim a camera cost nothing, which is a measurement nobody made;
14277
- * - a `failure-contribution` zero is the **most valuable value on the
14278
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
14279
- * and it is exactly what an absent entry cannot say.
14280
- *
14281
- * Putting a loss counter on a cost entry would also break the reconciliation
14282
- * that gives `load-contribution` its point: contributions are subtracted from
14283
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
14284
- * has no process.
14285
- *
14286
- * ## Why not a log line, since the counters already exist
14287
- *
14288
- * Several of these paths already counted themselves — `CaptureScheduler`'s
14289
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
14290
- * ends in a log line, and a log line is the thing the operator asked to stop
14291
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
14292
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
14293
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
14294
- * media blackout were both diagnosed. The counters stay; this is where they can
14295
- * be READ.
14296
- *
14297
- * ## The rate is served with its denominator or not at all
14298
- *
14299
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
14300
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
14301
- * than yesterday" and was **flat across twelve hours** once divided by the
14302
- * successes on the same path. A surface that publishes only the numerator
14303
- * reproduces that mistake on every read.
14304
- *
14305
- * ## Shape
14306
- *
14307
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
14308
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
14309
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
14310
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
14311
- * a forked runner's entries reach hub-main over transport that already exists.
14312
- * No new UDS message, no second registry (D3). The operator reads the assembled
14313
- * result through `system.getFailureContributions`.
14314
- */
14315
- var FailureReasonCountSchema = object({
14316
- /**
14317
- * Why the attempt did not land, in the contributor's own vocabulary —
14318
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
14319
- * strings that already appear in this repo's logs and, where one exists, the
14320
- * same string the per-track `previewMissReason` records (D276): a second
14321
- * vocabulary for the same loss would make the row and the counter
14322
- * un-joinable.
14323
- */
14324
- reason: string(),
14325
- count: number().int().nonnegative()
14326
- });
14327
- var FailureContributionSchema = object({
14328
- /**
14329
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
14330
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
14331
- * `unit` free: the families are owned by different addons and a shared enum
14332
- * is a central list that rots invisibly.
14333
- */
14334
- family: string(),
14335
- /**
14336
- * The NUMERIC device id — the same value every log line carries as
14337
- * `tags.deviceId`. Never nullable and never absent: a contributor that
14338
- * cannot name the camera must not emit the entry, because a fleet total
14339
- * cannot answer the only question anybody asks of this surface.
14340
- */
14341
- deviceId: number().int().positive(),
14342
- /**
14343
- * A second dimension inside the family: the model / step id for an inference
14344
- * timeout, so "which camera AND which model" is one read. Absent when the
14345
- * family has a single variant.
14346
- */
14347
- variant: string().optional(),
14348
- /**
14349
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
14350
- * differencing two reads must drop the interval when it changes, because the
14351
- * counter restarted from zero in a respawned runner. Same discipline as
14352
- * `LoadContribution.startedAtMs`.
14353
- */
14354
- sinceMs: number(),
14355
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
14356
- atMs: number(),
14357
- /**
14358
- * THE DENOMINATOR — every attempt on this path for this camera in the
14359
- * window. A failure count published without it is the mistake this schema
14360
- * exists to make impossible.
14361
- */
14362
- attempts: number().int().nonnegative(),
14363
- /** Attempts that landed. `attempts - succeeded` is the loss. */
14364
- succeeded: number().int().nonnegative(),
14365
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
14366
- reasons: array(FailureReasonCountSchema).readonly()
14367
- });
14368
- method(_void(), array(FailureContributionSchema).readonly());
14369
- var LoadContributionSchema = object({
14370
- role: _enum([
14371
- "decode",
14372
- "transcode",
14373
- "recording",
14374
- "streaming",
14375
- "detection"
14376
- ]),
14377
- /**
14378
- * The NUMERIC device id — the same value every log line carries as
14379
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14380
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
14381
- * contributor that cannot name its camera must not emit the entry at all,
14382
- * because an unnamed per-camera entry is indistinguishable from a shared one
14383
- * and would quietly turn one camera's cost into everybody's.
14384
- */
14385
- deviceId: number().int().positive().nullable(),
14386
- attribution: _enum([
14387
- "measured",
14388
- "accounted",
14389
- "unattributable"
14390
- ]),
14391
- /**
14392
- * What ONE entry is, in the contributor's own words — `615/high`,
14393
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14394
- * family and inventing a common one would lose the only information that
14395
- * makes two entries for the same camera distinguishable.
14396
- */
14397
- unit: string(),
14398
- /**
14399
- * The OS process this cost lives in, when there is one. Present so a
14400
- * consumer can (a) tell two generations of the same unit apart across a
14401
- * restart, and (b) subtract claimed processes from the node's process
14402
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14403
- * process of its own.
14404
- */
14405
- pid: number().int().positive().optional(),
14406
- /**
14407
- * When this generation started. The pid's incarnation marker: a consumer
14408
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14409
- * window when this changes, because the counter restarted from zero in a new
14410
- * process.
14411
- */
14412
- startedAtMs: number().optional(),
14413
- /**
14414
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14415
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
14416
- * contribution is asked for.
14417
- *
14418
- * Cumulative and not a rate on purpose: a rate needs a window, a window
14419
- * needs a sampler, and a new per-node sampler is the defect half of
14420
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14421
- * by whoever already keeps a history; a rate cannot be un-averaged.
14422
- *
14423
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14424
- * an entry with no process.
14425
- */
14426
- cpuSeconds: number().optional(),
14427
- /** Resident bytes of this unit's process, same source and same rules. */
14428
- rssBytes: number().optional()
14429
- });
14430
- method(_void(), array(LoadContributionSchema).readonly());
14431
- /**
14432
14479
  * `login-method` — collection cap through which auth addons contribute
14433
14480
  * their pre-auth login surfaces to the login page. This is the SINGLE,
14434
14481
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -19088,12 +19135,53 @@ var MediaFileKindEnum = _enum([
19088
19135
  "keyFrameSmall",
19089
19136
  "thumbnailSmall"
19090
19137
  ]);
19138
+ /**
19139
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
19140
+ * ARE — never the bytes themselves.
19141
+ *
19142
+ * ## Why `url` and not `base64`
19143
+ *
19144
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
19145
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
19146
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
19147
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
19148
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
19149
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
19150
+ *
19151
+ * `url` points at the `event-media` data plane
19152
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
19153
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
19154
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
19155
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
19156
+ * no less protected than they were inside a `view`-level cap response — see
19157
+ * `data-plane-access.ts` for the rule and the one gap it does not close
19158
+ * (per-device scoping).
19159
+ *
19160
+ * The URL is built from the row's **stored** key, which is not always its
19161
+ * published `kind`: a track's face/plate crop is stored as `crop` under
19162
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
19163
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
19164
+ *
19165
+ * ## `base64` is TRANSITIONAL and is going away
19166
+ *
19167
+ * It is still populated for one reason: the deployed viewer's track-detail
19168
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
19169
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
19170
+ * triangle — not as absence. Removing the field before that viewer ships is an
19171
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
19172
+ * delete this line and the `withBytes` pass-through in
19173
+ * `analytics-query-facade.ts`; nothing else reads it.
19174
+ */
19091
19175
  var MediaFileSchema = object({
19092
19176
  key: string(),
19093
19177
  kind: MediaFileKindEnum,
19094
- base64: string(),
19095
19178
  sizeBytes: number(),
19096
19179
  timestamp: number()
19180
+ }).extend({
19181
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
19182
+ url: string(),
19183
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
19184
+ base64: string()
19097
19185
  });
19098
19186
  /**
19099
19187
  * One media row WITHOUT its bytes.
@@ -19105,7 +19193,9 @@ var MediaFileSchema = object({
19105
19193
  * blocks the whole view.
19106
19194
  *
19107
19195
  * `sizeBytes` is carried because it is what lets a client decide between the
19108
- * stored blob and a `?variant=thumb` rendering without fetching either.
19196
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
19197
+ * `url` because a client that had to build the plane path itself is a second
19198
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
19109
19199
  */
19110
19200
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
19111
19201
  /**
@@ -19794,6 +19884,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19794
19884
  }), array(MediaFileSchema).readonly()), method(object({
19795
19885
  trackId: string(),
19796
19886
  deviceId: number()
19887
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19888
+ eventId: string(),
19889
+ deviceId: number()
19797
19890
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19798
19891
  kind: "mutation",
19799
19892
  auth: "admin"
@@ -24074,10 +24167,24 @@ var FaceClusterSchema = object({
24074
24167
  size: number().int(),
24075
24168
  cohesion: number()
24076
24169
  });
24170
+ /**
24171
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
24172
+ * are — never the bytes.
24173
+ *
24174
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
24175
+ * track/event contract) is still populated because a deployed viewer requires
24176
+ * the field to parse a row at all; this method has no such reader. Its ONE
24177
+ * caller is the admin UI's detail modal, which was building
24178
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
24179
+ * dialog already rendering its key FRAME from the `event-media` plane.
24180
+ *
24181
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
24182
+ * media key directly, so this needed no new plane and no new access decision.
24183
+ */
24077
24184
  var MediaFileLiteSchema$1 = object({
24078
24185
  key: string(),
24079
24186
  kind: string(),
24080
- base64: string(),
24187
+ url: string(),
24081
24188
  sizeBytes: number(),
24082
24189
  timestamp: number()
24083
24190
  });
@@ -26357,10 +26464,24 @@ var PlateInfoSchema = object({
26357
26464
  */
26358
26465
  cropUrl: string().optional()
26359
26466
  });
26467
+ /**
26468
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
26469
+ * are — never the bytes.
26470
+ *
26471
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
26472
+ * track/event contract) is still populated because a deployed viewer requires
26473
+ * the field to parse a row at all; this method has no such reader. Its ONE
26474
+ * caller is the admin UI's detail modal, which was building
26475
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
26476
+ * dialog already rendering its key FRAME from the `event-media` plane.
26477
+ *
26478
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
26479
+ * media key directly, so this needed no new plane and no new access decision.
26480
+ */
26360
26481
  var MediaFileLiteSchema = object({
26361
26482
  key: string(),
26362
26483
  kind: string(),
26363
- base64: string(),
26484
+ url: string(),
26364
26485
  sizeBytes: number(),
26365
26486
  timestamp: number()
26366
26487
  });
@@ -32398,6 +32519,12 @@ Object.freeze({
32398
32519
  addonId: null,
32399
32520
  access: "view"
32400
32521
  },
32522
+ "pipelineAnalytics.listEventMedia": {
32523
+ capName: "pipeline-analytics",
32524
+ capScope: "device",
32525
+ addonId: null,
32526
+ access: "view"
32527
+ },
32401
32528
  "pipelineAnalytics.listGroups": {
32402
32529
  capName: "pipeline-analytics",
32403
32530
  capScope: "device",
@@ -36021,6 +36148,11 @@ Object.freeze({
36021
36148
  form: "array",
36022
36149
  optional: false
36023
36150
  }],
36151
+ "pipelineAnalytics.listEventMedia": [{
36152
+ name: "deviceId",
36153
+ form: "single",
36154
+ optional: false
36155
+ }],
36024
36156
  "pipelineAnalytics.listGroups": [{
36025
36157
  name: "deviceIds",
36026
36158
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-hap",
3
- "version": "1.2.56",
3
+ "version": "1.2.58",
4
4
  "description": "HomeKit (HAP) exporter for CamStack devices. Publishes each exposed device as its own HomeKit accessory: cameras and doorbells with SRTP streaming, HomeKit Secure Video, motion, two-way audio, PTZ and battery; switches, lights, locks and sensors through a capability→service table.",
5
5
  "keywords": [
6
6
  "camstack",