@camstack/types 1.2.127 → 1.2.128

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.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_event_category = require("./event-category-BaEgqJNv.js");
3
- const require_sleep = require("./sleep-CWWLTM6W.js");
3
+ const require_sleep = require("./sleep-C3AniWy-.js");
4
4
  const require_canonical_hash = require("./canonical-hash-DNV8S5ET.js");
5
5
  const require_enums = require("./enums.js");
6
6
  const require_err_msg = require("./err-msg-COpsHMw2.js");
@@ -11004,6 +11004,135 @@ var embeddingEncoderCapability = {
11004
11004
  }
11005
11005
  };
11006
11006
  //#endregion
11007
+ //#region src/capabilities/failure-contribution.cap.ts
11008
+ /**
11009
+ * `failure-contribution` — the capability an addon reports its OWN losses
11010
+ * through, per camera, with the denominator attached. It stores nothing.
11011
+ *
11012
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
11013
+ *
11014
+ * `load-contribution` answers *what did this camera COST*. This answers *what
11015
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
11016
+ * copied: the contributor reports what it already knows, hub-main adds only
11017
+ * `addonId`, nothing needs global knowledge, and there is no central list for
11018
+ * somebody to forget to edit.
11019
+ *
11020
+ * They are not merged, because their invariants are opposites:
11021
+ *
11022
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
11023
+ * claim a camera cost nothing, which is a measurement nobody made;
11024
+ * - a `failure-contribution` zero is the **most valuable value on the
11025
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
11026
+ * and it is exactly what an absent entry cannot say.
11027
+ *
11028
+ * Putting a loss counter on a cost entry would also break the reconciliation
11029
+ * that gives `load-contribution` its point: contributions are subtracted from
11030
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
11031
+ * has no process.
11032
+ *
11033
+ * ## Why not a log line, since the counters already exist
11034
+ *
11035
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
11036
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
11037
+ * ends in a log line, and a log line is the thing the operator asked to stop
11038
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
11039
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
11040
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
11041
+ * media blackout were both diagnosed. The counters stay; this is where they can
11042
+ * be READ.
11043
+ *
11044
+ * ## The rate is served with its denominator or not at all
11045
+ *
11046
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
11047
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
11048
+ * than yesterday" and was **flat across twelve hours** once divided by the
11049
+ * successes on the same path. A surface that publishes only the numerator
11050
+ * reproduces that mistake on every read.
11051
+ *
11052
+ * ## Shape
11053
+ *
11054
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
11055
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
11056
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
11057
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
11058
+ * a forked runner's entries reach hub-main over transport that already exists.
11059
+ * No new UDS message, no second registry (D3). The operator reads the assembled
11060
+ * result through `system.getFailureContributions`.
11061
+ */
11062
+ var FailureReasonCountSchema = zod.z.object({
11063
+ /**
11064
+ * Why the attempt did not land, in the contributor's own vocabulary —
11065
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
11066
+ * strings that already appear in this repo's logs and, where one exists, the
11067
+ * same string the per-track `previewMissReason` records (D276): a second
11068
+ * vocabulary for the same loss would make the row and the counter
11069
+ * un-joinable.
11070
+ */
11071
+ reason: zod.z.string(),
11072
+ count: zod.z.number().int().nonnegative()
11073
+ });
11074
+ var FailureContributionSchema = zod.z.object({
11075
+ /**
11076
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
11077
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
11078
+ * `unit` free: the families are owned by different addons and a shared enum
11079
+ * is a central list that rots invisibly.
11080
+ */
11081
+ family: zod.z.string(),
11082
+ /**
11083
+ * The NUMERIC device id — the same value every log line carries as
11084
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
11085
+ * cannot name the camera must not emit the entry, because a fleet total
11086
+ * cannot answer the only question anybody asks of this surface.
11087
+ */
11088
+ deviceId: zod.z.number().int().positive(),
11089
+ /**
11090
+ * A second dimension inside the family: the model / step id for an inference
11091
+ * timeout, so "which camera AND which model" is one read. Absent when the
11092
+ * family has a single variant.
11093
+ */
11094
+ variant: zod.z.string().optional(),
11095
+ /**
11096
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
11097
+ * differencing two reads must drop the interval when it changes, because the
11098
+ * counter restarted from zero in a respawned runner. Same discipline as
11099
+ * `LoadContribution.startedAtMs`.
11100
+ */
11101
+ sinceMs: zod.z.number(),
11102
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
11103
+ atMs: zod.z.number(),
11104
+ /**
11105
+ * THE DENOMINATOR — every attempt on this path for this camera in the
11106
+ * window. A failure count published without it is the mistake this schema
11107
+ * exists to make impossible.
11108
+ */
11109
+ attempts: zod.z.number().int().nonnegative(),
11110
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
11111
+ succeeded: zod.z.number().int().nonnegative(),
11112
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
11113
+ reasons: zod.z.array(FailureReasonCountSchema).readonly()
11114
+ });
11115
+ var failureContributionCapability = {
11116
+ name: "failure-contribution",
11117
+ scope: "system",
11118
+ mode: "collection",
11119
+ internal: true,
11120
+ methods: {
11121
+ /**
11122
+ * This addon's per-camera failure counters, read live from bounded in-RAM
11123
+ * state it already keeps. Inert: no persistence, no sampling, no timer.
11124
+ *
11125
+ * READING NEVER RESETS. The counters are CUMULATIVE since `sinceMs`, and a
11126
+ * consumer that wants a rate differences two reads. A draining read would
11127
+ * make two operators with the page open each destroy half of the other's
11128
+ * numbers, and `load-contribution` already settled the same question the
11129
+ * same way for `cpuSeconds`.
11130
+ */
11131
+ list: require_sleep.method(zod.z.void(), zod.z.array(FailureContributionSchema).readonly()) },
11132
+ /** In-process only — enumerated through `addons.listCapabilityProviders`. */
11133
+ mount: { kind: "skip" }
11134
+ };
11135
+ //#endregion
11007
11136
  //#region src/capabilities/filesystem-browse.cap.ts
11008
11137
  /**
11009
11138
  * filesystem-browse — per-node capability for browsing the node's local
@@ -11644,246 +11773,6 @@ var llmCapability = {
11644
11773
  }
11645
11774
  };
11646
11775
  //#endregion
11647
- //#region src/capabilities/log-channels.cap.ts
11648
- /**
11649
- * `log-channels` — the capability an addon DECLARES its diagnostic channels
11650
- * through. It stores nothing.
11651
- *
11652
- * ## Why a capability at all, and why this shape
11653
- *
11654
- * Which channels exist is knowledge only the addon has: `stream-broker` knows
11655
- * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
11656
- * maintained by hand rots at the first addition and rots INVISIBLY — nothing
11657
- * fails, an operator just never sees the channel somebody added. So the list
11658
- * is assembled from declarations at runtime.
11659
- *
11660
- * The shape is copied from `log-destination.cap.ts`, which already does
11661
- * exactly this job: `mode: 'collection'`, `internal: true`,
11662
- * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
11663
- * `addons.listCapabilityProviders` still enumerates it, and the hub's
11664
- * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
11665
- * runner's declarations reach hub-main over the transport that already exists.
11666
- * No new UDS message, no second registry.
11667
- *
11668
- * ## What it deliberately does NOT own
11669
- *
11670
- * The VALUES — which channel is armed, for which cameras, until when — live in
11671
- * ONE place: the logging settings document on the `system` cap
11672
- * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
11673
- * value is the defect the plan behind this work exists to remove, and
11674
- * `setRequestCensus` was retired (D245) rather than allowed to be a second
11675
- * one. {@link logChannelsCapability} therefore has no getter for a level, no
11676
- * setter for a window and no persistence of any kind.
11677
- *
11678
- * ## Why `apply` is here even so
11679
- *
11680
- * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
11681
- * seam has to carry the value from the authority to the mirror, and a channel
11682
- * that cannot be reached is precisely the dead knob this whole slice exists to
11683
- * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
11684
- * `apply` is that seam and nothing more: it writes an in-memory mirror, it
11685
- * persists nothing, it is never the source of a value, and it is called only
11686
- * with a set the hub actually read (D49 — a read that fails does not call it
11687
- * at all, so no channel is silently disarmed by a bad read).
11688
- */
11689
- /** What `apply` reports back — enough to log, not enough to be a second state. */
11690
- var LogChannelApplyResultSchema = zod.z.object({
11691
- /** How many declared channels are armed in this process after the call. */
11692
- armed: zod.z.number().int().min(0),
11693
- /**
11694
- * Names the document armed that this process does not declare. Reported
11695
- * rather than swallowed: a name here is either a typo or an addon that has
11696
- * not booted, and both deserve a line instead of silence.
11697
- */
11698
- unknown: zod.z.array(zod.z.string()).readonly()
11699
- });
11700
- var logChannelsCapability = {
11701
- name: "log-channels",
11702
- scope: "system",
11703
- mode: "collection",
11704
- internal: true,
11705
- methods: {
11706
- /** The channels this addon declares. Inert: no value, no state. */
11707
- list: require_sleep.method(zod.z.void(), zod.z.array(LogChannelDescriptorSchema).readonly()),
11708
- /**
11709
- * Refresh this process's mirror from the document's FULL set of armed
11710
- * windows.
11711
- *
11712
- * Full and not incremental on purpose: the document is the authority, so a
11713
- * channel it does not name is disarmed here. An incremental apply would
11714
- * let a disarm get lost in transit and leave a channel running that
11715
- * nobody can see is running.
11716
- */
11717
- apply: require_sleep.method(zod.z.object({ windows: zod.z.array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" })
11718
- },
11719
- /** In-process only — enumerated through `addons.listCapabilityProviders`. */
11720
- mount: { kind: "skip" }
11721
- };
11722
- //#endregion
11723
- //#region src/capabilities/log-destination.cap.ts
11724
- var LogLevelSchema = zod.z.enum([
11725
- "debug",
11726
- "info",
11727
- "warn",
11728
- "error"
11729
- ]);
11730
- var LogEntrySchema = zod.z.object({
11731
- timestamp: zod.z.date(),
11732
- level: LogLevelSchema,
11733
- scope: zod.z.array(zod.z.string()),
11734
- message: zod.z.string(),
11735
- meta: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
11736
- tags: zod.z.record(zod.z.string(), zod.z.string()).optional()
11737
- });
11738
- var logDestinationCapability = {
11739
- name: "log-destination",
11740
- scope: "system",
11741
- mode: "collection",
11742
- internal: true,
11743
- methods: {
11744
- write: require_sleep.method(LogEntrySchema, zod.z.void(), { kind: "mutation" }),
11745
- query: require_sleep.method(zod.z.object({
11746
- scope: zod.z.array(zod.z.string()).optional(),
11747
- level: LogLevelSchema.optional(),
11748
- since: zod.z.date().optional(),
11749
- until: zod.z.date().optional(),
11750
- limit: zod.z.number().optional(),
11751
- tags: zod.z.record(zod.z.string(), zod.z.string()).optional()
11752
- }), zod.z.array(LogEntrySchema).readonly())
11753
- },
11754
- /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
11755
- mount: { kind: "skip" }
11756
- };
11757
- //#endregion
11758
- //#region src/capabilities/failure-contribution.cap.ts
11759
- /**
11760
- * `failure-contribution` — the capability an addon reports its OWN losses
11761
- * through, per camera, with the denominator attached. It stores nothing.
11762
- *
11763
- * ## The twin of `load-contribution`, and why it is a twin and not a field
11764
- *
11765
- * `load-contribution` answers *what did this camera COST*. This answers *what
11766
- * did this camera LOSE*. The reporting discipline is identical and deliberately
11767
- * copied: the contributor reports what it already knows, hub-main adds only
11768
- * `addonId`, nothing needs global knowledge, and there is no central list for
11769
- * somebody to forget to edit.
11770
- *
11771
- * They are not merged, because their invariants are opposites:
11772
- *
11773
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
11774
- * claim a camera cost nothing, which is a measurement nobody made;
11775
- * - a `failure-contribution` zero is the **most valuable value on the
11776
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
11777
- * and it is exactly what an absent entry cannot say.
11778
- *
11779
- * Putting a loss counter on a cost entry would also break the reconciliation
11780
- * that gives `load-contribution` its point: contributions are subtracted from
11781
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
11782
- * has no process.
11783
- *
11784
- * ## Why not a log line, since the counters already exist
11785
- *
11786
- * Several of these paths already counted themselves — `CaptureScheduler`'s
11787
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
11788
- * ends in a log line, and a log line is the thing the operator asked to stop
11789
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
11790
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
11791
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
11792
- * media blackout were both diagnosed. The counters stay; this is where they can
11793
- * be READ.
11794
- *
11795
- * ## The rate is served with its denominator or not at all
11796
- *
11797
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
11798
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
11799
- * than yesterday" and was **flat across twelve hours** once divided by the
11800
- * successes on the same path. A surface that publishes only the numerator
11801
- * reproduces that mistake on every read.
11802
- *
11803
- * ## Shape
11804
- *
11805
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
11806
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
11807
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
11808
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
11809
- * a forked runner's entries reach hub-main over transport that already exists.
11810
- * No new UDS message, no second registry (D3). The operator reads the assembled
11811
- * result through `system.getFailureContributions`.
11812
- */
11813
- var FailureReasonCountSchema = zod.z.object({
11814
- /**
11815
- * Why the attempt did not land, in the contributor's own vocabulary —
11816
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
11817
- * strings that already appear in this repo's logs and, where one exists, the
11818
- * same string the per-track `previewMissReason` records (D276): a second
11819
- * vocabulary for the same loss would make the row and the counter
11820
- * un-joinable.
11821
- */
11822
- reason: zod.z.string(),
11823
- count: zod.z.number().int().nonnegative()
11824
- });
11825
- var FailureContributionSchema = zod.z.object({
11826
- /**
11827
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
11828
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
11829
- * `unit` free: the families are owned by different addons and a shared enum
11830
- * is a central list that rots invisibly.
11831
- */
11832
- family: zod.z.string(),
11833
- /**
11834
- * The NUMERIC device id — the same value every log line carries as
11835
- * `tags.deviceId`. Never nullable and never absent: a contributor that
11836
- * cannot name the camera must not emit the entry, because a fleet total
11837
- * cannot answer the only question anybody asks of this surface.
11838
- */
11839
- deviceId: zod.z.number().int().positive(),
11840
- /**
11841
- * A second dimension inside the family: the model / step id for an inference
11842
- * timeout, so "which camera AND which model" is one read. Absent when the
11843
- * family has a single variant.
11844
- */
11845
- variant: zod.z.string().optional(),
11846
- /**
11847
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
11848
- * differencing two reads must drop the interval when it changes, because the
11849
- * counter restarted from zero in a respawned runner. Same discipline as
11850
- * `LoadContribution.startedAtMs`.
11851
- */
11852
- sinceMs: zod.z.number(),
11853
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
11854
- atMs: zod.z.number(),
11855
- /**
11856
- * THE DENOMINATOR — every attempt on this path for this camera in the
11857
- * window. A failure count published without it is the mistake this schema
11858
- * exists to make impossible.
11859
- */
11860
- attempts: zod.z.number().int().nonnegative(),
11861
- /** Attempts that landed. `attempts - succeeded` is the loss. */
11862
- succeeded: zod.z.number().int().nonnegative(),
11863
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
11864
- reasons: zod.z.array(FailureReasonCountSchema).readonly()
11865
- });
11866
- var failureContributionCapability = {
11867
- name: "failure-contribution",
11868
- scope: "system",
11869
- mode: "collection",
11870
- internal: true,
11871
- methods: {
11872
- /**
11873
- * This addon's per-camera failure counters, read live from bounded in-RAM
11874
- * state it already keeps. Inert: no persistence, no sampling, no timer.
11875
- *
11876
- * READING NEVER RESETS. The counters are CUMULATIVE since `sinceMs`, and a
11877
- * consumer that wants a rate differences two reads. A draining read would
11878
- * make two operators with the page open each destroy half of the other's
11879
- * numbers, and `load-contribution` already settled the same question the
11880
- * same way for `cpuSeconds`.
11881
- */
11882
- list: require_sleep.method(zod.z.void(), zod.z.array(FailureContributionSchema).readonly()) },
11883
- /** In-process only — enumerated through `addons.listCapabilityProviders`. */
11884
- mount: { kind: "skip" }
11885
- };
11886
- //#endregion
11887
11776
  //#region src/capabilities/load-contribution.cap.ts
11888
11777
  /**
11889
11778
  * `load-contribution` — the capability an addon reports its OWN cost through,
@@ -12044,6 +11933,117 @@ list: require_sleep.method(zod.z.void(), zod.z.array(LoadContributionSchema).rea
12044
11933
  mount: { kind: "skip" }
12045
11934
  };
12046
11935
  //#endregion
11936
+ //#region src/capabilities/log-channels.cap.ts
11937
+ /**
11938
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
11939
+ * through. It stores nothing.
11940
+ *
11941
+ * ## Why a capability at all, and why this shape
11942
+ *
11943
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
11944
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
11945
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
11946
+ * fails, an operator just never sees the channel somebody added. So the list
11947
+ * is assembled from declarations at runtime.
11948
+ *
11949
+ * The shape is copied from `log-destination.cap.ts`, which already does
11950
+ * exactly this job: `mode: 'collection'`, `internal: true`,
11951
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
11952
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
11953
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
11954
+ * runner's declarations reach hub-main over the transport that already exists.
11955
+ * No new UDS message, no second registry.
11956
+ *
11957
+ * ## What it deliberately does NOT own
11958
+ *
11959
+ * The VALUES — which channel is armed, for which cameras, until when — live in
11960
+ * ONE place: the logging settings document on the `system` cap
11961
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
11962
+ * value is the defect the plan behind this work exists to remove, and
11963
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
11964
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
11965
+ * setter for a window and no persistence of any kind.
11966
+ *
11967
+ * ## Why `apply` is here even so
11968
+ *
11969
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
11970
+ * seam has to carry the value from the authority to the mirror, and a channel
11971
+ * that cannot be reached is precisely the dead knob this whole slice exists to
11972
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
11973
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
11974
+ * persists nothing, it is never the source of a value, and it is called only
11975
+ * with a set the hub actually read (D49 — a read that fails does not call it
11976
+ * at all, so no channel is silently disarmed by a bad read).
11977
+ */
11978
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
11979
+ var LogChannelApplyResultSchema = zod.z.object({
11980
+ /** How many declared channels are armed in this process after the call. */
11981
+ armed: zod.z.number().int().min(0),
11982
+ /**
11983
+ * Names the document armed that this process does not declare. Reported
11984
+ * rather than swallowed: a name here is either a typo or an addon that has
11985
+ * not booted, and both deserve a line instead of silence.
11986
+ */
11987
+ unknown: zod.z.array(zod.z.string()).readonly()
11988
+ });
11989
+ var logChannelsCapability = {
11990
+ name: "log-channels",
11991
+ scope: "system",
11992
+ mode: "collection",
11993
+ internal: true,
11994
+ methods: {
11995
+ /** The channels this addon declares. Inert: no value, no state. */
11996
+ list: require_sleep.method(zod.z.void(), zod.z.array(LogChannelDescriptorSchema).readonly()),
11997
+ /**
11998
+ * Refresh this process's mirror from the document's FULL set of armed
11999
+ * windows.
12000
+ *
12001
+ * Full and not incremental on purpose: the document is the authority, so a
12002
+ * channel it does not name is disarmed here. An incremental apply would
12003
+ * let a disarm get lost in transit and leave a channel running that
12004
+ * nobody can see is running.
12005
+ */
12006
+ apply: require_sleep.method(zod.z.object({ windows: zod.z.array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" })
12007
+ },
12008
+ /** In-process only — enumerated through `addons.listCapabilityProviders`. */
12009
+ mount: { kind: "skip" }
12010
+ };
12011
+ //#endregion
12012
+ //#region src/capabilities/log-destination.cap.ts
12013
+ var LogLevelSchema = zod.z.enum([
12014
+ "debug",
12015
+ "info",
12016
+ "warn",
12017
+ "error"
12018
+ ]);
12019
+ var LogEntrySchema = zod.z.object({
12020
+ timestamp: zod.z.date(),
12021
+ level: LogLevelSchema,
12022
+ scope: zod.z.array(zod.z.string()),
12023
+ message: zod.z.string(),
12024
+ meta: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
12025
+ tags: zod.z.record(zod.z.string(), zod.z.string()).optional()
12026
+ });
12027
+ var logDestinationCapability = {
12028
+ name: "log-destination",
12029
+ scope: "system",
12030
+ mode: "collection",
12031
+ internal: true,
12032
+ methods: {
12033
+ write: require_sleep.method(LogEntrySchema, zod.z.void(), { kind: "mutation" }),
12034
+ query: require_sleep.method(zod.z.object({
12035
+ scope: zod.z.array(zod.z.string()).optional(),
12036
+ level: LogLevelSchema.optional(),
12037
+ since: zod.z.date().optional(),
12038
+ until: zod.z.date().optional(),
12039
+ limit: zod.z.number().optional(),
12040
+ tags: zod.z.record(zod.z.string(), zod.z.string()).optional()
12041
+ }), zod.z.array(LogEntrySchema).readonly())
12042
+ },
12043
+ /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
12044
+ mount: { kind: "skip" }
12045
+ };
12046
+ //#endregion
12047
12047
  //#region src/capabilities/login-method.cap.ts
12048
12048
  /**
12049
12049
  * `login-method` — collection cap through which auth addons contribute
@@ -18248,14 +18248,65 @@ var MediaFileKindEnum = zod.z.enum([
18248
18248
  "keyFrameSmall",
18249
18249
  "thumbnailSmall"
18250
18250
  ]);
18251
- var MediaFileSchema = zod.z.object({
18251
+ /**
18252
+ * One media row's IDENTITY and shape, with no representation of its bytes.
18253
+ *
18254
+ * This is the half of a media row that is cheap: it comes out of the index
18255
+ * without opening a blob, and it is everything a client needs to decide what
18256
+ * to render before it renders anything. Both wire shapes below are this plus
18257
+ * an address; the STORE's own read-back shape ({@link MediaFileBytes}) is this
18258
+ * plus the bytes.
18259
+ */
18260
+ var MediaFileRefSchema = zod.z.object({
18252
18261
  key: zod.z.string(),
18253
18262
  kind: MediaFileKindEnum,
18254
- base64: zod.z.string(),
18255
18263
  sizeBytes: zod.z.number(),
18256
18264
  timestamp: zod.z.number()
18257
18265
  });
18258
18266
  /**
18267
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18268
+ * ARE — never the bytes themselves.
18269
+ *
18270
+ * ## Why `url` and not `base64`
18271
+ *
18272
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18273
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18274
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18275
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18276
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18277
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18278
+ *
18279
+ * `url` points at the `event-media` data plane
18280
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18281
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18282
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18283
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18284
+ * no less protected than they were inside a `view`-level cap response — see
18285
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18286
+ * (per-device scoping).
18287
+ *
18288
+ * The URL is built from the row's **stored** key, which is not always its
18289
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18290
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18291
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18292
+ *
18293
+ * ## `base64` is TRANSITIONAL and is going away
18294
+ *
18295
+ * It is still populated for one reason: the deployed viewer's track-detail
18296
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18297
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18298
+ * triangle — not as absence. Removing the field before that viewer ships is an
18299
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18300
+ * delete this line and the `withBytes` pass-through in
18301
+ * `analytics-query-facade.ts`; nothing else reads it.
18302
+ */
18303
+ var MediaFileSchema = MediaFileRefSchema.extend({
18304
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18305
+ url: zod.z.string(),
18306
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18307
+ base64: zod.z.string()
18308
+ });
18309
+ /**
18259
18310
  * One media row WITHOUT its bytes.
18260
18311
  *
18261
18312
  * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
@@ -18265,7 +18316,9 @@ var MediaFileSchema = zod.z.object({
18265
18316
  * blocks the whole view.
18266
18317
  *
18267
18318
  * `sizeBytes` is carried because it is what lets a client decide between the
18268
- * stored blob and a `?variant=thumb` rendering without fetching either.
18319
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18320
+ * `url` because a client that had to build the plane path itself is a second
18321
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18269
18322
  */
18270
18323
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18271
18324
  /**
@@ -19398,6 +19451,26 @@ var pipelineAnalyticsCapability = {
19398
19451
  deviceId: zod.z.number()
19399
19452
  }), zod.z.array(MediaFileInfoSchema).readonly()),
19400
19453
  /**
19454
+ * What media an EVENT has, without any of it — the twin `getEventMedia`
19455
+ * never had.
19456
+ *
19457
+ * `listTrackMedia` above got this treatment because a track's media is
19458
+ * 5-8 MB. An event's is worse per row, not better: an old-style event owns
19459
+ * a `crop` AND a native-resolution `fullFrameBoxed`, and the track DETAIL
19460
+ * modal — the one surface that legitimately shows the big kinds — unions
19461
+ * both listings to build its filmstrip. It then renders every tile from
19462
+ * the `event-media` plane by key and throws the bytes away. Measured on
19463
+ * the live hub: one event's `fullFrameBoxed` is 2 824 077 B, base64'd to
19464
+ * ~3.8 MB, allocated whole in hub-main's heap, for a list of keys.
19465
+ *
19466
+ * Same `deviceId` authorization subject as `getEventMedia`, and the same
19467
+ * rows — this is a projection of that method, never a different question.
19468
+ */
19469
+ listEventMedia: require_sleep.method(zod.z.object({
19470
+ eventId: zod.z.string(),
19471
+ deviceId: zod.z.number()
19472
+ }), zod.z.array(MediaFileInfoSchema).readonly()),
19473
+ /**
19401
19474
  * Search object events by text query using CLIP cosine similarity.
19402
19475
  * Encodes `text` via the `embedding-encoder` cap, queries the
19403
19476
  * `ObjectEmbeddingStore` with optional prefilters, ranks all matching
@@ -26223,10 +26296,24 @@ var FaceClusterSchema = zod.z.object({
26223
26296
  size: zod.z.number().int(),
26224
26297
  cohesion: zod.z.number()
26225
26298
  });
26299
+ /**
26300
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
26301
+ * are — never the bytes.
26302
+ *
26303
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
26304
+ * track/event contract) is still populated because a deployed viewer requires
26305
+ * the field to parse a row at all; this method has no such reader. Its ONE
26306
+ * caller is the admin UI's detail modal, which was building
26307
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
26308
+ * dialog already rendering its key FRAME from the `event-media` plane.
26309
+ *
26310
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
26311
+ * media key directly, so this needed no new plane and no new access decision.
26312
+ */
26226
26313
  var MediaFileLiteSchema$1 = zod.z.object({
26227
26314
  key: zod.z.string(),
26228
26315
  kind: zod.z.string(),
26229
- base64: zod.z.string(),
26316
+ url: zod.z.string(),
26230
26317
  sizeBytes: zod.z.number(),
26231
26318
  timestamp: zod.z.number()
26232
26319
  });
@@ -29724,10 +29811,24 @@ var PlateInfoSchema = zod.z.object({
29724
29811
  */
29725
29812
  cropUrl: zod.z.string().optional()
29726
29813
  });
29814
+ /**
29815
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
29816
+ * are — never the bytes.
29817
+ *
29818
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
29819
+ * track/event contract) is still populated because a deployed viewer requires
29820
+ * the field to parse a row at all; this method has no such reader. Its ONE
29821
+ * caller is the admin UI's detail modal, which was building
29822
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
29823
+ * dialog already rendering its key FRAME from the `event-media` plane.
29824
+ *
29825
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
29826
+ * media key directly, so this needed no new plane and no new access decision.
29827
+ */
29727
29828
  var MediaFileLiteSchema = zod.z.object({
29728
29829
  key: zod.z.string(),
29729
29830
  kind: zod.z.string(),
29730
- base64: zod.z.string(),
29831
+ url: zod.z.string(),
29731
29832
  sizeBytes: zod.z.number(),
29732
29833
  timestamp: zod.z.number()
29733
29834
  });
@@ -41516,6 +41617,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
41516
41617
  addonId: null,
41517
41618
  access: "view"
41518
41619
  },
41620
+ "pipelineAnalytics.listEventMedia": {
41621
+ capName: "pipeline-analytics",
41622
+ capScope: "device",
41623
+ addonId: null,
41624
+ access: "view"
41625
+ },
41519
41626
  "pipelineAnalytics.listGroups": {
41520
41627
  capName: "pipeline-analytics",
41521
41628
  capScope: "device",
@@ -45402,6 +45509,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
45402
45509
  form: "array",
45403
45510
  optional: false
45404
45511
  }],
45512
+ "pipelineAnalytics.listEventMedia": [{
45513
+ name: "deviceId",
45514
+ form: "single",
45515
+ optional: false
45516
+ }],
45405
45517
  "pipelineAnalytics.listGroups": [{
45406
45518
  name: "deviceIds",
45407
45519
  form: "array",
@@ -51779,6 +51891,7 @@ exports.MaskRectShapeSchema = MaskRectShapeSchema;
51779
51891
  exports.MaskShapeKindSchema = MaskShapeKindSchema;
51780
51892
  exports.MaskShapeSchema = MaskShapeSchema;
51781
51893
  exports.MediaFileInfoSchema = MediaFileInfoSchema;
51894
+ exports.MediaFileRefSchema = MediaFileRefSchema;
51782
51895
  exports.MediaFileSchema = MediaFileSchema;
51783
51896
  exports.MediaPlayerRepeatSchema = MediaPlayerRepeatSchema;
51784
51897
  exports.MediaPlayerStateSchema = MediaPlayerStateSchema;