@camstack/addon-provider-petkit 0.2.37 → 0.2.39
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 +269 -1
- package/dist/addon.mjs +269 -1
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -7018,6 +7018,40 @@ var BaseAddon = class {
|
|
|
7018
7018
|
deviceSettingsSchema() {
|
|
7019
7019
|
return null;
|
|
7020
7020
|
}
|
|
7021
|
+
/**
|
|
7022
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
7023
|
+
* ARE the configuration of its integration.
|
|
7024
|
+
*
|
|
7025
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
7026
|
+
* operator should find on the addon's integration page (System →
|
|
7027
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
7028
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
7029
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
7030
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
7031
|
+
* nature of the integration.
|
|
7032
|
+
*
|
|
7033
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
7034
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
7035
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
7036
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
7037
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
7038
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
7039
|
+
*
|
|
7040
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
7041
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
7042
|
+
* removed with the reason recorded at
|
|
7043
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
7044
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
7045
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
7046
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
7047
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
7048
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
7049
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
7050
|
+
* ids it names.
|
|
7051
|
+
*/
|
|
7052
|
+
integrationSettingSections() {
|
|
7053
|
+
return [];
|
|
7054
|
+
}
|
|
7021
7055
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
7022
7056
|
const schema = this.globalSettingsSchema(cap);
|
|
7023
7057
|
if (!schema) return { sections: [] };
|
|
@@ -7028,6 +7062,55 @@ var BaseAddon = class {
|
|
|
7028
7062
|
} : projected);
|
|
7029
7063
|
}
|
|
7030
7064
|
/**
|
|
7065
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
7066
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
7067
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
7068
|
+
*
|
|
7069
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
7070
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
7071
|
+
* as a failed load.
|
|
7072
|
+
*
|
|
7073
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
7074
|
+
* and not in whichever UI happens to render this:
|
|
7075
|
+
*
|
|
7076
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
7077
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
7078
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
7079
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
7080
|
+
* not merely discouraged.
|
|
7081
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
7082
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
7083
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
7084
|
+
* who opened the page (D266).
|
|
7085
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
7086
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
7087
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
7088
|
+
*/
|
|
7089
|
+
async getIntegrationSettings(nodeId) {
|
|
7090
|
+
const declared = this.integrationSettingSections();
|
|
7091
|
+
if (declared.length === 0) return null;
|
|
7092
|
+
const schema = this.globalSettingsSchema();
|
|
7093
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
7094
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
7095
|
+
const sections = [];
|
|
7096
|
+
for (const id of declared) {
|
|
7097
|
+
const section = byId.get(id);
|
|
7098
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
7099
|
+
const fields = dropPerNodeFields(section.fields);
|
|
7100
|
+
if (fields.length === 0) continue;
|
|
7101
|
+
sections.push({
|
|
7102
|
+
...section,
|
|
7103
|
+
fields
|
|
7104
|
+
});
|
|
7105
|
+
}
|
|
7106
|
+
if (sections.length === 0) return null;
|
|
7107
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
7108
|
+
return hydrateSchema({
|
|
7109
|
+
...schema,
|
|
7110
|
+
sections
|
|
7111
|
+
}, projected);
|
|
7112
|
+
}
|
|
7113
|
+
/**
|
|
7031
7114
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
7032
7115
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
7033
7116
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -7331,6 +7414,41 @@ var BaseAddon = class {
|
|
|
7331
7414
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
7332
7415
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
7333
7416
|
*/
|
|
7417
|
+
/**
|
|
7418
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
7419
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
7420
|
+
* with no child is dropped rather than rendered empty.
|
|
7421
|
+
*
|
|
7422
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
7423
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
7424
|
+
*/
|
|
7425
|
+
function dropPerNodeFields(fields) {
|
|
7426
|
+
const kept = [];
|
|
7427
|
+
for (const field of fields) {
|
|
7428
|
+
if (field.type === "group") {
|
|
7429
|
+
const inner = dropPerNodeFields(field.fields);
|
|
7430
|
+
if (inner.length > 0) kept.push({
|
|
7431
|
+
...field,
|
|
7432
|
+
fields: inner
|
|
7433
|
+
});
|
|
7434
|
+
continue;
|
|
7435
|
+
}
|
|
7436
|
+
if (field.type === "sub-tabs") {
|
|
7437
|
+
const tabs = field.tabs.map((tab) => ({
|
|
7438
|
+
...tab,
|
|
7439
|
+
fields: dropPerNodeFields(tab.fields)
|
|
7440
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
7441
|
+
if (tabs.length > 0) kept.push({
|
|
7442
|
+
...field,
|
|
7443
|
+
tabs
|
|
7444
|
+
});
|
|
7445
|
+
continue;
|
|
7446
|
+
}
|
|
7447
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
7448
|
+
kept.push(field);
|
|
7449
|
+
}
|
|
7450
|
+
return kept;
|
|
7451
|
+
}
|
|
7334
7452
|
function collectPerNodeFieldKeys(fields) {
|
|
7335
7453
|
const collected = [];
|
|
7336
7454
|
for (const field of fields) {
|
|
@@ -10500,6 +10618,9 @@ method(object({
|
|
|
10500
10618
|
kind: "mutation",
|
|
10501
10619
|
auth: "admin"
|
|
10502
10620
|
}), method(object({
|
|
10621
|
+
addonId: string(),
|
|
10622
|
+
nodeId: string().optional()
|
|
10623
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
10503
10624
|
addonId: string(),
|
|
10504
10625
|
deviceId: number(),
|
|
10505
10626
|
nodeId: string().optional()
|
|
@@ -14465,6 +14586,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
14465
14586
|
limit: number().optional(),
|
|
14466
14587
|
tags: record(string(), string()).optional()
|
|
14467
14588
|
}), array(LogEntrySchema).readonly());
|
|
14589
|
+
/**
|
|
14590
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
14591
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
14592
|
+
*
|
|
14593
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
14594
|
+
*
|
|
14595
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
14596
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
14597
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
14598
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
14599
|
+
* somebody to forget to edit.
|
|
14600
|
+
*
|
|
14601
|
+
* They are not merged, because their invariants are opposites:
|
|
14602
|
+
*
|
|
14603
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
14604
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
14605
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
14606
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
14607
|
+
* and it is exactly what an absent entry cannot say.
|
|
14608
|
+
*
|
|
14609
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
14610
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
14611
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
14612
|
+
* has no process.
|
|
14613
|
+
*
|
|
14614
|
+
* ## Why not a log line, since the counters already exist
|
|
14615
|
+
*
|
|
14616
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
14617
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
14618
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
14619
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
14620
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
14621
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
14622
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
14623
|
+
* be READ.
|
|
14624
|
+
*
|
|
14625
|
+
* ## The rate is served with its denominator or not at all
|
|
14626
|
+
*
|
|
14627
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
14628
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
14629
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
14630
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
14631
|
+
* reproduces that mistake on every read.
|
|
14632
|
+
*
|
|
14633
|
+
* ## Shape
|
|
14634
|
+
*
|
|
14635
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
14636
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
14637
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
14638
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
14639
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
14640
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
14641
|
+
* result through `system.getFailureContributions`.
|
|
14642
|
+
*/
|
|
14643
|
+
var FailureReasonCountSchema = object({
|
|
14644
|
+
/**
|
|
14645
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
14646
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
14647
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
14648
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
14649
|
+
* vocabulary for the same loss would make the row and the counter
|
|
14650
|
+
* un-joinable.
|
|
14651
|
+
*/
|
|
14652
|
+
reason: string(),
|
|
14653
|
+
count: number().int().nonnegative()
|
|
14654
|
+
});
|
|
14655
|
+
var FailureContributionSchema = object({
|
|
14656
|
+
/**
|
|
14657
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
14658
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
14659
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
14660
|
+
* is a central list that rots invisibly.
|
|
14661
|
+
*/
|
|
14662
|
+
family: string(),
|
|
14663
|
+
/**
|
|
14664
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
14665
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
14666
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
14667
|
+
* cannot answer the only question anybody asks of this surface.
|
|
14668
|
+
*/
|
|
14669
|
+
deviceId: number().int().positive(),
|
|
14670
|
+
/**
|
|
14671
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
14672
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
14673
|
+
* family has a single variant.
|
|
14674
|
+
*/
|
|
14675
|
+
variant: string().optional(),
|
|
14676
|
+
/**
|
|
14677
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
14678
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
14679
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
14680
|
+
* `LoadContribution.startedAtMs`.
|
|
14681
|
+
*/
|
|
14682
|
+
sinceMs: number(),
|
|
14683
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
14684
|
+
atMs: number(),
|
|
14685
|
+
/**
|
|
14686
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
14687
|
+
* window. A failure count published without it is the mistake this schema
|
|
14688
|
+
* exists to make impossible.
|
|
14689
|
+
*/
|
|
14690
|
+
attempts: number().int().nonnegative(),
|
|
14691
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
14692
|
+
succeeded: number().int().nonnegative(),
|
|
14693
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
14694
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
14695
|
+
});
|
|
14696
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
14468
14697
|
var LoadContributionSchema = object({
|
|
14469
14698
|
role: _enum([
|
|
14470
14699
|
"decode",
|
|
@@ -19055,6 +19284,20 @@ var TrackSchema = object({
|
|
|
19055
19284
|
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
19056
19285
|
*/
|
|
19057
19286
|
hasRider: boolean().optional(),
|
|
19287
|
+
/**
|
|
19288
|
+
* WHY this track ended without a NATIVE best-shot tile
|
|
19289
|
+
* ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
|
|
19290
|
+
* a composed token line (`no-key-frame capture=keyframe:native-missx4`,
|
|
19291
|
+
* `derive-returned-null tile=standin`, …) written at close and CLEARED by
|
|
19292
|
+
* the late-keyFrame upgrade when a native tile lands after all. The
|
|
19293
|
+
* operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
19294
|
+
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
19295
|
+
*
|
|
19296
|
+
* **Absent ≠ "missed silently"**: a row written before the column, a hub
|
|
19297
|
+
* that predates the field, and every track whose tile landed native all
|
|
19298
|
+
* omit it. Render nothing when absent.
|
|
19299
|
+
*/
|
|
19300
|
+
previewMissReason: string().optional(),
|
|
19058
19301
|
...TrackFlagFields,
|
|
19059
19302
|
...TrackRetrainFields
|
|
19060
19303
|
});
|
|
@@ -30238,6 +30481,13 @@ var LoggingSettingsPatchSchema = object({
|
|
|
30238
30481
|
* anyone but its owner.
|
|
30239
30482
|
*/
|
|
30240
30483
|
var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
|
|
30484
|
+
/**
|
|
30485
|
+
* One per-camera failure counter, plus WHO reported it.
|
|
30486
|
+
*
|
|
30487
|
+
* Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
|
|
30488
|
+
* the hub as it enumerates providers, never by the contributor.
|
|
30489
|
+
*/
|
|
30490
|
+
var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
|
|
30241
30491
|
var GetLoggingSettingsInputSchema = object({
|
|
30242
30492
|
scopeNodeId: string().optional(),
|
|
30243
30493
|
/**
|
|
@@ -30296,7 +30546,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
|
|
|
30296
30546
|
}), method(_void(), SiteLocationStatusSchema, {
|
|
30297
30547
|
kind: "mutation",
|
|
30298
30548
|
auth: "admin"
|
|
30299
|
-
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
30549
|
+
}), 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, {
|
|
30300
30550
|
kind: "mutation",
|
|
30301
30551
|
auth: "admin"
|
|
30302
30552
|
});
|
|
@@ -32618,6 +32868,12 @@ Object.freeze({
|
|
|
32618
32868
|
addonId: null,
|
|
32619
32869
|
access: "view"
|
|
32620
32870
|
},
|
|
32871
|
+
"addonSettings.getIntegrationSettings": {
|
|
32872
|
+
capName: "addon-settings",
|
|
32873
|
+
capScope: "system",
|
|
32874
|
+
addonId: null,
|
|
32875
|
+
access: "view"
|
|
32876
|
+
},
|
|
32621
32877
|
"addonSettings.updateDeviceSettings": {
|
|
32622
32878
|
capName: "addon-settings",
|
|
32623
32879
|
capScope: "system",
|
|
@@ -34280,6 +34536,12 @@ Object.freeze({
|
|
|
34280
34536
|
addonId: null,
|
|
34281
34537
|
access: "create"
|
|
34282
34538
|
},
|
|
34539
|
+
"failureContribution.list": {
|
|
34540
|
+
capName: "failure-contribution",
|
|
34541
|
+
capScope: "system",
|
|
34542
|
+
addonId: null,
|
|
34543
|
+
access: "view"
|
|
34544
|
+
},
|
|
34283
34545
|
"fanControl.setDirection": {
|
|
34284
34546
|
capName: "fan-control",
|
|
34285
34547
|
capScope: "device",
|
|
@@ -37586,6 +37848,12 @@ Object.freeze({
|
|
|
37586
37848
|
addonId: null,
|
|
37587
37849
|
access: "create"
|
|
37588
37850
|
},
|
|
37851
|
+
"system.getFailureContributions": {
|
|
37852
|
+
capName: "system",
|
|
37853
|
+
capScope: "system",
|
|
37854
|
+
addonId: null,
|
|
37855
|
+
access: "view"
|
|
37856
|
+
},
|
|
37589
37857
|
"system.getLoadContributions": {
|
|
37590
37858
|
capName: "system",
|
|
37591
37859
|
capScope: "system",
|
package/dist/addon.mjs
CHANGED
|
@@ -7017,6 +7017,40 @@ var BaseAddon = class {
|
|
|
7017
7017
|
deviceSettingsSchema() {
|
|
7018
7018
|
return null;
|
|
7019
7019
|
}
|
|
7020
|
+
/**
|
|
7021
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
7022
|
+
* ARE the configuration of its integration.
|
|
7023
|
+
*
|
|
7024
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
7025
|
+
* operator should find on the addon's integration page (System →
|
|
7026
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
7027
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
7028
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
7029
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
7030
|
+
* nature of the integration.
|
|
7031
|
+
*
|
|
7032
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
7033
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
7034
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
7035
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
7036
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
7037
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
7038
|
+
*
|
|
7039
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
7040
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
7041
|
+
* removed with the reason recorded at
|
|
7042
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
7043
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
7044
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
7045
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
7046
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
7047
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
7048
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
7049
|
+
* ids it names.
|
|
7050
|
+
*/
|
|
7051
|
+
integrationSettingSections() {
|
|
7052
|
+
return [];
|
|
7053
|
+
}
|
|
7020
7054
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
7021
7055
|
const schema = this.globalSettingsSchema(cap);
|
|
7022
7056
|
if (!schema) return { sections: [] };
|
|
@@ -7027,6 +7061,55 @@ var BaseAddon = class {
|
|
|
7027
7061
|
} : projected);
|
|
7028
7062
|
}
|
|
7029
7063
|
/**
|
|
7064
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
7065
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
7066
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
7067
|
+
*
|
|
7068
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
7069
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
7070
|
+
* as a failed load.
|
|
7071
|
+
*
|
|
7072
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
7073
|
+
* and not in whichever UI happens to render this:
|
|
7074
|
+
*
|
|
7075
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
7076
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
7077
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
7078
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
7079
|
+
* not merely discouraged.
|
|
7080
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
7081
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
7082
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
7083
|
+
* who opened the page (D266).
|
|
7084
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
7085
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
7086
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
7087
|
+
*/
|
|
7088
|
+
async getIntegrationSettings(nodeId) {
|
|
7089
|
+
const declared = this.integrationSettingSections();
|
|
7090
|
+
if (declared.length === 0) return null;
|
|
7091
|
+
const schema = this.globalSettingsSchema();
|
|
7092
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
7093
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
7094
|
+
const sections = [];
|
|
7095
|
+
for (const id of declared) {
|
|
7096
|
+
const section = byId.get(id);
|
|
7097
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
7098
|
+
const fields = dropPerNodeFields(section.fields);
|
|
7099
|
+
if (fields.length === 0) continue;
|
|
7100
|
+
sections.push({
|
|
7101
|
+
...section,
|
|
7102
|
+
fields
|
|
7103
|
+
});
|
|
7104
|
+
}
|
|
7105
|
+
if (sections.length === 0) return null;
|
|
7106
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
7107
|
+
return hydrateSchema({
|
|
7108
|
+
...schema,
|
|
7109
|
+
sections
|
|
7110
|
+
}, projected);
|
|
7111
|
+
}
|
|
7112
|
+
/**
|
|
7030
7113
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
7031
7114
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
7032
7115
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -7330,6 +7413,41 @@ var BaseAddon = class {
|
|
|
7330
7413
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
7331
7414
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
7332
7415
|
*/
|
|
7416
|
+
/**
|
|
7417
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
7418
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
7419
|
+
* with no child is dropped rather than rendered empty.
|
|
7420
|
+
*
|
|
7421
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
7422
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
7423
|
+
*/
|
|
7424
|
+
function dropPerNodeFields(fields) {
|
|
7425
|
+
const kept = [];
|
|
7426
|
+
for (const field of fields) {
|
|
7427
|
+
if (field.type === "group") {
|
|
7428
|
+
const inner = dropPerNodeFields(field.fields);
|
|
7429
|
+
if (inner.length > 0) kept.push({
|
|
7430
|
+
...field,
|
|
7431
|
+
fields: inner
|
|
7432
|
+
});
|
|
7433
|
+
continue;
|
|
7434
|
+
}
|
|
7435
|
+
if (field.type === "sub-tabs") {
|
|
7436
|
+
const tabs = field.tabs.map((tab) => ({
|
|
7437
|
+
...tab,
|
|
7438
|
+
fields: dropPerNodeFields(tab.fields)
|
|
7439
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
7440
|
+
if (tabs.length > 0) kept.push({
|
|
7441
|
+
...field,
|
|
7442
|
+
tabs
|
|
7443
|
+
});
|
|
7444
|
+
continue;
|
|
7445
|
+
}
|
|
7446
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
7447
|
+
kept.push(field);
|
|
7448
|
+
}
|
|
7449
|
+
return kept;
|
|
7450
|
+
}
|
|
7333
7451
|
function collectPerNodeFieldKeys(fields) {
|
|
7334
7452
|
const collected = [];
|
|
7335
7453
|
for (const field of fields) {
|
|
@@ -10499,6 +10617,9 @@ method(object({
|
|
|
10499
10617
|
kind: "mutation",
|
|
10500
10618
|
auth: "admin"
|
|
10501
10619
|
}), method(object({
|
|
10620
|
+
addonId: string(),
|
|
10621
|
+
nodeId: string().optional()
|
|
10622
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
10502
10623
|
addonId: string(),
|
|
10503
10624
|
deviceId: number(),
|
|
10504
10625
|
nodeId: string().optional()
|
|
@@ -14464,6 +14585,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
14464
14585
|
limit: number().optional(),
|
|
14465
14586
|
tags: record(string(), string()).optional()
|
|
14466
14587
|
}), array(LogEntrySchema).readonly());
|
|
14588
|
+
/**
|
|
14589
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
14590
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
14591
|
+
*
|
|
14592
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
14593
|
+
*
|
|
14594
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
14595
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
14596
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
14597
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
14598
|
+
* somebody to forget to edit.
|
|
14599
|
+
*
|
|
14600
|
+
* They are not merged, because their invariants are opposites:
|
|
14601
|
+
*
|
|
14602
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
14603
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
14604
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
14605
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
14606
|
+
* and it is exactly what an absent entry cannot say.
|
|
14607
|
+
*
|
|
14608
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
14609
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
14610
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
14611
|
+
* has no process.
|
|
14612
|
+
*
|
|
14613
|
+
* ## Why not a log line, since the counters already exist
|
|
14614
|
+
*
|
|
14615
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
14616
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
14617
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
14618
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
14619
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
14620
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
14621
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
14622
|
+
* be READ.
|
|
14623
|
+
*
|
|
14624
|
+
* ## The rate is served with its denominator or not at all
|
|
14625
|
+
*
|
|
14626
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
14627
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
14628
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
14629
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
14630
|
+
* reproduces that mistake on every read.
|
|
14631
|
+
*
|
|
14632
|
+
* ## Shape
|
|
14633
|
+
*
|
|
14634
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
14635
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
14636
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
14637
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
14638
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
14639
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
14640
|
+
* result through `system.getFailureContributions`.
|
|
14641
|
+
*/
|
|
14642
|
+
var FailureReasonCountSchema = object({
|
|
14643
|
+
/**
|
|
14644
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
14645
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
14646
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
14647
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
14648
|
+
* vocabulary for the same loss would make the row and the counter
|
|
14649
|
+
* un-joinable.
|
|
14650
|
+
*/
|
|
14651
|
+
reason: string(),
|
|
14652
|
+
count: number().int().nonnegative()
|
|
14653
|
+
});
|
|
14654
|
+
var FailureContributionSchema = object({
|
|
14655
|
+
/**
|
|
14656
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
14657
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
14658
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
14659
|
+
* is a central list that rots invisibly.
|
|
14660
|
+
*/
|
|
14661
|
+
family: string(),
|
|
14662
|
+
/**
|
|
14663
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
14664
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
14665
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
14666
|
+
* cannot answer the only question anybody asks of this surface.
|
|
14667
|
+
*/
|
|
14668
|
+
deviceId: number().int().positive(),
|
|
14669
|
+
/**
|
|
14670
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
14671
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
14672
|
+
* family has a single variant.
|
|
14673
|
+
*/
|
|
14674
|
+
variant: string().optional(),
|
|
14675
|
+
/**
|
|
14676
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
14677
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
14678
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
14679
|
+
* `LoadContribution.startedAtMs`.
|
|
14680
|
+
*/
|
|
14681
|
+
sinceMs: number(),
|
|
14682
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
14683
|
+
atMs: number(),
|
|
14684
|
+
/**
|
|
14685
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
14686
|
+
* window. A failure count published without it is the mistake this schema
|
|
14687
|
+
* exists to make impossible.
|
|
14688
|
+
*/
|
|
14689
|
+
attempts: number().int().nonnegative(),
|
|
14690
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
14691
|
+
succeeded: number().int().nonnegative(),
|
|
14692
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
14693
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
14694
|
+
});
|
|
14695
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
14467
14696
|
var LoadContributionSchema = object({
|
|
14468
14697
|
role: _enum([
|
|
14469
14698
|
"decode",
|
|
@@ -19054,6 +19283,20 @@ var TrackSchema = object({
|
|
|
19054
19283
|
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
19055
19284
|
*/
|
|
19056
19285
|
hasRider: boolean().optional(),
|
|
19286
|
+
/**
|
|
19287
|
+
* WHY this track ended without a NATIVE best-shot tile
|
|
19288
|
+
* ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
|
|
19289
|
+
* a composed token line (`no-key-frame capture=keyframe:native-missx4`,
|
|
19290
|
+
* `derive-returned-null tile=standin`, …) written at close and CLEARED by
|
|
19291
|
+
* the late-keyFrame upgrade when a native tile lands after all. The
|
|
19292
|
+
* operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
19293
|
+
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
19294
|
+
*
|
|
19295
|
+
* **Absent ≠ "missed silently"**: a row written before the column, a hub
|
|
19296
|
+
* that predates the field, and every track whose tile landed native all
|
|
19297
|
+
* omit it. Render nothing when absent.
|
|
19298
|
+
*/
|
|
19299
|
+
previewMissReason: string().optional(),
|
|
19057
19300
|
...TrackFlagFields,
|
|
19058
19301
|
...TrackRetrainFields
|
|
19059
19302
|
});
|
|
@@ -30237,6 +30480,13 @@ var LoggingSettingsPatchSchema = object({
|
|
|
30237
30480
|
* anyone but its owner.
|
|
30238
30481
|
*/
|
|
30239
30482
|
var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
|
|
30483
|
+
/**
|
|
30484
|
+
* One per-camera failure counter, plus WHO reported it.
|
|
30485
|
+
*
|
|
30486
|
+
* Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
|
|
30487
|
+
* the hub as it enumerates providers, never by the contributor.
|
|
30488
|
+
*/
|
|
30489
|
+
var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
|
|
30240
30490
|
var GetLoggingSettingsInputSchema = object({
|
|
30241
30491
|
scopeNodeId: string().optional(),
|
|
30242
30492
|
/**
|
|
@@ -30295,7 +30545,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
|
|
|
30295
30545
|
}), method(_void(), SiteLocationStatusSchema, {
|
|
30296
30546
|
kind: "mutation",
|
|
30297
30547
|
auth: "admin"
|
|
30298
|
-
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
30548
|
+
}), 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, {
|
|
30299
30549
|
kind: "mutation",
|
|
30300
30550
|
auth: "admin"
|
|
30301
30551
|
});
|
|
@@ -32617,6 +32867,12 @@ Object.freeze({
|
|
|
32617
32867
|
addonId: null,
|
|
32618
32868
|
access: "view"
|
|
32619
32869
|
},
|
|
32870
|
+
"addonSettings.getIntegrationSettings": {
|
|
32871
|
+
capName: "addon-settings",
|
|
32872
|
+
capScope: "system",
|
|
32873
|
+
addonId: null,
|
|
32874
|
+
access: "view"
|
|
32875
|
+
},
|
|
32620
32876
|
"addonSettings.updateDeviceSettings": {
|
|
32621
32877
|
capName: "addon-settings",
|
|
32622
32878
|
capScope: "system",
|
|
@@ -34279,6 +34535,12 @@ Object.freeze({
|
|
|
34279
34535
|
addonId: null,
|
|
34280
34536
|
access: "create"
|
|
34281
34537
|
},
|
|
34538
|
+
"failureContribution.list": {
|
|
34539
|
+
capName: "failure-contribution",
|
|
34540
|
+
capScope: "system",
|
|
34541
|
+
addonId: null,
|
|
34542
|
+
access: "view"
|
|
34543
|
+
},
|
|
34282
34544
|
"fanControl.setDirection": {
|
|
34283
34545
|
capName: "fan-control",
|
|
34284
34546
|
capScope: "device",
|
|
@@ -37585,6 +37847,12 @@ Object.freeze({
|
|
|
37585
37847
|
addonId: null,
|
|
37586
37848
|
access: "create"
|
|
37587
37849
|
},
|
|
37850
|
+
"system.getFailureContributions": {
|
|
37851
|
+
capName: "system",
|
|
37852
|
+
capScope: "system",
|
|
37853
|
+
addonId: null,
|
|
37854
|
+
access: "view"
|
|
37855
|
+
},
|
|
37588
37856
|
"system.getLoadContributions": {
|
|
37589
37857
|
capName: "system",
|
|
37590
37858
|
capScope: "system",
|
package/package.json
CHANGED