@camstack/addon-export-google 0.1.10 → 0.1.12

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.
@@ -13186,6 +13186,114 @@ method(object({
13186
13186
  height: number()
13187
13187
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13188
13188
  /**
13189
+ * `failure-contribution` — the capability an addon reports its OWN losses
13190
+ * through, per camera, with the denominator attached. It stores nothing.
13191
+ *
13192
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13193
+ *
13194
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13195
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13196
+ * copied: the contributor reports what it already knows, hub-main adds only
13197
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13198
+ * somebody to forget to edit.
13199
+ *
13200
+ * They are not merged, because their invariants are opposites:
13201
+ *
13202
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13203
+ * claim a camera cost nothing, which is a measurement nobody made;
13204
+ * - a `failure-contribution` zero is the **most valuable value on the
13205
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13206
+ * and it is exactly what an absent entry cannot say.
13207
+ *
13208
+ * Putting a loss counter on a cost entry would also break the reconciliation
13209
+ * that gives `load-contribution` its point: contributions are subtracted from
13210
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13211
+ * has no process.
13212
+ *
13213
+ * ## Why not a log line, since the counters already exist
13214
+ *
13215
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13216
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13217
+ * ends in a log line, and a log line is the thing the operator asked to stop
13218
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13219
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13220
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13221
+ * media blackout were both diagnosed. The counters stay; this is where they can
13222
+ * be READ.
13223
+ *
13224
+ * ## The rate is served with its denominator or not at all
13225
+ *
13226
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13227
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13228
+ * than yesterday" and was **flat across twelve hours** once divided by the
13229
+ * successes on the same path. A surface that publishes only the numerator
13230
+ * reproduces that mistake on every read.
13231
+ *
13232
+ * ## Shape
13233
+ *
13234
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13235
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13236
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13237
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13238
+ * a forked runner's entries reach hub-main over transport that already exists.
13239
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13240
+ * result through `system.getFailureContributions`.
13241
+ */
13242
+ var FailureReasonCountSchema = object({
13243
+ /**
13244
+ * Why the attempt did not land, in the contributor's own vocabulary —
13245
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13246
+ * strings that already appear in this repo's logs and, where one exists, the
13247
+ * same string the per-track `previewMissReason` records (D276): a second
13248
+ * vocabulary for the same loss would make the row and the counter
13249
+ * un-joinable.
13250
+ */
13251
+ reason: string(),
13252
+ count: number().int().nonnegative()
13253
+ });
13254
+ var FailureContributionSchema = object({
13255
+ /**
13256
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13257
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13258
+ * `unit` free: the families are owned by different addons and a shared enum
13259
+ * is a central list that rots invisibly.
13260
+ */
13261
+ family: string(),
13262
+ /**
13263
+ * The NUMERIC device id — the same value every log line carries as
13264
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13265
+ * cannot name the camera must not emit the entry, because a fleet total
13266
+ * cannot answer the only question anybody asks of this surface.
13267
+ */
13268
+ deviceId: number().int().positive(),
13269
+ /**
13270
+ * A second dimension inside the family: the model / step id for an inference
13271
+ * timeout, so "which camera AND which model" is one read. Absent when the
13272
+ * family has a single variant.
13273
+ */
13274
+ variant: string().optional(),
13275
+ /**
13276
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13277
+ * differencing two reads must drop the interval when it changes, because the
13278
+ * counter restarted from zero in a respawned runner. Same discipline as
13279
+ * `LoadContribution.startedAtMs`.
13280
+ */
13281
+ sinceMs: number(),
13282
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13283
+ atMs: number(),
13284
+ /**
13285
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13286
+ * window. A failure count published without it is the mistake this schema
13287
+ * exists to make impossible.
13288
+ */
13289
+ attempts: number().int().nonnegative(),
13290
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13291
+ succeeded: number().int().nonnegative(),
13292
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13293
+ reasons: array(FailureReasonCountSchema).readonly()
13294
+ });
13295
+ method(_void(), array(FailureContributionSchema).readonly());
13296
+ /**
13189
13297
  * filesystem-browse — per-node capability for browsing the node's local
13190
13298
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13191
13299
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13707,6 +13815,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13707
13815
  kind: "mutation",
13708
13816
  auth: "admin"
13709
13817
  });
13818
+ var LoadContributionSchema = object({
13819
+ role: _enum([
13820
+ "decode",
13821
+ "transcode",
13822
+ "recording",
13823
+ "streaming",
13824
+ "detection"
13825
+ ]),
13826
+ /**
13827
+ * The NUMERIC device id — the same value every log line carries as
13828
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13829
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13830
+ * contributor that cannot name its camera must not emit the entry at all,
13831
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13832
+ * and would quietly turn one camera's cost into everybody's.
13833
+ */
13834
+ deviceId: number().int().positive().nullable(),
13835
+ attribution: _enum([
13836
+ "measured",
13837
+ "accounted",
13838
+ "unattributable"
13839
+ ]),
13840
+ /**
13841
+ * What ONE entry is, in the contributor's own words — `615/high`,
13842
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13843
+ * family and inventing a common one would lose the only information that
13844
+ * makes two entries for the same camera distinguishable.
13845
+ */
13846
+ unit: string(),
13847
+ /**
13848
+ * The OS process this cost lives in, when there is one. Present so a
13849
+ * consumer can (a) tell two generations of the same unit apart across a
13850
+ * restart, and (b) subtract claimed processes from the node's process
13851
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13852
+ * process of its own.
13853
+ */
13854
+ pid: number().int().positive().optional(),
13855
+ /**
13856
+ * When this generation started. The pid's incarnation marker: a consumer
13857
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13858
+ * window when this changes, because the counter restarted from zero in a new
13859
+ * process.
13860
+ */
13861
+ startedAtMs: number().optional(),
13862
+ /**
13863
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13864
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13865
+ * contribution is asked for.
13866
+ *
13867
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13868
+ * needs a sampler, and a new per-node sampler is the defect half of
13869
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13870
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13871
+ *
13872
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13873
+ * an entry with no process.
13874
+ */
13875
+ cpuSeconds: number().optional(),
13876
+ /** Resident bytes of this unit's process, same source and same rules. */
13877
+ rssBytes: number().optional()
13878
+ });
13879
+ method(_void(), array(LoadContributionSchema).readonly());
13710
13880
  /**
13711
13881
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13712
13882
  * through. It stores nothing.
@@ -13783,176 +13953,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13783
13953
  tags: record(string(), string()).optional()
13784
13954
  }), array(LogEntrySchema).readonly());
13785
13955
  /**
13786
- * `failure-contribution` — the capability an addon reports its OWN losses
13787
- * through, per camera, with the denominator attached. It stores nothing.
13788
- *
13789
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13790
- *
13791
- * `load-contribution` answers *what did this camera COST*. This answers *what
13792
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13793
- * copied: the contributor reports what it already knows, hub-main adds only
13794
- * `addonId`, nothing needs global knowledge, and there is no central list for
13795
- * somebody to forget to edit.
13796
- *
13797
- * They are not merged, because their invariants are opposites:
13798
- *
13799
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13800
- * claim a camera cost nothing, which is a measurement nobody made;
13801
- * - a `failure-contribution` zero is the **most valuable value on the
13802
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13803
- * and it is exactly what an absent entry cannot say.
13804
- *
13805
- * Putting a loss counter on a cost entry would also break the reconciliation
13806
- * that gives `load-contribution` its point: contributions are subtracted from
13807
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13808
- * has no process.
13809
- *
13810
- * ## Why not a log line, since the counters already exist
13811
- *
13812
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13813
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13814
- * ends in a log line, and a log line is the thing the operator asked to stop
13815
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13816
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13817
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13818
- * media blackout were both diagnosed. The counters stay; this is where they can
13819
- * be READ.
13820
- *
13821
- * ## The rate is served with its denominator or not at all
13822
- *
13823
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13824
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13825
- * than yesterday" and was **flat across twelve hours** once divided by the
13826
- * successes on the same path. A surface that publishes only the numerator
13827
- * reproduces that mistake on every read.
13828
- *
13829
- * ## Shape
13830
- *
13831
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13832
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13833
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13834
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13835
- * a forked runner's entries reach hub-main over transport that already exists.
13836
- * No new UDS message, no second registry (D3). The operator reads the assembled
13837
- * result through `system.getFailureContributions`.
13838
- */
13839
- var FailureReasonCountSchema = object({
13840
- /**
13841
- * Why the attempt did not land, in the contributor's own vocabulary —
13842
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13843
- * strings that already appear in this repo's logs and, where one exists, the
13844
- * same string the per-track `previewMissReason` records (D276): a second
13845
- * vocabulary for the same loss would make the row and the counter
13846
- * un-joinable.
13847
- */
13848
- reason: string(),
13849
- count: number().int().nonnegative()
13850
- });
13851
- var FailureContributionSchema = object({
13852
- /**
13853
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13854
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13855
- * `unit` free: the families are owned by different addons and a shared enum
13856
- * is a central list that rots invisibly.
13857
- */
13858
- family: string(),
13859
- /**
13860
- * The NUMERIC device id — the same value every log line carries as
13861
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13862
- * cannot name the camera must not emit the entry, because a fleet total
13863
- * cannot answer the only question anybody asks of this surface.
13864
- */
13865
- deviceId: number().int().positive(),
13866
- /**
13867
- * A second dimension inside the family: the model / step id for an inference
13868
- * timeout, so "which camera AND which model" is one read. Absent when the
13869
- * family has a single variant.
13870
- */
13871
- variant: string().optional(),
13872
- /**
13873
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13874
- * differencing two reads must drop the interval when it changes, because the
13875
- * counter restarted from zero in a respawned runner. Same discipline as
13876
- * `LoadContribution.startedAtMs`.
13877
- */
13878
- sinceMs: number(),
13879
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13880
- atMs: number(),
13881
- /**
13882
- * THE DENOMINATOR — every attempt on this path for this camera in the
13883
- * window. A failure count published without it is the mistake this schema
13884
- * exists to make impossible.
13885
- */
13886
- attempts: number().int().nonnegative(),
13887
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13888
- succeeded: number().int().nonnegative(),
13889
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13890
- reasons: array(FailureReasonCountSchema).readonly()
13891
- });
13892
- method(_void(), array(FailureContributionSchema).readonly());
13893
- var LoadContributionSchema = object({
13894
- role: _enum([
13895
- "decode",
13896
- "transcode",
13897
- "recording",
13898
- "streaming",
13899
- "detection"
13900
- ]),
13901
- /**
13902
- * The NUMERIC device id — the same value every log line carries as
13903
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13904
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13905
- * contributor that cannot name its camera must not emit the entry at all,
13906
- * because an unnamed per-camera entry is indistinguishable from a shared one
13907
- * and would quietly turn one camera's cost into everybody's.
13908
- */
13909
- deviceId: number().int().positive().nullable(),
13910
- attribution: _enum([
13911
- "measured",
13912
- "accounted",
13913
- "unattributable"
13914
- ]),
13915
- /**
13916
- * What ONE entry is, in the contributor's own words — `615/high`,
13917
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13918
- * family and inventing a common one would lose the only information that
13919
- * makes two entries for the same camera distinguishable.
13920
- */
13921
- unit: string(),
13922
- /**
13923
- * The OS process this cost lives in, when there is one. Present so a
13924
- * consumer can (a) tell two generations of the same unit apart across a
13925
- * restart, and (b) subtract claimed processes from the node's process
13926
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13927
- * process of its own.
13928
- */
13929
- pid: number().int().positive().optional(),
13930
- /**
13931
- * When this generation started. The pid's incarnation marker: a consumer
13932
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13933
- * window when this changes, because the counter restarted from zero in a new
13934
- * process.
13935
- */
13936
- startedAtMs: number().optional(),
13937
- /**
13938
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13939
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13940
- * contribution is asked for.
13941
- *
13942
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13943
- * needs a sampler, and a new per-node sampler is the defect half of
13944
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13945
- * by whoever already keeps a history; a rate cannot be un-averaged.
13946
- *
13947
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13948
- * an entry with no process.
13949
- */
13950
- cpuSeconds: number().optional(),
13951
- /** Resident bytes of this unit's process, same source and same rules. */
13952
- rssBytes: number().optional()
13953
- });
13954
- method(_void(), array(LoadContributionSchema).readonly());
13955
- /**
13956
13956
  * `login-method` — collection cap through which auth addons contribute
13957
13957
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13958
13958
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18628,12 +18628,53 @@ var MediaFileKindEnum = _enum([
18628
18628
  "keyFrameSmall",
18629
18629
  "thumbnailSmall"
18630
18630
  ]);
18631
+ /**
18632
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18633
+ * ARE — never the bytes themselves.
18634
+ *
18635
+ * ## Why `url` and not `base64`
18636
+ *
18637
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18638
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18639
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18640
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18641
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18642
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18643
+ *
18644
+ * `url` points at the `event-media` data plane
18645
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18646
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18647
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18648
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18649
+ * no less protected than they were inside a `view`-level cap response — see
18650
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18651
+ * (per-device scoping).
18652
+ *
18653
+ * The URL is built from the row's **stored** key, which is not always its
18654
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18655
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18656
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18657
+ *
18658
+ * ## `base64` is TRANSITIONAL and is going away
18659
+ *
18660
+ * It is still populated for one reason: the deployed viewer's track-detail
18661
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18662
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18663
+ * triangle — not as absence. Removing the field before that viewer ships is an
18664
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18665
+ * delete this line and the `withBytes` pass-through in
18666
+ * `analytics-query-facade.ts`; nothing else reads it.
18667
+ */
18631
18668
  var MediaFileSchema = object({
18632
18669
  key: string(),
18633
18670
  kind: MediaFileKindEnum,
18634
- base64: string(),
18635
18671
  sizeBytes: number(),
18636
18672
  timestamp: number()
18673
+ }).extend({
18674
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18675
+ url: string(),
18676
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18677
+ base64: string()
18637
18678
  });
18638
18679
  /**
18639
18680
  * One media row WITHOUT its bytes.
@@ -18645,7 +18686,9 @@ var MediaFileSchema = object({
18645
18686
  * blocks the whole view.
18646
18687
  *
18647
18688
  * `sizeBytes` is carried because it is what lets a client decide between the
18648
- * stored blob and a `?variant=thumb` rendering without fetching either.
18689
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18690
+ * `url` because a client that had to build the plane path itself is a second
18691
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18649
18692
  */
18650
18693
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18651
18694
  /**
@@ -18992,6 +19035,50 @@ var EventStoreFootprintSchema = object({
18992
19035
  totalBytes: number().int(),
18993
19036
  devices: array(EventStoreDeviceFootprintSchema).readonly()
18994
19037
  });
19038
+ /** Event-media footprint for one {@link MediaFileKind}. */
19039
+ var EventMediaKindFootprintSchema = object({
19040
+ kind: MediaFileKindEnum,
19041
+ /** Media rows of this kind. */
19042
+ rows: number().int(),
19043
+ /** Bytes on disk held by those rows. */
19044
+ bytes: number().int()
19045
+ });
19046
+ /**
19047
+ * The media footprint broken down by KIND — the axis a deletion decision
19048
+ * actually turns on.
19049
+ *
19050
+ * A byte total says how much there is; it cannot say what is safe to remove.
19051
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
19052
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
19053
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
19054
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
19055
+ * nothing else, so sizing a deletion means summing per kind.
19056
+ *
19057
+ * ## Why `unaccounted*` exists
19058
+ *
19059
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
19060
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
19061
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
19062
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
19063
+ * retired code path, or by a version that knew a kind this one does not) would
19064
+ * otherwise vanish from the total silently, and an operator would delete
19065
+ * against a denominator smaller than the disk.
19066
+ *
19067
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
19068
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
19069
+ */
19070
+ var EventMediaKindBreakdownSchema = object({
19071
+ /** Every media row in scope, from one unfiltered aggregate. */
19072
+ totalRows: number().int(),
19073
+ /** Every media byte in scope, from that same aggregate. */
19074
+ totalBytes: number().int(),
19075
+ /** Per-kind footprint, ordered by bytes descending. */
19076
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
19077
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
19078
+ unaccountedRows: number().int(),
19079
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
19080
+ unaccountedBytes: number().int()
19081
+ });
18995
19082
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
18996
19083
  var EventPruneCountsSchema = object({
18997
19084
  motion: number().int(),
@@ -19195,6 +19282,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19195
19282
  }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
19196
19283
  kind: "query",
19197
19284
  auth: "admin"
19285
+ }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
19286
+ kind: "query",
19287
+ auth: "admin"
19198
19288
  }), method(object({
19199
19289
  olderThanMs: number(),
19200
19290
  reason: OpsLogReasonSchema.optional()
@@ -19334,6 +19424,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19334
19424
  }), array(MediaFileSchema).readonly()), method(object({
19335
19425
  trackId: string(),
19336
19426
  deviceId: number()
19427
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19428
+ eventId: string(),
19429
+ deviceId: number()
19337
19430
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19338
19431
  kind: "mutation",
19339
19432
  auth: "admin"
@@ -21143,6 +21236,20 @@ method(object({
21143
21236
  error: string().optional()
21144
21237
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
21145
21238
  providerId: string(),
21239
+ /**
21240
+ * The location this config is an UNSAVED edit of, when there is one.
21241
+ *
21242
+ * `listLocations` replaces every declared secret with the redaction
21243
+ * sentinel, so the edit modal's form state holds the sentinel for any
21244
+ * credential the operator did not retype — and posting that here
21245
+ * without a way to resolve it makes the provider try to authenticate
21246
+ * as `__camstack_redacted__` and report the operator's own working
21247
+ * password as wrong. Given this id, the orchestrator restores each
21248
+ * sentinel from the stored config (same rule as `upsertLocation`)
21249
+ * before dispatching. Omitted by the "Add location" wizard, where
21250
+ * every value was typed just now and nothing is stored yet.
21251
+ */
21252
+ locationId: string().optional(),
21146
21253
  config: record(string(), unknown())
21147
21254
  }), object({
21148
21255
  ok: boolean(),
@@ -23606,10 +23713,24 @@ var FaceClusterSchema = object({
23606
23713
  size: number().int(),
23607
23714
  cohesion: number()
23608
23715
  });
23716
+ /**
23717
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23718
+ * are — never the bytes.
23719
+ *
23720
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23721
+ * track/event contract) is still populated because a deployed viewer requires
23722
+ * the field to parse a row at all; this method has no such reader. Its ONE
23723
+ * caller is the admin UI's detail modal, which was building
23724
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23725
+ * dialog already rendering its key FRAME from the `event-media` plane.
23726
+ *
23727
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23728
+ * media key directly, so this needed no new plane and no new access decision.
23729
+ */
23609
23730
  var MediaFileLiteSchema$1 = object({
23610
23731
  key: string(),
23611
23732
  kind: string(),
23612
- base64: string(),
23733
+ url: string(),
23613
23734
  sizeBytes: number(),
23614
23735
  timestamp: number()
23615
23736
  });
@@ -25861,10 +25982,24 @@ var PlateInfoSchema = object({
25861
25982
  */
25862
25983
  cropUrl: string().optional()
25863
25984
  });
25985
+ /**
25986
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25987
+ * are — never the bytes.
25988
+ *
25989
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25990
+ * track/event contract) is still populated because a deployed viewer requires
25991
+ * the field to parse a row at all; this method has no such reader. Its ONE
25992
+ * caller is the admin UI's detail modal, which was building
25993
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25994
+ * dialog already rendering its key FRAME from the `event-media` plane.
25995
+ *
25996
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25997
+ * media key directly, so this needed no new plane and no new access decision.
25998
+ */
25864
25999
  var MediaFileLiteSchema = object({
25865
26000
  key: string(),
25866
26001
  kind: string(),
25867
- base64: string(),
26002
+ url: string(),
25868
26003
  sizeBytes: number(),
25869
26004
  timestamp: number()
25870
26005
  });
@@ -31788,6 +31923,12 @@ Object.freeze({
31788
31923
  addonId: null,
31789
31924
  access: "view"
31790
31925
  },
31926
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
31927
+ capName: "pipeline-analytics",
31928
+ capScope: "device",
31929
+ addonId: null,
31930
+ access: "view"
31931
+ },
31791
31932
  "pipelineAnalytics.getEventStoreFootprint": {
31792
31933
  capName: "pipeline-analytics",
31793
31934
  capScope: "device",
@@ -31884,6 +32025,12 @@ Object.freeze({
31884
32025
  addonId: null,
31885
32026
  access: "view"
31886
32027
  },
32028
+ "pipelineAnalytics.listEventMedia": {
32029
+ capName: "pipeline-analytics",
32030
+ capScope: "device",
32031
+ addonId: null,
32032
+ access: "view"
32033
+ },
31887
32034
  "pipelineAnalytics.listGroups": {
31888
32035
  capName: "pipeline-analytics",
31889
32036
  capScope: "device",
@@ -35447,6 +35594,11 @@ Object.freeze({
35447
35594
  form: "single",
35448
35595
  optional: false
35449
35596
  }],
35597
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
35598
+ name: "deviceId",
35599
+ form: "single",
35600
+ optional: true
35601
+ }],
35450
35602
  "pipelineAnalytics.getGroup": [{
35451
35603
  name: "deviceId",
35452
35604
  form: "single",
@@ -35507,6 +35659,11 @@ Object.freeze({
35507
35659
  form: "array",
35508
35660
  optional: false
35509
35661
  }],
35662
+ "pipelineAnalytics.listEventMedia": [{
35663
+ name: "deviceId",
35664
+ form: "single",
35665
+ optional: false
35666
+ }],
35510
35667
  "pipelineAnalytics.listGroups": [{
35511
35668
  name: "deviceIds",
35512
35669
  form: "array",
@@ -13182,6 +13182,114 @@ method(object({
13182
13182
  height: number()
13183
13183
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13184
13184
  /**
13185
+ * `failure-contribution` — the capability an addon reports its OWN losses
13186
+ * through, per camera, with the denominator attached. It stores nothing.
13187
+ *
13188
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13189
+ *
13190
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13191
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13192
+ * copied: the contributor reports what it already knows, hub-main adds only
13193
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13194
+ * somebody to forget to edit.
13195
+ *
13196
+ * They are not merged, because their invariants are opposites:
13197
+ *
13198
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13199
+ * claim a camera cost nothing, which is a measurement nobody made;
13200
+ * - a `failure-contribution` zero is the **most valuable value on the
13201
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13202
+ * and it is exactly what an absent entry cannot say.
13203
+ *
13204
+ * Putting a loss counter on a cost entry would also break the reconciliation
13205
+ * that gives `load-contribution` its point: contributions are subtracted from
13206
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13207
+ * has no process.
13208
+ *
13209
+ * ## Why not a log line, since the counters already exist
13210
+ *
13211
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13212
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13213
+ * ends in a log line, and a log line is the thing the operator asked to stop
13214
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13215
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13216
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13217
+ * media blackout were both diagnosed. The counters stay; this is where they can
13218
+ * be READ.
13219
+ *
13220
+ * ## The rate is served with its denominator or not at all
13221
+ *
13222
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13223
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13224
+ * than yesterday" and was **flat across twelve hours** once divided by the
13225
+ * successes on the same path. A surface that publishes only the numerator
13226
+ * reproduces that mistake on every read.
13227
+ *
13228
+ * ## Shape
13229
+ *
13230
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13231
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13232
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13233
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13234
+ * a forked runner's entries reach hub-main over transport that already exists.
13235
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13236
+ * result through `system.getFailureContributions`.
13237
+ */
13238
+ var FailureReasonCountSchema = object({
13239
+ /**
13240
+ * Why the attempt did not land, in the contributor's own vocabulary —
13241
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13242
+ * strings that already appear in this repo's logs and, where one exists, the
13243
+ * same string the per-track `previewMissReason` records (D276): a second
13244
+ * vocabulary for the same loss would make the row and the counter
13245
+ * un-joinable.
13246
+ */
13247
+ reason: string(),
13248
+ count: number().int().nonnegative()
13249
+ });
13250
+ var FailureContributionSchema = object({
13251
+ /**
13252
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13253
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13254
+ * `unit` free: the families are owned by different addons and a shared enum
13255
+ * is a central list that rots invisibly.
13256
+ */
13257
+ family: string(),
13258
+ /**
13259
+ * The NUMERIC device id — the same value every log line carries as
13260
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13261
+ * cannot name the camera must not emit the entry, because a fleet total
13262
+ * cannot answer the only question anybody asks of this surface.
13263
+ */
13264
+ deviceId: number().int().positive(),
13265
+ /**
13266
+ * A second dimension inside the family: the model / step id for an inference
13267
+ * timeout, so "which camera AND which model" is one read. Absent when the
13268
+ * family has a single variant.
13269
+ */
13270
+ variant: string().optional(),
13271
+ /**
13272
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13273
+ * differencing two reads must drop the interval when it changes, because the
13274
+ * counter restarted from zero in a respawned runner. Same discipline as
13275
+ * `LoadContribution.startedAtMs`.
13276
+ */
13277
+ sinceMs: number(),
13278
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13279
+ atMs: number(),
13280
+ /**
13281
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13282
+ * window. A failure count published without it is the mistake this schema
13283
+ * exists to make impossible.
13284
+ */
13285
+ attempts: number().int().nonnegative(),
13286
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13287
+ succeeded: number().int().nonnegative(),
13288
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13289
+ reasons: array(FailureReasonCountSchema).readonly()
13290
+ });
13291
+ method(_void(), array(FailureContributionSchema).readonly());
13292
+ /**
13185
13293
  * filesystem-browse — per-node capability for browsing the node's local
13186
13294
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13187
13295
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13703,6 +13811,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13703
13811
  kind: "mutation",
13704
13812
  auth: "admin"
13705
13813
  });
13814
+ var LoadContributionSchema = object({
13815
+ role: _enum([
13816
+ "decode",
13817
+ "transcode",
13818
+ "recording",
13819
+ "streaming",
13820
+ "detection"
13821
+ ]),
13822
+ /**
13823
+ * The NUMERIC device id — the same value every log line carries as
13824
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13825
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13826
+ * contributor that cannot name its camera must not emit the entry at all,
13827
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13828
+ * and would quietly turn one camera's cost into everybody's.
13829
+ */
13830
+ deviceId: number().int().positive().nullable(),
13831
+ attribution: _enum([
13832
+ "measured",
13833
+ "accounted",
13834
+ "unattributable"
13835
+ ]),
13836
+ /**
13837
+ * What ONE entry is, in the contributor's own words — `615/high`,
13838
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13839
+ * family and inventing a common one would lose the only information that
13840
+ * makes two entries for the same camera distinguishable.
13841
+ */
13842
+ unit: string(),
13843
+ /**
13844
+ * The OS process this cost lives in, when there is one. Present so a
13845
+ * consumer can (a) tell two generations of the same unit apart across a
13846
+ * restart, and (b) subtract claimed processes from the node's process
13847
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13848
+ * process of its own.
13849
+ */
13850
+ pid: number().int().positive().optional(),
13851
+ /**
13852
+ * When this generation started. The pid's incarnation marker: a consumer
13853
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13854
+ * window when this changes, because the counter restarted from zero in a new
13855
+ * process.
13856
+ */
13857
+ startedAtMs: number().optional(),
13858
+ /**
13859
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13860
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13861
+ * contribution is asked for.
13862
+ *
13863
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13864
+ * needs a sampler, and a new per-node sampler is the defect half of
13865
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13866
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13867
+ *
13868
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13869
+ * an entry with no process.
13870
+ */
13871
+ cpuSeconds: number().optional(),
13872
+ /** Resident bytes of this unit's process, same source and same rules. */
13873
+ rssBytes: number().optional()
13874
+ });
13875
+ method(_void(), array(LoadContributionSchema).readonly());
13706
13876
  /**
13707
13877
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13708
13878
  * through. It stores nothing.
@@ -13779,176 +13949,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13779
13949
  tags: record(string(), string()).optional()
13780
13950
  }), array(LogEntrySchema).readonly());
13781
13951
  /**
13782
- * `failure-contribution` — the capability an addon reports its OWN losses
13783
- * through, per camera, with the denominator attached. It stores nothing.
13784
- *
13785
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13786
- *
13787
- * `load-contribution` answers *what did this camera COST*. This answers *what
13788
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13789
- * copied: the contributor reports what it already knows, hub-main adds only
13790
- * `addonId`, nothing needs global knowledge, and there is no central list for
13791
- * somebody to forget to edit.
13792
- *
13793
- * They are not merged, because their invariants are opposites:
13794
- *
13795
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13796
- * claim a camera cost nothing, which is a measurement nobody made;
13797
- * - a `failure-contribution` zero is the **most valuable value on the
13798
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13799
- * and it is exactly what an absent entry cannot say.
13800
- *
13801
- * Putting a loss counter on a cost entry would also break the reconciliation
13802
- * that gives `load-contribution` its point: contributions are subtracted from
13803
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13804
- * has no process.
13805
- *
13806
- * ## Why not a log line, since the counters already exist
13807
- *
13808
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13809
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13810
- * ends in a log line, and a log line is the thing the operator asked to stop
13811
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13812
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13813
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13814
- * media blackout were both diagnosed. The counters stay; this is where they can
13815
- * be READ.
13816
- *
13817
- * ## The rate is served with its denominator or not at all
13818
- *
13819
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13820
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13821
- * than yesterday" and was **flat across twelve hours** once divided by the
13822
- * successes on the same path. A surface that publishes only the numerator
13823
- * reproduces that mistake on every read.
13824
- *
13825
- * ## Shape
13826
- *
13827
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13828
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13829
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13830
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13831
- * a forked runner's entries reach hub-main over transport that already exists.
13832
- * No new UDS message, no second registry (D3). The operator reads the assembled
13833
- * result through `system.getFailureContributions`.
13834
- */
13835
- var FailureReasonCountSchema = object({
13836
- /**
13837
- * Why the attempt did not land, in the contributor's own vocabulary —
13838
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13839
- * strings that already appear in this repo's logs and, where one exists, the
13840
- * same string the per-track `previewMissReason` records (D276): a second
13841
- * vocabulary for the same loss would make the row and the counter
13842
- * un-joinable.
13843
- */
13844
- reason: string(),
13845
- count: number().int().nonnegative()
13846
- });
13847
- var FailureContributionSchema = object({
13848
- /**
13849
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13850
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13851
- * `unit` free: the families are owned by different addons and a shared enum
13852
- * is a central list that rots invisibly.
13853
- */
13854
- family: string(),
13855
- /**
13856
- * The NUMERIC device id — the same value every log line carries as
13857
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13858
- * cannot name the camera must not emit the entry, because a fleet total
13859
- * cannot answer the only question anybody asks of this surface.
13860
- */
13861
- deviceId: number().int().positive(),
13862
- /**
13863
- * A second dimension inside the family: the model / step id for an inference
13864
- * timeout, so "which camera AND which model" is one read. Absent when the
13865
- * family has a single variant.
13866
- */
13867
- variant: string().optional(),
13868
- /**
13869
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13870
- * differencing two reads must drop the interval when it changes, because the
13871
- * counter restarted from zero in a respawned runner. Same discipline as
13872
- * `LoadContribution.startedAtMs`.
13873
- */
13874
- sinceMs: number(),
13875
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13876
- atMs: number(),
13877
- /**
13878
- * THE DENOMINATOR — every attempt on this path for this camera in the
13879
- * window. A failure count published without it is the mistake this schema
13880
- * exists to make impossible.
13881
- */
13882
- attempts: number().int().nonnegative(),
13883
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13884
- succeeded: number().int().nonnegative(),
13885
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13886
- reasons: array(FailureReasonCountSchema).readonly()
13887
- });
13888
- method(_void(), array(FailureContributionSchema).readonly());
13889
- var LoadContributionSchema = object({
13890
- role: _enum([
13891
- "decode",
13892
- "transcode",
13893
- "recording",
13894
- "streaming",
13895
- "detection"
13896
- ]),
13897
- /**
13898
- * The NUMERIC device id — the same value every log line carries as
13899
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13900
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13901
- * contributor that cannot name its camera must not emit the entry at all,
13902
- * because an unnamed per-camera entry is indistinguishable from a shared one
13903
- * and would quietly turn one camera's cost into everybody's.
13904
- */
13905
- deviceId: number().int().positive().nullable(),
13906
- attribution: _enum([
13907
- "measured",
13908
- "accounted",
13909
- "unattributable"
13910
- ]),
13911
- /**
13912
- * What ONE entry is, in the contributor's own words — `615/high`,
13913
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13914
- * family and inventing a common one would lose the only information that
13915
- * makes two entries for the same camera distinguishable.
13916
- */
13917
- unit: string(),
13918
- /**
13919
- * The OS process this cost lives in, when there is one. Present so a
13920
- * consumer can (a) tell two generations of the same unit apart across a
13921
- * restart, and (b) subtract claimed processes from the node's process
13922
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13923
- * process of its own.
13924
- */
13925
- pid: number().int().positive().optional(),
13926
- /**
13927
- * When this generation started. The pid's incarnation marker: a consumer
13928
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13929
- * window when this changes, because the counter restarted from zero in a new
13930
- * process.
13931
- */
13932
- startedAtMs: number().optional(),
13933
- /**
13934
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13935
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13936
- * contribution is asked for.
13937
- *
13938
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13939
- * needs a sampler, and a new per-node sampler is the defect half of
13940
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13941
- * by whoever already keeps a history; a rate cannot be un-averaged.
13942
- *
13943
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13944
- * an entry with no process.
13945
- */
13946
- cpuSeconds: number().optional(),
13947
- /** Resident bytes of this unit's process, same source and same rules. */
13948
- rssBytes: number().optional()
13949
- });
13950
- method(_void(), array(LoadContributionSchema).readonly());
13951
- /**
13952
13952
  * `login-method` — collection cap through which auth addons contribute
13953
13953
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13954
13954
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18624,12 +18624,53 @@ var MediaFileKindEnum = _enum([
18624
18624
  "keyFrameSmall",
18625
18625
  "thumbnailSmall"
18626
18626
  ]);
18627
+ /**
18628
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18629
+ * ARE — never the bytes themselves.
18630
+ *
18631
+ * ## Why `url` and not `base64`
18632
+ *
18633
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18634
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18635
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18636
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18637
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18638
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18639
+ *
18640
+ * `url` points at the `event-media` data plane
18641
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18642
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18643
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18644
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18645
+ * no less protected than they were inside a `view`-level cap response — see
18646
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18647
+ * (per-device scoping).
18648
+ *
18649
+ * The URL is built from the row's **stored** key, which is not always its
18650
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18651
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18652
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18653
+ *
18654
+ * ## `base64` is TRANSITIONAL and is going away
18655
+ *
18656
+ * It is still populated for one reason: the deployed viewer's track-detail
18657
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18658
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18659
+ * triangle — not as absence. Removing the field before that viewer ships is an
18660
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18661
+ * delete this line and the `withBytes` pass-through in
18662
+ * `analytics-query-facade.ts`; nothing else reads it.
18663
+ */
18627
18664
  var MediaFileSchema = object({
18628
18665
  key: string(),
18629
18666
  kind: MediaFileKindEnum,
18630
- base64: string(),
18631
18667
  sizeBytes: number(),
18632
18668
  timestamp: number()
18669
+ }).extend({
18670
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18671
+ url: string(),
18672
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18673
+ base64: string()
18633
18674
  });
18634
18675
  /**
18635
18676
  * One media row WITHOUT its bytes.
@@ -18641,7 +18682,9 @@ var MediaFileSchema = object({
18641
18682
  * blocks the whole view.
18642
18683
  *
18643
18684
  * `sizeBytes` is carried because it is what lets a client decide between the
18644
- * stored blob and a `?variant=thumb` rendering without fetching either.
18685
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18686
+ * `url` because a client that had to build the plane path itself is a second
18687
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18645
18688
  */
18646
18689
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18647
18690
  /**
@@ -18988,6 +19031,50 @@ var EventStoreFootprintSchema = object({
18988
19031
  totalBytes: number().int(),
18989
19032
  devices: array(EventStoreDeviceFootprintSchema).readonly()
18990
19033
  });
19034
+ /** Event-media footprint for one {@link MediaFileKind}. */
19035
+ var EventMediaKindFootprintSchema = object({
19036
+ kind: MediaFileKindEnum,
19037
+ /** Media rows of this kind. */
19038
+ rows: number().int(),
19039
+ /** Bytes on disk held by those rows. */
19040
+ bytes: number().int()
19041
+ });
19042
+ /**
19043
+ * The media footprint broken down by KIND — the axis a deletion decision
19044
+ * actually turns on.
19045
+ *
19046
+ * A byte total says how much there is; it cannot say what is safe to remove.
19047
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
19048
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
19049
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
19050
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
19051
+ * nothing else, so sizing a deletion means summing per kind.
19052
+ *
19053
+ * ## Why `unaccounted*` exists
19054
+ *
19055
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
19056
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
19057
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
19058
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
19059
+ * retired code path, or by a version that knew a kind this one does not) would
19060
+ * otherwise vanish from the total silently, and an operator would delete
19061
+ * against a denominator smaller than the disk.
19062
+ *
19063
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
19064
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
19065
+ */
19066
+ var EventMediaKindBreakdownSchema = object({
19067
+ /** Every media row in scope, from one unfiltered aggregate. */
19068
+ totalRows: number().int(),
19069
+ /** Every media byte in scope, from that same aggregate. */
19070
+ totalBytes: number().int(),
19071
+ /** Per-kind footprint, ordered by bytes descending. */
19072
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
19073
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
19074
+ unaccountedRows: number().int(),
19075
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
19076
+ unaccountedBytes: number().int()
19077
+ });
18991
19078
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
18992
19079
  var EventPruneCountsSchema = object({
18993
19080
  motion: number().int(),
@@ -19191,6 +19278,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19191
19278
  }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
19192
19279
  kind: "query",
19193
19280
  auth: "admin"
19281
+ }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
19282
+ kind: "query",
19283
+ auth: "admin"
19194
19284
  }), method(object({
19195
19285
  olderThanMs: number(),
19196
19286
  reason: OpsLogReasonSchema.optional()
@@ -19330,6 +19420,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19330
19420
  }), array(MediaFileSchema).readonly()), method(object({
19331
19421
  trackId: string(),
19332
19422
  deviceId: number()
19423
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19424
+ eventId: string(),
19425
+ deviceId: number()
19333
19426
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19334
19427
  kind: "mutation",
19335
19428
  auth: "admin"
@@ -21139,6 +21232,20 @@ method(object({
21139
21232
  error: string().optional()
21140
21233
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
21141
21234
  providerId: string(),
21235
+ /**
21236
+ * The location this config is an UNSAVED edit of, when there is one.
21237
+ *
21238
+ * `listLocations` replaces every declared secret with the redaction
21239
+ * sentinel, so the edit modal's form state holds the sentinel for any
21240
+ * credential the operator did not retype — and posting that here
21241
+ * without a way to resolve it makes the provider try to authenticate
21242
+ * as `__camstack_redacted__` and report the operator's own working
21243
+ * password as wrong. Given this id, the orchestrator restores each
21244
+ * sentinel from the stored config (same rule as `upsertLocation`)
21245
+ * before dispatching. Omitted by the "Add location" wizard, where
21246
+ * every value was typed just now and nothing is stored yet.
21247
+ */
21248
+ locationId: string().optional(),
21142
21249
  config: record(string(), unknown())
21143
21250
  }), object({
21144
21251
  ok: boolean(),
@@ -23602,10 +23709,24 @@ var FaceClusterSchema = object({
23602
23709
  size: number().int(),
23603
23710
  cohesion: number()
23604
23711
  });
23712
+ /**
23713
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23714
+ * are — never the bytes.
23715
+ *
23716
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23717
+ * track/event contract) is still populated because a deployed viewer requires
23718
+ * the field to parse a row at all; this method has no such reader. Its ONE
23719
+ * caller is the admin UI's detail modal, which was building
23720
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23721
+ * dialog already rendering its key FRAME from the `event-media` plane.
23722
+ *
23723
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23724
+ * media key directly, so this needed no new plane and no new access decision.
23725
+ */
23605
23726
  var MediaFileLiteSchema$1 = object({
23606
23727
  key: string(),
23607
23728
  kind: string(),
23608
- base64: string(),
23729
+ url: string(),
23609
23730
  sizeBytes: number(),
23610
23731
  timestamp: number()
23611
23732
  });
@@ -25857,10 +25978,24 @@ var PlateInfoSchema = object({
25857
25978
  */
25858
25979
  cropUrl: string().optional()
25859
25980
  });
25981
+ /**
25982
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25983
+ * are — never the bytes.
25984
+ *
25985
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25986
+ * track/event contract) is still populated because a deployed viewer requires
25987
+ * the field to parse a row at all; this method has no such reader. Its ONE
25988
+ * caller is the admin UI's detail modal, which was building
25989
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25990
+ * dialog already rendering its key FRAME from the `event-media` plane.
25991
+ *
25992
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25993
+ * media key directly, so this needed no new plane and no new access decision.
25994
+ */
25860
25995
  var MediaFileLiteSchema = object({
25861
25996
  key: string(),
25862
25997
  kind: string(),
25863
- base64: string(),
25998
+ url: string(),
25864
25999
  sizeBytes: number(),
25865
26000
  timestamp: number()
25866
26001
  });
@@ -31784,6 +31919,12 @@ Object.freeze({
31784
31919
  addonId: null,
31785
31920
  access: "view"
31786
31921
  },
31922
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
31923
+ capName: "pipeline-analytics",
31924
+ capScope: "device",
31925
+ addonId: null,
31926
+ access: "view"
31927
+ },
31787
31928
  "pipelineAnalytics.getEventStoreFootprint": {
31788
31929
  capName: "pipeline-analytics",
31789
31930
  capScope: "device",
@@ -31880,6 +32021,12 @@ Object.freeze({
31880
32021
  addonId: null,
31881
32022
  access: "view"
31882
32023
  },
32024
+ "pipelineAnalytics.listEventMedia": {
32025
+ capName: "pipeline-analytics",
32026
+ capScope: "device",
32027
+ addonId: null,
32028
+ access: "view"
32029
+ },
31883
32030
  "pipelineAnalytics.listGroups": {
31884
32031
  capName: "pipeline-analytics",
31885
32032
  capScope: "device",
@@ -35443,6 +35590,11 @@ Object.freeze({
35443
35590
  form: "single",
35444
35591
  optional: false
35445
35592
  }],
35593
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
35594
+ name: "deviceId",
35595
+ form: "single",
35596
+ optional: true
35597
+ }],
35446
35598
  "pipelineAnalytics.getGroup": [{
35447
35599
  name: "deviceId",
35448
35600
  form: "single",
@@ -35503,6 +35655,11 @@ Object.freeze({
35503
35655
  form: "array",
35504
35656
  optional: false
35505
35657
  }],
35658
+ "pipelineAnalytics.listEventMedia": [{
35659
+ name: "deviceId",
35660
+ form: "single",
35661
+ optional: false
35662
+ }],
35506
35663
  "pipelineAnalytics.listGroups": [{
35507
35664
  name: "deviceIds",
35508
35665
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-google",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Google Home export — hub-side smart-home fulfillment (SYNC / QUERY / EXECUTE / DISCONNECT) for the non-camera fleet, served over the hub's own OAuth account link. No Google credential is stored, sent or required.",
5
5
  "keywords": [
6
6
  "camstack",