@camstack/addon-provider-hikvision 1.2.38 → 1.2.40

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
@@ -7522,6 +7522,66 @@ var OpsLogQueryInputSchema = object({
7522
7522
  /** Max rows returned, newest-first. */
7523
7523
  limit: number().int().min(1).max(1e3).optional()
7524
7524
  });
7525
+ var LabelDefinitionSchema = object({
7526
+ id: string(),
7527
+ name: string(),
7528
+ category: string().optional(),
7529
+ description: string().optional(),
7530
+ icon: string().optional()
7531
+ });
7532
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
7533
+ var CLASS_MAP_MACRO_TARGETS = [
7534
+ "person",
7535
+ "vehicle",
7536
+ "animal",
7537
+ "package"
7538
+ ];
7539
+ /**
7540
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
7541
+ * un operatore può selezionare.
7542
+ *
7543
+ * Sono le tre offerte dallo step `object-detection`
7544
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
7545
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
7546
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
7547
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
7548
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
7549
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
7550
+ *
7551
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
7552
+ * dello step e una seconda volta come union `FirstLevelMacro`
7553
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
7554
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
7555
+ * successiva.
7556
+ */
7557
+ var FIRST_LEVEL_MACRO_CLASSES = [
7558
+ "person",
7559
+ "vehicle",
7560
+ "animal"
7561
+ ];
7562
+ /**
7563
+ * Wire schema for a per-model CATALOG classMap override
7564
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
7565
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
7566
+ * detection pipeline executor actually routes.
7567
+ *
7568
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
7569
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
7570
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
7571
+ * enum) — the two used to share the name `ClassMapDefinition`/
7572
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
7573
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
7574
+ * are not: it is two different concepts colliding on a name. Keep this type
7575
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
7576
+ * would either narrow every `ClassMapDefinition` consumer to the four
7577
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
7578
+ * schema exists for (see the "rejects a classMap whose target is not a
7579
+ * detection macro" test in `model-catalog-schema.test.ts`).
7580
+ */
7581
+ var DetectionCatalogClassMapSchema = object({
7582
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
7583
+ preserveOriginal: boolean()
7584
+ });
7525
7585
  /**
7526
7586
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
7527
7587
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -7544,10 +7604,55 @@ var RecordingStorageModeSchema = _enum([
7544
7604
  "events",
7545
7605
  "continuous"
7546
7606
  ]);
7607
+ /**
7608
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
7609
+ * tre offerte dallo step `object-detection`, da UNA lista
7610
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
7611
+ */
7612
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
7613
+ /**
7614
+ * True quando `values` non ripete un elemento.
7615
+ *
7616
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
7617
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
7618
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
7619
+ */
7620
+ var noDuplicates = (values) => new Set(values).size === values.length;
7547
7621
  /** Which detectors trigger an `events`-mode band. */
7548
7622
  var RecordingTriggersSchema = object({
7549
7623
  motion: boolean().optional(),
7550
- audioThresholdDbfs: number().optional()
7624
+ audioThresholdDbfs: number().optional(),
7625
+ /**
7626
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
7627
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
7628
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
7629
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
7630
+ *
7631
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
7632
+ * quelle che hanno attraversato `enabledMacroClasses`, i
7633
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
7634
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
7635
+ * finestre — vedi `recorder/object-trigger.ts`.
7636
+ */
7637
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
7638
+ /**
7639
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
7640
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
7641
+ * `objectClasses`.
7642
+ *
7643
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
7644
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
7645
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
7646
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
7647
+ * device (D12) — mai un elenco globale di cap.
7648
+ *
7649
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
7650
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
7651
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
7652
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
7653
+ * registrare.
7654
+ */
7655
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7551
7656
  });
7552
7657
  /**
7553
7658
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8174,41 +8279,6 @@ var TIMEZONES = [
8174
8279
  function findTimezone(id) {
8175
8280
  return TIMEZONES.find((tz) => tz.id === id);
8176
8281
  }
8177
- var LabelDefinitionSchema = object({
8178
- id: string(),
8179
- name: string(),
8180
- category: string().optional(),
8181
- description: string().optional(),
8182
- icon: string().optional()
8183
- });
8184
- /**
8185
- * Wire schema for a per-model CATALOG classMap override
8186
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8187
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8188
- * detection pipeline executor actually routes.
8189
- *
8190
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8191
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8192
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8193
- * enum) — the two used to share the name `ClassMapDefinition`/
8194
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8195
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8196
- * are not: it is two different concepts colliding on a name. Keep this type
8197
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8198
- * would either narrow every `ClassMapDefinition` consumer to the four
8199
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8200
- * schema exists for (see the "rejects a classMap whose target is not a
8201
- * detection macro" test in `model-catalog-schema.test.ts`).
8202
- */
8203
- var DetectionCatalogClassMapSchema = object({
8204
- mapping: record(string(), _enum([
8205
- "person",
8206
- "vehicle",
8207
- "animal",
8208
- "package"
8209
- ])),
8210
- preserveOriginal: boolean()
8211
- });
8212
8282
  var MODEL_FORMATS = [
8213
8283
  "onnx",
8214
8284
  "coreml",
@@ -21440,7 +21510,7 @@ var lifecycleJobSchema = object({
21440
21510
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21441
21511
  * as every other cap.
21442
21512
  */
21443
- var LogLevelSchema$1 = _enum([
21513
+ var LogLevelSchema$2 = _enum([
21444
21514
  "debug",
21445
21515
  "info",
21446
21516
  "warn",
@@ -21647,7 +21717,7 @@ var CustomActionInputSchema = object({
21647
21717
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21648
21718
  addonId: string(),
21649
21719
  limit: number().min(1).max(500).default(100),
21650
- level: LogLevelSchema$1.optional()
21720
+ level: LogLevelSchema$2.optional()
21651
21721
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21652
21722
  packageName: string(),
21653
21723
  version: string().optional()
@@ -21745,7 +21815,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21745
21815
  auth: "admin"
21746
21816
  }), method(object({
21747
21817
  addonId: string(),
21748
- level: LogLevelSchema$1.optional()
21818
+ level: LogLevelSchema$2.optional()
21749
21819
  }), LogStreamEntrySchema, { kind: "subscription" });
21750
21820
  /**
21751
21821
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -23469,6 +23539,35 @@ var FaceFilterEnum = _enum([
23469
23539
  "identified",
23470
23540
  "all"
23471
23541
  ]);
23542
+ /**
23543
+ * What a `listRecentFaces` page is ORDERED BY.
23544
+ *
23545
+ * - `timestamp` — when the face was seen. The historical (and default) order.
23546
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
23547
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
23548
+ * order: it puts the suggestions an operator can confirm with one tap at the
23549
+ * top, and it is the reason this enum exists — a client that ranked a capped
23550
+ * page client-side was ranking the newest N, never the most certain N.
23551
+ *
23552
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
23553
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
23554
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
23555
+ * — flipping the direction reorders the rows that HAVE a certainty and never
23556
+ * floods the page with the ones that do not. `addon-post-analysis`'s
23557
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
23558
+ * then by faceId, and is what makes this a total order instead of the
23559
+ * backend's NULL-collation accident.
23560
+ */
23561
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
23562
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
23563
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
23564
+ * never leaves the server. */
23565
+ var FaceClusterSchema = object({
23566
+ faceIds: array(string()).readonly(),
23567
+ representativeFaceId: string(),
23568
+ size: number().int(),
23569
+ cohesion: number()
23570
+ });
23472
23571
  var MediaFileLiteSchema$1 = object({
23473
23572
  key: string(),
23474
23573
  kind: string(),
@@ -23515,24 +23614,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23515
23614
  kind: "mutation",
23516
23615
  auth: "admin"
23517
23616
  }), method(object({
23518
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
23617
+ /**
23618
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
23619
+ *
23620
+ * The legacy single-camera form, kept verbatim for every caller that
23621
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
23622
+ * instead — never both: `deviceIds` is the authority whenever it is
23623
+ * present, and this field is then ignored rather than unioned, so
23624
+ * there is exactly one answer to "which cameras did I ask for".
23625
+ */
23519
23626
  deviceId: number().int().optional(),
23627
+ /**
23628
+ * Restrict to a SET of cameras — the review UI's camera filter, which
23629
+ * until now had to fetch the cluster-wide page and drop rows in the
23630
+ * client (so the `limit` it asked for was spent on cameras it was
23631
+ * about to discard).
23632
+ *
23633
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
23634
+ * "every camera". A request for no devices is a request, not an
23635
+ * omission; same contract as `deviceManager.listFleet` and
23636
+ * `pipelineAnalytics.listRecentTracks`.
23637
+ *
23638
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
23639
+ */
23640
+ deviceIds: array(number().int()).optional(),
23520
23641
  limit: number().int().positive().optional(),
23521
23642
  filter: FaceFilterEnum.optional(),
23522
23643
  /**
23523
- * Inline the base64 crop on every row. Default `true` — the existing
23524
- * behaviour, kept so no caller breaks.
23644
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23645
+ * Absent means no lower bound.
23646
+ */
23647
+ since: number().int().optional(),
23648
+ /**
23649
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23650
+ * Absent means no upper bound.
23651
+ */
23652
+ until: number().int().optional(),
23653
+ /**
23654
+ * Order the page by time or by suggestion certainty. Default
23655
+ * `'timestamp'` — the historical order, unchanged for every caller
23656
+ * that does not ask.
23525
23657
  *
23526
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
23527
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
23528
- * the browser cache the images.
23658
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
23659
+ * does under `'suggestionConfidence'`.
23529
23660
  *
23530
- * **This is an INPUT field, so it does not reach the addon until the
23531
- * next train.** The hub router validates cap inputs against its own
23532
- * compiled Zod, which strips a key it does not know verified today
23533
- * on the OUTPUT side, where an additive field DOES arrive immediately
23534
- * (`Track.hasFace`). Until the train ships, sending `false` is
23535
- * harmless and simply keeps the crops inline.
23661
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
23662
+ * index and stops reading as soon as `limit` rows have PASSED the
23663
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
23664
+ * certain row may be the oldest so it walks the window. Narrow it
23665
+ * with {@link since} / {@link until}.
23666
+ */
23667
+ sortBy: FaceSortFieldEnum.optional(),
23668
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
23669
+ sortDirection: FaceSortDirectionEnum.optional(),
23670
+ /**
23671
+ * Inline the base64 crop on every row.
23672
+ *
23673
+ * Default `false` since the 2026-08-25 inversion — see
23674
+ * `include-crops-default.ts`, which is the ONE place that resolves
23675
+ * this for every gallery, and which records why the inline shape had
23676
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
23677
+ * The doc here used to still say `true`; it was wrong, and a leftover
23678
+ * that describes the old design reads as permission to rely on it.
23679
+ *
23680
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
23681
+ * which the browser fetches off the `event-media` plane in parallel,
23682
+ * cached and ETagged.
23536
23683
  */
23537
23684
  includeCrops: boolean().optional()
23538
23685
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -23568,13 +23715,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23568
23715
  }), method(object({
23569
23716
  threshold: number().min(0).max(1).optional(),
23570
23717
  minClusterSize: number().int().min(2).optional(),
23571
- limit: number().int().positive().optional()
23572
- }).optional(), array(object({
23573
- faceIds: array(string()).readonly(),
23574
- representativeFaceId: string(),
23575
- size: number().int(),
23576
- cohesion: number()
23577
- })).readonly());
23718
+ /**
23719
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
23720
+ * which read as though it bounded the work — it never did.
23721
+ *
23722
+ * Wins over {@link limit} when both are sent.
23723
+ */
23724
+ maxClusters: number().int().positive().optional(),
23725
+ /**
23726
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
23727
+ * RESULT, not the scan. Kept so existing callers keep working; send
23728
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
23729
+ */
23730
+ limit: number().int().positive().optional(),
23731
+ /**
23732
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
23733
+ * POOL, not the result.
23734
+ *
23735
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
23736
+ * used to read every unassigned face on the hub no matter what the
23737
+ * caller asked for, because the only bound cut the finished clusters
23738
+ * afterwards; a UI showing a window of 100 paid for a scan of the
23739
+ * whole corpus, on an addon whose disk is under contention.
23740
+ *
23741
+ * The pool is the NEWEST matching faces first — the same order the
23742
+ * gallery shows — so a bound here shortens the horizon, it does not
23743
+ * sample it randomly.
23744
+ *
23745
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
23746
+ * so the live corpus — 372 face rows — is unaffected while the
23747
+ * unbounded scan can never come back as the table grows.
23748
+ */
23749
+ maxFacesScanned: number().int().positive().optional()
23750
+ }).optional(), array(FaceClusterSchema).readonly());
23578
23751
  /**
23579
23752
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
23580
23753
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -28847,6 +29020,293 @@ var SetSiteLocationInputSchema = object({
28847
29020
  latitude: number().min(-90).max(90),
28848
29021
  longitude: number().min(-180).max(180)
28849
29022
  }).nullable();
29023
+ /**
29024
+ * The TRANSPORT a call arrived on.
29025
+ *
29026
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
29027
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
29028
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
29029
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
29030
+ * checkable rather than asserted.
29031
+ *
29032
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
29033
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
29034
+ * connection; the viewer talks to the hub over `wsLink`
29035
+ * exclusively, so this is the plane the HTTP census could not see.
29036
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
29037
+ * never touches a socket and therefore never touched a census.
29038
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
29039
+ * that is exactly what its `0` asserts: every plane the hub has can name
29040
+ * itself. It is an output bucket, never a knob — a call that arrives on a
29041
+ * plane nobody instrumented lands here instead of vanishing from the total.
29042
+ */
29043
+ var TransportPlaneSchema = _enum([
29044
+ "http",
29045
+ "ws",
29046
+ "mesh",
29047
+ "unknown"
29048
+ ]);
29049
+ /**
29050
+ * Calls per plane. Every key is always present, `0` included — an absent plane
29051
+ * reads as "not instrumented", which is the one thing this census must never
29052
+ * make an operator wonder about.
29053
+ */
29054
+ var TransportPlaneCountsSchema = object({
29055
+ http: number(),
29056
+ ws: number(),
29057
+ mesh: number(),
29058
+ unknown: number()
29059
+ });
29060
+ /**
29061
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
29062
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29063
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29064
+ * already prints - never a token, never an `Authorization` header.
29065
+ *
29066
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
29067
+ * and lives for hours, so folding it into a call count makes one long-lived
29068
+ * stream look like a storm.
29069
+ */
29070
+ var RequestCensusGroupSchema = object({
29071
+ plane: TransportPlaneSchema,
29072
+ procedure: string(),
29073
+ userAgent: string(),
29074
+ ip: string(),
29075
+ principal: string(),
29076
+ calls: number(),
29077
+ subscriptions: number(),
29078
+ perMin: number()
29079
+ });
29080
+ /**
29081
+ * A procedure's TOTAL over the window, across every caller.
29082
+ *
29083
+ * This block, not the group list, is what answers "did these calls arrive over
29084
+ * HTTP at all". A total far BELOW what a store-side census counted over the
29085
+ * same window excludes the HTTP plane, which is a result, not a failure.
29086
+ */
29087
+ var RequestCensusProcedureSchema = object({
29088
+ procedure: string(),
29089
+ calls: number(),
29090
+ /**
29091
+ * The same total, split by transport. THIS is the row that answers the
29092
+ * question the census exists for: one look at `deviceManager.listAll` says
29093
+ * which plane carried the 4 960, without joining two log lines by eye.
29094
+ */
29095
+ planes: TransportPlaneCountsSchema,
29096
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
29097
+ subscriptions: number(),
29098
+ perMin: number()
29099
+ });
29100
+ /**
29101
+ * The census as an operator sees it.
29102
+ *
29103
+ * `persisted` is the honest answer to "will this survive the restart I am
29104
+ * about to do": the arm deadline is written to `system-settings` so a window
29105
+ * armed now can measure the NEXT boot, and a write that failed must not look
29106
+ * like one that succeeded.
29107
+ */
29108
+ var RequestCensusStatusSchema = object({
29109
+ armed: boolean(),
29110
+ /** How long the current - or just-closed - window collected, in ms. */
29111
+ elapsedMs: number(),
29112
+ /** The window actually armed, after the server clamped the request. */
29113
+ windowMs: number(),
29114
+ /** Epoch ms the window closes at. 0 when disarmed. */
29115
+ armedUntilMs: number(),
29116
+ httpRequests: number(),
29117
+ batchedRequests: number(),
29118
+ /**
29119
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
29120
+ * is in play (`?batch=1` carries several procedures in one request); this is
29121
+ * the number comparable with a store-side call count.
29122
+ */
29123
+ procedureCalls: number(),
29124
+ /**
29125
+ * `procedureCalls` split by transport. The four keys sum to
29126
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
29127
+ * `planesExplainTotal` is that identity, checked rather than assumed.
29128
+ */
29129
+ planes: TransportPlaneCountsSchema,
29130
+ /**
29131
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
29132
+ * on no plane at all - which is a RESULT (a plane is missing from the
29133
+ * instrument), not a failure, and it has to be visible to be read as one.
29134
+ */
29135
+ planesExplainTotal: boolean(),
29136
+ /**
29137
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
29138
+ * adapter resolves one context per connection - kept because a plane's call
29139
+ * count of zero against 37 open connections says something different from a
29140
+ * plane with no connections at all.
29141
+ */
29142
+ wsConnections: number(),
29143
+ /**
29144
+ * Client frames the WS plane looked at. `wsMessages` far above
29145
+ * `planes.ws + subscriptions` means most traffic is not operations
29146
+ * (keepalives, connection params) - which is itself an answer.
29147
+ */
29148
+ wsMessages: number(),
29149
+ /**
29150
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
29151
+ * purpose: one live-events stream opened at boot and held for six hours is
29152
+ * one subscription, and counting it as a call would let a quiet plane
29153
+ * masquerade as the storm.
29154
+ */
29155
+ subscriptions: number(),
29156
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
29157
+ subscriptionStops: number(),
29158
+ distinctGroups: number(),
29159
+ /**
29160
+ * Operations counted in the totals whose CALLER attribution was shed at the
29161
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
29162
+ * which transport they arrived on, they just lost their group row.
29163
+ */
29164
+ unattributedCalls: number(),
29165
+ procedures: array(RequestCensusProcedureSchema).readonly(),
29166
+ groups: array(RequestCensusGroupSchema).readonly()
29167
+ }).extend({ persisted: boolean() });
29168
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
29169
+ var LogLevelSchema$1 = _enum([
29170
+ "debug",
29171
+ "info",
29172
+ "warn",
29173
+ "error"
29174
+ ]);
29175
+ /**
29176
+ * The diagnostics that can be ARMED for a window. Exactly one today.
29177
+ *
29178
+ * A diagnostic is anything whose cost is only worth paying while a question is
29179
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
29180
+ */
29181
+ var DiagnosticIdSchema = _enum(["request-census"]);
29182
+ /**
29183
+ * The layers of the level hierarchy, general → specific. The most specific
29184
+ * layer that carries an explicit value wins.
29185
+ *
29186
+ * `component` is DECLARED and not yet resolvable: the per-component channels
29187
+ * are a later slice of the same plan, and a `levelSource` enum that has to
29188
+ * grow later would force every consumer of this document to change with it.
29189
+ * Nothing returns `component` today.
29190
+ */
29191
+ var LoggingScopeKindSchema = _enum([
29192
+ "cluster",
29193
+ "node",
29194
+ "component"
29195
+ ]);
29196
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
29197
+ var LoggingLevelSourceSchema = _enum([
29198
+ "default",
29199
+ "cluster",
29200
+ "node",
29201
+ "component"
29202
+ ]);
29203
+ /**
29204
+ * One layer of the hierarchy as it actually STANDS.
29205
+ *
29206
+ * `level: null` is the whole reason this array is returned: it is the
29207
+ * difference between "this node is at `info` because I decided it" and
29208
+ * "...because it inherits". An operator who clears an override believing they
29209
+ * are clearing an inherited value has been handed the same defect as the two
29210
+ * contradicting knobs this document exists to remove, moved one floor up.
29211
+ */
29212
+ var LoggingLevelLayerSchema = object({
29213
+ scope: LoggingScopeKindSchema,
29214
+ /** The node this layer speaks for; `null` on the cluster layer. */
29215
+ nodeId: string().nullable(),
29216
+ /** Explicitly set here, or `null` when this layer inherits. */
29217
+ level: LogLevelSchema$1.nullable()
29218
+ });
29219
+ /** What a line is judged against, and WHICH layer decided it. */
29220
+ var LoggingEffectiveSchema = object({
29221
+ level: LogLevelSchema$1,
29222
+ levelSource: LoggingLevelSourceSchema
29223
+ });
29224
+ /** Every layer, general → specific. Never collapsed into the effective value. */
29225
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
29226
+ /**
29227
+ * An armed diagnostic, with its DEADLINE.
29228
+ *
29229
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
29230
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
29231
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
29232
+ * `armed` is false — a window is never reported as slightly expired.
29233
+ */
29234
+ var DiagnosticWindowSchema = object({
29235
+ id: DiagnosticIdSchema,
29236
+ armed: boolean(),
29237
+ /** Epoch ms the window closes at. 0 when disarmed. */
29238
+ armedUntilMs: number(),
29239
+ /** Ms left before it expires on its own. 0 when disarmed. */
29240
+ remainingMs: number(),
29241
+ /** Whether the stored deadline is the one the live diagnostic is running —
29242
+ * i.e. whether this window would survive a restart. */
29243
+ persisted: boolean()
29244
+ });
29245
+ /**
29246
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
29247
+ * server — there is no maximum here on purpose: a bound repeated in a schema
29248
+ * is a second knob that disagrees with the first the day one of them moves.
29249
+ */
29250
+ var DiagnosticWindowPatchSchema = object({
29251
+ id: DiagnosticIdSchema,
29252
+ armMs: number().int().min(0),
29253
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
29254
+ reportEveryMs: number().int().positive().optional()
29255
+ });
29256
+ /**
29257
+ * A PATCH, and patches MERGE.
29258
+ *
29259
+ * A field absent from the patch is left exactly as it was — arming a
29260
+ * diagnostic never resets a level, and setting a level never disarms a window.
29261
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
29262
+ * `setAll` already merges, and rebuilding the object is how an absent field
29263
+ * turns into an erased one.
29264
+ */
29265
+ var LoggingSettingsPatchSchema = object({
29266
+ /**
29267
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
29268
+ * addressed scope so it inherits again. A value sets it.
29269
+ */
29270
+ level: LogLevelSchema$1.nullable().optional(),
29271
+ /**
29272
+ * Only the diagnostics NAMED here change. An armed window that is not listed
29273
+ * keeps running — a patch is never a full replacement.
29274
+ */
29275
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29276
+ });
29277
+ /**
29278
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
29279
+ *
29280
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
29281
+ * input — the generated router strips it and uses it to resolve the PROVIDER
29282
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
29283
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
29284
+ * by an agent that holds no cluster document at all. The hub is the single
29285
+ * authority over the whole hierarchy and answers for every layer, so the
29286
+ * layer selector needs a name the transport does not already own.
29287
+ */
29288
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29289
+ var SetLoggingSettingsInputSchema = object({
29290
+ scopeNodeId: string().optional(),
29291
+ patch: LoggingSettingsPatchSchema
29292
+ });
29293
+ /**
29294
+ * The whole document, as read and as returned after every write.
29295
+ *
29296
+ * `persisted: false` means the settings store could not be read or written.
29297
+ * The in-memory mirror still governs behaviour and is unchanged by the
29298
+ * failure — a read that fails neither switches a level nor disarms a window
29299
+ * (D49) — but the operator is told that what they are looking at would not
29300
+ * survive a restart.
29301
+ */
29302
+ var LoggingSettingsStateSchema = object({
29303
+ /** The layer this document was read at. `null` = the cluster layer. */
29304
+ scopeNodeId: string().nullable(),
29305
+ effective: LoggingEffectiveSchema,
29306
+ explicit: LoggingExplicitSchema,
29307
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
29308
+ persisted: boolean()
29309
+ });
28850
29310
  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(), {
28851
29311
  kind: "mutation",
28852
29312
  auth: "admin"
@@ -28859,6 +29319,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28859
29319
  }), method(_void(), SiteLocationStatusSchema, {
28860
29320
  kind: "mutation",
28861
29321
  auth: "admin"
29322
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29323
+ kind: "mutation",
29324
+ auth: "admin"
28862
29325
  });
28863
29326
  /**
28864
29327
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -36331,6 +36794,18 @@ Object.freeze({
36331
36794
  addonId: null,
36332
36795
  access: "create"
36333
36796
  },
36797
+ "system.getLoggingSettings": {
36798
+ capName: "system",
36799
+ capScope: "system",
36800
+ addonId: null,
36801
+ access: "view"
36802
+ },
36803
+ "system.getRequestCensus": {
36804
+ capName: "system",
36805
+ capScope: "system",
36806
+ addonId: null,
36807
+ access: "view"
36808
+ },
36334
36809
  "system.getRetentionConfig": {
36335
36810
  capName: "system",
36336
36811
  capScope: "system",
@@ -36361,6 +36836,12 @@ Object.freeze({
36361
36836
  addonId: null,
36362
36837
  access: "view"
36363
36838
  },
36839
+ "system.setLoggingSettings": {
36840
+ capName: "system",
36841
+ capScope: "system",
36842
+ addonId: null,
36843
+ access: "create"
36844
+ },
36364
36845
  "system.setRetentionConfig": {
36365
36846
  capName: "system",
36366
36847
  capScope: "system",
@@ -37516,6 +37997,10 @@ Object.freeze({
37516
37997
  name: "deviceId",
37517
37998
  form: "single",
37518
37999
  optional: true
38000
+ }, {
38001
+ name: "deviceIds",
38002
+ form: "array",
38003
+ optional: true
37519
38004
  }],
37520
38005
  "fanControl.setDirection": [{
37521
38006
  name: "deviceId",
@@ -39126,7 +39611,38 @@ object({
39126
39611
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
39127
39612
  * reproduce that.
39128
39613
  */
39129
- tileBudgetMb: number().int().min(0).max(1024)
39614
+ tileBudgetMb: number().int().min(0).max(1024),
39615
+ /**
39616
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
39617
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
39618
+ * subject tiles, on frames that detected something.
39619
+ *
39620
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
39621
+ * containment is strict by design, so the native `keyFrame`, the detail
39622
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
39623
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
39624
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
39625
+ * frame-time after delivery, with the request only p50 367 ms behind it.
39626
+ *
39627
+ * Sizing, and why this is a budget and not a duration: a scene tile is
39628
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
39629
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
39630
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
39631
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
39632
+ * binds only through a detection burst, where it still covers well past the
39633
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
39634
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
39635
+ * whole shape exists to avoid.
39636
+ *
39637
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
39638
+ * subject tile, so one shared budget would let a busy camera's key frames
39639
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
39640
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
39641
+ * pre-existing behaviour, where a late full-frame request had nothing but the
39642
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
39643
+ * nothing.
39644
+ */
39645
+ sceneBudgetMb: number().int().min(0).max(1024)
39130
39646
  });
39131
39647
  /**
39132
39648
  * The values in force when the operator has set nothing.
@@ -39142,12 +39658,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
39142
39658
  budgetMb: 1024,
39143
39659
  activityMs: 15e3,
39144
39660
  tileBudgetMb: 64,
39661
+ sceneBudgetMb: 48,
39145
39662
  admission: "inferred"
39146
39663
  };
39147
39664
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
39148
39665
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
39149
39666
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
39150
39667
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
39668
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
39151
39669
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
39152
39670
  var MB = 1024 * 1024;
39153
39671
  1024 * MB, 3072 * MB;