@camstack/addon-export-alexa 1.2.43 → 1.2.45
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/export-alexa.addon.js +269 -1
- package/dist/export-alexa.addon.mjs +269 -1
- package/package.json +1 -1
|
@@ -5943,6 +5943,40 @@ var BaseAddon = class {
|
|
|
5943
5943
|
deviceSettingsSchema() {
|
|
5944
5944
|
return null;
|
|
5945
5945
|
}
|
|
5946
|
+
/**
|
|
5947
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
5948
|
+
* ARE the configuration of its integration.
|
|
5949
|
+
*
|
|
5950
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
5951
|
+
* operator should find on the addon's integration page (System →
|
|
5952
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
5953
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
5954
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
5955
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
5956
|
+
* nature of the integration.
|
|
5957
|
+
*
|
|
5958
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
5959
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
5960
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
5961
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
5962
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
5963
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
5964
|
+
*
|
|
5965
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
5966
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
5967
|
+
* removed with the reason recorded at
|
|
5968
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
5969
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
5970
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
5971
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
5972
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
5973
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
5974
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
5975
|
+
* ids it names.
|
|
5976
|
+
*/
|
|
5977
|
+
integrationSettingSections() {
|
|
5978
|
+
return [];
|
|
5979
|
+
}
|
|
5946
5980
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5947
5981
|
const schema = this.globalSettingsSchema(cap);
|
|
5948
5982
|
if (!schema) return { sections: [] };
|
|
@@ -5953,6 +5987,55 @@ var BaseAddon = class {
|
|
|
5953
5987
|
} : projected);
|
|
5954
5988
|
}
|
|
5955
5989
|
/**
|
|
5990
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
5991
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
5992
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
5993
|
+
*
|
|
5994
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
5995
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
5996
|
+
* as a failed load.
|
|
5997
|
+
*
|
|
5998
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
5999
|
+
* and not in whichever UI happens to render this:
|
|
6000
|
+
*
|
|
6001
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
6002
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
6003
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
6004
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
6005
|
+
* not merely discouraged.
|
|
6006
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
6007
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
6008
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
6009
|
+
* who opened the page (D266).
|
|
6010
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
6011
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
6012
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
6013
|
+
*/
|
|
6014
|
+
async getIntegrationSettings(nodeId) {
|
|
6015
|
+
const declared = this.integrationSettingSections();
|
|
6016
|
+
if (declared.length === 0) return null;
|
|
6017
|
+
const schema = this.globalSettingsSchema();
|
|
6018
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
6019
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
6020
|
+
const sections = [];
|
|
6021
|
+
for (const id of declared) {
|
|
6022
|
+
const section = byId.get(id);
|
|
6023
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
6024
|
+
const fields = dropPerNodeFields(section.fields);
|
|
6025
|
+
if (fields.length === 0) continue;
|
|
6026
|
+
sections.push({
|
|
6027
|
+
...section,
|
|
6028
|
+
fields
|
|
6029
|
+
});
|
|
6030
|
+
}
|
|
6031
|
+
if (sections.length === 0) return null;
|
|
6032
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6033
|
+
return hydrateSchema({
|
|
6034
|
+
...schema,
|
|
6035
|
+
sections
|
|
6036
|
+
}, projected);
|
|
6037
|
+
}
|
|
6038
|
+
/**
|
|
5956
6039
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5957
6040
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5958
6041
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6256,6 +6339,41 @@ var BaseAddon = class {
|
|
|
6256
6339
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6257
6340
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6258
6341
|
*/
|
|
6342
|
+
/**
|
|
6343
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6344
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6345
|
+
* with no child is dropped rather than rendered empty.
|
|
6346
|
+
*
|
|
6347
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6348
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6349
|
+
*/
|
|
6350
|
+
function dropPerNodeFields(fields) {
|
|
6351
|
+
const kept = [];
|
|
6352
|
+
for (const field of fields) {
|
|
6353
|
+
if (field.type === "group") {
|
|
6354
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6355
|
+
if (inner.length > 0) kept.push({
|
|
6356
|
+
...field,
|
|
6357
|
+
fields: inner
|
|
6358
|
+
});
|
|
6359
|
+
continue;
|
|
6360
|
+
}
|
|
6361
|
+
if (field.type === "sub-tabs") {
|
|
6362
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6363
|
+
...tab,
|
|
6364
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6365
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6366
|
+
if (tabs.length > 0) kept.push({
|
|
6367
|
+
...field,
|
|
6368
|
+
tabs
|
|
6369
|
+
});
|
|
6370
|
+
continue;
|
|
6371
|
+
}
|
|
6372
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6373
|
+
kept.push(field);
|
|
6374
|
+
}
|
|
6375
|
+
return kept;
|
|
6376
|
+
}
|
|
6259
6377
|
function collectPerNodeFieldKeys(fields) {
|
|
6260
6378
|
const collected = [];
|
|
6261
6379
|
for (const field of fields) {
|
|
@@ -9646,6 +9764,9 @@ method(object({
|
|
|
9646
9764
|
kind: "mutation",
|
|
9647
9765
|
auth: "admin"
|
|
9648
9766
|
}), method(object({
|
|
9767
|
+
addonId: string(),
|
|
9768
|
+
nodeId: string().optional()
|
|
9769
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
9649
9770
|
addonId: string(),
|
|
9650
9771
|
deviceId: number(),
|
|
9651
9772
|
nodeId: string().optional()
|
|
@@ -13377,6 +13498,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
13377
13498
|
limit: number().optional(),
|
|
13378
13499
|
tags: record(string(), string()).optional()
|
|
13379
13500
|
}), array(LogEntrySchema).readonly());
|
|
13501
|
+
/**
|
|
13502
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
13503
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
13504
|
+
*
|
|
13505
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
13506
|
+
*
|
|
13507
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
13508
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
13509
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
13510
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
13511
|
+
* somebody to forget to edit.
|
|
13512
|
+
*
|
|
13513
|
+
* They are not merged, because their invariants are opposites:
|
|
13514
|
+
*
|
|
13515
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
13516
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
13517
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
13518
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
13519
|
+
* and it is exactly what an absent entry cannot say.
|
|
13520
|
+
*
|
|
13521
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
13522
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
13523
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
13524
|
+
* has no process.
|
|
13525
|
+
*
|
|
13526
|
+
* ## Why not a log line, since the counters already exist
|
|
13527
|
+
*
|
|
13528
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
13529
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
13530
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
13531
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
13532
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
13533
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
13534
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
13535
|
+
* be READ.
|
|
13536
|
+
*
|
|
13537
|
+
* ## The rate is served with its denominator or not at all
|
|
13538
|
+
*
|
|
13539
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
13540
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
13541
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
13542
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
13543
|
+
* reproduces that mistake on every read.
|
|
13544
|
+
*
|
|
13545
|
+
* ## Shape
|
|
13546
|
+
*
|
|
13547
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
13548
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
13549
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
13550
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
13551
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
13552
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
13553
|
+
* result through `system.getFailureContributions`.
|
|
13554
|
+
*/
|
|
13555
|
+
var FailureReasonCountSchema = object({
|
|
13556
|
+
/**
|
|
13557
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
13558
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
13559
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
13560
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
13561
|
+
* vocabulary for the same loss would make the row and the counter
|
|
13562
|
+
* un-joinable.
|
|
13563
|
+
*/
|
|
13564
|
+
reason: string(),
|
|
13565
|
+
count: number().int().nonnegative()
|
|
13566
|
+
});
|
|
13567
|
+
var FailureContributionSchema = object({
|
|
13568
|
+
/**
|
|
13569
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
13570
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
13571
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
13572
|
+
* is a central list that rots invisibly.
|
|
13573
|
+
*/
|
|
13574
|
+
family: string(),
|
|
13575
|
+
/**
|
|
13576
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
13577
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
13578
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
13579
|
+
* cannot answer the only question anybody asks of this surface.
|
|
13580
|
+
*/
|
|
13581
|
+
deviceId: number().int().positive(),
|
|
13582
|
+
/**
|
|
13583
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
13584
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
13585
|
+
* family has a single variant.
|
|
13586
|
+
*/
|
|
13587
|
+
variant: string().optional(),
|
|
13588
|
+
/**
|
|
13589
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
13590
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
13591
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
13592
|
+
* `LoadContribution.startedAtMs`.
|
|
13593
|
+
*/
|
|
13594
|
+
sinceMs: number(),
|
|
13595
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
13596
|
+
atMs: number(),
|
|
13597
|
+
/**
|
|
13598
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
13599
|
+
* window. A failure count published without it is the mistake this schema
|
|
13600
|
+
* exists to make impossible.
|
|
13601
|
+
*/
|
|
13602
|
+
attempts: number().int().nonnegative(),
|
|
13603
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
13604
|
+
succeeded: number().int().nonnegative(),
|
|
13605
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
13606
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
13607
|
+
});
|
|
13608
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
13380
13609
|
var LoadContributionSchema = object({
|
|
13381
13610
|
role: _enum([
|
|
13382
13611
|
"decode",
|
|
@@ -17905,6 +18134,20 @@ var TrackSchema = object({
|
|
|
17905
18134
|
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
17906
18135
|
*/
|
|
17907
18136
|
hasRider: boolean().optional(),
|
|
18137
|
+
/**
|
|
18138
|
+
* WHY this track ended without a NATIVE best-shot tile
|
|
18139
|
+
* ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
|
|
18140
|
+
* a composed token line (`no-key-frame capture=keyframe:native-missx4`,
|
|
18141
|
+
* `derive-returned-null tile=standin`, …) written at close and CLEARED by
|
|
18142
|
+
* the late-keyFrame upgrade when a native tile lands after all. The
|
|
18143
|
+
* operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
18144
|
+
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
18145
|
+
*
|
|
18146
|
+
* **Absent ≠ "missed silently"**: a row written before the column, a hub
|
|
18147
|
+
* that predates the field, and every track whose tile landed native all
|
|
18148
|
+
* omit it. Render nothing when absent.
|
|
18149
|
+
*/
|
|
18150
|
+
previewMissReason: string().optional(),
|
|
17908
18151
|
...TrackFlagFields,
|
|
17909
18152
|
...TrackRetrainFields
|
|
17910
18153
|
});
|
|
@@ -27131,6 +27374,13 @@ var LoggingSettingsPatchSchema = object({
|
|
|
27131
27374
|
* anyone but its owner.
|
|
27132
27375
|
*/
|
|
27133
27376
|
var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
|
|
27377
|
+
/**
|
|
27378
|
+
* One per-camera failure counter, plus WHO reported it.
|
|
27379
|
+
*
|
|
27380
|
+
* Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
|
|
27381
|
+
* the hub as it enumerates providers, never by the contributor.
|
|
27382
|
+
*/
|
|
27383
|
+
var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
|
|
27134
27384
|
var GetLoggingSettingsInputSchema = object({
|
|
27135
27385
|
scopeNodeId: string().optional(),
|
|
27136
27386
|
/**
|
|
@@ -27189,7 +27439,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
|
|
|
27189
27439
|
}), method(_void(), SiteLocationStatusSchema, {
|
|
27190
27440
|
kind: "mutation",
|
|
27191
27441
|
auth: "admin"
|
|
27192
|
-
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
27442
|
+
}), 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, {
|
|
27193
27443
|
kind: "mutation",
|
|
27194
27444
|
auth: "admin"
|
|
27195
27445
|
});
|
|
@@ -28103,6 +28353,12 @@ Object.freeze({
|
|
|
28103
28353
|
addonId: null,
|
|
28104
28354
|
access: "view"
|
|
28105
28355
|
},
|
|
28356
|
+
"addonSettings.getIntegrationSettings": {
|
|
28357
|
+
capName: "addon-settings",
|
|
28358
|
+
capScope: "system",
|
|
28359
|
+
addonId: null,
|
|
28360
|
+
access: "view"
|
|
28361
|
+
},
|
|
28106
28362
|
"addonSettings.updateDeviceSettings": {
|
|
28107
28363
|
capName: "addon-settings",
|
|
28108
28364
|
capScope: "system",
|
|
@@ -29765,6 +30021,12 @@ Object.freeze({
|
|
|
29765
30021
|
addonId: null,
|
|
29766
30022
|
access: "create"
|
|
29767
30023
|
},
|
|
30024
|
+
"failureContribution.list": {
|
|
30025
|
+
capName: "failure-contribution",
|
|
30026
|
+
capScope: "system",
|
|
30027
|
+
addonId: null,
|
|
30028
|
+
access: "view"
|
|
30029
|
+
},
|
|
29768
30030
|
"fanControl.setDirection": {
|
|
29769
30031
|
capName: "fan-control",
|
|
29770
30032
|
capScope: "device",
|
|
@@ -33071,6 +33333,12 @@ Object.freeze({
|
|
|
33071
33333
|
addonId: null,
|
|
33072
33334
|
access: "create"
|
|
33073
33335
|
},
|
|
33336
|
+
"system.getFailureContributions": {
|
|
33337
|
+
capName: "system",
|
|
33338
|
+
capScope: "system",
|
|
33339
|
+
addonId: null,
|
|
33340
|
+
access: "view"
|
|
33341
|
+
},
|
|
33074
33342
|
"system.getLoadContributions": {
|
|
33075
33343
|
capName: "system",
|
|
33076
33344
|
capScope: "system",
|
|
@@ -5916,6 +5916,40 @@ var BaseAddon = class {
|
|
|
5916
5916
|
deviceSettingsSchema() {
|
|
5917
5917
|
return null;
|
|
5918
5918
|
}
|
|
5919
|
+
/**
|
|
5920
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
5921
|
+
* ARE the configuration of its integration.
|
|
5922
|
+
*
|
|
5923
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
5924
|
+
* operator should find on the addon's integration page (System →
|
|
5925
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
5926
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
5927
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
5928
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
5929
|
+
* nature of the integration.
|
|
5930
|
+
*
|
|
5931
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
5932
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
5933
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
5934
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
5935
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
5936
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
5937
|
+
*
|
|
5938
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
5939
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
5940
|
+
* removed with the reason recorded at
|
|
5941
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
5942
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
5943
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
5944
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
5945
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
5946
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
5947
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
5948
|
+
* ids it names.
|
|
5949
|
+
*/
|
|
5950
|
+
integrationSettingSections() {
|
|
5951
|
+
return [];
|
|
5952
|
+
}
|
|
5919
5953
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5920
5954
|
const schema = this.globalSettingsSchema(cap);
|
|
5921
5955
|
if (!schema) return { sections: [] };
|
|
@@ -5926,6 +5960,55 @@ var BaseAddon = class {
|
|
|
5926
5960
|
} : projected);
|
|
5927
5961
|
}
|
|
5928
5962
|
/**
|
|
5963
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
5964
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
5965
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
5966
|
+
*
|
|
5967
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
5968
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
5969
|
+
* as a failed load.
|
|
5970
|
+
*
|
|
5971
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
5972
|
+
* and not in whichever UI happens to render this:
|
|
5973
|
+
*
|
|
5974
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
5975
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
5976
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
5977
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
5978
|
+
* not merely discouraged.
|
|
5979
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
5980
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
5981
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
5982
|
+
* who opened the page (D266).
|
|
5983
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
5984
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
5985
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
5986
|
+
*/
|
|
5987
|
+
async getIntegrationSettings(nodeId) {
|
|
5988
|
+
const declared = this.integrationSettingSections();
|
|
5989
|
+
if (declared.length === 0) return null;
|
|
5990
|
+
const schema = this.globalSettingsSchema();
|
|
5991
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
5992
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
5993
|
+
const sections = [];
|
|
5994
|
+
for (const id of declared) {
|
|
5995
|
+
const section = byId.get(id);
|
|
5996
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
5997
|
+
const fields = dropPerNodeFields(section.fields);
|
|
5998
|
+
if (fields.length === 0) continue;
|
|
5999
|
+
sections.push({
|
|
6000
|
+
...section,
|
|
6001
|
+
fields
|
|
6002
|
+
});
|
|
6003
|
+
}
|
|
6004
|
+
if (sections.length === 0) return null;
|
|
6005
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6006
|
+
return hydrateSchema({
|
|
6007
|
+
...schema,
|
|
6008
|
+
sections
|
|
6009
|
+
}, projected);
|
|
6010
|
+
}
|
|
6011
|
+
/**
|
|
5929
6012
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5930
6013
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5931
6014
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6229,6 +6312,41 @@ var BaseAddon = class {
|
|
|
6229
6312
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6230
6313
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6231
6314
|
*/
|
|
6315
|
+
/**
|
|
6316
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6317
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6318
|
+
* with no child is dropped rather than rendered empty.
|
|
6319
|
+
*
|
|
6320
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6321
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6322
|
+
*/
|
|
6323
|
+
function dropPerNodeFields(fields) {
|
|
6324
|
+
const kept = [];
|
|
6325
|
+
for (const field of fields) {
|
|
6326
|
+
if (field.type === "group") {
|
|
6327
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6328
|
+
if (inner.length > 0) kept.push({
|
|
6329
|
+
...field,
|
|
6330
|
+
fields: inner
|
|
6331
|
+
});
|
|
6332
|
+
continue;
|
|
6333
|
+
}
|
|
6334
|
+
if (field.type === "sub-tabs") {
|
|
6335
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6336
|
+
...tab,
|
|
6337
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6338
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6339
|
+
if (tabs.length > 0) kept.push({
|
|
6340
|
+
...field,
|
|
6341
|
+
tabs
|
|
6342
|
+
});
|
|
6343
|
+
continue;
|
|
6344
|
+
}
|
|
6345
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6346
|
+
kept.push(field);
|
|
6347
|
+
}
|
|
6348
|
+
return kept;
|
|
6349
|
+
}
|
|
6232
6350
|
function collectPerNodeFieldKeys(fields) {
|
|
6233
6351
|
const collected = [];
|
|
6234
6352
|
for (const field of fields) {
|
|
@@ -9619,6 +9737,9 @@ method(object({
|
|
|
9619
9737
|
kind: "mutation",
|
|
9620
9738
|
auth: "admin"
|
|
9621
9739
|
}), method(object({
|
|
9740
|
+
addonId: string(),
|
|
9741
|
+
nodeId: string().optional()
|
|
9742
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
9622
9743
|
addonId: string(),
|
|
9623
9744
|
deviceId: number(),
|
|
9624
9745
|
nodeId: string().optional()
|
|
@@ -13350,6 +13471,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
13350
13471
|
limit: number().optional(),
|
|
13351
13472
|
tags: record(string(), string()).optional()
|
|
13352
13473
|
}), array(LogEntrySchema).readonly());
|
|
13474
|
+
/**
|
|
13475
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
13476
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
13477
|
+
*
|
|
13478
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
13479
|
+
*
|
|
13480
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
13481
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
13482
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
13483
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
13484
|
+
* somebody to forget to edit.
|
|
13485
|
+
*
|
|
13486
|
+
* They are not merged, because their invariants are opposites:
|
|
13487
|
+
*
|
|
13488
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
13489
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
13490
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
13491
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
13492
|
+
* and it is exactly what an absent entry cannot say.
|
|
13493
|
+
*
|
|
13494
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
13495
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
13496
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
13497
|
+
* has no process.
|
|
13498
|
+
*
|
|
13499
|
+
* ## Why not a log line, since the counters already exist
|
|
13500
|
+
*
|
|
13501
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
13502
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
13503
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
13504
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
13505
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
13506
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
13507
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
13508
|
+
* be READ.
|
|
13509
|
+
*
|
|
13510
|
+
* ## The rate is served with its denominator or not at all
|
|
13511
|
+
*
|
|
13512
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
13513
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
13514
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
13515
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
13516
|
+
* reproduces that mistake on every read.
|
|
13517
|
+
*
|
|
13518
|
+
* ## Shape
|
|
13519
|
+
*
|
|
13520
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
13521
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
13522
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
13523
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
13524
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
13525
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
13526
|
+
* result through `system.getFailureContributions`.
|
|
13527
|
+
*/
|
|
13528
|
+
var FailureReasonCountSchema = object({
|
|
13529
|
+
/**
|
|
13530
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
13531
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
13532
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
13533
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
13534
|
+
* vocabulary for the same loss would make the row and the counter
|
|
13535
|
+
* un-joinable.
|
|
13536
|
+
*/
|
|
13537
|
+
reason: string(),
|
|
13538
|
+
count: number().int().nonnegative()
|
|
13539
|
+
});
|
|
13540
|
+
var FailureContributionSchema = object({
|
|
13541
|
+
/**
|
|
13542
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
13543
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
13544
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
13545
|
+
* is a central list that rots invisibly.
|
|
13546
|
+
*/
|
|
13547
|
+
family: string(),
|
|
13548
|
+
/**
|
|
13549
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
13550
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
13551
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
13552
|
+
* cannot answer the only question anybody asks of this surface.
|
|
13553
|
+
*/
|
|
13554
|
+
deviceId: number().int().positive(),
|
|
13555
|
+
/**
|
|
13556
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
13557
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
13558
|
+
* family has a single variant.
|
|
13559
|
+
*/
|
|
13560
|
+
variant: string().optional(),
|
|
13561
|
+
/**
|
|
13562
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
13563
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
13564
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
13565
|
+
* `LoadContribution.startedAtMs`.
|
|
13566
|
+
*/
|
|
13567
|
+
sinceMs: number(),
|
|
13568
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
13569
|
+
atMs: number(),
|
|
13570
|
+
/**
|
|
13571
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
13572
|
+
* window. A failure count published without it is the mistake this schema
|
|
13573
|
+
* exists to make impossible.
|
|
13574
|
+
*/
|
|
13575
|
+
attempts: number().int().nonnegative(),
|
|
13576
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
13577
|
+
succeeded: number().int().nonnegative(),
|
|
13578
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
13579
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
13580
|
+
});
|
|
13581
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
13353
13582
|
var LoadContributionSchema = object({
|
|
13354
13583
|
role: _enum([
|
|
13355
13584
|
"decode",
|
|
@@ -17878,6 +18107,20 @@ var TrackSchema = object({
|
|
|
17878
18107
|
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
17879
18108
|
*/
|
|
17880
18109
|
hasRider: boolean().optional(),
|
|
18110
|
+
/**
|
|
18111
|
+
* WHY this track ended without a NATIVE best-shot tile
|
|
18112
|
+
* ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
|
|
18113
|
+
* a composed token line (`no-key-frame capture=keyframe:native-missx4`,
|
|
18114
|
+
* `derive-returned-null tile=standin`, …) written at close and CLEARED by
|
|
18115
|
+
* the late-keyFrame upgrade when a native tile lands after all. The
|
|
18116
|
+
* operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
18117
|
+
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
18118
|
+
*
|
|
18119
|
+
* **Absent ≠ "missed silently"**: a row written before the column, a hub
|
|
18120
|
+
* that predates the field, and every track whose tile landed native all
|
|
18121
|
+
* omit it. Render nothing when absent.
|
|
18122
|
+
*/
|
|
18123
|
+
previewMissReason: string().optional(),
|
|
17881
18124
|
...TrackFlagFields,
|
|
17882
18125
|
...TrackRetrainFields
|
|
17883
18126
|
});
|
|
@@ -27104,6 +27347,13 @@ var LoggingSettingsPatchSchema = object({
|
|
|
27104
27347
|
* anyone but its owner.
|
|
27105
27348
|
*/
|
|
27106
27349
|
var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
|
|
27350
|
+
/**
|
|
27351
|
+
* One per-camera failure counter, plus WHO reported it.
|
|
27352
|
+
*
|
|
27353
|
+
* Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
|
|
27354
|
+
* the hub as it enumerates providers, never by the contributor.
|
|
27355
|
+
*/
|
|
27356
|
+
var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
|
|
27107
27357
|
var GetLoggingSettingsInputSchema = object({
|
|
27108
27358
|
scopeNodeId: string().optional(),
|
|
27109
27359
|
/**
|
|
@@ -27162,7 +27412,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
|
|
|
27162
27412
|
}), method(_void(), SiteLocationStatusSchema, {
|
|
27163
27413
|
kind: "mutation",
|
|
27164
27414
|
auth: "admin"
|
|
27165
|
-
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
27415
|
+
}), 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, {
|
|
27166
27416
|
kind: "mutation",
|
|
27167
27417
|
auth: "admin"
|
|
27168
27418
|
});
|
|
@@ -28076,6 +28326,12 @@ Object.freeze({
|
|
|
28076
28326
|
addonId: null,
|
|
28077
28327
|
access: "view"
|
|
28078
28328
|
},
|
|
28329
|
+
"addonSettings.getIntegrationSettings": {
|
|
28330
|
+
capName: "addon-settings",
|
|
28331
|
+
capScope: "system",
|
|
28332
|
+
addonId: null,
|
|
28333
|
+
access: "view"
|
|
28334
|
+
},
|
|
28079
28335
|
"addonSettings.updateDeviceSettings": {
|
|
28080
28336
|
capName: "addon-settings",
|
|
28081
28337
|
capScope: "system",
|
|
@@ -29738,6 +29994,12 @@ Object.freeze({
|
|
|
29738
29994
|
addonId: null,
|
|
29739
29995
|
access: "create"
|
|
29740
29996
|
},
|
|
29997
|
+
"failureContribution.list": {
|
|
29998
|
+
capName: "failure-contribution",
|
|
29999
|
+
capScope: "system",
|
|
30000
|
+
addonId: null,
|
|
30001
|
+
access: "view"
|
|
30002
|
+
},
|
|
29741
30003
|
"fanControl.setDirection": {
|
|
29742
30004
|
capName: "fan-control",
|
|
29743
30005
|
capScope: "device",
|
|
@@ -33044,6 +33306,12 @@ Object.freeze({
|
|
|
33044
33306
|
addonId: null,
|
|
33045
33307
|
access: "create"
|
|
33046
33308
|
},
|
|
33309
|
+
"system.getFailureContributions": {
|
|
33310
|
+
capName: "system",
|
|
33311
|
+
capScope: "system",
|
|
33312
|
+
addonId: null,
|
|
33313
|
+
access: "view"
|
|
33314
|
+
},
|
|
33047
33315
|
"system.getLoadContributions": {
|
|
33048
33316
|
capName: "system",
|
|
33049
33317
|
capScope: "system",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-export-alexa",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.45",
|
|
4
4
|
"description": "Alexa Smart Home Skill export — hub-side OAuth provider + directive handler. The companion AWS Lambda forwards Alexa directives to this addon's /addon/export-alexa/directive endpoint.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|