@camstack/addon-decoder-ffmpeg 1.2.36 → 1.2.38
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 +269 -1
- package/dist/index.mjs +269 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5921,6 +5921,40 @@ var BaseAddon = class {
|
|
|
5921
5921
|
deviceSettingsSchema() {
|
|
5922
5922
|
return null;
|
|
5923
5923
|
}
|
|
5924
|
+
/**
|
|
5925
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
5926
|
+
* ARE the configuration of its integration.
|
|
5927
|
+
*
|
|
5928
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
5929
|
+
* operator should find on the addon's integration page (System →
|
|
5930
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
5931
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
5932
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
5933
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
5934
|
+
* nature of the integration.
|
|
5935
|
+
*
|
|
5936
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
5937
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
5938
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
5939
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
5940
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
5941
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
5942
|
+
*
|
|
5943
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
5944
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
5945
|
+
* removed with the reason recorded at
|
|
5946
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
5947
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
5948
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
5949
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
5950
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
5951
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
5952
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
5953
|
+
* ids it names.
|
|
5954
|
+
*/
|
|
5955
|
+
integrationSettingSections() {
|
|
5956
|
+
return [];
|
|
5957
|
+
}
|
|
5924
5958
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5925
5959
|
const schema = this.globalSettingsSchema(cap);
|
|
5926
5960
|
if (!schema) return { sections: [] };
|
|
@@ -5931,6 +5965,55 @@ var BaseAddon = class {
|
|
|
5931
5965
|
} : projected);
|
|
5932
5966
|
}
|
|
5933
5967
|
/**
|
|
5968
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
5969
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
5970
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
5971
|
+
*
|
|
5972
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
5973
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
5974
|
+
* as a failed load.
|
|
5975
|
+
*
|
|
5976
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
5977
|
+
* and not in whichever UI happens to render this:
|
|
5978
|
+
*
|
|
5979
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
5980
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
5981
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
5982
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
5983
|
+
* not merely discouraged.
|
|
5984
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
5985
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
5986
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
5987
|
+
* who opened the page (D266).
|
|
5988
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
5989
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
5990
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
5991
|
+
*/
|
|
5992
|
+
async getIntegrationSettings(nodeId) {
|
|
5993
|
+
const declared = this.integrationSettingSections();
|
|
5994
|
+
if (declared.length === 0) return null;
|
|
5995
|
+
const schema = this.globalSettingsSchema();
|
|
5996
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
5997
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
5998
|
+
const sections = [];
|
|
5999
|
+
for (const id of declared) {
|
|
6000
|
+
const section = byId.get(id);
|
|
6001
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
6002
|
+
const fields = dropPerNodeFields(section.fields);
|
|
6003
|
+
if (fields.length === 0) continue;
|
|
6004
|
+
sections.push({
|
|
6005
|
+
...section,
|
|
6006
|
+
fields
|
|
6007
|
+
});
|
|
6008
|
+
}
|
|
6009
|
+
if (sections.length === 0) return null;
|
|
6010
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6011
|
+
return hydrateSchema({
|
|
6012
|
+
...schema,
|
|
6013
|
+
sections
|
|
6014
|
+
}, projected);
|
|
6015
|
+
}
|
|
6016
|
+
/**
|
|
5934
6017
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5935
6018
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5936
6019
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6234,6 +6317,41 @@ var BaseAddon = class {
|
|
|
6234
6317
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6235
6318
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6236
6319
|
*/
|
|
6320
|
+
/**
|
|
6321
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6322
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6323
|
+
* with no child is dropped rather than rendered empty.
|
|
6324
|
+
*
|
|
6325
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6326
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6327
|
+
*/
|
|
6328
|
+
function dropPerNodeFields(fields) {
|
|
6329
|
+
const kept = [];
|
|
6330
|
+
for (const field of fields) {
|
|
6331
|
+
if (field.type === "group") {
|
|
6332
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6333
|
+
if (inner.length > 0) kept.push({
|
|
6334
|
+
...field,
|
|
6335
|
+
fields: inner
|
|
6336
|
+
});
|
|
6337
|
+
continue;
|
|
6338
|
+
}
|
|
6339
|
+
if (field.type === "sub-tabs") {
|
|
6340
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6341
|
+
...tab,
|
|
6342
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6343
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6344
|
+
if (tabs.length > 0) kept.push({
|
|
6345
|
+
...field,
|
|
6346
|
+
tabs
|
|
6347
|
+
});
|
|
6348
|
+
continue;
|
|
6349
|
+
}
|
|
6350
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6351
|
+
kept.push(field);
|
|
6352
|
+
}
|
|
6353
|
+
return kept;
|
|
6354
|
+
}
|
|
6237
6355
|
function collectPerNodeFieldKeys(fields) {
|
|
6238
6356
|
const collected = [];
|
|
6239
6357
|
for (const field of fields) {
|
|
@@ -9399,6 +9517,9 @@ method(object({
|
|
|
9399
9517
|
kind: "mutation",
|
|
9400
9518
|
auth: "admin"
|
|
9401
9519
|
}), method(object({
|
|
9520
|
+
addonId: string(),
|
|
9521
|
+
nodeId: string().optional()
|
|
9522
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
9402
9523
|
addonId: string(),
|
|
9403
9524
|
deviceId: number(),
|
|
9404
9525
|
nodeId: string().optional()
|
|
@@ -13213,6 +13334,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
13213
13334
|
limit: number().optional(),
|
|
13214
13335
|
tags: record(string(), string()).optional()
|
|
13215
13336
|
}), array(LogEntrySchema).readonly());
|
|
13337
|
+
/**
|
|
13338
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
13339
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
13340
|
+
*
|
|
13341
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
13342
|
+
*
|
|
13343
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
13344
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
13345
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
13346
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
13347
|
+
* somebody to forget to edit.
|
|
13348
|
+
*
|
|
13349
|
+
* They are not merged, because their invariants are opposites:
|
|
13350
|
+
*
|
|
13351
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
13352
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
13353
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
13354
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
13355
|
+
* and it is exactly what an absent entry cannot say.
|
|
13356
|
+
*
|
|
13357
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
13358
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
13359
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
13360
|
+
* has no process.
|
|
13361
|
+
*
|
|
13362
|
+
* ## Why not a log line, since the counters already exist
|
|
13363
|
+
*
|
|
13364
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
13365
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
13366
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
13367
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
13368
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
13369
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
13370
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
13371
|
+
* be READ.
|
|
13372
|
+
*
|
|
13373
|
+
* ## The rate is served with its denominator or not at all
|
|
13374
|
+
*
|
|
13375
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
13376
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
13377
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
13378
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
13379
|
+
* reproduces that mistake on every read.
|
|
13380
|
+
*
|
|
13381
|
+
* ## Shape
|
|
13382
|
+
*
|
|
13383
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
13384
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
13385
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
13386
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
13387
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
13388
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
13389
|
+
* result through `system.getFailureContributions`.
|
|
13390
|
+
*/
|
|
13391
|
+
var FailureReasonCountSchema = object({
|
|
13392
|
+
/**
|
|
13393
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
13394
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
13395
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
13396
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
13397
|
+
* vocabulary for the same loss would make the row and the counter
|
|
13398
|
+
* un-joinable.
|
|
13399
|
+
*/
|
|
13400
|
+
reason: string(),
|
|
13401
|
+
count: number().int().nonnegative()
|
|
13402
|
+
});
|
|
13403
|
+
var FailureContributionSchema = object({
|
|
13404
|
+
/**
|
|
13405
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
13406
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
13407
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
13408
|
+
* is a central list that rots invisibly.
|
|
13409
|
+
*/
|
|
13410
|
+
family: string(),
|
|
13411
|
+
/**
|
|
13412
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
13413
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
13414
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
13415
|
+
* cannot answer the only question anybody asks of this surface.
|
|
13416
|
+
*/
|
|
13417
|
+
deviceId: number().int().positive(),
|
|
13418
|
+
/**
|
|
13419
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
13420
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
13421
|
+
* family has a single variant.
|
|
13422
|
+
*/
|
|
13423
|
+
variant: string().optional(),
|
|
13424
|
+
/**
|
|
13425
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
13426
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
13427
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
13428
|
+
* `LoadContribution.startedAtMs`.
|
|
13429
|
+
*/
|
|
13430
|
+
sinceMs: number(),
|
|
13431
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
13432
|
+
atMs: number(),
|
|
13433
|
+
/**
|
|
13434
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
13435
|
+
* window. A failure count published without it is the mistake this schema
|
|
13436
|
+
* exists to make impossible.
|
|
13437
|
+
*/
|
|
13438
|
+
attempts: number().int().nonnegative(),
|
|
13439
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
13440
|
+
succeeded: number().int().nonnegative(),
|
|
13441
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
13442
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
13443
|
+
});
|
|
13444
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
13216
13445
|
var LoadContributionSchema = object({
|
|
13217
13446
|
role: _enum([
|
|
13218
13447
|
"decode",
|
|
@@ -17725,6 +17954,20 @@ var TrackSchema = object({
|
|
|
17725
17954
|
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
17726
17955
|
*/
|
|
17727
17956
|
hasRider: boolean().optional(),
|
|
17957
|
+
/**
|
|
17958
|
+
* WHY this track ended without a NATIVE best-shot tile
|
|
17959
|
+
* ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
|
|
17960
|
+
* a composed token line (`no-key-frame capture=keyframe:native-missx4`,
|
|
17961
|
+
* `derive-returned-null tile=standin`, …) written at close and CLEARED by
|
|
17962
|
+
* the late-keyFrame upgrade when a native tile lands after all. The
|
|
17963
|
+
* operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
17964
|
+
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
17965
|
+
*
|
|
17966
|
+
* **Absent ≠ "missed silently"**: a row written before the column, a hub
|
|
17967
|
+
* that predates the field, and every track whose tile landed native all
|
|
17968
|
+
* omit it. Render nothing when absent.
|
|
17969
|
+
*/
|
|
17970
|
+
previewMissReason: string().optional(),
|
|
17728
17971
|
...TrackFlagFields,
|
|
17729
17972
|
...TrackRetrainFields
|
|
17730
17973
|
});
|
|
@@ -26951,6 +27194,13 @@ var LoggingSettingsPatchSchema = object({
|
|
|
26951
27194
|
* anyone but its owner.
|
|
26952
27195
|
*/
|
|
26953
27196
|
var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
|
|
27197
|
+
/**
|
|
27198
|
+
* One per-camera failure counter, plus WHO reported it.
|
|
27199
|
+
*
|
|
27200
|
+
* Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
|
|
27201
|
+
* the hub as it enumerates providers, never by the contributor.
|
|
27202
|
+
*/
|
|
27203
|
+
var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
|
|
26954
27204
|
var GetLoggingSettingsInputSchema = object({
|
|
26955
27205
|
scopeNodeId: string().optional(),
|
|
26956
27206
|
/**
|
|
@@ -27009,7 +27259,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
|
|
|
27009
27259
|
}), method(_void(), SiteLocationStatusSchema, {
|
|
27010
27260
|
kind: "mutation",
|
|
27011
27261
|
auth: "admin"
|
|
27012
|
-
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
27262
|
+
}), 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, {
|
|
27013
27263
|
kind: "mutation",
|
|
27014
27264
|
auth: "admin"
|
|
27015
27265
|
});
|
|
@@ -27923,6 +28173,12 @@ Object.freeze({
|
|
|
27923
28173
|
addonId: null,
|
|
27924
28174
|
access: "view"
|
|
27925
28175
|
},
|
|
28176
|
+
"addonSettings.getIntegrationSettings": {
|
|
28177
|
+
capName: "addon-settings",
|
|
28178
|
+
capScope: "system",
|
|
28179
|
+
addonId: null,
|
|
28180
|
+
access: "view"
|
|
28181
|
+
},
|
|
27926
28182
|
"addonSettings.updateDeviceSettings": {
|
|
27927
28183
|
capName: "addon-settings",
|
|
27928
28184
|
capScope: "system",
|
|
@@ -29585,6 +29841,12 @@ Object.freeze({
|
|
|
29585
29841
|
addonId: null,
|
|
29586
29842
|
access: "create"
|
|
29587
29843
|
},
|
|
29844
|
+
"failureContribution.list": {
|
|
29845
|
+
capName: "failure-contribution",
|
|
29846
|
+
capScope: "system",
|
|
29847
|
+
addonId: null,
|
|
29848
|
+
access: "view"
|
|
29849
|
+
},
|
|
29588
29850
|
"fanControl.setDirection": {
|
|
29589
29851
|
capName: "fan-control",
|
|
29590
29852
|
capScope: "device",
|
|
@@ -32891,6 +33153,12 @@ Object.freeze({
|
|
|
32891
33153
|
addonId: null,
|
|
32892
33154
|
access: "create"
|
|
32893
33155
|
},
|
|
33156
|
+
"system.getFailureContributions": {
|
|
33157
|
+
capName: "system",
|
|
33158
|
+
capScope: "system",
|
|
33159
|
+
addonId: null,
|
|
33160
|
+
access: "view"
|
|
33161
|
+
},
|
|
32894
33162
|
"system.getLoadContributions": {
|
|
32895
33163
|
capName: "system",
|
|
32896
33164
|
capScope: "system",
|
package/dist/index.mjs
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) {
|
|
@@ -9395,6 +9513,9 @@ method(object({
|
|
|
9395
9513
|
kind: "mutation",
|
|
9396
9514
|
auth: "admin"
|
|
9397
9515
|
}), method(object({
|
|
9516
|
+
addonId: string(),
|
|
9517
|
+
nodeId: string().optional()
|
|
9518
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
9398
9519
|
addonId: string(),
|
|
9399
9520
|
deviceId: number(),
|
|
9400
9521
|
nodeId: string().optional()
|
|
@@ -13209,6 +13330,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
13209
13330
|
limit: number().optional(),
|
|
13210
13331
|
tags: record(string(), string()).optional()
|
|
13211
13332
|
}), array(LogEntrySchema).readonly());
|
|
13333
|
+
/**
|
|
13334
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
13335
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
13336
|
+
*
|
|
13337
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
13338
|
+
*
|
|
13339
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
13340
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
13341
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
13342
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
13343
|
+
* somebody to forget to edit.
|
|
13344
|
+
*
|
|
13345
|
+
* They are not merged, because their invariants are opposites:
|
|
13346
|
+
*
|
|
13347
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
13348
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
13349
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
13350
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
13351
|
+
* and it is exactly what an absent entry cannot say.
|
|
13352
|
+
*
|
|
13353
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
13354
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
13355
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
13356
|
+
* has no process.
|
|
13357
|
+
*
|
|
13358
|
+
* ## Why not a log line, since the counters already exist
|
|
13359
|
+
*
|
|
13360
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
13361
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
13362
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
13363
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
13364
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
13365
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
13366
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
13367
|
+
* be READ.
|
|
13368
|
+
*
|
|
13369
|
+
* ## The rate is served with its denominator or not at all
|
|
13370
|
+
*
|
|
13371
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
13372
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
13373
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
13374
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
13375
|
+
* reproduces that mistake on every read.
|
|
13376
|
+
*
|
|
13377
|
+
* ## Shape
|
|
13378
|
+
*
|
|
13379
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
13380
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
13381
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
13382
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
13383
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
13384
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
13385
|
+
* result through `system.getFailureContributions`.
|
|
13386
|
+
*/
|
|
13387
|
+
var FailureReasonCountSchema = object({
|
|
13388
|
+
/**
|
|
13389
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
13390
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
13391
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
13392
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
13393
|
+
* vocabulary for the same loss would make the row and the counter
|
|
13394
|
+
* un-joinable.
|
|
13395
|
+
*/
|
|
13396
|
+
reason: string(),
|
|
13397
|
+
count: number().int().nonnegative()
|
|
13398
|
+
});
|
|
13399
|
+
var FailureContributionSchema = object({
|
|
13400
|
+
/**
|
|
13401
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
13402
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
13403
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
13404
|
+
* is a central list that rots invisibly.
|
|
13405
|
+
*/
|
|
13406
|
+
family: string(),
|
|
13407
|
+
/**
|
|
13408
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
13409
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
13410
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
13411
|
+
* cannot answer the only question anybody asks of this surface.
|
|
13412
|
+
*/
|
|
13413
|
+
deviceId: number().int().positive(),
|
|
13414
|
+
/**
|
|
13415
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
13416
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
13417
|
+
* family has a single variant.
|
|
13418
|
+
*/
|
|
13419
|
+
variant: string().optional(),
|
|
13420
|
+
/**
|
|
13421
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
13422
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
13423
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
13424
|
+
* `LoadContribution.startedAtMs`.
|
|
13425
|
+
*/
|
|
13426
|
+
sinceMs: number(),
|
|
13427
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
13428
|
+
atMs: number(),
|
|
13429
|
+
/**
|
|
13430
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
13431
|
+
* window. A failure count published without it is the mistake this schema
|
|
13432
|
+
* exists to make impossible.
|
|
13433
|
+
*/
|
|
13434
|
+
attempts: number().int().nonnegative(),
|
|
13435
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
13436
|
+
succeeded: number().int().nonnegative(),
|
|
13437
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
13438
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
13439
|
+
});
|
|
13440
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
13212
13441
|
var LoadContributionSchema = object({
|
|
13213
13442
|
role: _enum([
|
|
13214
13443
|
"decode",
|
|
@@ -17721,6 +17950,20 @@ var TrackSchema = object({
|
|
|
17721
17950
|
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
17722
17951
|
*/
|
|
17723
17952
|
hasRider: boolean().optional(),
|
|
17953
|
+
/**
|
|
17954
|
+
* WHY this track ended without a NATIVE best-shot tile
|
|
17955
|
+
* ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
|
|
17956
|
+
* a composed token line (`no-key-frame capture=keyframe:native-missx4`,
|
|
17957
|
+
* `derive-returned-null tile=standin`, …) written at close and CLEARED by
|
|
17958
|
+
* the late-keyFrame upgrade when a native tile lands after all. The
|
|
17959
|
+
* operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
17960
|
+
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
17961
|
+
*
|
|
17962
|
+
* **Absent ≠ "missed silently"**: a row written before the column, a hub
|
|
17963
|
+
* that predates the field, and every track whose tile landed native all
|
|
17964
|
+
* omit it. Render nothing when absent.
|
|
17965
|
+
*/
|
|
17966
|
+
previewMissReason: string().optional(),
|
|
17724
17967
|
...TrackFlagFields,
|
|
17725
17968
|
...TrackRetrainFields
|
|
17726
17969
|
});
|
|
@@ -26947,6 +27190,13 @@ var LoggingSettingsPatchSchema = object({
|
|
|
26947
27190
|
* anyone but its owner.
|
|
26948
27191
|
*/
|
|
26949
27192
|
var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
|
|
27193
|
+
/**
|
|
27194
|
+
* One per-camera failure counter, plus WHO reported it.
|
|
27195
|
+
*
|
|
27196
|
+
* Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
|
|
27197
|
+
* the hub as it enumerates providers, never by the contributor.
|
|
27198
|
+
*/
|
|
27199
|
+
var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
|
|
26950
27200
|
var GetLoggingSettingsInputSchema = object({
|
|
26951
27201
|
scopeNodeId: string().optional(),
|
|
26952
27202
|
/**
|
|
@@ -27005,7 +27255,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
|
|
|
27005
27255
|
}), method(_void(), SiteLocationStatusSchema, {
|
|
27006
27256
|
kind: "mutation",
|
|
27007
27257
|
auth: "admin"
|
|
27008
|
-
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
27258
|
+
}), 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, {
|
|
27009
27259
|
kind: "mutation",
|
|
27010
27260
|
auth: "admin"
|
|
27011
27261
|
});
|
|
@@ -27919,6 +28169,12 @@ Object.freeze({
|
|
|
27919
28169
|
addonId: null,
|
|
27920
28170
|
access: "view"
|
|
27921
28171
|
},
|
|
28172
|
+
"addonSettings.getIntegrationSettings": {
|
|
28173
|
+
capName: "addon-settings",
|
|
28174
|
+
capScope: "system",
|
|
28175
|
+
addonId: null,
|
|
28176
|
+
access: "view"
|
|
28177
|
+
},
|
|
27922
28178
|
"addonSettings.updateDeviceSettings": {
|
|
27923
28179
|
capName: "addon-settings",
|
|
27924
28180
|
capScope: "system",
|
|
@@ -29581,6 +29837,12 @@ Object.freeze({
|
|
|
29581
29837
|
addonId: null,
|
|
29582
29838
|
access: "create"
|
|
29583
29839
|
},
|
|
29840
|
+
"failureContribution.list": {
|
|
29841
|
+
capName: "failure-contribution",
|
|
29842
|
+
capScope: "system",
|
|
29843
|
+
addonId: null,
|
|
29844
|
+
access: "view"
|
|
29845
|
+
},
|
|
29584
29846
|
"fanControl.setDirection": {
|
|
29585
29847
|
capName: "fan-control",
|
|
29586
29848
|
capScope: "device",
|
|
@@ -32887,6 +33149,12 @@ Object.freeze({
|
|
|
32887
33149
|
addonId: null,
|
|
32888
33150
|
access: "create"
|
|
32889
33151
|
},
|
|
33152
|
+
"system.getFailureContributions": {
|
|
33153
|
+
capName: "system",
|
|
33154
|
+
capScope: "system",
|
|
33155
|
+
addonId: null,
|
|
33156
|
+
access: "view"
|
|
33157
|
+
},
|
|
32890
33158
|
"system.getLoadContributions": {
|
|
32891
33159
|
capName: "system",
|
|
32892
33160
|
capScope: "system",
|