@camstack/addon-provider-onvif 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/addon.js +331 -174
  2. package/dist/addon.mjs +331 -174
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -12974,6 +12974,114 @@ method(object({
12974
12974
  height: number()
12975
12975
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12976
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
+ /**
12977
13085
  * filesystem-browse — per-node capability for browsing the node's local
12978
13086
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12979
13087
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13495,6 +13603,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13495
13603
  kind: "mutation",
13496
13604
  auth: "admin"
13497
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());
13498
13668
  /**
13499
13669
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13500
13670
  * through. It stores nothing.
@@ -13571,176 +13741,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13571
13741
  tags: record(string(), string()).optional()
13572
13742
  }), array(LogEntrySchema).readonly());
13573
13743
  /**
13574
- * `failure-contribution` — the capability an addon reports its OWN losses
13575
- * through, per camera, with the denominator attached. It stores nothing.
13576
- *
13577
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13578
- *
13579
- * `load-contribution` answers *what did this camera COST*. This answers *what
13580
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13581
- * copied: the contributor reports what it already knows, hub-main adds only
13582
- * `addonId`, nothing needs global knowledge, and there is no central list for
13583
- * somebody to forget to edit.
13584
- *
13585
- * They are not merged, because their invariants are opposites:
13586
- *
13587
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13588
- * claim a camera cost nothing, which is a measurement nobody made;
13589
- * - a `failure-contribution` zero is the **most valuable value on the
13590
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13591
- * and it is exactly what an absent entry cannot say.
13592
- *
13593
- * Putting a loss counter on a cost entry would also break the reconciliation
13594
- * that gives `load-contribution` its point: contributions are subtracted from
13595
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13596
- * has no process.
13597
- *
13598
- * ## Why not a log line, since the counters already exist
13599
- *
13600
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13601
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13602
- * ends in a log line, and a log line is the thing the operator asked to stop
13603
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13604
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13605
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13606
- * media blackout were both diagnosed. The counters stay; this is where they can
13607
- * be READ.
13608
- *
13609
- * ## The rate is served with its denominator or not at all
13610
- *
13611
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13612
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13613
- * than yesterday" and was **flat across twelve hours** once divided by the
13614
- * successes on the same path. A surface that publishes only the numerator
13615
- * reproduces that mistake on every read.
13616
- *
13617
- * ## Shape
13618
- *
13619
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13620
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13621
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13622
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13623
- * a forked runner's entries reach hub-main over transport that already exists.
13624
- * No new UDS message, no second registry (D3). The operator reads the assembled
13625
- * result through `system.getFailureContributions`.
13626
- */
13627
- var FailureReasonCountSchema = object({
13628
- /**
13629
- * Why the attempt did not land, in the contributor's own vocabulary —
13630
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13631
- * strings that already appear in this repo's logs and, where one exists, the
13632
- * same string the per-track `previewMissReason` records (D276): a second
13633
- * vocabulary for the same loss would make the row and the counter
13634
- * un-joinable.
13635
- */
13636
- reason: string(),
13637
- count: number().int().nonnegative()
13638
- });
13639
- var FailureContributionSchema = object({
13640
- /**
13641
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13642
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13643
- * `unit` free: the families are owned by different addons and a shared enum
13644
- * is a central list that rots invisibly.
13645
- */
13646
- family: string(),
13647
- /**
13648
- * The NUMERIC device id — the same value every log line carries as
13649
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13650
- * cannot name the camera must not emit the entry, because a fleet total
13651
- * cannot answer the only question anybody asks of this surface.
13652
- */
13653
- deviceId: number().int().positive(),
13654
- /**
13655
- * A second dimension inside the family: the model / step id for an inference
13656
- * timeout, so "which camera AND which model" is one read. Absent when the
13657
- * family has a single variant.
13658
- */
13659
- variant: string().optional(),
13660
- /**
13661
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13662
- * differencing two reads must drop the interval when it changes, because the
13663
- * counter restarted from zero in a respawned runner. Same discipline as
13664
- * `LoadContribution.startedAtMs`.
13665
- */
13666
- sinceMs: number(),
13667
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13668
- atMs: number(),
13669
- /**
13670
- * THE DENOMINATOR — every attempt on this path for this camera in the
13671
- * window. A failure count published without it is the mistake this schema
13672
- * exists to make impossible.
13673
- */
13674
- attempts: number().int().nonnegative(),
13675
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13676
- succeeded: number().int().nonnegative(),
13677
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13678
- reasons: array(FailureReasonCountSchema).readonly()
13679
- });
13680
- method(_void(), array(FailureContributionSchema).readonly());
13681
- var LoadContributionSchema = object({
13682
- role: _enum([
13683
- "decode",
13684
- "transcode",
13685
- "recording",
13686
- "streaming",
13687
- "detection"
13688
- ]),
13689
- /**
13690
- * The NUMERIC device id — the same value every log line carries as
13691
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13692
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13693
- * contributor that cannot name its camera must not emit the entry at all,
13694
- * because an unnamed per-camera entry is indistinguishable from a shared one
13695
- * and would quietly turn one camera's cost into everybody's.
13696
- */
13697
- deviceId: number().int().positive().nullable(),
13698
- attribution: _enum([
13699
- "measured",
13700
- "accounted",
13701
- "unattributable"
13702
- ]),
13703
- /**
13704
- * What ONE entry is, in the contributor's own words — `615/high`,
13705
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13706
- * family and inventing a common one would lose the only information that
13707
- * makes two entries for the same camera distinguishable.
13708
- */
13709
- unit: string(),
13710
- /**
13711
- * The OS process this cost lives in, when there is one. Present so a
13712
- * consumer can (a) tell two generations of the same unit apart across a
13713
- * restart, and (b) subtract claimed processes from the node's process
13714
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13715
- * process of its own.
13716
- */
13717
- pid: number().int().positive().optional(),
13718
- /**
13719
- * When this generation started. The pid's incarnation marker: a consumer
13720
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13721
- * window when this changes, because the counter restarted from zero in a new
13722
- * process.
13723
- */
13724
- startedAtMs: number().optional(),
13725
- /**
13726
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13727
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13728
- * contribution is asked for.
13729
- *
13730
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13731
- * needs a sampler, and a new per-node sampler is the defect half of
13732
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13733
- * by whoever already keeps a history; a rate cannot be un-averaged.
13734
- *
13735
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13736
- * an entry with no process.
13737
- */
13738
- cpuSeconds: number().optional(),
13739
- /** Resident bytes of this unit's process, same source and same rules. */
13740
- rssBytes: number().optional()
13741
- });
13742
- method(_void(), array(LoadContributionSchema).readonly());
13743
- /**
13744
13744
  * `login-method` — collection cap through which auth addons contribute
13745
13745
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13746
13746
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18400,12 +18400,53 @@ var MediaFileKindEnum = _enum([
18400
18400
  "keyFrameSmall",
18401
18401
  "thumbnailSmall"
18402
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
+ */
18403
18440
  var MediaFileSchema = object({
18404
18441
  key: string(),
18405
18442
  kind: MediaFileKindEnum,
18406
- base64: string(),
18407
18443
  sizeBytes: number(),
18408
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()
18409
18450
  });
18410
18451
  /**
18411
18452
  * One media row WITHOUT its bytes.
@@ -18417,7 +18458,9 @@ var MediaFileSchema = object({
18417
18458
  * blocks the whole view.
18418
18459
  *
18419
18460
  * `sizeBytes` is carried because it is what lets a client decide between the
18420
- * 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.
18421
18464
  */
18422
18465
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18423
18466
  /**
@@ -18764,6 +18807,50 @@ var EventStoreFootprintSchema = object({
18764
18807
  totalBytes: number().int(),
18765
18808
  devices: array(EventStoreDeviceFootprintSchema).readonly()
18766
18809
  });
18810
+ /** Event-media footprint for one {@link MediaFileKind}. */
18811
+ var EventMediaKindFootprintSchema = object({
18812
+ kind: MediaFileKindEnum,
18813
+ /** Media rows of this kind. */
18814
+ rows: number().int(),
18815
+ /** Bytes on disk held by those rows. */
18816
+ bytes: number().int()
18817
+ });
18818
+ /**
18819
+ * The media footprint broken down by KIND — the axis a deletion decision
18820
+ * actually turns on.
18821
+ *
18822
+ * A byte total says how much there is; it cannot say what is safe to remove.
18823
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
18824
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
18825
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
18826
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
18827
+ * nothing else, so sizing a deletion means summing per kind.
18828
+ *
18829
+ * ## Why `unaccounted*` exists
18830
+ *
18831
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
18832
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
18833
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
18834
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
18835
+ * retired code path, or by a version that knew a kind this one does not) would
18836
+ * otherwise vanish from the total silently, and an operator would delete
18837
+ * against a denominator smaller than the disk.
18838
+ *
18839
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
18840
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
18841
+ */
18842
+ var EventMediaKindBreakdownSchema = object({
18843
+ /** Every media row in scope, from one unfiltered aggregate. */
18844
+ totalRows: number().int(),
18845
+ /** Every media byte in scope, from that same aggregate. */
18846
+ totalBytes: number().int(),
18847
+ /** Per-kind footprint, ordered by bytes descending. */
18848
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
18849
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
18850
+ unaccountedRows: number().int(),
18851
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
18852
+ unaccountedBytes: number().int()
18853
+ });
18767
18854
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
18768
18855
  var EventPruneCountsSchema = object({
18769
18856
  motion: number().int(),
@@ -18967,6 +19054,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18967
19054
  }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
18968
19055
  kind: "query",
18969
19056
  auth: "admin"
19057
+ }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
19058
+ kind: "query",
19059
+ auth: "admin"
18970
19060
  }), method(object({
18971
19061
  olderThanMs: number(),
18972
19062
  reason: OpsLogReasonSchema.optional()
@@ -19106,6 +19196,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19106
19196
  }), array(MediaFileSchema).readonly()), method(object({
19107
19197
  trackId: string(),
19108
19198
  deviceId: number()
19199
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19200
+ eventId: string(),
19201
+ deviceId: number()
19109
19202
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19110
19203
  kind: "mutation",
19111
19204
  auth: "admin"
@@ -21019,6 +21112,20 @@ method(object({
21019
21112
  error: string().optional()
21020
21113
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
21021
21114
  providerId: string(),
21115
+ /**
21116
+ * The location this config is an UNSAVED edit of, when there is one.
21117
+ *
21118
+ * `listLocations` replaces every declared secret with the redaction
21119
+ * sentinel, so the edit modal's form state holds the sentinel for any
21120
+ * credential the operator did not retype — and posting that here
21121
+ * without a way to resolve it makes the provider try to authenticate
21122
+ * as `__camstack_redacted__` and report the operator's own working
21123
+ * password as wrong. Given this id, the orchestrator restores each
21124
+ * sentinel from the stored config (same rule as `upsertLocation`)
21125
+ * before dispatching. Omitted by the "Add location" wizard, where
21126
+ * every value was typed just now and nothing is stored yet.
21127
+ */
21128
+ locationId: string().optional(),
21022
21129
  config: record(string(), unknown())
21023
21130
  }), object({
21024
21131
  ok: boolean(),
@@ -23470,10 +23577,24 @@ var FaceClusterSchema = object({
23470
23577
  size: number().int(),
23471
23578
  cohesion: number()
23472
23579
  });
23580
+ /**
23581
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23582
+ * are — never the bytes.
23583
+ *
23584
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23585
+ * track/event contract) is still populated because a deployed viewer requires
23586
+ * the field to parse a row at all; this method has no such reader. Its ONE
23587
+ * caller is the admin UI's detail modal, which was building
23588
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23589
+ * dialog already rendering its key FRAME from the `event-media` plane.
23590
+ *
23591
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23592
+ * media key directly, so this needed no new plane and no new access decision.
23593
+ */
23473
23594
  var MediaFileLiteSchema$1 = object({
23474
23595
  key: string(),
23475
23596
  kind: string(),
23476
- base64: string(),
23597
+ url: string(),
23477
23598
  sizeBytes: number(),
23478
23599
  timestamp: number()
23479
23600
  });
@@ -25725,10 +25846,24 @@ var PlateInfoSchema = object({
25725
25846
  */
25726
25847
  cropUrl: string().optional()
25727
25848
  });
25849
+ /**
25850
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25851
+ * are — never the bytes.
25852
+ *
25853
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25854
+ * track/event contract) is still populated because a deployed viewer requires
25855
+ * the field to parse a row at all; this method has no such reader. Its ONE
25856
+ * caller is the admin UI's detail modal, which was building
25857
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25858
+ * dialog already rendering its key FRAME from the `event-media` plane.
25859
+ *
25860
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25861
+ * media key directly, so this needed no new plane and no new access decision.
25862
+ */
25728
25863
  var MediaFileLiteSchema = object({
25729
25864
  key: string(),
25730
25865
  kind: string(),
25731
- base64: string(),
25866
+ url: string(),
25732
25867
  sizeBytes: number(),
25733
25868
  timestamp: number()
25734
25869
  });
@@ -32097,6 +32232,12 @@ Object.freeze({
32097
32232
  addonId: null,
32098
32233
  access: "view"
32099
32234
  },
32235
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
32236
+ capName: "pipeline-analytics",
32237
+ capScope: "device",
32238
+ addonId: null,
32239
+ access: "view"
32240
+ },
32100
32241
  "pipelineAnalytics.getEventStoreFootprint": {
32101
32242
  capName: "pipeline-analytics",
32102
32243
  capScope: "device",
@@ -32193,6 +32334,12 @@ Object.freeze({
32193
32334
  addonId: null,
32194
32335
  access: "view"
32195
32336
  },
32337
+ "pipelineAnalytics.listEventMedia": {
32338
+ capName: "pipeline-analytics",
32339
+ capScope: "device",
32340
+ addonId: null,
32341
+ access: "view"
32342
+ },
32196
32343
  "pipelineAnalytics.listGroups": {
32197
32344
  capName: "pipeline-analytics",
32198
32345
  capScope: "device",
@@ -35756,6 +35903,11 @@ Object.freeze({
35756
35903
  form: "single",
35757
35904
  optional: false
35758
35905
  }],
35906
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
35907
+ name: "deviceId",
35908
+ form: "single",
35909
+ optional: true
35910
+ }],
35759
35911
  "pipelineAnalytics.getGroup": [{
35760
35912
  name: "deviceId",
35761
35913
  form: "single",
@@ -35816,6 +35968,11 @@ Object.freeze({
35816
35968
  form: "array",
35817
35969
  optional: false
35818
35970
  }],
35971
+ "pipelineAnalytics.listEventMedia": [{
35972
+ name: "deviceId",
35973
+ form: "single",
35974
+ optional: false
35975
+ }],
35819
35976
  "pipelineAnalytics.listGroups": [{
35820
35977
  name: "deviceIds",
35821
35978
  form: "array",
package/dist/addon.mjs CHANGED
@@ -12975,6 +12975,114 @@ method(object({
12975
12975
  height: number()
12976
12976
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12977
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
+ /**
12978
13086
  * filesystem-browse — per-node capability for browsing the node's local
12979
13087
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12980
13088
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13496,6 +13604,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13496
13604
  kind: "mutation",
13497
13605
  auth: "admin"
13498
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());
13499
13669
  /**
13500
13670
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13501
13671
  * through. It stores nothing.
@@ -13572,176 +13742,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13572
13742
  tags: record(string(), string()).optional()
13573
13743
  }), array(LogEntrySchema).readonly());
13574
13744
  /**
13575
- * `failure-contribution` — the capability an addon reports its OWN losses
13576
- * through, per camera, with the denominator attached. It stores nothing.
13577
- *
13578
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13579
- *
13580
- * `load-contribution` answers *what did this camera COST*. This answers *what
13581
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13582
- * copied: the contributor reports what it already knows, hub-main adds only
13583
- * `addonId`, nothing needs global knowledge, and there is no central list for
13584
- * somebody to forget to edit.
13585
- *
13586
- * They are not merged, because their invariants are opposites:
13587
- *
13588
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13589
- * claim a camera cost nothing, which is a measurement nobody made;
13590
- * - a `failure-contribution` zero is the **most valuable value on the
13591
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13592
- * and it is exactly what an absent entry cannot say.
13593
- *
13594
- * Putting a loss counter on a cost entry would also break the reconciliation
13595
- * that gives `load-contribution` its point: contributions are subtracted from
13596
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13597
- * has no process.
13598
- *
13599
- * ## Why not a log line, since the counters already exist
13600
- *
13601
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13602
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13603
- * ends in a log line, and a log line is the thing the operator asked to stop
13604
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13605
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13606
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13607
- * media blackout were both diagnosed. The counters stay; this is where they can
13608
- * be READ.
13609
- *
13610
- * ## The rate is served with its denominator or not at all
13611
- *
13612
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13613
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13614
- * than yesterday" and was **flat across twelve hours** once divided by the
13615
- * successes on the same path. A surface that publishes only the numerator
13616
- * reproduces that mistake on every read.
13617
- *
13618
- * ## Shape
13619
- *
13620
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13621
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13622
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13623
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13624
- * a forked runner's entries reach hub-main over transport that already exists.
13625
- * No new UDS message, no second registry (D3). The operator reads the assembled
13626
- * result through `system.getFailureContributions`.
13627
- */
13628
- var FailureReasonCountSchema = object({
13629
- /**
13630
- * Why the attempt did not land, in the contributor's own vocabulary —
13631
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13632
- * strings that already appear in this repo's logs and, where one exists, the
13633
- * same string the per-track `previewMissReason` records (D276): a second
13634
- * vocabulary for the same loss would make the row and the counter
13635
- * un-joinable.
13636
- */
13637
- reason: string(),
13638
- count: number().int().nonnegative()
13639
- });
13640
- var FailureContributionSchema = object({
13641
- /**
13642
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13643
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13644
- * `unit` free: the families are owned by different addons and a shared enum
13645
- * is a central list that rots invisibly.
13646
- */
13647
- family: string(),
13648
- /**
13649
- * The NUMERIC device id — the same value every log line carries as
13650
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13651
- * cannot name the camera must not emit the entry, because a fleet total
13652
- * cannot answer the only question anybody asks of this surface.
13653
- */
13654
- deviceId: number().int().positive(),
13655
- /**
13656
- * A second dimension inside the family: the model / step id for an inference
13657
- * timeout, so "which camera AND which model" is one read. Absent when the
13658
- * family has a single variant.
13659
- */
13660
- variant: string().optional(),
13661
- /**
13662
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13663
- * differencing two reads must drop the interval when it changes, because the
13664
- * counter restarted from zero in a respawned runner. Same discipline as
13665
- * `LoadContribution.startedAtMs`.
13666
- */
13667
- sinceMs: number(),
13668
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13669
- atMs: number(),
13670
- /**
13671
- * THE DENOMINATOR — every attempt on this path for this camera in the
13672
- * window. A failure count published without it is the mistake this schema
13673
- * exists to make impossible.
13674
- */
13675
- attempts: number().int().nonnegative(),
13676
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13677
- succeeded: number().int().nonnegative(),
13678
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13679
- reasons: array(FailureReasonCountSchema).readonly()
13680
- });
13681
- method(_void(), array(FailureContributionSchema).readonly());
13682
- var LoadContributionSchema = object({
13683
- role: _enum([
13684
- "decode",
13685
- "transcode",
13686
- "recording",
13687
- "streaming",
13688
- "detection"
13689
- ]),
13690
- /**
13691
- * The NUMERIC device id — the same value every log line carries as
13692
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13693
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13694
- * contributor that cannot name its camera must not emit the entry at all,
13695
- * because an unnamed per-camera entry is indistinguishable from a shared one
13696
- * and would quietly turn one camera's cost into everybody's.
13697
- */
13698
- deviceId: number().int().positive().nullable(),
13699
- attribution: _enum([
13700
- "measured",
13701
- "accounted",
13702
- "unattributable"
13703
- ]),
13704
- /**
13705
- * What ONE entry is, in the contributor's own words — `615/high`,
13706
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13707
- * family and inventing a common one would lose the only information that
13708
- * makes two entries for the same camera distinguishable.
13709
- */
13710
- unit: string(),
13711
- /**
13712
- * The OS process this cost lives in, when there is one. Present so a
13713
- * consumer can (a) tell two generations of the same unit apart across a
13714
- * restart, and (b) subtract claimed processes from the node's process
13715
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13716
- * process of its own.
13717
- */
13718
- pid: number().int().positive().optional(),
13719
- /**
13720
- * When this generation started. The pid's incarnation marker: a consumer
13721
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13722
- * window when this changes, because the counter restarted from zero in a new
13723
- * process.
13724
- */
13725
- startedAtMs: number().optional(),
13726
- /**
13727
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13728
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13729
- * contribution is asked for.
13730
- *
13731
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13732
- * needs a sampler, and a new per-node sampler is the defect half of
13733
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13734
- * by whoever already keeps a history; a rate cannot be un-averaged.
13735
- *
13736
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13737
- * an entry with no process.
13738
- */
13739
- cpuSeconds: number().optional(),
13740
- /** Resident bytes of this unit's process, same source and same rules. */
13741
- rssBytes: number().optional()
13742
- });
13743
- method(_void(), array(LoadContributionSchema).readonly());
13744
- /**
13745
13745
  * `login-method` — collection cap through which auth addons contribute
13746
13746
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13747
13747
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18401,12 +18401,53 @@ var MediaFileKindEnum = _enum([
18401
18401
  "keyFrameSmall",
18402
18402
  "thumbnailSmall"
18403
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
+ */
18404
18441
  var MediaFileSchema = object({
18405
18442
  key: string(),
18406
18443
  kind: MediaFileKindEnum,
18407
- base64: string(),
18408
18444
  sizeBytes: number(),
18409
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()
18410
18451
  });
18411
18452
  /**
18412
18453
  * One media row WITHOUT its bytes.
@@ -18418,7 +18459,9 @@ var MediaFileSchema = object({
18418
18459
  * blocks the whole view.
18419
18460
  *
18420
18461
  * `sizeBytes` is carried because it is what lets a client decide between the
18421
- * 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.
18422
18465
  */
18423
18466
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18424
18467
  /**
@@ -18765,6 +18808,50 @@ var EventStoreFootprintSchema = object({
18765
18808
  totalBytes: number().int(),
18766
18809
  devices: array(EventStoreDeviceFootprintSchema).readonly()
18767
18810
  });
18811
+ /** Event-media footprint for one {@link MediaFileKind}. */
18812
+ var EventMediaKindFootprintSchema = object({
18813
+ kind: MediaFileKindEnum,
18814
+ /** Media rows of this kind. */
18815
+ rows: number().int(),
18816
+ /** Bytes on disk held by those rows. */
18817
+ bytes: number().int()
18818
+ });
18819
+ /**
18820
+ * The media footprint broken down by KIND — the axis a deletion decision
18821
+ * actually turns on.
18822
+ *
18823
+ * A byte total says how much there is; it cannot say what is safe to remove.
18824
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
18825
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
18826
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
18827
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
18828
+ * nothing else, so sizing a deletion means summing per kind.
18829
+ *
18830
+ * ## Why `unaccounted*` exists
18831
+ *
18832
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
18833
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
18834
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
18835
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
18836
+ * retired code path, or by a version that knew a kind this one does not) would
18837
+ * otherwise vanish from the total silently, and an operator would delete
18838
+ * against a denominator smaller than the disk.
18839
+ *
18840
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
18841
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
18842
+ */
18843
+ var EventMediaKindBreakdownSchema = object({
18844
+ /** Every media row in scope, from one unfiltered aggregate. */
18845
+ totalRows: number().int(),
18846
+ /** Every media byte in scope, from that same aggregate. */
18847
+ totalBytes: number().int(),
18848
+ /** Per-kind footprint, ordered by bytes descending. */
18849
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
18850
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
18851
+ unaccountedRows: number().int(),
18852
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
18853
+ unaccountedBytes: number().int()
18854
+ });
18768
18855
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
18769
18856
  var EventPruneCountsSchema = object({
18770
18857
  motion: number().int(),
@@ -18968,6 +19055,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18968
19055
  }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
18969
19056
  kind: "query",
18970
19057
  auth: "admin"
19058
+ }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
19059
+ kind: "query",
19060
+ auth: "admin"
18971
19061
  }), method(object({
18972
19062
  olderThanMs: number(),
18973
19063
  reason: OpsLogReasonSchema.optional()
@@ -19107,6 +19197,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19107
19197
  }), array(MediaFileSchema).readonly()), method(object({
19108
19198
  trackId: string(),
19109
19199
  deviceId: number()
19200
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19201
+ eventId: string(),
19202
+ deviceId: number()
19110
19203
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19111
19204
  kind: "mutation",
19112
19205
  auth: "admin"
@@ -21020,6 +21113,20 @@ method(object({
21020
21113
  error: string().optional()
21021
21114
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
21022
21115
  providerId: string(),
21116
+ /**
21117
+ * The location this config is an UNSAVED edit of, when there is one.
21118
+ *
21119
+ * `listLocations` replaces every declared secret with the redaction
21120
+ * sentinel, so the edit modal's form state holds the sentinel for any
21121
+ * credential the operator did not retype — and posting that here
21122
+ * without a way to resolve it makes the provider try to authenticate
21123
+ * as `__camstack_redacted__` and report the operator's own working
21124
+ * password as wrong. Given this id, the orchestrator restores each
21125
+ * sentinel from the stored config (same rule as `upsertLocation`)
21126
+ * before dispatching. Omitted by the "Add location" wizard, where
21127
+ * every value was typed just now and nothing is stored yet.
21128
+ */
21129
+ locationId: string().optional(),
21023
21130
  config: record(string(), unknown())
21024
21131
  }), object({
21025
21132
  ok: boolean(),
@@ -23471,10 +23578,24 @@ var FaceClusterSchema = object({
23471
23578
  size: number().int(),
23472
23579
  cohesion: number()
23473
23580
  });
23581
+ /**
23582
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23583
+ * are — never the bytes.
23584
+ *
23585
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23586
+ * track/event contract) is still populated because a deployed viewer requires
23587
+ * the field to parse a row at all; this method has no such reader. Its ONE
23588
+ * caller is the admin UI's detail modal, which was building
23589
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23590
+ * dialog already rendering its key FRAME from the `event-media` plane.
23591
+ *
23592
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23593
+ * media key directly, so this needed no new plane and no new access decision.
23594
+ */
23474
23595
  var MediaFileLiteSchema$1 = object({
23475
23596
  key: string(),
23476
23597
  kind: string(),
23477
- base64: string(),
23598
+ url: string(),
23478
23599
  sizeBytes: number(),
23479
23600
  timestamp: number()
23480
23601
  });
@@ -25726,10 +25847,24 @@ var PlateInfoSchema = object({
25726
25847
  */
25727
25848
  cropUrl: string().optional()
25728
25849
  });
25850
+ /**
25851
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25852
+ * are — never the bytes.
25853
+ *
25854
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25855
+ * track/event contract) is still populated because a deployed viewer requires
25856
+ * the field to parse a row at all; this method has no such reader. Its ONE
25857
+ * caller is the admin UI's detail modal, which was building
25858
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25859
+ * dialog already rendering its key FRAME from the `event-media` plane.
25860
+ *
25861
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25862
+ * media key directly, so this needed no new plane and no new access decision.
25863
+ */
25729
25864
  var MediaFileLiteSchema = object({
25730
25865
  key: string(),
25731
25866
  kind: string(),
25732
- base64: string(),
25867
+ url: string(),
25733
25868
  sizeBytes: number(),
25734
25869
  timestamp: number()
25735
25870
  });
@@ -32098,6 +32233,12 @@ Object.freeze({
32098
32233
  addonId: null,
32099
32234
  access: "view"
32100
32235
  },
32236
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
32237
+ capName: "pipeline-analytics",
32238
+ capScope: "device",
32239
+ addonId: null,
32240
+ access: "view"
32241
+ },
32101
32242
  "pipelineAnalytics.getEventStoreFootprint": {
32102
32243
  capName: "pipeline-analytics",
32103
32244
  capScope: "device",
@@ -32194,6 +32335,12 @@ Object.freeze({
32194
32335
  addonId: null,
32195
32336
  access: "view"
32196
32337
  },
32338
+ "pipelineAnalytics.listEventMedia": {
32339
+ capName: "pipeline-analytics",
32340
+ capScope: "device",
32341
+ addonId: null,
32342
+ access: "view"
32343
+ },
32197
32344
  "pipelineAnalytics.listGroups": {
32198
32345
  capName: "pipeline-analytics",
32199
32346
  capScope: "device",
@@ -35757,6 +35904,11 @@ Object.freeze({
35757
35904
  form: "single",
35758
35905
  optional: false
35759
35906
  }],
35907
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
35908
+ name: "deviceId",
35909
+ form: "single",
35910
+ optional: true
35911
+ }],
35760
35912
  "pipelineAnalytics.getGroup": [{
35761
35913
  name: "deviceId",
35762
35914
  form: "single",
@@ -35817,6 +35969,11 @@ Object.freeze({
35817
35969
  form: "array",
35818
35970
  optional: false
35819
35971
  }],
35972
+ "pipelineAnalytics.listEventMedia": [{
35973
+ name: "deviceId",
35974
+ form: "single",
35975
+ optional: false
35976
+ }],
35820
35977
  "pipelineAnalytics.listGroups": [{
35821
35978
  name: "deviceIds",
35822
35979
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-onvif",
3
- "version": "1.2.45",
3
+ "version": "1.2.47",
4
4
  "description": "ONVIF camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",