@camstack/addon-smtp-nodemailer 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.
@@ -12941,6 +12941,114 @@ method(object({
12941
12941
  height: number()
12942
12942
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12943
12943
  /**
12944
+ * `failure-contribution` — the capability an addon reports its OWN losses
12945
+ * through, per camera, with the denominator attached. It stores nothing.
12946
+ *
12947
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
12948
+ *
12949
+ * `load-contribution` answers *what did this camera COST*. This answers *what
12950
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
12951
+ * copied: the contributor reports what it already knows, hub-main adds only
12952
+ * `addonId`, nothing needs global knowledge, and there is no central list for
12953
+ * somebody to forget to edit.
12954
+ *
12955
+ * They are not merged, because their invariants are opposites:
12956
+ *
12957
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
12958
+ * claim a camera cost nothing, which is a measurement nobody made;
12959
+ * - a `failure-contribution` zero is the **most valuable value on the
12960
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
12961
+ * and it is exactly what an absent entry cannot say.
12962
+ *
12963
+ * Putting a loss counter on a cost entry would also break the reconciliation
12964
+ * that gives `load-contribution` its point: contributions are subtracted from
12965
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
12966
+ * has no process.
12967
+ *
12968
+ * ## Why not a log line, since the counters already exist
12969
+ *
12970
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
12971
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
12972
+ * ends in a log line, and a log line is the thing the operator asked to stop
12973
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
12974
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
12975
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
12976
+ * media blackout were both diagnosed. The counters stay; this is where they can
12977
+ * be READ.
12978
+ *
12979
+ * ## The rate is served with its denominator or not at all
12980
+ *
12981
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
12982
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
12983
+ * than yesterday" and was **flat across twelve hours** once divided by the
12984
+ * successes on the same path. A surface that publishes only the numerator
12985
+ * reproduces that mistake on every read.
12986
+ *
12987
+ * ## Shape
12988
+ *
12989
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
12990
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
12991
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
12992
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
12993
+ * a forked runner's entries reach hub-main over transport that already exists.
12994
+ * No new UDS message, no second registry (D3). The operator reads the assembled
12995
+ * result through `system.getFailureContributions`.
12996
+ */
12997
+ var FailureReasonCountSchema = object({
12998
+ /**
12999
+ * Why the attempt did not land, in the contributor's own vocabulary —
13000
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13001
+ * strings that already appear in this repo's logs and, where one exists, the
13002
+ * same string the per-track `previewMissReason` records (D276): a second
13003
+ * vocabulary for the same loss would make the row and the counter
13004
+ * un-joinable.
13005
+ */
13006
+ reason: string(),
13007
+ count: number().int().nonnegative()
13008
+ });
13009
+ var FailureContributionSchema = object({
13010
+ /**
13011
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13012
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13013
+ * `unit` free: the families are owned by different addons and a shared enum
13014
+ * is a central list that rots invisibly.
13015
+ */
13016
+ family: string(),
13017
+ /**
13018
+ * The NUMERIC device id — the same value every log line carries as
13019
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13020
+ * cannot name the camera must not emit the entry, because a fleet total
13021
+ * cannot answer the only question anybody asks of this surface.
13022
+ */
13023
+ deviceId: number().int().positive(),
13024
+ /**
13025
+ * A second dimension inside the family: the model / step id for an inference
13026
+ * timeout, so "which camera AND which model" is one read. Absent when the
13027
+ * family has a single variant.
13028
+ */
13029
+ variant: string().optional(),
13030
+ /**
13031
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13032
+ * differencing two reads must drop the interval when it changes, because the
13033
+ * counter restarted from zero in a respawned runner. Same discipline as
13034
+ * `LoadContribution.startedAtMs`.
13035
+ */
13036
+ sinceMs: number(),
13037
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13038
+ atMs: number(),
13039
+ /**
13040
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13041
+ * window. A failure count published without it is the mistake this schema
13042
+ * exists to make impossible.
13043
+ */
13044
+ attempts: number().int().nonnegative(),
13045
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13046
+ succeeded: number().int().nonnegative(),
13047
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13048
+ reasons: array(FailureReasonCountSchema).readonly()
13049
+ });
13050
+ method(_void(), array(FailureContributionSchema).readonly());
13051
+ /**
12944
13052
  * filesystem-browse — per-node capability for browsing the node's local
12945
13053
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12946
13054
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13462,6 +13570,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13462
13570
  kind: "mutation",
13463
13571
  auth: "admin"
13464
13572
  });
13573
+ var LoadContributionSchema = object({
13574
+ role: _enum([
13575
+ "decode",
13576
+ "transcode",
13577
+ "recording",
13578
+ "streaming",
13579
+ "detection"
13580
+ ]),
13581
+ /**
13582
+ * The NUMERIC device id — the same value every log line carries as
13583
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13584
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13585
+ * contributor that cannot name its camera must not emit the entry at all,
13586
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13587
+ * and would quietly turn one camera's cost into everybody's.
13588
+ */
13589
+ deviceId: number().int().positive().nullable(),
13590
+ attribution: _enum([
13591
+ "measured",
13592
+ "accounted",
13593
+ "unattributable"
13594
+ ]),
13595
+ /**
13596
+ * What ONE entry is, in the contributor's own words — `615/high`,
13597
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13598
+ * family and inventing a common one would lose the only information that
13599
+ * makes two entries for the same camera distinguishable.
13600
+ */
13601
+ unit: string(),
13602
+ /**
13603
+ * The OS process this cost lives in, when there is one. Present so a
13604
+ * consumer can (a) tell two generations of the same unit apart across a
13605
+ * restart, and (b) subtract claimed processes from the node's process
13606
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13607
+ * process of its own.
13608
+ */
13609
+ pid: number().int().positive().optional(),
13610
+ /**
13611
+ * When this generation started. The pid's incarnation marker: a consumer
13612
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13613
+ * window when this changes, because the counter restarted from zero in a new
13614
+ * process.
13615
+ */
13616
+ startedAtMs: number().optional(),
13617
+ /**
13618
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13619
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13620
+ * contribution is asked for.
13621
+ *
13622
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13623
+ * needs a sampler, and a new per-node sampler is the defect half of
13624
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13625
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13626
+ *
13627
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13628
+ * an entry with no process.
13629
+ */
13630
+ cpuSeconds: number().optional(),
13631
+ /** Resident bytes of this unit's process, same source and same rules. */
13632
+ rssBytes: number().optional()
13633
+ });
13634
+ method(_void(), array(LoadContributionSchema).readonly());
13465
13635
  /**
13466
13636
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13467
13637
  * through. It stores nothing.
@@ -13538,176 +13708,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13538
13708
  tags: record(string(), string()).optional()
13539
13709
  }), array(LogEntrySchema).readonly());
13540
13710
  /**
13541
- * `failure-contribution` — the capability an addon reports its OWN losses
13542
- * through, per camera, with the denominator attached. It stores nothing.
13543
- *
13544
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13545
- *
13546
- * `load-contribution` answers *what did this camera COST*. This answers *what
13547
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13548
- * copied: the contributor reports what it already knows, hub-main adds only
13549
- * `addonId`, nothing needs global knowledge, and there is no central list for
13550
- * somebody to forget to edit.
13551
- *
13552
- * They are not merged, because their invariants are opposites:
13553
- *
13554
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13555
- * claim a camera cost nothing, which is a measurement nobody made;
13556
- * - a `failure-contribution` zero is the **most valuable value on the
13557
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13558
- * and it is exactly what an absent entry cannot say.
13559
- *
13560
- * Putting a loss counter on a cost entry would also break the reconciliation
13561
- * that gives `load-contribution` its point: contributions are subtracted from
13562
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13563
- * has no process.
13564
- *
13565
- * ## Why not a log line, since the counters already exist
13566
- *
13567
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13568
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13569
- * ends in a log line, and a log line is the thing the operator asked to stop
13570
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13571
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13572
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13573
- * media blackout were both diagnosed. The counters stay; this is where they can
13574
- * be READ.
13575
- *
13576
- * ## The rate is served with its denominator or not at all
13577
- *
13578
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13579
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13580
- * than yesterday" and was **flat across twelve hours** once divided by the
13581
- * successes on the same path. A surface that publishes only the numerator
13582
- * reproduces that mistake on every read.
13583
- *
13584
- * ## Shape
13585
- *
13586
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13587
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13588
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13589
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13590
- * a forked runner's entries reach hub-main over transport that already exists.
13591
- * No new UDS message, no second registry (D3). The operator reads the assembled
13592
- * result through `system.getFailureContributions`.
13593
- */
13594
- var FailureReasonCountSchema = object({
13595
- /**
13596
- * Why the attempt did not land, in the contributor's own vocabulary —
13597
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13598
- * strings that already appear in this repo's logs and, where one exists, the
13599
- * same string the per-track `previewMissReason` records (D276): a second
13600
- * vocabulary for the same loss would make the row and the counter
13601
- * un-joinable.
13602
- */
13603
- reason: string(),
13604
- count: number().int().nonnegative()
13605
- });
13606
- var FailureContributionSchema = object({
13607
- /**
13608
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13609
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13610
- * `unit` free: the families are owned by different addons and a shared enum
13611
- * is a central list that rots invisibly.
13612
- */
13613
- family: string(),
13614
- /**
13615
- * The NUMERIC device id — the same value every log line carries as
13616
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13617
- * cannot name the camera must not emit the entry, because a fleet total
13618
- * cannot answer the only question anybody asks of this surface.
13619
- */
13620
- deviceId: number().int().positive(),
13621
- /**
13622
- * A second dimension inside the family: the model / step id for an inference
13623
- * timeout, so "which camera AND which model" is one read. Absent when the
13624
- * family has a single variant.
13625
- */
13626
- variant: string().optional(),
13627
- /**
13628
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13629
- * differencing two reads must drop the interval when it changes, because the
13630
- * counter restarted from zero in a respawned runner. Same discipline as
13631
- * `LoadContribution.startedAtMs`.
13632
- */
13633
- sinceMs: number(),
13634
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13635
- atMs: number(),
13636
- /**
13637
- * THE DENOMINATOR — every attempt on this path for this camera in the
13638
- * window. A failure count published without it is the mistake this schema
13639
- * exists to make impossible.
13640
- */
13641
- attempts: number().int().nonnegative(),
13642
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13643
- succeeded: number().int().nonnegative(),
13644
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13645
- reasons: array(FailureReasonCountSchema).readonly()
13646
- });
13647
- method(_void(), array(FailureContributionSchema).readonly());
13648
- var LoadContributionSchema = object({
13649
- role: _enum([
13650
- "decode",
13651
- "transcode",
13652
- "recording",
13653
- "streaming",
13654
- "detection"
13655
- ]),
13656
- /**
13657
- * The NUMERIC device id — the same value every log line carries as
13658
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13659
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13660
- * contributor that cannot name its camera must not emit the entry at all,
13661
- * because an unnamed per-camera entry is indistinguishable from a shared one
13662
- * and would quietly turn one camera's cost into everybody's.
13663
- */
13664
- deviceId: number().int().positive().nullable(),
13665
- attribution: _enum([
13666
- "measured",
13667
- "accounted",
13668
- "unattributable"
13669
- ]),
13670
- /**
13671
- * What ONE entry is, in the contributor's own words — `615/high`,
13672
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13673
- * family and inventing a common one would lose the only information that
13674
- * makes two entries for the same camera distinguishable.
13675
- */
13676
- unit: string(),
13677
- /**
13678
- * The OS process this cost lives in, when there is one. Present so a
13679
- * consumer can (a) tell two generations of the same unit apart across a
13680
- * restart, and (b) subtract claimed processes from the node's process
13681
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13682
- * process of its own.
13683
- */
13684
- pid: number().int().positive().optional(),
13685
- /**
13686
- * When this generation started. The pid's incarnation marker: a consumer
13687
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13688
- * window when this changes, because the counter restarted from zero in a new
13689
- * process.
13690
- */
13691
- startedAtMs: number().optional(),
13692
- /**
13693
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13694
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13695
- * contribution is asked for.
13696
- *
13697
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13698
- * needs a sampler, and a new per-node sampler is the defect half of
13699
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13700
- * by whoever already keeps a history; a rate cannot be un-averaged.
13701
- *
13702
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13703
- * an entry with no process.
13704
- */
13705
- cpuSeconds: number().optional(),
13706
- /** Resident bytes of this unit's process, same source and same rules. */
13707
- rssBytes: number().optional()
13708
- });
13709
- method(_void(), array(LoadContributionSchema).readonly());
13710
- /**
13711
13711
  * `login-method` — collection cap through which auth addons contribute
13712
13712
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13713
13713
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18367,12 +18367,53 @@ var MediaFileKindEnum = _enum([
18367
18367
  "keyFrameSmall",
18368
18368
  "thumbnailSmall"
18369
18369
  ]);
18370
+ /**
18371
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18372
+ * ARE — never the bytes themselves.
18373
+ *
18374
+ * ## Why `url` and not `base64`
18375
+ *
18376
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18377
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18378
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18379
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18380
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18381
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18382
+ *
18383
+ * `url` points at the `event-media` data plane
18384
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18385
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18386
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18387
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18388
+ * no less protected than they were inside a `view`-level cap response — see
18389
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18390
+ * (per-device scoping).
18391
+ *
18392
+ * The URL is built from the row's **stored** key, which is not always its
18393
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18394
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18395
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18396
+ *
18397
+ * ## `base64` is TRANSITIONAL and is going away
18398
+ *
18399
+ * It is still populated for one reason: the deployed viewer's track-detail
18400
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18401
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18402
+ * triangle — not as absence. Removing the field before that viewer ships is an
18403
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18404
+ * delete this line and the `withBytes` pass-through in
18405
+ * `analytics-query-facade.ts`; nothing else reads it.
18406
+ */
18370
18407
  var MediaFileSchema = object({
18371
18408
  key: string(),
18372
18409
  kind: MediaFileKindEnum,
18373
- base64: string(),
18374
18410
  sizeBytes: number(),
18375
18411
  timestamp: number()
18412
+ }).extend({
18413
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18414
+ url: string(),
18415
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18416
+ base64: string()
18376
18417
  });
18377
18418
  /**
18378
18419
  * One media row WITHOUT its bytes.
@@ -18384,7 +18425,9 @@ var MediaFileSchema = object({
18384
18425
  * blocks the whole view.
18385
18426
  *
18386
18427
  * `sizeBytes` is carried because it is what lets a client decide between the
18387
- * stored blob and a `?variant=thumb` rendering without fetching either.
18428
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18429
+ * `url` because a client that had to build the plane path itself is a second
18430
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18388
18431
  */
18389
18432
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18390
18433
  /**
@@ -18731,6 +18774,50 @@ var EventStoreFootprintSchema = object({
18731
18774
  totalBytes: number().int(),
18732
18775
  devices: array(EventStoreDeviceFootprintSchema).readonly()
18733
18776
  });
18777
+ /** Event-media footprint for one {@link MediaFileKind}. */
18778
+ var EventMediaKindFootprintSchema = object({
18779
+ kind: MediaFileKindEnum,
18780
+ /** Media rows of this kind. */
18781
+ rows: number().int(),
18782
+ /** Bytes on disk held by those rows. */
18783
+ bytes: number().int()
18784
+ });
18785
+ /**
18786
+ * The media footprint broken down by KIND — the axis a deletion decision
18787
+ * actually turns on.
18788
+ *
18789
+ * A byte total says how much there is; it cannot say what is safe to remove.
18790
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
18791
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
18792
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
18793
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
18794
+ * nothing else, so sizing a deletion means summing per kind.
18795
+ *
18796
+ * ## Why `unaccounted*` exists
18797
+ *
18798
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
18799
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
18800
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
18801
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
18802
+ * retired code path, or by a version that knew a kind this one does not) would
18803
+ * otherwise vanish from the total silently, and an operator would delete
18804
+ * against a denominator smaller than the disk.
18805
+ *
18806
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
18807
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
18808
+ */
18809
+ var EventMediaKindBreakdownSchema = object({
18810
+ /** Every media row in scope, from one unfiltered aggregate. */
18811
+ totalRows: number().int(),
18812
+ /** Every media byte in scope, from that same aggregate. */
18813
+ totalBytes: number().int(),
18814
+ /** Per-kind footprint, ordered by bytes descending. */
18815
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
18816
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
18817
+ unaccountedRows: number().int(),
18818
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
18819
+ unaccountedBytes: number().int()
18820
+ });
18734
18821
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
18735
18822
  var EventPruneCountsSchema = object({
18736
18823
  motion: number().int(),
@@ -18934,6 +19021,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18934
19021
  }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
18935
19022
  kind: "query",
18936
19023
  auth: "admin"
19024
+ }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
19025
+ kind: "query",
19026
+ auth: "admin"
18937
19027
  }), method(object({
18938
19028
  olderThanMs: number(),
18939
19029
  reason: OpsLogReasonSchema.optional()
@@ -19073,6 +19163,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19073
19163
  }), array(MediaFileSchema).readonly()), method(object({
19074
19164
  trackId: string(),
19075
19165
  deviceId: number()
19166
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19167
+ eventId: string(),
19168
+ deviceId: number()
19076
19169
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19077
19170
  kind: "mutation",
19078
19171
  auth: "admin"
@@ -20895,6 +20988,20 @@ method(object({
20895
20988
  error: string().optional()
20896
20989
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
20897
20990
  providerId: string(),
20991
+ /**
20992
+ * The location this config is an UNSAVED edit of, when there is one.
20993
+ *
20994
+ * `listLocations` replaces every declared secret with the redaction
20995
+ * sentinel, so the edit modal's form state holds the sentinel for any
20996
+ * credential the operator did not retype — and posting that here
20997
+ * without a way to resolve it makes the provider try to authenticate
20998
+ * as `__camstack_redacted__` and report the operator's own working
20999
+ * password as wrong. Given this id, the orchestrator restores each
21000
+ * sentinel from the stored config (same rule as `upsertLocation`)
21001
+ * before dispatching. Omitted by the "Add location" wizard, where
21002
+ * every value was typed just now and nothing is stored yet.
21003
+ */
21004
+ locationId: string().optional(),
20898
21005
  config: record(string(), unknown())
20899
21006
  }), object({
20900
21007
  ok: boolean(),
@@ -23346,10 +23453,24 @@ var FaceClusterSchema = object({
23346
23453
  size: number().int(),
23347
23454
  cohesion: number()
23348
23455
  });
23456
+ /**
23457
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23458
+ * are — never the bytes.
23459
+ *
23460
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23461
+ * track/event contract) is still populated because a deployed viewer requires
23462
+ * the field to parse a row at all; this method has no such reader. Its ONE
23463
+ * caller is the admin UI's detail modal, which was building
23464
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23465
+ * dialog already rendering its key FRAME from the `event-media` plane.
23466
+ *
23467
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23468
+ * media key directly, so this needed no new plane and no new access decision.
23469
+ */
23349
23470
  var MediaFileLiteSchema$1 = object({
23350
23471
  key: string(),
23351
23472
  kind: string(),
23352
- base64: string(),
23473
+ url: string(),
23353
23474
  sizeBytes: number(),
23354
23475
  timestamp: number()
23355
23476
  });
@@ -25601,10 +25722,24 @@ var PlateInfoSchema = object({
25601
25722
  */
25602
25723
  cropUrl: string().optional()
25603
25724
  });
25725
+ /**
25726
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25727
+ * are — never the bytes.
25728
+ *
25729
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25730
+ * track/event contract) is still populated because a deployed viewer requires
25731
+ * the field to parse a row at all; this method has no such reader. Its ONE
25732
+ * caller is the admin UI's detail modal, which was building
25733
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25734
+ * dialog already rendering its key FRAME from the `event-media` plane.
25735
+ *
25736
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25737
+ * media key directly, so this needed no new plane and no new access decision.
25738
+ */
25604
25739
  var MediaFileLiteSchema = object({
25605
25740
  key: string(),
25606
25741
  kind: string(),
25607
- base64: string(),
25742
+ url: string(),
25608
25743
  sizeBytes: number(),
25609
25744
  timestamp: number()
25610
25745
  });
@@ -31521,6 +31656,12 @@ Object.freeze({
31521
31656
  addonId: null,
31522
31657
  access: "view"
31523
31658
  },
31659
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
31660
+ capName: "pipeline-analytics",
31661
+ capScope: "device",
31662
+ addonId: null,
31663
+ access: "view"
31664
+ },
31524
31665
  "pipelineAnalytics.getEventStoreFootprint": {
31525
31666
  capName: "pipeline-analytics",
31526
31667
  capScope: "device",
@@ -31617,6 +31758,12 @@ Object.freeze({
31617
31758
  addonId: null,
31618
31759
  access: "view"
31619
31760
  },
31761
+ "pipelineAnalytics.listEventMedia": {
31762
+ capName: "pipeline-analytics",
31763
+ capScope: "device",
31764
+ addonId: null,
31765
+ access: "view"
31766
+ },
31620
31767
  "pipelineAnalytics.listGroups": {
31621
31768
  capName: "pipeline-analytics",
31622
31769
  capScope: "device",
@@ -35180,6 +35327,11 @@ Object.freeze({
35180
35327
  form: "single",
35181
35328
  optional: false
35182
35329
  }],
35330
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
35331
+ name: "deviceId",
35332
+ form: "single",
35333
+ optional: true
35334
+ }],
35183
35335
  "pipelineAnalytics.getGroup": [{
35184
35336
  name: "deviceId",
35185
35337
  form: "single",
@@ -35240,6 +35392,11 @@ Object.freeze({
35240
35392
  form: "array",
35241
35393
  optional: false
35242
35394
  }],
35395
+ "pipelineAnalytics.listEventMedia": [{
35396
+ name: "deviceId",
35397
+ form: "single",
35398
+ optional: false
35399
+ }],
35243
35400
  "pipelineAnalytics.listGroups": [{
35244
35401
  name: "deviceIds",
35245
35402
  form: "array",
@@ -12939,6 +12939,114 @@ method(object({
12939
12939
  height: number()
12940
12940
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12941
12941
  /**
12942
+ * `failure-contribution` — the capability an addon reports its OWN losses
12943
+ * through, per camera, with the denominator attached. It stores nothing.
12944
+ *
12945
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
12946
+ *
12947
+ * `load-contribution` answers *what did this camera COST*. This answers *what
12948
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
12949
+ * copied: the contributor reports what it already knows, hub-main adds only
12950
+ * `addonId`, nothing needs global knowledge, and there is no central list for
12951
+ * somebody to forget to edit.
12952
+ *
12953
+ * They are not merged, because their invariants are opposites:
12954
+ *
12955
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
12956
+ * claim a camera cost nothing, which is a measurement nobody made;
12957
+ * - a `failure-contribution` zero is the **most valuable value on the
12958
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
12959
+ * and it is exactly what an absent entry cannot say.
12960
+ *
12961
+ * Putting a loss counter on a cost entry would also break the reconciliation
12962
+ * that gives `load-contribution` its point: contributions are subtracted from
12963
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
12964
+ * has no process.
12965
+ *
12966
+ * ## Why not a log line, since the counters already exist
12967
+ *
12968
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
12969
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
12970
+ * ends in a log line, and a log line is the thing the operator asked to stop
12971
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
12972
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
12973
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
12974
+ * media blackout were both diagnosed. The counters stay; this is where they can
12975
+ * be READ.
12976
+ *
12977
+ * ## The rate is served with its denominator or not at all
12978
+ *
12979
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
12980
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
12981
+ * than yesterday" and was **flat across twelve hours** once divided by the
12982
+ * successes on the same path. A surface that publishes only the numerator
12983
+ * reproduces that mistake on every read.
12984
+ *
12985
+ * ## Shape
12986
+ *
12987
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
12988
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
12989
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
12990
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
12991
+ * a forked runner's entries reach hub-main over transport that already exists.
12992
+ * No new UDS message, no second registry (D3). The operator reads the assembled
12993
+ * result through `system.getFailureContributions`.
12994
+ */
12995
+ var FailureReasonCountSchema = object({
12996
+ /**
12997
+ * Why the attempt did not land, in the contributor's own vocabulary —
12998
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
12999
+ * strings that already appear in this repo's logs and, where one exists, the
13000
+ * same string the per-track `previewMissReason` records (D276): a second
13001
+ * vocabulary for the same loss would make the row and the counter
13002
+ * un-joinable.
13003
+ */
13004
+ reason: string(),
13005
+ count: number().int().nonnegative()
13006
+ });
13007
+ var FailureContributionSchema = object({
13008
+ /**
13009
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13010
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13011
+ * `unit` free: the families are owned by different addons and a shared enum
13012
+ * is a central list that rots invisibly.
13013
+ */
13014
+ family: string(),
13015
+ /**
13016
+ * The NUMERIC device id — the same value every log line carries as
13017
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13018
+ * cannot name the camera must not emit the entry, because a fleet total
13019
+ * cannot answer the only question anybody asks of this surface.
13020
+ */
13021
+ deviceId: number().int().positive(),
13022
+ /**
13023
+ * A second dimension inside the family: the model / step id for an inference
13024
+ * timeout, so "which camera AND which model" is one read. Absent when the
13025
+ * family has a single variant.
13026
+ */
13027
+ variant: string().optional(),
13028
+ /**
13029
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13030
+ * differencing two reads must drop the interval when it changes, because the
13031
+ * counter restarted from zero in a respawned runner. Same discipline as
13032
+ * `LoadContribution.startedAtMs`.
13033
+ */
13034
+ sinceMs: number(),
13035
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13036
+ atMs: number(),
13037
+ /**
13038
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13039
+ * window. A failure count published without it is the mistake this schema
13040
+ * exists to make impossible.
13041
+ */
13042
+ attempts: number().int().nonnegative(),
13043
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13044
+ succeeded: number().int().nonnegative(),
13045
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13046
+ reasons: array(FailureReasonCountSchema).readonly()
13047
+ });
13048
+ method(_void(), array(FailureContributionSchema).readonly());
13049
+ /**
12942
13050
  * filesystem-browse — per-node capability for browsing the node's local
12943
13051
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12944
13052
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13460,6 +13568,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13460
13568
  kind: "mutation",
13461
13569
  auth: "admin"
13462
13570
  });
13571
+ var LoadContributionSchema = object({
13572
+ role: _enum([
13573
+ "decode",
13574
+ "transcode",
13575
+ "recording",
13576
+ "streaming",
13577
+ "detection"
13578
+ ]),
13579
+ /**
13580
+ * The NUMERIC device id — the same value every log line carries as
13581
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13582
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13583
+ * contributor that cannot name its camera must not emit the entry at all,
13584
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13585
+ * and would quietly turn one camera's cost into everybody's.
13586
+ */
13587
+ deviceId: number().int().positive().nullable(),
13588
+ attribution: _enum([
13589
+ "measured",
13590
+ "accounted",
13591
+ "unattributable"
13592
+ ]),
13593
+ /**
13594
+ * What ONE entry is, in the contributor's own words — `615/high`,
13595
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13596
+ * family and inventing a common one would lose the only information that
13597
+ * makes two entries for the same camera distinguishable.
13598
+ */
13599
+ unit: string(),
13600
+ /**
13601
+ * The OS process this cost lives in, when there is one. Present so a
13602
+ * consumer can (a) tell two generations of the same unit apart across a
13603
+ * restart, and (b) subtract claimed processes from the node's process
13604
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13605
+ * process of its own.
13606
+ */
13607
+ pid: number().int().positive().optional(),
13608
+ /**
13609
+ * When this generation started. The pid's incarnation marker: a consumer
13610
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13611
+ * window when this changes, because the counter restarted from zero in a new
13612
+ * process.
13613
+ */
13614
+ startedAtMs: number().optional(),
13615
+ /**
13616
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13617
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13618
+ * contribution is asked for.
13619
+ *
13620
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13621
+ * needs a sampler, and a new per-node sampler is the defect half of
13622
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13623
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13624
+ *
13625
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13626
+ * an entry with no process.
13627
+ */
13628
+ cpuSeconds: number().optional(),
13629
+ /** Resident bytes of this unit's process, same source and same rules. */
13630
+ rssBytes: number().optional()
13631
+ });
13632
+ method(_void(), array(LoadContributionSchema).readonly());
13463
13633
  /**
13464
13634
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13465
13635
  * through. It stores nothing.
@@ -13536,176 +13706,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13536
13706
  tags: record(string(), string()).optional()
13537
13707
  }), array(LogEntrySchema).readonly());
13538
13708
  /**
13539
- * `failure-contribution` — the capability an addon reports its OWN losses
13540
- * through, per camera, with the denominator attached. It stores nothing.
13541
- *
13542
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13543
- *
13544
- * `load-contribution` answers *what did this camera COST*. This answers *what
13545
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13546
- * copied: the contributor reports what it already knows, hub-main adds only
13547
- * `addonId`, nothing needs global knowledge, and there is no central list for
13548
- * somebody to forget to edit.
13549
- *
13550
- * They are not merged, because their invariants are opposites:
13551
- *
13552
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13553
- * claim a camera cost nothing, which is a measurement nobody made;
13554
- * - a `failure-contribution` zero is the **most valuable value on the
13555
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13556
- * and it is exactly what an absent entry cannot say.
13557
- *
13558
- * Putting a loss counter on a cost entry would also break the reconciliation
13559
- * that gives `load-contribution` its point: contributions are subtracted from
13560
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13561
- * has no process.
13562
- *
13563
- * ## Why not a log line, since the counters already exist
13564
- *
13565
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13566
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13567
- * ends in a log line, and a log line is the thing the operator asked to stop
13568
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13569
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13570
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13571
- * media blackout were both diagnosed. The counters stay; this is where they can
13572
- * be READ.
13573
- *
13574
- * ## The rate is served with its denominator or not at all
13575
- *
13576
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13577
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13578
- * than yesterday" and was **flat across twelve hours** once divided by the
13579
- * successes on the same path. A surface that publishes only the numerator
13580
- * reproduces that mistake on every read.
13581
- *
13582
- * ## Shape
13583
- *
13584
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13585
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13586
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13587
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13588
- * a forked runner's entries reach hub-main over transport that already exists.
13589
- * No new UDS message, no second registry (D3). The operator reads the assembled
13590
- * result through `system.getFailureContributions`.
13591
- */
13592
- var FailureReasonCountSchema = object({
13593
- /**
13594
- * Why the attempt did not land, in the contributor's own vocabulary —
13595
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13596
- * strings that already appear in this repo's logs and, where one exists, the
13597
- * same string the per-track `previewMissReason` records (D276): a second
13598
- * vocabulary for the same loss would make the row and the counter
13599
- * un-joinable.
13600
- */
13601
- reason: string(),
13602
- count: number().int().nonnegative()
13603
- });
13604
- var FailureContributionSchema = object({
13605
- /**
13606
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13607
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13608
- * `unit` free: the families are owned by different addons and a shared enum
13609
- * is a central list that rots invisibly.
13610
- */
13611
- family: string(),
13612
- /**
13613
- * The NUMERIC device id — the same value every log line carries as
13614
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13615
- * cannot name the camera must not emit the entry, because a fleet total
13616
- * cannot answer the only question anybody asks of this surface.
13617
- */
13618
- deviceId: number().int().positive(),
13619
- /**
13620
- * A second dimension inside the family: the model / step id for an inference
13621
- * timeout, so "which camera AND which model" is one read. Absent when the
13622
- * family has a single variant.
13623
- */
13624
- variant: string().optional(),
13625
- /**
13626
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13627
- * differencing two reads must drop the interval when it changes, because the
13628
- * counter restarted from zero in a respawned runner. Same discipline as
13629
- * `LoadContribution.startedAtMs`.
13630
- */
13631
- sinceMs: number(),
13632
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13633
- atMs: number(),
13634
- /**
13635
- * THE DENOMINATOR — every attempt on this path for this camera in the
13636
- * window. A failure count published without it is the mistake this schema
13637
- * exists to make impossible.
13638
- */
13639
- attempts: number().int().nonnegative(),
13640
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13641
- succeeded: number().int().nonnegative(),
13642
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13643
- reasons: array(FailureReasonCountSchema).readonly()
13644
- });
13645
- method(_void(), array(FailureContributionSchema).readonly());
13646
- var LoadContributionSchema = object({
13647
- role: _enum([
13648
- "decode",
13649
- "transcode",
13650
- "recording",
13651
- "streaming",
13652
- "detection"
13653
- ]),
13654
- /**
13655
- * The NUMERIC device id — the same value every log line carries as
13656
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13657
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13658
- * contributor that cannot name its camera must not emit the entry at all,
13659
- * because an unnamed per-camera entry is indistinguishable from a shared one
13660
- * and would quietly turn one camera's cost into everybody's.
13661
- */
13662
- deviceId: number().int().positive().nullable(),
13663
- attribution: _enum([
13664
- "measured",
13665
- "accounted",
13666
- "unattributable"
13667
- ]),
13668
- /**
13669
- * What ONE entry is, in the contributor's own words — `615/high`,
13670
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13671
- * family and inventing a common one would lose the only information that
13672
- * makes two entries for the same camera distinguishable.
13673
- */
13674
- unit: string(),
13675
- /**
13676
- * The OS process this cost lives in, when there is one. Present so a
13677
- * consumer can (a) tell two generations of the same unit apart across a
13678
- * restart, and (b) subtract claimed processes from the node's process
13679
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13680
- * process of its own.
13681
- */
13682
- pid: number().int().positive().optional(),
13683
- /**
13684
- * When this generation started. The pid's incarnation marker: a consumer
13685
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13686
- * window when this changes, because the counter restarted from zero in a new
13687
- * process.
13688
- */
13689
- startedAtMs: number().optional(),
13690
- /**
13691
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13692
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13693
- * contribution is asked for.
13694
- *
13695
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13696
- * needs a sampler, and a new per-node sampler is the defect half of
13697
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13698
- * by whoever already keeps a history; a rate cannot be un-averaged.
13699
- *
13700
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13701
- * an entry with no process.
13702
- */
13703
- cpuSeconds: number().optional(),
13704
- /** Resident bytes of this unit's process, same source and same rules. */
13705
- rssBytes: number().optional()
13706
- });
13707
- method(_void(), array(LoadContributionSchema).readonly());
13708
- /**
13709
13709
  * `login-method` — collection cap through which auth addons contribute
13710
13710
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13711
13711
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18365,12 +18365,53 @@ var MediaFileKindEnum = _enum([
18365
18365
  "keyFrameSmall",
18366
18366
  "thumbnailSmall"
18367
18367
  ]);
18368
+ /**
18369
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18370
+ * ARE — never the bytes themselves.
18371
+ *
18372
+ * ## Why `url` and not `base64`
18373
+ *
18374
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18375
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18376
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18377
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18378
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18379
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18380
+ *
18381
+ * `url` points at the `event-media` data plane
18382
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18383
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18384
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18385
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18386
+ * no less protected than they were inside a `view`-level cap response — see
18387
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18388
+ * (per-device scoping).
18389
+ *
18390
+ * The URL is built from the row's **stored** key, which is not always its
18391
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18392
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18393
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18394
+ *
18395
+ * ## `base64` is TRANSITIONAL and is going away
18396
+ *
18397
+ * It is still populated for one reason: the deployed viewer's track-detail
18398
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18399
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18400
+ * triangle — not as absence. Removing the field before that viewer ships is an
18401
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18402
+ * delete this line and the `withBytes` pass-through in
18403
+ * `analytics-query-facade.ts`; nothing else reads it.
18404
+ */
18368
18405
  var MediaFileSchema = object({
18369
18406
  key: string(),
18370
18407
  kind: MediaFileKindEnum,
18371
- base64: string(),
18372
18408
  sizeBytes: number(),
18373
18409
  timestamp: number()
18410
+ }).extend({
18411
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18412
+ url: string(),
18413
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18414
+ base64: string()
18374
18415
  });
18375
18416
  /**
18376
18417
  * One media row WITHOUT its bytes.
@@ -18382,7 +18423,9 @@ var MediaFileSchema = object({
18382
18423
  * blocks the whole view.
18383
18424
  *
18384
18425
  * `sizeBytes` is carried because it is what lets a client decide between the
18385
- * stored blob and a `?variant=thumb` rendering without fetching either.
18426
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18427
+ * `url` because a client that had to build the plane path itself is a second
18428
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18386
18429
  */
18387
18430
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18388
18431
  /**
@@ -18729,6 +18772,50 @@ var EventStoreFootprintSchema = object({
18729
18772
  totalBytes: number().int(),
18730
18773
  devices: array(EventStoreDeviceFootprintSchema).readonly()
18731
18774
  });
18775
+ /** Event-media footprint for one {@link MediaFileKind}. */
18776
+ var EventMediaKindFootprintSchema = object({
18777
+ kind: MediaFileKindEnum,
18778
+ /** Media rows of this kind. */
18779
+ rows: number().int(),
18780
+ /** Bytes on disk held by those rows. */
18781
+ bytes: number().int()
18782
+ });
18783
+ /**
18784
+ * The media footprint broken down by KIND — the axis a deletion decision
18785
+ * actually turns on.
18786
+ *
18787
+ * A byte total says how much there is; it cannot say what is safe to remove.
18788
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
18789
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
18790
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
18791
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
18792
+ * nothing else, so sizing a deletion means summing per kind.
18793
+ *
18794
+ * ## Why `unaccounted*` exists
18795
+ *
18796
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
18797
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
18798
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
18799
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
18800
+ * retired code path, or by a version that knew a kind this one does not) would
18801
+ * otherwise vanish from the total silently, and an operator would delete
18802
+ * against a denominator smaller than the disk.
18803
+ *
18804
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
18805
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
18806
+ */
18807
+ var EventMediaKindBreakdownSchema = object({
18808
+ /** Every media row in scope, from one unfiltered aggregate. */
18809
+ totalRows: number().int(),
18810
+ /** Every media byte in scope, from that same aggregate. */
18811
+ totalBytes: number().int(),
18812
+ /** Per-kind footprint, ordered by bytes descending. */
18813
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
18814
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
18815
+ unaccountedRows: number().int(),
18816
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
18817
+ unaccountedBytes: number().int()
18818
+ });
18732
18819
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
18733
18820
  var EventPruneCountsSchema = object({
18734
18821
  motion: number().int(),
@@ -18932,6 +19019,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18932
19019
  }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
18933
19020
  kind: "query",
18934
19021
  auth: "admin"
19022
+ }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
19023
+ kind: "query",
19024
+ auth: "admin"
18935
19025
  }), method(object({
18936
19026
  olderThanMs: number(),
18937
19027
  reason: OpsLogReasonSchema.optional()
@@ -19071,6 +19161,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19071
19161
  }), array(MediaFileSchema).readonly()), method(object({
19072
19162
  trackId: string(),
19073
19163
  deviceId: number()
19164
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19165
+ eventId: string(),
19166
+ deviceId: number()
19074
19167
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19075
19168
  kind: "mutation",
19076
19169
  auth: "admin"
@@ -20893,6 +20986,20 @@ method(object({
20893
20986
  error: string().optional()
20894
20987
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
20895
20988
  providerId: string(),
20989
+ /**
20990
+ * The location this config is an UNSAVED edit of, when there is one.
20991
+ *
20992
+ * `listLocations` replaces every declared secret with the redaction
20993
+ * sentinel, so the edit modal's form state holds the sentinel for any
20994
+ * credential the operator did not retype — and posting that here
20995
+ * without a way to resolve it makes the provider try to authenticate
20996
+ * as `__camstack_redacted__` and report the operator's own working
20997
+ * password as wrong. Given this id, the orchestrator restores each
20998
+ * sentinel from the stored config (same rule as `upsertLocation`)
20999
+ * before dispatching. Omitted by the "Add location" wizard, where
21000
+ * every value was typed just now and nothing is stored yet.
21001
+ */
21002
+ locationId: string().optional(),
20896
21003
  config: record(string(), unknown())
20897
21004
  }), object({
20898
21005
  ok: boolean(),
@@ -23344,10 +23451,24 @@ var FaceClusterSchema = object({
23344
23451
  size: number().int(),
23345
23452
  cohesion: number()
23346
23453
  });
23454
+ /**
23455
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23456
+ * are — never the bytes.
23457
+ *
23458
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23459
+ * track/event contract) is still populated because a deployed viewer requires
23460
+ * the field to parse a row at all; this method has no such reader. Its ONE
23461
+ * caller is the admin UI's detail modal, which was building
23462
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23463
+ * dialog already rendering its key FRAME from the `event-media` plane.
23464
+ *
23465
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23466
+ * media key directly, so this needed no new plane and no new access decision.
23467
+ */
23347
23468
  var MediaFileLiteSchema$1 = object({
23348
23469
  key: string(),
23349
23470
  kind: string(),
23350
- base64: string(),
23471
+ url: string(),
23351
23472
  sizeBytes: number(),
23352
23473
  timestamp: number()
23353
23474
  });
@@ -25599,10 +25720,24 @@ var PlateInfoSchema = object({
25599
25720
  */
25600
25721
  cropUrl: string().optional()
25601
25722
  });
25723
+ /**
25724
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25725
+ * are — never the bytes.
25726
+ *
25727
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25728
+ * track/event contract) is still populated because a deployed viewer requires
25729
+ * the field to parse a row at all; this method has no such reader. Its ONE
25730
+ * caller is the admin UI's detail modal, which was building
25731
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25732
+ * dialog already rendering its key FRAME from the `event-media` plane.
25733
+ *
25734
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25735
+ * media key directly, so this needed no new plane and no new access decision.
25736
+ */
25602
25737
  var MediaFileLiteSchema = object({
25603
25738
  key: string(),
25604
25739
  kind: string(),
25605
- base64: string(),
25740
+ url: string(),
25606
25741
  sizeBytes: number(),
25607
25742
  timestamp: number()
25608
25743
  });
@@ -31519,6 +31654,12 @@ Object.freeze({
31519
31654
  addonId: null,
31520
31655
  access: "view"
31521
31656
  },
31657
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
31658
+ capName: "pipeline-analytics",
31659
+ capScope: "device",
31660
+ addonId: null,
31661
+ access: "view"
31662
+ },
31522
31663
  "pipelineAnalytics.getEventStoreFootprint": {
31523
31664
  capName: "pipeline-analytics",
31524
31665
  capScope: "device",
@@ -31615,6 +31756,12 @@ Object.freeze({
31615
31756
  addonId: null,
31616
31757
  access: "view"
31617
31758
  },
31759
+ "pipelineAnalytics.listEventMedia": {
31760
+ capName: "pipeline-analytics",
31761
+ capScope: "device",
31762
+ addonId: null,
31763
+ access: "view"
31764
+ },
31618
31765
  "pipelineAnalytics.listGroups": {
31619
31766
  capName: "pipeline-analytics",
31620
31767
  capScope: "device",
@@ -35178,6 +35325,11 @@ Object.freeze({
35178
35325
  form: "single",
35179
35326
  optional: false
35180
35327
  }],
35328
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
35329
+ name: "deviceId",
35330
+ form: "single",
35331
+ optional: true
35332
+ }],
35181
35333
  "pipelineAnalytics.getGroup": [{
35182
35334
  name: "deviceId",
35183
35335
  form: "single",
@@ -35238,6 +35390,11 @@ Object.freeze({
35238
35390
  form: "array",
35239
35391
  optional: false
35240
35392
  }],
35393
+ "pipelineAnalytics.listEventMedia": [{
35394
+ name: "deviceId",
35395
+ form: "single",
35396
+ optional: false
35397
+ }],
35241
35398
  "pipelineAnalytics.listGroups": [{
35242
35399
  name: "deviceIds",
35243
35400
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-smtp-nodemailer",
3
- "version": "1.2.45",
3
+ "version": "1.2.47",
4
4
  "description": "SMTP email provider addon for CamStack — wraps `nodemailer` and registers a `smtp-provider` cap collection entry. Used by magic-link login + notifier addons.",
5
5
  "keywords": [
6
6
  "camstack",