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