@camstack/addon-provider-amcrest 0.2.32 → 0.2.34

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
@@ -7520,6 +7520,66 @@ var OpsLogQueryInputSchema = object({
7520
7520
  /** Max rows returned, newest-first. */
7521
7521
  limit: number().int().min(1).max(1e3).optional()
7522
7522
  });
7523
+ var LabelDefinitionSchema = object({
7524
+ id: string(),
7525
+ name: string(),
7526
+ category: string().optional(),
7527
+ description: string().optional(),
7528
+ icon: string().optional()
7529
+ });
7530
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
7531
+ var CLASS_MAP_MACRO_TARGETS = [
7532
+ "person",
7533
+ "vehicle",
7534
+ "animal",
7535
+ "package"
7536
+ ];
7537
+ /**
7538
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
7539
+ * un operatore può selezionare.
7540
+ *
7541
+ * Sono le tre offerte dallo step `object-detection`
7542
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
7543
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
7544
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
7545
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
7546
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
7547
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
7548
+ *
7549
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
7550
+ * dello step e una seconda volta come union `FirstLevelMacro`
7551
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
7552
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
7553
+ * successiva.
7554
+ */
7555
+ var FIRST_LEVEL_MACRO_CLASSES = [
7556
+ "person",
7557
+ "vehicle",
7558
+ "animal"
7559
+ ];
7560
+ /**
7561
+ * Wire schema for a per-model CATALOG classMap override
7562
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
7563
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
7564
+ * detection pipeline executor actually routes.
7565
+ *
7566
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
7567
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
7568
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
7569
+ * enum) — the two used to share the name `ClassMapDefinition`/
7570
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
7571
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
7572
+ * are not: it is two different concepts colliding on a name. Keep this type
7573
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
7574
+ * would either narrow every `ClassMapDefinition` consumer to the four
7575
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
7576
+ * schema exists for (see the "rejects a classMap whose target is not a
7577
+ * detection macro" test in `model-catalog-schema.test.ts`).
7578
+ */
7579
+ var DetectionCatalogClassMapSchema = object({
7580
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
7581
+ preserveOriginal: boolean()
7582
+ });
7523
7583
  /**
7524
7584
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
7525
7585
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -7542,10 +7602,55 @@ var RecordingStorageModeSchema = _enum([
7542
7602
  "events",
7543
7603
  "continuous"
7544
7604
  ]);
7605
+ /**
7606
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
7607
+ * tre offerte dallo step `object-detection`, da UNA lista
7608
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
7609
+ */
7610
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
7611
+ /**
7612
+ * True quando `values` non ripete un elemento.
7613
+ *
7614
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
7615
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
7616
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
7617
+ */
7618
+ var noDuplicates = (values) => new Set(values).size === values.length;
7545
7619
  /** Which detectors trigger an `events`-mode band. */
7546
7620
  var RecordingTriggersSchema = object({
7547
7621
  motion: boolean().optional(),
7548
- audioThresholdDbfs: number().optional()
7622
+ audioThresholdDbfs: number().optional(),
7623
+ /**
7624
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
7625
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
7626
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
7627
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
7628
+ *
7629
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
7630
+ * quelle che hanno attraversato `enabledMacroClasses`, i
7631
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
7632
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
7633
+ * finestre — vedi `recorder/object-trigger.ts`.
7634
+ */
7635
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
7636
+ /**
7637
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
7638
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
7639
+ * `objectClasses`.
7640
+ *
7641
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
7642
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
7643
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
7644
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
7645
+ * device (D12) — mai un elenco globale di cap.
7646
+ *
7647
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
7648
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
7649
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
7650
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
7651
+ * registrare.
7652
+ */
7653
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7549
7654
  });
7550
7655
  /**
7551
7656
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -7997,41 +8102,6 @@ var DecoderSessionConfigSchema = object({
7997
8102
  */
7998
8103
  debug: boolean().optional()
7999
8104
  });
8000
- var LabelDefinitionSchema = object({
8001
- id: string(),
8002
- name: string(),
8003
- category: string().optional(),
8004
- description: string().optional(),
8005
- icon: string().optional()
8006
- });
8007
- /**
8008
- * Wire schema for a per-model CATALOG classMap override
8009
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8010
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8011
- * detection pipeline executor actually routes.
8012
- *
8013
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8014
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8015
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8016
- * enum) — the two used to share the name `ClassMapDefinition`/
8017
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8018
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8019
- * are not: it is two different concepts colliding on a name. Keep this type
8020
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8021
- * would either narrow every `ClassMapDefinition` consumer to the four
8022
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8023
- * schema exists for (see the "rejects a classMap whose target is not a
8024
- * detection macro" test in `model-catalog-schema.test.ts`).
8025
- */
8026
- var DetectionCatalogClassMapSchema = object({
8027
- mapping: record(string(), _enum([
8028
- "person",
8029
- "vehicle",
8030
- "animal",
8031
- "package"
8032
- ])),
8033
- preserveOriginal: boolean()
8034
- });
8035
8105
  var MODEL_FORMATS = [
8036
8106
  "onnx",
8037
8107
  "coreml",
@@ -21251,7 +21321,7 @@ var lifecycleJobSchema = object({
21251
21321
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21252
21322
  * as every other cap.
21253
21323
  */
21254
- var LogLevelSchema$1 = _enum([
21324
+ var LogLevelSchema$2 = _enum([
21255
21325
  "debug",
21256
21326
  "info",
21257
21327
  "warn",
@@ -21458,7 +21528,7 @@ var CustomActionInputSchema = object({
21458
21528
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21459
21529
  addonId: string(),
21460
21530
  limit: number().min(1).max(500).default(100),
21461
- level: LogLevelSchema$1.optional()
21531
+ level: LogLevelSchema$2.optional()
21462
21532
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21463
21533
  packageName: string(),
21464
21534
  version: string().optional()
@@ -21556,7 +21626,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21556
21626
  auth: "admin"
21557
21627
  }), method(object({
21558
21628
  addonId: string(),
21559
- level: LogLevelSchema$1.optional()
21629
+ level: LogLevelSchema$2.optional()
21560
21630
  }), LogStreamEntrySchema, { kind: "subscription" });
21561
21631
  /**
21562
21632
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -23280,6 +23350,35 @@ var FaceFilterEnum = _enum([
23280
23350
  "identified",
23281
23351
  "all"
23282
23352
  ]);
23353
+ /**
23354
+ * What a `listRecentFaces` page is ORDERED BY.
23355
+ *
23356
+ * - `timestamp` — when the face was seen. The historical (and default) order.
23357
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
23358
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
23359
+ * order: it puts the suggestions an operator can confirm with one tap at the
23360
+ * top, and it is the reason this enum exists — a client that ranked a capped
23361
+ * page client-side was ranking the newest N, never the most certain N.
23362
+ *
23363
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
23364
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
23365
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
23366
+ * — flipping the direction reorders the rows that HAVE a certainty and never
23367
+ * floods the page with the ones that do not. `addon-post-analysis`'s
23368
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
23369
+ * then by faceId, and is what makes this a total order instead of the
23370
+ * backend's NULL-collation accident.
23371
+ */
23372
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
23373
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
23374
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
23375
+ * never leaves the server. */
23376
+ var FaceClusterSchema = object({
23377
+ faceIds: array(string()).readonly(),
23378
+ representativeFaceId: string(),
23379
+ size: number().int(),
23380
+ cohesion: number()
23381
+ });
23283
23382
  var MediaFileLiteSchema$1 = object({
23284
23383
  key: string(),
23285
23384
  kind: string(),
@@ -23326,24 +23425,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23326
23425
  kind: "mutation",
23327
23426
  auth: "admin"
23328
23427
  }), method(object({
23329
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
23428
+ /**
23429
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
23430
+ *
23431
+ * The legacy single-camera form, kept verbatim for every caller that
23432
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
23433
+ * instead — never both: `deviceIds` is the authority whenever it is
23434
+ * present, and this field is then ignored rather than unioned, so
23435
+ * there is exactly one answer to "which cameras did I ask for".
23436
+ */
23330
23437
  deviceId: number().int().optional(),
23438
+ /**
23439
+ * Restrict to a SET of cameras — the review UI's camera filter, which
23440
+ * until now had to fetch the cluster-wide page and drop rows in the
23441
+ * client (so the `limit` it asked for was spent on cameras it was
23442
+ * about to discard).
23443
+ *
23444
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
23445
+ * "every camera". A request for no devices is a request, not an
23446
+ * omission; same contract as `deviceManager.listFleet` and
23447
+ * `pipelineAnalytics.listRecentTracks`.
23448
+ *
23449
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
23450
+ */
23451
+ deviceIds: array(number().int()).optional(),
23331
23452
  limit: number().int().positive().optional(),
23332
23453
  filter: FaceFilterEnum.optional(),
23333
23454
  /**
23334
- * Inline the base64 crop on every row. Default `true` — the existing
23335
- * behaviour, kept so no caller breaks.
23455
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23456
+ * Absent means no lower bound.
23457
+ */
23458
+ since: number().int().optional(),
23459
+ /**
23460
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23461
+ * Absent means no upper bound.
23462
+ */
23463
+ until: number().int().optional(),
23464
+ /**
23465
+ * Order the page by time or by suggestion certainty. Default
23466
+ * `'timestamp'` — the historical order, unchanged for every caller
23467
+ * that does not ask.
23336
23468
  *
23337
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
23338
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
23339
- * the browser cache the images.
23469
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
23470
+ * does under `'suggestionConfidence'`.
23340
23471
  *
23341
- * **This is an INPUT field, so it does not reach the addon until the
23342
- * next train.** The hub router validates cap inputs against its own
23343
- * compiled Zod, which strips a key it does not know verified today
23344
- * on the OUTPUT side, where an additive field DOES arrive immediately
23345
- * (`Track.hasFace`). Until the train ships, sending `false` is
23346
- * harmless and simply keeps the crops inline.
23472
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
23473
+ * index and stops reading as soon as `limit` rows have PASSED the
23474
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
23475
+ * certain row may be the oldest so it walks the window. Narrow it
23476
+ * with {@link since} / {@link until}.
23477
+ */
23478
+ sortBy: FaceSortFieldEnum.optional(),
23479
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
23480
+ sortDirection: FaceSortDirectionEnum.optional(),
23481
+ /**
23482
+ * Inline the base64 crop on every row.
23483
+ *
23484
+ * Default `false` since the 2026-08-25 inversion — see
23485
+ * `include-crops-default.ts`, which is the ONE place that resolves
23486
+ * this for every gallery, and which records why the inline shape had
23487
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
23488
+ * The doc here used to still say `true`; it was wrong, and a leftover
23489
+ * that describes the old design reads as permission to rely on it.
23490
+ *
23491
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
23492
+ * which the browser fetches off the `event-media` plane in parallel,
23493
+ * cached and ETagged.
23347
23494
  */
23348
23495
  includeCrops: boolean().optional()
23349
23496
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -23379,13 +23526,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23379
23526
  }), method(object({
23380
23527
  threshold: number().min(0).max(1).optional(),
23381
23528
  minClusterSize: number().int().min(2).optional(),
23382
- limit: number().int().positive().optional()
23383
- }).optional(), array(object({
23384
- faceIds: array(string()).readonly(),
23385
- representativeFaceId: string(),
23386
- size: number().int(),
23387
- cohesion: number()
23388
- })).readonly());
23529
+ /**
23530
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
23531
+ * which read as though it bounded the work — it never did.
23532
+ *
23533
+ * Wins over {@link limit} when both are sent.
23534
+ */
23535
+ maxClusters: number().int().positive().optional(),
23536
+ /**
23537
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
23538
+ * RESULT, not the scan. Kept so existing callers keep working; send
23539
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
23540
+ */
23541
+ limit: number().int().positive().optional(),
23542
+ /**
23543
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
23544
+ * POOL, not the result.
23545
+ *
23546
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
23547
+ * used to read every unassigned face on the hub no matter what the
23548
+ * caller asked for, because the only bound cut the finished clusters
23549
+ * afterwards; a UI showing a window of 100 paid for a scan of the
23550
+ * whole corpus, on an addon whose disk is under contention.
23551
+ *
23552
+ * The pool is the NEWEST matching faces first — the same order the
23553
+ * gallery shows — so a bound here shortens the horizon, it does not
23554
+ * sample it randomly.
23555
+ *
23556
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
23557
+ * so the live corpus — 372 face rows — is unaffected while the
23558
+ * unbounded scan can never come back as the table grows.
23559
+ */
23560
+ maxFacesScanned: number().int().positive().optional()
23561
+ }).optional(), array(FaceClusterSchema).readonly());
23389
23562
  /**
23390
23563
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
23391
23564
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -28613,6 +28786,293 @@ var SetSiteLocationInputSchema = object({
28613
28786
  latitude: number().min(-90).max(90),
28614
28787
  longitude: number().min(-180).max(180)
28615
28788
  }).nullable();
28789
+ /**
28790
+ * The TRANSPORT a call arrived on.
28791
+ *
28792
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28793
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28794
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28795
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28796
+ * checkable rather than asserted.
28797
+ *
28798
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28799
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28800
+ * connection; the viewer talks to the hub over `wsLink`
28801
+ * exclusively, so this is the plane the HTTP census could not see.
28802
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28803
+ * never touches a socket and therefore never touched a census.
28804
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28805
+ * that is exactly what its `0` asserts: every plane the hub has can name
28806
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28807
+ * plane nobody instrumented lands here instead of vanishing from the total.
28808
+ */
28809
+ var TransportPlaneSchema = _enum([
28810
+ "http",
28811
+ "ws",
28812
+ "mesh",
28813
+ "unknown"
28814
+ ]);
28815
+ /**
28816
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28817
+ * reads as "not instrumented", which is the one thing this census must never
28818
+ * make an operator wonder about.
28819
+ */
28820
+ var TransportPlaneCountsSchema = object({
28821
+ http: number(),
28822
+ ws: number(),
28823
+ mesh: number(),
28824
+ unknown: number()
28825
+ });
28826
+ /**
28827
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28828
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28829
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28830
+ * already prints - never a token, never an `Authorization` header.
28831
+ *
28832
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28833
+ * and lives for hours, so folding it into a call count makes one long-lived
28834
+ * stream look like a storm.
28835
+ */
28836
+ var RequestCensusGroupSchema = object({
28837
+ plane: TransportPlaneSchema,
28838
+ procedure: string(),
28839
+ userAgent: string(),
28840
+ ip: string(),
28841
+ principal: string(),
28842
+ calls: number(),
28843
+ subscriptions: number(),
28844
+ perMin: number()
28845
+ });
28846
+ /**
28847
+ * A procedure's TOTAL over the window, across every caller.
28848
+ *
28849
+ * This block, not the group list, is what answers "did these calls arrive over
28850
+ * HTTP at all". A total far BELOW what a store-side census counted over the
28851
+ * same window excludes the HTTP plane, which is a result, not a failure.
28852
+ */
28853
+ var RequestCensusProcedureSchema = object({
28854
+ procedure: string(),
28855
+ calls: number(),
28856
+ /**
28857
+ * The same total, split by transport. THIS is the row that answers the
28858
+ * question the census exists for: one look at `deviceManager.listAll` says
28859
+ * which plane carried the 4 960, without joining two log lines by eye.
28860
+ */
28861
+ planes: TransportPlaneCountsSchema,
28862
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28863
+ subscriptions: number(),
28864
+ perMin: number()
28865
+ });
28866
+ /**
28867
+ * The census as an operator sees it.
28868
+ *
28869
+ * `persisted` is the honest answer to "will this survive the restart I am
28870
+ * about to do": the arm deadline is written to `system-settings` so a window
28871
+ * armed now can measure the NEXT boot, and a write that failed must not look
28872
+ * like one that succeeded.
28873
+ */
28874
+ var RequestCensusStatusSchema = object({
28875
+ armed: boolean(),
28876
+ /** How long the current - or just-closed - window collected, in ms. */
28877
+ elapsedMs: number(),
28878
+ /** The window actually armed, after the server clamped the request. */
28879
+ windowMs: number(),
28880
+ /** Epoch ms the window closes at. 0 when disarmed. */
28881
+ armedUntilMs: number(),
28882
+ httpRequests: number(),
28883
+ batchedRequests: number(),
28884
+ /**
28885
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
28886
+ * is in play (`?batch=1` carries several procedures in one request); this is
28887
+ * the number comparable with a store-side call count.
28888
+ */
28889
+ procedureCalls: number(),
28890
+ /**
28891
+ * `procedureCalls` split by transport. The four keys sum to
28892
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28893
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28894
+ */
28895
+ planes: TransportPlaneCountsSchema,
28896
+ /**
28897
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28898
+ * on no plane at all - which is a RESULT (a plane is missing from the
28899
+ * instrument), not a failure, and it has to be visible to be read as one.
28900
+ */
28901
+ planesExplainTotal: boolean(),
28902
+ /**
28903
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
28904
+ * adapter resolves one context per connection - kept because a plane's call
28905
+ * count of zero against 37 open connections says something different from a
28906
+ * plane with no connections at all.
28907
+ */
28908
+ wsConnections: number(),
28909
+ /**
28910
+ * Client frames the WS plane looked at. `wsMessages` far above
28911
+ * `planes.ws + subscriptions` means most traffic is not operations
28912
+ * (keepalives, connection params) - which is itself an answer.
28913
+ */
28914
+ wsMessages: number(),
28915
+ /**
28916
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28917
+ * purpose: one live-events stream opened at boot and held for six hours is
28918
+ * one subscription, and counting it as a call would let a quiet plane
28919
+ * masquerade as the storm.
28920
+ */
28921
+ subscriptions: number(),
28922
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28923
+ subscriptionStops: number(),
28924
+ distinctGroups: number(),
28925
+ /**
28926
+ * Operations counted in the totals whose CALLER attribution was shed at the
28927
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28928
+ * which transport they arrived on, they just lost their group row.
28929
+ */
28930
+ unattributedCalls: number(),
28931
+ procedures: array(RequestCensusProcedureSchema).readonly(),
28932
+ groups: array(RequestCensusGroupSchema).readonly()
28933
+ }).extend({ persisted: boolean() });
28934
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
28935
+ var LogLevelSchema$1 = _enum([
28936
+ "debug",
28937
+ "info",
28938
+ "warn",
28939
+ "error"
28940
+ ]);
28941
+ /**
28942
+ * The diagnostics that can be ARMED for a window. Exactly one today.
28943
+ *
28944
+ * A diagnostic is anything whose cost is only worth paying while a question is
28945
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
28946
+ */
28947
+ var DiagnosticIdSchema = _enum(["request-census"]);
28948
+ /**
28949
+ * The layers of the level hierarchy, general → specific. The most specific
28950
+ * layer that carries an explicit value wins.
28951
+ *
28952
+ * `component` is DECLARED and not yet resolvable: the per-component channels
28953
+ * are a later slice of the same plan, and a `levelSource` enum that has to
28954
+ * grow later would force every consumer of this document to change with it.
28955
+ * Nothing returns `component` today.
28956
+ */
28957
+ var LoggingScopeKindSchema = _enum([
28958
+ "cluster",
28959
+ "node",
28960
+ "component"
28961
+ ]);
28962
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
28963
+ var LoggingLevelSourceSchema = _enum([
28964
+ "default",
28965
+ "cluster",
28966
+ "node",
28967
+ "component"
28968
+ ]);
28969
+ /**
28970
+ * One layer of the hierarchy as it actually STANDS.
28971
+ *
28972
+ * `level: null` is the whole reason this array is returned: it is the
28973
+ * difference between "this node is at `info` because I decided it" and
28974
+ * "...because it inherits". An operator who clears an override believing they
28975
+ * are clearing an inherited value has been handed the same defect as the two
28976
+ * contradicting knobs this document exists to remove, moved one floor up.
28977
+ */
28978
+ var LoggingLevelLayerSchema = object({
28979
+ scope: LoggingScopeKindSchema,
28980
+ /** The node this layer speaks for; `null` on the cluster layer. */
28981
+ nodeId: string().nullable(),
28982
+ /** Explicitly set here, or `null` when this layer inherits. */
28983
+ level: LogLevelSchema$1.nullable()
28984
+ });
28985
+ /** What a line is judged against, and WHICH layer decided it. */
28986
+ var LoggingEffectiveSchema = object({
28987
+ level: LogLevelSchema$1,
28988
+ levelSource: LoggingLevelSourceSchema
28989
+ });
28990
+ /** Every layer, general → specific. Never collapsed into the effective value. */
28991
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
28992
+ /**
28993
+ * An armed diagnostic, with its DEADLINE.
28994
+ *
28995
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
28996
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
28997
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
28998
+ * `armed` is false — a window is never reported as slightly expired.
28999
+ */
29000
+ var DiagnosticWindowSchema = object({
29001
+ id: DiagnosticIdSchema,
29002
+ armed: boolean(),
29003
+ /** Epoch ms the window closes at. 0 when disarmed. */
29004
+ armedUntilMs: number(),
29005
+ /** Ms left before it expires on its own. 0 when disarmed. */
29006
+ remainingMs: number(),
29007
+ /** Whether the stored deadline is the one the live diagnostic is running —
29008
+ * i.e. whether this window would survive a restart. */
29009
+ persisted: boolean()
29010
+ });
29011
+ /**
29012
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
29013
+ * server — there is no maximum here on purpose: a bound repeated in a schema
29014
+ * is a second knob that disagrees with the first the day one of them moves.
29015
+ */
29016
+ var DiagnosticWindowPatchSchema = object({
29017
+ id: DiagnosticIdSchema,
29018
+ armMs: number().int().min(0),
29019
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
29020
+ reportEveryMs: number().int().positive().optional()
29021
+ });
29022
+ /**
29023
+ * A PATCH, and patches MERGE.
29024
+ *
29025
+ * A field absent from the patch is left exactly as it was — arming a
29026
+ * diagnostic never resets a level, and setting a level never disarms a window.
29027
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
29028
+ * `setAll` already merges, and rebuilding the object is how an absent field
29029
+ * turns into an erased one.
29030
+ */
29031
+ var LoggingSettingsPatchSchema = object({
29032
+ /**
29033
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
29034
+ * addressed scope so it inherits again. A value sets it.
29035
+ */
29036
+ level: LogLevelSchema$1.nullable().optional(),
29037
+ /**
29038
+ * Only the diagnostics NAMED here change. An armed window that is not listed
29039
+ * keeps running — a patch is never a full replacement.
29040
+ */
29041
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29042
+ });
29043
+ /**
29044
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
29045
+ *
29046
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
29047
+ * input — the generated router strips it and uses it to resolve the PROVIDER
29048
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
29049
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
29050
+ * by an agent that holds no cluster document at all. The hub is the single
29051
+ * authority over the whole hierarchy and answers for every layer, so the
29052
+ * layer selector needs a name the transport does not already own.
29053
+ */
29054
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29055
+ var SetLoggingSettingsInputSchema = object({
29056
+ scopeNodeId: string().optional(),
29057
+ patch: LoggingSettingsPatchSchema
29058
+ });
29059
+ /**
29060
+ * The whole document, as read and as returned after every write.
29061
+ *
29062
+ * `persisted: false` means the settings store could not be read or written.
29063
+ * The in-memory mirror still governs behaviour and is unchanged by the
29064
+ * failure — a read that fails neither switches a level nor disarms a window
29065
+ * (D49) — but the operator is told that what they are looking at would not
29066
+ * survive a restart.
29067
+ */
29068
+ var LoggingSettingsStateSchema = object({
29069
+ /** The layer this document was read at. `null` = the cluster layer. */
29070
+ scopeNodeId: string().nullable(),
29071
+ effective: LoggingEffectiveSchema,
29072
+ explicit: LoggingExplicitSchema,
29073
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
29074
+ persisted: boolean()
29075
+ });
28616
29076
  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(), {
28617
29077
  kind: "mutation",
28618
29078
  auth: "admin"
@@ -28625,6 +29085,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28625
29085
  }), method(_void(), SiteLocationStatusSchema, {
28626
29086
  kind: "mutation",
28627
29087
  auth: "admin"
29088
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29089
+ kind: "mutation",
29090
+ auth: "admin"
28628
29091
  });
28629
29092
  /**
28630
29093
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -36070,6 +36533,18 @@ Object.freeze({
36070
36533
  addonId: null,
36071
36534
  access: "create"
36072
36535
  },
36536
+ "system.getLoggingSettings": {
36537
+ capName: "system",
36538
+ capScope: "system",
36539
+ addonId: null,
36540
+ access: "view"
36541
+ },
36542
+ "system.getRequestCensus": {
36543
+ capName: "system",
36544
+ capScope: "system",
36545
+ addonId: null,
36546
+ access: "view"
36547
+ },
36073
36548
  "system.getRetentionConfig": {
36074
36549
  capName: "system",
36075
36550
  capScope: "system",
@@ -36100,6 +36575,12 @@ Object.freeze({
36100
36575
  addonId: null,
36101
36576
  access: "view"
36102
36577
  },
36578
+ "system.setLoggingSettings": {
36579
+ capName: "system",
36580
+ capScope: "system",
36581
+ addonId: null,
36582
+ access: "create"
36583
+ },
36103
36584
  "system.setRetentionConfig": {
36104
36585
  capName: "system",
36105
36586
  capScope: "system",
@@ -37255,6 +37736,10 @@ Object.freeze({
37255
37736
  name: "deviceId",
37256
37737
  form: "single",
37257
37738
  optional: true
37739
+ }, {
37740
+ name: "deviceIds",
37741
+ form: "array",
37742
+ optional: true
37258
37743
  }],
37259
37744
  "fanControl.setDirection": [{
37260
37745
  name: "deviceId",
@@ -38865,7 +39350,38 @@ object({
38865
39350
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
38866
39351
  * reproduce that.
38867
39352
  */
38868
- tileBudgetMb: number().int().min(0).max(1024)
39353
+ tileBudgetMb: number().int().min(0).max(1024),
39354
+ /**
39355
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
39356
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
39357
+ * subject tiles, on frames that detected something.
39358
+ *
39359
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
39360
+ * containment is strict by design, so the native `keyFrame`, the detail
39361
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
39362
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
39363
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
39364
+ * frame-time after delivery, with the request only p50 367 ms behind it.
39365
+ *
39366
+ * Sizing, and why this is a budget and not a duration: a scene tile is
39367
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
39368
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
39369
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
39370
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
39371
+ * binds only through a detection burst, where it still covers well past the
39372
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
39373
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
39374
+ * whole shape exists to avoid.
39375
+ *
39376
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
39377
+ * subject tile, so one shared budget would let a busy camera's key frames
39378
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
39379
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
39380
+ * pre-existing behaviour, where a late full-frame request had nothing but the
39381
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
39382
+ * nothing.
39383
+ */
39384
+ sceneBudgetMb: number().int().min(0).max(1024)
38869
39385
  });
38870
39386
  /**
38871
39387
  * The values in force when the operator has set nothing.
@@ -38881,12 +39397,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
38881
39397
  budgetMb: 1024,
38882
39398
  activityMs: 15e3,
38883
39399
  tileBudgetMb: 64,
39400
+ sceneBudgetMb: 48,
38884
39401
  admission: "inferred"
38885
39402
  };
38886
39403
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
38887
39404
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
38888
39405
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
38889
39406
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
39407
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
38890
39408
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
38891
39409
  var MB = 1024 * 1024;
38892
39410
  1024 * MB, 3072 * MB;