@camstack/addon-provider-reolink 1.2.53 → 1.2.55

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.
Files changed (3) hide show
  1. package/dist/addon.js +577 -59
  2. package/dist/addon.mjs +577 -59
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -7560,6 +7560,66 @@ var OpsLogQueryInputSchema = object({
7560
7560
  /** Max rows returned, newest-first. */
7561
7561
  limit: number().int().min(1).max(1e3).optional()
7562
7562
  });
7563
+ var LabelDefinitionSchema = object({
7564
+ id: string(),
7565
+ name: string(),
7566
+ category: string().optional(),
7567
+ description: string().optional(),
7568
+ icon: string().optional()
7569
+ });
7570
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
7571
+ var CLASS_MAP_MACRO_TARGETS = [
7572
+ "person",
7573
+ "vehicle",
7574
+ "animal",
7575
+ "package"
7576
+ ];
7577
+ /**
7578
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
7579
+ * un operatore può selezionare.
7580
+ *
7581
+ * Sono le tre offerte dallo step `object-detection`
7582
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
7583
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
7584
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
7585
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
7586
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
7587
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
7588
+ *
7589
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
7590
+ * dello step e una seconda volta come union `FirstLevelMacro`
7591
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
7592
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
7593
+ * successiva.
7594
+ */
7595
+ var FIRST_LEVEL_MACRO_CLASSES = [
7596
+ "person",
7597
+ "vehicle",
7598
+ "animal"
7599
+ ];
7600
+ /**
7601
+ * Wire schema for a per-model CATALOG classMap override
7602
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
7603
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
7604
+ * detection pipeline executor actually routes.
7605
+ *
7606
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
7607
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
7608
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
7609
+ * enum) — the two used to share the name `ClassMapDefinition`/
7610
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
7611
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
7612
+ * are not: it is two different concepts colliding on a name. Keep this type
7613
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
7614
+ * would either narrow every `ClassMapDefinition` consumer to the four
7615
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
7616
+ * schema exists for (see the "rejects a classMap whose target is not a
7617
+ * detection macro" test in `model-catalog-schema.test.ts`).
7618
+ */
7619
+ var DetectionCatalogClassMapSchema = object({
7620
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
7621
+ preserveOriginal: boolean()
7622
+ });
7563
7623
  /**
7564
7624
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
7565
7625
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -7582,10 +7642,55 @@ var RecordingStorageModeSchema = _enum([
7582
7642
  "events",
7583
7643
  "continuous"
7584
7644
  ]);
7645
+ /**
7646
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
7647
+ * tre offerte dallo step `object-detection`, da UNA lista
7648
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
7649
+ */
7650
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
7651
+ /**
7652
+ * True quando `values` non ripete un elemento.
7653
+ *
7654
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
7655
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
7656
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
7657
+ */
7658
+ var noDuplicates = (values) => new Set(values).size === values.length;
7585
7659
  /** Which detectors trigger an `events`-mode band. */
7586
7660
  var RecordingTriggersSchema = object({
7587
7661
  motion: boolean().optional(),
7588
- audioThresholdDbfs: number().optional()
7662
+ audioThresholdDbfs: number().optional(),
7663
+ /**
7664
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
7665
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
7666
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
7667
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
7668
+ *
7669
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
7670
+ * quelle che hanno attraversato `enabledMacroClasses`, i
7671
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
7672
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
7673
+ * finestre — vedi `recorder/object-trigger.ts`.
7674
+ */
7675
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
7676
+ /**
7677
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
7678
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
7679
+ * `objectClasses`.
7680
+ *
7681
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
7682
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
7683
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
7684
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
7685
+ * device (D12) — mai un elenco globale di cap.
7686
+ *
7687
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
7688
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
7689
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
7690
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
7691
+ * registrare.
7692
+ */
7693
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7589
7694
  });
7590
7695
  /**
7591
7696
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8212,41 +8317,6 @@ var TIMEZONES = [
8212
8317
  function findTimezone(id) {
8213
8318
  return TIMEZONES.find((tz) => tz.id === id);
8214
8319
  }
8215
- var LabelDefinitionSchema = object({
8216
- id: string(),
8217
- name: string(),
8218
- category: string().optional(),
8219
- description: string().optional(),
8220
- icon: string().optional()
8221
- });
8222
- /**
8223
- * Wire schema for a per-model CATALOG classMap override
8224
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8225
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8226
- * detection pipeline executor actually routes.
8227
- *
8228
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8229
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8230
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8231
- * enum) — the two used to share the name `ClassMapDefinition`/
8232
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8233
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8234
- * are not: it is two different concepts colliding on a name. Keep this type
8235
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8236
- * would either narrow every `ClassMapDefinition` consumer to the four
8237
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8238
- * schema exists for (see the "rejects a classMap whose target is not a
8239
- * detection macro" test in `model-catalog-schema.test.ts`).
8240
- */
8241
- var DetectionCatalogClassMapSchema = object({
8242
- mapping: record(string(), _enum([
8243
- "person",
8244
- "vehicle",
8245
- "animal",
8246
- "package"
8247
- ])),
8248
- preserveOriginal: boolean()
8249
- });
8250
8320
  var MODEL_FORMATS = [
8251
8321
  "onnx",
8252
8322
  "coreml",
@@ -21478,7 +21548,7 @@ var lifecycleJobSchema = object({
21478
21548
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21479
21549
  * as every other cap.
21480
21550
  */
21481
- var LogLevelSchema$1 = _enum([
21551
+ var LogLevelSchema$2 = _enum([
21482
21552
  "debug",
21483
21553
  "info",
21484
21554
  "warn",
@@ -21685,7 +21755,7 @@ var CustomActionInputSchema = object({
21685
21755
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21686
21756
  addonId: string(),
21687
21757
  limit: number().min(1).max(500).default(100),
21688
- level: LogLevelSchema$1.optional()
21758
+ level: LogLevelSchema$2.optional()
21689
21759
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21690
21760
  packageName: string(),
21691
21761
  version: string().optional()
@@ -21783,7 +21853,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21783
21853
  auth: "admin"
21784
21854
  }), method(object({
21785
21855
  addonId: string(),
21786
- level: LogLevelSchema$1.optional()
21856
+ level: LogLevelSchema$2.optional()
21787
21857
  }), LogStreamEntrySchema, { kind: "subscription" });
21788
21858
  /**
21789
21859
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -23507,6 +23577,35 @@ var FaceFilterEnum = _enum([
23507
23577
  "identified",
23508
23578
  "all"
23509
23579
  ]);
23580
+ /**
23581
+ * What a `listRecentFaces` page is ORDERED BY.
23582
+ *
23583
+ * - `timestamp` — when the face was seen. The historical (and default) order.
23584
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
23585
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
23586
+ * order: it puts the suggestions an operator can confirm with one tap at the
23587
+ * top, and it is the reason this enum exists — a client that ranked a capped
23588
+ * page client-side was ranking the newest N, never the most certain N.
23589
+ *
23590
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
23591
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
23592
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
23593
+ * — flipping the direction reorders the rows that HAVE a certainty and never
23594
+ * floods the page with the ones that do not. `addon-post-analysis`'s
23595
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
23596
+ * then by faceId, and is what makes this a total order instead of the
23597
+ * backend's NULL-collation accident.
23598
+ */
23599
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
23600
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
23601
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
23602
+ * never leaves the server. */
23603
+ var FaceClusterSchema = object({
23604
+ faceIds: array(string()).readonly(),
23605
+ representativeFaceId: string(),
23606
+ size: number().int(),
23607
+ cohesion: number()
23608
+ });
23510
23609
  var MediaFileLiteSchema$1 = object({
23511
23610
  key: string(),
23512
23611
  kind: string(),
@@ -23553,24 +23652,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23553
23652
  kind: "mutation",
23554
23653
  auth: "admin"
23555
23654
  }), method(object({
23556
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
23655
+ /**
23656
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
23657
+ *
23658
+ * The legacy single-camera form, kept verbatim for every caller that
23659
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
23660
+ * instead — never both: `deviceIds` is the authority whenever it is
23661
+ * present, and this field is then ignored rather than unioned, so
23662
+ * there is exactly one answer to "which cameras did I ask for".
23663
+ */
23557
23664
  deviceId: number().int().optional(),
23665
+ /**
23666
+ * Restrict to a SET of cameras — the review UI's camera filter, which
23667
+ * until now had to fetch the cluster-wide page and drop rows in the
23668
+ * client (so the `limit` it asked for was spent on cameras it was
23669
+ * about to discard).
23670
+ *
23671
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
23672
+ * "every camera". A request for no devices is a request, not an
23673
+ * omission; same contract as `deviceManager.listFleet` and
23674
+ * `pipelineAnalytics.listRecentTracks`.
23675
+ *
23676
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
23677
+ */
23678
+ deviceIds: array(number().int()).optional(),
23558
23679
  limit: number().int().positive().optional(),
23559
23680
  filter: FaceFilterEnum.optional(),
23560
23681
  /**
23561
- * Inline the base64 crop on every row. Default `true` — the existing
23562
- * behaviour, kept so no caller breaks.
23682
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23683
+ * Absent means no lower bound.
23684
+ */
23685
+ since: number().int().optional(),
23686
+ /**
23687
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23688
+ * Absent means no upper bound.
23689
+ */
23690
+ until: number().int().optional(),
23691
+ /**
23692
+ * Order the page by time or by suggestion certainty. Default
23693
+ * `'timestamp'` — the historical order, unchanged for every caller
23694
+ * that does not ask.
23563
23695
  *
23564
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
23565
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
23566
- * the browser cache the images.
23696
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
23697
+ * does under `'suggestionConfidence'`.
23567
23698
  *
23568
- * **This is an INPUT field, so it does not reach the addon until the
23569
- * next train.** The hub router validates cap inputs against its own
23570
- * compiled Zod, which strips a key it does not know verified today
23571
- * on the OUTPUT side, where an additive field DOES arrive immediately
23572
- * (`Track.hasFace`). Until the train ships, sending `false` is
23573
- * harmless and simply keeps the crops inline.
23699
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
23700
+ * index and stops reading as soon as `limit` rows have PASSED the
23701
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
23702
+ * certain row may be the oldest so it walks the window. Narrow it
23703
+ * with {@link since} / {@link until}.
23704
+ */
23705
+ sortBy: FaceSortFieldEnum.optional(),
23706
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
23707
+ sortDirection: FaceSortDirectionEnum.optional(),
23708
+ /**
23709
+ * Inline the base64 crop on every row.
23710
+ *
23711
+ * Default `false` since the 2026-08-25 inversion — see
23712
+ * `include-crops-default.ts`, which is the ONE place that resolves
23713
+ * this for every gallery, and which records why the inline shape had
23714
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
23715
+ * The doc here used to still say `true`; it was wrong, and a leftover
23716
+ * that describes the old design reads as permission to rely on it.
23717
+ *
23718
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
23719
+ * which the browser fetches off the `event-media` plane in parallel,
23720
+ * cached and ETagged.
23574
23721
  */
23575
23722
  includeCrops: boolean().optional()
23576
23723
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -23606,13 +23753,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23606
23753
  }), method(object({
23607
23754
  threshold: number().min(0).max(1).optional(),
23608
23755
  minClusterSize: number().int().min(2).optional(),
23609
- limit: number().int().positive().optional()
23610
- }).optional(), array(object({
23611
- faceIds: array(string()).readonly(),
23612
- representativeFaceId: string(),
23613
- size: number().int(),
23614
- cohesion: number()
23615
- })).readonly());
23756
+ /**
23757
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
23758
+ * which read as though it bounded the work — it never did.
23759
+ *
23760
+ * Wins over {@link limit} when both are sent.
23761
+ */
23762
+ maxClusters: number().int().positive().optional(),
23763
+ /**
23764
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
23765
+ * RESULT, not the scan. Kept so existing callers keep working; send
23766
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
23767
+ */
23768
+ limit: number().int().positive().optional(),
23769
+ /**
23770
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
23771
+ * POOL, not the result.
23772
+ *
23773
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
23774
+ * used to read every unassigned face on the hub no matter what the
23775
+ * caller asked for, because the only bound cut the finished clusters
23776
+ * afterwards; a UI showing a window of 100 paid for a scan of the
23777
+ * whole corpus, on an addon whose disk is under contention.
23778
+ *
23779
+ * The pool is the NEWEST matching faces first — the same order the
23780
+ * gallery shows — so a bound here shortens the horizon, it does not
23781
+ * sample it randomly.
23782
+ *
23783
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
23784
+ * so the live corpus — 372 face rows — is unaffected while the
23785
+ * unbounded scan can never come back as the table grows.
23786
+ */
23787
+ maxFacesScanned: number().int().positive().optional()
23788
+ }).optional(), array(FaceClusterSchema).readonly());
23616
23789
  /**
23617
23790
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
23618
23791
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -28839,6 +29012,293 @@ var SetSiteLocationInputSchema = object({
28839
29012
  latitude: number().min(-90).max(90),
28840
29013
  longitude: number().min(-180).max(180)
28841
29014
  }).nullable();
29015
+ /**
29016
+ * The TRANSPORT a call arrived on.
29017
+ *
29018
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
29019
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
29020
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
29021
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
29022
+ * checkable rather than asserted.
29023
+ *
29024
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
29025
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
29026
+ * connection; the viewer talks to the hub over `wsLink`
29027
+ * exclusively, so this is the plane the HTTP census could not see.
29028
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
29029
+ * never touches a socket and therefore never touched a census.
29030
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
29031
+ * that is exactly what its `0` asserts: every plane the hub has can name
29032
+ * itself. It is an output bucket, never a knob — a call that arrives on a
29033
+ * plane nobody instrumented lands here instead of vanishing from the total.
29034
+ */
29035
+ var TransportPlaneSchema = _enum([
29036
+ "http",
29037
+ "ws",
29038
+ "mesh",
29039
+ "unknown"
29040
+ ]);
29041
+ /**
29042
+ * Calls per plane. Every key is always present, `0` included — an absent plane
29043
+ * reads as "not instrumented", which is the one thing this census must never
29044
+ * make an operator wonder about.
29045
+ */
29046
+ var TransportPlaneCountsSchema = object({
29047
+ http: number(),
29048
+ ws: number(),
29049
+ mesh: number(),
29050
+ unknown: number()
29051
+ });
29052
+ /**
29053
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
29054
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29055
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29056
+ * already prints - never a token, never an `Authorization` header.
29057
+ *
29058
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
29059
+ * and lives for hours, so folding it into a call count makes one long-lived
29060
+ * stream look like a storm.
29061
+ */
29062
+ var RequestCensusGroupSchema = object({
29063
+ plane: TransportPlaneSchema,
29064
+ procedure: string(),
29065
+ userAgent: string(),
29066
+ ip: string(),
29067
+ principal: string(),
29068
+ calls: number(),
29069
+ subscriptions: number(),
29070
+ perMin: number()
29071
+ });
29072
+ /**
29073
+ * A procedure's TOTAL over the window, across every caller.
29074
+ *
29075
+ * This block, not the group list, is what answers "did these calls arrive over
29076
+ * HTTP at all". A total far BELOW what a store-side census counted over the
29077
+ * same window excludes the HTTP plane, which is a result, not a failure.
29078
+ */
29079
+ var RequestCensusProcedureSchema = object({
29080
+ procedure: string(),
29081
+ calls: number(),
29082
+ /**
29083
+ * The same total, split by transport. THIS is the row that answers the
29084
+ * question the census exists for: one look at `deviceManager.listAll` says
29085
+ * which plane carried the 4 960, without joining two log lines by eye.
29086
+ */
29087
+ planes: TransportPlaneCountsSchema,
29088
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
29089
+ subscriptions: number(),
29090
+ perMin: number()
29091
+ });
29092
+ /**
29093
+ * The census as an operator sees it.
29094
+ *
29095
+ * `persisted` is the honest answer to "will this survive the restart I am
29096
+ * about to do": the arm deadline is written to `system-settings` so a window
29097
+ * armed now can measure the NEXT boot, and a write that failed must not look
29098
+ * like one that succeeded.
29099
+ */
29100
+ var RequestCensusStatusSchema = object({
29101
+ armed: boolean(),
29102
+ /** How long the current - or just-closed - window collected, in ms. */
29103
+ elapsedMs: number(),
29104
+ /** The window actually armed, after the server clamped the request. */
29105
+ windowMs: number(),
29106
+ /** Epoch ms the window closes at. 0 when disarmed. */
29107
+ armedUntilMs: number(),
29108
+ httpRequests: number(),
29109
+ batchedRequests: number(),
29110
+ /**
29111
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
29112
+ * is in play (`?batch=1` carries several procedures in one request); this is
29113
+ * the number comparable with a store-side call count.
29114
+ */
29115
+ procedureCalls: number(),
29116
+ /**
29117
+ * `procedureCalls` split by transport. The four keys sum to
29118
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
29119
+ * `planesExplainTotal` is that identity, checked rather than assumed.
29120
+ */
29121
+ planes: TransportPlaneCountsSchema,
29122
+ /**
29123
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
29124
+ * on no plane at all - which is a RESULT (a plane is missing from the
29125
+ * instrument), not a failure, and it has to be visible to be read as one.
29126
+ */
29127
+ planesExplainTotal: boolean(),
29128
+ /**
29129
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
29130
+ * adapter resolves one context per connection - kept because a plane's call
29131
+ * count of zero against 37 open connections says something different from a
29132
+ * plane with no connections at all.
29133
+ */
29134
+ wsConnections: number(),
29135
+ /**
29136
+ * Client frames the WS plane looked at. `wsMessages` far above
29137
+ * `planes.ws + subscriptions` means most traffic is not operations
29138
+ * (keepalives, connection params) - which is itself an answer.
29139
+ */
29140
+ wsMessages: number(),
29141
+ /**
29142
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
29143
+ * purpose: one live-events stream opened at boot and held for six hours is
29144
+ * one subscription, and counting it as a call would let a quiet plane
29145
+ * masquerade as the storm.
29146
+ */
29147
+ subscriptions: number(),
29148
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
29149
+ subscriptionStops: number(),
29150
+ distinctGroups: number(),
29151
+ /**
29152
+ * Operations counted in the totals whose CALLER attribution was shed at the
29153
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
29154
+ * which transport they arrived on, they just lost their group row.
29155
+ */
29156
+ unattributedCalls: number(),
29157
+ procedures: array(RequestCensusProcedureSchema).readonly(),
29158
+ groups: array(RequestCensusGroupSchema).readonly()
29159
+ }).extend({ persisted: boolean() });
29160
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
29161
+ var LogLevelSchema$1 = _enum([
29162
+ "debug",
29163
+ "info",
29164
+ "warn",
29165
+ "error"
29166
+ ]);
29167
+ /**
29168
+ * The diagnostics that can be ARMED for a window. Exactly one today.
29169
+ *
29170
+ * A diagnostic is anything whose cost is only worth paying while a question is
29171
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
29172
+ */
29173
+ var DiagnosticIdSchema = _enum(["request-census"]);
29174
+ /**
29175
+ * The layers of the level hierarchy, general → specific. The most specific
29176
+ * layer that carries an explicit value wins.
29177
+ *
29178
+ * `component` is DECLARED and not yet resolvable: the per-component channels
29179
+ * are a later slice of the same plan, and a `levelSource` enum that has to
29180
+ * grow later would force every consumer of this document to change with it.
29181
+ * Nothing returns `component` today.
29182
+ */
29183
+ var LoggingScopeKindSchema = _enum([
29184
+ "cluster",
29185
+ "node",
29186
+ "component"
29187
+ ]);
29188
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
29189
+ var LoggingLevelSourceSchema = _enum([
29190
+ "default",
29191
+ "cluster",
29192
+ "node",
29193
+ "component"
29194
+ ]);
29195
+ /**
29196
+ * One layer of the hierarchy as it actually STANDS.
29197
+ *
29198
+ * `level: null` is the whole reason this array is returned: it is the
29199
+ * difference between "this node is at `info` because I decided it" and
29200
+ * "...because it inherits". An operator who clears an override believing they
29201
+ * are clearing an inherited value has been handed the same defect as the two
29202
+ * contradicting knobs this document exists to remove, moved one floor up.
29203
+ */
29204
+ var LoggingLevelLayerSchema = object({
29205
+ scope: LoggingScopeKindSchema,
29206
+ /** The node this layer speaks for; `null` on the cluster layer. */
29207
+ nodeId: string().nullable(),
29208
+ /** Explicitly set here, or `null` when this layer inherits. */
29209
+ level: LogLevelSchema$1.nullable()
29210
+ });
29211
+ /** What a line is judged against, and WHICH layer decided it. */
29212
+ var LoggingEffectiveSchema = object({
29213
+ level: LogLevelSchema$1,
29214
+ levelSource: LoggingLevelSourceSchema
29215
+ });
29216
+ /** Every layer, general → specific. Never collapsed into the effective value. */
29217
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
29218
+ /**
29219
+ * An armed diagnostic, with its DEADLINE.
29220
+ *
29221
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
29222
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
29223
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
29224
+ * `armed` is false — a window is never reported as slightly expired.
29225
+ */
29226
+ var DiagnosticWindowSchema = object({
29227
+ id: DiagnosticIdSchema,
29228
+ armed: boolean(),
29229
+ /** Epoch ms the window closes at. 0 when disarmed. */
29230
+ armedUntilMs: number(),
29231
+ /** Ms left before it expires on its own. 0 when disarmed. */
29232
+ remainingMs: number(),
29233
+ /** Whether the stored deadline is the one the live diagnostic is running —
29234
+ * i.e. whether this window would survive a restart. */
29235
+ persisted: boolean()
29236
+ });
29237
+ /**
29238
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
29239
+ * server — there is no maximum here on purpose: a bound repeated in a schema
29240
+ * is a second knob that disagrees with the first the day one of them moves.
29241
+ */
29242
+ var DiagnosticWindowPatchSchema = object({
29243
+ id: DiagnosticIdSchema,
29244
+ armMs: number().int().min(0),
29245
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
29246
+ reportEveryMs: number().int().positive().optional()
29247
+ });
29248
+ /**
29249
+ * A PATCH, and patches MERGE.
29250
+ *
29251
+ * A field absent from the patch is left exactly as it was — arming a
29252
+ * diagnostic never resets a level, and setting a level never disarms a window.
29253
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
29254
+ * `setAll` already merges, and rebuilding the object is how an absent field
29255
+ * turns into an erased one.
29256
+ */
29257
+ var LoggingSettingsPatchSchema = object({
29258
+ /**
29259
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
29260
+ * addressed scope so it inherits again. A value sets it.
29261
+ */
29262
+ level: LogLevelSchema$1.nullable().optional(),
29263
+ /**
29264
+ * Only the diagnostics NAMED here change. An armed window that is not listed
29265
+ * keeps running — a patch is never a full replacement.
29266
+ */
29267
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29268
+ });
29269
+ /**
29270
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
29271
+ *
29272
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
29273
+ * input — the generated router strips it and uses it to resolve the PROVIDER
29274
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
29275
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
29276
+ * by an agent that holds no cluster document at all. The hub is the single
29277
+ * authority over the whole hierarchy and answers for every layer, so the
29278
+ * layer selector needs a name the transport does not already own.
29279
+ */
29280
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29281
+ var SetLoggingSettingsInputSchema = object({
29282
+ scopeNodeId: string().optional(),
29283
+ patch: LoggingSettingsPatchSchema
29284
+ });
29285
+ /**
29286
+ * The whole document, as read and as returned after every write.
29287
+ *
29288
+ * `persisted: false` means the settings store could not be read or written.
29289
+ * The in-memory mirror still governs behaviour and is unchanged by the
29290
+ * failure — a read that fails neither switches a level nor disarms a window
29291
+ * (D49) — but the operator is told that what they are looking at would not
29292
+ * survive a restart.
29293
+ */
29294
+ var LoggingSettingsStateSchema = object({
29295
+ /** The layer this document was read at. `null` = the cluster layer. */
29296
+ scopeNodeId: string().nullable(),
29297
+ effective: LoggingEffectiveSchema,
29298
+ explicit: LoggingExplicitSchema,
29299
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
29300
+ persisted: boolean()
29301
+ });
28842
29302
  method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record(string(), unknown()), _null(), {
28843
29303
  kind: "mutation",
28844
29304
  auth: "admin"
@@ -28851,6 +29311,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28851
29311
  }), method(_void(), SiteLocationStatusSchema, {
28852
29312
  kind: "mutation",
28853
29313
  auth: "admin"
29314
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29315
+ kind: "mutation",
29316
+ auth: "admin"
28854
29317
  });
28855
29318
  /**
28856
29319
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -36257,6 +36720,18 @@ Object.freeze({
36257
36720
  addonId: null,
36258
36721
  access: "create"
36259
36722
  },
36723
+ "system.getLoggingSettings": {
36724
+ capName: "system",
36725
+ capScope: "system",
36726
+ addonId: null,
36727
+ access: "view"
36728
+ },
36729
+ "system.getRequestCensus": {
36730
+ capName: "system",
36731
+ capScope: "system",
36732
+ addonId: null,
36733
+ access: "view"
36734
+ },
36260
36735
  "system.getRetentionConfig": {
36261
36736
  capName: "system",
36262
36737
  capScope: "system",
@@ -36287,6 +36762,12 @@ Object.freeze({
36287
36762
  addonId: null,
36288
36763
  access: "view"
36289
36764
  },
36765
+ "system.setLoggingSettings": {
36766
+ capName: "system",
36767
+ capScope: "system",
36768
+ addonId: null,
36769
+ access: "create"
36770
+ },
36290
36771
  "system.setRetentionConfig": {
36291
36772
  capName: "system",
36292
36773
  capScope: "system",
@@ -37442,6 +37923,10 @@ Object.freeze({
37442
37923
  name: "deviceId",
37443
37924
  form: "single",
37444
37925
  optional: true
37926
+ }, {
37927
+ name: "deviceIds",
37928
+ form: "array",
37929
+ optional: true
37445
37930
  }],
37446
37931
  "fanControl.setDirection": [{
37447
37932
  name: "deviceId",
@@ -39052,7 +39537,38 @@ object({
39052
39537
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
39053
39538
  * reproduce that.
39054
39539
  */
39055
- tileBudgetMb: number().int().min(0).max(1024)
39540
+ tileBudgetMb: number().int().min(0).max(1024),
39541
+ /**
39542
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
39543
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
39544
+ * subject tiles, on frames that detected something.
39545
+ *
39546
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
39547
+ * containment is strict by design, so the native `keyFrame`, the detail
39548
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
39549
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
39550
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
39551
+ * frame-time after delivery, with the request only p50 367 ms behind it.
39552
+ *
39553
+ * Sizing, and why this is a budget and not a duration: a scene tile is
39554
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
39555
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
39556
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
39557
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
39558
+ * binds only through a detection burst, where it still covers well past the
39559
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
39560
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
39561
+ * whole shape exists to avoid.
39562
+ *
39563
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
39564
+ * subject tile, so one shared budget would let a busy camera's key frames
39565
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
39566
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
39567
+ * pre-existing behaviour, where a late full-frame request had nothing but the
39568
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
39569
+ * nothing.
39570
+ */
39571
+ sceneBudgetMb: number().int().min(0).max(1024)
39056
39572
  });
39057
39573
  /**
39058
39574
  * The values in force when the operator has set nothing.
@@ -39068,12 +39584,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
39068
39584
  budgetMb: 1024,
39069
39585
  activityMs: 15e3,
39070
39586
  tileBudgetMb: 64,
39587
+ sceneBudgetMb: 48,
39071
39588
  admission: "inferred"
39072
39589
  };
39073
39590
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
39074
39591
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
39075
39592
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
39076
39593
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
39594
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
39077
39595
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
39078
39596
  var MB = 1024 * 1024;
39079
39597
  1024 * MB, 3072 * MB;