@camstack/addon-notifiers 1.2.49 → 1.2.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +313 -181
  2. package/dist/addon.mjs +313 -181
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8136,6 +8136,21 @@ var RelocateJobSchema = object({
8136
8136
  bytesMoved: number().int(),
8137
8137
  /** Total files discovered up front; null while (or when) unknown. */
8138
8138
  filesTotal: number().int().nullable(),
8139
+ /**
8140
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8141
+ * made that nobody asked for, so it is reported where the operator reads the
8142
+ * job rather than only in a log line.
8143
+ *
8144
+ * A footage segment records its byte count in its own NAME, and the durable
8145
+ * hour row derives its aggregates from those names. A file that does not
8146
+ * match its name therefore makes the ledger's sums — and with them quota and
8147
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8148
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8149
+ *
8150
+ * Absent on lanes where the question has no meaning: a media blob's size is
8151
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8152
+ */
8153
+ rowsReconciled: number().int().nonnegative().optional(),
8139
8154
  startedAt: number(),
8140
8155
  finishedAt: number().nullable(),
8141
8156
  error: string().nullable()
@@ -8204,14 +8219,42 @@ var RelocateMediaInputSchema = object({
8204
8219
  /** Omitted = `move`, the pre-existing behaviour. */
8205
8220
  mode: MediaRelocateModeSchema.optional()
8206
8221
  });
8207
- /** How many rows still carry NO `locationId` — the population a repoint would
8208
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8209
- * value that permits a non-blocking `eventMedia` cutover. */
8210
- var UnstampedEventMediaCountSchema = object({
8211
- media: number().int().nonnegative(),
8212
- retrainFrames: number().int().nonnegative(),
8213
- total: number().int().nonnegative()
8222
+ /**
8223
+ * The unstamped population of ONE collection — split, because the gate and the
8224
+ * operator ask two different questions and only one of them has to be cheap.
8225
+ *
8226
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8227
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8228
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8229
+ * that matters — after a seal, when the population is empty.
8230
+ *
8231
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8232
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8233
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8234
+ * and useful answer: "there are some, and this read could not say how many"
8235
+ * still refuses the cutover, which is the whole job.
8236
+ */
8237
+ var UnstampedRowsSchema = object({
8238
+ present: boolean(),
8239
+ rows: number().int().nonnegative().nullable()
8214
8240
  });
8241
+ /**
8242
+ * How many rows still carry NO `locationId` — the population a repoint would
8243
+ * silently re-aim at a disk that does not hold their bytes.
8244
+ *
8245
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8246
+ * over. The gate opens on a measured absence and on nothing else; an unread
8247
+ * collection and an empty one are different facts, and this repo has already
8248
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8249
+ */
8250
+ var UnstampedEventMediaCountSchema = object({
8251
+ media: UnstampedRowsSchema,
8252
+ retrainFrames: UnstampedRowsSchema,
8253
+ /** True when EITHER collection holds one. The refusal reads this. */
8254
+ anyPresent: boolean(),
8255
+ /** Sum across both, or `null` when either lane could not be counted. */
8256
+ total: number().int().nonnegative().nullable()
8257
+ }).nullable();
8215
8258
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8216
8259
  /** The independently selectable logical storage classes — every class
8217
8260
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8322,6 +8365,10 @@ var StorageMigrationMoveProgressSchema = object({
8322
8365
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8323
8366
  filesTotal: number().int().nonnegative().nullable(),
8324
8367
  bytesMoved: number().int().nonnegative(),
8368
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8369
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8370
+ * rows would be the same failure as one that silently skipped them. */
8371
+ rowsReconciled: number().int().nonnegative().optional(),
8325
8372
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8326
8373
  * crash gets a new mover, and a rate computed from the migration's start
8327
8374
  * would silently average in the time nothing was running. */
@@ -13047,6 +13094,114 @@ method(object({
13047
13094
  height: number()
13048
13095
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13049
13096
  /**
13097
+ * `failure-contribution` — the capability an addon reports its OWN losses
13098
+ * through, per camera, with the denominator attached. It stores nothing.
13099
+ *
13100
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13101
+ *
13102
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13103
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13104
+ * copied: the contributor reports what it already knows, hub-main adds only
13105
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13106
+ * somebody to forget to edit.
13107
+ *
13108
+ * They are not merged, because their invariants are opposites:
13109
+ *
13110
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13111
+ * claim a camera cost nothing, which is a measurement nobody made;
13112
+ * - a `failure-contribution` zero is the **most valuable value on the
13113
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13114
+ * and it is exactly what an absent entry cannot say.
13115
+ *
13116
+ * Putting a loss counter on a cost entry would also break the reconciliation
13117
+ * that gives `load-contribution` its point: contributions are subtracted from
13118
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13119
+ * has no process.
13120
+ *
13121
+ * ## Why not a log line, since the counters already exist
13122
+ *
13123
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13124
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13125
+ * ends in a log line, and a log line is the thing the operator asked to stop
13126
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13127
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13128
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13129
+ * media blackout were both diagnosed. The counters stay; this is where they can
13130
+ * be READ.
13131
+ *
13132
+ * ## The rate is served with its denominator or not at all
13133
+ *
13134
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13135
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13136
+ * than yesterday" and was **flat across twelve hours** once divided by the
13137
+ * successes on the same path. A surface that publishes only the numerator
13138
+ * reproduces that mistake on every read.
13139
+ *
13140
+ * ## Shape
13141
+ *
13142
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13143
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13144
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13145
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13146
+ * a forked runner's entries reach hub-main over transport that already exists.
13147
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13148
+ * result through `system.getFailureContributions`.
13149
+ */
13150
+ var FailureReasonCountSchema = object({
13151
+ /**
13152
+ * Why the attempt did not land, in the contributor's own vocabulary —
13153
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13154
+ * strings that already appear in this repo's logs and, where one exists, the
13155
+ * same string the per-track `previewMissReason` records (D276): a second
13156
+ * vocabulary for the same loss would make the row and the counter
13157
+ * un-joinable.
13158
+ */
13159
+ reason: string(),
13160
+ count: number().int().nonnegative()
13161
+ });
13162
+ var FailureContributionSchema = object({
13163
+ /**
13164
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13165
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13166
+ * `unit` free: the families are owned by different addons and a shared enum
13167
+ * is a central list that rots invisibly.
13168
+ */
13169
+ family: string(),
13170
+ /**
13171
+ * The NUMERIC device id — the same value every log line carries as
13172
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13173
+ * cannot name the camera must not emit the entry, because a fleet total
13174
+ * cannot answer the only question anybody asks of this surface.
13175
+ */
13176
+ deviceId: number().int().positive(),
13177
+ /**
13178
+ * A second dimension inside the family: the model / step id for an inference
13179
+ * timeout, so "which camera AND which model" is one read. Absent when the
13180
+ * family has a single variant.
13181
+ */
13182
+ variant: string().optional(),
13183
+ /**
13184
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13185
+ * differencing two reads must drop the interval when it changes, because the
13186
+ * counter restarted from zero in a respawned runner. Same discipline as
13187
+ * `LoadContribution.startedAtMs`.
13188
+ */
13189
+ sinceMs: number(),
13190
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13191
+ atMs: number(),
13192
+ /**
13193
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13194
+ * window. A failure count published without it is the mistake this schema
13195
+ * exists to make impossible.
13196
+ */
13197
+ attempts: number().int().nonnegative(),
13198
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13199
+ succeeded: number().int().nonnegative(),
13200
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13201
+ reasons: array(FailureReasonCountSchema).readonly()
13202
+ });
13203
+ method(_void(), array(FailureContributionSchema).readonly());
13204
+ /**
13050
13205
  * filesystem-browse — per-node capability for browsing the node's local
13051
13206
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13052
13207
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13568,6 +13723,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13568
13723
  kind: "mutation",
13569
13724
  auth: "admin"
13570
13725
  });
13726
+ var LoadContributionSchema = object({
13727
+ role: _enum([
13728
+ "decode",
13729
+ "transcode",
13730
+ "recording",
13731
+ "streaming",
13732
+ "detection"
13733
+ ]),
13734
+ /**
13735
+ * The NUMERIC device id — the same value every log line carries as
13736
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13737
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13738
+ * contributor that cannot name its camera must not emit the entry at all,
13739
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13740
+ * and would quietly turn one camera's cost into everybody's.
13741
+ */
13742
+ deviceId: number().int().positive().nullable(),
13743
+ attribution: _enum([
13744
+ "measured",
13745
+ "accounted",
13746
+ "unattributable"
13747
+ ]),
13748
+ /**
13749
+ * What ONE entry is, in the contributor's own words — `615/high`,
13750
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13751
+ * family and inventing a common one would lose the only information that
13752
+ * makes two entries for the same camera distinguishable.
13753
+ */
13754
+ unit: string(),
13755
+ /**
13756
+ * The OS process this cost lives in, when there is one. Present so a
13757
+ * consumer can (a) tell two generations of the same unit apart across a
13758
+ * restart, and (b) subtract claimed processes from the node's process
13759
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13760
+ * process of its own.
13761
+ */
13762
+ pid: number().int().positive().optional(),
13763
+ /**
13764
+ * When this generation started. The pid's incarnation marker: a consumer
13765
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13766
+ * window when this changes, because the counter restarted from zero in a new
13767
+ * process.
13768
+ */
13769
+ startedAtMs: number().optional(),
13770
+ /**
13771
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13772
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13773
+ * contribution is asked for.
13774
+ *
13775
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13776
+ * needs a sampler, and a new per-node sampler is the defect half of
13777
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13778
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13779
+ *
13780
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13781
+ * an entry with no process.
13782
+ */
13783
+ cpuSeconds: number().optional(),
13784
+ /** Resident bytes of this unit's process, same source and same rules. */
13785
+ rssBytes: number().optional()
13786
+ });
13787
+ method(_void(), array(LoadContributionSchema).readonly());
13571
13788
  /**
13572
13789
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13573
13790
  * through. It stores nothing.
@@ -13644,176 +13861,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13644
13861
  tags: record(string(), string()).optional()
13645
13862
  }), array(LogEntrySchema).readonly());
13646
13863
  /**
13647
- * `failure-contribution` — the capability an addon reports its OWN losses
13648
- * through, per camera, with the denominator attached. It stores nothing.
13649
- *
13650
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13651
- *
13652
- * `load-contribution` answers *what did this camera COST*. This answers *what
13653
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13654
- * copied: the contributor reports what it already knows, hub-main adds only
13655
- * `addonId`, nothing needs global knowledge, and there is no central list for
13656
- * somebody to forget to edit.
13657
- *
13658
- * They are not merged, because their invariants are opposites:
13659
- *
13660
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13661
- * claim a camera cost nothing, which is a measurement nobody made;
13662
- * - a `failure-contribution` zero is the **most valuable value on the
13663
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13664
- * and it is exactly what an absent entry cannot say.
13665
- *
13666
- * Putting a loss counter on a cost entry would also break the reconciliation
13667
- * that gives `load-contribution` its point: contributions are subtracted from
13668
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13669
- * has no process.
13670
- *
13671
- * ## Why not a log line, since the counters already exist
13672
- *
13673
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13674
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13675
- * ends in a log line, and a log line is the thing the operator asked to stop
13676
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13677
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13678
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13679
- * media blackout were both diagnosed. The counters stay; this is where they can
13680
- * be READ.
13681
- *
13682
- * ## The rate is served with its denominator or not at all
13683
- *
13684
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13685
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13686
- * than yesterday" and was **flat across twelve hours** once divided by the
13687
- * successes on the same path. A surface that publishes only the numerator
13688
- * reproduces that mistake on every read.
13689
- *
13690
- * ## Shape
13691
- *
13692
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13693
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13694
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13695
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13696
- * a forked runner's entries reach hub-main over transport that already exists.
13697
- * No new UDS message, no second registry (D3). The operator reads the assembled
13698
- * result through `system.getFailureContributions`.
13699
- */
13700
- var FailureReasonCountSchema = object({
13701
- /**
13702
- * Why the attempt did not land, in the contributor's own vocabulary —
13703
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13704
- * strings that already appear in this repo's logs and, where one exists, the
13705
- * same string the per-track `previewMissReason` records (D276): a second
13706
- * vocabulary for the same loss would make the row and the counter
13707
- * un-joinable.
13708
- */
13709
- reason: string(),
13710
- count: number().int().nonnegative()
13711
- });
13712
- var FailureContributionSchema = object({
13713
- /**
13714
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13715
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13716
- * `unit` free: the families are owned by different addons and a shared enum
13717
- * is a central list that rots invisibly.
13718
- */
13719
- family: string(),
13720
- /**
13721
- * The NUMERIC device id — the same value every log line carries as
13722
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13723
- * cannot name the camera must not emit the entry, because a fleet total
13724
- * cannot answer the only question anybody asks of this surface.
13725
- */
13726
- deviceId: number().int().positive(),
13727
- /**
13728
- * A second dimension inside the family: the model / step id for an inference
13729
- * timeout, so "which camera AND which model" is one read. Absent when the
13730
- * family has a single variant.
13731
- */
13732
- variant: string().optional(),
13733
- /**
13734
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13735
- * differencing two reads must drop the interval when it changes, because the
13736
- * counter restarted from zero in a respawned runner. Same discipline as
13737
- * `LoadContribution.startedAtMs`.
13738
- */
13739
- sinceMs: number(),
13740
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13741
- atMs: number(),
13742
- /**
13743
- * THE DENOMINATOR — every attempt on this path for this camera in the
13744
- * window. A failure count published without it is the mistake this schema
13745
- * exists to make impossible.
13746
- */
13747
- attempts: number().int().nonnegative(),
13748
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13749
- succeeded: number().int().nonnegative(),
13750
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13751
- reasons: array(FailureReasonCountSchema).readonly()
13752
- });
13753
- method(_void(), array(FailureContributionSchema).readonly());
13754
- var LoadContributionSchema = object({
13755
- role: _enum([
13756
- "decode",
13757
- "transcode",
13758
- "recording",
13759
- "streaming",
13760
- "detection"
13761
- ]),
13762
- /**
13763
- * The NUMERIC device id — the same value every log line carries as
13764
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13765
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13766
- * contributor that cannot name its camera must not emit the entry at all,
13767
- * because an unnamed per-camera entry is indistinguishable from a shared one
13768
- * and would quietly turn one camera's cost into everybody's.
13769
- */
13770
- deviceId: number().int().positive().nullable(),
13771
- attribution: _enum([
13772
- "measured",
13773
- "accounted",
13774
- "unattributable"
13775
- ]),
13776
- /**
13777
- * What ONE entry is, in the contributor's own words — `615/high`,
13778
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13779
- * family and inventing a common one would lose the only information that
13780
- * makes two entries for the same camera distinguishable.
13781
- */
13782
- unit: string(),
13783
- /**
13784
- * The OS process this cost lives in, when there is one. Present so a
13785
- * consumer can (a) tell two generations of the same unit apart across a
13786
- * restart, and (b) subtract claimed processes from the node's process
13787
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13788
- * process of its own.
13789
- */
13790
- pid: number().int().positive().optional(),
13791
- /**
13792
- * When this generation started. The pid's incarnation marker: a consumer
13793
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13794
- * window when this changes, because the counter restarted from zero in a new
13795
- * process.
13796
- */
13797
- startedAtMs: number().optional(),
13798
- /**
13799
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13800
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13801
- * contribution is asked for.
13802
- *
13803
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13804
- * needs a sampler, and a new per-node sampler is the defect half of
13805
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13806
- * by whoever already keeps a history; a rate cannot be un-averaged.
13807
- *
13808
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13809
- * an entry with no process.
13810
- */
13811
- cpuSeconds: number().optional(),
13812
- /** Resident bytes of this unit's process, same source and same rules. */
13813
- rssBytes: number().optional()
13814
- });
13815
- method(_void(), array(LoadContributionSchema).readonly());
13816
- /**
13817
13864
  * `login-method` — collection cap through which auth addons contribute
13818
13865
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13819
13866
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18487,12 +18534,53 @@ var MediaFileKindEnum = _enum([
18487
18534
  "keyFrameSmall",
18488
18535
  "thumbnailSmall"
18489
18536
  ]);
18537
+ /**
18538
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18539
+ * ARE — never the bytes themselves.
18540
+ *
18541
+ * ## Why `url` and not `base64`
18542
+ *
18543
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18544
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18545
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18546
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18547
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18548
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18549
+ *
18550
+ * `url` points at the `event-media` data plane
18551
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18552
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18553
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18554
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18555
+ * no less protected than they were inside a `view`-level cap response — see
18556
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18557
+ * (per-device scoping).
18558
+ *
18559
+ * The URL is built from the row's **stored** key, which is not always its
18560
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18561
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18562
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18563
+ *
18564
+ * ## `base64` is TRANSITIONAL and is going away
18565
+ *
18566
+ * It is still populated for one reason: the deployed viewer's track-detail
18567
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18568
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18569
+ * triangle — not as absence. Removing the field before that viewer ships is an
18570
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18571
+ * delete this line and the `withBytes` pass-through in
18572
+ * `analytics-query-facade.ts`; nothing else reads it.
18573
+ */
18490
18574
  var MediaFileSchema = object({
18491
18575
  key: string(),
18492
18576
  kind: MediaFileKindEnum,
18493
- base64: string(),
18494
18577
  sizeBytes: number(),
18495
18578
  timestamp: number()
18579
+ }).extend({
18580
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18581
+ url: string(),
18582
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18583
+ base64: string()
18496
18584
  });
18497
18585
  /**
18498
18586
  * One media row WITHOUT its bytes.
@@ -18504,7 +18592,9 @@ var MediaFileSchema = object({
18504
18592
  * blocks the whole view.
18505
18593
  *
18506
18594
  * `sizeBytes` is carried because it is what lets a client decide between the
18507
- * stored blob and a `?variant=thumb` rendering without fetching either.
18595
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18596
+ * `url` because a client that had to build the plane path itself is a second
18597
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18508
18598
  */
18509
18599
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18510
18600
  /**
@@ -19193,6 +19283,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19193
19283
  }), array(MediaFileSchema).readonly()), method(object({
19194
19284
  trackId: string(),
19195
19285
  deviceId: number()
19286
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19287
+ eventId: string(),
19288
+ deviceId: number()
19196
19289
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19197
19290
  kind: "mutation",
19198
19291
  auth: "admin"
@@ -23453,10 +23546,24 @@ var FaceClusterSchema = object({
23453
23546
  size: number().int(),
23454
23547
  cohesion: number()
23455
23548
  });
23549
+ /**
23550
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23551
+ * are — never the bytes.
23552
+ *
23553
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23554
+ * track/event contract) is still populated because a deployed viewer requires
23555
+ * the field to parse a row at all; this method has no such reader. Its ONE
23556
+ * caller is the admin UI's detail modal, which was building
23557
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23558
+ * dialog already rendering its key FRAME from the `event-media` plane.
23559
+ *
23560
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23561
+ * media key directly, so this needed no new plane and no new access decision.
23562
+ */
23456
23563
  var MediaFileLiteSchema$1 = object({
23457
23564
  key: string(),
23458
23565
  kind: string(),
23459
- base64: string(),
23566
+ url: string(),
23460
23567
  sizeBytes: number(),
23461
23568
  timestamp: number()
23462
23569
  });
@@ -25708,10 +25815,24 @@ var PlateInfoSchema = object({
25708
25815
  */
25709
25816
  cropUrl: string().optional()
25710
25817
  });
25818
+ /**
25819
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25820
+ * are — never the bytes.
25821
+ *
25822
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25823
+ * track/event contract) is still populated because a deployed viewer requires
25824
+ * the field to parse a row at all; this method has no such reader. Its ONE
25825
+ * caller is the admin UI's detail modal, which was building
25826
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25827
+ * dialog already rendering its key FRAME from the `event-media` plane.
25828
+ *
25829
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25830
+ * media key directly, so this needed no new plane and no new access decision.
25831
+ */
25711
25832
  var MediaFileLiteSchema = object({
25712
25833
  key: string(),
25713
25834
  kind: string(),
25714
- base64: string(),
25835
+ url: string(),
25715
25836
  sizeBytes: number(),
25716
25837
  timestamp: number()
25717
25838
  });
@@ -31724,6 +31845,12 @@ Object.freeze({
31724
31845
  addonId: null,
31725
31846
  access: "view"
31726
31847
  },
31848
+ "pipelineAnalytics.listEventMedia": {
31849
+ capName: "pipeline-analytics",
31850
+ capScope: "device",
31851
+ addonId: null,
31852
+ access: "view"
31853
+ },
31727
31854
  "pipelineAnalytics.listGroups": {
31728
31855
  capName: "pipeline-analytics",
31729
31856
  capScope: "device",
@@ -35347,6 +35474,11 @@ Object.freeze({
35347
35474
  form: "array",
35348
35475
  optional: false
35349
35476
  }],
35477
+ "pipelineAnalytics.listEventMedia": [{
35478
+ name: "deviceId",
35479
+ form: "single",
35480
+ optional: false
35481
+ }],
35350
35482
  "pipelineAnalytics.listGroups": [{
35351
35483
  name: "deviceIds",
35352
35484
  form: "array",
package/dist/addon.mjs CHANGED
@@ -8109,6 +8109,21 @@ var RelocateJobSchema = object({
8109
8109
  bytesMoved: number().int(),
8110
8110
  /** Total files discovered up front; null while (or when) unknown. */
8111
8111
  filesTotal: number().int().nullable(),
8112
+ /**
8113
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8114
+ * made that nobody asked for, so it is reported where the operator reads the
8115
+ * job rather than only in a log line.
8116
+ *
8117
+ * A footage segment records its byte count in its own NAME, and the durable
8118
+ * hour row derives its aggregates from those names. A file that does not
8119
+ * match its name therefore makes the ledger's sums — and with them quota and
8120
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8121
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8122
+ *
8123
+ * Absent on lanes where the question has no meaning: a media blob's size is
8124
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8125
+ */
8126
+ rowsReconciled: number().int().nonnegative().optional(),
8112
8127
  startedAt: number(),
8113
8128
  finishedAt: number().nullable(),
8114
8129
  error: string().nullable()
@@ -8177,14 +8192,42 @@ var RelocateMediaInputSchema = object({
8177
8192
  /** Omitted = `move`, the pre-existing behaviour. */
8178
8193
  mode: MediaRelocateModeSchema.optional()
8179
8194
  });
8180
- /** How many rows still carry NO `locationId` — the population a repoint would
8181
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8182
- * value that permits a non-blocking `eventMedia` cutover. */
8183
- var UnstampedEventMediaCountSchema = object({
8184
- media: number().int().nonnegative(),
8185
- retrainFrames: number().int().nonnegative(),
8186
- total: number().int().nonnegative()
8195
+ /**
8196
+ * The unstamped population of ONE collection — split, because the gate and the
8197
+ * operator ask two different questions and only one of them has to be cheap.
8198
+ *
8199
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8200
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8201
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8202
+ * that matters — after a seal, when the population is empty.
8203
+ *
8204
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8205
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8206
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8207
+ * and useful answer: "there are some, and this read could not say how many"
8208
+ * still refuses the cutover, which is the whole job.
8209
+ */
8210
+ var UnstampedRowsSchema = object({
8211
+ present: boolean(),
8212
+ rows: number().int().nonnegative().nullable()
8187
8213
  });
8214
+ /**
8215
+ * How many rows still carry NO `locationId` — the population a repoint would
8216
+ * silently re-aim at a disk that does not hold their bytes.
8217
+ *
8218
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8219
+ * over. The gate opens on a measured absence and on nothing else; an unread
8220
+ * collection and an empty one are different facts, and this repo has already
8221
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8222
+ */
8223
+ var UnstampedEventMediaCountSchema = object({
8224
+ media: UnstampedRowsSchema,
8225
+ retrainFrames: UnstampedRowsSchema,
8226
+ /** True when EITHER collection holds one. The refusal reads this. */
8227
+ anyPresent: boolean(),
8228
+ /** Sum across both, or `null` when either lane could not be counted. */
8229
+ total: number().int().nonnegative().nullable()
8230
+ }).nullable();
8188
8231
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8189
8232
  /** The independently selectable logical storage classes — every class
8190
8233
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8295,6 +8338,10 @@ var StorageMigrationMoveProgressSchema = object({
8295
8338
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8296
8339
  filesTotal: number().int().nonnegative().nullable(),
8297
8340
  bytesMoved: number().int().nonnegative(),
8341
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8342
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8343
+ * rows would be the same failure as one that silently skipped them. */
8344
+ rowsReconciled: number().int().nonnegative().optional(),
8298
8345
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8299
8346
  * crash gets a new mover, and a rate computed from the migration's start
8300
8347
  * would silently average in the time nothing was running. */
@@ -13020,6 +13067,114 @@ method(object({
13020
13067
  height: number()
13021
13068
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13022
13069
  /**
13070
+ * `failure-contribution` — the capability an addon reports its OWN losses
13071
+ * through, per camera, with the denominator attached. It stores nothing.
13072
+ *
13073
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13074
+ *
13075
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13076
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13077
+ * copied: the contributor reports what it already knows, hub-main adds only
13078
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13079
+ * somebody to forget to edit.
13080
+ *
13081
+ * They are not merged, because their invariants are opposites:
13082
+ *
13083
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13084
+ * claim a camera cost nothing, which is a measurement nobody made;
13085
+ * - a `failure-contribution` zero is the **most valuable value on the
13086
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13087
+ * and it is exactly what an absent entry cannot say.
13088
+ *
13089
+ * Putting a loss counter on a cost entry would also break the reconciliation
13090
+ * that gives `load-contribution` its point: contributions are subtracted from
13091
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13092
+ * has no process.
13093
+ *
13094
+ * ## Why not a log line, since the counters already exist
13095
+ *
13096
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13097
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13098
+ * ends in a log line, and a log line is the thing the operator asked to stop
13099
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13100
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13101
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13102
+ * media blackout were both diagnosed. The counters stay; this is where they can
13103
+ * be READ.
13104
+ *
13105
+ * ## The rate is served with its denominator or not at all
13106
+ *
13107
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13108
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13109
+ * than yesterday" and was **flat across twelve hours** once divided by the
13110
+ * successes on the same path. A surface that publishes only the numerator
13111
+ * reproduces that mistake on every read.
13112
+ *
13113
+ * ## Shape
13114
+ *
13115
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13116
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13117
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13118
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13119
+ * a forked runner's entries reach hub-main over transport that already exists.
13120
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13121
+ * result through `system.getFailureContributions`.
13122
+ */
13123
+ var FailureReasonCountSchema = object({
13124
+ /**
13125
+ * Why the attempt did not land, in the contributor's own vocabulary —
13126
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13127
+ * strings that already appear in this repo's logs and, where one exists, the
13128
+ * same string the per-track `previewMissReason` records (D276): a second
13129
+ * vocabulary for the same loss would make the row and the counter
13130
+ * un-joinable.
13131
+ */
13132
+ reason: string(),
13133
+ count: number().int().nonnegative()
13134
+ });
13135
+ var FailureContributionSchema = object({
13136
+ /**
13137
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13138
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13139
+ * `unit` free: the families are owned by different addons and a shared enum
13140
+ * is a central list that rots invisibly.
13141
+ */
13142
+ family: string(),
13143
+ /**
13144
+ * The NUMERIC device id — the same value every log line carries as
13145
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13146
+ * cannot name the camera must not emit the entry, because a fleet total
13147
+ * cannot answer the only question anybody asks of this surface.
13148
+ */
13149
+ deviceId: number().int().positive(),
13150
+ /**
13151
+ * A second dimension inside the family: the model / step id for an inference
13152
+ * timeout, so "which camera AND which model" is one read. Absent when the
13153
+ * family has a single variant.
13154
+ */
13155
+ variant: string().optional(),
13156
+ /**
13157
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13158
+ * differencing two reads must drop the interval when it changes, because the
13159
+ * counter restarted from zero in a respawned runner. Same discipline as
13160
+ * `LoadContribution.startedAtMs`.
13161
+ */
13162
+ sinceMs: number(),
13163
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13164
+ atMs: number(),
13165
+ /**
13166
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13167
+ * window. A failure count published without it is the mistake this schema
13168
+ * exists to make impossible.
13169
+ */
13170
+ attempts: number().int().nonnegative(),
13171
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13172
+ succeeded: number().int().nonnegative(),
13173
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13174
+ reasons: array(FailureReasonCountSchema).readonly()
13175
+ });
13176
+ method(_void(), array(FailureContributionSchema).readonly());
13177
+ /**
13023
13178
  * filesystem-browse — per-node capability for browsing the node's local
13024
13179
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13025
13180
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13541,6 +13696,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13541
13696
  kind: "mutation",
13542
13697
  auth: "admin"
13543
13698
  });
13699
+ var LoadContributionSchema = object({
13700
+ role: _enum([
13701
+ "decode",
13702
+ "transcode",
13703
+ "recording",
13704
+ "streaming",
13705
+ "detection"
13706
+ ]),
13707
+ /**
13708
+ * The NUMERIC device id — the same value every log line carries as
13709
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13710
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13711
+ * contributor that cannot name its camera must not emit the entry at all,
13712
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13713
+ * and would quietly turn one camera's cost into everybody's.
13714
+ */
13715
+ deviceId: number().int().positive().nullable(),
13716
+ attribution: _enum([
13717
+ "measured",
13718
+ "accounted",
13719
+ "unattributable"
13720
+ ]),
13721
+ /**
13722
+ * What ONE entry is, in the contributor's own words — `615/high`,
13723
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13724
+ * family and inventing a common one would lose the only information that
13725
+ * makes two entries for the same camera distinguishable.
13726
+ */
13727
+ unit: string(),
13728
+ /**
13729
+ * The OS process this cost lives in, when there is one. Present so a
13730
+ * consumer can (a) tell two generations of the same unit apart across a
13731
+ * restart, and (b) subtract claimed processes from the node's process
13732
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13733
+ * process of its own.
13734
+ */
13735
+ pid: number().int().positive().optional(),
13736
+ /**
13737
+ * When this generation started. The pid's incarnation marker: a consumer
13738
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13739
+ * window when this changes, because the counter restarted from zero in a new
13740
+ * process.
13741
+ */
13742
+ startedAtMs: number().optional(),
13743
+ /**
13744
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13745
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13746
+ * contribution is asked for.
13747
+ *
13748
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13749
+ * needs a sampler, and a new per-node sampler is the defect half of
13750
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13751
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13752
+ *
13753
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13754
+ * an entry with no process.
13755
+ */
13756
+ cpuSeconds: number().optional(),
13757
+ /** Resident bytes of this unit's process, same source and same rules. */
13758
+ rssBytes: number().optional()
13759
+ });
13760
+ method(_void(), array(LoadContributionSchema).readonly());
13544
13761
  /**
13545
13762
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13546
13763
  * through. It stores nothing.
@@ -13617,176 +13834,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13617
13834
  tags: record(string(), string()).optional()
13618
13835
  }), array(LogEntrySchema).readonly());
13619
13836
  /**
13620
- * `failure-contribution` — the capability an addon reports its OWN losses
13621
- * through, per camera, with the denominator attached. It stores nothing.
13622
- *
13623
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13624
- *
13625
- * `load-contribution` answers *what did this camera COST*. This answers *what
13626
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13627
- * copied: the contributor reports what it already knows, hub-main adds only
13628
- * `addonId`, nothing needs global knowledge, and there is no central list for
13629
- * somebody to forget to edit.
13630
- *
13631
- * They are not merged, because their invariants are opposites:
13632
- *
13633
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13634
- * claim a camera cost nothing, which is a measurement nobody made;
13635
- * - a `failure-contribution` zero is the **most valuable value on the
13636
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13637
- * and it is exactly what an absent entry cannot say.
13638
- *
13639
- * Putting a loss counter on a cost entry would also break the reconciliation
13640
- * that gives `load-contribution` its point: contributions are subtracted from
13641
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13642
- * has no process.
13643
- *
13644
- * ## Why not a log line, since the counters already exist
13645
- *
13646
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13647
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13648
- * ends in a log line, and a log line is the thing the operator asked to stop
13649
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13650
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13651
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13652
- * media blackout were both diagnosed. The counters stay; this is where they can
13653
- * be READ.
13654
- *
13655
- * ## The rate is served with its denominator or not at all
13656
- *
13657
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13658
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13659
- * than yesterday" and was **flat across twelve hours** once divided by the
13660
- * successes on the same path. A surface that publishes only the numerator
13661
- * reproduces that mistake on every read.
13662
- *
13663
- * ## Shape
13664
- *
13665
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13666
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13667
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13668
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13669
- * a forked runner's entries reach hub-main over transport that already exists.
13670
- * No new UDS message, no second registry (D3). The operator reads the assembled
13671
- * result through `system.getFailureContributions`.
13672
- */
13673
- var FailureReasonCountSchema = object({
13674
- /**
13675
- * Why the attempt did not land, in the contributor's own vocabulary —
13676
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13677
- * strings that already appear in this repo's logs and, where one exists, the
13678
- * same string the per-track `previewMissReason` records (D276): a second
13679
- * vocabulary for the same loss would make the row and the counter
13680
- * un-joinable.
13681
- */
13682
- reason: string(),
13683
- count: number().int().nonnegative()
13684
- });
13685
- var FailureContributionSchema = object({
13686
- /**
13687
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13688
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13689
- * `unit` free: the families are owned by different addons and a shared enum
13690
- * is a central list that rots invisibly.
13691
- */
13692
- family: string(),
13693
- /**
13694
- * The NUMERIC device id — the same value every log line carries as
13695
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13696
- * cannot name the camera must not emit the entry, because a fleet total
13697
- * cannot answer the only question anybody asks of this surface.
13698
- */
13699
- deviceId: number().int().positive(),
13700
- /**
13701
- * A second dimension inside the family: the model / step id for an inference
13702
- * timeout, so "which camera AND which model" is one read. Absent when the
13703
- * family has a single variant.
13704
- */
13705
- variant: string().optional(),
13706
- /**
13707
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13708
- * differencing two reads must drop the interval when it changes, because the
13709
- * counter restarted from zero in a respawned runner. Same discipline as
13710
- * `LoadContribution.startedAtMs`.
13711
- */
13712
- sinceMs: number(),
13713
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13714
- atMs: number(),
13715
- /**
13716
- * THE DENOMINATOR — every attempt on this path for this camera in the
13717
- * window. A failure count published without it is the mistake this schema
13718
- * exists to make impossible.
13719
- */
13720
- attempts: number().int().nonnegative(),
13721
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13722
- succeeded: number().int().nonnegative(),
13723
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13724
- reasons: array(FailureReasonCountSchema).readonly()
13725
- });
13726
- method(_void(), array(FailureContributionSchema).readonly());
13727
- var LoadContributionSchema = object({
13728
- role: _enum([
13729
- "decode",
13730
- "transcode",
13731
- "recording",
13732
- "streaming",
13733
- "detection"
13734
- ]),
13735
- /**
13736
- * The NUMERIC device id — the same value every log line carries as
13737
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13738
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13739
- * contributor that cannot name its camera must not emit the entry at all,
13740
- * because an unnamed per-camera entry is indistinguishable from a shared one
13741
- * and would quietly turn one camera's cost into everybody's.
13742
- */
13743
- deviceId: number().int().positive().nullable(),
13744
- attribution: _enum([
13745
- "measured",
13746
- "accounted",
13747
- "unattributable"
13748
- ]),
13749
- /**
13750
- * What ONE entry is, in the contributor's own words — `615/high`,
13751
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13752
- * family and inventing a common one would lose the only information that
13753
- * makes two entries for the same camera distinguishable.
13754
- */
13755
- unit: string(),
13756
- /**
13757
- * The OS process this cost lives in, when there is one. Present so a
13758
- * consumer can (a) tell two generations of the same unit apart across a
13759
- * restart, and (b) subtract claimed processes from the node's process
13760
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13761
- * process of its own.
13762
- */
13763
- pid: number().int().positive().optional(),
13764
- /**
13765
- * When this generation started. The pid's incarnation marker: a consumer
13766
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13767
- * window when this changes, because the counter restarted from zero in a new
13768
- * process.
13769
- */
13770
- startedAtMs: number().optional(),
13771
- /**
13772
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13773
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13774
- * contribution is asked for.
13775
- *
13776
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13777
- * needs a sampler, and a new per-node sampler is the defect half of
13778
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13779
- * by whoever already keeps a history; a rate cannot be un-averaged.
13780
- *
13781
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13782
- * an entry with no process.
13783
- */
13784
- cpuSeconds: number().optional(),
13785
- /** Resident bytes of this unit's process, same source and same rules. */
13786
- rssBytes: number().optional()
13787
- });
13788
- method(_void(), array(LoadContributionSchema).readonly());
13789
- /**
13790
13837
  * `login-method` — collection cap through which auth addons contribute
13791
13838
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13792
13839
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18460,12 +18507,53 @@ var MediaFileKindEnum = _enum([
18460
18507
  "keyFrameSmall",
18461
18508
  "thumbnailSmall"
18462
18509
  ]);
18510
+ /**
18511
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18512
+ * ARE — never the bytes themselves.
18513
+ *
18514
+ * ## Why `url` and not `base64`
18515
+ *
18516
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18517
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18518
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18519
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18520
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18521
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18522
+ *
18523
+ * `url` points at the `event-media` data plane
18524
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18525
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18526
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18527
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18528
+ * no less protected than they were inside a `view`-level cap response — see
18529
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18530
+ * (per-device scoping).
18531
+ *
18532
+ * The URL is built from the row's **stored** key, which is not always its
18533
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18534
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18535
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18536
+ *
18537
+ * ## `base64` is TRANSITIONAL and is going away
18538
+ *
18539
+ * It is still populated for one reason: the deployed viewer's track-detail
18540
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18541
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18542
+ * triangle — not as absence. Removing the field before that viewer ships is an
18543
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18544
+ * delete this line and the `withBytes` pass-through in
18545
+ * `analytics-query-facade.ts`; nothing else reads it.
18546
+ */
18463
18547
  var MediaFileSchema = object({
18464
18548
  key: string(),
18465
18549
  kind: MediaFileKindEnum,
18466
- base64: string(),
18467
18550
  sizeBytes: number(),
18468
18551
  timestamp: number()
18552
+ }).extend({
18553
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18554
+ url: string(),
18555
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18556
+ base64: string()
18469
18557
  });
18470
18558
  /**
18471
18559
  * One media row WITHOUT its bytes.
@@ -18477,7 +18565,9 @@ var MediaFileSchema = object({
18477
18565
  * blocks the whole view.
18478
18566
  *
18479
18567
  * `sizeBytes` is carried because it is what lets a client decide between the
18480
- * stored blob and a `?variant=thumb` rendering without fetching either.
18568
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18569
+ * `url` because a client that had to build the plane path itself is a second
18570
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18481
18571
  */
18482
18572
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18483
18573
  /**
@@ -19166,6 +19256,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19166
19256
  }), array(MediaFileSchema).readonly()), method(object({
19167
19257
  trackId: string(),
19168
19258
  deviceId: number()
19259
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19260
+ eventId: string(),
19261
+ deviceId: number()
19169
19262
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19170
19263
  kind: "mutation",
19171
19264
  auth: "admin"
@@ -23426,10 +23519,24 @@ var FaceClusterSchema = object({
23426
23519
  size: number().int(),
23427
23520
  cohesion: number()
23428
23521
  });
23522
+ /**
23523
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23524
+ * are — never the bytes.
23525
+ *
23526
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23527
+ * track/event contract) is still populated because a deployed viewer requires
23528
+ * the field to parse a row at all; this method has no such reader. Its ONE
23529
+ * caller is the admin UI's detail modal, which was building
23530
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23531
+ * dialog already rendering its key FRAME from the `event-media` plane.
23532
+ *
23533
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23534
+ * media key directly, so this needed no new plane and no new access decision.
23535
+ */
23429
23536
  var MediaFileLiteSchema$1 = object({
23430
23537
  key: string(),
23431
23538
  kind: string(),
23432
- base64: string(),
23539
+ url: string(),
23433
23540
  sizeBytes: number(),
23434
23541
  timestamp: number()
23435
23542
  });
@@ -25681,10 +25788,24 @@ var PlateInfoSchema = object({
25681
25788
  */
25682
25789
  cropUrl: string().optional()
25683
25790
  });
25791
+ /**
25792
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25793
+ * are — never the bytes.
25794
+ *
25795
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25796
+ * track/event contract) is still populated because a deployed viewer requires
25797
+ * the field to parse a row at all; this method has no such reader. Its ONE
25798
+ * caller is the admin UI's detail modal, which was building
25799
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25800
+ * dialog already rendering its key FRAME from the `event-media` plane.
25801
+ *
25802
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25803
+ * media key directly, so this needed no new plane and no new access decision.
25804
+ */
25684
25805
  var MediaFileLiteSchema = object({
25685
25806
  key: string(),
25686
25807
  kind: string(),
25687
- base64: string(),
25808
+ url: string(),
25688
25809
  sizeBytes: number(),
25689
25810
  timestamp: number()
25690
25811
  });
@@ -31697,6 +31818,12 @@ Object.freeze({
31697
31818
  addonId: null,
31698
31819
  access: "view"
31699
31820
  },
31821
+ "pipelineAnalytics.listEventMedia": {
31822
+ capName: "pipeline-analytics",
31823
+ capScope: "device",
31824
+ addonId: null,
31825
+ access: "view"
31826
+ },
31700
31827
  "pipelineAnalytics.listGroups": {
31701
31828
  capName: "pipeline-analytics",
31702
31829
  capScope: "device",
@@ -35320,6 +35447,11 @@ Object.freeze({
35320
35447
  form: "array",
35321
35448
  optional: false
35322
35449
  }],
35450
+ "pipelineAnalytics.listEventMedia": [{
35451
+ name: "deviceId",
35452
+ form: "single",
35453
+ optional: false
35454
+ }],
35323
35455
  "pipelineAnalytics.listGroups": [{
35324
35456
  name: "deviceIds",
35325
35457
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-notifiers",
3
- "version": "1.2.49",
3
+ "version": "1.2.51",
4
4
  "description": "System notifiers addon for CamStack — a `notification-output` collection provider hosting per-kind notifier adapters (ntfy, pushover, gotify, telegram, discord, webhook, zentik).",
5
5
  "keywords": [
6
6
  "camstack",