@camstack/addon-agent-ui 1.2.38 → 1.2.40
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/addon.js +270 -2
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -5917,6 +5917,40 @@ var BaseAddon = class {
|
|
|
5917
5917
|
deviceSettingsSchema() {
|
|
5918
5918
|
return null;
|
|
5919
5919
|
}
|
|
5920
|
+
/**
|
|
5921
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
5922
|
+
* ARE the configuration of its integration.
|
|
5923
|
+
*
|
|
5924
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
5925
|
+
* operator should find on the addon's integration page (System →
|
|
5926
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
5927
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
5928
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
5929
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
5930
|
+
* nature of the integration.
|
|
5931
|
+
*
|
|
5932
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
5933
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
5934
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
5935
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
5936
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
5937
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
5938
|
+
*
|
|
5939
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
5940
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
5941
|
+
* removed with the reason recorded at
|
|
5942
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
5943
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
5944
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
5945
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
5946
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
5947
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
5948
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
5949
|
+
* ids it names.
|
|
5950
|
+
*/
|
|
5951
|
+
integrationSettingSections() {
|
|
5952
|
+
return [];
|
|
5953
|
+
}
|
|
5920
5954
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5921
5955
|
const schema = this.globalSettingsSchema(cap);
|
|
5922
5956
|
if (!schema) return { sections: [] };
|
|
@@ -5927,6 +5961,55 @@ var BaseAddon = class {
|
|
|
5927
5961
|
} : projected);
|
|
5928
5962
|
}
|
|
5929
5963
|
/**
|
|
5964
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
5965
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
5966
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
5967
|
+
*
|
|
5968
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
5969
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
5970
|
+
* as a failed load.
|
|
5971
|
+
*
|
|
5972
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
5973
|
+
* and not in whichever UI happens to render this:
|
|
5974
|
+
*
|
|
5975
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
5976
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
5977
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
5978
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
5979
|
+
* not merely discouraged.
|
|
5980
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
5981
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
5982
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
5983
|
+
* who opened the page (D266).
|
|
5984
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
5985
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
5986
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
5987
|
+
*/
|
|
5988
|
+
async getIntegrationSettings(nodeId) {
|
|
5989
|
+
const declared = this.integrationSettingSections();
|
|
5990
|
+
if (declared.length === 0) return null;
|
|
5991
|
+
const schema = this.globalSettingsSchema();
|
|
5992
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
5993
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
5994
|
+
const sections = [];
|
|
5995
|
+
for (const id of declared) {
|
|
5996
|
+
const section = byId.get(id);
|
|
5997
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
5998
|
+
const fields = dropPerNodeFields(section.fields);
|
|
5999
|
+
if (fields.length === 0) continue;
|
|
6000
|
+
sections.push({
|
|
6001
|
+
...section,
|
|
6002
|
+
fields
|
|
6003
|
+
});
|
|
6004
|
+
}
|
|
6005
|
+
if (sections.length === 0) return null;
|
|
6006
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6007
|
+
return hydrateSchema({
|
|
6008
|
+
...schema,
|
|
6009
|
+
sections
|
|
6010
|
+
}, projected);
|
|
6011
|
+
}
|
|
6012
|
+
/**
|
|
5930
6013
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5931
6014
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5932
6015
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6230,6 +6313,41 @@ var BaseAddon = class {
|
|
|
6230
6313
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6231
6314
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6232
6315
|
*/
|
|
6316
|
+
/**
|
|
6317
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6318
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6319
|
+
* with no child is dropped rather than rendered empty.
|
|
6320
|
+
*
|
|
6321
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6322
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6323
|
+
*/
|
|
6324
|
+
function dropPerNodeFields(fields) {
|
|
6325
|
+
const kept = [];
|
|
6326
|
+
for (const field of fields) {
|
|
6327
|
+
if (field.type === "group") {
|
|
6328
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6329
|
+
if (inner.length > 0) kept.push({
|
|
6330
|
+
...field,
|
|
6331
|
+
fields: inner
|
|
6332
|
+
});
|
|
6333
|
+
continue;
|
|
6334
|
+
}
|
|
6335
|
+
if (field.type === "sub-tabs") {
|
|
6336
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6337
|
+
...tab,
|
|
6338
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6339
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6340
|
+
if (tabs.length > 0) kept.push({
|
|
6341
|
+
...field,
|
|
6342
|
+
tabs
|
|
6343
|
+
});
|
|
6344
|
+
continue;
|
|
6345
|
+
}
|
|
6346
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6347
|
+
kept.push(field);
|
|
6348
|
+
}
|
|
6349
|
+
return kept;
|
|
6350
|
+
}
|
|
6233
6351
|
function collectPerNodeFieldKeys(fields) {
|
|
6234
6352
|
const collected = [];
|
|
6235
6353
|
for (const field of fields) {
|
|
@@ -9401,6 +9519,9 @@ method(object({
|
|
|
9401
9519
|
kind: "mutation",
|
|
9402
9520
|
auth: "admin"
|
|
9403
9521
|
}), method(object({
|
|
9522
|
+
addonId: string(),
|
|
9523
|
+
nodeId: string().optional()
|
|
9524
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
9404
9525
|
addonId: string(),
|
|
9405
9526
|
deviceId: number(),
|
|
9406
9527
|
nodeId: string().optional()
|
|
@@ -13085,6 +13206,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
13085
13206
|
limit: number().optional(),
|
|
13086
13207
|
tags: record(string(), string()).optional()
|
|
13087
13208
|
}), array(LogEntrySchema).readonly());
|
|
13209
|
+
/**
|
|
13210
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
13211
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
13212
|
+
*
|
|
13213
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
13214
|
+
*
|
|
13215
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
13216
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
13217
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
13218
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
13219
|
+
* somebody to forget to edit.
|
|
13220
|
+
*
|
|
13221
|
+
* They are not merged, because their invariants are opposites:
|
|
13222
|
+
*
|
|
13223
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
13224
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
13225
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
13226
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
13227
|
+
* and it is exactly what an absent entry cannot say.
|
|
13228
|
+
*
|
|
13229
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
13230
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
13231
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
13232
|
+
* has no process.
|
|
13233
|
+
*
|
|
13234
|
+
* ## Why not a log line, since the counters already exist
|
|
13235
|
+
*
|
|
13236
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
13237
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
13238
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
13239
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
13240
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
13241
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
13242
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
13243
|
+
* be READ.
|
|
13244
|
+
*
|
|
13245
|
+
* ## The rate is served with its denominator or not at all
|
|
13246
|
+
*
|
|
13247
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
13248
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
13249
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
13250
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
13251
|
+
* reproduces that mistake on every read.
|
|
13252
|
+
*
|
|
13253
|
+
* ## Shape
|
|
13254
|
+
*
|
|
13255
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
13256
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
13257
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
13258
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
13259
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
13260
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
13261
|
+
* result through `system.getFailureContributions`.
|
|
13262
|
+
*/
|
|
13263
|
+
var FailureReasonCountSchema = object({
|
|
13264
|
+
/**
|
|
13265
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
13266
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
13267
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
13268
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
13269
|
+
* vocabulary for the same loss would make the row and the counter
|
|
13270
|
+
* un-joinable.
|
|
13271
|
+
*/
|
|
13272
|
+
reason: string(),
|
|
13273
|
+
count: number().int().nonnegative()
|
|
13274
|
+
});
|
|
13275
|
+
var FailureContributionSchema = object({
|
|
13276
|
+
/**
|
|
13277
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
13278
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
13279
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
13280
|
+
* is a central list that rots invisibly.
|
|
13281
|
+
*/
|
|
13282
|
+
family: string(),
|
|
13283
|
+
/**
|
|
13284
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
13285
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
13286
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
13287
|
+
* cannot answer the only question anybody asks of this surface.
|
|
13288
|
+
*/
|
|
13289
|
+
deviceId: number().int().positive(),
|
|
13290
|
+
/**
|
|
13291
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
13292
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
13293
|
+
* family has a single variant.
|
|
13294
|
+
*/
|
|
13295
|
+
variant: string().optional(),
|
|
13296
|
+
/**
|
|
13297
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
13298
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
13299
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
13300
|
+
* `LoadContribution.startedAtMs`.
|
|
13301
|
+
*/
|
|
13302
|
+
sinceMs: number(),
|
|
13303
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
13304
|
+
atMs: number(),
|
|
13305
|
+
/**
|
|
13306
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
13307
|
+
* window. A failure count published without it is the mistake this schema
|
|
13308
|
+
* exists to make impossible.
|
|
13309
|
+
*/
|
|
13310
|
+
attempts: number().int().nonnegative(),
|
|
13311
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
13312
|
+
succeeded: number().int().nonnegative(),
|
|
13313
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
13314
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
13315
|
+
});
|
|
13316
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
13088
13317
|
var LoadContributionSchema = object({
|
|
13089
13318
|
role: _enum([
|
|
13090
13319
|
"decode",
|
|
@@ -17597,6 +17826,20 @@ var TrackSchema = object({
|
|
|
17597
17826
|
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
17598
17827
|
*/
|
|
17599
17828
|
hasRider: boolean().optional(),
|
|
17829
|
+
/**
|
|
17830
|
+
* WHY this track ended without a NATIVE best-shot tile
|
|
17831
|
+
* ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
|
|
17832
|
+
* a composed token line (`no-key-frame capture=keyframe:native-missx4`,
|
|
17833
|
+
* `derive-returned-null tile=standin`, …) written at close and CLEARED by
|
|
17834
|
+
* the late-keyFrame upgrade when a native tile lands after all. The
|
|
17835
|
+
* operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
17836
|
+
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
17837
|
+
*
|
|
17838
|
+
* **Absent ≠ "missed silently"**: a row written before the column, a hub
|
|
17839
|
+
* that predates the field, and every track whose tile landed native all
|
|
17840
|
+
* omit it. Render nothing when absent.
|
|
17841
|
+
*/
|
|
17842
|
+
previewMissReason: string().optional(),
|
|
17600
17843
|
...TrackFlagFields,
|
|
17601
17844
|
...TrackRetrainFields
|
|
17602
17845
|
});
|
|
@@ -26823,6 +27066,13 @@ var LoggingSettingsPatchSchema = object({
|
|
|
26823
27066
|
* anyone but its owner.
|
|
26824
27067
|
*/
|
|
26825
27068
|
var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
|
|
27069
|
+
/**
|
|
27070
|
+
* One per-camera failure counter, plus WHO reported it.
|
|
27071
|
+
*
|
|
27072
|
+
* Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
|
|
27073
|
+
* the hub as it enumerates providers, never by the contributor.
|
|
27074
|
+
*/
|
|
27075
|
+
var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
|
|
26826
27076
|
var GetLoggingSettingsInputSchema = object({
|
|
26827
27077
|
scopeNodeId: string().optional(),
|
|
26828
27078
|
/**
|
|
@@ -26881,7 +27131,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
|
|
|
26881
27131
|
}), method(_void(), SiteLocationStatusSchema, {
|
|
26882
27132
|
kind: "mutation",
|
|
26883
27133
|
auth: "admin"
|
|
26884
|
-
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
27134
|
+
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(_void(), array(ReportedFailureContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
26885
27135
|
kind: "mutation",
|
|
26886
27136
|
auth: "admin"
|
|
26887
27137
|
});
|
|
@@ -27795,6 +28045,12 @@ Object.freeze({
|
|
|
27795
28045
|
addonId: null,
|
|
27796
28046
|
access: "view"
|
|
27797
28047
|
},
|
|
28048
|
+
"addonSettings.getIntegrationSettings": {
|
|
28049
|
+
capName: "addon-settings",
|
|
28050
|
+
capScope: "system",
|
|
28051
|
+
addonId: null,
|
|
28052
|
+
access: "view"
|
|
28053
|
+
},
|
|
27798
28054
|
"addonSettings.updateDeviceSettings": {
|
|
27799
28055
|
capName: "addon-settings",
|
|
27800
28056
|
capScope: "system",
|
|
@@ -29457,6 +29713,12 @@ Object.freeze({
|
|
|
29457
29713
|
addonId: null,
|
|
29458
29714
|
access: "create"
|
|
29459
29715
|
},
|
|
29716
|
+
"failureContribution.list": {
|
|
29717
|
+
capName: "failure-contribution",
|
|
29718
|
+
capScope: "system",
|
|
29719
|
+
addonId: null,
|
|
29720
|
+
access: "view"
|
|
29721
|
+
},
|
|
29460
29722
|
"fanControl.setDirection": {
|
|
29461
29723
|
capName: "fan-control",
|
|
29462
29724
|
capScope: "device",
|
|
@@ -32763,6 +33025,12 @@ Object.freeze({
|
|
|
32763
33025
|
addonId: null,
|
|
32764
33026
|
access: "create"
|
|
32765
33027
|
},
|
|
33028
|
+
"system.getFailureContributions": {
|
|
33029
|
+
capName: "system",
|
|
33030
|
+
capScope: "system",
|
|
33031
|
+
addonId: null,
|
|
33032
|
+
access: "view"
|
|
33033
|
+
},
|
|
32766
33034
|
"system.getLoadContributions": {
|
|
32767
33035
|
capName: "system",
|
|
32768
33036
|
capScope: "system",
|
|
@@ -35670,7 +35938,7 @@ var AgentUIAddon = class extends BaseAddon {
|
|
|
35670
35938
|
capability: adminUiCapability,
|
|
35671
35939
|
provider: {
|
|
35672
35940
|
getStaticDir: async () => ({ staticDir: path.resolve(__dirname) }),
|
|
35673
|
-
getVersion: async () => ({ version: "1.2.
|
|
35941
|
+
getVersion: async () => ({ version: "1.2.40" })
|
|
35674
35942
|
}
|
|
35675
35943
|
}];
|
|
35676
35944
|
}
|