@camstack/addon-provider-petkit 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
@@ -8628,6 +8628,66 @@ var OpsLogQueryInputSchema = object({
8628
8628
  /** Max rows returned, newest-first. */
8629
8629
  limit: number().int().min(1).max(1e3).optional()
8630
8630
  });
8631
+ var LabelDefinitionSchema = object({
8632
+ id: string(),
8633
+ name: string(),
8634
+ category: string().optional(),
8635
+ description: string().optional(),
8636
+ icon: string().optional()
8637
+ });
8638
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
8639
+ var CLASS_MAP_MACRO_TARGETS = [
8640
+ "person",
8641
+ "vehicle",
8642
+ "animal",
8643
+ "package"
8644
+ ];
8645
+ /**
8646
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
8647
+ * un operatore può selezionare.
8648
+ *
8649
+ * Sono le tre offerte dallo step `object-detection`
8650
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
8651
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
8652
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
8653
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
8654
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
8655
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
8656
+ *
8657
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
8658
+ * dello step e una seconda volta come union `FirstLevelMacro`
8659
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
8660
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
8661
+ * successiva.
8662
+ */
8663
+ var FIRST_LEVEL_MACRO_CLASSES = [
8664
+ "person",
8665
+ "vehicle",
8666
+ "animal"
8667
+ ];
8668
+ /**
8669
+ * Wire schema for a per-model CATALOG classMap override
8670
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8671
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8672
+ * detection pipeline executor actually routes.
8673
+ *
8674
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8675
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8676
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8677
+ * enum) — the two used to share the name `ClassMapDefinition`/
8678
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8679
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8680
+ * are not: it is two different concepts colliding on a name. Keep this type
8681
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8682
+ * would either narrow every `ClassMapDefinition` consumer to the four
8683
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8684
+ * schema exists for (see the "rejects a classMap whose target is not a
8685
+ * detection macro" test in `model-catalog-schema.test.ts`).
8686
+ */
8687
+ var DetectionCatalogClassMapSchema = object({
8688
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
8689
+ preserveOriginal: boolean()
8690
+ });
8631
8691
  /**
8632
8692
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
8633
8693
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -8650,10 +8710,55 @@ var RecordingStorageModeSchema = _enum([
8650
8710
  "events",
8651
8711
  "continuous"
8652
8712
  ]);
8713
+ /**
8714
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
8715
+ * tre offerte dallo step `object-detection`, da UNA lista
8716
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
8717
+ */
8718
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
8719
+ /**
8720
+ * True quando `values` non ripete un elemento.
8721
+ *
8722
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
8723
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
8724
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
8725
+ */
8726
+ var noDuplicates = (values) => new Set(values).size === values.length;
8653
8727
  /** Which detectors trigger an `events`-mode band. */
8654
8728
  var RecordingTriggersSchema = object({
8655
8729
  motion: boolean().optional(),
8656
- audioThresholdDbfs: number().optional()
8730
+ audioThresholdDbfs: number().optional(),
8731
+ /**
8732
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
8733
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
8734
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
8735
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
8736
+ *
8737
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
8738
+ * quelle che hanno attraversato `enabledMacroClasses`, i
8739
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
8740
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
8741
+ * finestre — vedi `recorder/object-trigger.ts`.
8742
+ */
8743
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
8744
+ /**
8745
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
8746
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
8747
+ * `objectClasses`.
8748
+ *
8749
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
8750
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
8751
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
8752
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
8753
+ * device (D12) — mai un elenco globale di cap.
8754
+ *
8755
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
8756
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
8757
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
8758
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
8759
+ * registrare.
8760
+ */
8761
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
8657
8762
  });
8658
8763
  /**
8659
8764
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -9105,41 +9210,6 @@ var DecoderSessionConfigSchema = object({
9105
9210
  */
9106
9211
  debug: boolean().optional()
9107
9212
  });
9108
- var LabelDefinitionSchema = object({
9109
- id: string(),
9110
- name: string(),
9111
- category: string().optional(),
9112
- description: string().optional(),
9113
- icon: string().optional()
9114
- });
9115
- /**
9116
- * Wire schema for a per-model CATALOG classMap override
9117
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
9118
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
9119
- * detection pipeline executor actually routes.
9120
- *
9121
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
9122
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
9123
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
9124
- * enum) — the two used to share the name `ClassMapDefinition`/
9125
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
9126
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
9127
- * are not: it is two different concepts colliding on a name. Keep this type
9128
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
9129
- * would either narrow every `ClassMapDefinition` consumer to the four
9130
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
9131
- * schema exists for (see the "rejects a classMap whose target is not a
9132
- * detection macro" test in `model-catalog-schema.test.ts`).
9133
- */
9134
- var DetectionCatalogClassMapSchema = object({
9135
- mapping: record(string(), _enum([
9136
- "person",
9137
- "vehicle",
9138
- "animal",
9139
- "package"
9140
- ])),
9141
- preserveOriginal: boolean()
9142
- });
9143
9213
  var MODEL_FORMATS = [
9144
9214
  "onnx",
9145
9215
  "coreml",
@@ -22272,7 +22342,7 @@ var lifecycleJobSchema = object({
22272
22342
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
22273
22343
  * as every other cap.
22274
22344
  */
22275
- var LogLevelSchema$1 = _enum([
22345
+ var LogLevelSchema$2 = _enum([
22276
22346
  "debug",
22277
22347
  "info",
22278
22348
  "warn",
@@ -22479,7 +22549,7 @@ var CustomActionInputSchema = object({
22479
22549
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
22480
22550
  addonId: string(),
22481
22551
  limit: number().min(1).max(500).default(100),
22482
- level: LogLevelSchema$1.optional()
22552
+ level: LogLevelSchema$2.optional()
22483
22553
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
22484
22554
  packageName: string(),
22485
22555
  version: string().optional()
@@ -22577,7 +22647,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
22577
22647
  auth: "admin"
22578
22648
  }), method(object({
22579
22649
  addonId: string(),
22580
- level: LogLevelSchema$1.optional()
22650
+ level: LogLevelSchema$2.optional()
22581
22651
  }), LogStreamEntrySchema, { kind: "subscription" });
22582
22652
  /**
22583
22653
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -24309,6 +24379,35 @@ var FaceFilterEnum = _enum([
24309
24379
  "identified",
24310
24380
  "all"
24311
24381
  ]);
24382
+ /**
24383
+ * What a `listRecentFaces` page is ORDERED BY.
24384
+ *
24385
+ * - `timestamp` — when the face was seen. The historical (and default) order.
24386
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
24387
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
24388
+ * order: it puts the suggestions an operator can confirm with one tap at the
24389
+ * top, and it is the reason this enum exists — a client that ranked a capped
24390
+ * page client-side was ranking the newest N, never the most certain N.
24391
+ *
24392
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
24393
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
24394
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
24395
+ * — flipping the direction reorders the rows that HAVE a certainty and never
24396
+ * floods the page with the ones that do not. `addon-post-analysis`'s
24397
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
24398
+ * then by faceId, and is what makes this a total order instead of the
24399
+ * backend's NULL-collation accident.
24400
+ */
24401
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
24402
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
24403
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
24404
+ * never leaves the server. */
24405
+ var FaceClusterSchema = object({
24406
+ faceIds: array(string()).readonly(),
24407
+ representativeFaceId: string(),
24408
+ size: number().int(),
24409
+ cohesion: number()
24410
+ });
24312
24411
  var MediaFileLiteSchema$1 = object({
24313
24412
  key: string(),
24314
24413
  kind: string(),
@@ -24355,24 +24454,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24355
24454
  kind: "mutation",
24356
24455
  auth: "admin"
24357
24456
  }), method(object({
24358
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
24457
+ /**
24458
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
24459
+ *
24460
+ * The legacy single-camera form, kept verbatim for every caller that
24461
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
24462
+ * instead — never both: `deviceIds` is the authority whenever it is
24463
+ * present, and this field is then ignored rather than unioned, so
24464
+ * there is exactly one answer to "which cameras did I ask for".
24465
+ */
24359
24466
  deviceId: number().int().optional(),
24467
+ /**
24468
+ * Restrict to a SET of cameras — the review UI's camera filter, which
24469
+ * until now had to fetch the cluster-wide page and drop rows in the
24470
+ * client (so the `limit` it asked for was spent on cameras it was
24471
+ * about to discard).
24472
+ *
24473
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
24474
+ * "every camera". A request for no devices is a request, not an
24475
+ * omission; same contract as `deviceManager.listFleet` and
24476
+ * `pipelineAnalytics.listRecentTracks`.
24477
+ *
24478
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
24479
+ */
24480
+ deviceIds: array(number().int()).optional(),
24360
24481
  limit: number().int().positive().optional(),
24361
24482
  filter: FaceFilterEnum.optional(),
24362
24483
  /**
24363
- * Inline the base64 crop on every row. Default `true` — the existing
24364
- * behaviour, kept so no caller breaks.
24484
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24485
+ * Absent means no lower bound.
24486
+ */
24487
+ since: number().int().optional(),
24488
+ /**
24489
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24490
+ * Absent means no upper bound.
24491
+ */
24492
+ until: number().int().optional(),
24493
+ /**
24494
+ * Order the page by time or by suggestion certainty. Default
24495
+ * `'timestamp'` — the historical order, unchanged for every caller
24496
+ * that does not ask.
24365
24497
  *
24366
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
24367
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
24368
- * the browser cache the images.
24498
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
24499
+ * does under `'suggestionConfidence'`.
24369
24500
  *
24370
- * **This is an INPUT field, so it does not reach the addon until the
24371
- * next train.** The hub router validates cap inputs against its own
24372
- * compiled Zod, which strips a key it does not know verified today
24373
- * on the OUTPUT side, where an additive field DOES arrive immediately
24374
- * (`Track.hasFace`). Until the train ships, sending `false` is
24375
- * harmless and simply keeps the crops inline.
24501
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
24502
+ * index and stops reading as soon as `limit` rows have PASSED the
24503
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
24504
+ * certain row may be the oldest so it walks the window. Narrow it
24505
+ * with {@link since} / {@link until}.
24506
+ */
24507
+ sortBy: FaceSortFieldEnum.optional(),
24508
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
24509
+ sortDirection: FaceSortDirectionEnum.optional(),
24510
+ /**
24511
+ * Inline the base64 crop on every row.
24512
+ *
24513
+ * Default `false` since the 2026-08-25 inversion — see
24514
+ * `include-crops-default.ts`, which is the ONE place that resolves
24515
+ * this for every gallery, and which records why the inline shape had
24516
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
24517
+ * The doc here used to still say `true`; it was wrong, and a leftover
24518
+ * that describes the old design reads as permission to rely on it.
24519
+ *
24520
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
24521
+ * which the browser fetches off the `event-media` plane in parallel,
24522
+ * cached and ETagged.
24376
24523
  */
24377
24524
  includeCrops: boolean().optional()
24378
24525
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -24408,13 +24555,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24408
24555
  }), method(object({
24409
24556
  threshold: number().min(0).max(1).optional(),
24410
24557
  minClusterSize: number().int().min(2).optional(),
24411
- limit: number().int().positive().optional()
24412
- }).optional(), array(object({
24413
- faceIds: array(string()).readonly(),
24414
- representativeFaceId: string(),
24415
- size: number().int(),
24416
- cohesion: number()
24417
- })).readonly());
24558
+ /**
24559
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
24560
+ * which read as though it bounded the work — it never did.
24561
+ *
24562
+ * Wins over {@link limit} when both are sent.
24563
+ */
24564
+ maxClusters: number().int().positive().optional(),
24565
+ /**
24566
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
24567
+ * RESULT, not the scan. Kept so existing callers keep working; send
24568
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
24569
+ */
24570
+ limit: number().int().positive().optional(),
24571
+ /**
24572
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
24573
+ * POOL, not the result.
24574
+ *
24575
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
24576
+ * used to read every unassigned face on the hub no matter what the
24577
+ * caller asked for, because the only bound cut the finished clusters
24578
+ * afterwards; a UI showing a window of 100 paid for a scan of the
24579
+ * whole corpus, on an addon whose disk is under contention.
24580
+ *
24581
+ * The pool is the NEWEST matching faces first — the same order the
24582
+ * gallery shows — so a bound here shortens the horizon, it does not
24583
+ * sample it randomly.
24584
+ *
24585
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
24586
+ * so the live corpus — 372 face rows — is unaffected while the
24587
+ * unbounded scan can never come back as the table grows.
24588
+ */
24589
+ maxFacesScanned: number().int().positive().optional()
24590
+ }).optional(), array(FaceClusterSchema).readonly());
24418
24591
  /**
24419
24592
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
24420
24593
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -29356,6 +29529,293 @@ var SetSiteLocationInputSchema = object({
29356
29529
  latitude: number().min(-90).max(90),
29357
29530
  longitude: number().min(-180).max(180)
29358
29531
  }).nullable();
29532
+ /**
29533
+ * The TRANSPORT a call arrived on.
29534
+ *
29535
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
29536
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
29537
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
29538
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
29539
+ * checkable rather than asserted.
29540
+ *
29541
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
29542
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
29543
+ * connection; the viewer talks to the hub over `wsLink`
29544
+ * exclusively, so this is the plane the HTTP census could not see.
29545
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
29546
+ * never touches a socket and therefore never touched a census.
29547
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
29548
+ * that is exactly what its `0` asserts: every plane the hub has can name
29549
+ * itself. It is an output bucket, never a knob — a call that arrives on a
29550
+ * plane nobody instrumented lands here instead of vanishing from the total.
29551
+ */
29552
+ var TransportPlaneSchema = _enum([
29553
+ "http",
29554
+ "ws",
29555
+ "mesh",
29556
+ "unknown"
29557
+ ]);
29558
+ /**
29559
+ * Calls per plane. Every key is always present, `0` included — an absent plane
29560
+ * reads as "not instrumented", which is the one thing this census must never
29561
+ * make an operator wonder about.
29562
+ */
29563
+ var TransportPlaneCountsSchema = object({
29564
+ http: number(),
29565
+ ws: number(),
29566
+ mesh: number(),
29567
+ unknown: number()
29568
+ });
29569
+ /**
29570
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
29571
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29572
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29573
+ * already prints - never a token, never an `Authorization` header.
29574
+ *
29575
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
29576
+ * and lives for hours, so folding it into a call count makes one long-lived
29577
+ * stream look like a storm.
29578
+ */
29579
+ var RequestCensusGroupSchema = object({
29580
+ plane: TransportPlaneSchema,
29581
+ procedure: string(),
29582
+ userAgent: string(),
29583
+ ip: string(),
29584
+ principal: string(),
29585
+ calls: number(),
29586
+ subscriptions: number(),
29587
+ perMin: number()
29588
+ });
29589
+ /**
29590
+ * A procedure's TOTAL over the window, across every caller.
29591
+ *
29592
+ * This block, not the group list, is what answers "did these calls arrive over
29593
+ * HTTP at all". A total far BELOW what a store-side census counted over the
29594
+ * same window excludes the HTTP plane, which is a result, not a failure.
29595
+ */
29596
+ var RequestCensusProcedureSchema = object({
29597
+ procedure: string(),
29598
+ calls: number(),
29599
+ /**
29600
+ * The same total, split by transport. THIS is the row that answers the
29601
+ * question the census exists for: one look at `deviceManager.listAll` says
29602
+ * which plane carried the 4 960, without joining two log lines by eye.
29603
+ */
29604
+ planes: TransportPlaneCountsSchema,
29605
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
29606
+ subscriptions: number(),
29607
+ perMin: number()
29608
+ });
29609
+ /**
29610
+ * The census as an operator sees it.
29611
+ *
29612
+ * `persisted` is the honest answer to "will this survive the restart I am
29613
+ * about to do": the arm deadline is written to `system-settings` so a window
29614
+ * armed now can measure the NEXT boot, and a write that failed must not look
29615
+ * like one that succeeded.
29616
+ */
29617
+ var RequestCensusStatusSchema = object({
29618
+ armed: boolean(),
29619
+ /** How long the current - or just-closed - window collected, in ms. */
29620
+ elapsedMs: number(),
29621
+ /** The window actually armed, after the server clamped the request. */
29622
+ windowMs: number(),
29623
+ /** Epoch ms the window closes at. 0 when disarmed. */
29624
+ armedUntilMs: number(),
29625
+ httpRequests: number(),
29626
+ batchedRequests: number(),
29627
+ /**
29628
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
29629
+ * is in play (`?batch=1` carries several procedures in one request); this is
29630
+ * the number comparable with a store-side call count.
29631
+ */
29632
+ procedureCalls: number(),
29633
+ /**
29634
+ * `procedureCalls` split by transport. The four keys sum to
29635
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
29636
+ * `planesExplainTotal` is that identity, checked rather than assumed.
29637
+ */
29638
+ planes: TransportPlaneCountsSchema,
29639
+ /**
29640
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
29641
+ * on no plane at all - which is a RESULT (a plane is missing from the
29642
+ * instrument), not a failure, and it has to be visible to be read as one.
29643
+ */
29644
+ planesExplainTotal: boolean(),
29645
+ /**
29646
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
29647
+ * adapter resolves one context per connection - kept because a plane's call
29648
+ * count of zero against 37 open connections says something different from a
29649
+ * plane with no connections at all.
29650
+ */
29651
+ wsConnections: number(),
29652
+ /**
29653
+ * Client frames the WS plane looked at. `wsMessages` far above
29654
+ * `planes.ws + subscriptions` means most traffic is not operations
29655
+ * (keepalives, connection params) - which is itself an answer.
29656
+ */
29657
+ wsMessages: number(),
29658
+ /**
29659
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
29660
+ * purpose: one live-events stream opened at boot and held for six hours is
29661
+ * one subscription, and counting it as a call would let a quiet plane
29662
+ * masquerade as the storm.
29663
+ */
29664
+ subscriptions: number(),
29665
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
29666
+ subscriptionStops: number(),
29667
+ distinctGroups: number(),
29668
+ /**
29669
+ * Operations counted in the totals whose CALLER attribution was shed at the
29670
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
29671
+ * which transport they arrived on, they just lost their group row.
29672
+ */
29673
+ unattributedCalls: number(),
29674
+ procedures: array(RequestCensusProcedureSchema).readonly(),
29675
+ groups: array(RequestCensusGroupSchema).readonly()
29676
+ }).extend({ persisted: boolean() });
29677
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
29678
+ var LogLevelSchema$1 = _enum([
29679
+ "debug",
29680
+ "info",
29681
+ "warn",
29682
+ "error"
29683
+ ]);
29684
+ /**
29685
+ * The diagnostics that can be ARMED for a window. Exactly one today.
29686
+ *
29687
+ * A diagnostic is anything whose cost is only worth paying while a question is
29688
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
29689
+ */
29690
+ var DiagnosticIdSchema = _enum(["request-census"]);
29691
+ /**
29692
+ * The layers of the level hierarchy, general → specific. The most specific
29693
+ * layer that carries an explicit value wins.
29694
+ *
29695
+ * `component` is DECLARED and not yet resolvable: the per-component channels
29696
+ * are a later slice of the same plan, and a `levelSource` enum that has to
29697
+ * grow later would force every consumer of this document to change with it.
29698
+ * Nothing returns `component` today.
29699
+ */
29700
+ var LoggingScopeKindSchema = _enum([
29701
+ "cluster",
29702
+ "node",
29703
+ "component"
29704
+ ]);
29705
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
29706
+ var LoggingLevelSourceSchema = _enum([
29707
+ "default",
29708
+ "cluster",
29709
+ "node",
29710
+ "component"
29711
+ ]);
29712
+ /**
29713
+ * One layer of the hierarchy as it actually STANDS.
29714
+ *
29715
+ * `level: null` is the whole reason this array is returned: it is the
29716
+ * difference between "this node is at `info` because I decided it" and
29717
+ * "...because it inherits". An operator who clears an override believing they
29718
+ * are clearing an inherited value has been handed the same defect as the two
29719
+ * contradicting knobs this document exists to remove, moved one floor up.
29720
+ */
29721
+ var LoggingLevelLayerSchema = object({
29722
+ scope: LoggingScopeKindSchema,
29723
+ /** The node this layer speaks for; `null` on the cluster layer. */
29724
+ nodeId: string().nullable(),
29725
+ /** Explicitly set here, or `null` when this layer inherits. */
29726
+ level: LogLevelSchema$1.nullable()
29727
+ });
29728
+ /** What a line is judged against, and WHICH layer decided it. */
29729
+ var LoggingEffectiveSchema = object({
29730
+ level: LogLevelSchema$1,
29731
+ levelSource: LoggingLevelSourceSchema
29732
+ });
29733
+ /** Every layer, general → specific. Never collapsed into the effective value. */
29734
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
29735
+ /**
29736
+ * An armed diagnostic, with its DEADLINE.
29737
+ *
29738
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
29739
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
29740
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
29741
+ * `armed` is false — a window is never reported as slightly expired.
29742
+ */
29743
+ var DiagnosticWindowSchema = object({
29744
+ id: DiagnosticIdSchema,
29745
+ armed: boolean(),
29746
+ /** Epoch ms the window closes at. 0 when disarmed. */
29747
+ armedUntilMs: number(),
29748
+ /** Ms left before it expires on its own. 0 when disarmed. */
29749
+ remainingMs: number(),
29750
+ /** Whether the stored deadline is the one the live diagnostic is running —
29751
+ * i.e. whether this window would survive a restart. */
29752
+ persisted: boolean()
29753
+ });
29754
+ /**
29755
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
29756
+ * server — there is no maximum here on purpose: a bound repeated in a schema
29757
+ * is a second knob that disagrees with the first the day one of them moves.
29758
+ */
29759
+ var DiagnosticWindowPatchSchema = object({
29760
+ id: DiagnosticIdSchema,
29761
+ armMs: number().int().min(0),
29762
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
29763
+ reportEveryMs: number().int().positive().optional()
29764
+ });
29765
+ /**
29766
+ * A PATCH, and patches MERGE.
29767
+ *
29768
+ * A field absent from the patch is left exactly as it was — arming a
29769
+ * diagnostic never resets a level, and setting a level never disarms a window.
29770
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
29771
+ * `setAll` already merges, and rebuilding the object is how an absent field
29772
+ * turns into an erased one.
29773
+ */
29774
+ var LoggingSettingsPatchSchema = object({
29775
+ /**
29776
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
29777
+ * addressed scope so it inherits again. A value sets it.
29778
+ */
29779
+ level: LogLevelSchema$1.nullable().optional(),
29780
+ /**
29781
+ * Only the diagnostics NAMED here change. An armed window that is not listed
29782
+ * keeps running — a patch is never a full replacement.
29783
+ */
29784
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29785
+ });
29786
+ /**
29787
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
29788
+ *
29789
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
29790
+ * input — the generated router strips it and uses it to resolve the PROVIDER
29791
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
29792
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
29793
+ * by an agent that holds no cluster document at all. The hub is the single
29794
+ * authority over the whole hierarchy and answers for every layer, so the
29795
+ * layer selector needs a name the transport does not already own.
29796
+ */
29797
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29798
+ var SetLoggingSettingsInputSchema = object({
29799
+ scopeNodeId: string().optional(),
29800
+ patch: LoggingSettingsPatchSchema
29801
+ });
29802
+ /**
29803
+ * The whole document, as read and as returned after every write.
29804
+ *
29805
+ * `persisted: false` means the settings store could not be read or written.
29806
+ * The in-memory mirror still governs behaviour and is unchanged by the
29807
+ * failure — a read that fails neither switches a level nor disarms a window
29808
+ * (D49) — but the operator is told that what they are looking at would not
29809
+ * survive a restart.
29810
+ */
29811
+ var LoggingSettingsStateSchema = object({
29812
+ /** The layer this document was read at. `null` = the cluster layer. */
29813
+ scopeNodeId: string().nullable(),
29814
+ effective: LoggingEffectiveSchema,
29815
+ explicit: LoggingExplicitSchema,
29816
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
29817
+ persisted: boolean()
29818
+ });
29359
29819
  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(), {
29360
29820
  kind: "mutation",
29361
29821
  auth: "admin"
@@ -29368,6 +29828,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29368
29828
  }), method(_void(), SiteLocationStatusSchema, {
29369
29829
  kind: "mutation",
29370
29830
  auth: "admin"
29831
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29832
+ kind: "mutation",
29833
+ auth: "admin"
29371
29834
  });
29372
29835
  /**
29373
29836
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -36607,6 +37070,18 @@ Object.freeze({
36607
37070
  addonId: null,
36608
37071
  access: "create"
36609
37072
  },
37073
+ "system.getLoggingSettings": {
37074
+ capName: "system",
37075
+ capScope: "system",
37076
+ addonId: null,
37077
+ access: "view"
37078
+ },
37079
+ "system.getRequestCensus": {
37080
+ capName: "system",
37081
+ capScope: "system",
37082
+ addonId: null,
37083
+ access: "view"
37084
+ },
36610
37085
  "system.getRetentionConfig": {
36611
37086
  capName: "system",
36612
37087
  capScope: "system",
@@ -36637,6 +37112,12 @@ Object.freeze({
36637
37112
  addonId: null,
36638
37113
  access: "view"
36639
37114
  },
37115
+ "system.setLoggingSettings": {
37116
+ capName: "system",
37117
+ capScope: "system",
37118
+ addonId: null,
37119
+ access: "create"
37120
+ },
36640
37121
  "system.setRetentionConfig": {
36641
37122
  capName: "system",
36642
37123
  capScope: "system",
@@ -37792,6 +38273,10 @@ Object.freeze({
37792
38273
  name: "deviceId",
37793
38274
  form: "single",
37794
38275
  optional: true
38276
+ }, {
38277
+ name: "deviceIds",
38278
+ form: "array",
38279
+ optional: true
37795
38280
  }],
37796
38281
  "fanControl.setDirection": [{
37797
38282
  name: "deviceId",
@@ -39402,7 +39887,38 @@ object({
39402
39887
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
39403
39888
  * reproduce that.
39404
39889
  */
39405
- tileBudgetMb: number().int().min(0).max(1024)
39890
+ tileBudgetMb: number().int().min(0).max(1024),
39891
+ /**
39892
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
39893
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
39894
+ * subject tiles, on frames that detected something.
39895
+ *
39896
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
39897
+ * containment is strict by design, so the native `keyFrame`, the detail
39898
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
39899
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
39900
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
39901
+ * frame-time after delivery, with the request only p50 367 ms behind it.
39902
+ *
39903
+ * Sizing, and why this is a budget and not a duration: a scene tile is
39904
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
39905
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
39906
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
39907
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
39908
+ * binds only through a detection burst, where it still covers well past the
39909
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
39910
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
39911
+ * whole shape exists to avoid.
39912
+ *
39913
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
39914
+ * subject tile, so one shared budget would let a busy camera's key frames
39915
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
39916
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
39917
+ * pre-existing behaviour, where a late full-frame request had nothing but the
39918
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
39919
+ * nothing.
39920
+ */
39921
+ sceneBudgetMb: number().int().min(0).max(1024)
39406
39922
  });
39407
39923
  /**
39408
39924
  * The values in force when the operator has set nothing.
@@ -39418,12 +39934,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
39418
39934
  budgetMb: 1024,
39419
39935
  activityMs: 15e3,
39420
39936
  tileBudgetMb: 64,
39937
+ sceneBudgetMb: 48,
39421
39938
  admission: "inferred"
39422
39939
  };
39423
39940
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
39424
39941
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
39425
39942
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
39426
39943
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
39944
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
39427
39945
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
39428
39946
  var MB = 1024 * 1024;
39429
39947
  1024 * MB, 3072 * MB;