@camstack/addon-decoder-ffmpeg 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.
Files changed (3) hide show
  1. package/dist/index.js +313 -181
  2. package/dist/index.mjs +313 -181
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8004,6 +8004,21 @@ var RelocateJobSchema = object({
8004
8004
  bytesMoved: number().int(),
8005
8005
  /** Total files discovered up front; null while (or when) unknown. */
8006
8006
  filesTotal: number().int().nullable(),
8007
+ /**
8008
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8009
+ * made that nobody asked for, so it is reported where the operator reads the
8010
+ * job rather than only in a log line.
8011
+ *
8012
+ * A footage segment records its byte count in its own NAME, and the durable
8013
+ * hour row derives its aggregates from those names. A file that does not
8014
+ * match its name therefore makes the ledger's sums — and with them quota and
8015
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8016
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8017
+ *
8018
+ * Absent on lanes where the question has no meaning: a media blob's size is
8019
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8020
+ */
8021
+ rowsReconciled: number().int().nonnegative().optional(),
8007
8022
  startedAt: number(),
8008
8023
  finishedAt: number().nullable(),
8009
8024
  error: string().nullable()
@@ -8072,14 +8087,42 @@ var RelocateMediaInputSchema = object({
8072
8087
  /** Omitted = `move`, the pre-existing behaviour. */
8073
8088
  mode: MediaRelocateModeSchema.optional()
8074
8089
  });
8075
- /** How many rows still carry NO `locationId` — the population a repoint would
8076
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8077
- * value that permits a non-blocking `eventMedia` cutover. */
8078
- var UnstampedEventMediaCountSchema = object({
8079
- media: number().int().nonnegative(),
8080
- retrainFrames: number().int().nonnegative(),
8081
- total: number().int().nonnegative()
8090
+ /**
8091
+ * The unstamped population of ONE collection split, because the gate and the
8092
+ * operator ask two different questions and only one of them has to be cheap.
8093
+ *
8094
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8095
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8096
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8097
+ * that matters — after a seal, when the population is empty.
8098
+ *
8099
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8100
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8101
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8102
+ * and useful answer: "there are some, and this read could not say how many"
8103
+ * still refuses the cutover, which is the whole job.
8104
+ */
8105
+ var UnstampedRowsSchema = object({
8106
+ present: boolean(),
8107
+ rows: number().int().nonnegative().nullable()
8082
8108
  });
8109
+ /**
8110
+ * How many rows still carry NO `locationId` — the population a repoint would
8111
+ * silently re-aim at a disk that does not hold their bytes.
8112
+ *
8113
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8114
+ * over. The gate opens on a measured absence and on nothing else; an unread
8115
+ * collection and an empty one are different facts, and this repo has already
8116
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8117
+ */
8118
+ var UnstampedEventMediaCountSchema = object({
8119
+ media: UnstampedRowsSchema,
8120
+ retrainFrames: UnstampedRowsSchema,
8121
+ /** True when EITHER collection holds one. The refusal reads this. */
8122
+ anyPresent: boolean(),
8123
+ /** Sum across both, or `null` when either lane could not be counted. */
8124
+ total: number().int().nonnegative().nullable()
8125
+ }).nullable();
8083
8126
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8084
8127
  /** The independently selectable logical storage classes — every class
8085
8128
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8190,6 +8233,10 @@ var StorageMigrationMoveProgressSchema = object({
8190
8233
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8191
8234
  filesTotal: number().int().nonnegative().nullable(),
8192
8235
  bytesMoved: number().int().nonnegative(),
8236
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8237
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8238
+ * rows would be the same failure as one that silently skipped them. */
8239
+ rowsReconciled: number().int().nonnegative().optional(),
8193
8240
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8194
8241
  * crash gets a new mover, and a rate computed from the migration's start
8195
8242
  * would silently average in the time nothing was running. */
@@ -13004,6 +13051,114 @@ method(object({
13004
13051
  height: number()
13005
13052
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13006
13053
  /**
13054
+ * `failure-contribution` — the capability an addon reports its OWN losses
13055
+ * through, per camera, with the denominator attached. It stores nothing.
13056
+ *
13057
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13058
+ *
13059
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13060
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13061
+ * copied: the contributor reports what it already knows, hub-main adds only
13062
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13063
+ * somebody to forget to edit.
13064
+ *
13065
+ * They are not merged, because their invariants are opposites:
13066
+ *
13067
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13068
+ * claim a camera cost nothing, which is a measurement nobody made;
13069
+ * - a `failure-contribution` zero is the **most valuable value on the
13070
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13071
+ * and it is exactly what an absent entry cannot say.
13072
+ *
13073
+ * Putting a loss counter on a cost entry would also break the reconciliation
13074
+ * that gives `load-contribution` its point: contributions are subtracted from
13075
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13076
+ * has no process.
13077
+ *
13078
+ * ## Why not a log line, since the counters already exist
13079
+ *
13080
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13081
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13082
+ * ends in a log line, and a log line is the thing the operator asked to stop
13083
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13084
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13085
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13086
+ * media blackout were both diagnosed. The counters stay; this is where they can
13087
+ * be READ.
13088
+ *
13089
+ * ## The rate is served with its denominator or not at all
13090
+ *
13091
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13092
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13093
+ * than yesterday" and was **flat across twelve hours** once divided by the
13094
+ * successes on the same path. A surface that publishes only the numerator
13095
+ * reproduces that mistake on every read.
13096
+ *
13097
+ * ## Shape
13098
+ *
13099
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13100
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13101
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13102
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13103
+ * a forked runner's entries reach hub-main over transport that already exists.
13104
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13105
+ * result through `system.getFailureContributions`.
13106
+ */
13107
+ var FailureReasonCountSchema = object({
13108
+ /**
13109
+ * Why the attempt did not land, in the contributor's own vocabulary —
13110
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13111
+ * strings that already appear in this repo's logs and, where one exists, the
13112
+ * same string the per-track `previewMissReason` records (D276): a second
13113
+ * vocabulary for the same loss would make the row and the counter
13114
+ * un-joinable.
13115
+ */
13116
+ reason: string(),
13117
+ count: number().int().nonnegative()
13118
+ });
13119
+ var FailureContributionSchema = object({
13120
+ /**
13121
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13122
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13123
+ * `unit` free: the families are owned by different addons and a shared enum
13124
+ * is a central list that rots invisibly.
13125
+ */
13126
+ family: string(),
13127
+ /**
13128
+ * The NUMERIC device id — the same value every log line carries as
13129
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13130
+ * cannot name the camera must not emit the entry, because a fleet total
13131
+ * cannot answer the only question anybody asks of this surface.
13132
+ */
13133
+ deviceId: number().int().positive(),
13134
+ /**
13135
+ * A second dimension inside the family: the model / step id for an inference
13136
+ * timeout, so "which camera AND which model" is one read. Absent when the
13137
+ * family has a single variant.
13138
+ */
13139
+ variant: string().optional(),
13140
+ /**
13141
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13142
+ * differencing two reads must drop the interval when it changes, because the
13143
+ * counter restarted from zero in a respawned runner. Same discipline as
13144
+ * `LoadContribution.startedAtMs`.
13145
+ */
13146
+ sinceMs: number(),
13147
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13148
+ atMs: number(),
13149
+ /**
13150
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13151
+ * window. A failure count published without it is the mistake this schema
13152
+ * exists to make impossible.
13153
+ */
13154
+ attempts: number().int().nonnegative(),
13155
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13156
+ succeeded: number().int().nonnegative(),
13157
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13158
+ reasons: array(FailureReasonCountSchema).readonly()
13159
+ });
13160
+ method(_void(), array(FailureContributionSchema).readonly());
13161
+ /**
13007
13162
  * filesystem-browse — per-node capability for browsing the node's local
13008
13163
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13009
13164
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13525,6 +13680,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13525
13680
  kind: "mutation",
13526
13681
  auth: "admin"
13527
13682
  });
13683
+ var LoadContributionSchema = object({
13684
+ role: _enum([
13685
+ "decode",
13686
+ "transcode",
13687
+ "recording",
13688
+ "streaming",
13689
+ "detection"
13690
+ ]),
13691
+ /**
13692
+ * The NUMERIC device id — the same value every log line carries as
13693
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13694
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13695
+ * contributor that cannot name its camera must not emit the entry at all,
13696
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13697
+ * and would quietly turn one camera's cost into everybody's.
13698
+ */
13699
+ deviceId: number().int().positive().nullable(),
13700
+ attribution: _enum([
13701
+ "measured",
13702
+ "accounted",
13703
+ "unattributable"
13704
+ ]),
13705
+ /**
13706
+ * What ONE entry is, in the contributor's own words — `615/high`,
13707
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13708
+ * family and inventing a common one would lose the only information that
13709
+ * makes two entries for the same camera distinguishable.
13710
+ */
13711
+ unit: string(),
13712
+ /**
13713
+ * The OS process this cost lives in, when there is one. Present so a
13714
+ * consumer can (a) tell two generations of the same unit apart across a
13715
+ * restart, and (b) subtract claimed processes from the node's process
13716
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13717
+ * process of its own.
13718
+ */
13719
+ pid: number().int().positive().optional(),
13720
+ /**
13721
+ * When this generation started. The pid's incarnation marker: a consumer
13722
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13723
+ * window when this changes, because the counter restarted from zero in a new
13724
+ * process.
13725
+ */
13726
+ startedAtMs: number().optional(),
13727
+ /**
13728
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13729
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13730
+ * contribution is asked for.
13731
+ *
13732
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13733
+ * needs a sampler, and a new per-node sampler is the defect half of
13734
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13735
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13736
+ *
13737
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13738
+ * an entry with no process.
13739
+ */
13740
+ cpuSeconds: number().optional(),
13741
+ /** Resident bytes of this unit's process, same source and same rules. */
13742
+ rssBytes: number().optional()
13743
+ });
13744
+ method(_void(), array(LoadContributionSchema).readonly());
13528
13745
  /**
13529
13746
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13530
13747
  * through. It stores nothing.
@@ -13601,176 +13818,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13601
13818
  tags: record(string(), string()).optional()
13602
13819
  }), array(LogEntrySchema).readonly());
13603
13820
  /**
13604
- * `failure-contribution` — the capability an addon reports its OWN losses
13605
- * through, per camera, with the denominator attached. It stores nothing.
13606
- *
13607
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13608
- *
13609
- * `load-contribution` answers *what did this camera COST*. This answers *what
13610
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13611
- * copied: the contributor reports what it already knows, hub-main adds only
13612
- * `addonId`, nothing needs global knowledge, and there is no central list for
13613
- * somebody to forget to edit.
13614
- *
13615
- * They are not merged, because their invariants are opposites:
13616
- *
13617
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13618
- * claim a camera cost nothing, which is a measurement nobody made;
13619
- * - a `failure-contribution` zero is the **most valuable value on the
13620
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13621
- * and it is exactly what an absent entry cannot say.
13622
- *
13623
- * Putting a loss counter on a cost entry would also break the reconciliation
13624
- * that gives `load-contribution` its point: contributions are subtracted from
13625
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13626
- * has no process.
13627
- *
13628
- * ## Why not a log line, since the counters already exist
13629
- *
13630
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13631
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13632
- * ends in a log line, and a log line is the thing the operator asked to stop
13633
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13634
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13635
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13636
- * media blackout were both diagnosed. The counters stay; this is where they can
13637
- * be READ.
13638
- *
13639
- * ## The rate is served with its denominator or not at all
13640
- *
13641
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13642
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13643
- * than yesterday" and was **flat across twelve hours** once divided by the
13644
- * successes on the same path. A surface that publishes only the numerator
13645
- * reproduces that mistake on every read.
13646
- *
13647
- * ## Shape
13648
- *
13649
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13650
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13651
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13652
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13653
- * a forked runner's entries reach hub-main over transport that already exists.
13654
- * No new UDS message, no second registry (D3). The operator reads the assembled
13655
- * result through `system.getFailureContributions`.
13656
- */
13657
- var FailureReasonCountSchema = object({
13658
- /**
13659
- * Why the attempt did not land, in the contributor's own vocabulary —
13660
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13661
- * strings that already appear in this repo's logs and, where one exists, the
13662
- * same string the per-track `previewMissReason` records (D276): a second
13663
- * vocabulary for the same loss would make the row and the counter
13664
- * un-joinable.
13665
- */
13666
- reason: string(),
13667
- count: number().int().nonnegative()
13668
- });
13669
- var FailureContributionSchema = object({
13670
- /**
13671
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13672
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13673
- * `unit` free: the families are owned by different addons and a shared enum
13674
- * is a central list that rots invisibly.
13675
- */
13676
- family: string(),
13677
- /**
13678
- * The NUMERIC device id — the same value every log line carries as
13679
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13680
- * cannot name the camera must not emit the entry, because a fleet total
13681
- * cannot answer the only question anybody asks of this surface.
13682
- */
13683
- deviceId: number().int().positive(),
13684
- /**
13685
- * A second dimension inside the family: the model / step id for an inference
13686
- * timeout, so "which camera AND which model" is one read. Absent when the
13687
- * family has a single variant.
13688
- */
13689
- variant: string().optional(),
13690
- /**
13691
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13692
- * differencing two reads must drop the interval when it changes, because the
13693
- * counter restarted from zero in a respawned runner. Same discipline as
13694
- * `LoadContribution.startedAtMs`.
13695
- */
13696
- sinceMs: number(),
13697
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13698
- atMs: number(),
13699
- /**
13700
- * THE DENOMINATOR — every attempt on this path for this camera in the
13701
- * window. A failure count published without it is the mistake this schema
13702
- * exists to make impossible.
13703
- */
13704
- attempts: number().int().nonnegative(),
13705
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13706
- succeeded: number().int().nonnegative(),
13707
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13708
- reasons: array(FailureReasonCountSchema).readonly()
13709
- });
13710
- method(_void(), array(FailureContributionSchema).readonly());
13711
- var LoadContributionSchema = object({
13712
- role: _enum([
13713
- "decode",
13714
- "transcode",
13715
- "recording",
13716
- "streaming",
13717
- "detection"
13718
- ]),
13719
- /**
13720
- * The NUMERIC device id — the same value every log line carries as
13721
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13722
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13723
- * contributor that cannot name its camera must not emit the entry at all,
13724
- * because an unnamed per-camera entry is indistinguishable from a shared one
13725
- * and would quietly turn one camera's cost into everybody's.
13726
- */
13727
- deviceId: number().int().positive().nullable(),
13728
- attribution: _enum([
13729
- "measured",
13730
- "accounted",
13731
- "unattributable"
13732
- ]),
13733
- /**
13734
- * What ONE entry is, in the contributor's own words — `615/high`,
13735
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13736
- * family and inventing a common one would lose the only information that
13737
- * makes two entries for the same camera distinguishable.
13738
- */
13739
- unit: string(),
13740
- /**
13741
- * The OS process this cost lives in, when there is one. Present so a
13742
- * consumer can (a) tell two generations of the same unit apart across a
13743
- * restart, and (b) subtract claimed processes from the node's process
13744
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13745
- * process of its own.
13746
- */
13747
- pid: number().int().positive().optional(),
13748
- /**
13749
- * When this generation started. The pid's incarnation marker: a consumer
13750
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13751
- * window when this changes, because the counter restarted from zero in a new
13752
- * process.
13753
- */
13754
- startedAtMs: number().optional(),
13755
- /**
13756
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13757
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13758
- * contribution is asked for.
13759
- *
13760
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13761
- * needs a sampler, and a new per-node sampler is the defect half of
13762
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13763
- * by whoever already keeps a history; a rate cannot be un-averaged.
13764
- *
13765
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13766
- * an entry with no process.
13767
- */
13768
- cpuSeconds: number().optional(),
13769
- /** Resident bytes of this unit's process, same source and same rules. */
13770
- rssBytes: number().optional()
13771
- });
13772
- method(_void(), array(LoadContributionSchema).readonly());
13773
- /**
13774
13821
  * `login-method` — collection cap through which auth addons contribute
13775
13822
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13776
13823
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18430,12 +18477,53 @@ var MediaFileKindEnum = _enum([
18430
18477
  "keyFrameSmall",
18431
18478
  "thumbnailSmall"
18432
18479
  ]);
18480
+ /**
18481
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18482
+ * ARE — never the bytes themselves.
18483
+ *
18484
+ * ## Why `url` and not `base64`
18485
+ *
18486
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18487
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18488
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18489
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18490
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18491
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18492
+ *
18493
+ * `url` points at the `event-media` data plane
18494
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18495
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18496
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18497
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18498
+ * no less protected than they were inside a `view`-level cap response — see
18499
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18500
+ * (per-device scoping).
18501
+ *
18502
+ * The URL is built from the row's **stored** key, which is not always its
18503
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18504
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18505
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18506
+ *
18507
+ * ## `base64` is TRANSITIONAL and is going away
18508
+ *
18509
+ * It is still populated for one reason: the deployed viewer's track-detail
18510
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18511
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18512
+ * triangle — not as absence. Removing the field before that viewer ships is an
18513
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18514
+ * delete this line and the `withBytes` pass-through in
18515
+ * `analytics-query-facade.ts`; nothing else reads it.
18516
+ */
18433
18517
  var MediaFileSchema = object({
18434
18518
  key: string(),
18435
18519
  kind: MediaFileKindEnum,
18436
- base64: string(),
18437
18520
  sizeBytes: number(),
18438
18521
  timestamp: number()
18522
+ }).extend({
18523
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18524
+ url: string(),
18525
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18526
+ base64: string()
18439
18527
  });
18440
18528
  /**
18441
18529
  * One media row WITHOUT its bytes.
@@ -18447,7 +18535,9 @@ var MediaFileSchema = object({
18447
18535
  * blocks the whole view.
18448
18536
  *
18449
18537
  * `sizeBytes` is carried because it is what lets a client decide between the
18450
- * stored blob and a `?variant=thumb` rendering without fetching either.
18538
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18539
+ * `url` because a client that had to build the plane path itself is a second
18540
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18451
18541
  */
18452
18542
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18453
18543
  /**
@@ -19136,6 +19226,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19136
19226
  }), array(MediaFileSchema).readonly()), method(object({
19137
19227
  trackId: string(),
19138
19228
  deviceId: number()
19229
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19230
+ eventId: string(),
19231
+ deviceId: number()
19139
19232
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19140
19233
  kind: "mutation",
19141
19234
  auth: "admin"
@@ -23396,10 +23489,24 @@ var FaceClusterSchema = object({
23396
23489
  size: number().int(),
23397
23490
  cohesion: number()
23398
23491
  });
23492
+ /**
23493
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23494
+ * are — never the bytes.
23495
+ *
23496
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23497
+ * track/event contract) is still populated because a deployed viewer requires
23498
+ * the field to parse a row at all; this method has no such reader. Its ONE
23499
+ * caller is the admin UI's detail modal, which was building
23500
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23501
+ * dialog already rendering its key FRAME from the `event-media` plane.
23502
+ *
23503
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23504
+ * media key directly, so this needed no new plane and no new access decision.
23505
+ */
23399
23506
  var MediaFileLiteSchema$1 = object({
23400
23507
  key: string(),
23401
23508
  kind: string(),
23402
- base64: string(),
23509
+ url: string(),
23403
23510
  sizeBytes: number(),
23404
23511
  timestamp: number()
23405
23512
  });
@@ -25651,10 +25758,24 @@ var PlateInfoSchema = object({
25651
25758
  */
25652
25759
  cropUrl: string().optional()
25653
25760
  });
25761
+ /**
25762
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25763
+ * are — never the bytes.
25764
+ *
25765
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25766
+ * track/event contract) is still populated because a deployed viewer requires
25767
+ * the field to parse a row at all; this method has no such reader. Its ONE
25768
+ * caller is the admin UI's detail modal, which was building
25769
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25770
+ * dialog already rendering its key FRAME from the `event-media` plane.
25771
+ *
25772
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25773
+ * media key directly, so this needed no new plane and no new access decision.
25774
+ */
25654
25775
  var MediaFileLiteSchema = object({
25655
25776
  key: string(),
25656
25777
  kind: string(),
25657
- base64: string(),
25778
+ url: string(),
25658
25779
  sizeBytes: number(),
25659
25780
  timestamp: number()
25660
25781
  });
@@ -31667,6 +31788,12 @@ Object.freeze({
31667
31788
  addonId: null,
31668
31789
  access: "view"
31669
31790
  },
31791
+ "pipelineAnalytics.listEventMedia": {
31792
+ capName: "pipeline-analytics",
31793
+ capScope: "device",
31794
+ addonId: null,
31795
+ access: "view"
31796
+ },
31670
31797
  "pipelineAnalytics.listGroups": {
31671
31798
  capName: "pipeline-analytics",
31672
31799
  capScope: "device",
@@ -35290,6 +35417,11 @@ Object.freeze({
35290
35417
  form: "array",
35291
35418
  optional: false
35292
35419
  }],
35420
+ "pipelineAnalytics.listEventMedia": [{
35421
+ name: "deviceId",
35422
+ form: "single",
35423
+ optional: false
35424
+ }],
35293
35425
  "pipelineAnalytics.listGroups": [{
35294
35426
  name: "deviceIds",
35295
35427
  form: "array",
package/dist/index.mjs CHANGED
@@ -8000,6 +8000,21 @@ var RelocateJobSchema = object({
8000
8000
  bytesMoved: number().int(),
8001
8001
  /** Total files discovered up front; null while (or when) unknown. */
8002
8002
  filesTotal: number().int().nullable(),
8003
+ /**
8004
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8005
+ * made that nobody asked for, so it is reported where the operator reads the
8006
+ * job rather than only in a log line.
8007
+ *
8008
+ * A footage segment records its byte count in its own NAME, and the durable
8009
+ * hour row derives its aggregates from those names. A file that does not
8010
+ * match its name therefore makes the ledger's sums — and with them quota and
8011
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8012
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8013
+ *
8014
+ * Absent on lanes where the question has no meaning: a media blob's size is
8015
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8016
+ */
8017
+ rowsReconciled: number().int().nonnegative().optional(),
8003
8018
  startedAt: number(),
8004
8019
  finishedAt: number().nullable(),
8005
8020
  error: string().nullable()
@@ -8068,14 +8083,42 @@ var RelocateMediaInputSchema = object({
8068
8083
  /** Omitted = `move`, the pre-existing behaviour. */
8069
8084
  mode: MediaRelocateModeSchema.optional()
8070
8085
  });
8071
- /** How many rows still carry NO `locationId` — the population a repoint would
8072
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8073
- * value that permits a non-blocking `eventMedia` cutover. */
8074
- var UnstampedEventMediaCountSchema = object({
8075
- media: number().int().nonnegative(),
8076
- retrainFrames: number().int().nonnegative(),
8077
- total: number().int().nonnegative()
8086
+ /**
8087
+ * The unstamped population of ONE collection split, because the gate and the
8088
+ * operator ask two different questions and only one of them has to be cheap.
8089
+ *
8090
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8091
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8092
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8093
+ * that matters — after a seal, when the population is empty.
8094
+ *
8095
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8096
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8097
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8098
+ * and useful answer: "there are some, and this read could not say how many"
8099
+ * still refuses the cutover, which is the whole job.
8100
+ */
8101
+ var UnstampedRowsSchema = object({
8102
+ present: boolean(),
8103
+ rows: number().int().nonnegative().nullable()
8078
8104
  });
8105
+ /**
8106
+ * How many rows still carry NO `locationId` — the population a repoint would
8107
+ * silently re-aim at a disk that does not hold their bytes.
8108
+ *
8109
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8110
+ * over. The gate opens on a measured absence and on nothing else; an unread
8111
+ * collection and an empty one are different facts, and this repo has already
8112
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8113
+ */
8114
+ var UnstampedEventMediaCountSchema = object({
8115
+ media: UnstampedRowsSchema,
8116
+ retrainFrames: UnstampedRowsSchema,
8117
+ /** True when EITHER collection holds one. The refusal reads this. */
8118
+ anyPresent: boolean(),
8119
+ /** Sum across both, or `null` when either lane could not be counted. */
8120
+ total: number().int().nonnegative().nullable()
8121
+ }).nullable();
8079
8122
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8080
8123
  /** The independently selectable logical storage classes — every class
8081
8124
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8186,6 +8229,10 @@ var StorageMigrationMoveProgressSchema = object({
8186
8229
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8187
8230
  filesTotal: number().int().nonnegative().nullable(),
8188
8231
  bytesMoved: number().int().nonnegative(),
8232
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8233
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8234
+ * rows would be the same failure as one that silently skipped them. */
8235
+ rowsReconciled: number().int().nonnegative().optional(),
8189
8236
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8190
8237
  * crash gets a new mover, and a rate computed from the migration's start
8191
8238
  * would silently average in the time nothing was running. */
@@ -13000,6 +13047,114 @@ method(object({
13000
13047
  height: number()
13001
13048
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13002
13049
  /**
13050
+ * `failure-contribution` — the capability an addon reports its OWN losses
13051
+ * through, per camera, with the denominator attached. It stores nothing.
13052
+ *
13053
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13054
+ *
13055
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13056
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13057
+ * copied: the contributor reports what it already knows, hub-main adds only
13058
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13059
+ * somebody to forget to edit.
13060
+ *
13061
+ * They are not merged, because their invariants are opposites:
13062
+ *
13063
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13064
+ * claim a camera cost nothing, which is a measurement nobody made;
13065
+ * - a `failure-contribution` zero is the **most valuable value on the
13066
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13067
+ * and it is exactly what an absent entry cannot say.
13068
+ *
13069
+ * Putting a loss counter on a cost entry would also break the reconciliation
13070
+ * that gives `load-contribution` its point: contributions are subtracted from
13071
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13072
+ * has no process.
13073
+ *
13074
+ * ## Why not a log line, since the counters already exist
13075
+ *
13076
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13077
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13078
+ * ends in a log line, and a log line is the thing the operator asked to stop
13079
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13080
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13081
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13082
+ * media blackout were both diagnosed. The counters stay; this is where they can
13083
+ * be READ.
13084
+ *
13085
+ * ## The rate is served with its denominator or not at all
13086
+ *
13087
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13088
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13089
+ * than yesterday" and was **flat across twelve hours** once divided by the
13090
+ * successes on the same path. A surface that publishes only the numerator
13091
+ * reproduces that mistake on every read.
13092
+ *
13093
+ * ## Shape
13094
+ *
13095
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13096
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13097
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13098
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13099
+ * a forked runner's entries reach hub-main over transport that already exists.
13100
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13101
+ * result through `system.getFailureContributions`.
13102
+ */
13103
+ var FailureReasonCountSchema = object({
13104
+ /**
13105
+ * Why the attempt did not land, in the contributor's own vocabulary —
13106
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13107
+ * strings that already appear in this repo's logs and, where one exists, the
13108
+ * same string the per-track `previewMissReason` records (D276): a second
13109
+ * vocabulary for the same loss would make the row and the counter
13110
+ * un-joinable.
13111
+ */
13112
+ reason: string(),
13113
+ count: number().int().nonnegative()
13114
+ });
13115
+ var FailureContributionSchema = object({
13116
+ /**
13117
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13118
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13119
+ * `unit` free: the families are owned by different addons and a shared enum
13120
+ * is a central list that rots invisibly.
13121
+ */
13122
+ family: string(),
13123
+ /**
13124
+ * The NUMERIC device id — the same value every log line carries as
13125
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13126
+ * cannot name the camera must not emit the entry, because a fleet total
13127
+ * cannot answer the only question anybody asks of this surface.
13128
+ */
13129
+ deviceId: number().int().positive(),
13130
+ /**
13131
+ * A second dimension inside the family: the model / step id for an inference
13132
+ * timeout, so "which camera AND which model" is one read. Absent when the
13133
+ * family has a single variant.
13134
+ */
13135
+ variant: string().optional(),
13136
+ /**
13137
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13138
+ * differencing two reads must drop the interval when it changes, because the
13139
+ * counter restarted from zero in a respawned runner. Same discipline as
13140
+ * `LoadContribution.startedAtMs`.
13141
+ */
13142
+ sinceMs: number(),
13143
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13144
+ atMs: number(),
13145
+ /**
13146
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13147
+ * window. A failure count published without it is the mistake this schema
13148
+ * exists to make impossible.
13149
+ */
13150
+ attempts: number().int().nonnegative(),
13151
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13152
+ succeeded: number().int().nonnegative(),
13153
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13154
+ reasons: array(FailureReasonCountSchema).readonly()
13155
+ });
13156
+ method(_void(), array(FailureContributionSchema).readonly());
13157
+ /**
13003
13158
  * filesystem-browse — per-node capability for browsing the node's local
13004
13159
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13005
13160
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13521,6 +13676,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13521
13676
  kind: "mutation",
13522
13677
  auth: "admin"
13523
13678
  });
13679
+ var LoadContributionSchema = object({
13680
+ role: _enum([
13681
+ "decode",
13682
+ "transcode",
13683
+ "recording",
13684
+ "streaming",
13685
+ "detection"
13686
+ ]),
13687
+ /**
13688
+ * The NUMERIC device id — the same value every log line carries as
13689
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13690
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13691
+ * contributor that cannot name its camera must not emit the entry at all,
13692
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13693
+ * and would quietly turn one camera's cost into everybody's.
13694
+ */
13695
+ deviceId: number().int().positive().nullable(),
13696
+ attribution: _enum([
13697
+ "measured",
13698
+ "accounted",
13699
+ "unattributable"
13700
+ ]),
13701
+ /**
13702
+ * What ONE entry is, in the contributor's own words — `615/high`,
13703
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13704
+ * family and inventing a common one would lose the only information that
13705
+ * makes two entries for the same camera distinguishable.
13706
+ */
13707
+ unit: string(),
13708
+ /**
13709
+ * The OS process this cost lives in, when there is one. Present so a
13710
+ * consumer can (a) tell two generations of the same unit apart across a
13711
+ * restart, and (b) subtract claimed processes from the node's process
13712
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13713
+ * process of its own.
13714
+ */
13715
+ pid: number().int().positive().optional(),
13716
+ /**
13717
+ * When this generation started. The pid's incarnation marker: a consumer
13718
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13719
+ * window when this changes, because the counter restarted from zero in a new
13720
+ * process.
13721
+ */
13722
+ startedAtMs: number().optional(),
13723
+ /**
13724
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13725
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13726
+ * contribution is asked for.
13727
+ *
13728
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13729
+ * needs a sampler, and a new per-node sampler is the defect half of
13730
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13731
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13732
+ *
13733
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13734
+ * an entry with no process.
13735
+ */
13736
+ cpuSeconds: number().optional(),
13737
+ /** Resident bytes of this unit's process, same source and same rules. */
13738
+ rssBytes: number().optional()
13739
+ });
13740
+ method(_void(), array(LoadContributionSchema).readonly());
13524
13741
  /**
13525
13742
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13526
13743
  * through. It stores nothing.
@@ -13597,176 +13814,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13597
13814
  tags: record(string(), string()).optional()
13598
13815
  }), array(LogEntrySchema).readonly());
13599
13816
  /**
13600
- * `failure-contribution` — the capability an addon reports its OWN losses
13601
- * through, per camera, with the denominator attached. It stores nothing.
13602
- *
13603
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13604
- *
13605
- * `load-contribution` answers *what did this camera COST*. This answers *what
13606
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13607
- * copied: the contributor reports what it already knows, hub-main adds only
13608
- * `addonId`, nothing needs global knowledge, and there is no central list for
13609
- * somebody to forget to edit.
13610
- *
13611
- * They are not merged, because their invariants are opposites:
13612
- *
13613
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13614
- * claim a camera cost nothing, which is a measurement nobody made;
13615
- * - a `failure-contribution` zero is the **most valuable value on the
13616
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13617
- * and it is exactly what an absent entry cannot say.
13618
- *
13619
- * Putting a loss counter on a cost entry would also break the reconciliation
13620
- * that gives `load-contribution` its point: contributions are subtracted from
13621
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13622
- * has no process.
13623
- *
13624
- * ## Why not a log line, since the counters already exist
13625
- *
13626
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13627
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13628
- * ends in a log line, and a log line is the thing the operator asked to stop
13629
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13630
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13631
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13632
- * media blackout were both diagnosed. The counters stay; this is where they can
13633
- * be READ.
13634
- *
13635
- * ## The rate is served with its denominator or not at all
13636
- *
13637
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13638
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13639
- * than yesterday" and was **flat across twelve hours** once divided by the
13640
- * successes on the same path. A surface that publishes only the numerator
13641
- * reproduces that mistake on every read.
13642
- *
13643
- * ## Shape
13644
- *
13645
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13646
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13647
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13648
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13649
- * a forked runner's entries reach hub-main over transport that already exists.
13650
- * No new UDS message, no second registry (D3). The operator reads the assembled
13651
- * result through `system.getFailureContributions`.
13652
- */
13653
- var FailureReasonCountSchema = object({
13654
- /**
13655
- * Why the attempt did not land, in the contributor's own vocabulary —
13656
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13657
- * strings that already appear in this repo's logs and, where one exists, the
13658
- * same string the per-track `previewMissReason` records (D276): a second
13659
- * vocabulary for the same loss would make the row and the counter
13660
- * un-joinable.
13661
- */
13662
- reason: string(),
13663
- count: number().int().nonnegative()
13664
- });
13665
- var FailureContributionSchema = object({
13666
- /**
13667
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13668
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13669
- * `unit` free: the families are owned by different addons and a shared enum
13670
- * is a central list that rots invisibly.
13671
- */
13672
- family: string(),
13673
- /**
13674
- * The NUMERIC device id — the same value every log line carries as
13675
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13676
- * cannot name the camera must not emit the entry, because a fleet total
13677
- * cannot answer the only question anybody asks of this surface.
13678
- */
13679
- deviceId: number().int().positive(),
13680
- /**
13681
- * A second dimension inside the family: the model / step id for an inference
13682
- * timeout, so "which camera AND which model" is one read. Absent when the
13683
- * family has a single variant.
13684
- */
13685
- variant: string().optional(),
13686
- /**
13687
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13688
- * differencing two reads must drop the interval when it changes, because the
13689
- * counter restarted from zero in a respawned runner. Same discipline as
13690
- * `LoadContribution.startedAtMs`.
13691
- */
13692
- sinceMs: number(),
13693
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13694
- atMs: number(),
13695
- /**
13696
- * THE DENOMINATOR — every attempt on this path for this camera in the
13697
- * window. A failure count published without it is the mistake this schema
13698
- * exists to make impossible.
13699
- */
13700
- attempts: number().int().nonnegative(),
13701
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13702
- succeeded: number().int().nonnegative(),
13703
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13704
- reasons: array(FailureReasonCountSchema).readonly()
13705
- });
13706
- method(_void(), array(FailureContributionSchema).readonly());
13707
- var LoadContributionSchema = object({
13708
- role: _enum([
13709
- "decode",
13710
- "transcode",
13711
- "recording",
13712
- "streaming",
13713
- "detection"
13714
- ]),
13715
- /**
13716
- * The NUMERIC device id — the same value every log line carries as
13717
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13718
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13719
- * contributor that cannot name its camera must not emit the entry at all,
13720
- * because an unnamed per-camera entry is indistinguishable from a shared one
13721
- * and would quietly turn one camera's cost into everybody's.
13722
- */
13723
- deviceId: number().int().positive().nullable(),
13724
- attribution: _enum([
13725
- "measured",
13726
- "accounted",
13727
- "unattributable"
13728
- ]),
13729
- /**
13730
- * What ONE entry is, in the contributor's own words — `615/high`,
13731
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13732
- * family and inventing a common one would lose the only information that
13733
- * makes two entries for the same camera distinguishable.
13734
- */
13735
- unit: string(),
13736
- /**
13737
- * The OS process this cost lives in, when there is one. Present so a
13738
- * consumer can (a) tell two generations of the same unit apart across a
13739
- * restart, and (b) subtract claimed processes from the node's process
13740
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13741
- * process of its own.
13742
- */
13743
- pid: number().int().positive().optional(),
13744
- /**
13745
- * When this generation started. The pid's incarnation marker: a consumer
13746
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13747
- * window when this changes, because the counter restarted from zero in a new
13748
- * process.
13749
- */
13750
- startedAtMs: number().optional(),
13751
- /**
13752
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13753
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13754
- * contribution is asked for.
13755
- *
13756
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13757
- * needs a sampler, and a new per-node sampler is the defect half of
13758
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13759
- * by whoever already keeps a history; a rate cannot be un-averaged.
13760
- *
13761
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13762
- * an entry with no process.
13763
- */
13764
- cpuSeconds: number().optional(),
13765
- /** Resident bytes of this unit's process, same source and same rules. */
13766
- rssBytes: number().optional()
13767
- });
13768
- method(_void(), array(LoadContributionSchema).readonly());
13769
- /**
13770
13817
  * `login-method` — collection cap through which auth addons contribute
13771
13818
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13772
13819
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18426,12 +18473,53 @@ var MediaFileKindEnum = _enum([
18426
18473
  "keyFrameSmall",
18427
18474
  "thumbnailSmall"
18428
18475
  ]);
18476
+ /**
18477
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18478
+ * ARE — never the bytes themselves.
18479
+ *
18480
+ * ## Why `url` and not `base64`
18481
+ *
18482
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18483
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18484
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18485
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18486
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18487
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18488
+ *
18489
+ * `url` points at the `event-media` data plane
18490
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18491
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18492
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18493
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18494
+ * no less protected than they were inside a `view`-level cap response — see
18495
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18496
+ * (per-device scoping).
18497
+ *
18498
+ * The URL is built from the row's **stored** key, which is not always its
18499
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18500
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18501
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18502
+ *
18503
+ * ## `base64` is TRANSITIONAL and is going away
18504
+ *
18505
+ * It is still populated for one reason: the deployed viewer's track-detail
18506
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18507
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18508
+ * triangle — not as absence. Removing the field before that viewer ships is an
18509
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18510
+ * delete this line and the `withBytes` pass-through in
18511
+ * `analytics-query-facade.ts`; nothing else reads it.
18512
+ */
18429
18513
  var MediaFileSchema = object({
18430
18514
  key: string(),
18431
18515
  kind: MediaFileKindEnum,
18432
- base64: string(),
18433
18516
  sizeBytes: number(),
18434
18517
  timestamp: number()
18518
+ }).extend({
18519
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18520
+ url: string(),
18521
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18522
+ base64: string()
18435
18523
  });
18436
18524
  /**
18437
18525
  * One media row WITHOUT its bytes.
@@ -18443,7 +18531,9 @@ var MediaFileSchema = object({
18443
18531
  * blocks the whole view.
18444
18532
  *
18445
18533
  * `sizeBytes` is carried because it is what lets a client decide between the
18446
- * stored blob and a `?variant=thumb` rendering without fetching either.
18534
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18535
+ * `url` because a client that had to build the plane path itself is a second
18536
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18447
18537
  */
18448
18538
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18449
18539
  /**
@@ -19132,6 +19222,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19132
19222
  }), array(MediaFileSchema).readonly()), method(object({
19133
19223
  trackId: string(),
19134
19224
  deviceId: number()
19225
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19226
+ eventId: string(),
19227
+ deviceId: number()
19135
19228
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19136
19229
  kind: "mutation",
19137
19230
  auth: "admin"
@@ -23392,10 +23485,24 @@ var FaceClusterSchema = object({
23392
23485
  size: number().int(),
23393
23486
  cohesion: number()
23394
23487
  });
23488
+ /**
23489
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23490
+ * are — never the bytes.
23491
+ *
23492
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23493
+ * track/event contract) is still populated because a deployed viewer requires
23494
+ * the field to parse a row at all; this method has no such reader. Its ONE
23495
+ * caller is the admin UI's detail modal, which was building
23496
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23497
+ * dialog already rendering its key FRAME from the `event-media` plane.
23498
+ *
23499
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23500
+ * media key directly, so this needed no new plane and no new access decision.
23501
+ */
23395
23502
  var MediaFileLiteSchema$1 = object({
23396
23503
  key: string(),
23397
23504
  kind: string(),
23398
- base64: string(),
23505
+ url: string(),
23399
23506
  sizeBytes: number(),
23400
23507
  timestamp: number()
23401
23508
  });
@@ -25647,10 +25754,24 @@ var PlateInfoSchema = object({
25647
25754
  */
25648
25755
  cropUrl: string().optional()
25649
25756
  });
25757
+ /**
25758
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25759
+ * are — never the bytes.
25760
+ *
25761
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25762
+ * track/event contract) is still populated because a deployed viewer requires
25763
+ * the field to parse a row at all; this method has no such reader. Its ONE
25764
+ * caller is the admin UI's detail modal, which was building
25765
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25766
+ * dialog already rendering its key FRAME from the `event-media` plane.
25767
+ *
25768
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25769
+ * media key directly, so this needed no new plane and no new access decision.
25770
+ */
25650
25771
  var MediaFileLiteSchema = object({
25651
25772
  key: string(),
25652
25773
  kind: string(),
25653
- base64: string(),
25774
+ url: string(),
25654
25775
  sizeBytes: number(),
25655
25776
  timestamp: number()
25656
25777
  });
@@ -31663,6 +31784,12 @@ Object.freeze({
31663
31784
  addonId: null,
31664
31785
  access: "view"
31665
31786
  },
31787
+ "pipelineAnalytics.listEventMedia": {
31788
+ capName: "pipeline-analytics",
31789
+ capScope: "device",
31790
+ addonId: null,
31791
+ access: "view"
31792
+ },
31666
31793
  "pipelineAnalytics.listGroups": {
31667
31794
  capName: "pipeline-analytics",
31668
31795
  capScope: "device",
@@ -35286,6 +35413,11 @@ Object.freeze({
35286
35413
  form: "array",
35287
35414
  optional: false
35288
35415
  }],
35416
+ "pipelineAnalytics.listEventMedia": [{
35417
+ name: "deviceId",
35418
+ form: "single",
35419
+ optional: false
35420
+ }],
35289
35421
  "pipelineAnalytics.listGroups": [{
35290
35422
  name: "deviceIds",
35291
35423
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-decoder-ffmpeg",
3
- "version": "1.2.45",
3
+ "version": "1.2.47",
4
4
  "description": "Standalone ffmpeg-subprocess decoder fallback addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",