@camstack/addon-provider-dreo 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
|
@@ -5952,6 +5952,40 @@ var BaseAddon = class {
|
|
|
5952
5952
|
deviceSettingsSchema() {
|
|
5953
5953
|
return null;
|
|
5954
5954
|
}
|
|
5955
|
+
/**
|
|
5956
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
5957
|
+
* ARE the configuration of its integration.
|
|
5958
|
+
*
|
|
5959
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
5960
|
+
* operator should find on the addon's integration page (System →
|
|
5961
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
5962
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
5963
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
5964
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
5965
|
+
* nature of the integration.
|
|
5966
|
+
*
|
|
5967
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
5968
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
5969
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
5970
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
5971
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
5972
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
5973
|
+
*
|
|
5974
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
5975
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
5976
|
+
* removed with the reason recorded at
|
|
5977
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
5978
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
5979
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
5980
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
5981
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
5982
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
5983
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
5984
|
+
* ids it names.
|
|
5985
|
+
*/
|
|
5986
|
+
integrationSettingSections() {
|
|
5987
|
+
return [];
|
|
5988
|
+
}
|
|
5955
5989
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5956
5990
|
const schema = this.globalSettingsSchema(cap);
|
|
5957
5991
|
if (!schema) return { sections: [] };
|
|
@@ -5962,6 +5996,55 @@ var BaseAddon = class {
|
|
|
5962
5996
|
} : projected);
|
|
5963
5997
|
}
|
|
5964
5998
|
/**
|
|
5999
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
6000
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
6001
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
6002
|
+
*
|
|
6003
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
6004
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
6005
|
+
* as a failed load.
|
|
6006
|
+
*
|
|
6007
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
6008
|
+
* and not in whichever UI happens to render this:
|
|
6009
|
+
*
|
|
6010
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
6011
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
6012
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
6013
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
6014
|
+
* not merely discouraged.
|
|
6015
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
6016
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
6017
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
6018
|
+
* who opened the page (D266).
|
|
6019
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
6020
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
6021
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
6022
|
+
*/
|
|
6023
|
+
async getIntegrationSettings(nodeId) {
|
|
6024
|
+
const declared = this.integrationSettingSections();
|
|
6025
|
+
if (declared.length === 0) return null;
|
|
6026
|
+
const schema = this.globalSettingsSchema();
|
|
6027
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
6028
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
6029
|
+
const sections = [];
|
|
6030
|
+
for (const id of declared) {
|
|
6031
|
+
const section = byId.get(id);
|
|
6032
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
6033
|
+
const fields = dropPerNodeFields(section.fields);
|
|
6034
|
+
if (fields.length === 0) continue;
|
|
6035
|
+
sections.push({
|
|
6036
|
+
...section,
|
|
6037
|
+
fields
|
|
6038
|
+
});
|
|
6039
|
+
}
|
|
6040
|
+
if (sections.length === 0) return null;
|
|
6041
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6042
|
+
return hydrateSchema({
|
|
6043
|
+
...schema,
|
|
6044
|
+
sections
|
|
6045
|
+
}, projected);
|
|
6046
|
+
}
|
|
6047
|
+
/**
|
|
5965
6048
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5966
6049
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5967
6050
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6265,6 +6348,41 @@ var BaseAddon = class {
|
|
|
6265
6348
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6266
6349
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6267
6350
|
*/
|
|
6351
|
+
/**
|
|
6352
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6353
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6354
|
+
* with no child is dropped rather than rendered empty.
|
|
6355
|
+
*
|
|
6356
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6357
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6358
|
+
*/
|
|
6359
|
+
function dropPerNodeFields(fields) {
|
|
6360
|
+
const kept = [];
|
|
6361
|
+
for (const field of fields) {
|
|
6362
|
+
if (field.type === "group") {
|
|
6363
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6364
|
+
if (inner.length > 0) kept.push({
|
|
6365
|
+
...field,
|
|
6366
|
+
fields: inner
|
|
6367
|
+
});
|
|
6368
|
+
continue;
|
|
6369
|
+
}
|
|
6370
|
+
if (field.type === "sub-tabs") {
|
|
6371
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6372
|
+
...tab,
|
|
6373
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6374
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6375
|
+
if (tabs.length > 0) kept.push({
|
|
6376
|
+
...field,
|
|
6377
|
+
tabs
|
|
6378
|
+
});
|
|
6379
|
+
continue;
|
|
6380
|
+
}
|
|
6381
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6382
|
+
kept.push(field);
|
|
6383
|
+
}
|
|
6384
|
+
return kept;
|
|
6385
|
+
}
|
|
6268
6386
|
function collectPerNodeFieldKeys(fields) {
|
|
6269
6387
|
const collected = [];
|
|
6270
6388
|
for (const field of fields) {
|
|
@@ -9434,6 +9552,9 @@ method(object({
|
|
|
9434
9552
|
kind: "mutation",
|
|
9435
9553
|
auth: "admin"
|
|
9436
9554
|
}), method(object({
|
|
9555
|
+
addonId: string(),
|
|
9556
|
+
nodeId: string().optional()
|
|
9557
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
9437
9558
|
addonId: string(),
|
|
9438
9559
|
deviceId: number(),
|
|
9439
9560
|
nodeId: string().optional()
|
|
@@ -13399,6 +13520,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
13399
13520
|
limit: number().optional(),
|
|
13400
13521
|
tags: record(string(), string()).optional()
|
|
13401
13522
|
}), array(LogEntrySchema).readonly());
|
|
13523
|
+
/**
|
|
13524
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
13525
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
13526
|
+
*
|
|
13527
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
13528
|
+
*
|
|
13529
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
13530
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
13531
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
13532
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
13533
|
+
* somebody to forget to edit.
|
|
13534
|
+
*
|
|
13535
|
+
* They are not merged, because their invariants are opposites:
|
|
13536
|
+
*
|
|
13537
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
13538
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
13539
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
13540
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
13541
|
+
* and it is exactly what an absent entry cannot say.
|
|
13542
|
+
*
|
|
13543
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
13544
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
13545
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
13546
|
+
* has no process.
|
|
13547
|
+
*
|
|
13548
|
+
* ## Why not a log line, since the counters already exist
|
|
13549
|
+
*
|
|
13550
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
13551
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
13552
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
13553
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
13554
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
13555
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
13556
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
13557
|
+
* be READ.
|
|
13558
|
+
*
|
|
13559
|
+
* ## The rate is served with its denominator or not at all
|
|
13560
|
+
*
|
|
13561
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
13562
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
13563
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
13564
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
13565
|
+
* reproduces that mistake on every read.
|
|
13566
|
+
*
|
|
13567
|
+
* ## Shape
|
|
13568
|
+
*
|
|
13569
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
13570
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
13571
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
13572
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
13573
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
13574
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
13575
|
+
* result through `system.getFailureContributions`.
|
|
13576
|
+
*/
|
|
13577
|
+
var FailureReasonCountSchema = object({
|
|
13578
|
+
/**
|
|
13579
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
13580
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
13581
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
13582
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
13583
|
+
* vocabulary for the same loss would make the row and the counter
|
|
13584
|
+
* un-joinable.
|
|
13585
|
+
*/
|
|
13586
|
+
reason: string(),
|
|
13587
|
+
count: number().int().nonnegative()
|
|
13588
|
+
});
|
|
13589
|
+
var FailureContributionSchema = object({
|
|
13590
|
+
/**
|
|
13591
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
13592
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
13593
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
13594
|
+
* is a central list that rots invisibly.
|
|
13595
|
+
*/
|
|
13596
|
+
family: string(),
|
|
13597
|
+
/**
|
|
13598
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
13599
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
13600
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
13601
|
+
* cannot answer the only question anybody asks of this surface.
|
|
13602
|
+
*/
|
|
13603
|
+
deviceId: number().int().positive(),
|
|
13604
|
+
/**
|
|
13605
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
13606
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
13607
|
+
* family has a single variant.
|
|
13608
|
+
*/
|
|
13609
|
+
variant: string().optional(),
|
|
13610
|
+
/**
|
|
13611
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
13612
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
13613
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
13614
|
+
* `LoadContribution.startedAtMs`.
|
|
13615
|
+
*/
|
|
13616
|
+
sinceMs: number(),
|
|
13617
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
13618
|
+
atMs: number(),
|
|
13619
|
+
/**
|
|
13620
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
13621
|
+
* window. A failure count published without it is the mistake this schema
|
|
13622
|
+
* exists to make impossible.
|
|
13623
|
+
*/
|
|
13624
|
+
attempts: number().int().nonnegative(),
|
|
13625
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
13626
|
+
succeeded: number().int().nonnegative(),
|
|
13627
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
13628
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
13629
|
+
});
|
|
13630
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
13402
13631
|
var LoadContributionSchema = object({
|
|
13403
13632
|
role: _enum([
|
|
13404
13633
|
"decode",
|
|
@@ -17989,6 +18218,20 @@ var TrackSchema = object({
|
|
|
17989
18218
|
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
17990
18219
|
*/
|
|
17991
18220
|
hasRider: boolean().optional(),
|
|
18221
|
+
/**
|
|
18222
|
+
* WHY this track ended without a NATIVE best-shot tile
|
|
18223
|
+
* ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
|
|
18224
|
+
* a composed token line (`no-key-frame capture=keyframe:native-missx4`,
|
|
18225
|
+
* `derive-returned-null tile=standin`, …) written at close and CLEARED by
|
|
18226
|
+
* the late-keyFrame upgrade when a native tile lands after all. The
|
|
18227
|
+
* operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
18228
|
+
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
18229
|
+
*
|
|
18230
|
+
* **Absent ≠ "missed silently"**: a row written before the column, a hub
|
|
18231
|
+
* that predates the field, and every track whose tile landed native all
|
|
18232
|
+
* omit it. Render nothing when absent.
|
|
18233
|
+
*/
|
|
18234
|
+
previewMissReason: string().optional(),
|
|
17992
18235
|
...TrackFlagFields,
|
|
17993
18236
|
...TrackRetrainFields
|
|
17994
18237
|
});
|
|
@@ -29172,6 +29415,13 @@ var LoggingSettingsPatchSchema = object({
|
|
|
29172
29415
|
* anyone but its owner.
|
|
29173
29416
|
*/
|
|
29174
29417
|
var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
|
|
29418
|
+
/**
|
|
29419
|
+
* One per-camera failure counter, plus WHO reported it.
|
|
29420
|
+
*
|
|
29421
|
+
* Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
|
|
29422
|
+
* the hub as it enumerates providers, never by the contributor.
|
|
29423
|
+
*/
|
|
29424
|
+
var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
|
|
29175
29425
|
var GetLoggingSettingsInputSchema = object({
|
|
29176
29426
|
scopeNodeId: string().optional(),
|
|
29177
29427
|
/**
|
|
@@ -29230,7 +29480,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
|
|
|
29230
29480
|
}), method(_void(), SiteLocationStatusSchema, {
|
|
29231
29481
|
kind: "mutation",
|
|
29232
29482
|
auth: "admin"
|
|
29233
|
-
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
29483
|
+
}), 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, {
|
|
29234
29484
|
kind: "mutation",
|
|
29235
29485
|
auth: "admin"
|
|
29236
29486
|
});
|
|
@@ -31552,6 +31802,12 @@ Object.freeze({
|
|
|
31552
31802
|
addonId: null,
|
|
31553
31803
|
access: "view"
|
|
31554
31804
|
},
|
|
31805
|
+
"addonSettings.getIntegrationSettings": {
|
|
31806
|
+
capName: "addon-settings",
|
|
31807
|
+
capScope: "system",
|
|
31808
|
+
addonId: null,
|
|
31809
|
+
access: "view"
|
|
31810
|
+
},
|
|
31555
31811
|
"addonSettings.updateDeviceSettings": {
|
|
31556
31812
|
capName: "addon-settings",
|
|
31557
31813
|
capScope: "system",
|
|
@@ -33214,6 +33470,12 @@ Object.freeze({
|
|
|
33214
33470
|
addonId: null,
|
|
33215
33471
|
access: "create"
|
|
33216
33472
|
},
|
|
33473
|
+
"failureContribution.list": {
|
|
33474
|
+
capName: "failure-contribution",
|
|
33475
|
+
capScope: "system",
|
|
33476
|
+
addonId: null,
|
|
33477
|
+
access: "view"
|
|
33478
|
+
},
|
|
33217
33479
|
"fanControl.setDirection": {
|
|
33218
33480
|
capName: "fan-control",
|
|
33219
33481
|
capScope: "device",
|
|
@@ -36520,6 +36782,12 @@ Object.freeze({
|
|
|
36520
36782
|
addonId: null,
|
|
36521
36783
|
access: "create"
|
|
36522
36784
|
},
|
|
36785
|
+
"system.getFailureContributions": {
|
|
36786
|
+
capName: "system",
|
|
36787
|
+
capScope: "system",
|
|
36788
|
+
addonId: null,
|
|
36789
|
+
access: "view"
|
|
36790
|
+
},
|
|
36523
36791
|
"system.getLoadContributions": {
|
|
36524
36792
|
capName: "system",
|
|
36525
36793
|
capScope: "system",
|
package/dist/addon.mjs
CHANGED
|
@@ -5953,6 +5953,40 @@ var BaseAddon = class {
|
|
|
5953
5953
|
deviceSettingsSchema() {
|
|
5954
5954
|
return null;
|
|
5955
5955
|
}
|
|
5956
|
+
/**
|
|
5957
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
5958
|
+
* ARE the configuration of its integration.
|
|
5959
|
+
*
|
|
5960
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
5961
|
+
* operator should find on the addon's integration page (System →
|
|
5962
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
5963
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
5964
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
5965
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
5966
|
+
* nature of the integration.
|
|
5967
|
+
*
|
|
5968
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
5969
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
5970
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
5971
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
5972
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
5973
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
5974
|
+
*
|
|
5975
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
5976
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
5977
|
+
* removed with the reason recorded at
|
|
5978
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
5979
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
5980
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
5981
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
5982
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
5983
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
5984
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
5985
|
+
* ids it names.
|
|
5986
|
+
*/
|
|
5987
|
+
integrationSettingSections() {
|
|
5988
|
+
return [];
|
|
5989
|
+
}
|
|
5956
5990
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5957
5991
|
const schema = this.globalSettingsSchema(cap);
|
|
5958
5992
|
if (!schema) return { sections: [] };
|
|
@@ -5963,6 +5997,55 @@ var BaseAddon = class {
|
|
|
5963
5997
|
} : projected);
|
|
5964
5998
|
}
|
|
5965
5999
|
/**
|
|
6000
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
6001
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
6002
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
6003
|
+
*
|
|
6004
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
6005
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
6006
|
+
* as a failed load.
|
|
6007
|
+
*
|
|
6008
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
6009
|
+
* and not in whichever UI happens to render this:
|
|
6010
|
+
*
|
|
6011
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
6012
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
6013
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
6014
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
6015
|
+
* not merely discouraged.
|
|
6016
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
6017
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
6018
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
6019
|
+
* who opened the page (D266).
|
|
6020
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
6021
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
6022
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
6023
|
+
*/
|
|
6024
|
+
async getIntegrationSettings(nodeId) {
|
|
6025
|
+
const declared = this.integrationSettingSections();
|
|
6026
|
+
if (declared.length === 0) return null;
|
|
6027
|
+
const schema = this.globalSettingsSchema();
|
|
6028
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
6029
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
6030
|
+
const sections = [];
|
|
6031
|
+
for (const id of declared) {
|
|
6032
|
+
const section = byId.get(id);
|
|
6033
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
6034
|
+
const fields = dropPerNodeFields(section.fields);
|
|
6035
|
+
if (fields.length === 0) continue;
|
|
6036
|
+
sections.push({
|
|
6037
|
+
...section,
|
|
6038
|
+
fields
|
|
6039
|
+
});
|
|
6040
|
+
}
|
|
6041
|
+
if (sections.length === 0) return null;
|
|
6042
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6043
|
+
return hydrateSchema({
|
|
6044
|
+
...schema,
|
|
6045
|
+
sections
|
|
6046
|
+
}, projected);
|
|
6047
|
+
}
|
|
6048
|
+
/**
|
|
5966
6049
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5967
6050
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5968
6051
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6266,6 +6349,41 @@ var BaseAddon = class {
|
|
|
6266
6349
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6267
6350
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6268
6351
|
*/
|
|
6352
|
+
/**
|
|
6353
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6354
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6355
|
+
* with no child is dropped rather than rendered empty.
|
|
6356
|
+
*
|
|
6357
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6358
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6359
|
+
*/
|
|
6360
|
+
function dropPerNodeFields(fields) {
|
|
6361
|
+
const kept = [];
|
|
6362
|
+
for (const field of fields) {
|
|
6363
|
+
if (field.type === "group") {
|
|
6364
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6365
|
+
if (inner.length > 0) kept.push({
|
|
6366
|
+
...field,
|
|
6367
|
+
fields: inner
|
|
6368
|
+
});
|
|
6369
|
+
continue;
|
|
6370
|
+
}
|
|
6371
|
+
if (field.type === "sub-tabs") {
|
|
6372
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6373
|
+
...tab,
|
|
6374
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6375
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6376
|
+
if (tabs.length > 0) kept.push({
|
|
6377
|
+
...field,
|
|
6378
|
+
tabs
|
|
6379
|
+
});
|
|
6380
|
+
continue;
|
|
6381
|
+
}
|
|
6382
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6383
|
+
kept.push(field);
|
|
6384
|
+
}
|
|
6385
|
+
return kept;
|
|
6386
|
+
}
|
|
6269
6387
|
function collectPerNodeFieldKeys(fields) {
|
|
6270
6388
|
const collected = [];
|
|
6271
6389
|
for (const field of fields) {
|
|
@@ -9435,6 +9553,9 @@ method(object({
|
|
|
9435
9553
|
kind: "mutation",
|
|
9436
9554
|
auth: "admin"
|
|
9437
9555
|
}), method(object({
|
|
9556
|
+
addonId: string(),
|
|
9557
|
+
nodeId: string().optional()
|
|
9558
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
9438
9559
|
addonId: string(),
|
|
9439
9560
|
deviceId: number(),
|
|
9440
9561
|
nodeId: string().optional()
|
|
@@ -13400,6 +13521,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
13400
13521
|
limit: number().optional(),
|
|
13401
13522
|
tags: record(string(), string()).optional()
|
|
13402
13523
|
}), array(LogEntrySchema).readonly());
|
|
13524
|
+
/**
|
|
13525
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
13526
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
13527
|
+
*
|
|
13528
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
13529
|
+
*
|
|
13530
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
13531
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
13532
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
13533
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
13534
|
+
* somebody to forget to edit.
|
|
13535
|
+
*
|
|
13536
|
+
* They are not merged, because their invariants are opposites:
|
|
13537
|
+
*
|
|
13538
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
13539
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
13540
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
13541
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
13542
|
+
* and it is exactly what an absent entry cannot say.
|
|
13543
|
+
*
|
|
13544
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
13545
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
13546
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
13547
|
+
* has no process.
|
|
13548
|
+
*
|
|
13549
|
+
* ## Why not a log line, since the counters already exist
|
|
13550
|
+
*
|
|
13551
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
13552
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
13553
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
13554
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
13555
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
13556
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
13557
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
13558
|
+
* be READ.
|
|
13559
|
+
*
|
|
13560
|
+
* ## The rate is served with its denominator or not at all
|
|
13561
|
+
*
|
|
13562
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
13563
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
13564
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
13565
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
13566
|
+
* reproduces that mistake on every read.
|
|
13567
|
+
*
|
|
13568
|
+
* ## Shape
|
|
13569
|
+
*
|
|
13570
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
13571
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
13572
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
13573
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
13574
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
13575
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
13576
|
+
* result through `system.getFailureContributions`.
|
|
13577
|
+
*/
|
|
13578
|
+
var FailureReasonCountSchema = object({
|
|
13579
|
+
/**
|
|
13580
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
13581
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
13582
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
13583
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
13584
|
+
* vocabulary for the same loss would make the row and the counter
|
|
13585
|
+
* un-joinable.
|
|
13586
|
+
*/
|
|
13587
|
+
reason: string(),
|
|
13588
|
+
count: number().int().nonnegative()
|
|
13589
|
+
});
|
|
13590
|
+
var FailureContributionSchema = object({
|
|
13591
|
+
/**
|
|
13592
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
13593
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
13594
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
13595
|
+
* is a central list that rots invisibly.
|
|
13596
|
+
*/
|
|
13597
|
+
family: string(),
|
|
13598
|
+
/**
|
|
13599
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
13600
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
13601
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
13602
|
+
* cannot answer the only question anybody asks of this surface.
|
|
13603
|
+
*/
|
|
13604
|
+
deviceId: number().int().positive(),
|
|
13605
|
+
/**
|
|
13606
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
13607
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
13608
|
+
* family has a single variant.
|
|
13609
|
+
*/
|
|
13610
|
+
variant: string().optional(),
|
|
13611
|
+
/**
|
|
13612
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
13613
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
13614
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
13615
|
+
* `LoadContribution.startedAtMs`.
|
|
13616
|
+
*/
|
|
13617
|
+
sinceMs: number(),
|
|
13618
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
13619
|
+
atMs: number(),
|
|
13620
|
+
/**
|
|
13621
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
13622
|
+
* window. A failure count published without it is the mistake this schema
|
|
13623
|
+
* exists to make impossible.
|
|
13624
|
+
*/
|
|
13625
|
+
attempts: number().int().nonnegative(),
|
|
13626
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
13627
|
+
succeeded: number().int().nonnegative(),
|
|
13628
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
13629
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
13630
|
+
});
|
|
13631
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
13403
13632
|
var LoadContributionSchema = object({
|
|
13404
13633
|
role: _enum([
|
|
13405
13634
|
"decode",
|
|
@@ -17990,6 +18219,20 @@ var TrackSchema = object({
|
|
|
17990
18219
|
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
17991
18220
|
*/
|
|
17992
18221
|
hasRider: boolean().optional(),
|
|
18222
|
+
/**
|
|
18223
|
+
* WHY this track ended without a NATIVE best-shot tile
|
|
18224
|
+
* ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
|
|
18225
|
+
* a composed token line (`no-key-frame capture=keyframe:native-missx4`,
|
|
18226
|
+
* `derive-returned-null tile=standin`, …) written at close and CLEARED by
|
|
18227
|
+
* the late-keyFrame upgrade when a native tile lands after all. The
|
|
18228
|
+
* operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
18229
|
+
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
18230
|
+
*
|
|
18231
|
+
* **Absent ≠ "missed silently"**: a row written before the column, a hub
|
|
18232
|
+
* that predates the field, and every track whose tile landed native all
|
|
18233
|
+
* omit it. Render nothing when absent.
|
|
18234
|
+
*/
|
|
18235
|
+
previewMissReason: string().optional(),
|
|
17993
18236
|
...TrackFlagFields,
|
|
17994
18237
|
...TrackRetrainFields
|
|
17995
18238
|
});
|
|
@@ -29173,6 +29416,13 @@ var LoggingSettingsPatchSchema = object({
|
|
|
29173
29416
|
* anyone but its owner.
|
|
29174
29417
|
*/
|
|
29175
29418
|
var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
|
|
29419
|
+
/**
|
|
29420
|
+
* One per-camera failure counter, plus WHO reported it.
|
|
29421
|
+
*
|
|
29422
|
+
* Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
|
|
29423
|
+
* the hub as it enumerates providers, never by the contributor.
|
|
29424
|
+
*/
|
|
29425
|
+
var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
|
|
29176
29426
|
var GetLoggingSettingsInputSchema = object({
|
|
29177
29427
|
scopeNodeId: string().optional(),
|
|
29178
29428
|
/**
|
|
@@ -29231,7 +29481,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
|
|
|
29231
29481
|
}), method(_void(), SiteLocationStatusSchema, {
|
|
29232
29482
|
kind: "mutation",
|
|
29233
29483
|
auth: "admin"
|
|
29234
|
-
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
29484
|
+
}), 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, {
|
|
29235
29485
|
kind: "mutation",
|
|
29236
29486
|
auth: "admin"
|
|
29237
29487
|
});
|
|
@@ -31553,6 +31803,12 @@ Object.freeze({
|
|
|
31553
31803
|
addonId: null,
|
|
31554
31804
|
access: "view"
|
|
31555
31805
|
},
|
|
31806
|
+
"addonSettings.getIntegrationSettings": {
|
|
31807
|
+
capName: "addon-settings",
|
|
31808
|
+
capScope: "system",
|
|
31809
|
+
addonId: null,
|
|
31810
|
+
access: "view"
|
|
31811
|
+
},
|
|
31556
31812
|
"addonSettings.updateDeviceSettings": {
|
|
31557
31813
|
capName: "addon-settings",
|
|
31558
31814
|
capScope: "system",
|
|
@@ -33215,6 +33471,12 @@ Object.freeze({
|
|
|
33215
33471
|
addonId: null,
|
|
33216
33472
|
access: "create"
|
|
33217
33473
|
},
|
|
33474
|
+
"failureContribution.list": {
|
|
33475
|
+
capName: "failure-contribution",
|
|
33476
|
+
capScope: "system",
|
|
33477
|
+
addonId: null,
|
|
33478
|
+
access: "view"
|
|
33479
|
+
},
|
|
33218
33480
|
"fanControl.setDirection": {
|
|
33219
33481
|
capName: "fan-control",
|
|
33220
33482
|
capScope: "device",
|
|
@@ -36521,6 +36783,12 @@ Object.freeze({
|
|
|
36521
36783
|
addonId: null,
|
|
36522
36784
|
access: "create"
|
|
36523
36785
|
},
|
|
36786
|
+
"system.getFailureContributions": {
|
|
36787
|
+
capName: "system",
|
|
36788
|
+
capScope: "system",
|
|
36789
|
+
addonId: null,
|
|
36790
|
+
access: "view"
|
|
36791
|
+
},
|
|
36524
36792
|
"system.getLoadContributions": {
|
|
36525
36793
|
capName: "system",
|
|
36526
36794
|
capScope: "system",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-provider-dreo",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.39",
|
|
4
4
|
"description": "Dreo smart-device (fan / air-circulator / purifier / heater / humidifier) device-provider addon for CamStack — wraps the @apocaliss92/nodedreo Dreo cloud client (REST + WebSocket)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|