@camstack/addon-export-hap 1.2.49 → 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.
@@ -14004,6 +14004,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14004
14004
  limit: number().optional(),
14005
14005
  tags: record(string(), string()).optional()
14006
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());
14007
14115
  var LoadContributionSchema = object({
14008
14116
  role: _enum([
14009
14117
  "decode",
@@ -18516,6 +18624,20 @@ var TrackSchema = object({
18516
18624
  * `=== true` and render nothing otherwise — never infer "no rider".
18517
18625
  */
18518
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(),
18519
18641
  ...TrackFlagFields,
18520
18642
  ...TrackRetrainFields
18521
18643
  });
@@ -27799,6 +27921,13 @@ var LoggingSettingsPatchSchema = object({
27799
27921
  * anyone but its owner.
27800
27922
  */
27801
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() });
27802
27931
  var GetLoggingSettingsInputSchema = object({
27803
27932
  scopeNodeId: string().optional(),
27804
27933
  /**
@@ -27857,7 +27986,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
27857
27986
  }), method(_void(), SiteLocationStatusSchema, {
27858
27987
  kind: "mutation",
27859
27988
  auth: "admin"
27860
- }), 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, {
27861
27990
  kind: "mutation",
27862
27991
  auth: "admin"
27863
27992
  });
@@ -30455,6 +30584,12 @@ Object.freeze({
30455
30584
  addonId: null,
30456
30585
  access: "create"
30457
30586
  },
30587
+ "failureContribution.list": {
30588
+ capName: "failure-contribution",
30589
+ capScope: "system",
30590
+ addonId: null,
30591
+ access: "view"
30592
+ },
30458
30593
  "fanControl.setDirection": {
30459
30594
  capName: "fan-control",
30460
30595
  capScope: "device",
@@ -33761,6 +33896,12 @@ Object.freeze({
33761
33896
  addonId: null,
33762
33897
  access: "create"
33763
33898
  },
33899
+ "system.getFailureContributions": {
33900
+ capName: "system",
33901
+ capScope: "system",
33902
+ addonId: null,
33903
+ access: "view"
33904
+ },
33764
33905
  "system.getLoadContributions": {
33765
33906
  capName: "system",
33766
33907
  capScope: "system",
@@ -13992,6 +13992,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13992
13992
  limit: number().optional(),
13993
13993
  tags: record(string(), string()).optional()
13994
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());
13995
14103
  var LoadContributionSchema = object({
13996
14104
  role: _enum([
13997
14105
  "decode",
@@ -18504,6 +18612,20 @@ var TrackSchema = object({
18504
18612
  * `=== true` and render nothing otherwise — never infer "no rider".
18505
18613
  */
18506
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(),
18507
18629
  ...TrackFlagFields,
18508
18630
  ...TrackRetrainFields
18509
18631
  });
@@ -27787,6 +27909,13 @@ var LoggingSettingsPatchSchema = object({
27787
27909
  * anyone but its owner.
27788
27910
  */
27789
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() });
27790
27919
  var GetLoggingSettingsInputSchema = object({
27791
27920
  scopeNodeId: string().optional(),
27792
27921
  /**
@@ -27845,7 +27974,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
27845
27974
  }), method(_void(), SiteLocationStatusSchema, {
27846
27975
  kind: "mutation",
27847
27976
  auth: "admin"
27848
- }), 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, {
27849
27978
  kind: "mutation",
27850
27979
  auth: "admin"
27851
27980
  });
@@ -30443,6 +30572,12 @@ Object.freeze({
30443
30572
  addonId: null,
30444
30573
  access: "create"
30445
30574
  },
30575
+ "failureContribution.list": {
30576
+ capName: "failure-contribution",
30577
+ capScope: "system",
30578
+ addonId: null,
30579
+ access: "view"
30580
+ },
30446
30581
  "fanControl.setDirection": {
30447
30582
  capName: "fan-control",
30448
30583
  capScope: "device",
@@ -33749,6 +33884,12 @@ Object.freeze({
33749
33884
  addonId: null,
33750
33885
  access: "create"
33751
33886
  },
33887
+ "system.getFailureContributions": {
33888
+ capName: "system",
33889
+ capScope: "system",
33890
+ addonId: null,
33891
+ access: "view"
33892
+ },
33752
33893
  "system.getLoadContributions": {
33753
33894
  capName: "system",
33754
33895
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-hap",
3
- "version": "1.2.49",
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",