@camstack/addon-provider-gree 0.2.36 → 0.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/addon.js +269 -1
- package/dist/addon.mjs +269 -1
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -5919,6 +5919,40 @@ var BaseAddon = class {
|
|
|
5919
5919
|
deviceSettingsSchema() {
|
|
5920
5920
|
return null;
|
|
5921
5921
|
}
|
|
5922
|
+
/**
|
|
5923
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
5924
|
+
* ARE the configuration of its integration.
|
|
5925
|
+
*
|
|
5926
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
5927
|
+
* operator should find on the addon's integration page (System →
|
|
5928
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
5929
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
5930
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
5931
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
5932
|
+
* nature of the integration.
|
|
5933
|
+
*
|
|
5934
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
5935
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
5936
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
5937
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
5938
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
5939
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
5940
|
+
*
|
|
5941
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
5942
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
5943
|
+
* removed with the reason recorded at
|
|
5944
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
5945
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
5946
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
5947
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
5948
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
5949
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
5950
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
5951
|
+
* ids it names.
|
|
5952
|
+
*/
|
|
5953
|
+
integrationSettingSections() {
|
|
5954
|
+
return [];
|
|
5955
|
+
}
|
|
5922
5956
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5923
5957
|
const schema = this.globalSettingsSchema(cap);
|
|
5924
5958
|
if (!schema) return { sections: [] };
|
|
@@ -5929,6 +5963,55 @@ var BaseAddon = class {
|
|
|
5929
5963
|
} : projected);
|
|
5930
5964
|
}
|
|
5931
5965
|
/**
|
|
5966
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
5967
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
5968
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
5969
|
+
*
|
|
5970
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
5971
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
5972
|
+
* as a failed load.
|
|
5973
|
+
*
|
|
5974
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
5975
|
+
* and not in whichever UI happens to render this:
|
|
5976
|
+
*
|
|
5977
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
5978
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
5979
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
5980
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
5981
|
+
* not merely discouraged.
|
|
5982
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
5983
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
5984
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
5985
|
+
* who opened the page (D266).
|
|
5986
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
5987
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
5988
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
5989
|
+
*/
|
|
5990
|
+
async getIntegrationSettings(nodeId) {
|
|
5991
|
+
const declared = this.integrationSettingSections();
|
|
5992
|
+
if (declared.length === 0) return null;
|
|
5993
|
+
const schema = this.globalSettingsSchema();
|
|
5994
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
5995
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
5996
|
+
const sections = [];
|
|
5997
|
+
for (const id of declared) {
|
|
5998
|
+
const section = byId.get(id);
|
|
5999
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
6000
|
+
const fields = dropPerNodeFields(section.fields);
|
|
6001
|
+
if (fields.length === 0) continue;
|
|
6002
|
+
sections.push({
|
|
6003
|
+
...section,
|
|
6004
|
+
fields
|
|
6005
|
+
});
|
|
6006
|
+
}
|
|
6007
|
+
if (sections.length === 0) return null;
|
|
6008
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6009
|
+
return hydrateSchema({
|
|
6010
|
+
...schema,
|
|
6011
|
+
sections
|
|
6012
|
+
}, projected);
|
|
6013
|
+
}
|
|
6014
|
+
/**
|
|
5932
6015
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5933
6016
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5934
6017
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6232,6 +6315,41 @@ var BaseAddon = class {
|
|
|
6232
6315
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6233
6316
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6234
6317
|
*/
|
|
6318
|
+
/**
|
|
6319
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6320
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6321
|
+
* with no child is dropped rather than rendered empty.
|
|
6322
|
+
*
|
|
6323
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6324
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6325
|
+
*/
|
|
6326
|
+
function dropPerNodeFields(fields) {
|
|
6327
|
+
const kept = [];
|
|
6328
|
+
for (const field of fields) {
|
|
6329
|
+
if (field.type === "group") {
|
|
6330
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6331
|
+
if (inner.length > 0) kept.push({
|
|
6332
|
+
...field,
|
|
6333
|
+
fields: inner
|
|
6334
|
+
});
|
|
6335
|
+
continue;
|
|
6336
|
+
}
|
|
6337
|
+
if (field.type === "sub-tabs") {
|
|
6338
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6339
|
+
...tab,
|
|
6340
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6341
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6342
|
+
if (tabs.length > 0) kept.push({
|
|
6343
|
+
...field,
|
|
6344
|
+
tabs
|
|
6345
|
+
});
|
|
6346
|
+
continue;
|
|
6347
|
+
}
|
|
6348
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6349
|
+
kept.push(field);
|
|
6350
|
+
}
|
|
6351
|
+
return kept;
|
|
6352
|
+
}
|
|
6235
6353
|
function collectPerNodeFieldKeys(fields) {
|
|
6236
6354
|
const collected = [];
|
|
6237
6355
|
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()
|
|
@@ -13349,6 +13470,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
13349
13470
|
limit: number().optional(),
|
|
13350
13471
|
tags: record(string(), string()).optional()
|
|
13351
13472
|
}), array(LogEntrySchema).readonly());
|
|
13473
|
+
/**
|
|
13474
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
13475
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
13476
|
+
*
|
|
13477
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
13478
|
+
*
|
|
13479
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
13480
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
13481
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
13482
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
13483
|
+
* somebody to forget to edit.
|
|
13484
|
+
*
|
|
13485
|
+
* They are not merged, because their invariants are opposites:
|
|
13486
|
+
*
|
|
13487
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
13488
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
13489
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
13490
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
13491
|
+
* and it is exactly what an absent entry cannot say.
|
|
13492
|
+
*
|
|
13493
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
13494
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
13495
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
13496
|
+
* has no process.
|
|
13497
|
+
*
|
|
13498
|
+
* ## Why not a log line, since the counters already exist
|
|
13499
|
+
*
|
|
13500
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
13501
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
13502
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
13503
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
13504
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
13505
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
13506
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
13507
|
+
* be READ.
|
|
13508
|
+
*
|
|
13509
|
+
* ## The rate is served with its denominator or not at all
|
|
13510
|
+
*
|
|
13511
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
13512
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
13513
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
13514
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
13515
|
+
* reproduces that mistake on every read.
|
|
13516
|
+
*
|
|
13517
|
+
* ## Shape
|
|
13518
|
+
*
|
|
13519
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
13520
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
13521
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
13522
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
13523
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
13524
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
13525
|
+
* result through `system.getFailureContributions`.
|
|
13526
|
+
*/
|
|
13527
|
+
var FailureReasonCountSchema = object({
|
|
13528
|
+
/**
|
|
13529
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
13530
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
13531
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
13532
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
13533
|
+
* vocabulary for the same loss would make the row and the counter
|
|
13534
|
+
* un-joinable.
|
|
13535
|
+
*/
|
|
13536
|
+
reason: string(),
|
|
13537
|
+
count: number().int().nonnegative()
|
|
13538
|
+
});
|
|
13539
|
+
var FailureContributionSchema = object({
|
|
13540
|
+
/**
|
|
13541
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
13542
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
13543
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
13544
|
+
* is a central list that rots invisibly.
|
|
13545
|
+
*/
|
|
13546
|
+
family: string(),
|
|
13547
|
+
/**
|
|
13548
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
13549
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
13550
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
13551
|
+
* cannot answer the only question anybody asks of this surface.
|
|
13552
|
+
*/
|
|
13553
|
+
deviceId: number().int().positive(),
|
|
13554
|
+
/**
|
|
13555
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
13556
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
13557
|
+
* family has a single variant.
|
|
13558
|
+
*/
|
|
13559
|
+
variant: string().optional(),
|
|
13560
|
+
/**
|
|
13561
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
13562
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
13563
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
13564
|
+
* `LoadContribution.startedAtMs`.
|
|
13565
|
+
*/
|
|
13566
|
+
sinceMs: number(),
|
|
13567
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
13568
|
+
atMs: number(),
|
|
13569
|
+
/**
|
|
13570
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
13571
|
+
* window. A failure count published without it is the mistake this schema
|
|
13572
|
+
* exists to make impossible.
|
|
13573
|
+
*/
|
|
13574
|
+
attempts: number().int().nonnegative(),
|
|
13575
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
13576
|
+
succeeded: number().int().nonnegative(),
|
|
13577
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
13578
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
13579
|
+
});
|
|
13580
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
13352
13581
|
var LoadContributionSchema = object({
|
|
13353
13582
|
role: _enum([
|
|
13354
13583
|
"decode",
|
|
@@ -17939,6 +18168,20 @@ var TrackSchema = object({
|
|
|
17939
18168
|
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
17940
18169
|
*/
|
|
17941
18170
|
hasRider: boolean().optional(),
|
|
18171
|
+
/**
|
|
18172
|
+
* WHY this track ended without a NATIVE best-shot tile
|
|
18173
|
+
* ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
|
|
18174
|
+
* a composed token line (`no-key-frame capture=keyframe:native-missx4`,
|
|
18175
|
+
* `derive-returned-null tile=standin`, …) written at close and CLEARED by
|
|
18176
|
+
* the late-keyFrame upgrade when a native tile lands after all. The
|
|
18177
|
+
* operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
18178
|
+
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
18179
|
+
*
|
|
18180
|
+
* **Absent ≠ "missed silently"**: a row written before the column, a hub
|
|
18181
|
+
* that predates the field, and every track whose tile landed native all
|
|
18182
|
+
* omit it. Render nothing when absent.
|
|
18183
|
+
*/
|
|
18184
|
+
previewMissReason: string().optional(),
|
|
17942
18185
|
...TrackFlagFields,
|
|
17943
18186
|
...TrackRetrainFields
|
|
17944
18187
|
});
|
|
@@ -29114,6 +29357,13 @@ var LoggingSettingsPatchSchema = object({
|
|
|
29114
29357
|
* anyone but its owner.
|
|
29115
29358
|
*/
|
|
29116
29359
|
var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
|
|
29360
|
+
/**
|
|
29361
|
+
* One per-camera failure counter, plus WHO reported it.
|
|
29362
|
+
*
|
|
29363
|
+
* Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
|
|
29364
|
+
* the hub as it enumerates providers, never by the contributor.
|
|
29365
|
+
*/
|
|
29366
|
+
var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
|
|
29117
29367
|
var GetLoggingSettingsInputSchema = object({
|
|
29118
29368
|
scopeNodeId: string().optional(),
|
|
29119
29369
|
/**
|
|
@@ -29172,7 +29422,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
|
|
|
29172
29422
|
}), method(_void(), SiteLocationStatusSchema, {
|
|
29173
29423
|
kind: "mutation",
|
|
29174
29424
|
auth: "admin"
|
|
29175
|
-
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
29425
|
+
}), 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, {
|
|
29176
29426
|
kind: "mutation",
|
|
29177
29427
|
auth: "admin"
|
|
29178
29428
|
});
|
|
@@ -31494,6 +31744,12 @@ Object.freeze({
|
|
|
31494
31744
|
addonId: null,
|
|
31495
31745
|
access: "view"
|
|
31496
31746
|
},
|
|
31747
|
+
"addonSettings.getIntegrationSettings": {
|
|
31748
|
+
capName: "addon-settings",
|
|
31749
|
+
capScope: "system",
|
|
31750
|
+
addonId: null,
|
|
31751
|
+
access: "view"
|
|
31752
|
+
},
|
|
31497
31753
|
"addonSettings.updateDeviceSettings": {
|
|
31498
31754
|
capName: "addon-settings",
|
|
31499
31755
|
capScope: "system",
|
|
@@ -33156,6 +33412,12 @@ Object.freeze({
|
|
|
33156
33412
|
addonId: null,
|
|
33157
33413
|
access: "create"
|
|
33158
33414
|
},
|
|
33415
|
+
"failureContribution.list": {
|
|
33416
|
+
capName: "failure-contribution",
|
|
33417
|
+
capScope: "system",
|
|
33418
|
+
addonId: null,
|
|
33419
|
+
access: "view"
|
|
33420
|
+
},
|
|
33159
33421
|
"fanControl.setDirection": {
|
|
33160
33422
|
capName: "fan-control",
|
|
33161
33423
|
capScope: "device",
|
|
@@ -36462,6 +36724,12 @@ Object.freeze({
|
|
|
36462
36724
|
addonId: null,
|
|
36463
36725
|
access: "create"
|
|
36464
36726
|
},
|
|
36727
|
+
"system.getFailureContributions": {
|
|
36728
|
+
capName: "system",
|
|
36729
|
+
capScope: "system",
|
|
36730
|
+
addonId: null,
|
|
36731
|
+
access: "view"
|
|
36732
|
+
},
|
|
36465
36733
|
"system.getLoadContributions": {
|
|
36466
36734
|
capName: "system",
|
|
36467
36735
|
capScope: "system",
|
package/dist/addon.mjs
CHANGED
|
@@ -5918,6 +5918,40 @@ var BaseAddon = class {
|
|
|
5918
5918
|
deviceSettingsSchema() {
|
|
5919
5919
|
return null;
|
|
5920
5920
|
}
|
|
5921
|
+
/**
|
|
5922
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
5923
|
+
* ARE the configuration of its integration.
|
|
5924
|
+
*
|
|
5925
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
5926
|
+
* operator should find on the addon's integration page (System →
|
|
5927
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
5928
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
5929
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
5930
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
5931
|
+
* nature of the integration.
|
|
5932
|
+
*
|
|
5933
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
5934
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
5935
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
5936
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
5937
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
5938
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
5939
|
+
*
|
|
5940
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
5941
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
5942
|
+
* removed with the reason recorded at
|
|
5943
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
5944
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
5945
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
5946
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
5947
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
5948
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
5949
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
5950
|
+
* ids it names.
|
|
5951
|
+
*/
|
|
5952
|
+
integrationSettingSections() {
|
|
5953
|
+
return [];
|
|
5954
|
+
}
|
|
5921
5955
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5922
5956
|
const schema = this.globalSettingsSchema(cap);
|
|
5923
5957
|
if (!schema) return { sections: [] };
|
|
@@ -5928,6 +5962,55 @@ var BaseAddon = class {
|
|
|
5928
5962
|
} : projected);
|
|
5929
5963
|
}
|
|
5930
5964
|
/**
|
|
5965
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
5966
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
5967
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
5968
|
+
*
|
|
5969
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
5970
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
5971
|
+
* as a failed load.
|
|
5972
|
+
*
|
|
5973
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
5974
|
+
* and not in whichever UI happens to render this:
|
|
5975
|
+
*
|
|
5976
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
5977
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
5978
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
5979
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
5980
|
+
* not merely discouraged.
|
|
5981
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
5982
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
5983
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
5984
|
+
* who opened the page (D266).
|
|
5985
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
5986
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
5987
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
5988
|
+
*/
|
|
5989
|
+
async getIntegrationSettings(nodeId) {
|
|
5990
|
+
const declared = this.integrationSettingSections();
|
|
5991
|
+
if (declared.length === 0) return null;
|
|
5992
|
+
const schema = this.globalSettingsSchema();
|
|
5993
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
5994
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
5995
|
+
const sections = [];
|
|
5996
|
+
for (const id of declared) {
|
|
5997
|
+
const section = byId.get(id);
|
|
5998
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
5999
|
+
const fields = dropPerNodeFields(section.fields);
|
|
6000
|
+
if (fields.length === 0) continue;
|
|
6001
|
+
sections.push({
|
|
6002
|
+
...section,
|
|
6003
|
+
fields
|
|
6004
|
+
});
|
|
6005
|
+
}
|
|
6006
|
+
if (sections.length === 0) return null;
|
|
6007
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6008
|
+
return hydrateSchema({
|
|
6009
|
+
...schema,
|
|
6010
|
+
sections
|
|
6011
|
+
}, projected);
|
|
6012
|
+
}
|
|
6013
|
+
/**
|
|
5931
6014
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5932
6015
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5933
6016
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6231,6 +6314,41 @@ var BaseAddon = class {
|
|
|
6231
6314
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6232
6315
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6233
6316
|
*/
|
|
6317
|
+
/**
|
|
6318
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6319
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6320
|
+
* with no child is dropped rather than rendered empty.
|
|
6321
|
+
*
|
|
6322
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6323
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6324
|
+
*/
|
|
6325
|
+
function dropPerNodeFields(fields) {
|
|
6326
|
+
const kept = [];
|
|
6327
|
+
for (const field of fields) {
|
|
6328
|
+
if (field.type === "group") {
|
|
6329
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6330
|
+
if (inner.length > 0) kept.push({
|
|
6331
|
+
...field,
|
|
6332
|
+
fields: inner
|
|
6333
|
+
});
|
|
6334
|
+
continue;
|
|
6335
|
+
}
|
|
6336
|
+
if (field.type === "sub-tabs") {
|
|
6337
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6338
|
+
...tab,
|
|
6339
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6340
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6341
|
+
if (tabs.length > 0) kept.push({
|
|
6342
|
+
...field,
|
|
6343
|
+
tabs
|
|
6344
|
+
});
|
|
6345
|
+
continue;
|
|
6346
|
+
}
|
|
6347
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6348
|
+
kept.push(field);
|
|
6349
|
+
}
|
|
6350
|
+
return kept;
|
|
6351
|
+
}
|
|
6234
6352
|
function collectPerNodeFieldKeys(fields) {
|
|
6235
6353
|
const collected = [];
|
|
6236
6354
|
for (const field of fields) {
|
|
@@ -9400,6 +9518,9 @@ method(object({
|
|
|
9400
9518
|
kind: "mutation",
|
|
9401
9519
|
auth: "admin"
|
|
9402
9520
|
}), method(object({
|
|
9521
|
+
addonId: string(),
|
|
9522
|
+
nodeId: string().optional()
|
|
9523
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
9403
9524
|
addonId: string(),
|
|
9404
9525
|
deviceId: number(),
|
|
9405
9526
|
nodeId: string().optional()
|
|
@@ -13348,6 +13469,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
13348
13469
|
limit: number().optional(),
|
|
13349
13470
|
tags: record(string(), string()).optional()
|
|
13350
13471
|
}), array(LogEntrySchema).readonly());
|
|
13472
|
+
/**
|
|
13473
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
13474
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
13475
|
+
*
|
|
13476
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
13477
|
+
*
|
|
13478
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
13479
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
13480
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
13481
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
13482
|
+
* somebody to forget to edit.
|
|
13483
|
+
*
|
|
13484
|
+
* They are not merged, because their invariants are opposites:
|
|
13485
|
+
*
|
|
13486
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
13487
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
13488
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
13489
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
13490
|
+
* and it is exactly what an absent entry cannot say.
|
|
13491
|
+
*
|
|
13492
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
13493
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
13494
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
13495
|
+
* has no process.
|
|
13496
|
+
*
|
|
13497
|
+
* ## Why not a log line, since the counters already exist
|
|
13498
|
+
*
|
|
13499
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
13500
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
13501
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
13502
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
13503
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
13504
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
13505
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
13506
|
+
* be READ.
|
|
13507
|
+
*
|
|
13508
|
+
* ## The rate is served with its denominator or not at all
|
|
13509
|
+
*
|
|
13510
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
13511
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
13512
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
13513
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
13514
|
+
* reproduces that mistake on every read.
|
|
13515
|
+
*
|
|
13516
|
+
* ## Shape
|
|
13517
|
+
*
|
|
13518
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
13519
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
13520
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
13521
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
13522
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
13523
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
13524
|
+
* result through `system.getFailureContributions`.
|
|
13525
|
+
*/
|
|
13526
|
+
var FailureReasonCountSchema = object({
|
|
13527
|
+
/**
|
|
13528
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
13529
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
13530
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
13531
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
13532
|
+
* vocabulary for the same loss would make the row and the counter
|
|
13533
|
+
* un-joinable.
|
|
13534
|
+
*/
|
|
13535
|
+
reason: string(),
|
|
13536
|
+
count: number().int().nonnegative()
|
|
13537
|
+
});
|
|
13538
|
+
var FailureContributionSchema = object({
|
|
13539
|
+
/**
|
|
13540
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
13541
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
13542
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
13543
|
+
* is a central list that rots invisibly.
|
|
13544
|
+
*/
|
|
13545
|
+
family: string(),
|
|
13546
|
+
/**
|
|
13547
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
13548
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
13549
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
13550
|
+
* cannot answer the only question anybody asks of this surface.
|
|
13551
|
+
*/
|
|
13552
|
+
deviceId: number().int().positive(),
|
|
13553
|
+
/**
|
|
13554
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
13555
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
13556
|
+
* family has a single variant.
|
|
13557
|
+
*/
|
|
13558
|
+
variant: string().optional(),
|
|
13559
|
+
/**
|
|
13560
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
13561
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
13562
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
13563
|
+
* `LoadContribution.startedAtMs`.
|
|
13564
|
+
*/
|
|
13565
|
+
sinceMs: number(),
|
|
13566
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
13567
|
+
atMs: number(),
|
|
13568
|
+
/**
|
|
13569
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
13570
|
+
* window. A failure count published without it is the mistake this schema
|
|
13571
|
+
* exists to make impossible.
|
|
13572
|
+
*/
|
|
13573
|
+
attempts: number().int().nonnegative(),
|
|
13574
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
13575
|
+
succeeded: number().int().nonnegative(),
|
|
13576
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
13577
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
13578
|
+
});
|
|
13579
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
13351
13580
|
var LoadContributionSchema = object({
|
|
13352
13581
|
role: _enum([
|
|
13353
13582
|
"decode",
|
|
@@ -17938,6 +18167,20 @@ var TrackSchema = object({
|
|
|
17938
18167
|
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
17939
18168
|
*/
|
|
17940
18169
|
hasRider: boolean().optional(),
|
|
18170
|
+
/**
|
|
18171
|
+
* WHY this track ended without a NATIVE best-shot tile
|
|
18172
|
+
* ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
|
|
18173
|
+
* a composed token line (`no-key-frame capture=keyframe:native-missx4`,
|
|
18174
|
+
* `derive-returned-null tile=standin`, …) written at close and CLEARED by
|
|
18175
|
+
* the late-keyFrame upgrade when a native tile lands after all. The
|
|
18176
|
+
* operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
18177
|
+
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
18178
|
+
*
|
|
18179
|
+
* **Absent ≠ "missed silently"**: a row written before the column, a hub
|
|
18180
|
+
* that predates the field, and every track whose tile landed native all
|
|
18181
|
+
* omit it. Render nothing when absent.
|
|
18182
|
+
*/
|
|
18183
|
+
previewMissReason: string().optional(),
|
|
17941
18184
|
...TrackFlagFields,
|
|
17942
18185
|
...TrackRetrainFields
|
|
17943
18186
|
});
|
|
@@ -29113,6 +29356,13 @@ var LoggingSettingsPatchSchema = object({
|
|
|
29113
29356
|
* anyone but its owner.
|
|
29114
29357
|
*/
|
|
29115
29358
|
var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
|
|
29359
|
+
/**
|
|
29360
|
+
* One per-camera failure counter, plus WHO reported it.
|
|
29361
|
+
*
|
|
29362
|
+
* Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
|
|
29363
|
+
* the hub as it enumerates providers, never by the contributor.
|
|
29364
|
+
*/
|
|
29365
|
+
var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
|
|
29116
29366
|
var GetLoggingSettingsInputSchema = object({
|
|
29117
29367
|
scopeNodeId: string().optional(),
|
|
29118
29368
|
/**
|
|
@@ -29171,7 +29421,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
|
|
|
29171
29421
|
}), method(_void(), SiteLocationStatusSchema, {
|
|
29172
29422
|
kind: "mutation",
|
|
29173
29423
|
auth: "admin"
|
|
29174
|
-
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
29424
|
+
}), 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, {
|
|
29175
29425
|
kind: "mutation",
|
|
29176
29426
|
auth: "admin"
|
|
29177
29427
|
});
|
|
@@ -31493,6 +31743,12 @@ Object.freeze({
|
|
|
31493
31743
|
addonId: null,
|
|
31494
31744
|
access: "view"
|
|
31495
31745
|
},
|
|
31746
|
+
"addonSettings.getIntegrationSettings": {
|
|
31747
|
+
capName: "addon-settings",
|
|
31748
|
+
capScope: "system",
|
|
31749
|
+
addonId: null,
|
|
31750
|
+
access: "view"
|
|
31751
|
+
},
|
|
31496
31752
|
"addonSettings.updateDeviceSettings": {
|
|
31497
31753
|
capName: "addon-settings",
|
|
31498
31754
|
capScope: "system",
|
|
@@ -33155,6 +33411,12 @@ Object.freeze({
|
|
|
33155
33411
|
addonId: null,
|
|
33156
33412
|
access: "create"
|
|
33157
33413
|
},
|
|
33414
|
+
"failureContribution.list": {
|
|
33415
|
+
capName: "failure-contribution",
|
|
33416
|
+
capScope: "system",
|
|
33417
|
+
addonId: null,
|
|
33418
|
+
access: "view"
|
|
33419
|
+
},
|
|
33158
33420
|
"fanControl.setDirection": {
|
|
33159
33421
|
capName: "fan-control",
|
|
33160
33422
|
capScope: "device",
|
|
@@ -36461,6 +36723,12 @@ Object.freeze({
|
|
|
36461
36723
|
addonId: null,
|
|
36462
36724
|
access: "create"
|
|
36463
36725
|
},
|
|
36726
|
+
"system.getFailureContributions": {
|
|
36727
|
+
capName: "system",
|
|
36728
|
+
capScope: "system",
|
|
36729
|
+
addonId: null,
|
|
36730
|
+
access: "view"
|
|
36731
|
+
},
|
|
36464
36732
|
"system.getLoadContributions": {
|
|
36465
36733
|
capName: "system",
|
|
36466
36734
|
capScope: "system",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-provider-gree",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.38",
|
|
4
4
|
"description": "Gree air-conditioner device-provider addon for CamStack — wraps the @apocaliss92/nodegree local-UDP client (LAN discovery + AES control), exposing climate-control and fan-control",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|