@camstack/addon-provider-gree 0.2.45 → 0.2.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +331 -174
  2. package/dist/addon.mjs +331 -174
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -13187,6 +13187,114 @@ method(object({
13187
13187
  height: number()
13188
13188
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13189
13189
  /**
13190
+ * `failure-contribution` — the capability an addon reports its OWN losses
13191
+ * through, per camera, with the denominator attached. It stores nothing.
13192
+ *
13193
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13194
+ *
13195
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13196
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13197
+ * copied: the contributor reports what it already knows, hub-main adds only
13198
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13199
+ * somebody to forget to edit.
13200
+ *
13201
+ * They are not merged, because their invariants are opposites:
13202
+ *
13203
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13204
+ * claim a camera cost nothing, which is a measurement nobody made;
13205
+ * - a `failure-contribution` zero is the **most valuable value on the
13206
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13207
+ * and it is exactly what an absent entry cannot say.
13208
+ *
13209
+ * Putting a loss counter on a cost entry would also break the reconciliation
13210
+ * that gives `load-contribution` its point: contributions are subtracted from
13211
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13212
+ * has no process.
13213
+ *
13214
+ * ## Why not a log line, since the counters already exist
13215
+ *
13216
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13217
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13218
+ * ends in a log line, and a log line is the thing the operator asked to stop
13219
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13220
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13221
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13222
+ * media blackout were both diagnosed. The counters stay; this is where they can
13223
+ * be READ.
13224
+ *
13225
+ * ## The rate is served with its denominator or not at all
13226
+ *
13227
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13228
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13229
+ * than yesterday" and was **flat across twelve hours** once divided by the
13230
+ * successes on the same path. A surface that publishes only the numerator
13231
+ * reproduces that mistake on every read.
13232
+ *
13233
+ * ## Shape
13234
+ *
13235
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13236
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13237
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13238
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13239
+ * a forked runner's entries reach hub-main over transport that already exists.
13240
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13241
+ * result through `system.getFailureContributions`.
13242
+ */
13243
+ var FailureReasonCountSchema = object({
13244
+ /**
13245
+ * Why the attempt did not land, in the contributor's own vocabulary —
13246
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13247
+ * strings that already appear in this repo's logs and, where one exists, the
13248
+ * same string the per-track `previewMissReason` records (D276): a second
13249
+ * vocabulary for the same loss would make the row and the counter
13250
+ * un-joinable.
13251
+ */
13252
+ reason: string(),
13253
+ count: number().int().nonnegative()
13254
+ });
13255
+ var FailureContributionSchema = object({
13256
+ /**
13257
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13258
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13259
+ * `unit` free: the families are owned by different addons and a shared enum
13260
+ * is a central list that rots invisibly.
13261
+ */
13262
+ family: string(),
13263
+ /**
13264
+ * The NUMERIC device id — the same value every log line carries as
13265
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13266
+ * cannot name the camera must not emit the entry, because a fleet total
13267
+ * cannot answer the only question anybody asks of this surface.
13268
+ */
13269
+ deviceId: number().int().positive(),
13270
+ /**
13271
+ * A second dimension inside the family: the model / step id for an inference
13272
+ * timeout, so "which camera AND which model" is one read. Absent when the
13273
+ * family has a single variant.
13274
+ */
13275
+ variant: string().optional(),
13276
+ /**
13277
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13278
+ * differencing two reads must drop the interval when it changes, because the
13279
+ * counter restarted from zero in a respawned runner. Same discipline as
13280
+ * `LoadContribution.startedAtMs`.
13281
+ */
13282
+ sinceMs: number(),
13283
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13284
+ atMs: number(),
13285
+ /**
13286
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13287
+ * window. A failure count published without it is the mistake this schema
13288
+ * exists to make impossible.
13289
+ */
13290
+ attempts: number().int().nonnegative(),
13291
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13292
+ succeeded: number().int().nonnegative(),
13293
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13294
+ reasons: array(FailureReasonCountSchema).readonly()
13295
+ });
13296
+ method(_void(), array(FailureContributionSchema).readonly());
13297
+ /**
13190
13298
  * filesystem-browse — per-node capability for browsing the node's local
13191
13299
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13192
13300
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13708,6 +13816,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13708
13816
  kind: "mutation",
13709
13817
  auth: "admin"
13710
13818
  });
13819
+ var LoadContributionSchema = object({
13820
+ role: _enum([
13821
+ "decode",
13822
+ "transcode",
13823
+ "recording",
13824
+ "streaming",
13825
+ "detection"
13826
+ ]),
13827
+ /**
13828
+ * The NUMERIC device id — the same value every log line carries as
13829
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13830
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13831
+ * contributor that cannot name its camera must not emit the entry at all,
13832
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13833
+ * and would quietly turn one camera's cost into everybody's.
13834
+ */
13835
+ deviceId: number().int().positive().nullable(),
13836
+ attribution: _enum([
13837
+ "measured",
13838
+ "accounted",
13839
+ "unattributable"
13840
+ ]),
13841
+ /**
13842
+ * What ONE entry is, in the contributor's own words — `615/high`,
13843
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13844
+ * family and inventing a common one would lose the only information that
13845
+ * makes two entries for the same camera distinguishable.
13846
+ */
13847
+ unit: string(),
13848
+ /**
13849
+ * The OS process this cost lives in, when there is one. Present so a
13850
+ * consumer can (a) tell two generations of the same unit apart across a
13851
+ * restart, and (b) subtract claimed processes from the node's process
13852
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13853
+ * process of its own.
13854
+ */
13855
+ pid: number().int().positive().optional(),
13856
+ /**
13857
+ * When this generation started. The pid's incarnation marker: a consumer
13858
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13859
+ * window when this changes, because the counter restarted from zero in a new
13860
+ * process.
13861
+ */
13862
+ startedAtMs: number().optional(),
13863
+ /**
13864
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13865
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13866
+ * contribution is asked for.
13867
+ *
13868
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13869
+ * needs a sampler, and a new per-node sampler is the defect half of
13870
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13871
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13872
+ *
13873
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13874
+ * an entry with no process.
13875
+ */
13876
+ cpuSeconds: number().optional(),
13877
+ /** Resident bytes of this unit's process, same source and same rules. */
13878
+ rssBytes: number().optional()
13879
+ });
13880
+ method(_void(), array(LoadContributionSchema).readonly());
13711
13881
  /**
13712
13882
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13713
13883
  * through. It stores nothing.
@@ -13784,176 +13954,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13784
13954
  tags: record(string(), string()).optional()
13785
13955
  }), array(LogEntrySchema).readonly());
13786
13956
  /**
13787
- * `failure-contribution` — the capability an addon reports its OWN losses
13788
- * through, per camera, with the denominator attached. It stores nothing.
13789
- *
13790
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13791
- *
13792
- * `load-contribution` answers *what did this camera COST*. This answers *what
13793
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13794
- * copied: the contributor reports what it already knows, hub-main adds only
13795
- * `addonId`, nothing needs global knowledge, and there is no central list for
13796
- * somebody to forget to edit.
13797
- *
13798
- * They are not merged, because their invariants are opposites:
13799
- *
13800
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13801
- * claim a camera cost nothing, which is a measurement nobody made;
13802
- * - a `failure-contribution` zero is the **most valuable value on the
13803
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13804
- * and it is exactly what an absent entry cannot say.
13805
- *
13806
- * Putting a loss counter on a cost entry would also break the reconciliation
13807
- * that gives `load-contribution` its point: contributions are subtracted from
13808
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13809
- * has no process.
13810
- *
13811
- * ## Why not a log line, since the counters already exist
13812
- *
13813
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13814
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13815
- * ends in a log line, and a log line is the thing the operator asked to stop
13816
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13817
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13818
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13819
- * media blackout were both diagnosed. The counters stay; this is where they can
13820
- * be READ.
13821
- *
13822
- * ## The rate is served with its denominator or not at all
13823
- *
13824
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13825
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13826
- * than yesterday" and was **flat across twelve hours** once divided by the
13827
- * successes on the same path. A surface that publishes only the numerator
13828
- * reproduces that mistake on every read.
13829
- *
13830
- * ## Shape
13831
- *
13832
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13833
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13834
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13835
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13836
- * a forked runner's entries reach hub-main over transport that already exists.
13837
- * No new UDS message, no second registry (D3). The operator reads the assembled
13838
- * result through `system.getFailureContributions`.
13839
- */
13840
- var FailureReasonCountSchema = object({
13841
- /**
13842
- * Why the attempt did not land, in the contributor's own vocabulary —
13843
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13844
- * strings that already appear in this repo's logs and, where one exists, the
13845
- * same string the per-track `previewMissReason` records (D276): a second
13846
- * vocabulary for the same loss would make the row and the counter
13847
- * un-joinable.
13848
- */
13849
- reason: string(),
13850
- count: number().int().nonnegative()
13851
- });
13852
- var FailureContributionSchema = object({
13853
- /**
13854
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13855
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13856
- * `unit` free: the families are owned by different addons and a shared enum
13857
- * is a central list that rots invisibly.
13858
- */
13859
- family: string(),
13860
- /**
13861
- * The NUMERIC device id — the same value every log line carries as
13862
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13863
- * cannot name the camera must not emit the entry, because a fleet total
13864
- * cannot answer the only question anybody asks of this surface.
13865
- */
13866
- deviceId: number().int().positive(),
13867
- /**
13868
- * A second dimension inside the family: the model / step id for an inference
13869
- * timeout, so "which camera AND which model" is one read. Absent when the
13870
- * family has a single variant.
13871
- */
13872
- variant: string().optional(),
13873
- /**
13874
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13875
- * differencing two reads must drop the interval when it changes, because the
13876
- * counter restarted from zero in a respawned runner. Same discipline as
13877
- * `LoadContribution.startedAtMs`.
13878
- */
13879
- sinceMs: number(),
13880
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13881
- atMs: number(),
13882
- /**
13883
- * THE DENOMINATOR — every attempt on this path for this camera in the
13884
- * window. A failure count published without it is the mistake this schema
13885
- * exists to make impossible.
13886
- */
13887
- attempts: number().int().nonnegative(),
13888
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13889
- succeeded: number().int().nonnegative(),
13890
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13891
- reasons: array(FailureReasonCountSchema).readonly()
13892
- });
13893
- method(_void(), array(FailureContributionSchema).readonly());
13894
- var LoadContributionSchema = object({
13895
- role: _enum([
13896
- "decode",
13897
- "transcode",
13898
- "recording",
13899
- "streaming",
13900
- "detection"
13901
- ]),
13902
- /**
13903
- * The NUMERIC device id — the same value every log line carries as
13904
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13905
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13906
- * contributor that cannot name its camera must not emit the entry at all,
13907
- * because an unnamed per-camera entry is indistinguishable from a shared one
13908
- * and would quietly turn one camera's cost into everybody's.
13909
- */
13910
- deviceId: number().int().positive().nullable(),
13911
- attribution: _enum([
13912
- "measured",
13913
- "accounted",
13914
- "unattributable"
13915
- ]),
13916
- /**
13917
- * What ONE entry is, in the contributor's own words — `615/high`,
13918
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13919
- * family and inventing a common one would lose the only information that
13920
- * makes two entries for the same camera distinguishable.
13921
- */
13922
- unit: string(),
13923
- /**
13924
- * The OS process this cost lives in, when there is one. Present so a
13925
- * consumer can (a) tell two generations of the same unit apart across a
13926
- * restart, and (b) subtract claimed processes from the node's process
13927
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13928
- * process of its own.
13929
- */
13930
- pid: number().int().positive().optional(),
13931
- /**
13932
- * When this generation started. The pid's incarnation marker: a consumer
13933
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13934
- * window when this changes, because the counter restarted from zero in a new
13935
- * process.
13936
- */
13937
- startedAtMs: number().optional(),
13938
- /**
13939
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13940
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13941
- * contribution is asked for.
13942
- *
13943
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13944
- * needs a sampler, and a new per-node sampler is the defect half of
13945
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13946
- * by whoever already keeps a history; a rate cannot be un-averaged.
13947
- *
13948
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13949
- * an entry with no process.
13950
- */
13951
- cpuSeconds: number().optional(),
13952
- /** Resident bytes of this unit's process, same source and same rules. */
13953
- rssBytes: number().optional()
13954
- });
13955
- method(_void(), array(LoadContributionSchema).readonly());
13956
- /**
13957
13957
  * `login-method` — collection cap through which auth addons contribute
13958
13958
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13959
13959
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18691,12 +18691,53 @@ var MediaFileKindEnum = _enum([
18691
18691
  "keyFrameSmall",
18692
18692
  "thumbnailSmall"
18693
18693
  ]);
18694
+ /**
18695
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18696
+ * ARE — never the bytes themselves.
18697
+ *
18698
+ * ## Why `url` and not `base64`
18699
+ *
18700
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18701
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18702
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18703
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18704
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18705
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18706
+ *
18707
+ * `url` points at the `event-media` data plane
18708
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18709
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18710
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18711
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18712
+ * no less protected than they were inside a `view`-level cap response — see
18713
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18714
+ * (per-device scoping).
18715
+ *
18716
+ * The URL is built from the row's **stored** key, which is not always its
18717
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18718
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18719
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18720
+ *
18721
+ * ## `base64` is TRANSITIONAL and is going away
18722
+ *
18723
+ * It is still populated for one reason: the deployed viewer's track-detail
18724
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18725
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18726
+ * triangle — not as absence. Removing the field before that viewer ships is an
18727
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18728
+ * delete this line and the `withBytes` pass-through in
18729
+ * `analytics-query-facade.ts`; nothing else reads it.
18730
+ */
18694
18731
  var MediaFileSchema = object({
18695
18732
  key: string(),
18696
18733
  kind: MediaFileKindEnum,
18697
- base64: string(),
18698
18734
  sizeBytes: number(),
18699
18735
  timestamp: number()
18736
+ }).extend({
18737
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18738
+ url: string(),
18739
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18740
+ base64: string()
18700
18741
  });
18701
18742
  /**
18702
18743
  * One media row WITHOUT its bytes.
@@ -18708,7 +18749,9 @@ var MediaFileSchema = object({
18708
18749
  * blocks the whole view.
18709
18750
  *
18710
18751
  * `sizeBytes` is carried because it is what lets a client decide between the
18711
- * stored blob and a `?variant=thumb` rendering without fetching either.
18752
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18753
+ * `url` because a client that had to build the plane path itself is a second
18754
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18712
18755
  */
18713
18756
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18714
18757
  /**
@@ -19055,6 +19098,50 @@ var EventStoreFootprintSchema = object({
19055
19098
  totalBytes: number().int(),
19056
19099
  devices: array(EventStoreDeviceFootprintSchema).readonly()
19057
19100
  });
19101
+ /** Event-media footprint for one {@link MediaFileKind}. */
19102
+ var EventMediaKindFootprintSchema = object({
19103
+ kind: MediaFileKindEnum,
19104
+ /** Media rows of this kind. */
19105
+ rows: number().int(),
19106
+ /** Bytes on disk held by those rows. */
19107
+ bytes: number().int()
19108
+ });
19109
+ /**
19110
+ * The media footprint broken down by KIND — the axis a deletion decision
19111
+ * actually turns on.
19112
+ *
19113
+ * A byte total says how much there is; it cannot say what is safe to remove.
19114
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
19115
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
19116
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
19117
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
19118
+ * nothing else, so sizing a deletion means summing per kind.
19119
+ *
19120
+ * ## Why `unaccounted*` exists
19121
+ *
19122
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
19123
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
19124
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
19125
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
19126
+ * retired code path, or by a version that knew a kind this one does not) would
19127
+ * otherwise vanish from the total silently, and an operator would delete
19128
+ * against a denominator smaller than the disk.
19129
+ *
19130
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
19131
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
19132
+ */
19133
+ var EventMediaKindBreakdownSchema = object({
19134
+ /** Every media row in scope, from one unfiltered aggregate. */
19135
+ totalRows: number().int(),
19136
+ /** Every media byte in scope, from that same aggregate. */
19137
+ totalBytes: number().int(),
19138
+ /** Per-kind footprint, ordered by bytes descending. */
19139
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
19140
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
19141
+ unaccountedRows: number().int(),
19142
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
19143
+ unaccountedBytes: number().int()
19144
+ });
19058
19145
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
19059
19146
  var EventPruneCountsSchema = object({
19060
19147
  motion: number().int(),
@@ -19258,6 +19345,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19258
19345
  }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
19259
19346
  kind: "query",
19260
19347
  auth: "admin"
19348
+ }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
19349
+ kind: "query",
19350
+ auth: "admin"
19261
19351
  }), method(object({
19262
19352
  olderThanMs: number(),
19263
19353
  reason: OpsLogReasonSchema.optional()
@@ -19397,6 +19487,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19397
19487
  }), array(MediaFileSchema).readonly()), method(object({
19398
19488
  trackId: string(),
19399
19489
  deviceId: number()
19490
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19491
+ eventId: string(),
19492
+ deviceId: number()
19400
19493
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19401
19494
  kind: "mutation",
19402
19495
  auth: "admin"
@@ -21206,6 +21299,20 @@ method(object({
21206
21299
  error: string().optional()
21207
21300
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
21208
21301
  providerId: string(),
21302
+ /**
21303
+ * The location this config is an UNSAVED edit of, when there is one.
21304
+ *
21305
+ * `listLocations` replaces every declared secret with the redaction
21306
+ * sentinel, so the edit modal's form state holds the sentinel for any
21307
+ * credential the operator did not retype — and posting that here
21308
+ * without a way to resolve it makes the provider try to authenticate
21309
+ * as `__camstack_redacted__` and report the operator's own working
21310
+ * password as wrong. Given this id, the orchestrator restores each
21311
+ * sentinel from the stored config (same rule as `upsertLocation`)
21312
+ * before dispatching. Omitted by the "Add location" wizard, where
21313
+ * every value was typed just now and nothing is stored yet.
21314
+ */
21315
+ locationId: string().optional(),
21209
21316
  config: record(string(), unknown())
21210
21317
  }), object({
21211
21318
  ok: boolean(),
@@ -24387,10 +24494,24 @@ var FaceClusterSchema = object({
24387
24494
  size: number().int(),
24388
24495
  cohesion: number()
24389
24496
  });
24497
+ /**
24498
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
24499
+ * are — never the bytes.
24500
+ *
24501
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
24502
+ * track/event contract) is still populated because a deployed viewer requires
24503
+ * the field to parse a row at all; this method has no such reader. Its ONE
24504
+ * caller is the admin UI's detail modal, which was building
24505
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
24506
+ * dialog already rendering its key FRAME from the `event-media` plane.
24507
+ *
24508
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
24509
+ * media key directly, so this needed no new plane and no new access decision.
24510
+ */
24390
24511
  var MediaFileLiteSchema$1 = object({
24391
24512
  key: string(),
24392
24513
  kind: string(),
24393
- base64: string(),
24514
+ url: string(),
24394
24515
  sizeBytes: number(),
24395
24516
  timestamp: number()
24396
24517
  });
@@ -27412,10 +27533,24 @@ var PlateInfoSchema = object({
27412
27533
  */
27413
27534
  cropUrl: string().optional()
27414
27535
  });
27536
+ /**
27537
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
27538
+ * are — never the bytes.
27539
+ *
27540
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
27541
+ * track/event contract) is still populated because a deployed viewer requires
27542
+ * the field to parse a row at all; this method has no such reader. Its ONE
27543
+ * caller is the admin UI's detail modal, which was building
27544
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
27545
+ * dialog already rendering its key FRAME from the `event-media` plane.
27546
+ *
27547
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
27548
+ * media key directly, so this needed no new plane and no new access decision.
27549
+ */
27415
27550
  var MediaFileLiteSchema = object({
27416
27551
  key: string(),
27417
27552
  kind: string(),
27418
- base64: string(),
27553
+ url: string(),
27419
27554
  sizeBytes: number(),
27420
27555
  timestamp: number()
27421
27556
  });
@@ -35216,6 +35351,12 @@ Object.freeze({
35216
35351
  addonId: null,
35217
35352
  access: "view"
35218
35353
  },
35354
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
35355
+ capName: "pipeline-analytics",
35356
+ capScope: "device",
35357
+ addonId: null,
35358
+ access: "view"
35359
+ },
35219
35360
  "pipelineAnalytics.getEventStoreFootprint": {
35220
35361
  capName: "pipeline-analytics",
35221
35362
  capScope: "device",
@@ -35312,6 +35453,12 @@ Object.freeze({
35312
35453
  addonId: null,
35313
35454
  access: "view"
35314
35455
  },
35456
+ "pipelineAnalytics.listEventMedia": {
35457
+ capName: "pipeline-analytics",
35458
+ capScope: "device",
35459
+ addonId: null,
35460
+ access: "view"
35461
+ },
35315
35462
  "pipelineAnalytics.listGroups": {
35316
35463
  capName: "pipeline-analytics",
35317
35464
  capScope: "device",
@@ -38875,6 +39022,11 @@ Object.freeze({
38875
39022
  form: "single",
38876
39023
  optional: false
38877
39024
  }],
39025
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
39026
+ name: "deviceId",
39027
+ form: "single",
39028
+ optional: true
39029
+ }],
38878
39030
  "pipelineAnalytics.getGroup": [{
38879
39031
  name: "deviceId",
38880
39032
  form: "single",
@@ -38935,6 +39087,11 @@ Object.freeze({
38935
39087
  form: "array",
38936
39088
  optional: false
38937
39089
  }],
39090
+ "pipelineAnalytics.listEventMedia": [{
39091
+ name: "deviceId",
39092
+ form: "single",
39093
+ optional: false
39094
+ }],
38938
39095
  "pipelineAnalytics.listGroups": [{
38939
39096
  name: "deviceIds",
38940
39097
  form: "array",
package/dist/addon.mjs CHANGED
@@ -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:
@@ -18690,12 +18690,53 @@ var MediaFileKindEnum = _enum([
18690
18690
  "keyFrameSmall",
18691
18691
  "thumbnailSmall"
18692
18692
  ]);
18693
+ /**
18694
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18695
+ * ARE — never the bytes themselves.
18696
+ *
18697
+ * ## Why `url` and not `base64`
18698
+ *
18699
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18700
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18701
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18702
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18703
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18704
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18705
+ *
18706
+ * `url` points at the `event-media` data plane
18707
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18708
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18709
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18710
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18711
+ * no less protected than they were inside a `view`-level cap response — see
18712
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18713
+ * (per-device scoping).
18714
+ *
18715
+ * The URL is built from the row's **stored** key, which is not always its
18716
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18717
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18718
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18719
+ *
18720
+ * ## `base64` is TRANSITIONAL and is going away
18721
+ *
18722
+ * It is still populated for one reason: the deployed viewer's track-detail
18723
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18724
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18725
+ * triangle — not as absence. Removing the field before that viewer ships is an
18726
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18727
+ * delete this line and the `withBytes` pass-through in
18728
+ * `analytics-query-facade.ts`; nothing else reads it.
18729
+ */
18693
18730
  var MediaFileSchema = object({
18694
18731
  key: string(),
18695
18732
  kind: MediaFileKindEnum,
18696
- base64: string(),
18697
18733
  sizeBytes: number(),
18698
18734
  timestamp: number()
18735
+ }).extend({
18736
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18737
+ url: string(),
18738
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18739
+ base64: string()
18699
18740
  });
18700
18741
  /**
18701
18742
  * One media row WITHOUT its bytes.
@@ -18707,7 +18748,9 @@ var MediaFileSchema = object({
18707
18748
  * blocks the whole view.
18708
18749
  *
18709
18750
  * `sizeBytes` is carried because it is what lets a client decide between the
18710
- * stored blob and a `?variant=thumb` rendering without fetching either.
18751
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18752
+ * `url` because a client that had to build the plane path itself is a second
18753
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18711
18754
  */
18712
18755
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18713
18756
  /**
@@ -19054,6 +19097,50 @@ var EventStoreFootprintSchema = object({
19054
19097
  totalBytes: number().int(),
19055
19098
  devices: array(EventStoreDeviceFootprintSchema).readonly()
19056
19099
  });
19100
+ /** Event-media footprint for one {@link MediaFileKind}. */
19101
+ var EventMediaKindFootprintSchema = object({
19102
+ kind: MediaFileKindEnum,
19103
+ /** Media rows of this kind. */
19104
+ rows: number().int(),
19105
+ /** Bytes on disk held by those rows. */
19106
+ bytes: number().int()
19107
+ });
19108
+ /**
19109
+ * The media footprint broken down by KIND — the axis a deletion decision
19110
+ * actually turns on.
19111
+ *
19112
+ * A byte total says how much there is; it cannot say what is safe to remove.
19113
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
19114
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
19115
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
19116
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
19117
+ * nothing else, so sizing a deletion means summing per kind.
19118
+ *
19119
+ * ## Why `unaccounted*` exists
19120
+ *
19121
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
19122
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
19123
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
19124
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
19125
+ * retired code path, or by a version that knew a kind this one does not) would
19126
+ * otherwise vanish from the total silently, and an operator would delete
19127
+ * against a denominator smaller than the disk.
19128
+ *
19129
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
19130
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
19131
+ */
19132
+ var EventMediaKindBreakdownSchema = object({
19133
+ /** Every media row in scope, from one unfiltered aggregate. */
19134
+ totalRows: number().int(),
19135
+ /** Every media byte in scope, from that same aggregate. */
19136
+ totalBytes: number().int(),
19137
+ /** Per-kind footprint, ordered by bytes descending. */
19138
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
19139
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
19140
+ unaccountedRows: number().int(),
19141
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
19142
+ unaccountedBytes: number().int()
19143
+ });
19057
19144
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
19058
19145
  var EventPruneCountsSchema = object({
19059
19146
  motion: number().int(),
@@ -19257,6 +19344,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19257
19344
  }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
19258
19345
  kind: "query",
19259
19346
  auth: "admin"
19347
+ }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
19348
+ kind: "query",
19349
+ auth: "admin"
19260
19350
  }), method(object({
19261
19351
  olderThanMs: number(),
19262
19352
  reason: OpsLogReasonSchema.optional()
@@ -19396,6 +19486,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19396
19486
  }), array(MediaFileSchema).readonly()), method(object({
19397
19487
  trackId: string(),
19398
19488
  deviceId: number()
19489
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19490
+ eventId: string(),
19491
+ deviceId: number()
19399
19492
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19400
19493
  kind: "mutation",
19401
19494
  auth: "admin"
@@ -21205,6 +21298,20 @@ method(object({
21205
21298
  error: string().optional()
21206
21299
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
21207
21300
  providerId: string(),
21301
+ /**
21302
+ * The location this config is an UNSAVED edit of, when there is one.
21303
+ *
21304
+ * `listLocations` replaces every declared secret with the redaction
21305
+ * sentinel, so the edit modal's form state holds the sentinel for any
21306
+ * credential the operator did not retype — and posting that here
21307
+ * without a way to resolve it makes the provider try to authenticate
21308
+ * as `__camstack_redacted__` and report the operator's own working
21309
+ * password as wrong. Given this id, the orchestrator restores each
21310
+ * sentinel from the stored config (same rule as `upsertLocation`)
21311
+ * before dispatching. Omitted by the "Add location" wizard, where
21312
+ * every value was typed just now and nothing is stored yet.
21313
+ */
21314
+ locationId: string().optional(),
21208
21315
  config: record(string(), unknown())
21209
21316
  }), object({
21210
21317
  ok: boolean(),
@@ -24386,10 +24493,24 @@ var FaceClusterSchema = object({
24386
24493
  size: number().int(),
24387
24494
  cohesion: number()
24388
24495
  });
24496
+ /**
24497
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
24498
+ * are — never the bytes.
24499
+ *
24500
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
24501
+ * track/event contract) is still populated because a deployed viewer requires
24502
+ * the field to parse a row at all; this method has no such reader. Its ONE
24503
+ * caller is the admin UI's detail modal, which was building
24504
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
24505
+ * dialog already rendering its key FRAME from the `event-media` plane.
24506
+ *
24507
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
24508
+ * media key directly, so this needed no new plane and no new access decision.
24509
+ */
24389
24510
  var MediaFileLiteSchema$1 = object({
24390
24511
  key: string(),
24391
24512
  kind: string(),
24392
- base64: string(),
24513
+ url: string(),
24393
24514
  sizeBytes: number(),
24394
24515
  timestamp: number()
24395
24516
  });
@@ -27411,10 +27532,24 @@ var PlateInfoSchema = object({
27411
27532
  */
27412
27533
  cropUrl: string().optional()
27413
27534
  });
27535
+ /**
27536
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
27537
+ * are — never the bytes.
27538
+ *
27539
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
27540
+ * track/event contract) is still populated because a deployed viewer requires
27541
+ * the field to parse a row at all; this method has no such reader. Its ONE
27542
+ * caller is the admin UI's detail modal, which was building
27543
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
27544
+ * dialog already rendering its key FRAME from the `event-media` plane.
27545
+ *
27546
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
27547
+ * media key directly, so this needed no new plane and no new access decision.
27548
+ */
27414
27549
  var MediaFileLiteSchema = object({
27415
27550
  key: string(),
27416
27551
  kind: string(),
27417
- base64: string(),
27552
+ url: string(),
27418
27553
  sizeBytes: number(),
27419
27554
  timestamp: number()
27420
27555
  });
@@ -35215,6 +35350,12 @@ Object.freeze({
35215
35350
  addonId: null,
35216
35351
  access: "view"
35217
35352
  },
35353
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
35354
+ capName: "pipeline-analytics",
35355
+ capScope: "device",
35356
+ addonId: null,
35357
+ access: "view"
35358
+ },
35218
35359
  "pipelineAnalytics.getEventStoreFootprint": {
35219
35360
  capName: "pipeline-analytics",
35220
35361
  capScope: "device",
@@ -35311,6 +35452,12 @@ Object.freeze({
35311
35452
  addonId: null,
35312
35453
  access: "view"
35313
35454
  },
35455
+ "pipelineAnalytics.listEventMedia": {
35456
+ capName: "pipeline-analytics",
35457
+ capScope: "device",
35458
+ addonId: null,
35459
+ access: "view"
35460
+ },
35314
35461
  "pipelineAnalytics.listGroups": {
35315
35462
  capName: "pipeline-analytics",
35316
35463
  capScope: "device",
@@ -38874,6 +39021,11 @@ Object.freeze({
38874
39021
  form: "single",
38875
39022
  optional: false
38876
39023
  }],
39024
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
39025
+ name: "deviceId",
39026
+ form: "single",
39027
+ optional: true
39028
+ }],
38877
39029
  "pipelineAnalytics.getGroup": [{
38878
39030
  name: "deviceId",
38879
39031
  form: "single",
@@ -38934,6 +39086,11 @@ Object.freeze({
38934
39086
  form: "array",
38935
39087
  optional: false
38936
39088
  }],
39089
+ "pipelineAnalytics.listEventMedia": [{
39090
+ name: "deviceId",
39091
+ form: "single",
39092
+ optional: false
39093
+ }],
38937
39094
  "pipelineAnalytics.listGroups": [{
38938
39095
  name: "deviceIds",
38939
39096
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-gree",
3
- "version": "0.2.45",
3
+ "version": "0.2.47",
4
4
  "description": "Gree air-conditioner device-provider addon for CamStack — wraps the @apocaliss92/nodegree local-UDP client (LAN discovery + AES control), exposing climate-control and fan-control",
5
5
  "keywords": [
6
6
  "camstack",