@camstack/addon-provider-onvif 1.2.30 → 1.2.31

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
@@ -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",
@@ -20969,7 +21039,7 @@ var lifecycleJobSchema = object({
20969
21039
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
20970
21040
  * as every other cap.
20971
21041
  */
20972
- var LogLevelSchema$1 = _enum([
21042
+ var LogLevelSchema$2 = _enum([
20973
21043
  "debug",
20974
21044
  "info",
20975
21045
  "warn",
@@ -21176,7 +21246,7 @@ var CustomActionInputSchema = object({
21176
21246
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21177
21247
  addonId: string(),
21178
21248
  limit: number().min(1).max(500).default(100),
21179
- level: LogLevelSchema$1.optional()
21249
+ level: LogLevelSchema$2.optional()
21180
21250
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21181
21251
  packageName: string(),
21182
21252
  version: string().optional()
@@ -21274,7 +21344,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21274
21344
  auth: "admin"
21275
21345
  }), method(object({
21276
21346
  addonId: string(),
21277
- level: LogLevelSchema$1.optional()
21347
+ level: LogLevelSchema$2.optional()
21278
21348
  }), LogStreamEntrySchema, { kind: "subscription" });
21279
21349
  object({
21280
21350
  /** Carbon dioxide concentration in ppm. */
@@ -22268,6 +22338,35 @@ var FaceFilterEnum = _enum([
22268
22338
  "identified",
22269
22339
  "all"
22270
22340
  ]);
22341
+ /**
22342
+ * What a `listRecentFaces` page is ORDERED BY.
22343
+ *
22344
+ * - `timestamp` — when the face was seen. The historical (and default) order.
22345
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
22346
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
22347
+ * order: it puts the suggestions an operator can confirm with one tap at the
22348
+ * top, and it is the reason this enum exists — a client that ranked a capped
22349
+ * page client-side was ranking the newest N, never the most certain N.
22350
+ *
22351
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
22352
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
22353
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
22354
+ * — flipping the direction reorders the rows that HAVE a certainty and never
22355
+ * floods the page with the ones that do not. `addon-post-analysis`'s
22356
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
22357
+ * then by faceId, and is what makes this a total order instead of the
22358
+ * backend's NULL-collation accident.
22359
+ */
22360
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
22361
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
22362
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
22363
+ * never leaves the server. */
22364
+ var FaceClusterSchema = object({
22365
+ faceIds: array(string()).readonly(),
22366
+ representativeFaceId: string(),
22367
+ size: number().int(),
22368
+ cohesion: number()
22369
+ });
22271
22370
  var MediaFileLiteSchema$1 = object({
22272
22371
  key: string(),
22273
22372
  kind: string(),
@@ -22314,24 +22413,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
22314
22413
  kind: "mutation",
22315
22414
  auth: "admin"
22316
22415
  }), method(object({
22317
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
22416
+ /**
22417
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
22418
+ *
22419
+ * The legacy single-camera form, kept verbatim for every caller that
22420
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
22421
+ * instead — never both: `deviceIds` is the authority whenever it is
22422
+ * present, and this field is then ignored rather than unioned, so
22423
+ * there is exactly one answer to "which cameras did I ask for".
22424
+ */
22318
22425
  deviceId: number().int().optional(),
22426
+ /**
22427
+ * Restrict to a SET of cameras — the review UI's camera filter, which
22428
+ * until now had to fetch the cluster-wide page and drop rows in the
22429
+ * client (so the `limit` it asked for was spent on cameras it was
22430
+ * about to discard).
22431
+ *
22432
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
22433
+ * "every camera". A request for no devices is a request, not an
22434
+ * omission; same contract as `deviceManager.listFleet` and
22435
+ * `pipelineAnalytics.listRecentTracks`.
22436
+ *
22437
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
22438
+ */
22439
+ deviceIds: array(number().int()).optional(),
22319
22440
  limit: number().int().positive().optional(),
22320
22441
  filter: FaceFilterEnum.optional(),
22321
22442
  /**
22322
- * Inline the base64 crop on every row. Default `true` — the existing
22323
- * behaviour, kept so no caller breaks.
22443
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
22444
+ * Absent means no lower bound.
22445
+ */
22446
+ since: number().int().optional(),
22447
+ /**
22448
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
22449
+ * Absent means no upper bound.
22450
+ */
22451
+ until: number().int().optional(),
22452
+ /**
22453
+ * Order the page by time or by suggestion certainty. Default
22454
+ * `'timestamp'` — the historical order, unchanged for every caller
22455
+ * that does not ask.
22324
22456
  *
22325
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
22326
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
22327
- * the browser cache the images.
22457
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
22458
+ * does under `'suggestionConfidence'`.
22328
22459
  *
22329
- * **This is an INPUT field, so it does not reach the addon until the
22330
- * next train.** The hub router validates cap inputs against its own
22331
- * compiled Zod, which strips a key it does not know verified today
22332
- * on the OUTPUT side, where an additive field DOES arrive immediately
22333
- * (`Track.hasFace`). Until the train ships, sending `false` is
22334
- * harmless and simply keeps the crops inline.
22460
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
22461
+ * index and stops reading as soon as `limit` rows have PASSED the
22462
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
22463
+ * certain row may be the oldest so it walks the window. Narrow it
22464
+ * with {@link since} / {@link until}.
22465
+ */
22466
+ sortBy: FaceSortFieldEnum.optional(),
22467
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
22468
+ sortDirection: FaceSortDirectionEnum.optional(),
22469
+ /**
22470
+ * Inline the base64 crop on every row.
22471
+ *
22472
+ * Default `false` since the 2026-08-25 inversion — see
22473
+ * `include-crops-default.ts`, which is the ONE place that resolves
22474
+ * this for every gallery, and which records why the inline shape had
22475
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
22476
+ * The doc here used to still say `true`; it was wrong, and a leftover
22477
+ * that describes the old design reads as permission to rely on it.
22478
+ *
22479
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
22480
+ * which the browser fetches off the `event-media` plane in parallel,
22481
+ * cached and ETagged.
22335
22482
  */
22336
22483
  includeCrops: boolean().optional()
22337
22484
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -22367,13 +22514,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
22367
22514
  }), method(object({
22368
22515
  threshold: number().min(0).max(1).optional(),
22369
22516
  minClusterSize: number().int().min(2).optional(),
22370
- limit: number().int().positive().optional()
22371
- }).optional(), array(object({
22372
- faceIds: array(string()).readonly(),
22373
- representativeFaceId: string(),
22374
- size: number().int(),
22375
- cohesion: number()
22376
- })).readonly());
22517
+ /**
22518
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
22519
+ * which read as though it bounded the work — it never did.
22520
+ *
22521
+ * Wins over {@link limit} when both are sent.
22522
+ */
22523
+ maxClusters: number().int().positive().optional(),
22524
+ /**
22525
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
22526
+ * RESULT, not the scan. Kept so existing callers keep working; send
22527
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
22528
+ */
22529
+ limit: number().int().positive().optional(),
22530
+ /**
22531
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
22532
+ * POOL, not the result.
22533
+ *
22534
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
22535
+ * used to read every unassigned face on the hub no matter what the
22536
+ * caller asked for, because the only bound cut the finished clusters
22537
+ * afterwards; a UI showing a window of 100 paid for a scan of the
22538
+ * whole corpus, on an addon whose disk is under contention.
22539
+ *
22540
+ * The pool is the NEWEST matching faces first — the same order the
22541
+ * gallery shows — so a bound here shortens the horizon, it does not
22542
+ * sample it randomly.
22543
+ *
22544
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
22545
+ * so the live corpus — 372 face rows — is unaffected while the
22546
+ * unbounded scan can never come back as the table grows.
22547
+ */
22548
+ maxFacesScanned: number().int().positive().optional()
22549
+ }).optional(), array(FaceClusterSchema).readonly());
22377
22550
  /**
22378
22551
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
22379
22552
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -26138,6 +26311,211 @@ var SetSiteLocationInputSchema = object({
26138
26311
  latitude: number().min(-90).max(90),
26139
26312
  longitude: number().min(-180).max(180)
26140
26313
  }).nullable();
26314
+ /**
26315
+ * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
26316
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26317
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26318
+ * already prints - never a token, never an `Authorization` header.
26319
+ */
26320
+ var RequestCensusGroupSchema = object({
26321
+ procedure: string(),
26322
+ userAgent: string(),
26323
+ ip: string(),
26324
+ principal: string(),
26325
+ calls: number(),
26326
+ perMin: number()
26327
+ });
26328
+ /**
26329
+ * A procedure's TOTAL over the window, across every caller.
26330
+ *
26331
+ * This block, not the group list, is what answers "did these calls arrive over
26332
+ * HTTP at all". A total far BELOW what a store-side census counted over the
26333
+ * same window excludes the HTTP plane, which is a result, not a failure.
26334
+ */
26335
+ var RequestCensusProcedureSchema = object({
26336
+ procedure: string(),
26337
+ calls: number(),
26338
+ perMin: number()
26339
+ });
26340
+ /**
26341
+ * The census as an operator sees it.
26342
+ *
26343
+ * `persisted` is the honest answer to "will this survive the restart I am
26344
+ * about to do": the arm deadline is written to `system-settings` so a window
26345
+ * armed now can measure the NEXT boot, and a write that failed must not look
26346
+ * like one that succeeded.
26347
+ */
26348
+ var RequestCensusStatusSchema = object({
26349
+ armed: boolean(),
26350
+ /** How long the current - or just-closed - window collected, in ms. */
26351
+ elapsedMs: number(),
26352
+ /** The window actually armed, after the server clamped the request. */
26353
+ windowMs: number(),
26354
+ /** Epoch ms the window closes at. 0 when disarmed. */
26355
+ armedUntilMs: number(),
26356
+ httpRequests: number(),
26357
+ batchedRequests: number(),
26358
+ /**
26359
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
26360
+ * is in play (`?batch=1` carries several procedures in one request); this is
26361
+ * the number comparable with a store-side call count.
26362
+ */
26363
+ procedureCalls: number(),
26364
+ /**
26365
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
26366
+ * transport resolves one context per connection - but the number that says
26367
+ * whether a plane this census cannot see was busy while HTTP was quiet.
26368
+ */
26369
+ wsConnections: number(),
26370
+ distinctGroups: number(),
26371
+ /** Calls counted in the totals whose group attribution was shed at the
26372
+ * cardinality bound. */
26373
+ unattributedCalls: number(),
26374
+ procedures: array(RequestCensusProcedureSchema).readonly(),
26375
+ groups: array(RequestCensusGroupSchema).readonly()
26376
+ }).extend({ persisted: boolean() });
26377
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
26378
+ var LogLevelSchema$1 = _enum([
26379
+ "debug",
26380
+ "info",
26381
+ "warn",
26382
+ "error"
26383
+ ]);
26384
+ /**
26385
+ * The diagnostics that can be ARMED for a window. Exactly one today.
26386
+ *
26387
+ * A diagnostic is anything whose cost is only worth paying while a question is
26388
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
26389
+ */
26390
+ var DiagnosticIdSchema = _enum(["request-census"]);
26391
+ /**
26392
+ * The layers of the level hierarchy, general → specific. The most specific
26393
+ * layer that carries an explicit value wins.
26394
+ *
26395
+ * `component` is DECLARED and not yet resolvable: the per-component channels
26396
+ * are a later slice of the same plan, and a `levelSource` enum that has to
26397
+ * grow later would force every consumer of this document to change with it.
26398
+ * Nothing returns `component` today.
26399
+ */
26400
+ var LoggingScopeKindSchema = _enum([
26401
+ "cluster",
26402
+ "node",
26403
+ "component"
26404
+ ]);
26405
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
26406
+ var LoggingLevelSourceSchema = _enum([
26407
+ "default",
26408
+ "cluster",
26409
+ "node",
26410
+ "component"
26411
+ ]);
26412
+ /**
26413
+ * One layer of the hierarchy as it actually STANDS.
26414
+ *
26415
+ * `level: null` is the whole reason this array is returned: it is the
26416
+ * difference between "this node is at `info` because I decided it" and
26417
+ * "...because it inherits". An operator who clears an override believing they
26418
+ * are clearing an inherited value has been handed the same defect as the two
26419
+ * contradicting knobs this document exists to remove, moved one floor up.
26420
+ */
26421
+ var LoggingLevelLayerSchema = object({
26422
+ scope: LoggingScopeKindSchema,
26423
+ /** The node this layer speaks for; `null` on the cluster layer. */
26424
+ nodeId: string().nullable(),
26425
+ /** Explicitly set here, or `null` when this layer inherits. */
26426
+ level: LogLevelSchema$1.nullable()
26427
+ });
26428
+ /** What a line is judged against, and WHICH layer decided it. */
26429
+ var LoggingEffectiveSchema = object({
26430
+ level: LogLevelSchema$1,
26431
+ levelSource: LoggingLevelSourceSchema
26432
+ });
26433
+ /** Every layer, general → specific. Never collapsed into the effective value. */
26434
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
26435
+ /**
26436
+ * An armed diagnostic, with its DEADLINE.
26437
+ *
26438
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
26439
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
26440
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
26441
+ * `armed` is false — a window is never reported as slightly expired.
26442
+ */
26443
+ var DiagnosticWindowSchema = object({
26444
+ id: DiagnosticIdSchema,
26445
+ armed: boolean(),
26446
+ /** Epoch ms the window closes at. 0 when disarmed. */
26447
+ armedUntilMs: number(),
26448
+ /** Ms left before it expires on its own. 0 when disarmed. */
26449
+ remainingMs: number(),
26450
+ /** Whether the stored deadline is the one the live diagnostic is running —
26451
+ * i.e. whether this window would survive a restart. */
26452
+ persisted: boolean()
26453
+ });
26454
+ /**
26455
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
26456
+ * server — there is no maximum here on purpose: a bound repeated in a schema
26457
+ * is a second knob that disagrees with the first the day one of them moves.
26458
+ */
26459
+ var DiagnosticWindowPatchSchema = object({
26460
+ id: DiagnosticIdSchema,
26461
+ armMs: number().int().min(0),
26462
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
26463
+ reportEveryMs: number().int().positive().optional()
26464
+ });
26465
+ /**
26466
+ * A PATCH, and patches MERGE.
26467
+ *
26468
+ * A field absent from the patch is left exactly as it was — arming a
26469
+ * diagnostic never resets a level, and setting a level never disarms a window.
26470
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
26471
+ * `setAll` already merges, and rebuilding the object is how an absent field
26472
+ * turns into an erased one.
26473
+ */
26474
+ var LoggingSettingsPatchSchema = object({
26475
+ /**
26476
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
26477
+ * addressed scope so it inherits again. A value sets it.
26478
+ */
26479
+ level: LogLevelSchema$1.nullable().optional(),
26480
+ /**
26481
+ * Only the diagnostics NAMED here change. An armed window that is not listed
26482
+ * keeps running — a patch is never a full replacement.
26483
+ */
26484
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
26485
+ });
26486
+ /**
26487
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
26488
+ *
26489
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
26490
+ * input — the generated router strips it and uses it to resolve the PROVIDER
26491
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
26492
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
26493
+ * by an agent that holds no cluster document at all. The hub is the single
26494
+ * authority over the whole hierarchy and answers for every layer, so the
26495
+ * layer selector needs a name the transport does not already own.
26496
+ */
26497
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
26498
+ var SetLoggingSettingsInputSchema = object({
26499
+ scopeNodeId: string().optional(),
26500
+ patch: LoggingSettingsPatchSchema
26501
+ });
26502
+ /**
26503
+ * The whole document, as read and as returned after every write.
26504
+ *
26505
+ * `persisted: false` means the settings store could not be read or written.
26506
+ * The in-memory mirror still governs behaviour and is unchanged by the
26507
+ * failure — a read that fails neither switches a level nor disarms a window
26508
+ * (D49) — but the operator is told that what they are looking at would not
26509
+ * survive a restart.
26510
+ */
26511
+ var LoggingSettingsStateSchema = object({
26512
+ /** The layer this document was read at. `null` = the cluster layer. */
26513
+ scopeNodeId: string().nullable(),
26514
+ effective: LoggingEffectiveSchema,
26515
+ explicit: LoggingExplicitSchema,
26516
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
26517
+ persisted: boolean()
26518
+ });
26141
26519
  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(), {
26142
26520
  kind: "mutation",
26143
26521
  auth: "admin"
@@ -26150,6 +26528,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
26150
26528
  }), method(_void(), SiteLocationStatusSchema, {
26151
26529
  kind: "mutation",
26152
26530
  auth: "admin"
26531
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
26532
+ kind: "mutation",
26533
+ auth: "admin"
26153
26534
  });
26154
26535
  object({
26155
26536
  /** True when the device's tamper switch / case-open contact is
@@ -32391,6 +32772,18 @@ Object.freeze({
32391
32772
  addonId: null,
32392
32773
  access: "create"
32393
32774
  },
32775
+ "system.getLoggingSettings": {
32776
+ capName: "system",
32777
+ capScope: "system",
32778
+ addonId: null,
32779
+ access: "view"
32780
+ },
32781
+ "system.getRequestCensus": {
32782
+ capName: "system",
32783
+ capScope: "system",
32784
+ addonId: null,
32785
+ access: "view"
32786
+ },
32394
32787
  "system.getRetentionConfig": {
32395
32788
  capName: "system",
32396
32789
  capScope: "system",
@@ -32421,6 +32814,12 @@ Object.freeze({
32421
32814
  addonId: null,
32422
32815
  access: "view"
32423
32816
  },
32817
+ "system.setLoggingSettings": {
32818
+ capName: "system",
32819
+ capScope: "system",
32820
+ addonId: null,
32821
+ access: "create"
32822
+ },
32424
32823
  "system.setRetentionConfig": {
32425
32824
  capName: "system",
32426
32825
  capScope: "system",
@@ -33576,6 +33975,10 @@ Object.freeze({
33576
33975
  name: "deviceId",
33577
33976
  form: "single",
33578
33977
  optional: true
33978
+ }, {
33979
+ name: "deviceIds",
33980
+ form: "array",
33981
+ optional: true
33579
33982
  }],
33580
33983
  "fanControl.setDirection": [{
33581
33984
  name: "deviceId",
@@ -35186,7 +35589,38 @@ object({
35186
35589
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
35187
35590
  * reproduce that.
35188
35591
  */
35189
- tileBudgetMb: number().int().min(0).max(1024)
35592
+ tileBudgetMb: number().int().min(0).max(1024),
35593
+ /**
35594
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
35595
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
35596
+ * subject tiles, on frames that detected something.
35597
+ *
35598
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
35599
+ * containment is strict by design, so the native `keyFrame`, the detail
35600
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
35601
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
35602
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
35603
+ * frame-time after delivery, with the request only p50 367 ms behind it.
35604
+ *
35605
+ * Sizing, and why this is a budget and not a duration: a scene tile is
35606
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
35607
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
35608
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
35609
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
35610
+ * binds only through a detection burst, where it still covers well past the
35611
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
35612
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
35613
+ * whole shape exists to avoid.
35614
+ *
35615
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
35616
+ * subject tile, so one shared budget would let a busy camera's key frames
35617
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
35618
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
35619
+ * pre-existing behaviour, where a late full-frame request had nothing but the
35620
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
35621
+ * nothing.
35622
+ */
35623
+ sceneBudgetMb: number().int().min(0).max(1024)
35190
35624
  });
35191
35625
  /**
35192
35626
  * The values in force when the operator has set nothing.
@@ -35202,12 +35636,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
35202
35636
  budgetMb: 1024,
35203
35637
  activityMs: 15e3,
35204
35638
  tileBudgetMb: 64,
35639
+ sceneBudgetMb: 48,
35205
35640
  admission: "inferred"
35206
35641
  };
35207
35642
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
35208
35643
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
35209
35644
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
35210
35645
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
35646
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
35211
35647
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
35212
35648
  var MB = 1024 * 1024;
35213
35649
  1024 * MB, 3072 * MB;
package/dist/addon.mjs 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",
@@ -20970,7 +21040,7 @@ var lifecycleJobSchema = object({
20970
21040
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
20971
21041
  * as every other cap.
20972
21042
  */
20973
- var LogLevelSchema$1 = _enum([
21043
+ var LogLevelSchema$2 = _enum([
20974
21044
  "debug",
20975
21045
  "info",
20976
21046
  "warn",
@@ -21177,7 +21247,7 @@ var CustomActionInputSchema = object({
21177
21247
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21178
21248
  addonId: string(),
21179
21249
  limit: number().min(1).max(500).default(100),
21180
- level: LogLevelSchema$1.optional()
21250
+ level: LogLevelSchema$2.optional()
21181
21251
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21182
21252
  packageName: string(),
21183
21253
  version: string().optional()
@@ -21275,7 +21345,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21275
21345
  auth: "admin"
21276
21346
  }), method(object({
21277
21347
  addonId: string(),
21278
- level: LogLevelSchema$1.optional()
21348
+ level: LogLevelSchema$2.optional()
21279
21349
  }), LogStreamEntrySchema, { kind: "subscription" });
21280
21350
  object({
21281
21351
  /** Carbon dioxide concentration in ppm. */
@@ -22269,6 +22339,35 @@ var FaceFilterEnum = _enum([
22269
22339
  "identified",
22270
22340
  "all"
22271
22341
  ]);
22342
+ /**
22343
+ * What a `listRecentFaces` page is ORDERED BY.
22344
+ *
22345
+ * - `timestamp` — when the face was seen. The historical (and default) order.
22346
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
22347
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
22348
+ * order: it puts the suggestions an operator can confirm with one tap at the
22349
+ * top, and it is the reason this enum exists — a client that ranked a capped
22350
+ * page client-side was ranking the newest N, never the most certain N.
22351
+ *
22352
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
22353
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
22354
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
22355
+ * — flipping the direction reorders the rows that HAVE a certainty and never
22356
+ * floods the page with the ones that do not. `addon-post-analysis`'s
22357
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
22358
+ * then by faceId, and is what makes this a total order instead of the
22359
+ * backend's NULL-collation accident.
22360
+ */
22361
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
22362
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
22363
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
22364
+ * never leaves the server. */
22365
+ var FaceClusterSchema = object({
22366
+ faceIds: array(string()).readonly(),
22367
+ representativeFaceId: string(),
22368
+ size: number().int(),
22369
+ cohesion: number()
22370
+ });
22272
22371
  var MediaFileLiteSchema$1 = object({
22273
22372
  key: string(),
22274
22373
  kind: string(),
@@ -22315,24 +22414,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
22315
22414
  kind: "mutation",
22316
22415
  auth: "admin"
22317
22416
  }), method(object({
22318
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
22417
+ /**
22418
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
22419
+ *
22420
+ * The legacy single-camera form, kept verbatim for every caller that
22421
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
22422
+ * instead — never both: `deviceIds` is the authority whenever it is
22423
+ * present, and this field is then ignored rather than unioned, so
22424
+ * there is exactly one answer to "which cameras did I ask for".
22425
+ */
22319
22426
  deviceId: number().int().optional(),
22427
+ /**
22428
+ * Restrict to a SET of cameras — the review UI's camera filter, which
22429
+ * until now had to fetch the cluster-wide page and drop rows in the
22430
+ * client (so the `limit` it asked for was spent on cameras it was
22431
+ * about to discard).
22432
+ *
22433
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
22434
+ * "every camera". A request for no devices is a request, not an
22435
+ * omission; same contract as `deviceManager.listFleet` and
22436
+ * `pipelineAnalytics.listRecentTracks`.
22437
+ *
22438
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
22439
+ */
22440
+ deviceIds: array(number().int()).optional(),
22320
22441
  limit: number().int().positive().optional(),
22321
22442
  filter: FaceFilterEnum.optional(),
22322
22443
  /**
22323
- * Inline the base64 crop on every row. Default `true` — the existing
22324
- * behaviour, kept so no caller breaks.
22444
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
22445
+ * Absent means no lower bound.
22446
+ */
22447
+ since: number().int().optional(),
22448
+ /**
22449
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
22450
+ * Absent means no upper bound.
22451
+ */
22452
+ until: number().int().optional(),
22453
+ /**
22454
+ * Order the page by time or by suggestion certainty. Default
22455
+ * `'timestamp'` — the historical order, unchanged for every caller
22456
+ * that does not ask.
22325
22457
  *
22326
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
22327
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
22328
- * the browser cache the images.
22458
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
22459
+ * does under `'suggestionConfidence'`.
22329
22460
  *
22330
- * **This is an INPUT field, so it does not reach the addon until the
22331
- * next train.** The hub router validates cap inputs against its own
22332
- * compiled Zod, which strips a key it does not know verified today
22333
- * on the OUTPUT side, where an additive field DOES arrive immediately
22334
- * (`Track.hasFace`). Until the train ships, sending `false` is
22335
- * harmless and simply keeps the crops inline.
22461
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
22462
+ * index and stops reading as soon as `limit` rows have PASSED the
22463
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
22464
+ * certain row may be the oldest so it walks the window. Narrow it
22465
+ * with {@link since} / {@link until}.
22466
+ */
22467
+ sortBy: FaceSortFieldEnum.optional(),
22468
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
22469
+ sortDirection: FaceSortDirectionEnum.optional(),
22470
+ /**
22471
+ * Inline the base64 crop on every row.
22472
+ *
22473
+ * Default `false` since the 2026-08-25 inversion — see
22474
+ * `include-crops-default.ts`, which is the ONE place that resolves
22475
+ * this for every gallery, and which records why the inline shape had
22476
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
22477
+ * The doc here used to still say `true`; it was wrong, and a leftover
22478
+ * that describes the old design reads as permission to rely on it.
22479
+ *
22480
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
22481
+ * which the browser fetches off the `event-media` plane in parallel,
22482
+ * cached and ETagged.
22336
22483
  */
22337
22484
  includeCrops: boolean().optional()
22338
22485
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -22368,13 +22515,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
22368
22515
  }), method(object({
22369
22516
  threshold: number().min(0).max(1).optional(),
22370
22517
  minClusterSize: number().int().min(2).optional(),
22371
- limit: number().int().positive().optional()
22372
- }).optional(), array(object({
22373
- faceIds: array(string()).readonly(),
22374
- representativeFaceId: string(),
22375
- size: number().int(),
22376
- cohesion: number()
22377
- })).readonly());
22518
+ /**
22519
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
22520
+ * which read as though it bounded the work — it never did.
22521
+ *
22522
+ * Wins over {@link limit} when both are sent.
22523
+ */
22524
+ maxClusters: number().int().positive().optional(),
22525
+ /**
22526
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
22527
+ * RESULT, not the scan. Kept so existing callers keep working; send
22528
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
22529
+ */
22530
+ limit: number().int().positive().optional(),
22531
+ /**
22532
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
22533
+ * POOL, not the result.
22534
+ *
22535
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
22536
+ * used to read every unassigned face on the hub no matter what the
22537
+ * caller asked for, because the only bound cut the finished clusters
22538
+ * afterwards; a UI showing a window of 100 paid for a scan of the
22539
+ * whole corpus, on an addon whose disk is under contention.
22540
+ *
22541
+ * The pool is the NEWEST matching faces first — the same order the
22542
+ * gallery shows — so a bound here shortens the horizon, it does not
22543
+ * sample it randomly.
22544
+ *
22545
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
22546
+ * so the live corpus — 372 face rows — is unaffected while the
22547
+ * unbounded scan can never come back as the table grows.
22548
+ */
22549
+ maxFacesScanned: number().int().positive().optional()
22550
+ }).optional(), array(FaceClusterSchema).readonly());
22378
22551
  /**
22379
22552
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
22380
22553
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -26139,6 +26312,211 @@ var SetSiteLocationInputSchema = object({
26139
26312
  latitude: number().min(-90).max(90),
26140
26313
  longitude: number().min(-180).max(180)
26141
26314
  }).nullable();
26315
+ /**
26316
+ * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
26317
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26318
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26319
+ * already prints - never a token, never an `Authorization` header.
26320
+ */
26321
+ var RequestCensusGroupSchema = object({
26322
+ procedure: string(),
26323
+ userAgent: string(),
26324
+ ip: string(),
26325
+ principal: string(),
26326
+ calls: number(),
26327
+ perMin: number()
26328
+ });
26329
+ /**
26330
+ * A procedure's TOTAL over the window, across every caller.
26331
+ *
26332
+ * This block, not the group list, is what answers "did these calls arrive over
26333
+ * HTTP at all". A total far BELOW what a store-side census counted over the
26334
+ * same window excludes the HTTP plane, which is a result, not a failure.
26335
+ */
26336
+ var RequestCensusProcedureSchema = object({
26337
+ procedure: string(),
26338
+ calls: number(),
26339
+ perMin: number()
26340
+ });
26341
+ /**
26342
+ * The census as an operator sees it.
26343
+ *
26344
+ * `persisted` is the honest answer to "will this survive the restart I am
26345
+ * about to do": the arm deadline is written to `system-settings` so a window
26346
+ * armed now can measure the NEXT boot, and a write that failed must not look
26347
+ * like one that succeeded.
26348
+ */
26349
+ var RequestCensusStatusSchema = object({
26350
+ armed: boolean(),
26351
+ /** How long the current - or just-closed - window collected, in ms. */
26352
+ elapsedMs: number(),
26353
+ /** The window actually armed, after the server clamped the request. */
26354
+ windowMs: number(),
26355
+ /** Epoch ms the window closes at. 0 when disarmed. */
26356
+ armedUntilMs: number(),
26357
+ httpRequests: number(),
26358
+ batchedRequests: number(),
26359
+ /**
26360
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
26361
+ * is in play (`?batch=1` carries several procedures in one request); this is
26362
+ * the number comparable with a store-side call count.
26363
+ */
26364
+ procedureCalls: number(),
26365
+ /**
26366
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
26367
+ * transport resolves one context per connection - but the number that says
26368
+ * whether a plane this census cannot see was busy while HTTP was quiet.
26369
+ */
26370
+ wsConnections: number(),
26371
+ distinctGroups: number(),
26372
+ /** Calls counted in the totals whose group attribution was shed at the
26373
+ * cardinality bound. */
26374
+ unattributedCalls: number(),
26375
+ procedures: array(RequestCensusProcedureSchema).readonly(),
26376
+ groups: array(RequestCensusGroupSchema).readonly()
26377
+ }).extend({ persisted: boolean() });
26378
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
26379
+ var LogLevelSchema$1 = _enum([
26380
+ "debug",
26381
+ "info",
26382
+ "warn",
26383
+ "error"
26384
+ ]);
26385
+ /**
26386
+ * The diagnostics that can be ARMED for a window. Exactly one today.
26387
+ *
26388
+ * A diagnostic is anything whose cost is only worth paying while a question is
26389
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
26390
+ */
26391
+ var DiagnosticIdSchema = _enum(["request-census"]);
26392
+ /**
26393
+ * The layers of the level hierarchy, general → specific. The most specific
26394
+ * layer that carries an explicit value wins.
26395
+ *
26396
+ * `component` is DECLARED and not yet resolvable: the per-component channels
26397
+ * are a later slice of the same plan, and a `levelSource` enum that has to
26398
+ * grow later would force every consumer of this document to change with it.
26399
+ * Nothing returns `component` today.
26400
+ */
26401
+ var LoggingScopeKindSchema = _enum([
26402
+ "cluster",
26403
+ "node",
26404
+ "component"
26405
+ ]);
26406
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
26407
+ var LoggingLevelSourceSchema = _enum([
26408
+ "default",
26409
+ "cluster",
26410
+ "node",
26411
+ "component"
26412
+ ]);
26413
+ /**
26414
+ * One layer of the hierarchy as it actually STANDS.
26415
+ *
26416
+ * `level: null` is the whole reason this array is returned: it is the
26417
+ * difference between "this node is at `info` because I decided it" and
26418
+ * "...because it inherits". An operator who clears an override believing they
26419
+ * are clearing an inherited value has been handed the same defect as the two
26420
+ * contradicting knobs this document exists to remove, moved one floor up.
26421
+ */
26422
+ var LoggingLevelLayerSchema = object({
26423
+ scope: LoggingScopeKindSchema,
26424
+ /** The node this layer speaks for; `null` on the cluster layer. */
26425
+ nodeId: string().nullable(),
26426
+ /** Explicitly set here, or `null` when this layer inherits. */
26427
+ level: LogLevelSchema$1.nullable()
26428
+ });
26429
+ /** What a line is judged against, and WHICH layer decided it. */
26430
+ var LoggingEffectiveSchema = object({
26431
+ level: LogLevelSchema$1,
26432
+ levelSource: LoggingLevelSourceSchema
26433
+ });
26434
+ /** Every layer, general → specific. Never collapsed into the effective value. */
26435
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
26436
+ /**
26437
+ * An armed diagnostic, with its DEADLINE.
26438
+ *
26439
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
26440
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
26441
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
26442
+ * `armed` is false — a window is never reported as slightly expired.
26443
+ */
26444
+ var DiagnosticWindowSchema = object({
26445
+ id: DiagnosticIdSchema,
26446
+ armed: boolean(),
26447
+ /** Epoch ms the window closes at. 0 when disarmed. */
26448
+ armedUntilMs: number(),
26449
+ /** Ms left before it expires on its own. 0 when disarmed. */
26450
+ remainingMs: number(),
26451
+ /** Whether the stored deadline is the one the live diagnostic is running —
26452
+ * i.e. whether this window would survive a restart. */
26453
+ persisted: boolean()
26454
+ });
26455
+ /**
26456
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
26457
+ * server — there is no maximum here on purpose: a bound repeated in a schema
26458
+ * is a second knob that disagrees with the first the day one of them moves.
26459
+ */
26460
+ var DiagnosticWindowPatchSchema = object({
26461
+ id: DiagnosticIdSchema,
26462
+ armMs: number().int().min(0),
26463
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
26464
+ reportEveryMs: number().int().positive().optional()
26465
+ });
26466
+ /**
26467
+ * A PATCH, and patches MERGE.
26468
+ *
26469
+ * A field absent from the patch is left exactly as it was — arming a
26470
+ * diagnostic never resets a level, and setting a level never disarms a window.
26471
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
26472
+ * `setAll` already merges, and rebuilding the object is how an absent field
26473
+ * turns into an erased one.
26474
+ */
26475
+ var LoggingSettingsPatchSchema = object({
26476
+ /**
26477
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
26478
+ * addressed scope so it inherits again. A value sets it.
26479
+ */
26480
+ level: LogLevelSchema$1.nullable().optional(),
26481
+ /**
26482
+ * Only the diagnostics NAMED here change. An armed window that is not listed
26483
+ * keeps running — a patch is never a full replacement.
26484
+ */
26485
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
26486
+ });
26487
+ /**
26488
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
26489
+ *
26490
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
26491
+ * input — the generated router strips it and uses it to resolve the PROVIDER
26492
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
26493
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
26494
+ * by an agent that holds no cluster document at all. The hub is the single
26495
+ * authority over the whole hierarchy and answers for every layer, so the
26496
+ * layer selector needs a name the transport does not already own.
26497
+ */
26498
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
26499
+ var SetLoggingSettingsInputSchema = object({
26500
+ scopeNodeId: string().optional(),
26501
+ patch: LoggingSettingsPatchSchema
26502
+ });
26503
+ /**
26504
+ * The whole document, as read and as returned after every write.
26505
+ *
26506
+ * `persisted: false` means the settings store could not be read or written.
26507
+ * The in-memory mirror still governs behaviour and is unchanged by the
26508
+ * failure — a read that fails neither switches a level nor disarms a window
26509
+ * (D49) — but the operator is told that what they are looking at would not
26510
+ * survive a restart.
26511
+ */
26512
+ var LoggingSettingsStateSchema = object({
26513
+ /** The layer this document was read at. `null` = the cluster layer. */
26514
+ scopeNodeId: string().nullable(),
26515
+ effective: LoggingEffectiveSchema,
26516
+ explicit: LoggingExplicitSchema,
26517
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
26518
+ persisted: boolean()
26519
+ });
26142
26520
  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(), {
26143
26521
  kind: "mutation",
26144
26522
  auth: "admin"
@@ -26151,6 +26529,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
26151
26529
  }), method(_void(), SiteLocationStatusSchema, {
26152
26530
  kind: "mutation",
26153
26531
  auth: "admin"
26532
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
26533
+ kind: "mutation",
26534
+ auth: "admin"
26154
26535
  });
26155
26536
  object({
26156
26537
  /** True when the device's tamper switch / case-open contact is
@@ -32392,6 +32773,18 @@ Object.freeze({
32392
32773
  addonId: null,
32393
32774
  access: "create"
32394
32775
  },
32776
+ "system.getLoggingSettings": {
32777
+ capName: "system",
32778
+ capScope: "system",
32779
+ addonId: null,
32780
+ access: "view"
32781
+ },
32782
+ "system.getRequestCensus": {
32783
+ capName: "system",
32784
+ capScope: "system",
32785
+ addonId: null,
32786
+ access: "view"
32787
+ },
32395
32788
  "system.getRetentionConfig": {
32396
32789
  capName: "system",
32397
32790
  capScope: "system",
@@ -32422,6 +32815,12 @@ Object.freeze({
32422
32815
  addonId: null,
32423
32816
  access: "view"
32424
32817
  },
32818
+ "system.setLoggingSettings": {
32819
+ capName: "system",
32820
+ capScope: "system",
32821
+ addonId: null,
32822
+ access: "create"
32823
+ },
32425
32824
  "system.setRetentionConfig": {
32426
32825
  capName: "system",
32427
32826
  capScope: "system",
@@ -33577,6 +33976,10 @@ Object.freeze({
33577
33976
  name: "deviceId",
33578
33977
  form: "single",
33579
33978
  optional: true
33979
+ }, {
33980
+ name: "deviceIds",
33981
+ form: "array",
33982
+ optional: true
33580
33983
  }],
33581
33984
  "fanControl.setDirection": [{
33582
33985
  name: "deviceId",
@@ -35187,7 +35590,38 @@ object({
35187
35590
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
35188
35591
  * reproduce that.
35189
35592
  */
35190
- tileBudgetMb: number().int().min(0).max(1024)
35593
+ tileBudgetMb: number().int().min(0).max(1024),
35594
+ /**
35595
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
35596
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
35597
+ * subject tiles, on frames that detected something.
35598
+ *
35599
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
35600
+ * containment is strict by design, so the native `keyFrame`, the detail
35601
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
35602
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
35603
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
35604
+ * frame-time after delivery, with the request only p50 367 ms behind it.
35605
+ *
35606
+ * Sizing, and why this is a budget and not a duration: a scene tile is
35607
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
35608
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
35609
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
35610
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
35611
+ * binds only through a detection burst, where it still covers well past the
35612
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
35613
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
35614
+ * whole shape exists to avoid.
35615
+ *
35616
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
35617
+ * subject tile, so one shared budget would let a busy camera's key frames
35618
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
35619
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
35620
+ * pre-existing behaviour, where a late full-frame request had nothing but the
35621
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
35622
+ * nothing.
35623
+ */
35624
+ sceneBudgetMb: number().int().min(0).max(1024)
35191
35625
  });
35192
35626
  /**
35193
35627
  * The values in force when the operator has set nothing.
@@ -35203,12 +35637,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
35203
35637
  budgetMb: 1024,
35204
35638
  activityMs: 15e3,
35205
35639
  tileBudgetMb: 64,
35640
+ sceneBudgetMb: 48,
35206
35641
  admission: "inferred"
35207
35642
  };
35208
35643
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
35209
35644
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
35210
35645
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
35211
35646
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
35647
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
35212
35648
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
35213
35649
  var MB = 1024 * 1024;
35214
35650
  1024 * MB, 3072 * MB;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-onvif",
3
- "version": "1.2.30",
3
+ "version": "1.2.31",
4
4
  "description": "ONVIF camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",