@camstack/addon-provider-onvif 1.2.44 → 1.2.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +313 -181
  2. package/dist/addon.mjs +313 -181
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8002,6 +8002,21 @@ var RelocateJobSchema = object({
8002
8002
  bytesMoved: number().int(),
8003
8003
  /** Total files discovered up front; null while (or when) unknown. */
8004
8004
  filesTotal: number().int().nullable(),
8005
+ /**
8006
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8007
+ * made that nobody asked for, so it is reported where the operator reads the
8008
+ * job rather than only in a log line.
8009
+ *
8010
+ * A footage segment records its byte count in its own NAME, and the durable
8011
+ * hour row derives its aggregates from those names. A file that does not
8012
+ * match its name therefore makes the ledger's sums — and with them quota and
8013
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8014
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8015
+ *
8016
+ * Absent on lanes where the question has no meaning: a media blob's size is
8017
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8018
+ */
8019
+ rowsReconciled: number().int().nonnegative().optional(),
8005
8020
  startedAt: number(),
8006
8021
  finishedAt: number().nullable(),
8007
8022
  error: string().nullable()
@@ -8070,14 +8085,42 @@ var RelocateMediaInputSchema = object({
8070
8085
  /** Omitted = `move`, the pre-existing behaviour. */
8071
8086
  mode: MediaRelocateModeSchema.optional()
8072
8087
  });
8073
- /** How many rows still carry NO `locationId` — the population a repoint would
8074
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8075
- * value that permits a non-blocking `eventMedia` cutover. */
8076
- var UnstampedEventMediaCountSchema = object({
8077
- media: number().int().nonnegative(),
8078
- retrainFrames: number().int().nonnegative(),
8079
- total: number().int().nonnegative()
8088
+ /**
8089
+ * The unstamped population of ONE collection split, because the gate and the
8090
+ * operator ask two different questions and only one of them has to be cheap.
8091
+ *
8092
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8093
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8094
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8095
+ * that matters — after a seal, when the population is empty.
8096
+ *
8097
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8098
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8099
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8100
+ * and useful answer: "there are some, and this read could not say how many"
8101
+ * still refuses the cutover, which is the whole job.
8102
+ */
8103
+ var UnstampedRowsSchema = object({
8104
+ present: boolean(),
8105
+ rows: number().int().nonnegative().nullable()
8080
8106
  });
8107
+ /**
8108
+ * How many rows still carry NO `locationId` — the population a repoint would
8109
+ * silently re-aim at a disk that does not hold their bytes.
8110
+ *
8111
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8112
+ * over. The gate opens on a measured absence and on nothing else; an unread
8113
+ * collection and an empty one are different facts, and this repo has already
8114
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8115
+ */
8116
+ var UnstampedEventMediaCountSchema = object({
8117
+ media: UnstampedRowsSchema,
8118
+ retrainFrames: UnstampedRowsSchema,
8119
+ /** True when EITHER collection holds one. The refusal reads this. */
8120
+ anyPresent: boolean(),
8121
+ /** Sum across both, or `null` when either lane could not be counted. */
8122
+ total: number().int().nonnegative().nullable()
8123
+ }).nullable();
8081
8124
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8082
8125
  /** The independently selectable logical storage classes — every class
8083
8126
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8188,6 +8231,10 @@ var StorageMigrationMoveProgressSchema = object({
8188
8231
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8189
8232
  filesTotal: number().int().nonnegative().nullable(),
8190
8233
  bytesMoved: number().int().nonnegative(),
8234
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8235
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8236
+ * rows would be the same failure as one that silently skipped them. */
8237
+ rowsReconciled: number().int().nonnegative().optional(),
8191
8238
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8192
8239
  * crash gets a new mover, and a rate computed from the migration's start
8193
8240
  * would silently average in the time nothing was running. */
@@ -12927,6 +12974,114 @@ method(object({
12927
12974
  height: number()
12928
12975
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12929
12976
  /**
12977
+ * `failure-contribution` — the capability an addon reports its OWN losses
12978
+ * through, per camera, with the denominator attached. It stores nothing.
12979
+ *
12980
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
12981
+ *
12982
+ * `load-contribution` answers *what did this camera COST*. This answers *what
12983
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
12984
+ * copied: the contributor reports what it already knows, hub-main adds only
12985
+ * `addonId`, nothing needs global knowledge, and there is no central list for
12986
+ * somebody to forget to edit.
12987
+ *
12988
+ * They are not merged, because their invariants are opposites:
12989
+ *
12990
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
12991
+ * claim a camera cost nothing, which is a measurement nobody made;
12992
+ * - a `failure-contribution` zero is the **most valuable value on the
12993
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
12994
+ * and it is exactly what an absent entry cannot say.
12995
+ *
12996
+ * Putting a loss counter on a cost entry would also break the reconciliation
12997
+ * that gives `load-contribution` its point: contributions are subtracted from
12998
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
12999
+ * has no process.
13000
+ *
13001
+ * ## Why not a log line, since the counters already exist
13002
+ *
13003
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13004
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13005
+ * ends in a log line, and a log line is the thing the operator asked to stop
13006
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13007
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13008
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13009
+ * media blackout were both diagnosed. The counters stay; this is where they can
13010
+ * be READ.
13011
+ *
13012
+ * ## The rate is served with its denominator or not at all
13013
+ *
13014
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13015
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13016
+ * than yesterday" and was **flat across twelve hours** once divided by the
13017
+ * successes on the same path. A surface that publishes only the numerator
13018
+ * reproduces that mistake on every read.
13019
+ *
13020
+ * ## Shape
13021
+ *
13022
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13023
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13024
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13025
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13026
+ * a forked runner's entries reach hub-main over transport that already exists.
13027
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13028
+ * result through `system.getFailureContributions`.
13029
+ */
13030
+ var FailureReasonCountSchema = object({
13031
+ /**
13032
+ * Why the attempt did not land, in the contributor's own vocabulary —
13033
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13034
+ * strings that already appear in this repo's logs and, where one exists, the
13035
+ * same string the per-track `previewMissReason` records (D276): a second
13036
+ * vocabulary for the same loss would make the row and the counter
13037
+ * un-joinable.
13038
+ */
13039
+ reason: string(),
13040
+ count: number().int().nonnegative()
13041
+ });
13042
+ var FailureContributionSchema = object({
13043
+ /**
13044
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13045
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13046
+ * `unit` free: the families are owned by different addons and a shared enum
13047
+ * is a central list that rots invisibly.
13048
+ */
13049
+ family: string(),
13050
+ /**
13051
+ * The NUMERIC device id — the same value every log line carries as
13052
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13053
+ * cannot name the camera must not emit the entry, because a fleet total
13054
+ * cannot answer the only question anybody asks of this surface.
13055
+ */
13056
+ deviceId: number().int().positive(),
13057
+ /**
13058
+ * A second dimension inside the family: the model / step id for an inference
13059
+ * timeout, so "which camera AND which model" is one read. Absent when the
13060
+ * family has a single variant.
13061
+ */
13062
+ variant: string().optional(),
13063
+ /**
13064
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13065
+ * differencing two reads must drop the interval when it changes, because the
13066
+ * counter restarted from zero in a respawned runner. Same discipline as
13067
+ * `LoadContribution.startedAtMs`.
13068
+ */
13069
+ sinceMs: number(),
13070
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13071
+ atMs: number(),
13072
+ /**
13073
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13074
+ * window. A failure count published without it is the mistake this schema
13075
+ * exists to make impossible.
13076
+ */
13077
+ attempts: number().int().nonnegative(),
13078
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13079
+ succeeded: number().int().nonnegative(),
13080
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13081
+ reasons: array(FailureReasonCountSchema).readonly()
13082
+ });
13083
+ method(_void(), array(FailureContributionSchema).readonly());
13084
+ /**
12930
13085
  * filesystem-browse — per-node capability for browsing the node's local
12931
13086
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12932
13087
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13448,6 +13603,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13448
13603
  kind: "mutation",
13449
13604
  auth: "admin"
13450
13605
  });
13606
+ var LoadContributionSchema = object({
13607
+ role: _enum([
13608
+ "decode",
13609
+ "transcode",
13610
+ "recording",
13611
+ "streaming",
13612
+ "detection"
13613
+ ]),
13614
+ /**
13615
+ * The NUMERIC device id — the same value every log line carries as
13616
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13617
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13618
+ * contributor that cannot name its camera must not emit the entry at all,
13619
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13620
+ * and would quietly turn one camera's cost into everybody's.
13621
+ */
13622
+ deviceId: number().int().positive().nullable(),
13623
+ attribution: _enum([
13624
+ "measured",
13625
+ "accounted",
13626
+ "unattributable"
13627
+ ]),
13628
+ /**
13629
+ * What ONE entry is, in the contributor's own words — `615/high`,
13630
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13631
+ * family and inventing a common one would lose the only information that
13632
+ * makes two entries for the same camera distinguishable.
13633
+ */
13634
+ unit: string(),
13635
+ /**
13636
+ * The OS process this cost lives in, when there is one. Present so a
13637
+ * consumer can (a) tell two generations of the same unit apart across a
13638
+ * restart, and (b) subtract claimed processes from the node's process
13639
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13640
+ * process of its own.
13641
+ */
13642
+ pid: number().int().positive().optional(),
13643
+ /**
13644
+ * When this generation started. The pid's incarnation marker: a consumer
13645
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13646
+ * window when this changes, because the counter restarted from zero in a new
13647
+ * process.
13648
+ */
13649
+ startedAtMs: number().optional(),
13650
+ /**
13651
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13652
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13653
+ * contribution is asked for.
13654
+ *
13655
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13656
+ * needs a sampler, and a new per-node sampler is the defect half of
13657
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13658
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13659
+ *
13660
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13661
+ * an entry with no process.
13662
+ */
13663
+ cpuSeconds: number().optional(),
13664
+ /** Resident bytes of this unit's process, same source and same rules. */
13665
+ rssBytes: number().optional()
13666
+ });
13667
+ method(_void(), array(LoadContributionSchema).readonly());
13451
13668
  /**
13452
13669
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13453
13670
  * through. It stores nothing.
@@ -13524,176 +13741,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13524
13741
  tags: record(string(), string()).optional()
13525
13742
  }), array(LogEntrySchema).readonly());
13526
13743
  /**
13527
- * `failure-contribution` — the capability an addon reports its OWN losses
13528
- * through, per camera, with the denominator attached. It stores nothing.
13529
- *
13530
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13531
- *
13532
- * `load-contribution` answers *what did this camera COST*. This answers *what
13533
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13534
- * copied: the contributor reports what it already knows, hub-main adds only
13535
- * `addonId`, nothing needs global knowledge, and there is no central list for
13536
- * somebody to forget to edit.
13537
- *
13538
- * They are not merged, because their invariants are opposites:
13539
- *
13540
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13541
- * claim a camera cost nothing, which is a measurement nobody made;
13542
- * - a `failure-contribution` zero is the **most valuable value on the
13543
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13544
- * and it is exactly what an absent entry cannot say.
13545
- *
13546
- * Putting a loss counter on a cost entry would also break the reconciliation
13547
- * that gives `load-contribution` its point: contributions are subtracted from
13548
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13549
- * has no process.
13550
- *
13551
- * ## Why not a log line, since the counters already exist
13552
- *
13553
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13554
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13555
- * ends in a log line, and a log line is the thing the operator asked to stop
13556
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13557
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13558
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13559
- * media blackout were both diagnosed. The counters stay; this is where they can
13560
- * be READ.
13561
- *
13562
- * ## The rate is served with its denominator or not at all
13563
- *
13564
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13565
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13566
- * than yesterday" and was **flat across twelve hours** once divided by the
13567
- * successes on the same path. A surface that publishes only the numerator
13568
- * reproduces that mistake on every read.
13569
- *
13570
- * ## Shape
13571
- *
13572
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13573
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13574
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13575
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13576
- * a forked runner's entries reach hub-main over transport that already exists.
13577
- * No new UDS message, no second registry (D3). The operator reads the assembled
13578
- * result through `system.getFailureContributions`.
13579
- */
13580
- var FailureReasonCountSchema = object({
13581
- /**
13582
- * Why the attempt did not land, in the contributor's own vocabulary —
13583
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13584
- * strings that already appear in this repo's logs and, where one exists, the
13585
- * same string the per-track `previewMissReason` records (D276): a second
13586
- * vocabulary for the same loss would make the row and the counter
13587
- * un-joinable.
13588
- */
13589
- reason: string(),
13590
- count: number().int().nonnegative()
13591
- });
13592
- var FailureContributionSchema = object({
13593
- /**
13594
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13595
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13596
- * `unit` free: the families are owned by different addons and a shared enum
13597
- * is a central list that rots invisibly.
13598
- */
13599
- family: string(),
13600
- /**
13601
- * The NUMERIC device id — the same value every log line carries as
13602
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13603
- * cannot name the camera must not emit the entry, because a fleet total
13604
- * cannot answer the only question anybody asks of this surface.
13605
- */
13606
- deviceId: number().int().positive(),
13607
- /**
13608
- * A second dimension inside the family: the model / step id for an inference
13609
- * timeout, so "which camera AND which model" is one read. Absent when the
13610
- * family has a single variant.
13611
- */
13612
- variant: string().optional(),
13613
- /**
13614
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13615
- * differencing two reads must drop the interval when it changes, because the
13616
- * counter restarted from zero in a respawned runner. Same discipline as
13617
- * `LoadContribution.startedAtMs`.
13618
- */
13619
- sinceMs: number(),
13620
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13621
- atMs: number(),
13622
- /**
13623
- * THE DENOMINATOR — every attempt on this path for this camera in the
13624
- * window. A failure count published without it is the mistake this schema
13625
- * exists to make impossible.
13626
- */
13627
- attempts: number().int().nonnegative(),
13628
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13629
- succeeded: number().int().nonnegative(),
13630
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13631
- reasons: array(FailureReasonCountSchema).readonly()
13632
- });
13633
- method(_void(), array(FailureContributionSchema).readonly());
13634
- var LoadContributionSchema = object({
13635
- role: _enum([
13636
- "decode",
13637
- "transcode",
13638
- "recording",
13639
- "streaming",
13640
- "detection"
13641
- ]),
13642
- /**
13643
- * The NUMERIC device id — the same value every log line carries as
13644
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13645
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13646
- * contributor that cannot name its camera must not emit the entry at all,
13647
- * because an unnamed per-camera entry is indistinguishable from a shared one
13648
- * and would quietly turn one camera's cost into everybody's.
13649
- */
13650
- deviceId: number().int().positive().nullable(),
13651
- attribution: _enum([
13652
- "measured",
13653
- "accounted",
13654
- "unattributable"
13655
- ]),
13656
- /**
13657
- * What ONE entry is, in the contributor's own words — `615/high`,
13658
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13659
- * family and inventing a common one would lose the only information that
13660
- * makes two entries for the same camera distinguishable.
13661
- */
13662
- unit: string(),
13663
- /**
13664
- * The OS process this cost lives in, when there is one. Present so a
13665
- * consumer can (a) tell two generations of the same unit apart across a
13666
- * restart, and (b) subtract claimed processes from the node's process
13667
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13668
- * process of its own.
13669
- */
13670
- pid: number().int().positive().optional(),
13671
- /**
13672
- * When this generation started. The pid's incarnation marker: a consumer
13673
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13674
- * window when this changes, because the counter restarted from zero in a new
13675
- * process.
13676
- */
13677
- startedAtMs: number().optional(),
13678
- /**
13679
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13680
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13681
- * contribution is asked for.
13682
- *
13683
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13684
- * needs a sampler, and a new per-node sampler is the defect half of
13685
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13686
- * by whoever already keeps a history; a rate cannot be un-averaged.
13687
- *
13688
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13689
- * an entry with no process.
13690
- */
13691
- cpuSeconds: number().optional(),
13692
- /** Resident bytes of this unit's process, same source and same rules. */
13693
- rssBytes: number().optional()
13694
- });
13695
- method(_void(), array(LoadContributionSchema).readonly());
13696
- /**
13697
13744
  * `login-method` — collection cap through which auth addons contribute
13698
13745
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13699
13746
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18353,12 +18400,53 @@ var MediaFileKindEnum = _enum([
18353
18400
  "keyFrameSmall",
18354
18401
  "thumbnailSmall"
18355
18402
  ]);
18403
+ /**
18404
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18405
+ * ARE — never the bytes themselves.
18406
+ *
18407
+ * ## Why `url` and not `base64`
18408
+ *
18409
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18410
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18411
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18412
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18413
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18414
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18415
+ *
18416
+ * `url` points at the `event-media` data plane
18417
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18418
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18419
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18420
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18421
+ * no less protected than they were inside a `view`-level cap response — see
18422
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18423
+ * (per-device scoping).
18424
+ *
18425
+ * The URL is built from the row's **stored** key, which is not always its
18426
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18427
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18428
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18429
+ *
18430
+ * ## `base64` is TRANSITIONAL and is going away
18431
+ *
18432
+ * It is still populated for one reason: the deployed viewer's track-detail
18433
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18434
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18435
+ * triangle — not as absence. Removing the field before that viewer ships is an
18436
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18437
+ * delete this line and the `withBytes` pass-through in
18438
+ * `analytics-query-facade.ts`; nothing else reads it.
18439
+ */
18356
18440
  var MediaFileSchema = object({
18357
18441
  key: string(),
18358
18442
  kind: MediaFileKindEnum,
18359
- base64: string(),
18360
18443
  sizeBytes: number(),
18361
18444
  timestamp: number()
18445
+ }).extend({
18446
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18447
+ url: string(),
18448
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18449
+ base64: string()
18362
18450
  });
18363
18451
  /**
18364
18452
  * One media row WITHOUT its bytes.
@@ -18370,7 +18458,9 @@ var MediaFileSchema = object({
18370
18458
  * blocks the whole view.
18371
18459
  *
18372
18460
  * `sizeBytes` is carried because it is what lets a client decide between the
18373
- * stored blob and a `?variant=thumb` rendering without fetching either.
18461
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18462
+ * `url` because a client that had to build the plane path itself is a second
18463
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18374
18464
  */
18375
18465
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18376
18466
  /**
@@ -19059,6 +19149,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19059
19149
  }), array(MediaFileSchema).readonly()), method(object({
19060
19150
  trackId: string(),
19061
19151
  deviceId: number()
19152
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19153
+ eventId: string(),
19154
+ deviceId: number()
19062
19155
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19063
19156
  kind: "mutation",
19064
19157
  auth: "admin"
@@ -23423,10 +23516,24 @@ var FaceClusterSchema = object({
23423
23516
  size: number().int(),
23424
23517
  cohesion: number()
23425
23518
  });
23519
+ /**
23520
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23521
+ * are — never the bytes.
23522
+ *
23523
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23524
+ * track/event contract) is still populated because a deployed viewer requires
23525
+ * the field to parse a row at all; this method has no such reader. Its ONE
23526
+ * caller is the admin UI's detail modal, which was building
23527
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23528
+ * dialog already rendering its key FRAME from the `event-media` plane.
23529
+ *
23530
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23531
+ * media key directly, so this needed no new plane and no new access decision.
23532
+ */
23426
23533
  var MediaFileLiteSchema$1 = object({
23427
23534
  key: string(),
23428
23535
  kind: string(),
23429
- base64: string(),
23536
+ url: string(),
23430
23537
  sizeBytes: number(),
23431
23538
  timestamp: number()
23432
23539
  });
@@ -25678,10 +25785,24 @@ var PlateInfoSchema = object({
25678
25785
  */
25679
25786
  cropUrl: string().optional()
25680
25787
  });
25788
+ /**
25789
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25790
+ * are — never the bytes.
25791
+ *
25792
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25793
+ * track/event contract) is still populated because a deployed viewer requires
25794
+ * the field to parse a row at all; this method has no such reader. Its ONE
25795
+ * caller is the admin UI's detail modal, which was building
25796
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25797
+ * dialog already rendering its key FRAME from the `event-media` plane.
25798
+ *
25799
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25800
+ * media key directly, so this needed no new plane and no new access decision.
25801
+ */
25681
25802
  var MediaFileLiteSchema = object({
25682
25803
  key: string(),
25683
25804
  kind: string(),
25684
- base64: string(),
25805
+ url: string(),
25685
25806
  sizeBytes: number(),
25686
25807
  timestamp: number()
25687
25808
  });
@@ -32146,6 +32267,12 @@ Object.freeze({
32146
32267
  addonId: null,
32147
32268
  access: "view"
32148
32269
  },
32270
+ "pipelineAnalytics.listEventMedia": {
32271
+ capName: "pipeline-analytics",
32272
+ capScope: "device",
32273
+ addonId: null,
32274
+ access: "view"
32275
+ },
32149
32276
  "pipelineAnalytics.listGroups": {
32150
32277
  capName: "pipeline-analytics",
32151
32278
  capScope: "device",
@@ -35769,6 +35896,11 @@ Object.freeze({
35769
35896
  form: "array",
35770
35897
  optional: false
35771
35898
  }],
35899
+ "pipelineAnalytics.listEventMedia": [{
35900
+ name: "deviceId",
35901
+ form: "single",
35902
+ optional: false
35903
+ }],
35772
35904
  "pipelineAnalytics.listGroups": [{
35773
35905
  name: "deviceIds",
35774
35906
  form: "array",
package/dist/addon.mjs CHANGED
@@ -8003,6 +8003,21 @@ var RelocateJobSchema = object({
8003
8003
  bytesMoved: number().int(),
8004
8004
  /** Total files discovered up front; null while (or when) unknown. */
8005
8005
  filesTotal: number().int().nullable(),
8006
+ /**
8007
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8008
+ * made that nobody asked for, so it is reported where the operator reads the
8009
+ * job rather than only in a log line.
8010
+ *
8011
+ * A footage segment records its byte count in its own NAME, and the durable
8012
+ * hour row derives its aggregates from those names. A file that does not
8013
+ * match its name therefore makes the ledger's sums — and with them quota and
8014
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8015
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8016
+ *
8017
+ * Absent on lanes where the question has no meaning: a media blob's size is
8018
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8019
+ */
8020
+ rowsReconciled: number().int().nonnegative().optional(),
8006
8021
  startedAt: number(),
8007
8022
  finishedAt: number().nullable(),
8008
8023
  error: string().nullable()
@@ -8071,14 +8086,42 @@ var RelocateMediaInputSchema = object({
8071
8086
  /** Omitted = `move`, the pre-existing behaviour. */
8072
8087
  mode: MediaRelocateModeSchema.optional()
8073
8088
  });
8074
- /** How many rows still carry NO `locationId` — the population a repoint would
8075
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8076
- * value that permits a non-blocking `eventMedia` cutover. */
8077
- var UnstampedEventMediaCountSchema = object({
8078
- media: number().int().nonnegative(),
8079
- retrainFrames: number().int().nonnegative(),
8080
- total: number().int().nonnegative()
8089
+ /**
8090
+ * The unstamped population of ONE collection split, because the gate and the
8091
+ * operator ask two different questions and only one of them has to be cheap.
8092
+ *
8093
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8094
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8095
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8096
+ * that matters — after a seal, when the population is empty.
8097
+ *
8098
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8099
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8100
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8101
+ * and useful answer: "there are some, and this read could not say how many"
8102
+ * still refuses the cutover, which is the whole job.
8103
+ */
8104
+ var UnstampedRowsSchema = object({
8105
+ present: boolean(),
8106
+ rows: number().int().nonnegative().nullable()
8081
8107
  });
8108
+ /**
8109
+ * How many rows still carry NO `locationId` — the population a repoint would
8110
+ * silently re-aim at a disk that does not hold their bytes.
8111
+ *
8112
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8113
+ * over. The gate opens on a measured absence and on nothing else; an unread
8114
+ * collection and an empty one are different facts, and this repo has already
8115
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8116
+ */
8117
+ var UnstampedEventMediaCountSchema = object({
8118
+ media: UnstampedRowsSchema,
8119
+ retrainFrames: UnstampedRowsSchema,
8120
+ /** True when EITHER collection holds one. The refusal reads this. */
8121
+ anyPresent: boolean(),
8122
+ /** Sum across both, or `null` when either lane could not be counted. */
8123
+ total: number().int().nonnegative().nullable()
8124
+ }).nullable();
8082
8125
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8083
8126
  /** The independently selectable logical storage classes — every class
8084
8127
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8189,6 +8232,10 @@ var StorageMigrationMoveProgressSchema = object({
8189
8232
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8190
8233
  filesTotal: number().int().nonnegative().nullable(),
8191
8234
  bytesMoved: number().int().nonnegative(),
8235
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8236
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8237
+ * rows would be the same failure as one that silently skipped them. */
8238
+ rowsReconciled: number().int().nonnegative().optional(),
8192
8239
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8193
8240
  * crash gets a new mover, and a rate computed from the migration's start
8194
8241
  * would silently average in the time nothing was running. */
@@ -12928,6 +12975,114 @@ method(object({
12928
12975
  height: number()
12929
12976
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12930
12977
  /**
12978
+ * `failure-contribution` — the capability an addon reports its OWN losses
12979
+ * through, per camera, with the denominator attached. It stores nothing.
12980
+ *
12981
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
12982
+ *
12983
+ * `load-contribution` answers *what did this camera COST*. This answers *what
12984
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
12985
+ * copied: the contributor reports what it already knows, hub-main adds only
12986
+ * `addonId`, nothing needs global knowledge, and there is no central list for
12987
+ * somebody to forget to edit.
12988
+ *
12989
+ * They are not merged, because their invariants are opposites:
12990
+ *
12991
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
12992
+ * claim a camera cost nothing, which is a measurement nobody made;
12993
+ * - a `failure-contribution` zero is the **most valuable value on the
12994
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
12995
+ * and it is exactly what an absent entry cannot say.
12996
+ *
12997
+ * Putting a loss counter on a cost entry would also break the reconciliation
12998
+ * that gives `load-contribution` its point: contributions are subtracted from
12999
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13000
+ * has no process.
13001
+ *
13002
+ * ## Why not a log line, since the counters already exist
13003
+ *
13004
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13005
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13006
+ * ends in a log line, and a log line is the thing the operator asked to stop
13007
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13008
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13009
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13010
+ * media blackout were both diagnosed. The counters stay; this is where they can
13011
+ * be READ.
13012
+ *
13013
+ * ## The rate is served with its denominator or not at all
13014
+ *
13015
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13016
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13017
+ * than yesterday" and was **flat across twelve hours** once divided by the
13018
+ * successes on the same path. A surface that publishes only the numerator
13019
+ * reproduces that mistake on every read.
13020
+ *
13021
+ * ## Shape
13022
+ *
13023
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13024
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13025
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13026
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13027
+ * a forked runner's entries reach hub-main over transport that already exists.
13028
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13029
+ * result through `system.getFailureContributions`.
13030
+ */
13031
+ var FailureReasonCountSchema = object({
13032
+ /**
13033
+ * Why the attempt did not land, in the contributor's own vocabulary —
13034
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13035
+ * strings that already appear in this repo's logs and, where one exists, the
13036
+ * same string the per-track `previewMissReason` records (D276): a second
13037
+ * vocabulary for the same loss would make the row and the counter
13038
+ * un-joinable.
13039
+ */
13040
+ reason: string(),
13041
+ count: number().int().nonnegative()
13042
+ });
13043
+ var FailureContributionSchema = object({
13044
+ /**
13045
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13046
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13047
+ * `unit` free: the families are owned by different addons and a shared enum
13048
+ * is a central list that rots invisibly.
13049
+ */
13050
+ family: string(),
13051
+ /**
13052
+ * The NUMERIC device id — the same value every log line carries as
13053
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13054
+ * cannot name the camera must not emit the entry, because a fleet total
13055
+ * cannot answer the only question anybody asks of this surface.
13056
+ */
13057
+ deviceId: number().int().positive(),
13058
+ /**
13059
+ * A second dimension inside the family: the model / step id for an inference
13060
+ * timeout, so "which camera AND which model" is one read. Absent when the
13061
+ * family has a single variant.
13062
+ */
13063
+ variant: string().optional(),
13064
+ /**
13065
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13066
+ * differencing two reads must drop the interval when it changes, because the
13067
+ * counter restarted from zero in a respawned runner. Same discipline as
13068
+ * `LoadContribution.startedAtMs`.
13069
+ */
13070
+ sinceMs: number(),
13071
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13072
+ atMs: number(),
13073
+ /**
13074
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13075
+ * window. A failure count published without it is the mistake this schema
13076
+ * exists to make impossible.
13077
+ */
13078
+ attempts: number().int().nonnegative(),
13079
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13080
+ succeeded: number().int().nonnegative(),
13081
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13082
+ reasons: array(FailureReasonCountSchema).readonly()
13083
+ });
13084
+ method(_void(), array(FailureContributionSchema).readonly());
13085
+ /**
12931
13086
  * filesystem-browse — per-node capability for browsing the node's local
12932
13087
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12933
13088
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13449,6 +13604,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13449
13604
  kind: "mutation",
13450
13605
  auth: "admin"
13451
13606
  });
13607
+ var LoadContributionSchema = object({
13608
+ role: _enum([
13609
+ "decode",
13610
+ "transcode",
13611
+ "recording",
13612
+ "streaming",
13613
+ "detection"
13614
+ ]),
13615
+ /**
13616
+ * The NUMERIC device id — the same value every log line carries as
13617
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13618
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13619
+ * contributor that cannot name its camera must not emit the entry at all,
13620
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13621
+ * and would quietly turn one camera's cost into everybody's.
13622
+ */
13623
+ deviceId: number().int().positive().nullable(),
13624
+ attribution: _enum([
13625
+ "measured",
13626
+ "accounted",
13627
+ "unattributable"
13628
+ ]),
13629
+ /**
13630
+ * What ONE entry is, in the contributor's own words — `615/high`,
13631
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13632
+ * family and inventing a common one would lose the only information that
13633
+ * makes two entries for the same camera distinguishable.
13634
+ */
13635
+ unit: string(),
13636
+ /**
13637
+ * The OS process this cost lives in, when there is one. Present so a
13638
+ * consumer can (a) tell two generations of the same unit apart across a
13639
+ * restart, and (b) subtract claimed processes from the node's process
13640
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13641
+ * process of its own.
13642
+ */
13643
+ pid: number().int().positive().optional(),
13644
+ /**
13645
+ * When this generation started. The pid's incarnation marker: a consumer
13646
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13647
+ * window when this changes, because the counter restarted from zero in a new
13648
+ * process.
13649
+ */
13650
+ startedAtMs: number().optional(),
13651
+ /**
13652
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13653
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13654
+ * contribution is asked for.
13655
+ *
13656
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13657
+ * needs a sampler, and a new per-node sampler is the defect half of
13658
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13659
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13660
+ *
13661
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13662
+ * an entry with no process.
13663
+ */
13664
+ cpuSeconds: number().optional(),
13665
+ /** Resident bytes of this unit's process, same source and same rules. */
13666
+ rssBytes: number().optional()
13667
+ });
13668
+ method(_void(), array(LoadContributionSchema).readonly());
13452
13669
  /**
13453
13670
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13454
13671
  * through. It stores nothing.
@@ -13525,176 +13742,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13525
13742
  tags: record(string(), string()).optional()
13526
13743
  }), array(LogEntrySchema).readonly());
13527
13744
  /**
13528
- * `failure-contribution` — the capability an addon reports its OWN losses
13529
- * through, per camera, with the denominator attached. It stores nothing.
13530
- *
13531
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13532
- *
13533
- * `load-contribution` answers *what did this camera COST*. This answers *what
13534
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13535
- * copied: the contributor reports what it already knows, hub-main adds only
13536
- * `addonId`, nothing needs global knowledge, and there is no central list for
13537
- * somebody to forget to edit.
13538
- *
13539
- * They are not merged, because their invariants are opposites:
13540
- *
13541
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13542
- * claim a camera cost nothing, which is a measurement nobody made;
13543
- * - a `failure-contribution` zero is the **most valuable value on the
13544
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13545
- * and it is exactly what an absent entry cannot say.
13546
- *
13547
- * Putting a loss counter on a cost entry would also break the reconciliation
13548
- * that gives `load-contribution` its point: contributions are subtracted from
13549
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13550
- * has no process.
13551
- *
13552
- * ## Why not a log line, since the counters already exist
13553
- *
13554
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13555
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13556
- * ends in a log line, and a log line is the thing the operator asked to stop
13557
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13558
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13559
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13560
- * media blackout were both diagnosed. The counters stay; this is where they can
13561
- * be READ.
13562
- *
13563
- * ## The rate is served with its denominator or not at all
13564
- *
13565
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13566
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13567
- * than yesterday" and was **flat across twelve hours** once divided by the
13568
- * successes on the same path. A surface that publishes only the numerator
13569
- * reproduces that mistake on every read.
13570
- *
13571
- * ## Shape
13572
- *
13573
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13574
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13575
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13576
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13577
- * a forked runner's entries reach hub-main over transport that already exists.
13578
- * No new UDS message, no second registry (D3). The operator reads the assembled
13579
- * result through `system.getFailureContributions`.
13580
- */
13581
- var FailureReasonCountSchema = object({
13582
- /**
13583
- * Why the attempt did not land, in the contributor's own vocabulary —
13584
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13585
- * strings that already appear in this repo's logs and, where one exists, the
13586
- * same string the per-track `previewMissReason` records (D276): a second
13587
- * vocabulary for the same loss would make the row and the counter
13588
- * un-joinable.
13589
- */
13590
- reason: string(),
13591
- count: number().int().nonnegative()
13592
- });
13593
- var FailureContributionSchema = object({
13594
- /**
13595
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13596
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13597
- * `unit` free: the families are owned by different addons and a shared enum
13598
- * is a central list that rots invisibly.
13599
- */
13600
- family: string(),
13601
- /**
13602
- * The NUMERIC device id — the same value every log line carries as
13603
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13604
- * cannot name the camera must not emit the entry, because a fleet total
13605
- * cannot answer the only question anybody asks of this surface.
13606
- */
13607
- deviceId: number().int().positive(),
13608
- /**
13609
- * A second dimension inside the family: the model / step id for an inference
13610
- * timeout, so "which camera AND which model" is one read. Absent when the
13611
- * family has a single variant.
13612
- */
13613
- variant: string().optional(),
13614
- /**
13615
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13616
- * differencing two reads must drop the interval when it changes, because the
13617
- * counter restarted from zero in a respawned runner. Same discipline as
13618
- * `LoadContribution.startedAtMs`.
13619
- */
13620
- sinceMs: number(),
13621
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13622
- atMs: number(),
13623
- /**
13624
- * THE DENOMINATOR — every attempt on this path for this camera in the
13625
- * window. A failure count published without it is the mistake this schema
13626
- * exists to make impossible.
13627
- */
13628
- attempts: number().int().nonnegative(),
13629
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13630
- succeeded: number().int().nonnegative(),
13631
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13632
- reasons: array(FailureReasonCountSchema).readonly()
13633
- });
13634
- method(_void(), array(FailureContributionSchema).readonly());
13635
- var LoadContributionSchema = object({
13636
- role: _enum([
13637
- "decode",
13638
- "transcode",
13639
- "recording",
13640
- "streaming",
13641
- "detection"
13642
- ]),
13643
- /**
13644
- * The NUMERIC device id — the same value every log line carries as
13645
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13646
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13647
- * contributor that cannot name its camera must not emit the entry at all,
13648
- * because an unnamed per-camera entry is indistinguishable from a shared one
13649
- * and would quietly turn one camera's cost into everybody's.
13650
- */
13651
- deviceId: number().int().positive().nullable(),
13652
- attribution: _enum([
13653
- "measured",
13654
- "accounted",
13655
- "unattributable"
13656
- ]),
13657
- /**
13658
- * What ONE entry is, in the contributor's own words — `615/high`,
13659
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13660
- * family and inventing a common one would lose the only information that
13661
- * makes two entries for the same camera distinguishable.
13662
- */
13663
- unit: string(),
13664
- /**
13665
- * The OS process this cost lives in, when there is one. Present so a
13666
- * consumer can (a) tell two generations of the same unit apart across a
13667
- * restart, and (b) subtract claimed processes from the node's process
13668
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13669
- * process of its own.
13670
- */
13671
- pid: number().int().positive().optional(),
13672
- /**
13673
- * When this generation started. The pid's incarnation marker: a consumer
13674
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13675
- * window when this changes, because the counter restarted from zero in a new
13676
- * process.
13677
- */
13678
- startedAtMs: number().optional(),
13679
- /**
13680
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13681
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13682
- * contribution is asked for.
13683
- *
13684
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13685
- * needs a sampler, and a new per-node sampler is the defect half of
13686
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13687
- * by whoever already keeps a history; a rate cannot be un-averaged.
13688
- *
13689
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13690
- * an entry with no process.
13691
- */
13692
- cpuSeconds: number().optional(),
13693
- /** Resident bytes of this unit's process, same source and same rules. */
13694
- rssBytes: number().optional()
13695
- });
13696
- method(_void(), array(LoadContributionSchema).readonly());
13697
- /**
13698
13745
  * `login-method` — collection cap through which auth addons contribute
13699
13746
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13700
13747
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18354,12 +18401,53 @@ var MediaFileKindEnum = _enum([
18354
18401
  "keyFrameSmall",
18355
18402
  "thumbnailSmall"
18356
18403
  ]);
18404
+ /**
18405
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18406
+ * ARE — never the bytes themselves.
18407
+ *
18408
+ * ## Why `url` and not `base64`
18409
+ *
18410
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18411
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18412
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18413
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18414
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18415
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18416
+ *
18417
+ * `url` points at the `event-media` data plane
18418
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18419
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18420
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18421
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18422
+ * no less protected than they were inside a `view`-level cap response — see
18423
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18424
+ * (per-device scoping).
18425
+ *
18426
+ * The URL is built from the row's **stored** key, which is not always its
18427
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18428
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18429
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18430
+ *
18431
+ * ## `base64` is TRANSITIONAL and is going away
18432
+ *
18433
+ * It is still populated for one reason: the deployed viewer's track-detail
18434
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18435
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18436
+ * triangle — not as absence. Removing the field before that viewer ships is an
18437
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18438
+ * delete this line and the `withBytes` pass-through in
18439
+ * `analytics-query-facade.ts`; nothing else reads it.
18440
+ */
18357
18441
  var MediaFileSchema = object({
18358
18442
  key: string(),
18359
18443
  kind: MediaFileKindEnum,
18360
- base64: string(),
18361
18444
  sizeBytes: number(),
18362
18445
  timestamp: number()
18446
+ }).extend({
18447
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18448
+ url: string(),
18449
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18450
+ base64: string()
18363
18451
  });
18364
18452
  /**
18365
18453
  * One media row WITHOUT its bytes.
@@ -18371,7 +18459,9 @@ var MediaFileSchema = object({
18371
18459
  * blocks the whole view.
18372
18460
  *
18373
18461
  * `sizeBytes` is carried because it is what lets a client decide between the
18374
- * stored blob and a `?variant=thumb` rendering without fetching either.
18462
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18463
+ * `url` because a client that had to build the plane path itself is a second
18464
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18375
18465
  */
18376
18466
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18377
18467
  /**
@@ -19060,6 +19150,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19060
19150
  }), array(MediaFileSchema).readonly()), method(object({
19061
19151
  trackId: string(),
19062
19152
  deviceId: number()
19153
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19154
+ eventId: string(),
19155
+ deviceId: number()
19063
19156
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19064
19157
  kind: "mutation",
19065
19158
  auth: "admin"
@@ -23424,10 +23517,24 @@ var FaceClusterSchema = object({
23424
23517
  size: number().int(),
23425
23518
  cohesion: number()
23426
23519
  });
23520
+ /**
23521
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23522
+ * are — never the bytes.
23523
+ *
23524
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23525
+ * track/event contract) is still populated because a deployed viewer requires
23526
+ * the field to parse a row at all; this method has no such reader. Its ONE
23527
+ * caller is the admin UI's detail modal, which was building
23528
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23529
+ * dialog already rendering its key FRAME from the `event-media` plane.
23530
+ *
23531
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23532
+ * media key directly, so this needed no new plane and no new access decision.
23533
+ */
23427
23534
  var MediaFileLiteSchema$1 = object({
23428
23535
  key: string(),
23429
23536
  kind: string(),
23430
- base64: string(),
23537
+ url: string(),
23431
23538
  sizeBytes: number(),
23432
23539
  timestamp: number()
23433
23540
  });
@@ -25679,10 +25786,24 @@ var PlateInfoSchema = object({
25679
25786
  */
25680
25787
  cropUrl: string().optional()
25681
25788
  });
25789
+ /**
25790
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25791
+ * are — never the bytes.
25792
+ *
25793
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25794
+ * track/event contract) is still populated because a deployed viewer requires
25795
+ * the field to parse a row at all; this method has no such reader. Its ONE
25796
+ * caller is the admin UI's detail modal, which was building
25797
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25798
+ * dialog already rendering its key FRAME from the `event-media` plane.
25799
+ *
25800
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25801
+ * media key directly, so this needed no new plane and no new access decision.
25802
+ */
25682
25803
  var MediaFileLiteSchema = object({
25683
25804
  key: string(),
25684
25805
  kind: string(),
25685
- base64: string(),
25806
+ url: string(),
25686
25807
  sizeBytes: number(),
25687
25808
  timestamp: number()
25688
25809
  });
@@ -32147,6 +32268,12 @@ Object.freeze({
32147
32268
  addonId: null,
32148
32269
  access: "view"
32149
32270
  },
32271
+ "pipelineAnalytics.listEventMedia": {
32272
+ capName: "pipeline-analytics",
32273
+ capScope: "device",
32274
+ addonId: null,
32275
+ access: "view"
32276
+ },
32150
32277
  "pipelineAnalytics.listGroups": {
32151
32278
  capName: "pipeline-analytics",
32152
32279
  capScope: "device",
@@ -35770,6 +35897,11 @@ Object.freeze({
35770
35897
  form: "array",
35771
35898
  optional: false
35772
35899
  }],
35900
+ "pipelineAnalytics.listEventMedia": [{
35901
+ name: "deviceId",
35902
+ form: "single",
35903
+ optional: false
35904
+ }],
35773
35905
  "pipelineAnalytics.listGroups": [{
35774
35906
  name: "deviceIds",
35775
35907
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-onvif",
3
- "version": "1.2.44",
3
+ "version": "1.2.46",
4
4
  "description": "ONVIF camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",