@camstack/addon-provider-unifi 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
@@ -7525,6 +7525,66 @@ var OpsLogQueryInputSchema = object({
7525
7525
  /** Max rows returned, newest-first. */
7526
7526
  limit: number().int().min(1).max(1e3).optional()
7527
7527
  });
7528
+ var LabelDefinitionSchema = object({
7529
+ id: string(),
7530
+ name: string(),
7531
+ category: string().optional(),
7532
+ description: string().optional(),
7533
+ icon: string().optional()
7534
+ });
7535
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
7536
+ var CLASS_MAP_MACRO_TARGETS = [
7537
+ "person",
7538
+ "vehicle",
7539
+ "animal",
7540
+ "package"
7541
+ ];
7542
+ /**
7543
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
7544
+ * un operatore può selezionare.
7545
+ *
7546
+ * Sono le tre offerte dallo step `object-detection`
7547
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
7548
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
7549
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
7550
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
7551
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
7552
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
7553
+ *
7554
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
7555
+ * dello step e una seconda volta come union `FirstLevelMacro`
7556
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
7557
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
7558
+ * successiva.
7559
+ */
7560
+ var FIRST_LEVEL_MACRO_CLASSES = [
7561
+ "person",
7562
+ "vehicle",
7563
+ "animal"
7564
+ ];
7565
+ /**
7566
+ * Wire schema for a per-model CATALOG classMap override
7567
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
7568
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
7569
+ * detection pipeline executor actually routes.
7570
+ *
7571
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
7572
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
7573
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
7574
+ * enum) — the two used to share the name `ClassMapDefinition`/
7575
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
7576
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
7577
+ * are not: it is two different concepts colliding on a name. Keep this type
7578
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
7579
+ * would either narrow every `ClassMapDefinition` consumer to the four
7580
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
7581
+ * schema exists for (see the "rejects a classMap whose target is not a
7582
+ * detection macro" test in `model-catalog-schema.test.ts`).
7583
+ */
7584
+ var DetectionCatalogClassMapSchema = object({
7585
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
7586
+ preserveOriginal: boolean()
7587
+ });
7528
7588
  /**
7529
7589
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
7530
7590
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -7547,10 +7607,55 @@ var RecordingStorageModeSchema = _enum([
7547
7607
  "events",
7548
7608
  "continuous"
7549
7609
  ]);
7610
+ /**
7611
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
7612
+ * tre offerte dallo step `object-detection`, da UNA lista
7613
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
7614
+ */
7615
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
7616
+ /**
7617
+ * True quando `values` non ripete un elemento.
7618
+ *
7619
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
7620
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
7621
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
7622
+ */
7623
+ var noDuplicates = (values) => new Set(values).size === values.length;
7550
7624
  /** Which detectors trigger an `events`-mode band. */
7551
7625
  var RecordingTriggersSchema = object({
7552
7626
  motion: boolean().optional(),
7553
- audioThresholdDbfs: number().optional()
7627
+ audioThresholdDbfs: number().optional(),
7628
+ /**
7629
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
7630
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
7631
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
7632
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
7633
+ *
7634
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
7635
+ * quelle che hanno attraversato `enabledMacroClasses`, i
7636
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
7637
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
7638
+ * finestre — vedi `recorder/object-trigger.ts`.
7639
+ */
7640
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
7641
+ /**
7642
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
7643
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
7644
+ * `objectClasses`.
7645
+ *
7646
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
7647
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
7648
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
7649
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
7650
+ * device (D12) — mai un elenco globale di cap.
7651
+ *
7652
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
7653
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
7654
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
7655
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
7656
+ * registrare.
7657
+ */
7658
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7554
7659
  });
7555
7660
  /**
7556
7661
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8002,41 +8107,6 @@ var DecoderSessionConfigSchema = object({
8002
8107
  */
8003
8108
  debug: boolean().optional()
8004
8109
  });
8005
- var LabelDefinitionSchema = object({
8006
- id: string(),
8007
- name: string(),
8008
- category: string().optional(),
8009
- description: string().optional(),
8010
- icon: string().optional()
8011
- });
8012
- /**
8013
- * Wire schema for a per-model CATALOG classMap override
8014
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8015
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8016
- * detection pipeline executor actually routes.
8017
- *
8018
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8019
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8020
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8021
- * enum) — the two used to share the name `ClassMapDefinition`/
8022
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8023
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8024
- * are not: it is two different concepts colliding on a name. Keep this type
8025
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8026
- * would either narrow every `ClassMapDefinition` consumer to the four
8027
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8028
- * schema exists for (see the "rejects a classMap whose target is not a
8029
- * detection macro" test in `model-catalog-schema.test.ts`).
8030
- */
8031
- var DetectionCatalogClassMapSchema = object({
8032
- mapping: record(string(), _enum([
8033
- "person",
8034
- "vehicle",
8035
- "animal",
8036
- "package"
8037
- ])),
8038
- preserveOriginal: boolean()
8039
- });
8040
8110
  var MODEL_FORMATS = [
8041
8111
  "onnx",
8042
8112
  "coreml",
@@ -21152,7 +21222,7 @@ var lifecycleJobSchema = object({
21152
21222
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21153
21223
  * as every other cap.
21154
21224
  */
21155
- var LogLevelSchema$1 = _enum([
21225
+ var LogLevelSchema$2 = _enum([
21156
21226
  "debug",
21157
21227
  "info",
21158
21228
  "warn",
@@ -21359,7 +21429,7 @@ var CustomActionInputSchema = object({
21359
21429
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21360
21430
  addonId: string(),
21361
21431
  limit: number().min(1).max(500).default(100),
21362
- level: LogLevelSchema$1.optional()
21432
+ level: LogLevelSchema$2.optional()
21363
21433
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21364
21434
  packageName: string(),
21365
21435
  version: string().optional()
@@ -21457,7 +21527,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21457
21527
  auth: "admin"
21458
21528
  }), method(object({
21459
21529
  addonId: string(),
21460
- level: LogLevelSchema$1.optional()
21530
+ level: LogLevelSchema$2.optional()
21461
21531
  }), LogStreamEntrySchema, { kind: "subscription" });
21462
21532
  /**
21463
21533
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -23198,6 +23268,35 @@ var FaceFilterEnum = _enum([
23198
23268
  "identified",
23199
23269
  "all"
23200
23270
  ]);
23271
+ /**
23272
+ * What a `listRecentFaces` page is ORDERED BY.
23273
+ *
23274
+ * - `timestamp` — when the face was seen. The historical (and default) order.
23275
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
23276
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
23277
+ * order: it puts the suggestions an operator can confirm with one tap at the
23278
+ * top, and it is the reason this enum exists — a client that ranked a capped
23279
+ * page client-side was ranking the newest N, never the most certain N.
23280
+ *
23281
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
23282
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
23283
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
23284
+ * — flipping the direction reorders the rows that HAVE a certainty and never
23285
+ * floods the page with the ones that do not. `addon-post-analysis`'s
23286
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
23287
+ * then by faceId, and is what makes this a total order instead of the
23288
+ * backend's NULL-collation accident.
23289
+ */
23290
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
23291
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
23292
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
23293
+ * never leaves the server. */
23294
+ var FaceClusterSchema = object({
23295
+ faceIds: array(string()).readonly(),
23296
+ representativeFaceId: string(),
23297
+ size: number().int(),
23298
+ cohesion: number()
23299
+ });
23201
23300
  var MediaFileLiteSchema$1 = object({
23202
23301
  key: string(),
23203
23302
  kind: string(),
@@ -23244,24 +23343,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23244
23343
  kind: "mutation",
23245
23344
  auth: "admin"
23246
23345
  }), method(object({
23247
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
23346
+ /**
23347
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
23348
+ *
23349
+ * The legacy single-camera form, kept verbatim for every caller that
23350
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
23351
+ * instead — never both: `deviceIds` is the authority whenever it is
23352
+ * present, and this field is then ignored rather than unioned, so
23353
+ * there is exactly one answer to "which cameras did I ask for".
23354
+ */
23248
23355
  deviceId: number().int().optional(),
23356
+ /**
23357
+ * Restrict to a SET of cameras — the review UI's camera filter, which
23358
+ * until now had to fetch the cluster-wide page and drop rows in the
23359
+ * client (so the `limit` it asked for was spent on cameras it was
23360
+ * about to discard).
23361
+ *
23362
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
23363
+ * "every camera". A request for no devices is a request, not an
23364
+ * omission; same contract as `deviceManager.listFleet` and
23365
+ * `pipelineAnalytics.listRecentTracks`.
23366
+ *
23367
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
23368
+ */
23369
+ deviceIds: array(number().int()).optional(),
23249
23370
  limit: number().int().positive().optional(),
23250
23371
  filter: FaceFilterEnum.optional(),
23251
23372
  /**
23252
- * Inline the base64 crop on every row. Default `true` — the existing
23253
- * behaviour, kept so no caller breaks.
23373
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23374
+ * Absent means no lower bound.
23375
+ */
23376
+ since: number().int().optional(),
23377
+ /**
23378
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23379
+ * Absent means no upper bound.
23380
+ */
23381
+ until: number().int().optional(),
23382
+ /**
23383
+ * Order the page by time or by suggestion certainty. Default
23384
+ * `'timestamp'` — the historical order, unchanged for every caller
23385
+ * that does not ask.
23254
23386
  *
23255
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
23256
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
23257
- * the browser cache the images.
23387
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
23388
+ * does under `'suggestionConfidence'`.
23258
23389
  *
23259
- * **This is an INPUT field, so it does not reach the addon until the
23260
- * next train.** The hub router validates cap inputs against its own
23261
- * compiled Zod, which strips a key it does not know — verified today
23262
- * on the OUTPUT side, where an additive field DOES arrive immediately
23263
- * (`Track.hasFace`). Until the train ships, sending `false` is
23264
- * harmless and simply keeps the crops inline.
23390
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
23391
+ * index and stops reading as soon as `limit` rows have PASSED the
23392
+ * filter. `'suggestionConfidence'` cannot stop early — the most
23393
+ * certain row may be the oldest — so it walks the window. Narrow it
23394
+ * with {@link since} / {@link until}.
23395
+ */
23396
+ sortBy: FaceSortFieldEnum.optional(),
23397
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
23398
+ sortDirection: FaceSortDirectionEnum.optional(),
23399
+ /**
23400
+ * Inline the base64 crop on every row.
23401
+ *
23402
+ * Default `false` since the 2026-08-25 inversion — see
23403
+ * `include-crops-default.ts`, which is the ONE place that resolves
23404
+ * this for every gallery, and which records why the inline shape had
23405
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
23406
+ * The doc here used to still say `true`; it was wrong, and a leftover
23407
+ * that describes the old design reads as permission to rely on it.
23408
+ *
23409
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
23410
+ * which the browser fetches off the `event-media` plane in parallel,
23411
+ * cached and ETagged.
23265
23412
  */
23266
23413
  includeCrops: boolean().optional()
23267
23414
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -23297,13 +23444,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23297
23444
  }), method(object({
23298
23445
  threshold: number().min(0).max(1).optional(),
23299
23446
  minClusterSize: number().int().min(2).optional(),
23300
- limit: number().int().positive().optional()
23301
- }).optional(), array(object({
23302
- faceIds: array(string()).readonly(),
23303
- representativeFaceId: string(),
23304
- size: number().int(),
23305
- cohesion: number()
23306
- })).readonly());
23447
+ /**
23448
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
23449
+ * which read as though it bounded the work — it never did.
23450
+ *
23451
+ * Wins over {@link limit} when both are sent.
23452
+ */
23453
+ maxClusters: number().int().positive().optional(),
23454
+ /**
23455
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
23456
+ * RESULT, not the scan. Kept so existing callers keep working; send
23457
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
23458
+ */
23459
+ limit: number().int().positive().optional(),
23460
+ /**
23461
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
23462
+ * POOL, not the result.
23463
+ *
23464
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
23465
+ * used to read every unassigned face on the hub no matter what the
23466
+ * caller asked for, because the only bound cut the finished clusters
23467
+ * afterwards; a UI showing a window of 100 paid for a scan of the
23468
+ * whole corpus, on an addon whose disk is under contention.
23469
+ *
23470
+ * The pool is the NEWEST matching faces first — the same order the
23471
+ * gallery shows — so a bound here shortens the horizon, it does not
23472
+ * sample it randomly.
23473
+ *
23474
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
23475
+ * so the live corpus — 372 face rows — is unaffected while the
23476
+ * unbounded scan can never come back as the table grows.
23477
+ */
23478
+ maxFacesScanned: number().int().positive().optional()
23479
+ }).optional(), array(FaceClusterSchema).readonly());
23307
23480
  /**
23308
23481
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
23309
23482
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -28245,6 +28418,293 @@ var SetSiteLocationInputSchema = object({
28245
28418
  latitude: number().min(-90).max(90),
28246
28419
  longitude: number().min(-180).max(180)
28247
28420
  }).nullable();
28421
+ /**
28422
+ * The TRANSPORT a call arrived on.
28423
+ *
28424
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28425
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28426
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28427
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28428
+ * checkable rather than asserted.
28429
+ *
28430
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28431
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28432
+ * connection; the viewer talks to the hub over `wsLink`
28433
+ * exclusively, so this is the plane the HTTP census could not see.
28434
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28435
+ * never touches a socket and therefore never touched a census.
28436
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28437
+ * that is exactly what its `0` asserts: every plane the hub has can name
28438
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28439
+ * plane nobody instrumented lands here instead of vanishing from the total.
28440
+ */
28441
+ var TransportPlaneSchema = _enum([
28442
+ "http",
28443
+ "ws",
28444
+ "mesh",
28445
+ "unknown"
28446
+ ]);
28447
+ /**
28448
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28449
+ * reads as "not instrumented", which is the one thing this census must never
28450
+ * make an operator wonder about.
28451
+ */
28452
+ var TransportPlaneCountsSchema = object({
28453
+ http: number(),
28454
+ ws: number(),
28455
+ mesh: number(),
28456
+ unknown: number()
28457
+ });
28458
+ /**
28459
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28460
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28461
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28462
+ * already prints - never a token, never an `Authorization` header.
28463
+ *
28464
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28465
+ * and lives for hours, so folding it into a call count makes one long-lived
28466
+ * stream look like a storm.
28467
+ */
28468
+ var RequestCensusGroupSchema = object({
28469
+ plane: TransportPlaneSchema,
28470
+ procedure: string(),
28471
+ userAgent: string(),
28472
+ ip: string(),
28473
+ principal: string(),
28474
+ calls: number(),
28475
+ subscriptions: number(),
28476
+ perMin: number()
28477
+ });
28478
+ /**
28479
+ * A procedure's TOTAL over the window, across every caller.
28480
+ *
28481
+ * This block, not the group list, is what answers "did these calls arrive over
28482
+ * HTTP at all". A total far BELOW what a store-side census counted over the
28483
+ * same window excludes the HTTP plane, which is a result, not a failure.
28484
+ */
28485
+ var RequestCensusProcedureSchema = object({
28486
+ procedure: string(),
28487
+ calls: number(),
28488
+ /**
28489
+ * The same total, split by transport. THIS is the row that answers the
28490
+ * question the census exists for: one look at `deviceManager.listAll` says
28491
+ * which plane carried the 4 960, without joining two log lines by eye.
28492
+ */
28493
+ planes: TransportPlaneCountsSchema,
28494
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28495
+ subscriptions: number(),
28496
+ perMin: number()
28497
+ });
28498
+ /**
28499
+ * The census as an operator sees it.
28500
+ *
28501
+ * `persisted` is the honest answer to "will this survive the restart I am
28502
+ * about to do": the arm deadline is written to `system-settings` so a window
28503
+ * armed now can measure the NEXT boot, and a write that failed must not look
28504
+ * like one that succeeded.
28505
+ */
28506
+ var RequestCensusStatusSchema = object({
28507
+ armed: boolean(),
28508
+ /** How long the current - or just-closed - window collected, in ms. */
28509
+ elapsedMs: number(),
28510
+ /** The window actually armed, after the server clamped the request. */
28511
+ windowMs: number(),
28512
+ /** Epoch ms the window closes at. 0 when disarmed. */
28513
+ armedUntilMs: number(),
28514
+ httpRequests: number(),
28515
+ batchedRequests: number(),
28516
+ /**
28517
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
28518
+ * is in play (`?batch=1` carries several procedures in one request); this is
28519
+ * the number comparable with a store-side call count.
28520
+ */
28521
+ procedureCalls: number(),
28522
+ /**
28523
+ * `procedureCalls` split by transport. The four keys sum to
28524
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28525
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28526
+ */
28527
+ planes: TransportPlaneCountsSchema,
28528
+ /**
28529
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28530
+ * on no plane at all - which is a RESULT (a plane is missing from the
28531
+ * instrument), not a failure, and it has to be visible to be read as one.
28532
+ */
28533
+ planesExplainTotal: boolean(),
28534
+ /**
28535
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
28536
+ * adapter resolves one context per connection - kept because a plane's call
28537
+ * count of zero against 37 open connections says something different from a
28538
+ * plane with no connections at all.
28539
+ */
28540
+ wsConnections: number(),
28541
+ /**
28542
+ * Client frames the WS plane looked at. `wsMessages` far above
28543
+ * `planes.ws + subscriptions` means most traffic is not operations
28544
+ * (keepalives, connection params) - which is itself an answer.
28545
+ */
28546
+ wsMessages: number(),
28547
+ /**
28548
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28549
+ * purpose: one live-events stream opened at boot and held for six hours is
28550
+ * one subscription, and counting it as a call would let a quiet plane
28551
+ * masquerade as the storm.
28552
+ */
28553
+ subscriptions: number(),
28554
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28555
+ subscriptionStops: number(),
28556
+ distinctGroups: number(),
28557
+ /**
28558
+ * Operations counted in the totals whose CALLER attribution was shed at the
28559
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28560
+ * which transport they arrived on, they just lost their group row.
28561
+ */
28562
+ unattributedCalls: number(),
28563
+ procedures: array(RequestCensusProcedureSchema).readonly(),
28564
+ groups: array(RequestCensusGroupSchema).readonly()
28565
+ }).extend({ persisted: boolean() });
28566
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
28567
+ var LogLevelSchema$1 = _enum([
28568
+ "debug",
28569
+ "info",
28570
+ "warn",
28571
+ "error"
28572
+ ]);
28573
+ /**
28574
+ * The diagnostics that can be ARMED for a window. Exactly one today.
28575
+ *
28576
+ * A diagnostic is anything whose cost is only worth paying while a question is
28577
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
28578
+ */
28579
+ var DiagnosticIdSchema = _enum(["request-census"]);
28580
+ /**
28581
+ * The layers of the level hierarchy, general → specific. The most specific
28582
+ * layer that carries an explicit value wins.
28583
+ *
28584
+ * `component` is DECLARED and not yet resolvable: the per-component channels
28585
+ * are a later slice of the same plan, and a `levelSource` enum that has to
28586
+ * grow later would force every consumer of this document to change with it.
28587
+ * Nothing returns `component` today.
28588
+ */
28589
+ var LoggingScopeKindSchema = _enum([
28590
+ "cluster",
28591
+ "node",
28592
+ "component"
28593
+ ]);
28594
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
28595
+ var LoggingLevelSourceSchema = _enum([
28596
+ "default",
28597
+ "cluster",
28598
+ "node",
28599
+ "component"
28600
+ ]);
28601
+ /**
28602
+ * One layer of the hierarchy as it actually STANDS.
28603
+ *
28604
+ * `level: null` is the whole reason this array is returned: it is the
28605
+ * difference between "this node is at `info` because I decided it" and
28606
+ * "...because it inherits". An operator who clears an override believing they
28607
+ * are clearing an inherited value has been handed the same defect as the two
28608
+ * contradicting knobs this document exists to remove, moved one floor up.
28609
+ */
28610
+ var LoggingLevelLayerSchema = object({
28611
+ scope: LoggingScopeKindSchema,
28612
+ /** The node this layer speaks for; `null` on the cluster layer. */
28613
+ nodeId: string().nullable(),
28614
+ /** Explicitly set here, or `null` when this layer inherits. */
28615
+ level: LogLevelSchema$1.nullable()
28616
+ });
28617
+ /** What a line is judged against, and WHICH layer decided it. */
28618
+ var LoggingEffectiveSchema = object({
28619
+ level: LogLevelSchema$1,
28620
+ levelSource: LoggingLevelSourceSchema
28621
+ });
28622
+ /** Every layer, general → specific. Never collapsed into the effective value. */
28623
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
28624
+ /**
28625
+ * An armed diagnostic, with its DEADLINE.
28626
+ *
28627
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
28628
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
28629
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
28630
+ * `armed` is false — a window is never reported as slightly expired.
28631
+ */
28632
+ var DiagnosticWindowSchema = object({
28633
+ id: DiagnosticIdSchema,
28634
+ armed: boolean(),
28635
+ /** Epoch ms the window closes at. 0 when disarmed. */
28636
+ armedUntilMs: number(),
28637
+ /** Ms left before it expires on its own. 0 when disarmed. */
28638
+ remainingMs: number(),
28639
+ /** Whether the stored deadline is the one the live diagnostic is running —
28640
+ * i.e. whether this window would survive a restart. */
28641
+ persisted: boolean()
28642
+ });
28643
+ /**
28644
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
28645
+ * server — there is no maximum here on purpose: a bound repeated in a schema
28646
+ * is a second knob that disagrees with the first the day one of them moves.
28647
+ */
28648
+ var DiagnosticWindowPatchSchema = object({
28649
+ id: DiagnosticIdSchema,
28650
+ armMs: number().int().min(0),
28651
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
28652
+ reportEveryMs: number().int().positive().optional()
28653
+ });
28654
+ /**
28655
+ * A PATCH, and patches MERGE.
28656
+ *
28657
+ * A field absent from the patch is left exactly as it was — arming a
28658
+ * diagnostic never resets a level, and setting a level never disarms a window.
28659
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
28660
+ * `setAll` already merges, and rebuilding the object is how an absent field
28661
+ * turns into an erased one.
28662
+ */
28663
+ var LoggingSettingsPatchSchema = object({
28664
+ /**
28665
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
28666
+ * addressed scope so it inherits again. A value sets it.
28667
+ */
28668
+ level: LogLevelSchema$1.nullable().optional(),
28669
+ /**
28670
+ * Only the diagnostics NAMED here change. An armed window that is not listed
28671
+ * keeps running — a patch is never a full replacement.
28672
+ */
28673
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28674
+ });
28675
+ /**
28676
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
28677
+ *
28678
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
28679
+ * input — the generated router strips it and uses it to resolve the PROVIDER
28680
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
28681
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
28682
+ * by an agent that holds no cluster document at all. The hub is the single
28683
+ * authority over the whole hierarchy and answers for every layer, so the
28684
+ * layer selector needs a name the transport does not already own.
28685
+ */
28686
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
28687
+ var SetLoggingSettingsInputSchema = object({
28688
+ scopeNodeId: string().optional(),
28689
+ patch: LoggingSettingsPatchSchema
28690
+ });
28691
+ /**
28692
+ * The whole document, as read and as returned after every write.
28693
+ *
28694
+ * `persisted: false` means the settings store could not be read or written.
28695
+ * The in-memory mirror still governs behaviour and is unchanged by the
28696
+ * failure — a read that fails neither switches a level nor disarms a window
28697
+ * (D49) — but the operator is told that what they are looking at would not
28698
+ * survive a restart.
28699
+ */
28700
+ var LoggingSettingsStateSchema = object({
28701
+ /** The layer this document was read at. `null` = the cluster layer. */
28702
+ scopeNodeId: string().nullable(),
28703
+ effective: LoggingEffectiveSchema,
28704
+ explicit: LoggingExplicitSchema,
28705
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
28706
+ persisted: boolean()
28707
+ });
28248
28708
  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(), {
28249
28709
  kind: "mutation",
28250
28710
  auth: "admin"
@@ -28257,6 +28717,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28257
28717
  }), method(_void(), SiteLocationStatusSchema, {
28258
28718
  kind: "mutation",
28259
28719
  auth: "admin"
28720
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
28721
+ kind: "mutation",
28722
+ auth: "admin"
28260
28723
  });
28261
28724
  /**
28262
28725
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -35496,6 +35959,18 @@ Object.freeze({
35496
35959
  addonId: null,
35497
35960
  access: "create"
35498
35961
  },
35962
+ "system.getLoggingSettings": {
35963
+ capName: "system",
35964
+ capScope: "system",
35965
+ addonId: null,
35966
+ access: "view"
35967
+ },
35968
+ "system.getRequestCensus": {
35969
+ capName: "system",
35970
+ capScope: "system",
35971
+ addonId: null,
35972
+ access: "view"
35973
+ },
35499
35974
  "system.getRetentionConfig": {
35500
35975
  capName: "system",
35501
35976
  capScope: "system",
@@ -35526,6 +36001,12 @@ Object.freeze({
35526
36001
  addonId: null,
35527
36002
  access: "view"
35528
36003
  },
36004
+ "system.setLoggingSettings": {
36005
+ capName: "system",
36006
+ capScope: "system",
36007
+ addonId: null,
36008
+ access: "create"
36009
+ },
35529
36010
  "system.setRetentionConfig": {
35530
36011
  capName: "system",
35531
36012
  capScope: "system",
@@ -36681,6 +37162,10 @@ Object.freeze({
36681
37162
  name: "deviceId",
36682
37163
  form: "single",
36683
37164
  optional: true
37165
+ }, {
37166
+ name: "deviceIds",
37167
+ form: "array",
37168
+ optional: true
36684
37169
  }],
36685
37170
  "fanControl.setDirection": [{
36686
37171
  name: "deviceId",
@@ -38291,7 +38776,38 @@ object({
38291
38776
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
38292
38777
  * reproduce that.
38293
38778
  */
38294
- tileBudgetMb: number().int().min(0).max(1024)
38779
+ tileBudgetMb: number().int().min(0).max(1024),
38780
+ /**
38781
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
38782
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
38783
+ * subject tiles, on frames that detected something.
38784
+ *
38785
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
38786
+ * containment is strict by design, so the native `keyFrame`, the detail
38787
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
38788
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
38789
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
38790
+ * frame-time after delivery, with the request only p50 367 ms behind it.
38791
+ *
38792
+ * Sizing, and why this is a budget and not a duration: a scene tile is
38793
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
38794
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
38795
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
38796
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
38797
+ * binds only through a detection burst, where it still covers well past the
38798
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
38799
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
38800
+ * whole shape exists to avoid.
38801
+ *
38802
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
38803
+ * subject tile, so one shared budget would let a busy camera's key frames
38804
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
38805
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
38806
+ * pre-existing behaviour, where a late full-frame request had nothing but the
38807
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
38808
+ * nothing.
38809
+ */
38810
+ sceneBudgetMb: number().int().min(0).max(1024)
38295
38811
  });
38296
38812
  /**
38297
38813
  * The values in force when the operator has set nothing.
@@ -38307,12 +38823,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
38307
38823
  budgetMb: 1024,
38308
38824
  activityMs: 15e3,
38309
38825
  tileBudgetMb: 64,
38826
+ sceneBudgetMb: 48,
38310
38827
  admission: "inferred"
38311
38828
  };
38312
38829
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
38313
38830
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
38314
38831
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
38315
38832
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
38833
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
38316
38834
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
38317
38835
  var MB = 1024 * 1024;
38318
38836
  1024 * MB, 3072 * MB;