@camstack/addon-mqtt-broker 1.2.45 → 1.2.47

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.
@@ -8032,6 +8032,21 @@ var RelocateJobSchema = object({
8032
8032
  bytesMoved: number().int(),
8033
8033
  /** Total files discovered up front; null while (or when) unknown. */
8034
8034
  filesTotal: number().int().nullable(),
8035
+ /**
8036
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8037
+ * made that nobody asked for, so it is reported where the operator reads the
8038
+ * job rather than only in a log line.
8039
+ *
8040
+ * A footage segment records its byte count in its own NAME, and the durable
8041
+ * hour row derives its aggregates from those names. A file that does not
8042
+ * match its name therefore makes the ledger's sums — and with them quota and
8043
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8044
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8045
+ *
8046
+ * Absent on lanes where the question has no meaning: a media blob's size is
8047
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8048
+ */
8049
+ rowsReconciled: number().int().nonnegative().optional(),
8035
8050
  startedAt: number(),
8036
8051
  finishedAt: number().nullable(),
8037
8052
  error: string().nullable()
@@ -8100,14 +8115,42 @@ var RelocateMediaInputSchema = object({
8100
8115
  /** Omitted = `move`, the pre-existing behaviour. */
8101
8116
  mode: MediaRelocateModeSchema.optional()
8102
8117
  });
8103
- /** How many rows still carry NO `locationId` — the population a repoint would
8104
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8105
- * value that permits a non-blocking `eventMedia` cutover. */
8106
- var UnstampedEventMediaCountSchema = object({
8107
- media: number().int().nonnegative(),
8108
- retrainFrames: number().int().nonnegative(),
8109
- total: number().int().nonnegative()
8118
+ /**
8119
+ * The unstamped population of ONE collection — split, because the gate and the
8120
+ * operator ask two different questions and only one of them has to be cheap.
8121
+ *
8122
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8123
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8124
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8125
+ * that matters — after a seal, when the population is empty.
8126
+ *
8127
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8128
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8129
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8130
+ * and useful answer: "there are some, and this read could not say how many"
8131
+ * still refuses the cutover, which is the whole job.
8132
+ */
8133
+ var UnstampedRowsSchema = object({
8134
+ present: boolean(),
8135
+ rows: number().int().nonnegative().nullable()
8110
8136
  });
8137
+ /**
8138
+ * How many rows still carry NO `locationId` — the population a repoint would
8139
+ * silently re-aim at a disk that does not hold their bytes.
8140
+ *
8141
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8142
+ * over. The gate opens on a measured absence and on nothing else; an unread
8143
+ * collection and an empty one are different facts, and this repo has already
8144
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8145
+ */
8146
+ var UnstampedEventMediaCountSchema = object({
8147
+ media: UnstampedRowsSchema,
8148
+ retrainFrames: UnstampedRowsSchema,
8149
+ /** True when EITHER collection holds one. The refusal reads this. */
8150
+ anyPresent: boolean(),
8151
+ /** Sum across both, or `null` when either lane could not be counted. */
8152
+ total: number().int().nonnegative().nullable()
8153
+ }).nullable();
8111
8154
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8112
8155
  /** The independently selectable logical storage classes — every class
8113
8156
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8218,6 +8261,10 @@ var StorageMigrationMoveProgressSchema = object({
8218
8261
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8219
8262
  filesTotal: number().int().nonnegative().nullable(),
8220
8263
  bytesMoved: number().int().nonnegative(),
8264
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8265
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8266
+ * rows would be the same failure as one that silently skipped them. */
8267
+ rowsReconciled: number().int().nonnegative().optional(),
8221
8268
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8222
8269
  * crash gets a new mover, and a rate computed from the migration's start
8223
8270
  * would silently average in the time nothing was running. */
@@ -12951,6 +12998,114 @@ method(object({
12951
12998
  height: number()
12952
12999
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12953
13000
  /**
13001
+ * `failure-contribution` — the capability an addon reports its OWN losses
13002
+ * through, per camera, with the denominator attached. It stores nothing.
13003
+ *
13004
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13005
+ *
13006
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13007
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13008
+ * copied: the contributor reports what it already knows, hub-main adds only
13009
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13010
+ * somebody to forget to edit.
13011
+ *
13012
+ * They are not merged, because their invariants are opposites:
13013
+ *
13014
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13015
+ * claim a camera cost nothing, which is a measurement nobody made;
13016
+ * - a `failure-contribution` zero is the **most valuable value on the
13017
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13018
+ * and it is exactly what an absent entry cannot say.
13019
+ *
13020
+ * Putting a loss counter on a cost entry would also break the reconciliation
13021
+ * that gives `load-contribution` its point: contributions are subtracted from
13022
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13023
+ * has no process.
13024
+ *
13025
+ * ## Why not a log line, since the counters already exist
13026
+ *
13027
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13028
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13029
+ * ends in a log line, and a log line is the thing the operator asked to stop
13030
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13031
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13032
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13033
+ * media blackout were both diagnosed. The counters stay; this is where they can
13034
+ * be READ.
13035
+ *
13036
+ * ## The rate is served with its denominator or not at all
13037
+ *
13038
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13039
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13040
+ * than yesterday" and was **flat across twelve hours** once divided by the
13041
+ * successes on the same path. A surface that publishes only the numerator
13042
+ * reproduces that mistake on every read.
13043
+ *
13044
+ * ## Shape
13045
+ *
13046
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13047
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13048
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13049
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13050
+ * a forked runner's entries reach hub-main over transport that already exists.
13051
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13052
+ * result through `system.getFailureContributions`.
13053
+ */
13054
+ var FailureReasonCountSchema = object({
13055
+ /**
13056
+ * Why the attempt did not land, in the contributor's own vocabulary —
13057
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13058
+ * strings that already appear in this repo's logs and, where one exists, the
13059
+ * same string the per-track `previewMissReason` records (D276): a second
13060
+ * vocabulary for the same loss would make the row and the counter
13061
+ * un-joinable.
13062
+ */
13063
+ reason: string(),
13064
+ count: number().int().nonnegative()
13065
+ });
13066
+ var FailureContributionSchema = object({
13067
+ /**
13068
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13069
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13070
+ * `unit` free: the families are owned by different addons and a shared enum
13071
+ * is a central list that rots invisibly.
13072
+ */
13073
+ family: string(),
13074
+ /**
13075
+ * The NUMERIC device id — the same value every log line carries as
13076
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13077
+ * cannot name the camera must not emit the entry, because a fleet total
13078
+ * cannot answer the only question anybody asks of this surface.
13079
+ */
13080
+ deviceId: number().int().positive(),
13081
+ /**
13082
+ * A second dimension inside the family: the model / step id for an inference
13083
+ * timeout, so "which camera AND which model" is one read. Absent when the
13084
+ * family has a single variant.
13085
+ */
13086
+ variant: string().optional(),
13087
+ /**
13088
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13089
+ * differencing two reads must drop the interval when it changes, because the
13090
+ * counter restarted from zero in a respawned runner. Same discipline as
13091
+ * `LoadContribution.startedAtMs`.
13092
+ */
13093
+ sinceMs: number(),
13094
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13095
+ atMs: number(),
13096
+ /**
13097
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13098
+ * window. A failure count published without it is the mistake this schema
13099
+ * exists to make impossible.
13100
+ */
13101
+ attempts: number().int().nonnegative(),
13102
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13103
+ succeeded: number().int().nonnegative(),
13104
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13105
+ reasons: array(FailureReasonCountSchema).readonly()
13106
+ });
13107
+ method(_void(), array(FailureContributionSchema).readonly());
13108
+ /**
12954
13109
  * filesystem-browse — per-node capability for browsing the node's local
12955
13110
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12956
13111
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13472,6 +13627,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13472
13627
  kind: "mutation",
13473
13628
  auth: "admin"
13474
13629
  });
13630
+ var LoadContributionSchema = object({
13631
+ role: _enum([
13632
+ "decode",
13633
+ "transcode",
13634
+ "recording",
13635
+ "streaming",
13636
+ "detection"
13637
+ ]),
13638
+ /**
13639
+ * The NUMERIC device id — the same value every log line carries as
13640
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13641
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13642
+ * contributor that cannot name its camera must not emit the entry at all,
13643
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13644
+ * and would quietly turn one camera's cost into everybody's.
13645
+ */
13646
+ deviceId: number().int().positive().nullable(),
13647
+ attribution: _enum([
13648
+ "measured",
13649
+ "accounted",
13650
+ "unattributable"
13651
+ ]),
13652
+ /**
13653
+ * What ONE entry is, in the contributor's own words — `615/high`,
13654
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13655
+ * family and inventing a common one would lose the only information that
13656
+ * makes two entries for the same camera distinguishable.
13657
+ */
13658
+ unit: string(),
13659
+ /**
13660
+ * The OS process this cost lives in, when there is one. Present so a
13661
+ * consumer can (a) tell two generations of the same unit apart across a
13662
+ * restart, and (b) subtract claimed processes from the node's process
13663
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13664
+ * process of its own.
13665
+ */
13666
+ pid: number().int().positive().optional(),
13667
+ /**
13668
+ * When this generation started. The pid's incarnation marker: a consumer
13669
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13670
+ * window when this changes, because the counter restarted from zero in a new
13671
+ * process.
13672
+ */
13673
+ startedAtMs: number().optional(),
13674
+ /**
13675
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13676
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13677
+ * contribution is asked for.
13678
+ *
13679
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13680
+ * needs a sampler, and a new per-node sampler is the defect half of
13681
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13682
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13683
+ *
13684
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13685
+ * an entry with no process.
13686
+ */
13687
+ cpuSeconds: number().optional(),
13688
+ /** Resident bytes of this unit's process, same source and same rules. */
13689
+ rssBytes: number().optional()
13690
+ });
13691
+ method(_void(), array(LoadContributionSchema).readonly());
13475
13692
  /**
13476
13693
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13477
13694
  * through. It stores nothing.
@@ -13548,176 +13765,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13548
13765
  tags: record(string(), string()).optional()
13549
13766
  }), array(LogEntrySchema).readonly());
13550
13767
  /**
13551
- * `failure-contribution` — the capability an addon reports its OWN losses
13552
- * through, per camera, with the denominator attached. It stores nothing.
13553
- *
13554
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13555
- *
13556
- * `load-contribution` answers *what did this camera COST*. This answers *what
13557
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13558
- * copied: the contributor reports what it already knows, hub-main adds only
13559
- * `addonId`, nothing needs global knowledge, and there is no central list for
13560
- * somebody to forget to edit.
13561
- *
13562
- * They are not merged, because their invariants are opposites:
13563
- *
13564
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13565
- * claim a camera cost nothing, which is a measurement nobody made;
13566
- * - a `failure-contribution` zero is the **most valuable value on the
13567
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13568
- * and it is exactly what an absent entry cannot say.
13569
- *
13570
- * Putting a loss counter on a cost entry would also break the reconciliation
13571
- * that gives `load-contribution` its point: contributions are subtracted from
13572
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13573
- * has no process.
13574
- *
13575
- * ## Why not a log line, since the counters already exist
13576
- *
13577
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13578
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13579
- * ends in a log line, and a log line is the thing the operator asked to stop
13580
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13581
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13582
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13583
- * media blackout were both diagnosed. The counters stay; this is where they can
13584
- * be READ.
13585
- *
13586
- * ## The rate is served with its denominator or not at all
13587
- *
13588
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13589
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13590
- * than yesterday" and was **flat across twelve hours** once divided by the
13591
- * successes on the same path. A surface that publishes only the numerator
13592
- * reproduces that mistake on every read.
13593
- *
13594
- * ## Shape
13595
- *
13596
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13597
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13598
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13599
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13600
- * a forked runner's entries reach hub-main over transport that already exists.
13601
- * No new UDS message, no second registry (D3). The operator reads the assembled
13602
- * result through `system.getFailureContributions`.
13603
- */
13604
- var FailureReasonCountSchema = object({
13605
- /**
13606
- * Why the attempt did not land, in the contributor's own vocabulary —
13607
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13608
- * strings that already appear in this repo's logs and, where one exists, the
13609
- * same string the per-track `previewMissReason` records (D276): a second
13610
- * vocabulary for the same loss would make the row and the counter
13611
- * un-joinable.
13612
- */
13613
- reason: string(),
13614
- count: number().int().nonnegative()
13615
- });
13616
- var FailureContributionSchema = object({
13617
- /**
13618
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13619
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13620
- * `unit` free: the families are owned by different addons and a shared enum
13621
- * is a central list that rots invisibly.
13622
- */
13623
- family: string(),
13624
- /**
13625
- * The NUMERIC device id — the same value every log line carries as
13626
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13627
- * cannot name the camera must not emit the entry, because a fleet total
13628
- * cannot answer the only question anybody asks of this surface.
13629
- */
13630
- deviceId: number().int().positive(),
13631
- /**
13632
- * A second dimension inside the family: the model / step id for an inference
13633
- * timeout, so "which camera AND which model" is one read. Absent when the
13634
- * family has a single variant.
13635
- */
13636
- variant: string().optional(),
13637
- /**
13638
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13639
- * differencing two reads must drop the interval when it changes, because the
13640
- * counter restarted from zero in a respawned runner. Same discipline as
13641
- * `LoadContribution.startedAtMs`.
13642
- */
13643
- sinceMs: number(),
13644
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13645
- atMs: number(),
13646
- /**
13647
- * THE DENOMINATOR — every attempt on this path for this camera in the
13648
- * window. A failure count published without it is the mistake this schema
13649
- * exists to make impossible.
13650
- */
13651
- attempts: number().int().nonnegative(),
13652
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13653
- succeeded: number().int().nonnegative(),
13654
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13655
- reasons: array(FailureReasonCountSchema).readonly()
13656
- });
13657
- method(_void(), array(FailureContributionSchema).readonly());
13658
- var LoadContributionSchema = object({
13659
- role: _enum([
13660
- "decode",
13661
- "transcode",
13662
- "recording",
13663
- "streaming",
13664
- "detection"
13665
- ]),
13666
- /**
13667
- * The NUMERIC device id — the same value every log line carries as
13668
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13669
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13670
- * contributor that cannot name its camera must not emit the entry at all,
13671
- * because an unnamed per-camera entry is indistinguishable from a shared one
13672
- * and would quietly turn one camera's cost into everybody's.
13673
- */
13674
- deviceId: number().int().positive().nullable(),
13675
- attribution: _enum([
13676
- "measured",
13677
- "accounted",
13678
- "unattributable"
13679
- ]),
13680
- /**
13681
- * What ONE entry is, in the contributor's own words — `615/high`,
13682
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13683
- * family and inventing a common one would lose the only information that
13684
- * makes two entries for the same camera distinguishable.
13685
- */
13686
- unit: string(),
13687
- /**
13688
- * The OS process this cost lives in, when there is one. Present so a
13689
- * consumer can (a) tell two generations of the same unit apart across a
13690
- * restart, and (b) subtract claimed processes from the node's process
13691
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13692
- * process of its own.
13693
- */
13694
- pid: number().int().positive().optional(),
13695
- /**
13696
- * When this generation started. The pid's incarnation marker: a consumer
13697
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13698
- * window when this changes, because the counter restarted from zero in a new
13699
- * process.
13700
- */
13701
- startedAtMs: number().optional(),
13702
- /**
13703
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13704
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13705
- * contribution is asked for.
13706
- *
13707
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13708
- * needs a sampler, and a new per-node sampler is the defect half of
13709
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13710
- * by whoever already keeps a history; a rate cannot be un-averaged.
13711
- *
13712
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13713
- * an entry with no process.
13714
- */
13715
- cpuSeconds: number().optional(),
13716
- /** Resident bytes of this unit's process, same source and same rules. */
13717
- rssBytes: number().optional()
13718
- });
13719
- method(_void(), array(LoadContributionSchema).readonly());
13720
- /**
13721
13768
  * `login-method` — collection cap through which auth addons contribute
13722
13769
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13723
13770
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18396,12 +18443,53 @@ var MediaFileKindEnum = _enum([
18396
18443
  "keyFrameSmall",
18397
18444
  "thumbnailSmall"
18398
18445
  ]);
18446
+ /**
18447
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18448
+ * ARE — never the bytes themselves.
18449
+ *
18450
+ * ## Why `url` and not `base64`
18451
+ *
18452
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18453
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18454
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18455
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18456
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18457
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18458
+ *
18459
+ * `url` points at the `event-media` data plane
18460
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18461
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18462
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18463
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18464
+ * no less protected than they were inside a `view`-level cap response — see
18465
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18466
+ * (per-device scoping).
18467
+ *
18468
+ * The URL is built from the row's **stored** key, which is not always its
18469
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18470
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18471
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18472
+ *
18473
+ * ## `base64` is TRANSITIONAL and is going away
18474
+ *
18475
+ * It is still populated for one reason: the deployed viewer's track-detail
18476
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18477
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18478
+ * triangle — not as absence. Removing the field before that viewer ships is an
18479
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18480
+ * delete this line and the `withBytes` pass-through in
18481
+ * `analytics-query-facade.ts`; nothing else reads it.
18482
+ */
18399
18483
  var MediaFileSchema = object({
18400
18484
  key: string(),
18401
18485
  kind: MediaFileKindEnum,
18402
- base64: string(),
18403
18486
  sizeBytes: number(),
18404
18487
  timestamp: number()
18488
+ }).extend({
18489
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18490
+ url: string(),
18491
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18492
+ base64: string()
18405
18493
  });
18406
18494
  /**
18407
18495
  * One media row WITHOUT its bytes.
@@ -18413,7 +18501,9 @@ var MediaFileSchema = object({
18413
18501
  * blocks the whole view.
18414
18502
  *
18415
18503
  * `sizeBytes` is carried because it is what lets a client decide between the
18416
- * stored blob and a `?variant=thumb` rendering without fetching either.
18504
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18505
+ * `url` because a client that had to build the plane path itself is a second
18506
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18417
18507
  */
18418
18508
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18419
18509
  /**
@@ -19102,6 +19192,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19102
19192
  }), array(MediaFileSchema).readonly()), method(object({
19103
19193
  trackId: string(),
19104
19194
  deviceId: number()
19195
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19196
+ eventId: string(),
19197
+ deviceId: number()
19105
19198
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19106
19199
  kind: "mutation",
19107
19200
  auth: "admin"
@@ -23362,10 +23455,24 @@ var FaceClusterSchema = object({
23362
23455
  size: number().int(),
23363
23456
  cohesion: number()
23364
23457
  });
23458
+ /**
23459
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23460
+ * are — never the bytes.
23461
+ *
23462
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23463
+ * track/event contract) is still populated because a deployed viewer requires
23464
+ * the field to parse a row at all; this method has no such reader. Its ONE
23465
+ * caller is the admin UI's detail modal, which was building
23466
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23467
+ * dialog already rendering its key FRAME from the `event-media` plane.
23468
+ *
23469
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23470
+ * media key directly, so this needed no new plane and no new access decision.
23471
+ */
23365
23472
  var MediaFileLiteSchema$1 = object({
23366
23473
  key: string(),
23367
23474
  kind: string(),
23368
- base64: string(),
23475
+ url: string(),
23369
23476
  sizeBytes: number(),
23370
23477
  timestamp: number()
23371
23478
  });
@@ -25617,10 +25724,24 @@ var PlateInfoSchema = object({
25617
25724
  */
25618
25725
  cropUrl: string().optional()
25619
25726
  });
25727
+ /**
25728
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25729
+ * are — never the bytes.
25730
+ *
25731
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25732
+ * track/event contract) is still populated because a deployed viewer requires
25733
+ * the field to parse a row at all; this method has no such reader. Its ONE
25734
+ * caller is the admin UI's detail modal, which was building
25735
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25736
+ * dialog already rendering its key FRAME from the `event-media` plane.
25737
+ *
25738
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25739
+ * media key directly, so this needed no new plane and no new access decision.
25740
+ */
25620
25741
  var MediaFileLiteSchema = object({
25621
25742
  key: string(),
25622
25743
  kind: string(),
25623
- base64: string(),
25744
+ url: string(),
25624
25745
  sizeBytes: number(),
25625
25746
  timestamp: number()
25626
25747
  });
@@ -31633,6 +31754,12 @@ Object.freeze({
31633
31754
  addonId: null,
31634
31755
  access: "view"
31635
31756
  },
31757
+ "pipelineAnalytics.listEventMedia": {
31758
+ capName: "pipeline-analytics",
31759
+ capScope: "device",
31760
+ addonId: null,
31761
+ access: "view"
31762
+ },
31636
31763
  "pipelineAnalytics.listGroups": {
31637
31764
  capName: "pipeline-analytics",
31638
31765
  capScope: "device",
@@ -35256,6 +35383,11 @@ Object.freeze({
35256
35383
  form: "array",
35257
35384
  optional: false
35258
35385
  }],
35386
+ "pipelineAnalytics.listEventMedia": [{
35387
+ name: "deviceId",
35388
+ form: "single",
35389
+ optional: false
35390
+ }],
35259
35391
  "pipelineAnalytics.listGroups": [{
35260
35392
  name: "deviceIds",
35261
35393
  form: "array",
@@ -8027,6 +8027,21 @@ var RelocateJobSchema = object({
8027
8027
  bytesMoved: number().int(),
8028
8028
  /** Total files discovered up front; null while (or when) unknown. */
8029
8029
  filesTotal: number().int().nullable(),
8030
+ /**
8031
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8032
+ * made that nobody asked for, so it is reported where the operator reads the
8033
+ * job rather than only in a log line.
8034
+ *
8035
+ * A footage segment records its byte count in its own NAME, and the durable
8036
+ * hour row derives its aggregates from those names. A file that does not
8037
+ * match its name therefore makes the ledger's sums — and with them quota and
8038
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8039
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8040
+ *
8041
+ * Absent on lanes where the question has no meaning: a media blob's size is
8042
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8043
+ */
8044
+ rowsReconciled: number().int().nonnegative().optional(),
8030
8045
  startedAt: number(),
8031
8046
  finishedAt: number().nullable(),
8032
8047
  error: string().nullable()
@@ -8095,14 +8110,42 @@ var RelocateMediaInputSchema = object({
8095
8110
  /** Omitted = `move`, the pre-existing behaviour. */
8096
8111
  mode: MediaRelocateModeSchema.optional()
8097
8112
  });
8098
- /** How many rows still carry NO `locationId` — the population a repoint would
8099
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8100
- * value that permits a non-blocking `eventMedia` cutover. */
8101
- var UnstampedEventMediaCountSchema = object({
8102
- media: number().int().nonnegative(),
8103
- retrainFrames: number().int().nonnegative(),
8104
- total: number().int().nonnegative()
8113
+ /**
8114
+ * The unstamped population of ONE collection — split, because the gate and the
8115
+ * operator ask two different questions and only one of them has to be cheap.
8116
+ *
8117
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8118
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8119
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8120
+ * that matters — after a seal, when the population is empty.
8121
+ *
8122
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8123
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8124
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8125
+ * and useful answer: "there are some, and this read could not say how many"
8126
+ * still refuses the cutover, which is the whole job.
8127
+ */
8128
+ var UnstampedRowsSchema = object({
8129
+ present: boolean(),
8130
+ rows: number().int().nonnegative().nullable()
8105
8131
  });
8132
+ /**
8133
+ * How many rows still carry NO `locationId` — the population a repoint would
8134
+ * silently re-aim at a disk that does not hold their bytes.
8135
+ *
8136
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8137
+ * over. The gate opens on a measured absence and on nothing else; an unread
8138
+ * collection and an empty one are different facts, and this repo has already
8139
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8140
+ */
8141
+ var UnstampedEventMediaCountSchema = object({
8142
+ media: UnstampedRowsSchema,
8143
+ retrainFrames: UnstampedRowsSchema,
8144
+ /** True when EITHER collection holds one. The refusal reads this. */
8145
+ anyPresent: boolean(),
8146
+ /** Sum across both, or `null` when either lane could not be counted. */
8147
+ total: number().int().nonnegative().nullable()
8148
+ }).nullable();
8106
8149
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8107
8150
  /** The independently selectable logical storage classes — every class
8108
8151
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8213,6 +8256,10 @@ var StorageMigrationMoveProgressSchema = object({
8213
8256
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8214
8257
  filesTotal: number().int().nonnegative().nullable(),
8215
8258
  bytesMoved: number().int().nonnegative(),
8259
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8260
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8261
+ * rows would be the same failure as one that silently skipped them. */
8262
+ rowsReconciled: number().int().nonnegative().optional(),
8216
8263
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8217
8264
  * crash gets a new mover, and a rate computed from the migration's start
8218
8265
  * would silently average in the time nothing was running. */
@@ -12946,6 +12993,114 @@ method(object({
12946
12993
  height: number()
12947
12994
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12948
12995
  /**
12996
+ * `failure-contribution` — the capability an addon reports its OWN losses
12997
+ * through, per camera, with the denominator attached. It stores nothing.
12998
+ *
12999
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13000
+ *
13001
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13002
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13003
+ * copied: the contributor reports what it already knows, hub-main adds only
13004
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13005
+ * somebody to forget to edit.
13006
+ *
13007
+ * They are not merged, because their invariants are opposites:
13008
+ *
13009
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13010
+ * claim a camera cost nothing, which is a measurement nobody made;
13011
+ * - a `failure-contribution` zero is the **most valuable value on the
13012
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13013
+ * and it is exactly what an absent entry cannot say.
13014
+ *
13015
+ * Putting a loss counter on a cost entry would also break the reconciliation
13016
+ * that gives `load-contribution` its point: contributions are subtracted from
13017
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13018
+ * has no process.
13019
+ *
13020
+ * ## Why not a log line, since the counters already exist
13021
+ *
13022
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13023
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13024
+ * ends in a log line, and a log line is the thing the operator asked to stop
13025
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13026
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13027
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13028
+ * media blackout were both diagnosed. The counters stay; this is where they can
13029
+ * be READ.
13030
+ *
13031
+ * ## The rate is served with its denominator or not at all
13032
+ *
13033
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13034
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13035
+ * than yesterday" and was **flat across twelve hours** once divided by the
13036
+ * successes on the same path. A surface that publishes only the numerator
13037
+ * reproduces that mistake on every read.
13038
+ *
13039
+ * ## Shape
13040
+ *
13041
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13042
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13043
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13044
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13045
+ * a forked runner's entries reach hub-main over transport that already exists.
13046
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13047
+ * result through `system.getFailureContributions`.
13048
+ */
13049
+ var FailureReasonCountSchema = object({
13050
+ /**
13051
+ * Why the attempt did not land, in the contributor's own vocabulary —
13052
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13053
+ * strings that already appear in this repo's logs and, where one exists, the
13054
+ * same string the per-track `previewMissReason` records (D276): a second
13055
+ * vocabulary for the same loss would make the row and the counter
13056
+ * un-joinable.
13057
+ */
13058
+ reason: string(),
13059
+ count: number().int().nonnegative()
13060
+ });
13061
+ var FailureContributionSchema = object({
13062
+ /**
13063
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13064
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13065
+ * `unit` free: the families are owned by different addons and a shared enum
13066
+ * is a central list that rots invisibly.
13067
+ */
13068
+ family: string(),
13069
+ /**
13070
+ * The NUMERIC device id — the same value every log line carries as
13071
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13072
+ * cannot name the camera must not emit the entry, because a fleet total
13073
+ * cannot answer the only question anybody asks of this surface.
13074
+ */
13075
+ deviceId: number().int().positive(),
13076
+ /**
13077
+ * A second dimension inside the family: the model / step id for an inference
13078
+ * timeout, so "which camera AND which model" is one read. Absent when the
13079
+ * family has a single variant.
13080
+ */
13081
+ variant: string().optional(),
13082
+ /**
13083
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13084
+ * differencing two reads must drop the interval when it changes, because the
13085
+ * counter restarted from zero in a respawned runner. Same discipline as
13086
+ * `LoadContribution.startedAtMs`.
13087
+ */
13088
+ sinceMs: number(),
13089
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13090
+ atMs: number(),
13091
+ /**
13092
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13093
+ * window. A failure count published without it is the mistake this schema
13094
+ * exists to make impossible.
13095
+ */
13096
+ attempts: number().int().nonnegative(),
13097
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13098
+ succeeded: number().int().nonnegative(),
13099
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13100
+ reasons: array(FailureReasonCountSchema).readonly()
13101
+ });
13102
+ method(_void(), array(FailureContributionSchema).readonly());
13103
+ /**
12949
13104
  * filesystem-browse — per-node capability for browsing the node's local
12950
13105
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12951
13106
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13467,6 +13622,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13467
13622
  kind: "mutation",
13468
13623
  auth: "admin"
13469
13624
  });
13625
+ var LoadContributionSchema = object({
13626
+ role: _enum([
13627
+ "decode",
13628
+ "transcode",
13629
+ "recording",
13630
+ "streaming",
13631
+ "detection"
13632
+ ]),
13633
+ /**
13634
+ * The NUMERIC device id — the same value every log line carries as
13635
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13636
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13637
+ * contributor that cannot name its camera must not emit the entry at all,
13638
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13639
+ * and would quietly turn one camera's cost into everybody's.
13640
+ */
13641
+ deviceId: number().int().positive().nullable(),
13642
+ attribution: _enum([
13643
+ "measured",
13644
+ "accounted",
13645
+ "unattributable"
13646
+ ]),
13647
+ /**
13648
+ * What ONE entry is, in the contributor's own words — `615/high`,
13649
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13650
+ * family and inventing a common one would lose the only information that
13651
+ * makes two entries for the same camera distinguishable.
13652
+ */
13653
+ unit: string(),
13654
+ /**
13655
+ * The OS process this cost lives in, when there is one. Present so a
13656
+ * consumer can (a) tell two generations of the same unit apart across a
13657
+ * restart, and (b) subtract claimed processes from the node's process
13658
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13659
+ * process of its own.
13660
+ */
13661
+ pid: number().int().positive().optional(),
13662
+ /**
13663
+ * When this generation started. The pid's incarnation marker: a consumer
13664
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13665
+ * window when this changes, because the counter restarted from zero in a new
13666
+ * process.
13667
+ */
13668
+ startedAtMs: number().optional(),
13669
+ /**
13670
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13671
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13672
+ * contribution is asked for.
13673
+ *
13674
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13675
+ * needs a sampler, and a new per-node sampler is the defect half of
13676
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13677
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13678
+ *
13679
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13680
+ * an entry with no process.
13681
+ */
13682
+ cpuSeconds: number().optional(),
13683
+ /** Resident bytes of this unit's process, same source and same rules. */
13684
+ rssBytes: number().optional()
13685
+ });
13686
+ method(_void(), array(LoadContributionSchema).readonly());
13470
13687
  /**
13471
13688
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13472
13689
  * through. It stores nothing.
@@ -13543,176 +13760,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13543
13760
  tags: record(string(), string()).optional()
13544
13761
  }), array(LogEntrySchema).readonly());
13545
13762
  /**
13546
- * `failure-contribution` — the capability an addon reports its OWN losses
13547
- * through, per camera, with the denominator attached. It stores nothing.
13548
- *
13549
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13550
- *
13551
- * `load-contribution` answers *what did this camera COST*. This answers *what
13552
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13553
- * copied: the contributor reports what it already knows, hub-main adds only
13554
- * `addonId`, nothing needs global knowledge, and there is no central list for
13555
- * somebody to forget to edit.
13556
- *
13557
- * They are not merged, because their invariants are opposites:
13558
- *
13559
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13560
- * claim a camera cost nothing, which is a measurement nobody made;
13561
- * - a `failure-contribution` zero is the **most valuable value on the
13562
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13563
- * and it is exactly what an absent entry cannot say.
13564
- *
13565
- * Putting a loss counter on a cost entry would also break the reconciliation
13566
- * that gives `load-contribution` its point: contributions are subtracted from
13567
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13568
- * has no process.
13569
- *
13570
- * ## Why not a log line, since the counters already exist
13571
- *
13572
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13573
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13574
- * ends in a log line, and a log line is the thing the operator asked to stop
13575
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13576
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13577
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13578
- * media blackout were both diagnosed. The counters stay; this is where they can
13579
- * be READ.
13580
- *
13581
- * ## The rate is served with its denominator or not at all
13582
- *
13583
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13584
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13585
- * than yesterday" and was **flat across twelve hours** once divided by the
13586
- * successes on the same path. A surface that publishes only the numerator
13587
- * reproduces that mistake on every read.
13588
- *
13589
- * ## Shape
13590
- *
13591
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13592
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13593
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13594
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13595
- * a forked runner's entries reach hub-main over transport that already exists.
13596
- * No new UDS message, no second registry (D3). The operator reads the assembled
13597
- * result through `system.getFailureContributions`.
13598
- */
13599
- var FailureReasonCountSchema = object({
13600
- /**
13601
- * Why the attempt did not land, in the contributor's own vocabulary —
13602
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13603
- * strings that already appear in this repo's logs and, where one exists, the
13604
- * same string the per-track `previewMissReason` records (D276): a second
13605
- * vocabulary for the same loss would make the row and the counter
13606
- * un-joinable.
13607
- */
13608
- reason: string(),
13609
- count: number().int().nonnegative()
13610
- });
13611
- var FailureContributionSchema = object({
13612
- /**
13613
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13614
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13615
- * `unit` free: the families are owned by different addons and a shared enum
13616
- * is a central list that rots invisibly.
13617
- */
13618
- family: string(),
13619
- /**
13620
- * The NUMERIC device id — the same value every log line carries as
13621
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13622
- * cannot name the camera must not emit the entry, because a fleet total
13623
- * cannot answer the only question anybody asks of this surface.
13624
- */
13625
- deviceId: number().int().positive(),
13626
- /**
13627
- * A second dimension inside the family: the model / step id for an inference
13628
- * timeout, so "which camera AND which model" is one read. Absent when the
13629
- * family has a single variant.
13630
- */
13631
- variant: string().optional(),
13632
- /**
13633
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13634
- * differencing two reads must drop the interval when it changes, because the
13635
- * counter restarted from zero in a respawned runner. Same discipline as
13636
- * `LoadContribution.startedAtMs`.
13637
- */
13638
- sinceMs: number(),
13639
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13640
- atMs: number(),
13641
- /**
13642
- * THE DENOMINATOR — every attempt on this path for this camera in the
13643
- * window. A failure count published without it is the mistake this schema
13644
- * exists to make impossible.
13645
- */
13646
- attempts: number().int().nonnegative(),
13647
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13648
- succeeded: number().int().nonnegative(),
13649
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13650
- reasons: array(FailureReasonCountSchema).readonly()
13651
- });
13652
- method(_void(), array(FailureContributionSchema).readonly());
13653
- var LoadContributionSchema = object({
13654
- role: _enum([
13655
- "decode",
13656
- "transcode",
13657
- "recording",
13658
- "streaming",
13659
- "detection"
13660
- ]),
13661
- /**
13662
- * The NUMERIC device id — the same value every log line carries as
13663
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13664
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13665
- * contributor that cannot name its camera must not emit the entry at all,
13666
- * because an unnamed per-camera entry is indistinguishable from a shared one
13667
- * and would quietly turn one camera's cost into everybody's.
13668
- */
13669
- deviceId: number().int().positive().nullable(),
13670
- attribution: _enum([
13671
- "measured",
13672
- "accounted",
13673
- "unattributable"
13674
- ]),
13675
- /**
13676
- * What ONE entry is, in the contributor's own words — `615/high`,
13677
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13678
- * family and inventing a common one would lose the only information that
13679
- * makes two entries for the same camera distinguishable.
13680
- */
13681
- unit: string(),
13682
- /**
13683
- * The OS process this cost lives in, when there is one. Present so a
13684
- * consumer can (a) tell two generations of the same unit apart across a
13685
- * restart, and (b) subtract claimed processes from the node's process
13686
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13687
- * process of its own.
13688
- */
13689
- pid: number().int().positive().optional(),
13690
- /**
13691
- * When this generation started. The pid's incarnation marker: a consumer
13692
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13693
- * window when this changes, because the counter restarted from zero in a new
13694
- * process.
13695
- */
13696
- startedAtMs: number().optional(),
13697
- /**
13698
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13699
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13700
- * contribution is asked for.
13701
- *
13702
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13703
- * needs a sampler, and a new per-node sampler is the defect half of
13704
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13705
- * by whoever already keeps a history; a rate cannot be un-averaged.
13706
- *
13707
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13708
- * an entry with no process.
13709
- */
13710
- cpuSeconds: number().optional(),
13711
- /** Resident bytes of this unit's process, same source and same rules. */
13712
- rssBytes: number().optional()
13713
- });
13714
- method(_void(), array(LoadContributionSchema).readonly());
13715
- /**
13716
13763
  * `login-method` — collection cap through which auth addons contribute
13717
13764
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13718
13765
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18391,12 +18438,53 @@ var MediaFileKindEnum = _enum([
18391
18438
  "keyFrameSmall",
18392
18439
  "thumbnailSmall"
18393
18440
  ]);
18441
+ /**
18442
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18443
+ * ARE — never the bytes themselves.
18444
+ *
18445
+ * ## Why `url` and not `base64`
18446
+ *
18447
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18448
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18449
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18450
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18451
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18452
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18453
+ *
18454
+ * `url` points at the `event-media` data plane
18455
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18456
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18457
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18458
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18459
+ * no less protected than they were inside a `view`-level cap response — see
18460
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18461
+ * (per-device scoping).
18462
+ *
18463
+ * The URL is built from the row's **stored** key, which is not always its
18464
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18465
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18466
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18467
+ *
18468
+ * ## `base64` is TRANSITIONAL and is going away
18469
+ *
18470
+ * It is still populated for one reason: the deployed viewer's track-detail
18471
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18472
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18473
+ * triangle — not as absence. Removing the field before that viewer ships is an
18474
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18475
+ * delete this line and the `withBytes` pass-through in
18476
+ * `analytics-query-facade.ts`; nothing else reads it.
18477
+ */
18394
18478
  var MediaFileSchema = object({
18395
18479
  key: string(),
18396
18480
  kind: MediaFileKindEnum,
18397
- base64: string(),
18398
18481
  sizeBytes: number(),
18399
18482
  timestamp: number()
18483
+ }).extend({
18484
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18485
+ url: string(),
18486
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18487
+ base64: string()
18400
18488
  });
18401
18489
  /**
18402
18490
  * One media row WITHOUT its bytes.
@@ -18408,7 +18496,9 @@ var MediaFileSchema = object({
18408
18496
  * blocks the whole view.
18409
18497
  *
18410
18498
  * `sizeBytes` is carried because it is what lets a client decide between the
18411
- * stored blob and a `?variant=thumb` rendering without fetching either.
18499
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18500
+ * `url` because a client that had to build the plane path itself is a second
18501
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18412
18502
  */
18413
18503
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18414
18504
  /**
@@ -19097,6 +19187,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19097
19187
  }), array(MediaFileSchema).readonly()), method(object({
19098
19188
  trackId: string(),
19099
19189
  deviceId: number()
19190
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19191
+ eventId: string(),
19192
+ deviceId: number()
19100
19193
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19101
19194
  kind: "mutation",
19102
19195
  auth: "admin"
@@ -23357,10 +23450,24 @@ var FaceClusterSchema = object({
23357
23450
  size: number().int(),
23358
23451
  cohesion: number()
23359
23452
  });
23453
+ /**
23454
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23455
+ * are — never the bytes.
23456
+ *
23457
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23458
+ * track/event contract) is still populated because a deployed viewer requires
23459
+ * the field to parse a row at all; this method has no such reader. Its ONE
23460
+ * caller is the admin UI's detail modal, which was building
23461
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23462
+ * dialog already rendering its key FRAME from the `event-media` plane.
23463
+ *
23464
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23465
+ * media key directly, so this needed no new plane and no new access decision.
23466
+ */
23360
23467
  var MediaFileLiteSchema$1 = object({
23361
23468
  key: string(),
23362
23469
  kind: string(),
23363
- base64: string(),
23470
+ url: string(),
23364
23471
  sizeBytes: number(),
23365
23472
  timestamp: number()
23366
23473
  });
@@ -25612,10 +25719,24 @@ var PlateInfoSchema = object({
25612
25719
  */
25613
25720
  cropUrl: string().optional()
25614
25721
  });
25722
+ /**
25723
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25724
+ * are — never the bytes.
25725
+ *
25726
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25727
+ * track/event contract) is still populated because a deployed viewer requires
25728
+ * the field to parse a row at all; this method has no such reader. Its ONE
25729
+ * caller is the admin UI's detail modal, which was building
25730
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25731
+ * dialog already rendering its key FRAME from the `event-media` plane.
25732
+ *
25733
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25734
+ * media key directly, so this needed no new plane and no new access decision.
25735
+ */
25615
25736
  var MediaFileLiteSchema = object({
25616
25737
  key: string(),
25617
25738
  kind: string(),
25618
- base64: string(),
25739
+ url: string(),
25619
25740
  sizeBytes: number(),
25620
25741
  timestamp: number()
25621
25742
  });
@@ -31628,6 +31749,12 @@ Object.freeze({
31628
31749
  addonId: null,
31629
31750
  access: "view"
31630
31751
  },
31752
+ "pipelineAnalytics.listEventMedia": {
31753
+ capName: "pipeline-analytics",
31754
+ capScope: "device",
31755
+ addonId: null,
31756
+ access: "view"
31757
+ },
31631
31758
  "pipelineAnalytics.listGroups": {
31632
31759
  capName: "pipeline-analytics",
31633
31760
  capScope: "device",
@@ -35251,6 +35378,11 @@ Object.freeze({
35251
35378
  form: "array",
35252
35379
  optional: false
35253
35380
  }],
35381
+ "pipelineAnalytics.listEventMedia": [{
35382
+ name: "deviceId",
35383
+ form: "single",
35384
+ optional: false
35385
+ }],
35254
35386
  "pipelineAnalytics.listGroups": [{
35255
35387
  name: "deviceIds",
35256
35388
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-mqtt-broker",
3
- "version": "1.2.45",
3
+ "version": "1.2.47",
4
4
  "description": "MQTT broker registry addon for CamStack — manages external broker entries + an optional embedded aedes broker. Consumers spin up their own `mqtt.js` clients via the `mqtt-broker` cap.",
5
5
  "keywords": [
6
6
  "camstack",