@camstack/addon-mqtt-broker 1.2.46 → 1.2.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mqtt-broker.addon.js +259 -174
- package/dist/mqtt-broker.addon.mjs +259 -174
- package/package.json +1 -1
|
@@ -12998,6 +12998,114 @@ method(object({
|
|
|
12998
12998
|
height: number()
|
|
12999
12999
|
}), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
|
|
13000
13000
|
/**
|
|
13001
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
13002
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
13003
|
+
*
|
|
13004
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
13005
|
+
*
|
|
13006
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
13007
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
13008
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
13009
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
13010
|
+
* somebody to forget to edit.
|
|
13011
|
+
*
|
|
13012
|
+
* They are not merged, because their invariants are opposites:
|
|
13013
|
+
*
|
|
13014
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
13015
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
13016
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
13017
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
13018
|
+
* and it is exactly what an absent entry cannot say.
|
|
13019
|
+
*
|
|
13020
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
13021
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
13022
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
13023
|
+
* has no process.
|
|
13024
|
+
*
|
|
13025
|
+
* ## Why not a log line, since the counters already exist
|
|
13026
|
+
*
|
|
13027
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
13028
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
13029
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
13030
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
13031
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
13032
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
13033
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
13034
|
+
* be READ.
|
|
13035
|
+
*
|
|
13036
|
+
* ## The rate is served with its denominator or not at all
|
|
13037
|
+
*
|
|
13038
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
13039
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
13040
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
13041
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
13042
|
+
* reproduces that mistake on every read.
|
|
13043
|
+
*
|
|
13044
|
+
* ## Shape
|
|
13045
|
+
*
|
|
13046
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
13047
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
13048
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
13049
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
13050
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
13051
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
13052
|
+
* result through `system.getFailureContributions`.
|
|
13053
|
+
*/
|
|
13054
|
+
var FailureReasonCountSchema = object({
|
|
13055
|
+
/**
|
|
13056
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
13057
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
13058
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
13059
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
13060
|
+
* vocabulary for the same loss would make the row and the counter
|
|
13061
|
+
* un-joinable.
|
|
13062
|
+
*/
|
|
13063
|
+
reason: string(),
|
|
13064
|
+
count: number().int().nonnegative()
|
|
13065
|
+
});
|
|
13066
|
+
var FailureContributionSchema = object({
|
|
13067
|
+
/**
|
|
13068
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
13069
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
13070
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
13071
|
+
* is a central list that rots invisibly.
|
|
13072
|
+
*/
|
|
13073
|
+
family: string(),
|
|
13074
|
+
/**
|
|
13075
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
13076
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
13077
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
13078
|
+
* cannot answer the only question anybody asks of this surface.
|
|
13079
|
+
*/
|
|
13080
|
+
deviceId: number().int().positive(),
|
|
13081
|
+
/**
|
|
13082
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
13083
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
13084
|
+
* family has a single variant.
|
|
13085
|
+
*/
|
|
13086
|
+
variant: string().optional(),
|
|
13087
|
+
/**
|
|
13088
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
13089
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
13090
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
13091
|
+
* `LoadContribution.startedAtMs`.
|
|
13092
|
+
*/
|
|
13093
|
+
sinceMs: number(),
|
|
13094
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
13095
|
+
atMs: number(),
|
|
13096
|
+
/**
|
|
13097
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
13098
|
+
* window. A failure count published without it is the mistake this schema
|
|
13099
|
+
* exists to make impossible.
|
|
13100
|
+
*/
|
|
13101
|
+
attempts: number().int().nonnegative(),
|
|
13102
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
13103
|
+
succeeded: number().int().nonnegative(),
|
|
13104
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
13105
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
13106
|
+
});
|
|
13107
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
13108
|
+
/**
|
|
13001
13109
|
* filesystem-browse — per-node capability for browsing the node's local
|
|
13002
13110
|
* filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
|
|
13003
13111
|
* are sandboxed to operator-configured allowed roots (D115). Used by the
|
|
@@ -13519,6 +13627,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
|
|
|
13519
13627
|
kind: "mutation",
|
|
13520
13628
|
auth: "admin"
|
|
13521
13629
|
});
|
|
13630
|
+
var LoadContributionSchema = object({
|
|
13631
|
+
role: _enum([
|
|
13632
|
+
"decode",
|
|
13633
|
+
"transcode",
|
|
13634
|
+
"recording",
|
|
13635
|
+
"streaming",
|
|
13636
|
+
"detection"
|
|
13637
|
+
]),
|
|
13638
|
+
/**
|
|
13639
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
13640
|
+
* `tags.deviceId`. `null` means this cost genuinely belongs to no single
|
|
13641
|
+
* camera (a shared pool), NOT that the contributor forgot to look it up: a
|
|
13642
|
+
* contributor that cannot name its camera must not emit the entry at all,
|
|
13643
|
+
* because an unnamed per-camera entry is indistinguishable from a shared one
|
|
13644
|
+
* and would quietly turn one camera's cost into everybody's.
|
|
13645
|
+
*/
|
|
13646
|
+
deviceId: number().int().positive().nullable(),
|
|
13647
|
+
attribution: _enum([
|
|
13648
|
+
"measured",
|
|
13649
|
+
"accounted",
|
|
13650
|
+
"unattributable"
|
|
13651
|
+
]),
|
|
13652
|
+
/**
|
|
13653
|
+
* What ONE entry is, in the contributor's own words — `615/high`,
|
|
13654
|
+
* `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
|
|
13655
|
+
* family and inventing a common one would lose the only information that
|
|
13656
|
+
* makes two entries for the same camera distinguishable.
|
|
13657
|
+
*/
|
|
13658
|
+
unit: string(),
|
|
13659
|
+
/**
|
|
13660
|
+
* The OS process this cost lives in, when there is one. Present so a
|
|
13661
|
+
* consumer can (a) tell two generations of the same unit apart across a
|
|
13662
|
+
* restart, and (b) subtract claimed processes from the node's process
|
|
13663
|
+
* snapshot to see what NOBODY claimed. Absent for an entry that owns no
|
|
13664
|
+
* process of its own.
|
|
13665
|
+
*/
|
|
13666
|
+
pid: number().int().positive().optional(),
|
|
13667
|
+
/**
|
|
13668
|
+
* When this generation started. The pid's incarnation marker: a consumer
|
|
13669
|
+
* differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
|
|
13670
|
+
* window when this changes, because the counter restarted from zero in a new
|
|
13671
|
+
* process.
|
|
13672
|
+
*/
|
|
13673
|
+
startedAtMs: number().optional(),
|
|
13674
|
+
/**
|
|
13675
|
+
* CUMULATIVE CPU seconds this unit has consumed since it started — user +
|
|
13676
|
+
* system, read from the child's own `/proc/<pid>/stat` at the moment the
|
|
13677
|
+
* contribution is asked for.
|
|
13678
|
+
*
|
|
13679
|
+
* Cumulative and not a rate on purpose: a rate needs a window, a window
|
|
13680
|
+
* needs a sampler, and a new per-node sampler is the defect half of
|
|
13681
|
+
* `docs/architecture/load-ledger.md` documents. A counter can be differenced
|
|
13682
|
+
* by whoever already keeps a history; a rate cannot be un-averaged.
|
|
13683
|
+
*
|
|
13684
|
+
* Absent — never zero — on a node with no `/proc`, on a read failure, and on
|
|
13685
|
+
* an entry with no process.
|
|
13686
|
+
*/
|
|
13687
|
+
cpuSeconds: number().optional(),
|
|
13688
|
+
/** Resident bytes of this unit's process, same source and same rules. */
|
|
13689
|
+
rssBytes: number().optional()
|
|
13690
|
+
});
|
|
13691
|
+
method(_void(), array(LoadContributionSchema).readonly());
|
|
13522
13692
|
/**
|
|
13523
13693
|
* `log-channels` — the capability an addon DECLARES its diagnostic channels
|
|
13524
13694
|
* through. It stores nothing.
|
|
@@ -13595,176 +13765,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
13595
13765
|
tags: record(string(), string()).optional()
|
|
13596
13766
|
}), array(LogEntrySchema).readonly());
|
|
13597
13767
|
/**
|
|
13598
|
-
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
13599
|
-
* through, per camera, with the denominator attached. It stores nothing.
|
|
13600
|
-
*
|
|
13601
|
-
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
13602
|
-
*
|
|
13603
|
-
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
13604
|
-
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
13605
|
-
* copied: the contributor reports what it already knows, hub-main adds only
|
|
13606
|
-
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
13607
|
-
* somebody to forget to edit.
|
|
13608
|
-
*
|
|
13609
|
-
* They are not merged, because their invariants are opposites:
|
|
13610
|
-
*
|
|
13611
|
-
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
13612
|
-
* claim a camera cost nothing, which is a measurement nobody made;
|
|
13613
|
-
* - a `failure-contribution` zero is the **most valuable value on the
|
|
13614
|
-
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
13615
|
-
* and it is exactly what an absent entry cannot say.
|
|
13616
|
-
*
|
|
13617
|
-
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
13618
|
-
* that gives `load-contribution` its point: contributions are subtracted from
|
|
13619
|
-
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
13620
|
-
* has no process.
|
|
13621
|
-
*
|
|
13622
|
-
* ## Why not a log line, since the counters already exist
|
|
13623
|
-
*
|
|
13624
|
-
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
13625
|
-
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
13626
|
-
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
13627
|
-
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
13628
|
-
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
13629
|
-
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
13630
|
-
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
13631
|
-
* be READ.
|
|
13632
|
-
*
|
|
13633
|
-
* ## The rate is served with its denominator or not at all
|
|
13634
|
-
*
|
|
13635
|
-
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
13636
|
-
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
13637
|
-
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
13638
|
-
* successes on the same path. A surface that publishes only the numerator
|
|
13639
|
-
* reproduces that mistake on every read.
|
|
13640
|
-
*
|
|
13641
|
-
* ## Shape
|
|
13642
|
-
*
|
|
13643
|
-
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
13644
|
-
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
13645
|
-
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
13646
|
-
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
13647
|
-
* a forked runner's entries reach hub-main over transport that already exists.
|
|
13648
|
-
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
13649
|
-
* result through `system.getFailureContributions`.
|
|
13650
|
-
*/
|
|
13651
|
-
var FailureReasonCountSchema = object({
|
|
13652
|
-
/**
|
|
13653
|
-
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
13654
|
-
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
13655
|
-
* strings that already appear in this repo's logs and, where one exists, the
|
|
13656
|
-
* same string the per-track `previewMissReason` records (D276): a second
|
|
13657
|
-
* vocabulary for the same loss would make the row and the counter
|
|
13658
|
-
* un-joinable.
|
|
13659
|
-
*/
|
|
13660
|
-
reason: string(),
|
|
13661
|
-
count: number().int().nonnegative()
|
|
13662
|
-
});
|
|
13663
|
-
var FailureContributionSchema = object({
|
|
13664
|
-
/**
|
|
13665
|
-
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
13666
|
-
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
13667
|
-
* `unit` free: the families are owned by different addons and a shared enum
|
|
13668
|
-
* is a central list that rots invisibly.
|
|
13669
|
-
*/
|
|
13670
|
-
family: string(),
|
|
13671
|
-
/**
|
|
13672
|
-
* The NUMERIC device id — the same value every log line carries as
|
|
13673
|
-
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
13674
|
-
* cannot name the camera must not emit the entry, because a fleet total
|
|
13675
|
-
* cannot answer the only question anybody asks of this surface.
|
|
13676
|
-
*/
|
|
13677
|
-
deviceId: number().int().positive(),
|
|
13678
|
-
/**
|
|
13679
|
-
* A second dimension inside the family: the model / step id for an inference
|
|
13680
|
-
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
13681
|
-
* family has a single variant.
|
|
13682
|
-
*/
|
|
13683
|
-
variant: string().optional(),
|
|
13684
|
-
/**
|
|
13685
|
-
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
13686
|
-
* differencing two reads must drop the interval when it changes, because the
|
|
13687
|
-
* counter restarted from zero in a respawned runner. Same discipline as
|
|
13688
|
-
* `LoadContribution.startedAtMs`.
|
|
13689
|
-
*/
|
|
13690
|
-
sinceMs: number(),
|
|
13691
|
-
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
13692
|
-
atMs: number(),
|
|
13693
|
-
/**
|
|
13694
|
-
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
13695
|
-
* window. A failure count published without it is the mistake this schema
|
|
13696
|
-
* exists to make impossible.
|
|
13697
|
-
*/
|
|
13698
|
-
attempts: number().int().nonnegative(),
|
|
13699
|
-
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
13700
|
-
succeeded: number().int().nonnegative(),
|
|
13701
|
-
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
13702
|
-
reasons: array(FailureReasonCountSchema).readonly()
|
|
13703
|
-
});
|
|
13704
|
-
method(_void(), array(FailureContributionSchema).readonly());
|
|
13705
|
-
var LoadContributionSchema = object({
|
|
13706
|
-
role: _enum([
|
|
13707
|
-
"decode",
|
|
13708
|
-
"transcode",
|
|
13709
|
-
"recording",
|
|
13710
|
-
"streaming",
|
|
13711
|
-
"detection"
|
|
13712
|
-
]),
|
|
13713
|
-
/**
|
|
13714
|
-
* The NUMERIC device id — the same value every log line carries as
|
|
13715
|
-
* `tags.deviceId`. `null` means this cost genuinely belongs to no single
|
|
13716
|
-
* camera (a shared pool), NOT that the contributor forgot to look it up: a
|
|
13717
|
-
* contributor that cannot name its camera must not emit the entry at all,
|
|
13718
|
-
* because an unnamed per-camera entry is indistinguishable from a shared one
|
|
13719
|
-
* and would quietly turn one camera's cost into everybody's.
|
|
13720
|
-
*/
|
|
13721
|
-
deviceId: number().int().positive().nullable(),
|
|
13722
|
-
attribution: _enum([
|
|
13723
|
-
"measured",
|
|
13724
|
-
"accounted",
|
|
13725
|
-
"unattributable"
|
|
13726
|
-
]),
|
|
13727
|
-
/**
|
|
13728
|
-
* What ONE entry is, in the contributor's own words — `615/high`,
|
|
13729
|
-
* `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
|
|
13730
|
-
* family and inventing a common one would lose the only information that
|
|
13731
|
-
* makes two entries for the same camera distinguishable.
|
|
13732
|
-
*/
|
|
13733
|
-
unit: string(),
|
|
13734
|
-
/**
|
|
13735
|
-
* The OS process this cost lives in, when there is one. Present so a
|
|
13736
|
-
* consumer can (a) tell two generations of the same unit apart across a
|
|
13737
|
-
* restart, and (b) subtract claimed processes from the node's process
|
|
13738
|
-
* snapshot to see what NOBODY claimed. Absent for an entry that owns no
|
|
13739
|
-
* process of its own.
|
|
13740
|
-
*/
|
|
13741
|
-
pid: number().int().positive().optional(),
|
|
13742
|
-
/**
|
|
13743
|
-
* When this generation started. The pid's incarnation marker: a consumer
|
|
13744
|
-
* differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
|
|
13745
|
-
* window when this changes, because the counter restarted from zero in a new
|
|
13746
|
-
* process.
|
|
13747
|
-
*/
|
|
13748
|
-
startedAtMs: number().optional(),
|
|
13749
|
-
/**
|
|
13750
|
-
* CUMULATIVE CPU seconds this unit has consumed since it started — user +
|
|
13751
|
-
* system, read from the child's own `/proc/<pid>/stat` at the moment the
|
|
13752
|
-
* contribution is asked for.
|
|
13753
|
-
*
|
|
13754
|
-
* Cumulative and not a rate on purpose: a rate needs a window, a window
|
|
13755
|
-
* needs a sampler, and a new per-node sampler is the defect half of
|
|
13756
|
-
* `docs/architecture/load-ledger.md` documents. A counter can be differenced
|
|
13757
|
-
* by whoever already keeps a history; a rate cannot be un-averaged.
|
|
13758
|
-
*
|
|
13759
|
-
* Absent — never zero — on a node with no `/proc`, on a read failure, and on
|
|
13760
|
-
* an entry with no process.
|
|
13761
|
-
*/
|
|
13762
|
-
cpuSeconds: number().optional(),
|
|
13763
|
-
/** Resident bytes of this unit's process, same source and same rules. */
|
|
13764
|
-
rssBytes: number().optional()
|
|
13765
|
-
});
|
|
13766
|
-
method(_void(), array(LoadContributionSchema).readonly());
|
|
13767
|
-
/**
|
|
13768
13768
|
* `login-method` — collection cap through which auth addons contribute
|
|
13769
13769
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
13770
13770
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
@@ -18443,12 +18443,53 @@ var MediaFileKindEnum = _enum([
|
|
|
18443
18443
|
"keyFrameSmall",
|
|
18444
18444
|
"thumbnailSmall"
|
|
18445
18445
|
]);
|
|
18446
|
+
/**
|
|
18447
|
+
* One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
|
|
18448
|
+
* ARE — never the bytes themselves.
|
|
18449
|
+
*
|
|
18450
|
+
* ## Why `url` and not `base64`
|
|
18451
|
+
*
|
|
18452
|
+
* Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
|
|
18453
|
+
* with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
|
|
18454
|
+
* was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
|
|
18455
|
+
* wire. Forty events is ~144 MB. Every byte of it was read off disk,
|
|
18456
|
+
* base64-encoded, held whole in a unary tRPC envelope, and materialised in
|
|
18457
|
+
* hub-main's heap on the way past — for an `<img>` that would have cached it.
|
|
18458
|
+
*
|
|
18459
|
+
* `url` points at the `event-media` data plane
|
|
18460
|
+
* (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
|
|
18461
|
+
* with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
|
|
18462
|
+
* render a `?variant=thumb`, and streams. The hub gate in front of it requires
|
|
18463
|
+
* a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
|
|
18464
|
+
* no less protected than they were inside a `view`-level cap response — see
|
|
18465
|
+
* `data-plane-access.ts` for the rule and the one gap it does not close
|
|
18466
|
+
* (per-device scoping).
|
|
18467
|
+
*
|
|
18468
|
+
* The URL is built from the row's **stored** key, which is not always its
|
|
18469
|
+
* published `kind`: a track's face/plate crop is stored as `crop` under
|
|
18470
|
+
* `('face'|'plate', '<prefix>-<trackId>')` and published as
|
|
18471
|
+
* `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
|
|
18472
|
+
*
|
|
18473
|
+
* ## `base64` is TRANSITIONAL and is going away
|
|
18474
|
+
*
|
|
18475
|
+
* It is still populated for one reason: the deployed viewer's track-detail
|
|
18476
|
+
* HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
|
|
18477
|
+
* REQUIRES the field), and a row without it parses as a FAILED read — the red
|
|
18478
|
+
* triangle — not as absence. Removing the field before that viewer ships is an
|
|
18479
|
+
* outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
|
|
18480
|
+
* delete this line and the `withBytes` pass-through in
|
|
18481
|
+
* `analytics-query-facade.ts`; nothing else reads it.
|
|
18482
|
+
*/
|
|
18446
18483
|
var MediaFileSchema = object({
|
|
18447
18484
|
key: string(),
|
|
18448
18485
|
kind: MediaFileKindEnum,
|
|
18449
|
-
base64: string(),
|
|
18450
18486
|
sizeBytes: number(),
|
|
18451
18487
|
timestamp: number()
|
|
18488
|
+
}).extend({
|
|
18489
|
+
/** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
|
|
18490
|
+
url: string(),
|
|
18491
|
+
/** @deprecated Transitional — see the schema docblock. Use {@link url}. */
|
|
18492
|
+
base64: string()
|
|
18452
18493
|
});
|
|
18453
18494
|
/**
|
|
18454
18495
|
* One media row WITHOUT its bytes.
|
|
@@ -18460,7 +18501,9 @@ var MediaFileSchema = object({
|
|
|
18460
18501
|
* blocks the whole view.
|
|
18461
18502
|
*
|
|
18462
18503
|
* `sizeBytes` is carried because it is what lets a client decide between the
|
|
18463
|
-
* stored blob and a `?variant=thumb` rendering without fetching either
|
|
18504
|
+
* stored blob and a `?variant=thumb` rendering without fetching either, and
|
|
18505
|
+
* `url` because a client that had to build the plane path itself is a second
|
|
18506
|
+
* copy of a route — the embed, the viewer and the admin UI each grew one.
|
|
18464
18507
|
*/
|
|
18465
18508
|
var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
|
|
18466
18509
|
/**
|
|
@@ -19149,6 +19192,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
19149
19192
|
}), array(MediaFileSchema).readonly()), method(object({
|
|
19150
19193
|
trackId: string(),
|
|
19151
19194
|
deviceId: number()
|
|
19195
|
+
}), array(MediaFileInfoSchema).readonly()), method(object({
|
|
19196
|
+
eventId: string(),
|
|
19197
|
+
deviceId: number()
|
|
19152
19198
|
}), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
19153
19199
|
kind: "mutation",
|
|
19154
19200
|
auth: "admin"
|
|
@@ -23409,10 +23455,24 @@ var FaceClusterSchema = object({
|
|
|
23409
23455
|
size: number().int(),
|
|
23410
23456
|
cohesion: number()
|
|
23411
23457
|
});
|
|
23458
|
+
/**
|
|
23459
|
+
* One gallery media row: what the crop is, how big it is, and WHERE its bytes
|
|
23460
|
+
* are — never the bytes.
|
|
23461
|
+
*
|
|
23462
|
+
* `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
|
|
23463
|
+
* track/event contract) is still populated because a deployed viewer requires
|
|
23464
|
+
* the field to parse a row at all; this method has no such reader. Its ONE
|
|
23465
|
+
* caller is the admin UI's detail modal, which was building
|
|
23466
|
+
* `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
|
|
23467
|
+
* dialog already rendering its key FRAME from the `event-media` plane.
|
|
23468
|
+
*
|
|
23469
|
+
* `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
|
|
23470
|
+
* media key directly, so this needed no new plane and no new access decision.
|
|
23471
|
+
*/
|
|
23412
23472
|
var MediaFileLiteSchema$1 = object({
|
|
23413
23473
|
key: string(),
|
|
23414
23474
|
kind: string(),
|
|
23415
|
-
|
|
23475
|
+
url: string(),
|
|
23416
23476
|
sizeBytes: number(),
|
|
23417
23477
|
timestamp: number()
|
|
23418
23478
|
});
|
|
@@ -25664,10 +25724,24 @@ var PlateInfoSchema = object({
|
|
|
25664
25724
|
*/
|
|
25665
25725
|
cropUrl: string().optional()
|
|
25666
25726
|
});
|
|
25727
|
+
/**
|
|
25728
|
+
* One gallery media row: what the crop is, how big it is, and WHERE its bytes
|
|
25729
|
+
* are — never the bytes.
|
|
25730
|
+
*
|
|
25731
|
+
* `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
|
|
25732
|
+
* track/event contract) is still populated because a deployed viewer requires
|
|
25733
|
+
* the field to parse a row at all; this method has no such reader. Its ONE
|
|
25734
|
+
* caller is the admin UI's detail modal, which was building
|
|
25735
|
+
* `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
|
|
25736
|
+
* dialog already rendering its key FRAME from the `event-media` plane.
|
|
25737
|
+
*
|
|
25738
|
+
* `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
|
|
25739
|
+
* media key directly, so this needed no new plane and no new access decision.
|
|
25740
|
+
*/
|
|
25667
25741
|
var MediaFileLiteSchema = object({
|
|
25668
25742
|
key: string(),
|
|
25669
25743
|
kind: string(),
|
|
25670
|
-
|
|
25744
|
+
url: string(),
|
|
25671
25745
|
sizeBytes: number(),
|
|
25672
25746
|
timestamp: number()
|
|
25673
25747
|
});
|
|
@@ -31680,6 +31754,12 @@ Object.freeze({
|
|
|
31680
31754
|
addonId: null,
|
|
31681
31755
|
access: "view"
|
|
31682
31756
|
},
|
|
31757
|
+
"pipelineAnalytics.listEventMedia": {
|
|
31758
|
+
capName: "pipeline-analytics",
|
|
31759
|
+
capScope: "device",
|
|
31760
|
+
addonId: null,
|
|
31761
|
+
access: "view"
|
|
31762
|
+
},
|
|
31683
31763
|
"pipelineAnalytics.listGroups": {
|
|
31684
31764
|
capName: "pipeline-analytics",
|
|
31685
31765
|
capScope: "device",
|
|
@@ -35303,6 +35383,11 @@ Object.freeze({
|
|
|
35303
35383
|
form: "array",
|
|
35304
35384
|
optional: false
|
|
35305
35385
|
}],
|
|
35386
|
+
"pipelineAnalytics.listEventMedia": [{
|
|
35387
|
+
name: "deviceId",
|
|
35388
|
+
form: "single",
|
|
35389
|
+
optional: false
|
|
35390
|
+
}],
|
|
35306
35391
|
"pipelineAnalytics.listGroups": [{
|
|
35307
35392
|
name: "deviceIds",
|
|
35308
35393
|
form: "array",
|
|
@@ -12993,6 +12993,114 @@ method(object({
|
|
|
12993
12993
|
height: number()
|
|
12994
12994
|
}), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
|
|
12995
12995
|
/**
|
|
12996
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
12997
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
12998
|
+
*
|
|
12999
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
13000
|
+
*
|
|
13001
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
13002
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
13003
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
13004
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
13005
|
+
* somebody to forget to edit.
|
|
13006
|
+
*
|
|
13007
|
+
* They are not merged, because their invariants are opposites:
|
|
13008
|
+
*
|
|
13009
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
13010
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
13011
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
13012
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
13013
|
+
* and it is exactly what an absent entry cannot say.
|
|
13014
|
+
*
|
|
13015
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
13016
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
13017
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
13018
|
+
* has no process.
|
|
13019
|
+
*
|
|
13020
|
+
* ## Why not a log line, since the counters already exist
|
|
13021
|
+
*
|
|
13022
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
13023
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
13024
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
13025
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
13026
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
13027
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
13028
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
13029
|
+
* be READ.
|
|
13030
|
+
*
|
|
13031
|
+
* ## The rate is served with its denominator or not at all
|
|
13032
|
+
*
|
|
13033
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
13034
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
13035
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
13036
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
13037
|
+
* reproduces that mistake on every read.
|
|
13038
|
+
*
|
|
13039
|
+
* ## Shape
|
|
13040
|
+
*
|
|
13041
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
13042
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
13043
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
13044
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
13045
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
13046
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
13047
|
+
* result through `system.getFailureContributions`.
|
|
13048
|
+
*/
|
|
13049
|
+
var FailureReasonCountSchema = object({
|
|
13050
|
+
/**
|
|
13051
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
13052
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
13053
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
13054
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
13055
|
+
* vocabulary for the same loss would make the row and the counter
|
|
13056
|
+
* un-joinable.
|
|
13057
|
+
*/
|
|
13058
|
+
reason: string(),
|
|
13059
|
+
count: number().int().nonnegative()
|
|
13060
|
+
});
|
|
13061
|
+
var FailureContributionSchema = object({
|
|
13062
|
+
/**
|
|
13063
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
13064
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
13065
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
13066
|
+
* is a central list that rots invisibly.
|
|
13067
|
+
*/
|
|
13068
|
+
family: string(),
|
|
13069
|
+
/**
|
|
13070
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
13071
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
13072
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
13073
|
+
* cannot answer the only question anybody asks of this surface.
|
|
13074
|
+
*/
|
|
13075
|
+
deviceId: number().int().positive(),
|
|
13076
|
+
/**
|
|
13077
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
13078
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
13079
|
+
* family has a single variant.
|
|
13080
|
+
*/
|
|
13081
|
+
variant: string().optional(),
|
|
13082
|
+
/**
|
|
13083
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
13084
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
13085
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
13086
|
+
* `LoadContribution.startedAtMs`.
|
|
13087
|
+
*/
|
|
13088
|
+
sinceMs: number(),
|
|
13089
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
13090
|
+
atMs: number(),
|
|
13091
|
+
/**
|
|
13092
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
13093
|
+
* window. A failure count published without it is the mistake this schema
|
|
13094
|
+
* exists to make impossible.
|
|
13095
|
+
*/
|
|
13096
|
+
attempts: number().int().nonnegative(),
|
|
13097
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
13098
|
+
succeeded: number().int().nonnegative(),
|
|
13099
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
13100
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
13101
|
+
});
|
|
13102
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
13103
|
+
/**
|
|
12996
13104
|
* filesystem-browse — per-node capability for browsing the node's local
|
|
12997
13105
|
* filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
|
|
12998
13106
|
* are sandboxed to operator-configured allowed roots (D115). Used by the
|
|
@@ -13514,6 +13622,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
|
|
|
13514
13622
|
kind: "mutation",
|
|
13515
13623
|
auth: "admin"
|
|
13516
13624
|
});
|
|
13625
|
+
var LoadContributionSchema = object({
|
|
13626
|
+
role: _enum([
|
|
13627
|
+
"decode",
|
|
13628
|
+
"transcode",
|
|
13629
|
+
"recording",
|
|
13630
|
+
"streaming",
|
|
13631
|
+
"detection"
|
|
13632
|
+
]),
|
|
13633
|
+
/**
|
|
13634
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
13635
|
+
* `tags.deviceId`. `null` means this cost genuinely belongs to no single
|
|
13636
|
+
* camera (a shared pool), NOT that the contributor forgot to look it up: a
|
|
13637
|
+
* contributor that cannot name its camera must not emit the entry at all,
|
|
13638
|
+
* because an unnamed per-camera entry is indistinguishable from a shared one
|
|
13639
|
+
* and would quietly turn one camera's cost into everybody's.
|
|
13640
|
+
*/
|
|
13641
|
+
deviceId: number().int().positive().nullable(),
|
|
13642
|
+
attribution: _enum([
|
|
13643
|
+
"measured",
|
|
13644
|
+
"accounted",
|
|
13645
|
+
"unattributable"
|
|
13646
|
+
]),
|
|
13647
|
+
/**
|
|
13648
|
+
* What ONE entry is, in the contributor's own words — `615/high`,
|
|
13649
|
+
* `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
|
|
13650
|
+
* family and inventing a common one would lose the only information that
|
|
13651
|
+
* makes two entries for the same camera distinguishable.
|
|
13652
|
+
*/
|
|
13653
|
+
unit: string(),
|
|
13654
|
+
/**
|
|
13655
|
+
* The OS process this cost lives in, when there is one. Present so a
|
|
13656
|
+
* consumer can (a) tell two generations of the same unit apart across a
|
|
13657
|
+
* restart, and (b) subtract claimed processes from the node's process
|
|
13658
|
+
* snapshot to see what NOBODY claimed. Absent for an entry that owns no
|
|
13659
|
+
* process of its own.
|
|
13660
|
+
*/
|
|
13661
|
+
pid: number().int().positive().optional(),
|
|
13662
|
+
/**
|
|
13663
|
+
* When this generation started. The pid's incarnation marker: a consumer
|
|
13664
|
+
* differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
|
|
13665
|
+
* window when this changes, because the counter restarted from zero in a new
|
|
13666
|
+
* process.
|
|
13667
|
+
*/
|
|
13668
|
+
startedAtMs: number().optional(),
|
|
13669
|
+
/**
|
|
13670
|
+
* CUMULATIVE CPU seconds this unit has consumed since it started — user +
|
|
13671
|
+
* system, read from the child's own `/proc/<pid>/stat` at the moment the
|
|
13672
|
+
* contribution is asked for.
|
|
13673
|
+
*
|
|
13674
|
+
* Cumulative and not a rate on purpose: a rate needs a window, a window
|
|
13675
|
+
* needs a sampler, and a new per-node sampler is the defect half of
|
|
13676
|
+
* `docs/architecture/load-ledger.md` documents. A counter can be differenced
|
|
13677
|
+
* by whoever already keeps a history; a rate cannot be un-averaged.
|
|
13678
|
+
*
|
|
13679
|
+
* Absent — never zero — on a node with no `/proc`, on a read failure, and on
|
|
13680
|
+
* an entry with no process.
|
|
13681
|
+
*/
|
|
13682
|
+
cpuSeconds: number().optional(),
|
|
13683
|
+
/** Resident bytes of this unit's process, same source and same rules. */
|
|
13684
|
+
rssBytes: number().optional()
|
|
13685
|
+
});
|
|
13686
|
+
method(_void(), array(LoadContributionSchema).readonly());
|
|
13517
13687
|
/**
|
|
13518
13688
|
* `log-channels` — the capability an addon DECLARES its diagnostic channels
|
|
13519
13689
|
* through. It stores nothing.
|
|
@@ -13590,176 +13760,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
13590
13760
|
tags: record(string(), string()).optional()
|
|
13591
13761
|
}), array(LogEntrySchema).readonly());
|
|
13592
13762
|
/**
|
|
13593
|
-
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
13594
|
-
* through, per camera, with the denominator attached. It stores nothing.
|
|
13595
|
-
*
|
|
13596
|
-
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
13597
|
-
*
|
|
13598
|
-
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
13599
|
-
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
13600
|
-
* copied: the contributor reports what it already knows, hub-main adds only
|
|
13601
|
-
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
13602
|
-
* somebody to forget to edit.
|
|
13603
|
-
*
|
|
13604
|
-
* They are not merged, because their invariants are opposites:
|
|
13605
|
-
*
|
|
13606
|
-
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
13607
|
-
* claim a camera cost nothing, which is a measurement nobody made;
|
|
13608
|
-
* - a `failure-contribution` zero is the **most valuable value on the
|
|
13609
|
-
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
13610
|
-
* and it is exactly what an absent entry cannot say.
|
|
13611
|
-
*
|
|
13612
|
-
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
13613
|
-
* that gives `load-contribution` its point: contributions are subtracted from
|
|
13614
|
-
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
13615
|
-
* has no process.
|
|
13616
|
-
*
|
|
13617
|
-
* ## Why not a log line, since the counters already exist
|
|
13618
|
-
*
|
|
13619
|
-
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
13620
|
-
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
13621
|
-
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
13622
|
-
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
13623
|
-
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
13624
|
-
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
13625
|
-
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
13626
|
-
* be READ.
|
|
13627
|
-
*
|
|
13628
|
-
* ## The rate is served with its denominator or not at all
|
|
13629
|
-
*
|
|
13630
|
-
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
13631
|
-
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
13632
|
-
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
13633
|
-
* successes on the same path. A surface that publishes only the numerator
|
|
13634
|
-
* reproduces that mistake on every read.
|
|
13635
|
-
*
|
|
13636
|
-
* ## Shape
|
|
13637
|
-
*
|
|
13638
|
-
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
13639
|
-
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
13640
|
-
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
13641
|
-
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
13642
|
-
* a forked runner's entries reach hub-main over transport that already exists.
|
|
13643
|
-
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
13644
|
-
* result through `system.getFailureContributions`.
|
|
13645
|
-
*/
|
|
13646
|
-
var FailureReasonCountSchema = object({
|
|
13647
|
-
/**
|
|
13648
|
-
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
13649
|
-
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
13650
|
-
* strings that already appear in this repo's logs and, where one exists, the
|
|
13651
|
-
* same string the per-track `previewMissReason` records (D276): a second
|
|
13652
|
-
* vocabulary for the same loss would make the row and the counter
|
|
13653
|
-
* un-joinable.
|
|
13654
|
-
*/
|
|
13655
|
-
reason: string(),
|
|
13656
|
-
count: number().int().nonnegative()
|
|
13657
|
-
});
|
|
13658
|
-
var FailureContributionSchema = object({
|
|
13659
|
-
/**
|
|
13660
|
-
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
13661
|
-
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
13662
|
-
* `unit` free: the families are owned by different addons and a shared enum
|
|
13663
|
-
* is a central list that rots invisibly.
|
|
13664
|
-
*/
|
|
13665
|
-
family: string(),
|
|
13666
|
-
/**
|
|
13667
|
-
* The NUMERIC device id — the same value every log line carries as
|
|
13668
|
-
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
13669
|
-
* cannot name the camera must not emit the entry, because a fleet total
|
|
13670
|
-
* cannot answer the only question anybody asks of this surface.
|
|
13671
|
-
*/
|
|
13672
|
-
deviceId: number().int().positive(),
|
|
13673
|
-
/**
|
|
13674
|
-
* A second dimension inside the family: the model / step id for an inference
|
|
13675
|
-
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
13676
|
-
* family has a single variant.
|
|
13677
|
-
*/
|
|
13678
|
-
variant: string().optional(),
|
|
13679
|
-
/**
|
|
13680
|
-
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
13681
|
-
* differencing two reads must drop the interval when it changes, because the
|
|
13682
|
-
* counter restarted from zero in a respawned runner. Same discipline as
|
|
13683
|
-
* `LoadContribution.startedAtMs`.
|
|
13684
|
-
*/
|
|
13685
|
-
sinceMs: number(),
|
|
13686
|
-
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
13687
|
-
atMs: number(),
|
|
13688
|
-
/**
|
|
13689
|
-
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
13690
|
-
* window. A failure count published without it is the mistake this schema
|
|
13691
|
-
* exists to make impossible.
|
|
13692
|
-
*/
|
|
13693
|
-
attempts: number().int().nonnegative(),
|
|
13694
|
-
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
13695
|
-
succeeded: number().int().nonnegative(),
|
|
13696
|
-
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
13697
|
-
reasons: array(FailureReasonCountSchema).readonly()
|
|
13698
|
-
});
|
|
13699
|
-
method(_void(), array(FailureContributionSchema).readonly());
|
|
13700
|
-
var LoadContributionSchema = object({
|
|
13701
|
-
role: _enum([
|
|
13702
|
-
"decode",
|
|
13703
|
-
"transcode",
|
|
13704
|
-
"recording",
|
|
13705
|
-
"streaming",
|
|
13706
|
-
"detection"
|
|
13707
|
-
]),
|
|
13708
|
-
/**
|
|
13709
|
-
* The NUMERIC device id — the same value every log line carries as
|
|
13710
|
-
* `tags.deviceId`. `null` means this cost genuinely belongs to no single
|
|
13711
|
-
* camera (a shared pool), NOT that the contributor forgot to look it up: a
|
|
13712
|
-
* contributor that cannot name its camera must not emit the entry at all,
|
|
13713
|
-
* because an unnamed per-camera entry is indistinguishable from a shared one
|
|
13714
|
-
* and would quietly turn one camera's cost into everybody's.
|
|
13715
|
-
*/
|
|
13716
|
-
deviceId: number().int().positive().nullable(),
|
|
13717
|
-
attribution: _enum([
|
|
13718
|
-
"measured",
|
|
13719
|
-
"accounted",
|
|
13720
|
-
"unattributable"
|
|
13721
|
-
]),
|
|
13722
|
-
/**
|
|
13723
|
-
* What ONE entry is, in the contributor's own words — `615/high`,
|
|
13724
|
-
* `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
|
|
13725
|
-
* family and inventing a common one would lose the only information that
|
|
13726
|
-
* makes two entries for the same camera distinguishable.
|
|
13727
|
-
*/
|
|
13728
|
-
unit: string(),
|
|
13729
|
-
/**
|
|
13730
|
-
* The OS process this cost lives in, when there is one. Present so a
|
|
13731
|
-
* consumer can (a) tell two generations of the same unit apart across a
|
|
13732
|
-
* restart, and (b) subtract claimed processes from the node's process
|
|
13733
|
-
* snapshot to see what NOBODY claimed. Absent for an entry that owns no
|
|
13734
|
-
* process of its own.
|
|
13735
|
-
*/
|
|
13736
|
-
pid: number().int().positive().optional(),
|
|
13737
|
-
/**
|
|
13738
|
-
* When this generation started. The pid's incarnation marker: a consumer
|
|
13739
|
-
* differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
|
|
13740
|
-
* window when this changes, because the counter restarted from zero in a new
|
|
13741
|
-
* process.
|
|
13742
|
-
*/
|
|
13743
|
-
startedAtMs: number().optional(),
|
|
13744
|
-
/**
|
|
13745
|
-
* CUMULATIVE CPU seconds this unit has consumed since it started — user +
|
|
13746
|
-
* system, read from the child's own `/proc/<pid>/stat` at the moment the
|
|
13747
|
-
* contribution is asked for.
|
|
13748
|
-
*
|
|
13749
|
-
* Cumulative and not a rate on purpose: a rate needs a window, a window
|
|
13750
|
-
* needs a sampler, and a new per-node sampler is the defect half of
|
|
13751
|
-
* `docs/architecture/load-ledger.md` documents. A counter can be differenced
|
|
13752
|
-
* by whoever already keeps a history; a rate cannot be un-averaged.
|
|
13753
|
-
*
|
|
13754
|
-
* Absent — never zero — on a node with no `/proc`, on a read failure, and on
|
|
13755
|
-
* an entry with no process.
|
|
13756
|
-
*/
|
|
13757
|
-
cpuSeconds: number().optional(),
|
|
13758
|
-
/** Resident bytes of this unit's process, same source and same rules. */
|
|
13759
|
-
rssBytes: number().optional()
|
|
13760
|
-
});
|
|
13761
|
-
method(_void(), array(LoadContributionSchema).readonly());
|
|
13762
|
-
/**
|
|
13763
13763
|
* `login-method` — collection cap through which auth addons contribute
|
|
13764
13764
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
13765
13765
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
@@ -18438,12 +18438,53 @@ var MediaFileKindEnum = _enum([
|
|
|
18438
18438
|
"keyFrameSmall",
|
|
18439
18439
|
"thumbnailSmall"
|
|
18440
18440
|
]);
|
|
18441
|
+
/**
|
|
18442
|
+
* One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
|
|
18443
|
+
* ARE — never the bytes themselves.
|
|
18444
|
+
*
|
|
18445
|
+
* ## Why `url` and not `base64`
|
|
18446
|
+
*
|
|
18447
|
+
* Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
|
|
18448
|
+
* with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
|
|
18449
|
+
* was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
|
|
18450
|
+
* wire. Forty events is ~144 MB. Every byte of it was read off disk,
|
|
18451
|
+
* base64-encoded, held whole in a unary tRPC envelope, and materialised in
|
|
18452
|
+
* hub-main's heap on the way past — for an `<img>` that would have cached it.
|
|
18453
|
+
*
|
|
18454
|
+
* `url` points at the `event-media` data plane
|
|
18455
|
+
* (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
|
|
18456
|
+
* with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
|
|
18457
|
+
* render a `?variant=thumb`, and streams. The hub gate in front of it requires
|
|
18458
|
+
* a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
|
|
18459
|
+
* no less protected than they were inside a `view`-level cap response — see
|
|
18460
|
+
* `data-plane-access.ts` for the rule and the one gap it does not close
|
|
18461
|
+
* (per-device scoping).
|
|
18462
|
+
*
|
|
18463
|
+
* The URL is built from the row's **stored** key, which is not always its
|
|
18464
|
+
* published `kind`: a track's face/plate crop is stored as `crop` under
|
|
18465
|
+
* `('face'|'plate', '<prefix>-<trackId>')` and published as
|
|
18466
|
+
* `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
|
|
18467
|
+
*
|
|
18468
|
+
* ## `base64` is TRANSITIONAL and is going away
|
|
18469
|
+
*
|
|
18470
|
+
* It is still populated for one reason: the deployed viewer's track-detail
|
|
18471
|
+
* HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
|
|
18472
|
+
* REQUIRES the field), and a row without it parses as a FAILED read — the red
|
|
18473
|
+
* triangle — not as absence. Removing the field before that viewer ships is an
|
|
18474
|
+
* outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
|
|
18475
|
+
* delete this line and the `withBytes` pass-through in
|
|
18476
|
+
* `analytics-query-facade.ts`; nothing else reads it.
|
|
18477
|
+
*/
|
|
18441
18478
|
var MediaFileSchema = object({
|
|
18442
18479
|
key: string(),
|
|
18443
18480
|
kind: MediaFileKindEnum,
|
|
18444
|
-
base64: string(),
|
|
18445
18481
|
sizeBytes: number(),
|
|
18446
18482
|
timestamp: number()
|
|
18483
|
+
}).extend({
|
|
18484
|
+
/** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
|
|
18485
|
+
url: string(),
|
|
18486
|
+
/** @deprecated Transitional — see the schema docblock. Use {@link url}. */
|
|
18487
|
+
base64: string()
|
|
18447
18488
|
});
|
|
18448
18489
|
/**
|
|
18449
18490
|
* One media row WITHOUT its bytes.
|
|
@@ -18455,7 +18496,9 @@ var MediaFileSchema = object({
|
|
|
18455
18496
|
* blocks the whole view.
|
|
18456
18497
|
*
|
|
18457
18498
|
* `sizeBytes` is carried because it is what lets a client decide between the
|
|
18458
|
-
* stored blob and a `?variant=thumb` rendering without fetching either
|
|
18499
|
+
* stored blob and a `?variant=thumb` rendering without fetching either, and
|
|
18500
|
+
* `url` because a client that had to build the plane path itself is a second
|
|
18501
|
+
* copy of a route — the embed, the viewer and the admin UI each grew one.
|
|
18459
18502
|
*/
|
|
18460
18503
|
var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
|
|
18461
18504
|
/**
|
|
@@ -19144,6 +19187,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
19144
19187
|
}), array(MediaFileSchema).readonly()), method(object({
|
|
19145
19188
|
trackId: string(),
|
|
19146
19189
|
deviceId: number()
|
|
19190
|
+
}), array(MediaFileInfoSchema).readonly()), method(object({
|
|
19191
|
+
eventId: string(),
|
|
19192
|
+
deviceId: number()
|
|
19147
19193
|
}), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
19148
19194
|
kind: "mutation",
|
|
19149
19195
|
auth: "admin"
|
|
@@ -23404,10 +23450,24 @@ var FaceClusterSchema = object({
|
|
|
23404
23450
|
size: number().int(),
|
|
23405
23451
|
cohesion: number()
|
|
23406
23452
|
});
|
|
23453
|
+
/**
|
|
23454
|
+
* One gallery media row: what the crop is, how big it is, and WHERE its bytes
|
|
23455
|
+
* are — never the bytes.
|
|
23456
|
+
*
|
|
23457
|
+
* `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
|
|
23458
|
+
* track/event contract) is still populated because a deployed viewer requires
|
|
23459
|
+
* the field to parse a row at all; this method has no such reader. Its ONE
|
|
23460
|
+
* caller is the admin UI's detail modal, which was building
|
|
23461
|
+
* `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
|
|
23462
|
+
* dialog already rendering its key FRAME from the `event-media` plane.
|
|
23463
|
+
*
|
|
23464
|
+
* `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
|
|
23465
|
+
* media key directly, so this needed no new plane and no new access decision.
|
|
23466
|
+
*/
|
|
23407
23467
|
var MediaFileLiteSchema$1 = object({
|
|
23408
23468
|
key: string(),
|
|
23409
23469
|
kind: string(),
|
|
23410
|
-
|
|
23470
|
+
url: string(),
|
|
23411
23471
|
sizeBytes: number(),
|
|
23412
23472
|
timestamp: number()
|
|
23413
23473
|
});
|
|
@@ -25659,10 +25719,24 @@ var PlateInfoSchema = object({
|
|
|
25659
25719
|
*/
|
|
25660
25720
|
cropUrl: string().optional()
|
|
25661
25721
|
});
|
|
25722
|
+
/**
|
|
25723
|
+
* One gallery media row: what the crop is, how big it is, and WHERE its bytes
|
|
25724
|
+
* are — never the bytes.
|
|
25725
|
+
*
|
|
25726
|
+
* `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
|
|
25727
|
+
* track/event contract) is still populated because a deployed viewer requires
|
|
25728
|
+
* the field to parse a row at all; this method has no such reader. Its ONE
|
|
25729
|
+
* caller is the admin UI's detail modal, which was building
|
|
25730
|
+
* `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
|
|
25731
|
+
* dialog already rendering its key FRAME from the `event-media` plane.
|
|
25732
|
+
*
|
|
25733
|
+
* `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
|
|
25734
|
+
* media key directly, so this needed no new plane and no new access decision.
|
|
25735
|
+
*/
|
|
25662
25736
|
var MediaFileLiteSchema = object({
|
|
25663
25737
|
key: string(),
|
|
25664
25738
|
kind: string(),
|
|
25665
|
-
|
|
25739
|
+
url: string(),
|
|
25666
25740
|
sizeBytes: number(),
|
|
25667
25741
|
timestamp: number()
|
|
25668
25742
|
});
|
|
@@ -31675,6 +31749,12 @@ Object.freeze({
|
|
|
31675
31749
|
addonId: null,
|
|
31676
31750
|
access: "view"
|
|
31677
31751
|
},
|
|
31752
|
+
"pipelineAnalytics.listEventMedia": {
|
|
31753
|
+
capName: "pipeline-analytics",
|
|
31754
|
+
capScope: "device",
|
|
31755
|
+
addonId: null,
|
|
31756
|
+
access: "view"
|
|
31757
|
+
},
|
|
31678
31758
|
"pipelineAnalytics.listGroups": {
|
|
31679
31759
|
capName: "pipeline-analytics",
|
|
31680
31760
|
capScope: "device",
|
|
@@ -35298,6 +35378,11 @@ Object.freeze({
|
|
|
35298
35378
|
form: "array",
|
|
35299
35379
|
optional: false
|
|
35300
35380
|
}],
|
|
35381
|
+
"pipelineAnalytics.listEventMedia": [{
|
|
35382
|
+
name: "deviceId",
|
|
35383
|
+
form: "single",
|
|
35384
|
+
optional: false
|
|
35385
|
+
}],
|
|
35301
35386
|
"pipelineAnalytics.listGroups": [{
|
|
35302
35387
|
name: "deviceIds",
|
|
35303
35388
|
form: "array",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-mqtt-broker",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.47",
|
|
4
4
|
"description": "MQTT broker registry addon for CamStack — manages external broker entries + an optional embedded aedes broker. Consumers spin up their own `mqtt.js` clients via the `mqtt-broker` cap.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|