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