@camstack/addon-provider-tuya 0.2.31 → 0.2.33

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
@@ -8345,6 +8345,66 @@ var OpsLogQueryInputSchema = object({
8345
8345
  /** Max rows returned, newest-first. */
8346
8346
  limit: number().int().min(1).max(1e3).optional()
8347
8347
  });
8348
+ var LabelDefinitionSchema = object({
8349
+ id: string(),
8350
+ name: string(),
8351
+ category: string().optional(),
8352
+ description: string().optional(),
8353
+ icon: string().optional()
8354
+ });
8355
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
8356
+ var CLASS_MAP_MACRO_TARGETS = [
8357
+ "person",
8358
+ "vehicle",
8359
+ "animal",
8360
+ "package"
8361
+ ];
8362
+ /**
8363
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
8364
+ * un operatore può selezionare.
8365
+ *
8366
+ * Sono le tre offerte dallo step `object-detection`
8367
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
8368
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
8369
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
8370
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
8371
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
8372
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
8373
+ *
8374
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
8375
+ * dello step e una seconda volta come union `FirstLevelMacro`
8376
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
8377
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
8378
+ * successiva.
8379
+ */
8380
+ var FIRST_LEVEL_MACRO_CLASSES = [
8381
+ "person",
8382
+ "vehicle",
8383
+ "animal"
8384
+ ];
8385
+ /**
8386
+ * Wire schema for a per-model CATALOG classMap override
8387
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8388
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8389
+ * detection pipeline executor actually routes.
8390
+ *
8391
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8392
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8393
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8394
+ * enum) — the two used to share the name `ClassMapDefinition`/
8395
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8396
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8397
+ * are not: it is two different concepts colliding on a name. Keep this type
8398
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8399
+ * would either narrow every `ClassMapDefinition` consumer to the four
8400
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8401
+ * schema exists for (see the "rejects a classMap whose target is not a
8402
+ * detection macro" test in `model-catalog-schema.test.ts`).
8403
+ */
8404
+ var DetectionCatalogClassMapSchema = object({
8405
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
8406
+ preserveOriginal: boolean()
8407
+ });
8348
8408
  /**
8349
8409
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
8350
8410
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -8367,10 +8427,55 @@ var RecordingStorageModeSchema = _enum([
8367
8427
  "events",
8368
8428
  "continuous"
8369
8429
  ]);
8430
+ /**
8431
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
8432
+ * tre offerte dallo step `object-detection`, da UNA lista
8433
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
8434
+ */
8435
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
8436
+ /**
8437
+ * True quando `values` non ripete un elemento.
8438
+ *
8439
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
8440
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
8441
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
8442
+ */
8443
+ var noDuplicates = (values) => new Set(values).size === values.length;
8370
8444
  /** Which detectors trigger an `events`-mode band. */
8371
8445
  var RecordingTriggersSchema = object({
8372
8446
  motion: boolean().optional(),
8373
- audioThresholdDbfs: number().optional()
8447
+ audioThresholdDbfs: number().optional(),
8448
+ /**
8449
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
8450
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
8451
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
8452
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
8453
+ *
8454
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
8455
+ * quelle che hanno attraversato `enabledMacroClasses`, i
8456
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
8457
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
8458
+ * finestre — vedi `recorder/object-trigger.ts`.
8459
+ */
8460
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
8461
+ /**
8462
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
8463
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
8464
+ * `objectClasses`.
8465
+ *
8466
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
8467
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
8468
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
8469
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
8470
+ * device (D12) — mai un elenco globale di cap.
8471
+ *
8472
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
8473
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
8474
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
8475
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
8476
+ * registrare.
8477
+ */
8478
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
8374
8479
  });
8375
8480
  /**
8376
8481
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8822,41 +8927,6 @@ var DecoderSessionConfigSchema = object({
8822
8927
  */
8823
8928
  debug: boolean().optional()
8824
8929
  });
8825
- var LabelDefinitionSchema = object({
8826
- id: string(),
8827
- name: string(),
8828
- category: string().optional(),
8829
- description: string().optional(),
8830
- icon: string().optional()
8831
- });
8832
- /**
8833
- * Wire schema for a per-model CATALOG classMap override
8834
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8835
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8836
- * detection pipeline executor actually routes.
8837
- *
8838
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8839
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8840
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8841
- * enum) — the two used to share the name `ClassMapDefinition`/
8842
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8843
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8844
- * are not: it is two different concepts colliding on a name. Keep this type
8845
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8846
- * would either narrow every `ClassMapDefinition` consumer to the four
8847
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8848
- * schema exists for (see the "rejects a classMap whose target is not a
8849
- * detection macro" test in `model-catalog-schema.test.ts`).
8850
- */
8851
- var DetectionCatalogClassMapSchema = object({
8852
- mapping: record(string(), _enum([
8853
- "person",
8854
- "vehicle",
8855
- "animal",
8856
- "package"
8857
- ])),
8858
- preserveOriginal: boolean()
8859
- });
8860
8930
  var MODEL_FORMATS = [
8861
8931
  "onnx",
8862
8932
  "coreml",
@@ -21989,7 +22059,7 @@ var lifecycleJobSchema = object({
21989
22059
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21990
22060
  * as every other cap.
21991
22061
  */
21992
- var LogLevelSchema$1 = _enum([
22062
+ var LogLevelSchema$2 = _enum([
21993
22063
  "debug",
21994
22064
  "info",
21995
22065
  "warn",
@@ -22196,7 +22266,7 @@ var CustomActionInputSchema = object({
22196
22266
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
22197
22267
  addonId: string(),
22198
22268
  limit: number().min(1).max(500).default(100),
22199
- level: LogLevelSchema$1.optional()
22269
+ level: LogLevelSchema$2.optional()
22200
22270
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
22201
22271
  packageName: string(),
22202
22272
  version: string().optional()
@@ -22294,7 +22364,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
22294
22364
  auth: "admin"
22295
22365
  }), method(object({
22296
22366
  addonId: string(),
22297
- level: LogLevelSchema$1.optional()
22367
+ level: LogLevelSchema$2.optional()
22298
22368
  }), LogStreamEntrySchema, { kind: "subscription" });
22299
22369
  /**
22300
22370
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -24026,6 +24096,35 @@ var FaceFilterEnum = _enum([
24026
24096
  "identified",
24027
24097
  "all"
24028
24098
  ]);
24099
+ /**
24100
+ * What a `listRecentFaces` page is ORDERED BY.
24101
+ *
24102
+ * - `timestamp` — when the face was seen. The historical (and default) order.
24103
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
24104
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
24105
+ * order: it puts the suggestions an operator can confirm with one tap at the
24106
+ * top, and it is the reason this enum exists — a client that ranked a capped
24107
+ * page client-side was ranking the newest N, never the most certain N.
24108
+ *
24109
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
24110
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
24111
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
24112
+ * — flipping the direction reorders the rows that HAVE a certainty and never
24113
+ * floods the page with the ones that do not. `addon-post-analysis`'s
24114
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
24115
+ * then by faceId, and is what makes this a total order instead of the
24116
+ * backend's NULL-collation accident.
24117
+ */
24118
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
24119
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
24120
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
24121
+ * never leaves the server. */
24122
+ var FaceClusterSchema = object({
24123
+ faceIds: array(string()).readonly(),
24124
+ representativeFaceId: string(),
24125
+ size: number().int(),
24126
+ cohesion: number()
24127
+ });
24029
24128
  var MediaFileLiteSchema$1 = object({
24030
24129
  key: string(),
24031
24130
  kind: string(),
@@ -24072,24 +24171,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24072
24171
  kind: "mutation",
24073
24172
  auth: "admin"
24074
24173
  }), method(object({
24075
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
24174
+ /**
24175
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
24176
+ *
24177
+ * The legacy single-camera form, kept verbatim for every caller that
24178
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
24179
+ * instead — never both: `deviceIds` is the authority whenever it is
24180
+ * present, and this field is then ignored rather than unioned, so
24181
+ * there is exactly one answer to "which cameras did I ask for".
24182
+ */
24076
24183
  deviceId: number().int().optional(),
24184
+ /**
24185
+ * Restrict to a SET of cameras — the review UI's camera filter, which
24186
+ * until now had to fetch the cluster-wide page and drop rows in the
24187
+ * client (so the `limit` it asked for was spent on cameras it was
24188
+ * about to discard).
24189
+ *
24190
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
24191
+ * "every camera". A request for no devices is a request, not an
24192
+ * omission; same contract as `deviceManager.listFleet` and
24193
+ * `pipelineAnalytics.listRecentTracks`.
24194
+ *
24195
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
24196
+ */
24197
+ deviceIds: array(number().int()).optional(),
24077
24198
  limit: number().int().positive().optional(),
24078
24199
  filter: FaceFilterEnum.optional(),
24079
24200
  /**
24080
- * Inline the base64 crop on every row. Default `true` — the existing
24081
- * behaviour, kept so no caller breaks.
24201
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24202
+ * Absent means no lower bound.
24203
+ */
24204
+ since: number().int().optional(),
24205
+ /**
24206
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24207
+ * Absent means no upper bound.
24208
+ */
24209
+ until: number().int().optional(),
24210
+ /**
24211
+ * Order the page by time or by suggestion certainty. Default
24212
+ * `'timestamp'` — the historical order, unchanged for every caller
24213
+ * that does not ask.
24082
24214
  *
24083
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
24084
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
24085
- * the browser cache the images.
24215
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
24216
+ * does under `'suggestionConfidence'`.
24086
24217
  *
24087
- * **This is an INPUT field, so it does not reach the addon until the
24088
- * next train.** The hub router validates cap inputs against its own
24089
- * compiled Zod, which strips a key it does not know — verified today
24090
- * on the OUTPUT side, where an additive field DOES arrive immediately
24091
- * (`Track.hasFace`). Until the train ships, sending `false` is
24092
- * harmless and simply keeps the crops inline.
24218
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
24219
+ * index and stops reading as soon as `limit` rows have PASSED the
24220
+ * filter. `'suggestionConfidence'` cannot stop early — the most
24221
+ * certain row may be the oldest — so it walks the window. Narrow it
24222
+ * with {@link since} / {@link until}.
24223
+ */
24224
+ sortBy: FaceSortFieldEnum.optional(),
24225
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
24226
+ sortDirection: FaceSortDirectionEnum.optional(),
24227
+ /**
24228
+ * Inline the base64 crop on every row.
24229
+ *
24230
+ * Default `false` since the 2026-08-25 inversion — see
24231
+ * `include-crops-default.ts`, which is the ONE place that resolves
24232
+ * this for every gallery, and which records why the inline shape had
24233
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
24234
+ * The doc here used to still say `true`; it was wrong, and a leftover
24235
+ * that describes the old design reads as permission to rely on it.
24236
+ *
24237
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
24238
+ * which the browser fetches off the `event-media` plane in parallel,
24239
+ * cached and ETagged.
24093
24240
  */
24094
24241
  includeCrops: boolean().optional()
24095
24242
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -24125,13 +24272,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24125
24272
  }), method(object({
24126
24273
  threshold: number().min(0).max(1).optional(),
24127
24274
  minClusterSize: number().int().min(2).optional(),
24128
- limit: number().int().positive().optional()
24129
- }).optional(), array(object({
24130
- faceIds: array(string()).readonly(),
24131
- representativeFaceId: string(),
24132
- size: number().int(),
24133
- cohesion: number()
24134
- })).readonly());
24275
+ /**
24276
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
24277
+ * which read as though it bounded the work — it never did.
24278
+ *
24279
+ * Wins over {@link limit} when both are sent.
24280
+ */
24281
+ maxClusters: number().int().positive().optional(),
24282
+ /**
24283
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
24284
+ * RESULT, not the scan. Kept so existing callers keep working; send
24285
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
24286
+ */
24287
+ limit: number().int().positive().optional(),
24288
+ /**
24289
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
24290
+ * POOL, not the result.
24291
+ *
24292
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
24293
+ * used to read every unassigned face on the hub no matter what the
24294
+ * caller asked for, because the only bound cut the finished clusters
24295
+ * afterwards; a UI showing a window of 100 paid for a scan of the
24296
+ * whole corpus, on an addon whose disk is under contention.
24297
+ *
24298
+ * The pool is the NEWEST matching faces first — the same order the
24299
+ * gallery shows — so a bound here shortens the horizon, it does not
24300
+ * sample it randomly.
24301
+ *
24302
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
24303
+ * so the live corpus — 372 face rows — is unaffected while the
24304
+ * unbounded scan can never come back as the table grows.
24305
+ */
24306
+ maxFacesScanned: number().int().positive().optional()
24307
+ }).optional(), array(FaceClusterSchema).readonly());
24135
24308
  /**
24136
24309
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
24137
24310
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -29073,6 +29246,293 @@ var SetSiteLocationInputSchema = object({
29073
29246
  latitude: number().min(-90).max(90),
29074
29247
  longitude: number().min(-180).max(180)
29075
29248
  }).nullable();
29249
+ /**
29250
+ * The TRANSPORT a call arrived on.
29251
+ *
29252
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
29253
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
29254
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
29255
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
29256
+ * checkable rather than asserted.
29257
+ *
29258
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
29259
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
29260
+ * connection; the viewer talks to the hub over `wsLink`
29261
+ * exclusively, so this is the plane the HTTP census could not see.
29262
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
29263
+ * never touches a socket and therefore never touched a census.
29264
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
29265
+ * that is exactly what its `0` asserts: every plane the hub has can name
29266
+ * itself. It is an output bucket, never a knob — a call that arrives on a
29267
+ * plane nobody instrumented lands here instead of vanishing from the total.
29268
+ */
29269
+ var TransportPlaneSchema = _enum([
29270
+ "http",
29271
+ "ws",
29272
+ "mesh",
29273
+ "unknown"
29274
+ ]);
29275
+ /**
29276
+ * Calls per plane. Every key is always present, `0` included — an absent plane
29277
+ * reads as "not instrumented", which is the one thing this census must never
29278
+ * make an operator wonder about.
29279
+ */
29280
+ var TransportPlaneCountsSchema = object({
29281
+ http: number(),
29282
+ ws: number(),
29283
+ mesh: number(),
29284
+ unknown: number()
29285
+ });
29286
+ /**
29287
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
29288
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29289
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29290
+ * already prints - never a token, never an `Authorization` header.
29291
+ *
29292
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
29293
+ * and lives for hours, so folding it into a call count makes one long-lived
29294
+ * stream look like a storm.
29295
+ */
29296
+ var RequestCensusGroupSchema = object({
29297
+ plane: TransportPlaneSchema,
29298
+ procedure: string(),
29299
+ userAgent: string(),
29300
+ ip: string(),
29301
+ principal: string(),
29302
+ calls: number(),
29303
+ subscriptions: number(),
29304
+ perMin: number()
29305
+ });
29306
+ /**
29307
+ * A procedure's TOTAL over the window, across every caller.
29308
+ *
29309
+ * This block, not the group list, is what answers "did these calls arrive over
29310
+ * HTTP at all". A total far BELOW what a store-side census counted over the
29311
+ * same window excludes the HTTP plane, which is a result, not a failure.
29312
+ */
29313
+ var RequestCensusProcedureSchema = object({
29314
+ procedure: string(),
29315
+ calls: number(),
29316
+ /**
29317
+ * The same total, split by transport. THIS is the row that answers the
29318
+ * question the census exists for: one look at `deviceManager.listAll` says
29319
+ * which plane carried the 4 960, without joining two log lines by eye.
29320
+ */
29321
+ planes: TransportPlaneCountsSchema,
29322
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
29323
+ subscriptions: number(),
29324
+ perMin: number()
29325
+ });
29326
+ /**
29327
+ * The census as an operator sees it.
29328
+ *
29329
+ * `persisted` is the honest answer to "will this survive the restart I am
29330
+ * about to do": the arm deadline is written to `system-settings` so a window
29331
+ * armed now can measure the NEXT boot, and a write that failed must not look
29332
+ * like one that succeeded.
29333
+ */
29334
+ var RequestCensusStatusSchema = object({
29335
+ armed: boolean(),
29336
+ /** How long the current - or just-closed - window collected, in ms. */
29337
+ elapsedMs: number(),
29338
+ /** The window actually armed, after the server clamped the request. */
29339
+ windowMs: number(),
29340
+ /** Epoch ms the window closes at. 0 when disarmed. */
29341
+ armedUntilMs: number(),
29342
+ httpRequests: number(),
29343
+ batchedRequests: number(),
29344
+ /**
29345
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
29346
+ * is in play (`?batch=1` carries several procedures in one request); this is
29347
+ * the number comparable with a store-side call count.
29348
+ */
29349
+ procedureCalls: number(),
29350
+ /**
29351
+ * `procedureCalls` split by transport. The four keys sum to
29352
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
29353
+ * `planesExplainTotal` is that identity, checked rather than assumed.
29354
+ */
29355
+ planes: TransportPlaneCountsSchema,
29356
+ /**
29357
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
29358
+ * on no plane at all - which is a RESULT (a plane is missing from the
29359
+ * instrument), not a failure, and it has to be visible to be read as one.
29360
+ */
29361
+ planesExplainTotal: boolean(),
29362
+ /**
29363
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
29364
+ * adapter resolves one context per connection - kept because a plane's call
29365
+ * count of zero against 37 open connections says something different from a
29366
+ * plane with no connections at all.
29367
+ */
29368
+ wsConnections: number(),
29369
+ /**
29370
+ * Client frames the WS plane looked at. `wsMessages` far above
29371
+ * `planes.ws + subscriptions` means most traffic is not operations
29372
+ * (keepalives, connection params) - which is itself an answer.
29373
+ */
29374
+ wsMessages: number(),
29375
+ /**
29376
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
29377
+ * purpose: one live-events stream opened at boot and held for six hours is
29378
+ * one subscription, and counting it as a call would let a quiet plane
29379
+ * masquerade as the storm.
29380
+ */
29381
+ subscriptions: number(),
29382
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
29383
+ subscriptionStops: number(),
29384
+ distinctGroups: number(),
29385
+ /**
29386
+ * Operations counted in the totals whose CALLER attribution was shed at the
29387
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
29388
+ * which transport they arrived on, they just lost their group row.
29389
+ */
29390
+ unattributedCalls: number(),
29391
+ procedures: array(RequestCensusProcedureSchema).readonly(),
29392
+ groups: array(RequestCensusGroupSchema).readonly()
29393
+ }).extend({ persisted: boolean() });
29394
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
29395
+ var LogLevelSchema$1 = _enum([
29396
+ "debug",
29397
+ "info",
29398
+ "warn",
29399
+ "error"
29400
+ ]);
29401
+ /**
29402
+ * The diagnostics that can be ARMED for a window. Exactly one today.
29403
+ *
29404
+ * A diagnostic is anything whose cost is only worth paying while a question is
29405
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
29406
+ */
29407
+ var DiagnosticIdSchema = _enum(["request-census"]);
29408
+ /**
29409
+ * The layers of the level hierarchy, general → specific. The most specific
29410
+ * layer that carries an explicit value wins.
29411
+ *
29412
+ * `component` is DECLARED and not yet resolvable: the per-component channels
29413
+ * are a later slice of the same plan, and a `levelSource` enum that has to
29414
+ * grow later would force every consumer of this document to change with it.
29415
+ * Nothing returns `component` today.
29416
+ */
29417
+ var LoggingScopeKindSchema = _enum([
29418
+ "cluster",
29419
+ "node",
29420
+ "component"
29421
+ ]);
29422
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
29423
+ var LoggingLevelSourceSchema = _enum([
29424
+ "default",
29425
+ "cluster",
29426
+ "node",
29427
+ "component"
29428
+ ]);
29429
+ /**
29430
+ * One layer of the hierarchy as it actually STANDS.
29431
+ *
29432
+ * `level: null` is the whole reason this array is returned: it is the
29433
+ * difference between "this node is at `info` because I decided it" and
29434
+ * "...because it inherits". An operator who clears an override believing they
29435
+ * are clearing an inherited value has been handed the same defect as the two
29436
+ * contradicting knobs this document exists to remove, moved one floor up.
29437
+ */
29438
+ var LoggingLevelLayerSchema = object({
29439
+ scope: LoggingScopeKindSchema,
29440
+ /** The node this layer speaks for; `null` on the cluster layer. */
29441
+ nodeId: string().nullable(),
29442
+ /** Explicitly set here, or `null` when this layer inherits. */
29443
+ level: LogLevelSchema$1.nullable()
29444
+ });
29445
+ /** What a line is judged against, and WHICH layer decided it. */
29446
+ var LoggingEffectiveSchema = object({
29447
+ level: LogLevelSchema$1,
29448
+ levelSource: LoggingLevelSourceSchema
29449
+ });
29450
+ /** Every layer, general → specific. Never collapsed into the effective value. */
29451
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
29452
+ /**
29453
+ * An armed diagnostic, with its DEADLINE.
29454
+ *
29455
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
29456
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
29457
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
29458
+ * `armed` is false — a window is never reported as slightly expired.
29459
+ */
29460
+ var DiagnosticWindowSchema = object({
29461
+ id: DiagnosticIdSchema,
29462
+ armed: boolean(),
29463
+ /** Epoch ms the window closes at. 0 when disarmed. */
29464
+ armedUntilMs: number(),
29465
+ /** Ms left before it expires on its own. 0 when disarmed. */
29466
+ remainingMs: number(),
29467
+ /** Whether the stored deadline is the one the live diagnostic is running —
29468
+ * i.e. whether this window would survive a restart. */
29469
+ persisted: boolean()
29470
+ });
29471
+ /**
29472
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
29473
+ * server — there is no maximum here on purpose: a bound repeated in a schema
29474
+ * is a second knob that disagrees with the first the day one of them moves.
29475
+ */
29476
+ var DiagnosticWindowPatchSchema = object({
29477
+ id: DiagnosticIdSchema,
29478
+ armMs: number().int().min(0),
29479
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
29480
+ reportEveryMs: number().int().positive().optional()
29481
+ });
29482
+ /**
29483
+ * A PATCH, and patches MERGE.
29484
+ *
29485
+ * A field absent from the patch is left exactly as it was — arming a
29486
+ * diagnostic never resets a level, and setting a level never disarms a window.
29487
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
29488
+ * `setAll` already merges, and rebuilding the object is how an absent field
29489
+ * turns into an erased one.
29490
+ */
29491
+ var LoggingSettingsPatchSchema = object({
29492
+ /**
29493
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
29494
+ * addressed scope so it inherits again. A value sets it.
29495
+ */
29496
+ level: LogLevelSchema$1.nullable().optional(),
29497
+ /**
29498
+ * Only the diagnostics NAMED here change. An armed window that is not listed
29499
+ * keeps running — a patch is never a full replacement.
29500
+ */
29501
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29502
+ });
29503
+ /**
29504
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
29505
+ *
29506
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
29507
+ * input — the generated router strips it and uses it to resolve the PROVIDER
29508
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
29509
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
29510
+ * by an agent that holds no cluster document at all. The hub is the single
29511
+ * authority over the whole hierarchy and answers for every layer, so the
29512
+ * layer selector needs a name the transport does not already own.
29513
+ */
29514
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29515
+ var SetLoggingSettingsInputSchema = object({
29516
+ scopeNodeId: string().optional(),
29517
+ patch: LoggingSettingsPatchSchema
29518
+ });
29519
+ /**
29520
+ * The whole document, as read and as returned after every write.
29521
+ *
29522
+ * `persisted: false` means the settings store could not be read or written.
29523
+ * The in-memory mirror still governs behaviour and is unchanged by the
29524
+ * failure — a read that fails neither switches a level nor disarms a window
29525
+ * (D49) — but the operator is told that what they are looking at would not
29526
+ * survive a restart.
29527
+ */
29528
+ var LoggingSettingsStateSchema = object({
29529
+ /** The layer this document was read at. `null` = the cluster layer. */
29530
+ scopeNodeId: string().nullable(),
29531
+ effective: LoggingEffectiveSchema,
29532
+ explicit: LoggingExplicitSchema,
29533
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
29534
+ persisted: boolean()
29535
+ });
29076
29536
  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(), {
29077
29537
  kind: "mutation",
29078
29538
  auth: "admin"
@@ -29085,6 +29545,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29085
29545
  }), method(_void(), SiteLocationStatusSchema, {
29086
29546
  kind: "mutation",
29087
29547
  auth: "admin"
29548
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29549
+ kind: "mutation",
29550
+ auth: "admin"
29088
29551
  });
29089
29552
  /**
29090
29553
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -36324,6 +36787,18 @@ Object.freeze({
36324
36787
  addonId: null,
36325
36788
  access: "create"
36326
36789
  },
36790
+ "system.getLoggingSettings": {
36791
+ capName: "system",
36792
+ capScope: "system",
36793
+ addonId: null,
36794
+ access: "view"
36795
+ },
36796
+ "system.getRequestCensus": {
36797
+ capName: "system",
36798
+ capScope: "system",
36799
+ addonId: null,
36800
+ access: "view"
36801
+ },
36327
36802
  "system.getRetentionConfig": {
36328
36803
  capName: "system",
36329
36804
  capScope: "system",
@@ -36354,6 +36829,12 @@ Object.freeze({
36354
36829
  addonId: null,
36355
36830
  access: "view"
36356
36831
  },
36832
+ "system.setLoggingSettings": {
36833
+ capName: "system",
36834
+ capScope: "system",
36835
+ addonId: null,
36836
+ access: "create"
36837
+ },
36357
36838
  "system.setRetentionConfig": {
36358
36839
  capName: "system",
36359
36840
  capScope: "system",
@@ -37509,6 +37990,10 @@ Object.freeze({
37509
37990
  name: "deviceId",
37510
37991
  form: "single",
37511
37992
  optional: true
37993
+ }, {
37994
+ name: "deviceIds",
37995
+ form: "array",
37996
+ optional: true
37512
37997
  }],
37513
37998
  "fanControl.setDirection": [{
37514
37999
  name: "deviceId",
@@ -39119,7 +39604,38 @@ object({
39119
39604
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
39120
39605
  * reproduce that.
39121
39606
  */
39122
- tileBudgetMb: number().int().min(0).max(1024)
39607
+ tileBudgetMb: number().int().min(0).max(1024),
39608
+ /**
39609
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
39610
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
39611
+ * subject tiles, on frames that detected something.
39612
+ *
39613
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
39614
+ * containment is strict by design, so the native `keyFrame`, the detail
39615
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
39616
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
39617
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
39618
+ * frame-time after delivery, with the request only p50 367 ms behind it.
39619
+ *
39620
+ * Sizing, and why this is a budget and not a duration: a scene tile is
39621
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
39622
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
39623
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
39624
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
39625
+ * binds only through a detection burst, where it still covers well past the
39626
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
39627
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
39628
+ * whole shape exists to avoid.
39629
+ *
39630
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
39631
+ * subject tile, so one shared budget would let a busy camera's key frames
39632
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
39633
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
39634
+ * pre-existing behaviour, where a late full-frame request had nothing but the
39635
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
39636
+ * nothing.
39637
+ */
39638
+ sceneBudgetMb: number().int().min(0).max(1024)
39123
39639
  });
39124
39640
  /**
39125
39641
  * The values in force when the operator has set nothing.
@@ -39135,12 +39651,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
39135
39651
  budgetMb: 1024,
39136
39652
  activityMs: 15e3,
39137
39653
  tileBudgetMb: 64,
39654
+ sceneBudgetMb: 48,
39138
39655
  admission: "inferred"
39139
39656
  };
39140
39657
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
39141
39658
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
39142
39659
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
39143
39660
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
39661
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
39144
39662
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
39145
39663
  var MB = 1024 * 1024;
39146
39664
  1024 * MB, 3072 * MB;