@camstack/addon-matter-broker 0.2.30 → 0.2.32

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
@@ -7540,6 +7540,66 @@ var OpsLogQueryInputSchema = object({
7540
7540
  /** Max rows returned, newest-first. */
7541
7541
  limit: number().int().min(1).max(1e3).optional()
7542
7542
  });
7543
+ var LabelDefinitionSchema = object({
7544
+ id: string$2(),
7545
+ name: string$2(),
7546
+ category: string$2().optional(),
7547
+ description: string$2().optional(),
7548
+ icon: string$2().optional()
7549
+ });
7550
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
7551
+ var CLASS_MAP_MACRO_TARGETS = [
7552
+ "person",
7553
+ "vehicle",
7554
+ "animal",
7555
+ "package"
7556
+ ];
7557
+ /**
7558
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
7559
+ * un operatore può selezionare.
7560
+ *
7561
+ * Sono le tre offerte dallo step `object-detection`
7562
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
7563
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
7564
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
7565
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
7566
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
7567
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
7568
+ *
7569
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
7570
+ * dello step e una seconda volta come union `FirstLevelMacro`
7571
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
7572
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
7573
+ * successiva.
7574
+ */
7575
+ var FIRST_LEVEL_MACRO_CLASSES = [
7576
+ "person",
7577
+ "vehicle",
7578
+ "animal"
7579
+ ];
7580
+ /**
7581
+ * Wire schema for a per-model CATALOG classMap override
7582
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
7583
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
7584
+ * detection pipeline executor actually routes.
7585
+ *
7586
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
7587
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
7588
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
7589
+ * enum) — the two used to share the name `ClassMapDefinition`/
7590
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
7591
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
7592
+ * are not: it is two different concepts colliding on a name. Keep this type
7593
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
7594
+ * would either narrow every `ClassMapDefinition` consumer to the four
7595
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
7596
+ * schema exists for (see the "rejects a classMap whose target is not a
7597
+ * detection macro" test in `model-catalog-schema.test.ts`).
7598
+ */
7599
+ var DetectionCatalogClassMapSchema = object({
7600
+ mapping: record(string$2(), _enum(CLASS_MAP_MACRO_TARGETS)),
7601
+ preserveOriginal: boolean()
7602
+ });
7543
7603
  /**
7544
7604
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
7545
7605
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -7562,10 +7622,55 @@ var RecordingStorageModeSchema = _enum([
7562
7622
  "events",
7563
7623
  "continuous"
7564
7624
  ]);
7625
+ /**
7626
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
7627
+ * tre offerte dallo step `object-detection`, da UNA lista
7628
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
7629
+ */
7630
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
7631
+ /**
7632
+ * True quando `values` non ripete un elemento.
7633
+ *
7634
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
7635
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
7636
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
7637
+ */
7638
+ var noDuplicates = (values) => new Set(values).size === values.length;
7565
7639
  /** Which detectors trigger an `events`-mode band. */
7566
7640
  var RecordingTriggersSchema = object({
7567
7641
  motion: boolean().optional(),
7568
- audioThresholdDbfs: number().optional()
7642
+ audioThresholdDbfs: number().optional(),
7643
+ /**
7644
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
7645
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
7646
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
7647
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
7648
+ *
7649
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
7650
+ * quelle che hanno attraversato `enabledMacroClasses`, i
7651
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
7652
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
7653
+ * finestre — vedi `recorder/object-trigger.ts`.
7654
+ */
7655
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
7656
+ /**
7657
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
7658
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
7659
+ * `objectClasses`.
7660
+ *
7661
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
7662
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
7663
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
7664
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
7665
+ * device (D12) — mai un elenco globale di cap.
7666
+ *
7667
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
7668
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
7669
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
7670
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
7671
+ * registrare.
7672
+ */
7673
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7569
7674
  });
7570
7675
  /**
7571
7676
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8017,41 +8122,6 @@ var DecoderSessionConfigSchema = object({
8017
8122
  */
8018
8123
  debug: boolean().optional()
8019
8124
  });
8020
- var LabelDefinitionSchema = object({
8021
- id: string$2(),
8022
- name: string$2(),
8023
- category: string$2().optional(),
8024
- description: string$2().optional(),
8025
- icon: string$2().optional()
8026
- });
8027
- /**
8028
- * Wire schema for a per-model CATALOG classMap override
8029
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8030
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8031
- * detection pipeline executor actually routes.
8032
- *
8033
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8034
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8035
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8036
- * enum) — the two used to share the name `ClassMapDefinition`/
8037
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8038
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8039
- * are not: it is two different concepts colliding on a name. Keep this type
8040
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8041
- * would either narrow every `ClassMapDefinition` consumer to the four
8042
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8043
- * schema exists for (see the "rejects a classMap whose target is not a
8044
- * detection macro" test in `model-catalog-schema.test.ts`).
8045
- */
8046
- var DetectionCatalogClassMapSchema = object({
8047
- mapping: record(string$2(), _enum([
8048
- "person",
8049
- "vehicle",
8050
- "animal",
8051
- "package"
8052
- ])),
8053
- preserveOriginal: boolean()
8054
- });
8055
8125
  var MODEL_FORMATS = [
8056
8126
  "onnx",
8057
8127
  "coreml",
@@ -21233,7 +21303,7 @@ var lifecycleJobSchema = object({
21233
21303
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21234
21304
  * as every other cap.
21235
21305
  */
21236
- var LogLevelSchema$1 = _enum([
21306
+ var LogLevelSchema$2 = _enum([
21237
21307
  "debug",
21238
21308
  "info",
21239
21309
  "warn",
@@ -21440,7 +21510,7 @@ var CustomActionInputSchema = object({
21440
21510
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21441
21511
  addonId: string$2(),
21442
21512
  limit: number().min(1).max(500).default(100),
21443
- level: LogLevelSchema$1.optional()
21513
+ level: LogLevelSchema$2.optional()
21444
21514
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21445
21515
  packageName: string$2(),
21446
21516
  version: string$2().optional()
@@ -21538,7 +21608,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21538
21608
  auth: "admin"
21539
21609
  }), method(object({
21540
21610
  addonId: string$2(),
21541
- level: LogLevelSchema$1.optional()
21611
+ level: LogLevelSchema$2.optional()
21542
21612
  }), LogStreamEntrySchema, { kind: "subscription" });
21543
21613
  /**
21544
21614
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -23279,6 +23349,35 @@ var FaceFilterEnum = _enum([
23279
23349
  "identified",
23280
23350
  "all"
23281
23351
  ]);
23352
+ /**
23353
+ * What a `listRecentFaces` page is ORDERED BY.
23354
+ *
23355
+ * - `timestamp` — when the face was seen. The historical (and default) order.
23356
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
23357
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
23358
+ * order: it puts the suggestions an operator can confirm with one tap at the
23359
+ * top, and it is the reason this enum exists — a client that ranked a capped
23360
+ * page client-side was ranking the newest N, never the most certain N.
23361
+ *
23362
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
23363
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
23364
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
23365
+ * — flipping the direction reorders the rows that HAVE a certainty and never
23366
+ * floods the page with the ones that do not. `addon-post-analysis`'s
23367
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
23368
+ * then by faceId, and is what makes this a total order instead of the
23369
+ * backend's NULL-collation accident.
23370
+ */
23371
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
23372
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
23373
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
23374
+ * never leaves the server. */
23375
+ var FaceClusterSchema = object({
23376
+ faceIds: array(string$2()).readonly(),
23377
+ representativeFaceId: string$2(),
23378
+ size: number().int(),
23379
+ cohesion: number()
23380
+ });
23282
23381
  var MediaFileLiteSchema$1 = object({
23283
23382
  key: string$2(),
23284
23383
  kind: string$2(),
@@ -23325,24 +23424,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23325
23424
  kind: "mutation",
23326
23425
  auth: "admin"
23327
23426
  }), method(object({
23328
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
23427
+ /**
23428
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
23429
+ *
23430
+ * The legacy single-camera form, kept verbatim for every caller that
23431
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
23432
+ * instead — never both: `deviceIds` is the authority whenever it is
23433
+ * present, and this field is then ignored rather than unioned, so
23434
+ * there is exactly one answer to "which cameras did I ask for".
23435
+ */
23329
23436
  deviceId: number().int().optional(),
23437
+ /**
23438
+ * Restrict to a SET of cameras — the review UI's camera filter, which
23439
+ * until now had to fetch the cluster-wide page and drop rows in the
23440
+ * client (so the `limit` it asked for was spent on cameras it was
23441
+ * about to discard).
23442
+ *
23443
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
23444
+ * "every camera". A request for no devices is a request, not an
23445
+ * omission; same contract as `deviceManager.listFleet` and
23446
+ * `pipelineAnalytics.listRecentTracks`.
23447
+ *
23448
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
23449
+ */
23450
+ deviceIds: array(number().int()).optional(),
23330
23451
  limit: number().int().positive().optional(),
23331
23452
  filter: FaceFilterEnum.optional(),
23332
23453
  /**
23333
- * Inline the base64 crop on every row. Default `true` — the existing
23334
- * behaviour, kept so no caller breaks.
23454
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23455
+ * Absent means no lower bound.
23456
+ */
23457
+ since: number().int().optional(),
23458
+ /**
23459
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23460
+ * Absent means no upper bound.
23461
+ */
23462
+ until: number().int().optional(),
23463
+ /**
23464
+ * Order the page by time or by suggestion certainty. Default
23465
+ * `'timestamp'` — the historical order, unchanged for every caller
23466
+ * that does not ask.
23335
23467
  *
23336
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
23337
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
23338
- * the browser cache the images.
23468
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
23469
+ * does under `'suggestionConfidence'`.
23339
23470
  *
23340
- * **This is an INPUT field, so it does not reach the addon until the
23341
- * next train.** The hub router validates cap inputs against its own
23342
- * compiled Zod, which strips a key it does not know verified today
23343
- * on the OUTPUT side, where an additive field DOES arrive immediately
23344
- * (`Track.hasFace`). Until the train ships, sending `false` is
23345
- * harmless and simply keeps the crops inline.
23471
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
23472
+ * index and stops reading as soon as `limit` rows have PASSED the
23473
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
23474
+ * certain row may be the oldest so it walks the window. Narrow it
23475
+ * with {@link since} / {@link until}.
23476
+ */
23477
+ sortBy: FaceSortFieldEnum.optional(),
23478
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
23479
+ sortDirection: FaceSortDirectionEnum.optional(),
23480
+ /**
23481
+ * Inline the base64 crop on every row.
23482
+ *
23483
+ * Default `false` since the 2026-08-25 inversion — see
23484
+ * `include-crops-default.ts`, which is the ONE place that resolves
23485
+ * this for every gallery, and which records why the inline shape had
23486
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
23487
+ * The doc here used to still say `true`; it was wrong, and a leftover
23488
+ * that describes the old design reads as permission to rely on it.
23489
+ *
23490
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
23491
+ * which the browser fetches off the `event-media` plane in parallel,
23492
+ * cached and ETagged.
23346
23493
  */
23347
23494
  includeCrops: boolean().optional()
23348
23495
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -23378,13 +23525,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23378
23525
  }), method(object({
23379
23526
  threshold: number().min(0).max(1).optional(),
23380
23527
  minClusterSize: number().int().min(2).optional(),
23381
- limit: number().int().positive().optional()
23382
- }).optional(), array(object({
23383
- faceIds: array(string$2()).readonly(),
23384
- representativeFaceId: string$2(),
23385
- size: number().int(),
23386
- cohesion: number()
23387
- })).readonly());
23528
+ /**
23529
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
23530
+ * which read as though it bounded the work — it never did.
23531
+ *
23532
+ * Wins over {@link limit} when both are sent.
23533
+ */
23534
+ maxClusters: number().int().positive().optional(),
23535
+ /**
23536
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
23537
+ * RESULT, not the scan. Kept so existing callers keep working; send
23538
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
23539
+ */
23540
+ limit: number().int().positive().optional(),
23541
+ /**
23542
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
23543
+ * POOL, not the result.
23544
+ *
23545
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
23546
+ * used to read every unassigned face on the hub no matter what the
23547
+ * caller asked for, because the only bound cut the finished clusters
23548
+ * afterwards; a UI showing a window of 100 paid for a scan of the
23549
+ * whole corpus, on an addon whose disk is under contention.
23550
+ *
23551
+ * The pool is the NEWEST matching faces first — the same order the
23552
+ * gallery shows — so a bound here shortens the horizon, it does not
23553
+ * sample it randomly.
23554
+ *
23555
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
23556
+ * so the live corpus — 372 face rows — is unaffected while the
23557
+ * unbounded scan can never come back as the table grows.
23558
+ */
23559
+ maxFacesScanned: number().int().positive().optional()
23560
+ }).optional(), array(FaceClusterSchema).readonly());
23388
23561
  /**
23389
23562
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
23390
23563
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -28326,6 +28499,293 @@ var SetSiteLocationInputSchema = object({
28326
28499
  latitude: number().min(-90).max(90),
28327
28500
  longitude: number().min(-180).max(180)
28328
28501
  }).nullable();
28502
+ /**
28503
+ * The TRANSPORT a call arrived on.
28504
+ *
28505
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28506
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28507
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28508
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28509
+ * checkable rather than asserted.
28510
+ *
28511
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28512
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28513
+ * connection; the viewer talks to the hub over `wsLink`
28514
+ * exclusively, so this is the plane the HTTP census could not see.
28515
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28516
+ * never touches a socket and therefore never touched a census.
28517
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28518
+ * that is exactly what its `0` asserts: every plane the hub has can name
28519
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28520
+ * plane nobody instrumented lands here instead of vanishing from the total.
28521
+ */
28522
+ var TransportPlaneSchema = _enum([
28523
+ "http",
28524
+ "ws",
28525
+ "mesh",
28526
+ "unknown"
28527
+ ]);
28528
+ /**
28529
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28530
+ * reads as "not instrumented", which is the one thing this census must never
28531
+ * make an operator wonder about.
28532
+ */
28533
+ var TransportPlaneCountsSchema = object({
28534
+ http: number(),
28535
+ ws: number(),
28536
+ mesh: number(),
28537
+ unknown: number()
28538
+ });
28539
+ /**
28540
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28541
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28542
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28543
+ * already prints - never a token, never an `Authorization` header.
28544
+ *
28545
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28546
+ * and lives for hours, so folding it into a call count makes one long-lived
28547
+ * stream look like a storm.
28548
+ */
28549
+ var RequestCensusGroupSchema = object({
28550
+ plane: TransportPlaneSchema,
28551
+ procedure: string$2(),
28552
+ userAgent: string$2(),
28553
+ ip: string$2(),
28554
+ principal: string$2(),
28555
+ calls: number(),
28556
+ subscriptions: number(),
28557
+ perMin: number()
28558
+ });
28559
+ /**
28560
+ * A procedure's TOTAL over the window, across every caller.
28561
+ *
28562
+ * This block, not the group list, is what answers "did these calls arrive over
28563
+ * HTTP at all". A total far BELOW what a store-side census counted over the
28564
+ * same window excludes the HTTP plane, which is a result, not a failure.
28565
+ */
28566
+ var RequestCensusProcedureSchema = object({
28567
+ procedure: string$2(),
28568
+ calls: number(),
28569
+ /**
28570
+ * The same total, split by transport. THIS is the row that answers the
28571
+ * question the census exists for: one look at `deviceManager.listAll` says
28572
+ * which plane carried the 4 960, without joining two log lines by eye.
28573
+ */
28574
+ planes: TransportPlaneCountsSchema,
28575
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28576
+ subscriptions: number(),
28577
+ perMin: number()
28578
+ });
28579
+ /**
28580
+ * The census as an operator sees it.
28581
+ *
28582
+ * `persisted` is the honest answer to "will this survive the restart I am
28583
+ * about to do": the arm deadline is written to `system-settings` so a window
28584
+ * armed now can measure the NEXT boot, and a write that failed must not look
28585
+ * like one that succeeded.
28586
+ */
28587
+ var RequestCensusStatusSchema = object({
28588
+ armed: boolean(),
28589
+ /** How long the current - or just-closed - window collected, in ms. */
28590
+ elapsedMs: number(),
28591
+ /** The window actually armed, after the server clamped the request. */
28592
+ windowMs: number(),
28593
+ /** Epoch ms the window closes at. 0 when disarmed. */
28594
+ armedUntilMs: number(),
28595
+ httpRequests: number(),
28596
+ batchedRequests: number(),
28597
+ /**
28598
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
28599
+ * is in play (`?batch=1` carries several procedures in one request); this is
28600
+ * the number comparable with a store-side call count.
28601
+ */
28602
+ procedureCalls: number(),
28603
+ /**
28604
+ * `procedureCalls` split by transport. The four keys sum to
28605
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28606
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28607
+ */
28608
+ planes: TransportPlaneCountsSchema,
28609
+ /**
28610
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28611
+ * on no plane at all - which is a RESULT (a plane is missing from the
28612
+ * instrument), not a failure, and it has to be visible to be read as one.
28613
+ */
28614
+ planesExplainTotal: boolean(),
28615
+ /**
28616
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
28617
+ * adapter resolves one context per connection - kept because a plane's call
28618
+ * count of zero against 37 open connections says something different from a
28619
+ * plane with no connections at all.
28620
+ */
28621
+ wsConnections: number(),
28622
+ /**
28623
+ * Client frames the WS plane looked at. `wsMessages` far above
28624
+ * `planes.ws + subscriptions` means most traffic is not operations
28625
+ * (keepalives, connection params) - which is itself an answer.
28626
+ */
28627
+ wsMessages: number(),
28628
+ /**
28629
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28630
+ * purpose: one live-events stream opened at boot and held for six hours is
28631
+ * one subscription, and counting it as a call would let a quiet plane
28632
+ * masquerade as the storm.
28633
+ */
28634
+ subscriptions: number(),
28635
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28636
+ subscriptionStops: number(),
28637
+ distinctGroups: number(),
28638
+ /**
28639
+ * Operations counted in the totals whose CALLER attribution was shed at the
28640
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28641
+ * which transport they arrived on, they just lost their group row.
28642
+ */
28643
+ unattributedCalls: number(),
28644
+ procedures: array(RequestCensusProcedureSchema).readonly(),
28645
+ groups: array(RequestCensusGroupSchema).readonly()
28646
+ }).extend({ persisted: boolean() });
28647
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
28648
+ var LogLevelSchema$1 = _enum([
28649
+ "debug",
28650
+ "info",
28651
+ "warn",
28652
+ "error"
28653
+ ]);
28654
+ /**
28655
+ * The diagnostics that can be ARMED for a window. Exactly one today.
28656
+ *
28657
+ * A diagnostic is anything whose cost is only worth paying while a question is
28658
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
28659
+ */
28660
+ var DiagnosticIdSchema = _enum(["request-census"]);
28661
+ /**
28662
+ * The layers of the level hierarchy, general → specific. The most specific
28663
+ * layer that carries an explicit value wins.
28664
+ *
28665
+ * `component` is DECLARED and not yet resolvable: the per-component channels
28666
+ * are a later slice of the same plan, and a `levelSource` enum that has to
28667
+ * grow later would force every consumer of this document to change with it.
28668
+ * Nothing returns `component` today.
28669
+ */
28670
+ var LoggingScopeKindSchema = _enum([
28671
+ "cluster",
28672
+ "node",
28673
+ "component"
28674
+ ]);
28675
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
28676
+ var LoggingLevelSourceSchema = _enum([
28677
+ "default",
28678
+ "cluster",
28679
+ "node",
28680
+ "component"
28681
+ ]);
28682
+ /**
28683
+ * One layer of the hierarchy as it actually STANDS.
28684
+ *
28685
+ * `level: null` is the whole reason this array is returned: it is the
28686
+ * difference between "this node is at `info` because I decided it" and
28687
+ * "...because it inherits". An operator who clears an override believing they
28688
+ * are clearing an inherited value has been handed the same defect as the two
28689
+ * contradicting knobs this document exists to remove, moved one floor up.
28690
+ */
28691
+ var LoggingLevelLayerSchema = object({
28692
+ scope: LoggingScopeKindSchema,
28693
+ /** The node this layer speaks for; `null` on the cluster layer. */
28694
+ nodeId: string$2().nullable(),
28695
+ /** Explicitly set here, or `null` when this layer inherits. */
28696
+ level: LogLevelSchema$1.nullable()
28697
+ });
28698
+ /** What a line is judged against, and WHICH layer decided it. */
28699
+ var LoggingEffectiveSchema = object({
28700
+ level: LogLevelSchema$1,
28701
+ levelSource: LoggingLevelSourceSchema
28702
+ });
28703
+ /** Every layer, general → specific. Never collapsed into the effective value. */
28704
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
28705
+ /**
28706
+ * An armed diagnostic, with its DEADLINE.
28707
+ *
28708
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
28709
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
28710
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
28711
+ * `armed` is false — a window is never reported as slightly expired.
28712
+ */
28713
+ var DiagnosticWindowSchema = object({
28714
+ id: DiagnosticIdSchema,
28715
+ armed: boolean(),
28716
+ /** Epoch ms the window closes at. 0 when disarmed. */
28717
+ armedUntilMs: number(),
28718
+ /** Ms left before it expires on its own. 0 when disarmed. */
28719
+ remainingMs: number(),
28720
+ /** Whether the stored deadline is the one the live diagnostic is running —
28721
+ * i.e. whether this window would survive a restart. */
28722
+ persisted: boolean()
28723
+ });
28724
+ /**
28725
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
28726
+ * server — there is no maximum here on purpose: a bound repeated in a schema
28727
+ * is a second knob that disagrees with the first the day one of them moves.
28728
+ */
28729
+ var DiagnosticWindowPatchSchema = object({
28730
+ id: DiagnosticIdSchema,
28731
+ armMs: number().int().min(0),
28732
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
28733
+ reportEveryMs: number().int().positive().optional()
28734
+ });
28735
+ /**
28736
+ * A PATCH, and patches MERGE.
28737
+ *
28738
+ * A field absent from the patch is left exactly as it was — arming a
28739
+ * diagnostic never resets a level, and setting a level never disarms a window.
28740
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
28741
+ * `setAll` already merges, and rebuilding the object is how an absent field
28742
+ * turns into an erased one.
28743
+ */
28744
+ var LoggingSettingsPatchSchema = object({
28745
+ /**
28746
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
28747
+ * addressed scope so it inherits again. A value sets it.
28748
+ */
28749
+ level: LogLevelSchema$1.nullable().optional(),
28750
+ /**
28751
+ * Only the diagnostics NAMED here change. An armed window that is not listed
28752
+ * keeps running — a patch is never a full replacement.
28753
+ */
28754
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28755
+ });
28756
+ /**
28757
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
28758
+ *
28759
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
28760
+ * input — the generated router strips it and uses it to resolve the PROVIDER
28761
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
28762
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
28763
+ * by an agent that holds no cluster document at all. The hub is the single
28764
+ * authority over the whole hierarchy and answers for every layer, so the
28765
+ * layer selector needs a name the transport does not already own.
28766
+ */
28767
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string$2().optional() });
28768
+ var SetLoggingSettingsInputSchema = object({
28769
+ scopeNodeId: string$2().optional(),
28770
+ patch: LoggingSettingsPatchSchema
28771
+ });
28772
+ /**
28773
+ * The whole document, as read and as returned after every write.
28774
+ *
28775
+ * `persisted: false` means the settings store could not be read or written.
28776
+ * The in-memory mirror still governs behaviour and is unchanged by the
28777
+ * failure — a read that fails neither switches a level nor disarms a window
28778
+ * (D49) — but the operator is told that what they are looking at would not
28779
+ * survive a restart.
28780
+ */
28781
+ var LoggingSettingsStateSchema = object({
28782
+ /** The layer this document was read at. `null` = the cluster layer. */
28783
+ scopeNodeId: string$2().nullable(),
28784
+ effective: LoggingEffectiveSchema,
28785
+ explicit: LoggingExplicitSchema,
28786
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
28787
+ persisted: boolean()
28788
+ });
28329
28789
  method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record(string$2(), unknown()), _null(), {
28330
28790
  kind: "mutation",
28331
28791
  auth: "admin"
@@ -28338,6 +28798,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28338
28798
  }), method(_void(), SiteLocationStatusSchema, {
28339
28799
  kind: "mutation",
28340
28800
  auth: "admin"
28801
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
28802
+ kind: "mutation",
28803
+ auth: "admin"
28341
28804
  });
28342
28805
  /**
28343
28806
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -35577,6 +36040,18 @@ Object.freeze({
35577
36040
  addonId: null,
35578
36041
  access: "create"
35579
36042
  },
36043
+ "system.getLoggingSettings": {
36044
+ capName: "system",
36045
+ capScope: "system",
36046
+ addonId: null,
36047
+ access: "view"
36048
+ },
36049
+ "system.getRequestCensus": {
36050
+ capName: "system",
36051
+ capScope: "system",
36052
+ addonId: null,
36053
+ access: "view"
36054
+ },
35580
36055
  "system.getRetentionConfig": {
35581
36056
  capName: "system",
35582
36057
  capScope: "system",
@@ -35607,6 +36082,12 @@ Object.freeze({
35607
36082
  addonId: null,
35608
36083
  access: "view"
35609
36084
  },
36085
+ "system.setLoggingSettings": {
36086
+ capName: "system",
36087
+ capScope: "system",
36088
+ addonId: null,
36089
+ access: "create"
36090
+ },
35610
36091
  "system.setRetentionConfig": {
35611
36092
  capName: "system",
35612
36093
  capScope: "system",
@@ -36762,6 +37243,10 @@ Object.freeze({
36762
37243
  name: "deviceId",
36763
37244
  form: "single",
36764
37245
  optional: true
37246
+ }, {
37247
+ name: "deviceIds",
37248
+ form: "array",
37249
+ optional: true
36765
37250
  }],
36766
37251
  "fanControl.setDirection": [{
36767
37252
  name: "deviceId",
@@ -38372,7 +38857,38 @@ object({
38372
38857
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
38373
38858
  * reproduce that.
38374
38859
  */
38375
- tileBudgetMb: number().int().min(0).max(1024)
38860
+ tileBudgetMb: number().int().min(0).max(1024),
38861
+ /**
38862
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
38863
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
38864
+ * subject tiles, on frames that detected something.
38865
+ *
38866
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
38867
+ * containment is strict by design, so the native `keyFrame`, the detail
38868
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
38869
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
38870
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
38871
+ * frame-time after delivery, with the request only p50 367 ms behind it.
38872
+ *
38873
+ * Sizing, and why this is a budget and not a duration: a scene tile is
38874
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
38875
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
38876
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
38877
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
38878
+ * binds only through a detection burst, where it still covers well past the
38879
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
38880
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
38881
+ * whole shape exists to avoid.
38882
+ *
38883
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
38884
+ * subject tile, so one shared budget would let a busy camera's key frames
38885
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
38886
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
38887
+ * pre-existing behaviour, where a late full-frame request had nothing but the
38888
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
38889
+ * nothing.
38890
+ */
38891
+ sceneBudgetMb: number().int().min(0).max(1024)
38376
38892
  });
38377
38893
  /**
38378
38894
  * The values in force when the operator has set nothing.
@@ -38388,12 +38904,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
38388
38904
  budgetMb: 1024,
38389
38905
  activityMs: 15e3,
38390
38906
  tileBudgetMb: 64,
38907
+ sceneBudgetMb: 48,
38391
38908
  admission: "inferred"
38392
38909
  };
38393
38910
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
38394
38911
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
38395
38912
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
38396
38913
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
38914
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
38397
38915
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
38398
38916
  var MB = 1024 * 1024;
38399
38917
  1024 * MB, 3072 * MB;