@camstack/addon-export-hap 1.2.48 → 1.2.50
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/hap-export.addon.js +269 -1
- package/dist/hap-export.addon.mjs +269 -1
- package/package.json +1 -1
package/dist/hap-export.addon.js
CHANGED
|
@@ -6001,6 +6001,40 @@ var BaseAddon = class {
|
|
|
6001
6001
|
deviceSettingsSchema() {
|
|
6002
6002
|
return null;
|
|
6003
6003
|
}
|
|
6004
|
+
/**
|
|
6005
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
6006
|
+
* ARE the configuration of its integration.
|
|
6007
|
+
*
|
|
6008
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
6009
|
+
* operator should find on the addon's integration page (System →
|
|
6010
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
6011
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
6012
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
6013
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
6014
|
+
* nature of the integration.
|
|
6015
|
+
*
|
|
6016
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
6017
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
6018
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
6019
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
6020
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
6021
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
6022
|
+
*
|
|
6023
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
6024
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
6025
|
+
* removed with the reason recorded at
|
|
6026
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
6027
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
6028
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
6029
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
6030
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
6031
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
6032
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
6033
|
+
* ids it names.
|
|
6034
|
+
*/
|
|
6035
|
+
integrationSettingSections() {
|
|
6036
|
+
return [];
|
|
6037
|
+
}
|
|
6004
6038
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
6005
6039
|
const schema = this.globalSettingsSchema(cap);
|
|
6006
6040
|
if (!schema) return { sections: [] };
|
|
@@ -6011,6 +6045,55 @@ var BaseAddon = class {
|
|
|
6011
6045
|
} : projected);
|
|
6012
6046
|
}
|
|
6013
6047
|
/**
|
|
6048
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
6049
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
6050
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
6051
|
+
*
|
|
6052
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
6053
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
6054
|
+
* as a failed load.
|
|
6055
|
+
*
|
|
6056
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
6057
|
+
* and not in whichever UI happens to render this:
|
|
6058
|
+
*
|
|
6059
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
6060
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
6061
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
6062
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
6063
|
+
* not merely discouraged.
|
|
6064
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
6065
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
6066
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
6067
|
+
* who opened the page (D266).
|
|
6068
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
6069
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
6070
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
6071
|
+
*/
|
|
6072
|
+
async getIntegrationSettings(nodeId) {
|
|
6073
|
+
const declared = this.integrationSettingSections();
|
|
6074
|
+
if (declared.length === 0) return null;
|
|
6075
|
+
const schema = this.globalSettingsSchema();
|
|
6076
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
6077
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
6078
|
+
const sections = [];
|
|
6079
|
+
for (const id of declared) {
|
|
6080
|
+
const section = byId.get(id);
|
|
6081
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
6082
|
+
const fields = dropPerNodeFields(section.fields);
|
|
6083
|
+
if (fields.length === 0) continue;
|
|
6084
|
+
sections.push({
|
|
6085
|
+
...section,
|
|
6086
|
+
fields
|
|
6087
|
+
});
|
|
6088
|
+
}
|
|
6089
|
+
if (sections.length === 0) return null;
|
|
6090
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6091
|
+
return hydrateSchema({
|
|
6092
|
+
...schema,
|
|
6093
|
+
sections
|
|
6094
|
+
}, projected);
|
|
6095
|
+
}
|
|
6096
|
+
/**
|
|
6014
6097
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
6015
6098
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
6016
6099
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6314,6 +6397,41 @@ var BaseAddon = class {
|
|
|
6314
6397
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6315
6398
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6316
6399
|
*/
|
|
6400
|
+
/**
|
|
6401
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6402
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6403
|
+
* with no child is dropped rather than rendered empty.
|
|
6404
|
+
*
|
|
6405
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6406
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6407
|
+
*/
|
|
6408
|
+
function dropPerNodeFields(fields) {
|
|
6409
|
+
const kept = [];
|
|
6410
|
+
for (const field of fields) {
|
|
6411
|
+
if (field.type === "group") {
|
|
6412
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6413
|
+
if (inner.length > 0) kept.push({
|
|
6414
|
+
...field,
|
|
6415
|
+
fields: inner
|
|
6416
|
+
});
|
|
6417
|
+
continue;
|
|
6418
|
+
}
|
|
6419
|
+
if (field.type === "sub-tabs") {
|
|
6420
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6421
|
+
...tab,
|
|
6422
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6423
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6424
|
+
if (tabs.length > 0) kept.push({
|
|
6425
|
+
...field,
|
|
6426
|
+
tabs
|
|
6427
|
+
});
|
|
6428
|
+
continue;
|
|
6429
|
+
}
|
|
6430
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6431
|
+
kept.push(field);
|
|
6432
|
+
}
|
|
6433
|
+
return kept;
|
|
6434
|
+
}
|
|
6317
6435
|
function collectPerNodeFieldKeys(fields) {
|
|
6318
6436
|
const collected = [];
|
|
6319
6437
|
for (const field of fields) {
|
|
@@ -10118,6 +10236,9 @@ method(object({
|
|
|
10118
10236
|
kind: "mutation",
|
|
10119
10237
|
auth: "admin"
|
|
10120
10238
|
}), method(object({
|
|
10239
|
+
addonId: string(),
|
|
10240
|
+
nodeId: string().optional()
|
|
10241
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
10121
10242
|
addonId: string(),
|
|
10122
10243
|
deviceId: number(),
|
|
10123
10244
|
nodeId: string().optional()
|
|
@@ -13883,6 +14004,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
13883
14004
|
limit: number().optional(),
|
|
13884
14005
|
tags: record(string(), string()).optional()
|
|
13885
14006
|
}), array(LogEntrySchema).readonly());
|
|
14007
|
+
/**
|
|
14008
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
14009
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
14010
|
+
*
|
|
14011
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
14012
|
+
*
|
|
14013
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
14014
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
14015
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
14016
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
14017
|
+
* somebody to forget to edit.
|
|
14018
|
+
*
|
|
14019
|
+
* They are not merged, because their invariants are opposites:
|
|
14020
|
+
*
|
|
14021
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
14022
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
14023
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
14024
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
14025
|
+
* and it is exactly what an absent entry cannot say.
|
|
14026
|
+
*
|
|
14027
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
14028
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
14029
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
14030
|
+
* has no process.
|
|
14031
|
+
*
|
|
14032
|
+
* ## Why not a log line, since the counters already exist
|
|
14033
|
+
*
|
|
14034
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
14035
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
14036
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
14037
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
14038
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
14039
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
14040
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
14041
|
+
* be READ.
|
|
14042
|
+
*
|
|
14043
|
+
* ## The rate is served with its denominator or not at all
|
|
14044
|
+
*
|
|
14045
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
14046
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
14047
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
14048
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
14049
|
+
* reproduces that mistake on every read.
|
|
14050
|
+
*
|
|
14051
|
+
* ## Shape
|
|
14052
|
+
*
|
|
14053
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
14054
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
14055
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
14056
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
14057
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
14058
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
14059
|
+
* result through `system.getFailureContributions`.
|
|
14060
|
+
*/
|
|
14061
|
+
var FailureReasonCountSchema = object({
|
|
14062
|
+
/**
|
|
14063
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
14064
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
14065
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
14066
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
14067
|
+
* vocabulary for the same loss would make the row and the counter
|
|
14068
|
+
* un-joinable.
|
|
14069
|
+
*/
|
|
14070
|
+
reason: string(),
|
|
14071
|
+
count: number().int().nonnegative()
|
|
14072
|
+
});
|
|
14073
|
+
var FailureContributionSchema = object({
|
|
14074
|
+
/**
|
|
14075
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
14076
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
14077
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
14078
|
+
* is a central list that rots invisibly.
|
|
14079
|
+
*/
|
|
14080
|
+
family: string(),
|
|
14081
|
+
/**
|
|
14082
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
14083
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
14084
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
14085
|
+
* cannot answer the only question anybody asks of this surface.
|
|
14086
|
+
*/
|
|
14087
|
+
deviceId: number().int().positive(),
|
|
14088
|
+
/**
|
|
14089
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
14090
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
14091
|
+
* family has a single variant.
|
|
14092
|
+
*/
|
|
14093
|
+
variant: string().optional(),
|
|
14094
|
+
/**
|
|
14095
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
14096
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
14097
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
14098
|
+
* `LoadContribution.startedAtMs`.
|
|
14099
|
+
*/
|
|
14100
|
+
sinceMs: number(),
|
|
14101
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
14102
|
+
atMs: number(),
|
|
14103
|
+
/**
|
|
14104
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
14105
|
+
* window. A failure count published without it is the mistake this schema
|
|
14106
|
+
* exists to make impossible.
|
|
14107
|
+
*/
|
|
14108
|
+
attempts: number().int().nonnegative(),
|
|
14109
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
14110
|
+
succeeded: number().int().nonnegative(),
|
|
14111
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
14112
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
14113
|
+
});
|
|
14114
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
13886
14115
|
var LoadContributionSchema = object({
|
|
13887
14116
|
role: _enum([
|
|
13888
14117
|
"decode",
|
|
@@ -18395,6 +18624,20 @@ var TrackSchema = object({
|
|
|
18395
18624
|
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
18396
18625
|
*/
|
|
18397
18626
|
hasRider: boolean().optional(),
|
|
18627
|
+
/**
|
|
18628
|
+
* WHY this track ended without a NATIVE best-shot tile
|
|
18629
|
+
* ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
|
|
18630
|
+
* a composed token line (`no-key-frame capture=keyframe:native-missx4`,
|
|
18631
|
+
* `derive-returned-null tile=standin`, …) written at close and CLEARED by
|
|
18632
|
+
* the late-keyFrame upgrade when a native tile lands after all. The
|
|
18633
|
+
* operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
18634
|
+
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
18635
|
+
*
|
|
18636
|
+
* **Absent ≠ "missed silently"**: a row written before the column, a hub
|
|
18637
|
+
* that predates the field, and every track whose tile landed native all
|
|
18638
|
+
* omit it. Render nothing when absent.
|
|
18639
|
+
*/
|
|
18640
|
+
previewMissReason: string().optional(),
|
|
18398
18641
|
...TrackFlagFields,
|
|
18399
18642
|
...TrackRetrainFields
|
|
18400
18643
|
});
|
|
@@ -27678,6 +27921,13 @@ var LoggingSettingsPatchSchema = object({
|
|
|
27678
27921
|
* anyone but its owner.
|
|
27679
27922
|
*/
|
|
27680
27923
|
var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
|
|
27924
|
+
/**
|
|
27925
|
+
* One per-camera failure counter, plus WHO reported it.
|
|
27926
|
+
*
|
|
27927
|
+
* Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
|
|
27928
|
+
* the hub as it enumerates providers, never by the contributor.
|
|
27929
|
+
*/
|
|
27930
|
+
var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
|
|
27681
27931
|
var GetLoggingSettingsInputSchema = object({
|
|
27682
27932
|
scopeNodeId: string().optional(),
|
|
27683
27933
|
/**
|
|
@@ -27736,7 +27986,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
|
|
|
27736
27986
|
}), method(_void(), SiteLocationStatusSchema, {
|
|
27737
27987
|
kind: "mutation",
|
|
27738
27988
|
auth: "admin"
|
|
27739
|
-
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
27989
|
+
}), 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, {
|
|
27740
27990
|
kind: "mutation",
|
|
27741
27991
|
auth: "admin"
|
|
27742
27992
|
});
|
|
@@ -28666,6 +28916,12 @@ Object.freeze({
|
|
|
28666
28916
|
addonId: null,
|
|
28667
28917
|
access: "view"
|
|
28668
28918
|
},
|
|
28919
|
+
"addonSettings.getIntegrationSettings": {
|
|
28920
|
+
capName: "addon-settings",
|
|
28921
|
+
capScope: "system",
|
|
28922
|
+
addonId: null,
|
|
28923
|
+
access: "view"
|
|
28924
|
+
},
|
|
28669
28925
|
"addonSettings.updateDeviceSettings": {
|
|
28670
28926
|
capName: "addon-settings",
|
|
28671
28927
|
capScope: "system",
|
|
@@ -30328,6 +30584,12 @@ Object.freeze({
|
|
|
30328
30584
|
addonId: null,
|
|
30329
30585
|
access: "create"
|
|
30330
30586
|
},
|
|
30587
|
+
"failureContribution.list": {
|
|
30588
|
+
capName: "failure-contribution",
|
|
30589
|
+
capScope: "system",
|
|
30590
|
+
addonId: null,
|
|
30591
|
+
access: "view"
|
|
30592
|
+
},
|
|
30331
30593
|
"fanControl.setDirection": {
|
|
30332
30594
|
capName: "fan-control",
|
|
30333
30595
|
capScope: "device",
|
|
@@ -33634,6 +33896,12 @@ Object.freeze({
|
|
|
33634
33896
|
addonId: null,
|
|
33635
33897
|
access: "create"
|
|
33636
33898
|
},
|
|
33899
|
+
"system.getFailureContributions": {
|
|
33900
|
+
capName: "system",
|
|
33901
|
+
capScope: "system",
|
|
33902
|
+
addonId: null,
|
|
33903
|
+
access: "view"
|
|
33904
|
+
},
|
|
33637
33905
|
"system.getLoadContributions": {
|
|
33638
33906
|
capName: "system",
|
|
33639
33907
|
capScope: "system",
|
|
@@ -5989,6 +5989,40 @@ var BaseAddon = class {
|
|
|
5989
5989
|
deviceSettingsSchema() {
|
|
5990
5990
|
return null;
|
|
5991
5991
|
}
|
|
5992
|
+
/**
|
|
5993
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
5994
|
+
* ARE the configuration of its integration.
|
|
5995
|
+
*
|
|
5996
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
5997
|
+
* operator should find on the addon's integration page (System →
|
|
5998
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
5999
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
6000
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
6001
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
6002
|
+
* nature of the integration.
|
|
6003
|
+
*
|
|
6004
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
6005
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
6006
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
6007
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
6008
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
6009
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
6010
|
+
*
|
|
6011
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
6012
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
6013
|
+
* removed with the reason recorded at
|
|
6014
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
6015
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
6016
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
6017
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
6018
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
6019
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
6020
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
6021
|
+
* ids it names.
|
|
6022
|
+
*/
|
|
6023
|
+
integrationSettingSections() {
|
|
6024
|
+
return [];
|
|
6025
|
+
}
|
|
5992
6026
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5993
6027
|
const schema = this.globalSettingsSchema(cap);
|
|
5994
6028
|
if (!schema) return { sections: [] };
|
|
@@ -5999,6 +6033,55 @@ var BaseAddon = class {
|
|
|
5999
6033
|
} : projected);
|
|
6000
6034
|
}
|
|
6001
6035
|
/**
|
|
6036
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
6037
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
6038
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
6039
|
+
*
|
|
6040
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
6041
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
6042
|
+
* as a failed load.
|
|
6043
|
+
*
|
|
6044
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
6045
|
+
* and not in whichever UI happens to render this:
|
|
6046
|
+
*
|
|
6047
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
6048
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
6049
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
6050
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
6051
|
+
* not merely discouraged.
|
|
6052
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
6053
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
6054
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
6055
|
+
* who opened the page (D266).
|
|
6056
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
6057
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
6058
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
6059
|
+
*/
|
|
6060
|
+
async getIntegrationSettings(nodeId) {
|
|
6061
|
+
const declared = this.integrationSettingSections();
|
|
6062
|
+
if (declared.length === 0) return null;
|
|
6063
|
+
const schema = this.globalSettingsSchema();
|
|
6064
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
6065
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
6066
|
+
const sections = [];
|
|
6067
|
+
for (const id of declared) {
|
|
6068
|
+
const section = byId.get(id);
|
|
6069
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
6070
|
+
const fields = dropPerNodeFields(section.fields);
|
|
6071
|
+
if (fields.length === 0) continue;
|
|
6072
|
+
sections.push({
|
|
6073
|
+
...section,
|
|
6074
|
+
fields
|
|
6075
|
+
});
|
|
6076
|
+
}
|
|
6077
|
+
if (sections.length === 0) return null;
|
|
6078
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6079
|
+
return hydrateSchema({
|
|
6080
|
+
...schema,
|
|
6081
|
+
sections
|
|
6082
|
+
}, projected);
|
|
6083
|
+
}
|
|
6084
|
+
/**
|
|
6002
6085
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
6003
6086
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
6004
6087
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6302,6 +6385,41 @@ var BaseAddon = class {
|
|
|
6302
6385
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6303
6386
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6304
6387
|
*/
|
|
6388
|
+
/**
|
|
6389
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6390
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6391
|
+
* with no child is dropped rather than rendered empty.
|
|
6392
|
+
*
|
|
6393
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6394
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6395
|
+
*/
|
|
6396
|
+
function dropPerNodeFields(fields) {
|
|
6397
|
+
const kept = [];
|
|
6398
|
+
for (const field of fields) {
|
|
6399
|
+
if (field.type === "group") {
|
|
6400
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6401
|
+
if (inner.length > 0) kept.push({
|
|
6402
|
+
...field,
|
|
6403
|
+
fields: inner
|
|
6404
|
+
});
|
|
6405
|
+
continue;
|
|
6406
|
+
}
|
|
6407
|
+
if (field.type === "sub-tabs") {
|
|
6408
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6409
|
+
...tab,
|
|
6410
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6411
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6412
|
+
if (tabs.length > 0) kept.push({
|
|
6413
|
+
...field,
|
|
6414
|
+
tabs
|
|
6415
|
+
});
|
|
6416
|
+
continue;
|
|
6417
|
+
}
|
|
6418
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6419
|
+
kept.push(field);
|
|
6420
|
+
}
|
|
6421
|
+
return kept;
|
|
6422
|
+
}
|
|
6305
6423
|
function collectPerNodeFieldKeys(fields) {
|
|
6306
6424
|
const collected = [];
|
|
6307
6425
|
for (const field of fields) {
|
|
@@ -10106,6 +10224,9 @@ method(object({
|
|
|
10106
10224
|
kind: "mutation",
|
|
10107
10225
|
auth: "admin"
|
|
10108
10226
|
}), method(object({
|
|
10227
|
+
addonId: string(),
|
|
10228
|
+
nodeId: string().optional()
|
|
10229
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
10109
10230
|
addonId: string(),
|
|
10110
10231
|
deviceId: number(),
|
|
10111
10232
|
nodeId: string().optional()
|
|
@@ -13871,6 +13992,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
13871
13992
|
limit: number().optional(),
|
|
13872
13993
|
tags: record(string(), string()).optional()
|
|
13873
13994
|
}), array(LogEntrySchema).readonly());
|
|
13995
|
+
/**
|
|
13996
|
+
* `failure-contribution` — the capability an addon reports its OWN losses
|
|
13997
|
+
* through, per camera, with the denominator attached. It stores nothing.
|
|
13998
|
+
*
|
|
13999
|
+
* ## The twin of `load-contribution`, and why it is a twin and not a field
|
|
14000
|
+
*
|
|
14001
|
+
* `load-contribution` answers *what did this camera COST*. This answers *what
|
|
14002
|
+
* did this camera LOSE*. The reporting discipline is identical and deliberately
|
|
14003
|
+
* copied: the contributor reports what it already knows, hub-main adds only
|
|
14004
|
+
* `addonId`, nothing needs global knowledge, and there is no central list for
|
|
14005
|
+
* somebody to forget to edit.
|
|
14006
|
+
*
|
|
14007
|
+
* They are not merged, because their invariants are opposites:
|
|
14008
|
+
*
|
|
14009
|
+
* - a `load-contribution` measurement is **absent, never zero** — a zero would
|
|
14010
|
+
* claim a camera cost nothing, which is a measurement nobody made;
|
|
14011
|
+
* - a `failure-contribution` zero is the **most valuable value on the
|
|
14012
|
+
* surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
|
|
14013
|
+
* and it is exactly what an absent entry cannot say.
|
|
14014
|
+
*
|
|
14015
|
+
* Putting a loss counter on a cost entry would also break the reconciliation
|
|
14016
|
+
* that gives `load-contribution` its point: contributions are subtracted from
|
|
14017
|
+
* `metrics.node-processes-snapshot` to find processes nobody claims. A failure
|
|
14018
|
+
* has no process.
|
|
14019
|
+
*
|
|
14020
|
+
* ## Why not a log line, since the counters already exist
|
|
14021
|
+
*
|
|
14022
|
+
* Several of these paths already counted themselves — `CaptureScheduler`'s
|
|
14023
|
+
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
14024
|
+
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
14025
|
+
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
14026
|
+
* ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
|
|
14027
|
+
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
14028
|
+
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
14029
|
+
* be READ.
|
|
14030
|
+
*
|
|
14031
|
+
* ## The rate is served with its denominator or not at all
|
|
14032
|
+
*
|
|
14033
|
+
* Every entry carries `attempts` and `succeeded`. A miss count alone is
|
|
14034
|
+
* unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
|
|
14035
|
+
* than yesterday" and was **flat across twelve hours** once divided by the
|
|
14036
|
+
* successes on the same path. A surface that publishes only the numerator
|
|
14037
|
+
* reproduces that mistake on every read.
|
|
14038
|
+
*
|
|
14039
|
+
* ## Shape
|
|
14040
|
+
*
|
|
14041
|
+
* Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
|
|
14042
|
+
* `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
|
|
14043
|
+
* generated hooks, while `addons.listCapabilityProviders` still enumerates it
|
|
14044
|
+
* and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
|
|
14045
|
+
* a forked runner's entries reach hub-main over transport that already exists.
|
|
14046
|
+
* No new UDS message, no second registry (D3). The operator reads the assembled
|
|
14047
|
+
* result through `system.getFailureContributions`.
|
|
14048
|
+
*/
|
|
14049
|
+
var FailureReasonCountSchema = object({
|
|
14050
|
+
/**
|
|
14051
|
+
* Why the attempt did not land, in the contributor's own vocabulary —
|
|
14052
|
+
* `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
|
|
14053
|
+
* strings that already appear in this repo's logs and, where one exists, the
|
|
14054
|
+
* same string the per-track `previewMissReason` records (D276): a second
|
|
14055
|
+
* vocabulary for the same loss would make the row and the counter
|
|
14056
|
+
* un-joinable.
|
|
14057
|
+
*/
|
|
14058
|
+
reason: string(),
|
|
14059
|
+
count: number().int().nonnegative()
|
|
14060
|
+
});
|
|
14061
|
+
var FailureContributionSchema = object({
|
|
14062
|
+
/**
|
|
14063
|
+
* The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
|
|
14064
|
+
* `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
|
|
14065
|
+
* `unit` free: the families are owned by different addons and a shared enum
|
|
14066
|
+
* is a central list that rots invisibly.
|
|
14067
|
+
*/
|
|
14068
|
+
family: string(),
|
|
14069
|
+
/**
|
|
14070
|
+
* The NUMERIC device id — the same value every log line carries as
|
|
14071
|
+
* `tags.deviceId`. Never nullable and never absent: a contributor that
|
|
14072
|
+
* cannot name the camera must not emit the entry, because a fleet total
|
|
14073
|
+
* cannot answer the only question anybody asks of this surface.
|
|
14074
|
+
*/
|
|
14075
|
+
deviceId: number().int().positive(),
|
|
14076
|
+
/**
|
|
14077
|
+
* A second dimension inside the family: the model / step id for an inference
|
|
14078
|
+
* timeout, so "which camera AND which model" is one read. Absent when the
|
|
14079
|
+
* family has a single variant.
|
|
14080
|
+
*/
|
|
14081
|
+
variant: string().optional(),
|
|
14082
|
+
/**
|
|
14083
|
+
* Epoch ms this counter started — the INCARNATION MARKER. A consumer
|
|
14084
|
+
* differencing two reads must drop the interval when it changes, because the
|
|
14085
|
+
* counter restarted from zero in a respawned runner. Same discipline as
|
|
14086
|
+
* `LoadContribution.startedAtMs`.
|
|
14087
|
+
*/
|
|
14088
|
+
sinceMs: number(),
|
|
14089
|
+
/** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
|
|
14090
|
+
atMs: number(),
|
|
14091
|
+
/**
|
|
14092
|
+
* THE DENOMINATOR — every attempt on this path for this camera in the
|
|
14093
|
+
* window. A failure count published without it is the mistake this schema
|
|
14094
|
+
* exists to make impossible.
|
|
14095
|
+
*/
|
|
14096
|
+
attempts: number().int().nonnegative(),
|
|
14097
|
+
/** Attempts that landed. `attempts - succeeded` is the loss. */
|
|
14098
|
+
succeeded: number().int().nonnegative(),
|
|
14099
|
+
/** The loss, partitioned. Sums to `attempts - succeeded`. */
|
|
14100
|
+
reasons: array(FailureReasonCountSchema).readonly()
|
|
14101
|
+
});
|
|
14102
|
+
method(_void(), array(FailureContributionSchema).readonly());
|
|
13874
14103
|
var LoadContributionSchema = object({
|
|
13875
14104
|
role: _enum([
|
|
13876
14105
|
"decode",
|
|
@@ -18383,6 +18612,20 @@ var TrackSchema = object({
|
|
|
18383
18612
|
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
18384
18613
|
*/
|
|
18385
18614
|
hasRider: boolean().optional(),
|
|
18615
|
+
/**
|
|
18616
|
+
* WHY this track ended without a NATIVE best-shot tile
|
|
18617
|
+
* ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
|
|
18618
|
+
* a composed token line (`no-key-frame capture=keyframe:native-missx4`,
|
|
18619
|
+
* `derive-returned-null tile=standin`, …) written at close and CLEARED by
|
|
18620
|
+
* the late-keyFrame upgrade when a native tile lands after all. The
|
|
18621
|
+
* operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
18622
|
+
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
18623
|
+
*
|
|
18624
|
+
* **Absent ≠ "missed silently"**: a row written before the column, a hub
|
|
18625
|
+
* that predates the field, and every track whose tile landed native all
|
|
18626
|
+
* omit it. Render nothing when absent.
|
|
18627
|
+
*/
|
|
18628
|
+
previewMissReason: string().optional(),
|
|
18386
18629
|
...TrackFlagFields,
|
|
18387
18630
|
...TrackRetrainFields
|
|
18388
18631
|
});
|
|
@@ -27666,6 +27909,13 @@ var LoggingSettingsPatchSchema = object({
|
|
|
27666
27909
|
* anyone but its owner.
|
|
27667
27910
|
*/
|
|
27668
27911
|
var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
|
|
27912
|
+
/**
|
|
27913
|
+
* One per-camera failure counter, plus WHO reported it.
|
|
27914
|
+
*
|
|
27915
|
+
* Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
|
|
27916
|
+
* the hub as it enumerates providers, never by the contributor.
|
|
27917
|
+
*/
|
|
27918
|
+
var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
|
|
27669
27919
|
var GetLoggingSettingsInputSchema = object({
|
|
27670
27920
|
scopeNodeId: string().optional(),
|
|
27671
27921
|
/**
|
|
@@ -27724,7 +27974,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
|
|
|
27724
27974
|
}), method(_void(), SiteLocationStatusSchema, {
|
|
27725
27975
|
kind: "mutation",
|
|
27726
27976
|
auth: "admin"
|
|
27727
|
-
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
27977
|
+
}), 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, {
|
|
27728
27978
|
kind: "mutation",
|
|
27729
27979
|
auth: "admin"
|
|
27730
27980
|
});
|
|
@@ -28654,6 +28904,12 @@ Object.freeze({
|
|
|
28654
28904
|
addonId: null,
|
|
28655
28905
|
access: "view"
|
|
28656
28906
|
},
|
|
28907
|
+
"addonSettings.getIntegrationSettings": {
|
|
28908
|
+
capName: "addon-settings",
|
|
28909
|
+
capScope: "system",
|
|
28910
|
+
addonId: null,
|
|
28911
|
+
access: "view"
|
|
28912
|
+
},
|
|
28657
28913
|
"addonSettings.updateDeviceSettings": {
|
|
28658
28914
|
capName: "addon-settings",
|
|
28659
28915
|
capScope: "system",
|
|
@@ -30316,6 +30572,12 @@ Object.freeze({
|
|
|
30316
30572
|
addonId: null,
|
|
30317
30573
|
access: "create"
|
|
30318
30574
|
},
|
|
30575
|
+
"failureContribution.list": {
|
|
30576
|
+
capName: "failure-contribution",
|
|
30577
|
+
capScope: "system",
|
|
30578
|
+
addonId: null,
|
|
30579
|
+
access: "view"
|
|
30580
|
+
},
|
|
30319
30581
|
"fanControl.setDirection": {
|
|
30320
30582
|
capName: "fan-control",
|
|
30321
30583
|
capScope: "device",
|
|
@@ -33622,6 +33884,12 @@ Object.freeze({
|
|
|
33622
33884
|
addonId: null,
|
|
33623
33885
|
access: "create"
|
|
33624
33886
|
},
|
|
33887
|
+
"system.getFailureContributions": {
|
|
33888
|
+
capName: "system",
|
|
33889
|
+
capScope: "system",
|
|
33890
|
+
addonId: null,
|
|
33891
|
+
access: "view"
|
|
33892
|
+
},
|
|
33625
33893
|
"system.getLoadContributions": {
|
|
33626
33894
|
capName: "system",
|
|
33627
33895
|
capScope: "system",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-export-hap",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.50",
|
|
4
4
|
"description": "HomeKit (HAP) exporter for CamStack devices. Publishes each exposed device as its own HomeKit accessory: cameras and doorbells with SRTP streaming, HomeKit Secure Video, motion, two-way audio, PTZ and battery; switches, lights, locks and sensors through a capability→service table.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|