@camstack/addon-provider-hikvision 1.2.38 → 1.2.39

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
@@ -7521,6 +7521,66 @@ var OpsLogQueryInputSchema = object({
7521
7521
  /** Max rows returned, newest-first. */
7522
7522
  limit: number().int().min(1).max(1e3).optional()
7523
7523
  });
7524
+ var LabelDefinitionSchema = object({
7525
+ id: string(),
7526
+ name: string(),
7527
+ category: string().optional(),
7528
+ description: string().optional(),
7529
+ icon: string().optional()
7530
+ });
7531
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
7532
+ var CLASS_MAP_MACRO_TARGETS = [
7533
+ "person",
7534
+ "vehicle",
7535
+ "animal",
7536
+ "package"
7537
+ ];
7538
+ /**
7539
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
7540
+ * un operatore può selezionare.
7541
+ *
7542
+ * Sono le tre offerte dallo step `object-detection`
7543
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
7544
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
7545
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
7546
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
7547
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
7548
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
7549
+ *
7550
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
7551
+ * dello step e una seconda volta come union `FirstLevelMacro`
7552
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
7553
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
7554
+ * successiva.
7555
+ */
7556
+ var FIRST_LEVEL_MACRO_CLASSES = [
7557
+ "person",
7558
+ "vehicle",
7559
+ "animal"
7560
+ ];
7561
+ /**
7562
+ * Wire schema for a per-model CATALOG classMap override
7563
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
7564
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
7565
+ * detection pipeline executor actually routes.
7566
+ *
7567
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
7568
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
7569
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
7570
+ * enum) — the two used to share the name `ClassMapDefinition`/
7571
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
7572
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
7573
+ * are not: it is two different concepts colliding on a name. Keep this type
7574
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
7575
+ * would either narrow every `ClassMapDefinition` consumer to the four
7576
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
7577
+ * schema exists for (see the "rejects a classMap whose target is not a
7578
+ * detection macro" test in `model-catalog-schema.test.ts`).
7579
+ */
7580
+ var DetectionCatalogClassMapSchema = object({
7581
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
7582
+ preserveOriginal: boolean()
7583
+ });
7524
7584
  /**
7525
7585
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
7526
7586
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -7543,10 +7603,55 @@ var RecordingStorageModeSchema = _enum([
7543
7603
  "events",
7544
7604
  "continuous"
7545
7605
  ]);
7606
+ /**
7607
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
7608
+ * tre offerte dallo step `object-detection`, da UNA lista
7609
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
7610
+ */
7611
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
7612
+ /**
7613
+ * True quando `values` non ripete un elemento.
7614
+ *
7615
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
7616
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
7617
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
7618
+ */
7619
+ var noDuplicates = (values) => new Set(values).size === values.length;
7546
7620
  /** Which detectors trigger an `events`-mode band. */
7547
7621
  var RecordingTriggersSchema = object({
7548
7622
  motion: boolean().optional(),
7549
- audioThresholdDbfs: number().optional()
7623
+ audioThresholdDbfs: number().optional(),
7624
+ /**
7625
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
7626
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
7627
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
7628
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
7629
+ *
7630
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
7631
+ * quelle che hanno attraversato `enabledMacroClasses`, i
7632
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
7633
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
7634
+ * finestre — vedi `recorder/object-trigger.ts`.
7635
+ */
7636
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
7637
+ /**
7638
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
7639
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
7640
+ * `objectClasses`.
7641
+ *
7642
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
7643
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
7644
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
7645
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
7646
+ * device (D12) — mai un elenco globale di cap.
7647
+ *
7648
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
7649
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
7650
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
7651
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
7652
+ * registrare.
7653
+ */
7654
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7550
7655
  });
7551
7656
  /**
7552
7657
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8173,41 +8278,6 @@ var TIMEZONES = [
8173
8278
  function findTimezone(id) {
8174
8279
  return TIMEZONES.find((tz) => tz.id === id);
8175
8280
  }
8176
- var LabelDefinitionSchema = object({
8177
- id: string(),
8178
- name: string(),
8179
- category: string().optional(),
8180
- description: string().optional(),
8181
- icon: string().optional()
8182
- });
8183
- /**
8184
- * Wire schema for a per-model CATALOG classMap override
8185
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8186
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8187
- * detection pipeline executor actually routes.
8188
- *
8189
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8190
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8191
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8192
- * enum) — the two used to share the name `ClassMapDefinition`/
8193
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8194
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8195
- * are not: it is two different concepts colliding on a name. Keep this type
8196
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8197
- * would either narrow every `ClassMapDefinition` consumer to the four
8198
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8199
- * schema exists for (see the "rejects a classMap whose target is not a
8200
- * detection macro" test in `model-catalog-schema.test.ts`).
8201
- */
8202
- var DetectionCatalogClassMapSchema = object({
8203
- mapping: record(string(), _enum([
8204
- "person",
8205
- "vehicle",
8206
- "animal",
8207
- "package"
8208
- ])),
8209
- preserveOriginal: boolean()
8210
- });
8211
8281
  var MODEL_FORMATS = [
8212
8282
  "onnx",
8213
8283
  "coreml",
@@ -21439,7 +21509,7 @@ var lifecycleJobSchema = object({
21439
21509
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21440
21510
  * as every other cap.
21441
21511
  */
21442
- var LogLevelSchema$1 = _enum([
21512
+ var LogLevelSchema$2 = _enum([
21443
21513
  "debug",
21444
21514
  "info",
21445
21515
  "warn",
@@ -21646,7 +21716,7 @@ var CustomActionInputSchema = object({
21646
21716
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21647
21717
  addonId: string(),
21648
21718
  limit: number().min(1).max(500).default(100),
21649
- level: LogLevelSchema$1.optional()
21719
+ level: LogLevelSchema$2.optional()
21650
21720
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21651
21721
  packageName: string(),
21652
21722
  version: string().optional()
@@ -21744,7 +21814,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21744
21814
  auth: "admin"
21745
21815
  }), method(object({
21746
21816
  addonId: string(),
21747
- level: LogLevelSchema$1.optional()
21817
+ level: LogLevelSchema$2.optional()
21748
21818
  }), LogStreamEntrySchema, { kind: "subscription" });
21749
21819
  /**
21750
21820
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -23468,6 +23538,35 @@ var FaceFilterEnum = _enum([
23468
23538
  "identified",
23469
23539
  "all"
23470
23540
  ]);
23541
+ /**
23542
+ * What a `listRecentFaces` page is ORDERED BY.
23543
+ *
23544
+ * - `timestamp` — when the face was seen. The historical (and default) order.
23545
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
23546
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
23547
+ * order: it puts the suggestions an operator can confirm with one tap at the
23548
+ * top, and it is the reason this enum exists — a client that ranked a capped
23549
+ * page client-side was ranking the newest N, never the most certain N.
23550
+ *
23551
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
23552
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
23553
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
23554
+ * — flipping the direction reorders the rows that HAVE a certainty and never
23555
+ * floods the page with the ones that do not. `addon-post-analysis`'s
23556
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
23557
+ * then by faceId, and is what makes this a total order instead of the
23558
+ * backend's NULL-collation accident.
23559
+ */
23560
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
23561
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
23562
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
23563
+ * never leaves the server. */
23564
+ var FaceClusterSchema = object({
23565
+ faceIds: array(string()).readonly(),
23566
+ representativeFaceId: string(),
23567
+ size: number().int(),
23568
+ cohesion: number()
23569
+ });
23471
23570
  var MediaFileLiteSchema$1 = object({
23472
23571
  key: string(),
23473
23572
  kind: string(),
@@ -23514,24 +23613,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23514
23613
  kind: "mutation",
23515
23614
  auth: "admin"
23516
23615
  }), method(object({
23517
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
23616
+ /**
23617
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
23618
+ *
23619
+ * The legacy single-camera form, kept verbatim for every caller that
23620
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
23621
+ * instead — never both: `deviceIds` is the authority whenever it is
23622
+ * present, and this field is then ignored rather than unioned, so
23623
+ * there is exactly one answer to "which cameras did I ask for".
23624
+ */
23518
23625
  deviceId: number().int().optional(),
23626
+ /**
23627
+ * Restrict to a SET of cameras — the review UI's camera filter, which
23628
+ * until now had to fetch the cluster-wide page and drop rows in the
23629
+ * client (so the `limit` it asked for was spent on cameras it was
23630
+ * about to discard).
23631
+ *
23632
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
23633
+ * "every camera". A request for no devices is a request, not an
23634
+ * omission; same contract as `deviceManager.listFleet` and
23635
+ * `pipelineAnalytics.listRecentTracks`.
23636
+ *
23637
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
23638
+ */
23639
+ deviceIds: array(number().int()).optional(),
23519
23640
  limit: number().int().positive().optional(),
23520
23641
  filter: FaceFilterEnum.optional(),
23521
23642
  /**
23522
- * Inline the base64 crop on every row. Default `true` — the existing
23523
- * behaviour, kept so no caller breaks.
23643
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23644
+ * Absent means no lower bound.
23645
+ */
23646
+ since: number().int().optional(),
23647
+ /**
23648
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23649
+ * Absent means no upper bound.
23650
+ */
23651
+ until: number().int().optional(),
23652
+ /**
23653
+ * Order the page by time or by suggestion certainty. Default
23654
+ * `'timestamp'` — the historical order, unchanged for every caller
23655
+ * that does not ask.
23524
23656
  *
23525
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
23526
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
23527
- * the browser cache the images.
23657
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
23658
+ * does under `'suggestionConfidence'`.
23528
23659
  *
23529
- * **This is an INPUT field, so it does not reach the addon until the
23530
- * next train.** The hub router validates cap inputs against its own
23531
- * compiled Zod, which strips a key it does not know verified today
23532
- * on the OUTPUT side, where an additive field DOES arrive immediately
23533
- * (`Track.hasFace`). Until the train ships, sending `false` is
23534
- * harmless and simply keeps the crops inline.
23660
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
23661
+ * index and stops reading as soon as `limit` rows have PASSED the
23662
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
23663
+ * certain row may be the oldest so it walks the window. Narrow it
23664
+ * with {@link since} / {@link until}.
23665
+ */
23666
+ sortBy: FaceSortFieldEnum.optional(),
23667
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
23668
+ sortDirection: FaceSortDirectionEnum.optional(),
23669
+ /**
23670
+ * Inline the base64 crop on every row.
23671
+ *
23672
+ * Default `false` since the 2026-08-25 inversion — see
23673
+ * `include-crops-default.ts`, which is the ONE place that resolves
23674
+ * this for every gallery, and which records why the inline shape had
23675
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
23676
+ * The doc here used to still say `true`; it was wrong, and a leftover
23677
+ * that describes the old design reads as permission to rely on it.
23678
+ *
23679
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
23680
+ * which the browser fetches off the `event-media` plane in parallel,
23681
+ * cached and ETagged.
23535
23682
  */
23536
23683
  includeCrops: boolean().optional()
23537
23684
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -23567,13 +23714,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23567
23714
  }), method(object({
23568
23715
  threshold: number().min(0).max(1).optional(),
23569
23716
  minClusterSize: number().int().min(2).optional(),
23570
- limit: number().int().positive().optional()
23571
- }).optional(), array(object({
23572
- faceIds: array(string()).readonly(),
23573
- representativeFaceId: string(),
23574
- size: number().int(),
23575
- cohesion: number()
23576
- })).readonly());
23717
+ /**
23718
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
23719
+ * which read as though it bounded the work — it never did.
23720
+ *
23721
+ * Wins over {@link limit} when both are sent.
23722
+ */
23723
+ maxClusters: number().int().positive().optional(),
23724
+ /**
23725
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
23726
+ * RESULT, not the scan. Kept so existing callers keep working; send
23727
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
23728
+ */
23729
+ limit: number().int().positive().optional(),
23730
+ /**
23731
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
23732
+ * POOL, not the result.
23733
+ *
23734
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
23735
+ * used to read every unassigned face on the hub no matter what the
23736
+ * caller asked for, because the only bound cut the finished clusters
23737
+ * afterwards; a UI showing a window of 100 paid for a scan of the
23738
+ * whole corpus, on an addon whose disk is under contention.
23739
+ *
23740
+ * The pool is the NEWEST matching faces first — the same order the
23741
+ * gallery shows — so a bound here shortens the horizon, it does not
23742
+ * sample it randomly.
23743
+ *
23744
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
23745
+ * so the live corpus — 372 face rows — is unaffected while the
23746
+ * unbounded scan can never come back as the table grows.
23747
+ */
23748
+ maxFacesScanned: number().int().positive().optional()
23749
+ }).optional(), array(FaceClusterSchema).readonly());
23577
23750
  /**
23578
23751
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
23579
23752
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -28846,6 +29019,211 @@ var SetSiteLocationInputSchema = object({
28846
29019
  latitude: number().min(-90).max(90),
28847
29020
  longitude: number().min(-180).max(180)
28848
29021
  }).nullable();
29022
+ /**
29023
+ * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
29024
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29025
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29026
+ * already prints - never a token, never an `Authorization` header.
29027
+ */
29028
+ var RequestCensusGroupSchema = object({
29029
+ procedure: string(),
29030
+ userAgent: string(),
29031
+ ip: string(),
29032
+ principal: string(),
29033
+ calls: number(),
29034
+ perMin: number()
29035
+ });
29036
+ /**
29037
+ * A procedure's TOTAL over the window, across every caller.
29038
+ *
29039
+ * This block, not the group list, is what answers "did these calls arrive over
29040
+ * HTTP at all". A total far BELOW what a store-side census counted over the
29041
+ * same window excludes the HTTP plane, which is a result, not a failure.
29042
+ */
29043
+ var RequestCensusProcedureSchema = object({
29044
+ procedure: string(),
29045
+ calls: number(),
29046
+ perMin: number()
29047
+ });
29048
+ /**
29049
+ * The census as an operator sees it.
29050
+ *
29051
+ * `persisted` is the honest answer to "will this survive the restart I am
29052
+ * about to do": the arm deadline is written to `system-settings` so a window
29053
+ * armed now can measure the NEXT boot, and a write that failed must not look
29054
+ * like one that succeeded.
29055
+ */
29056
+ var RequestCensusStatusSchema = object({
29057
+ armed: boolean(),
29058
+ /** How long the current - or just-closed - window collected, in ms. */
29059
+ elapsedMs: number(),
29060
+ /** The window actually armed, after the server clamped the request. */
29061
+ windowMs: number(),
29062
+ /** Epoch ms the window closes at. 0 when disarmed. */
29063
+ armedUntilMs: number(),
29064
+ httpRequests: number(),
29065
+ batchedRequests: number(),
29066
+ /**
29067
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
29068
+ * is in play (`?batch=1` carries several procedures in one request); this is
29069
+ * the number comparable with a store-side call count.
29070
+ */
29071
+ procedureCalls: number(),
29072
+ /**
29073
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
29074
+ * transport resolves one context per connection - but the number that says
29075
+ * whether a plane this census cannot see was busy while HTTP was quiet.
29076
+ */
29077
+ wsConnections: number(),
29078
+ distinctGroups: number(),
29079
+ /** Calls counted in the totals whose group attribution was shed at the
29080
+ * cardinality bound. */
29081
+ unattributedCalls: number(),
29082
+ procedures: array(RequestCensusProcedureSchema).readonly(),
29083
+ groups: array(RequestCensusGroupSchema).readonly()
29084
+ }).extend({ persisted: boolean() });
29085
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
29086
+ var LogLevelSchema$1 = _enum([
29087
+ "debug",
29088
+ "info",
29089
+ "warn",
29090
+ "error"
29091
+ ]);
29092
+ /**
29093
+ * The diagnostics that can be ARMED for a window. Exactly one today.
29094
+ *
29095
+ * A diagnostic is anything whose cost is only worth paying while a question is
29096
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
29097
+ */
29098
+ var DiagnosticIdSchema = _enum(["request-census"]);
29099
+ /**
29100
+ * The layers of the level hierarchy, general → specific. The most specific
29101
+ * layer that carries an explicit value wins.
29102
+ *
29103
+ * `component` is DECLARED and not yet resolvable: the per-component channels
29104
+ * are a later slice of the same plan, and a `levelSource` enum that has to
29105
+ * grow later would force every consumer of this document to change with it.
29106
+ * Nothing returns `component` today.
29107
+ */
29108
+ var LoggingScopeKindSchema = _enum([
29109
+ "cluster",
29110
+ "node",
29111
+ "component"
29112
+ ]);
29113
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
29114
+ var LoggingLevelSourceSchema = _enum([
29115
+ "default",
29116
+ "cluster",
29117
+ "node",
29118
+ "component"
29119
+ ]);
29120
+ /**
29121
+ * One layer of the hierarchy as it actually STANDS.
29122
+ *
29123
+ * `level: null` is the whole reason this array is returned: it is the
29124
+ * difference between "this node is at `info` because I decided it" and
29125
+ * "...because it inherits". An operator who clears an override believing they
29126
+ * are clearing an inherited value has been handed the same defect as the two
29127
+ * contradicting knobs this document exists to remove, moved one floor up.
29128
+ */
29129
+ var LoggingLevelLayerSchema = object({
29130
+ scope: LoggingScopeKindSchema,
29131
+ /** The node this layer speaks for; `null` on the cluster layer. */
29132
+ nodeId: string().nullable(),
29133
+ /** Explicitly set here, or `null` when this layer inherits. */
29134
+ level: LogLevelSchema$1.nullable()
29135
+ });
29136
+ /** What a line is judged against, and WHICH layer decided it. */
29137
+ var LoggingEffectiveSchema = object({
29138
+ level: LogLevelSchema$1,
29139
+ levelSource: LoggingLevelSourceSchema
29140
+ });
29141
+ /** Every layer, general → specific. Never collapsed into the effective value. */
29142
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
29143
+ /**
29144
+ * An armed diagnostic, with its DEADLINE.
29145
+ *
29146
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
29147
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
29148
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
29149
+ * `armed` is false — a window is never reported as slightly expired.
29150
+ */
29151
+ var DiagnosticWindowSchema = object({
29152
+ id: DiagnosticIdSchema,
29153
+ armed: boolean(),
29154
+ /** Epoch ms the window closes at. 0 when disarmed. */
29155
+ armedUntilMs: number(),
29156
+ /** Ms left before it expires on its own. 0 when disarmed. */
29157
+ remainingMs: number(),
29158
+ /** Whether the stored deadline is the one the live diagnostic is running —
29159
+ * i.e. whether this window would survive a restart. */
29160
+ persisted: boolean()
29161
+ });
29162
+ /**
29163
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
29164
+ * server — there is no maximum here on purpose: a bound repeated in a schema
29165
+ * is a second knob that disagrees with the first the day one of them moves.
29166
+ */
29167
+ var DiagnosticWindowPatchSchema = object({
29168
+ id: DiagnosticIdSchema,
29169
+ armMs: number().int().min(0),
29170
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
29171
+ reportEveryMs: number().int().positive().optional()
29172
+ });
29173
+ /**
29174
+ * A PATCH, and patches MERGE.
29175
+ *
29176
+ * A field absent from the patch is left exactly as it was — arming a
29177
+ * diagnostic never resets a level, and setting a level never disarms a window.
29178
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
29179
+ * `setAll` already merges, and rebuilding the object is how an absent field
29180
+ * turns into an erased one.
29181
+ */
29182
+ var LoggingSettingsPatchSchema = object({
29183
+ /**
29184
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
29185
+ * addressed scope so it inherits again. A value sets it.
29186
+ */
29187
+ level: LogLevelSchema$1.nullable().optional(),
29188
+ /**
29189
+ * Only the diagnostics NAMED here change. An armed window that is not listed
29190
+ * keeps running — a patch is never a full replacement.
29191
+ */
29192
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29193
+ });
29194
+ /**
29195
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
29196
+ *
29197
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
29198
+ * input — the generated router strips it and uses it to resolve the PROVIDER
29199
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
29200
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
29201
+ * by an agent that holds no cluster document at all. The hub is the single
29202
+ * authority over the whole hierarchy and answers for every layer, so the
29203
+ * layer selector needs a name the transport does not already own.
29204
+ */
29205
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29206
+ var SetLoggingSettingsInputSchema = object({
29207
+ scopeNodeId: string().optional(),
29208
+ patch: LoggingSettingsPatchSchema
29209
+ });
29210
+ /**
29211
+ * The whole document, as read and as returned after every write.
29212
+ *
29213
+ * `persisted: false` means the settings store could not be read or written.
29214
+ * The in-memory mirror still governs behaviour and is unchanged by the
29215
+ * failure — a read that fails neither switches a level nor disarms a window
29216
+ * (D49) — but the operator is told that what they are looking at would not
29217
+ * survive a restart.
29218
+ */
29219
+ var LoggingSettingsStateSchema = object({
29220
+ /** The layer this document was read at. `null` = the cluster layer. */
29221
+ scopeNodeId: string().nullable(),
29222
+ effective: LoggingEffectiveSchema,
29223
+ explicit: LoggingExplicitSchema,
29224
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
29225
+ persisted: boolean()
29226
+ });
28849
29227
  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(), {
28850
29228
  kind: "mutation",
28851
29229
  auth: "admin"
@@ -28858,6 +29236,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28858
29236
  }), method(_void(), SiteLocationStatusSchema, {
28859
29237
  kind: "mutation",
28860
29238
  auth: "admin"
29239
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29240
+ kind: "mutation",
29241
+ auth: "admin"
28861
29242
  });
28862
29243
  /**
28863
29244
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -36330,6 +36711,18 @@ Object.freeze({
36330
36711
  addonId: null,
36331
36712
  access: "create"
36332
36713
  },
36714
+ "system.getLoggingSettings": {
36715
+ capName: "system",
36716
+ capScope: "system",
36717
+ addonId: null,
36718
+ access: "view"
36719
+ },
36720
+ "system.getRequestCensus": {
36721
+ capName: "system",
36722
+ capScope: "system",
36723
+ addonId: null,
36724
+ access: "view"
36725
+ },
36333
36726
  "system.getRetentionConfig": {
36334
36727
  capName: "system",
36335
36728
  capScope: "system",
@@ -36360,6 +36753,12 @@ Object.freeze({
36360
36753
  addonId: null,
36361
36754
  access: "view"
36362
36755
  },
36756
+ "system.setLoggingSettings": {
36757
+ capName: "system",
36758
+ capScope: "system",
36759
+ addonId: null,
36760
+ access: "create"
36761
+ },
36363
36762
  "system.setRetentionConfig": {
36364
36763
  capName: "system",
36365
36764
  capScope: "system",
@@ -37515,6 +37914,10 @@ Object.freeze({
37515
37914
  name: "deviceId",
37516
37915
  form: "single",
37517
37916
  optional: true
37917
+ }, {
37918
+ name: "deviceIds",
37919
+ form: "array",
37920
+ optional: true
37518
37921
  }],
37519
37922
  "fanControl.setDirection": [{
37520
37923
  name: "deviceId",
@@ -39125,7 +39528,38 @@ object({
39125
39528
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
39126
39529
  * reproduce that.
39127
39530
  */
39128
- tileBudgetMb: number().int().min(0).max(1024)
39531
+ tileBudgetMb: number().int().min(0).max(1024),
39532
+ /**
39533
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
39534
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
39535
+ * subject tiles, on frames that detected something.
39536
+ *
39537
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
39538
+ * containment is strict by design, so the native `keyFrame`, the detail
39539
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
39540
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
39541
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
39542
+ * frame-time after delivery, with the request only p50 367 ms behind it.
39543
+ *
39544
+ * Sizing, and why this is a budget and not a duration: a scene tile is
39545
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
39546
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
39547
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
39548
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
39549
+ * binds only through a detection burst, where it still covers well past the
39550
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
39551
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
39552
+ * whole shape exists to avoid.
39553
+ *
39554
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
39555
+ * subject tile, so one shared budget would let a busy camera's key frames
39556
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
39557
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
39558
+ * pre-existing behaviour, where a late full-frame request had nothing but the
39559
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
39560
+ * nothing.
39561
+ */
39562
+ sceneBudgetMb: number().int().min(0).max(1024)
39129
39563
  });
39130
39564
  /**
39131
39565
  * The values in force when the operator has set nothing.
@@ -39141,12 +39575,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
39141
39575
  budgetMb: 1024,
39142
39576
  activityMs: 15e3,
39143
39577
  tileBudgetMb: 64,
39578
+ sceneBudgetMb: 48,
39144
39579
  admission: "inferred"
39145
39580
  };
39146
39581
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
39147
39582
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
39148
39583
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
39149
39584
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
39585
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
39150
39586
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
39151
39587
  var MB = 1024 * 1024;
39152
39588
  1024 * MB, 3072 * MB;
package/dist/addon.mjs CHANGED
@@ -7522,6 +7522,66 @@ var OpsLogQueryInputSchema = object({
7522
7522
  /** Max rows returned, newest-first. */
7523
7523
  limit: number().int().min(1).max(1e3).optional()
7524
7524
  });
7525
+ var LabelDefinitionSchema = object({
7526
+ id: string(),
7527
+ name: string(),
7528
+ category: string().optional(),
7529
+ description: string().optional(),
7530
+ icon: string().optional()
7531
+ });
7532
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
7533
+ var CLASS_MAP_MACRO_TARGETS = [
7534
+ "person",
7535
+ "vehicle",
7536
+ "animal",
7537
+ "package"
7538
+ ];
7539
+ /**
7540
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
7541
+ * un operatore può selezionare.
7542
+ *
7543
+ * Sono le tre offerte dallo step `object-detection`
7544
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
7545
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
7546
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
7547
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
7548
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
7549
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
7550
+ *
7551
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
7552
+ * dello step e una seconda volta come union `FirstLevelMacro`
7553
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
7554
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
7555
+ * successiva.
7556
+ */
7557
+ var FIRST_LEVEL_MACRO_CLASSES = [
7558
+ "person",
7559
+ "vehicle",
7560
+ "animal"
7561
+ ];
7562
+ /**
7563
+ * Wire schema for a per-model CATALOG classMap override
7564
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
7565
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
7566
+ * detection pipeline executor actually routes.
7567
+ *
7568
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
7569
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
7570
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
7571
+ * enum) — the two used to share the name `ClassMapDefinition`/
7572
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
7573
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
7574
+ * are not: it is two different concepts colliding on a name. Keep this type
7575
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
7576
+ * would either narrow every `ClassMapDefinition` consumer to the four
7577
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
7578
+ * schema exists for (see the "rejects a classMap whose target is not a
7579
+ * detection macro" test in `model-catalog-schema.test.ts`).
7580
+ */
7581
+ var DetectionCatalogClassMapSchema = object({
7582
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
7583
+ preserveOriginal: boolean()
7584
+ });
7525
7585
  /**
7526
7586
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
7527
7587
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -7544,10 +7604,55 @@ var RecordingStorageModeSchema = _enum([
7544
7604
  "events",
7545
7605
  "continuous"
7546
7606
  ]);
7607
+ /**
7608
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
7609
+ * tre offerte dallo step `object-detection`, da UNA lista
7610
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
7611
+ */
7612
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
7613
+ /**
7614
+ * True quando `values` non ripete un elemento.
7615
+ *
7616
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
7617
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
7618
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
7619
+ */
7620
+ var noDuplicates = (values) => new Set(values).size === values.length;
7547
7621
  /** Which detectors trigger an `events`-mode band. */
7548
7622
  var RecordingTriggersSchema = object({
7549
7623
  motion: boolean().optional(),
7550
- audioThresholdDbfs: number().optional()
7624
+ audioThresholdDbfs: number().optional(),
7625
+ /**
7626
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
7627
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
7628
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
7629
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
7630
+ *
7631
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
7632
+ * quelle che hanno attraversato `enabledMacroClasses`, i
7633
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
7634
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
7635
+ * finestre — vedi `recorder/object-trigger.ts`.
7636
+ */
7637
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
7638
+ /**
7639
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
7640
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
7641
+ * `objectClasses`.
7642
+ *
7643
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
7644
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
7645
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
7646
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
7647
+ * device (D12) — mai un elenco globale di cap.
7648
+ *
7649
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
7650
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
7651
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
7652
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
7653
+ * registrare.
7654
+ */
7655
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7551
7656
  });
7552
7657
  /**
7553
7658
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8174,41 +8279,6 @@ var TIMEZONES = [
8174
8279
  function findTimezone(id) {
8175
8280
  return TIMEZONES.find((tz) => tz.id === id);
8176
8281
  }
8177
- var LabelDefinitionSchema = object({
8178
- id: string(),
8179
- name: string(),
8180
- category: string().optional(),
8181
- description: string().optional(),
8182
- icon: string().optional()
8183
- });
8184
- /**
8185
- * Wire schema for a per-model CATALOG classMap override
8186
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8187
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8188
- * detection pipeline executor actually routes.
8189
- *
8190
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8191
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8192
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8193
- * enum) — the two used to share the name `ClassMapDefinition`/
8194
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8195
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8196
- * are not: it is two different concepts colliding on a name. Keep this type
8197
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8198
- * would either narrow every `ClassMapDefinition` consumer to the four
8199
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8200
- * schema exists for (see the "rejects a classMap whose target is not a
8201
- * detection macro" test in `model-catalog-schema.test.ts`).
8202
- */
8203
- var DetectionCatalogClassMapSchema = object({
8204
- mapping: record(string(), _enum([
8205
- "person",
8206
- "vehicle",
8207
- "animal",
8208
- "package"
8209
- ])),
8210
- preserveOriginal: boolean()
8211
- });
8212
8282
  var MODEL_FORMATS = [
8213
8283
  "onnx",
8214
8284
  "coreml",
@@ -21440,7 +21510,7 @@ var lifecycleJobSchema = object({
21440
21510
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21441
21511
  * as every other cap.
21442
21512
  */
21443
- var LogLevelSchema$1 = _enum([
21513
+ var LogLevelSchema$2 = _enum([
21444
21514
  "debug",
21445
21515
  "info",
21446
21516
  "warn",
@@ -21647,7 +21717,7 @@ var CustomActionInputSchema = object({
21647
21717
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21648
21718
  addonId: string(),
21649
21719
  limit: number().min(1).max(500).default(100),
21650
- level: LogLevelSchema$1.optional()
21720
+ level: LogLevelSchema$2.optional()
21651
21721
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21652
21722
  packageName: string(),
21653
21723
  version: string().optional()
@@ -21745,7 +21815,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21745
21815
  auth: "admin"
21746
21816
  }), method(object({
21747
21817
  addonId: string(),
21748
- level: LogLevelSchema$1.optional()
21818
+ level: LogLevelSchema$2.optional()
21749
21819
  }), LogStreamEntrySchema, { kind: "subscription" });
21750
21820
  /**
21751
21821
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -23469,6 +23539,35 @@ var FaceFilterEnum = _enum([
23469
23539
  "identified",
23470
23540
  "all"
23471
23541
  ]);
23542
+ /**
23543
+ * What a `listRecentFaces` page is ORDERED BY.
23544
+ *
23545
+ * - `timestamp` — when the face was seen. The historical (and default) order.
23546
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
23547
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
23548
+ * order: it puts the suggestions an operator can confirm with one tap at the
23549
+ * top, and it is the reason this enum exists — a client that ranked a capped
23550
+ * page client-side was ranking the newest N, never the most certain N.
23551
+ *
23552
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
23553
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
23554
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
23555
+ * — flipping the direction reorders the rows that HAVE a certainty and never
23556
+ * floods the page with the ones that do not. `addon-post-analysis`'s
23557
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
23558
+ * then by faceId, and is what makes this a total order instead of the
23559
+ * backend's NULL-collation accident.
23560
+ */
23561
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
23562
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
23563
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
23564
+ * never leaves the server. */
23565
+ var FaceClusterSchema = object({
23566
+ faceIds: array(string()).readonly(),
23567
+ representativeFaceId: string(),
23568
+ size: number().int(),
23569
+ cohesion: number()
23570
+ });
23472
23571
  var MediaFileLiteSchema$1 = object({
23473
23572
  key: string(),
23474
23573
  kind: string(),
@@ -23515,24 +23614,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23515
23614
  kind: "mutation",
23516
23615
  auth: "admin"
23517
23616
  }), method(object({
23518
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
23617
+ /**
23618
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
23619
+ *
23620
+ * The legacy single-camera form, kept verbatim for every caller that
23621
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
23622
+ * instead — never both: `deviceIds` is the authority whenever it is
23623
+ * present, and this field is then ignored rather than unioned, so
23624
+ * there is exactly one answer to "which cameras did I ask for".
23625
+ */
23519
23626
  deviceId: number().int().optional(),
23627
+ /**
23628
+ * Restrict to a SET of cameras — the review UI's camera filter, which
23629
+ * until now had to fetch the cluster-wide page and drop rows in the
23630
+ * client (so the `limit` it asked for was spent on cameras it was
23631
+ * about to discard).
23632
+ *
23633
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
23634
+ * "every camera". A request for no devices is a request, not an
23635
+ * omission; same contract as `deviceManager.listFleet` and
23636
+ * `pipelineAnalytics.listRecentTracks`.
23637
+ *
23638
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
23639
+ */
23640
+ deviceIds: array(number().int()).optional(),
23520
23641
  limit: number().int().positive().optional(),
23521
23642
  filter: FaceFilterEnum.optional(),
23522
23643
  /**
23523
- * Inline the base64 crop on every row. Default `true` — the existing
23524
- * behaviour, kept so no caller breaks.
23644
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23645
+ * Absent means no lower bound.
23646
+ */
23647
+ since: number().int().optional(),
23648
+ /**
23649
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23650
+ * Absent means no upper bound.
23651
+ */
23652
+ until: number().int().optional(),
23653
+ /**
23654
+ * Order the page by time or by suggestion certainty. Default
23655
+ * `'timestamp'` — the historical order, unchanged for every caller
23656
+ * that does not ask.
23525
23657
  *
23526
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
23527
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
23528
- * the browser cache the images.
23658
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
23659
+ * does under `'suggestionConfidence'`.
23529
23660
  *
23530
- * **This is an INPUT field, so it does not reach the addon until the
23531
- * next train.** The hub router validates cap inputs against its own
23532
- * compiled Zod, which strips a key it does not know verified today
23533
- * on the OUTPUT side, where an additive field DOES arrive immediately
23534
- * (`Track.hasFace`). Until the train ships, sending `false` is
23535
- * harmless and simply keeps the crops inline.
23661
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
23662
+ * index and stops reading as soon as `limit` rows have PASSED the
23663
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
23664
+ * certain row may be the oldest so it walks the window. Narrow it
23665
+ * with {@link since} / {@link until}.
23666
+ */
23667
+ sortBy: FaceSortFieldEnum.optional(),
23668
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
23669
+ sortDirection: FaceSortDirectionEnum.optional(),
23670
+ /**
23671
+ * Inline the base64 crop on every row.
23672
+ *
23673
+ * Default `false` since the 2026-08-25 inversion — see
23674
+ * `include-crops-default.ts`, which is the ONE place that resolves
23675
+ * this for every gallery, and which records why the inline shape had
23676
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
23677
+ * The doc here used to still say `true`; it was wrong, and a leftover
23678
+ * that describes the old design reads as permission to rely on it.
23679
+ *
23680
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
23681
+ * which the browser fetches off the `event-media` plane in parallel,
23682
+ * cached and ETagged.
23536
23683
  */
23537
23684
  includeCrops: boolean().optional()
23538
23685
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -23568,13 +23715,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23568
23715
  }), method(object({
23569
23716
  threshold: number().min(0).max(1).optional(),
23570
23717
  minClusterSize: number().int().min(2).optional(),
23571
- limit: number().int().positive().optional()
23572
- }).optional(), array(object({
23573
- faceIds: array(string()).readonly(),
23574
- representativeFaceId: string(),
23575
- size: number().int(),
23576
- cohesion: number()
23577
- })).readonly());
23718
+ /**
23719
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
23720
+ * which read as though it bounded the work — it never did.
23721
+ *
23722
+ * Wins over {@link limit} when both are sent.
23723
+ */
23724
+ maxClusters: number().int().positive().optional(),
23725
+ /**
23726
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
23727
+ * RESULT, not the scan. Kept so existing callers keep working; send
23728
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
23729
+ */
23730
+ limit: number().int().positive().optional(),
23731
+ /**
23732
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
23733
+ * POOL, not the result.
23734
+ *
23735
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
23736
+ * used to read every unassigned face on the hub no matter what the
23737
+ * caller asked for, because the only bound cut the finished clusters
23738
+ * afterwards; a UI showing a window of 100 paid for a scan of the
23739
+ * whole corpus, on an addon whose disk is under contention.
23740
+ *
23741
+ * The pool is the NEWEST matching faces first — the same order the
23742
+ * gallery shows — so a bound here shortens the horizon, it does not
23743
+ * sample it randomly.
23744
+ *
23745
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
23746
+ * so the live corpus — 372 face rows — is unaffected while the
23747
+ * unbounded scan can never come back as the table grows.
23748
+ */
23749
+ maxFacesScanned: number().int().positive().optional()
23750
+ }).optional(), array(FaceClusterSchema).readonly());
23578
23751
  /**
23579
23752
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
23580
23753
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -28847,6 +29020,211 @@ var SetSiteLocationInputSchema = object({
28847
29020
  latitude: number().min(-90).max(90),
28848
29021
  longitude: number().min(-180).max(180)
28849
29022
  }).nullable();
29023
+ /**
29024
+ * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
29025
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29026
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29027
+ * already prints - never a token, never an `Authorization` header.
29028
+ */
29029
+ var RequestCensusGroupSchema = object({
29030
+ procedure: string(),
29031
+ userAgent: string(),
29032
+ ip: string(),
29033
+ principal: string(),
29034
+ calls: number(),
29035
+ perMin: number()
29036
+ });
29037
+ /**
29038
+ * A procedure's TOTAL over the window, across every caller.
29039
+ *
29040
+ * This block, not the group list, is what answers "did these calls arrive over
29041
+ * HTTP at all". A total far BELOW what a store-side census counted over the
29042
+ * same window excludes the HTTP plane, which is a result, not a failure.
29043
+ */
29044
+ var RequestCensusProcedureSchema = object({
29045
+ procedure: string(),
29046
+ calls: number(),
29047
+ perMin: number()
29048
+ });
29049
+ /**
29050
+ * The census as an operator sees it.
29051
+ *
29052
+ * `persisted` is the honest answer to "will this survive the restart I am
29053
+ * about to do": the arm deadline is written to `system-settings` so a window
29054
+ * armed now can measure the NEXT boot, and a write that failed must not look
29055
+ * like one that succeeded.
29056
+ */
29057
+ var RequestCensusStatusSchema = object({
29058
+ armed: boolean(),
29059
+ /** How long the current - or just-closed - window collected, in ms. */
29060
+ elapsedMs: number(),
29061
+ /** The window actually armed, after the server clamped the request. */
29062
+ windowMs: number(),
29063
+ /** Epoch ms the window closes at. 0 when disarmed. */
29064
+ armedUntilMs: number(),
29065
+ httpRequests: number(),
29066
+ batchedRequests: number(),
29067
+ /**
29068
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
29069
+ * is in play (`?batch=1` carries several procedures in one request); this is
29070
+ * the number comparable with a store-side call count.
29071
+ */
29072
+ procedureCalls: number(),
29073
+ /**
29074
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
29075
+ * transport resolves one context per connection - but the number that says
29076
+ * whether a plane this census cannot see was busy while HTTP was quiet.
29077
+ */
29078
+ wsConnections: number(),
29079
+ distinctGroups: number(),
29080
+ /** Calls counted in the totals whose group attribution was shed at the
29081
+ * cardinality bound. */
29082
+ unattributedCalls: number(),
29083
+ procedures: array(RequestCensusProcedureSchema).readonly(),
29084
+ groups: array(RequestCensusGroupSchema).readonly()
29085
+ }).extend({ persisted: boolean() });
29086
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
29087
+ var LogLevelSchema$1 = _enum([
29088
+ "debug",
29089
+ "info",
29090
+ "warn",
29091
+ "error"
29092
+ ]);
29093
+ /**
29094
+ * The diagnostics that can be ARMED for a window. Exactly one today.
29095
+ *
29096
+ * A diagnostic is anything whose cost is only worth paying while a question is
29097
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
29098
+ */
29099
+ var DiagnosticIdSchema = _enum(["request-census"]);
29100
+ /**
29101
+ * The layers of the level hierarchy, general → specific. The most specific
29102
+ * layer that carries an explicit value wins.
29103
+ *
29104
+ * `component` is DECLARED and not yet resolvable: the per-component channels
29105
+ * are a later slice of the same plan, and a `levelSource` enum that has to
29106
+ * grow later would force every consumer of this document to change with it.
29107
+ * Nothing returns `component` today.
29108
+ */
29109
+ var LoggingScopeKindSchema = _enum([
29110
+ "cluster",
29111
+ "node",
29112
+ "component"
29113
+ ]);
29114
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
29115
+ var LoggingLevelSourceSchema = _enum([
29116
+ "default",
29117
+ "cluster",
29118
+ "node",
29119
+ "component"
29120
+ ]);
29121
+ /**
29122
+ * One layer of the hierarchy as it actually STANDS.
29123
+ *
29124
+ * `level: null` is the whole reason this array is returned: it is the
29125
+ * difference between "this node is at `info` because I decided it" and
29126
+ * "...because it inherits". An operator who clears an override believing they
29127
+ * are clearing an inherited value has been handed the same defect as the two
29128
+ * contradicting knobs this document exists to remove, moved one floor up.
29129
+ */
29130
+ var LoggingLevelLayerSchema = object({
29131
+ scope: LoggingScopeKindSchema,
29132
+ /** The node this layer speaks for; `null` on the cluster layer. */
29133
+ nodeId: string().nullable(),
29134
+ /** Explicitly set here, or `null` when this layer inherits. */
29135
+ level: LogLevelSchema$1.nullable()
29136
+ });
29137
+ /** What a line is judged against, and WHICH layer decided it. */
29138
+ var LoggingEffectiveSchema = object({
29139
+ level: LogLevelSchema$1,
29140
+ levelSource: LoggingLevelSourceSchema
29141
+ });
29142
+ /** Every layer, general → specific. Never collapsed into the effective value. */
29143
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
29144
+ /**
29145
+ * An armed diagnostic, with its DEADLINE.
29146
+ *
29147
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
29148
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
29149
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
29150
+ * `armed` is false — a window is never reported as slightly expired.
29151
+ */
29152
+ var DiagnosticWindowSchema = object({
29153
+ id: DiagnosticIdSchema,
29154
+ armed: boolean(),
29155
+ /** Epoch ms the window closes at. 0 when disarmed. */
29156
+ armedUntilMs: number(),
29157
+ /** Ms left before it expires on its own. 0 when disarmed. */
29158
+ remainingMs: number(),
29159
+ /** Whether the stored deadline is the one the live diagnostic is running —
29160
+ * i.e. whether this window would survive a restart. */
29161
+ persisted: boolean()
29162
+ });
29163
+ /**
29164
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
29165
+ * server — there is no maximum here on purpose: a bound repeated in a schema
29166
+ * is a second knob that disagrees with the first the day one of them moves.
29167
+ */
29168
+ var DiagnosticWindowPatchSchema = object({
29169
+ id: DiagnosticIdSchema,
29170
+ armMs: number().int().min(0),
29171
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
29172
+ reportEveryMs: number().int().positive().optional()
29173
+ });
29174
+ /**
29175
+ * A PATCH, and patches MERGE.
29176
+ *
29177
+ * A field absent from the patch is left exactly as it was — arming a
29178
+ * diagnostic never resets a level, and setting a level never disarms a window.
29179
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
29180
+ * `setAll` already merges, and rebuilding the object is how an absent field
29181
+ * turns into an erased one.
29182
+ */
29183
+ var LoggingSettingsPatchSchema = object({
29184
+ /**
29185
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
29186
+ * addressed scope so it inherits again. A value sets it.
29187
+ */
29188
+ level: LogLevelSchema$1.nullable().optional(),
29189
+ /**
29190
+ * Only the diagnostics NAMED here change. An armed window that is not listed
29191
+ * keeps running — a patch is never a full replacement.
29192
+ */
29193
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29194
+ });
29195
+ /**
29196
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
29197
+ *
29198
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
29199
+ * input — the generated router strips it and uses it to resolve the PROVIDER
29200
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
29201
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
29202
+ * by an agent that holds no cluster document at all. The hub is the single
29203
+ * authority over the whole hierarchy and answers for every layer, so the
29204
+ * layer selector needs a name the transport does not already own.
29205
+ */
29206
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29207
+ var SetLoggingSettingsInputSchema = object({
29208
+ scopeNodeId: string().optional(),
29209
+ patch: LoggingSettingsPatchSchema
29210
+ });
29211
+ /**
29212
+ * The whole document, as read and as returned after every write.
29213
+ *
29214
+ * `persisted: false` means the settings store could not be read or written.
29215
+ * The in-memory mirror still governs behaviour and is unchanged by the
29216
+ * failure — a read that fails neither switches a level nor disarms a window
29217
+ * (D49) — but the operator is told that what they are looking at would not
29218
+ * survive a restart.
29219
+ */
29220
+ var LoggingSettingsStateSchema = object({
29221
+ /** The layer this document was read at. `null` = the cluster layer. */
29222
+ scopeNodeId: string().nullable(),
29223
+ effective: LoggingEffectiveSchema,
29224
+ explicit: LoggingExplicitSchema,
29225
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
29226
+ persisted: boolean()
29227
+ });
28850
29228
  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(), {
28851
29229
  kind: "mutation",
28852
29230
  auth: "admin"
@@ -28859,6 +29237,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28859
29237
  }), method(_void(), SiteLocationStatusSchema, {
28860
29238
  kind: "mutation",
28861
29239
  auth: "admin"
29240
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29241
+ kind: "mutation",
29242
+ auth: "admin"
28862
29243
  });
28863
29244
  /**
28864
29245
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -36331,6 +36712,18 @@ Object.freeze({
36331
36712
  addonId: null,
36332
36713
  access: "create"
36333
36714
  },
36715
+ "system.getLoggingSettings": {
36716
+ capName: "system",
36717
+ capScope: "system",
36718
+ addonId: null,
36719
+ access: "view"
36720
+ },
36721
+ "system.getRequestCensus": {
36722
+ capName: "system",
36723
+ capScope: "system",
36724
+ addonId: null,
36725
+ access: "view"
36726
+ },
36334
36727
  "system.getRetentionConfig": {
36335
36728
  capName: "system",
36336
36729
  capScope: "system",
@@ -36361,6 +36754,12 @@ Object.freeze({
36361
36754
  addonId: null,
36362
36755
  access: "view"
36363
36756
  },
36757
+ "system.setLoggingSettings": {
36758
+ capName: "system",
36759
+ capScope: "system",
36760
+ addonId: null,
36761
+ access: "create"
36762
+ },
36364
36763
  "system.setRetentionConfig": {
36365
36764
  capName: "system",
36366
36765
  capScope: "system",
@@ -37516,6 +37915,10 @@ Object.freeze({
37516
37915
  name: "deviceId",
37517
37916
  form: "single",
37518
37917
  optional: true
37918
+ }, {
37919
+ name: "deviceIds",
37920
+ form: "array",
37921
+ optional: true
37519
37922
  }],
37520
37923
  "fanControl.setDirection": [{
37521
37924
  name: "deviceId",
@@ -39126,7 +39529,38 @@ object({
39126
39529
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
39127
39530
  * reproduce that.
39128
39531
  */
39129
- tileBudgetMb: number().int().min(0).max(1024)
39532
+ tileBudgetMb: number().int().min(0).max(1024),
39533
+ /**
39534
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
39535
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
39536
+ * subject tiles, on frames that detected something.
39537
+ *
39538
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
39539
+ * containment is strict by design, so the native `keyFrame`, the detail
39540
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
39541
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
39542
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
39543
+ * frame-time after delivery, with the request only p50 367 ms behind it.
39544
+ *
39545
+ * Sizing, and why this is a budget and not a duration: a scene tile is
39546
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
39547
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
39548
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
39549
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
39550
+ * binds only through a detection burst, where it still covers well past the
39551
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
39552
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
39553
+ * whole shape exists to avoid.
39554
+ *
39555
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
39556
+ * subject tile, so one shared budget would let a busy camera's key frames
39557
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
39558
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
39559
+ * pre-existing behaviour, where a late full-frame request had nothing but the
39560
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
39561
+ * nothing.
39562
+ */
39563
+ sceneBudgetMb: number().int().min(0).max(1024)
39130
39564
  });
39131
39565
  /**
39132
39566
  * The values in force when the operator has set nothing.
@@ -39142,12 +39576,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
39142
39576
  budgetMb: 1024,
39143
39577
  activityMs: 15e3,
39144
39578
  tileBudgetMb: 64,
39579
+ sceneBudgetMb: 48,
39145
39580
  admission: "inferred"
39146
39581
  };
39147
39582
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
39148
39583
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
39149
39584
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
39150
39585
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
39586
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
39151
39587
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
39152
39588
  var MB = 1024 * 1024;
39153
39589
  1024 * MB, 3072 * MB;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-hikvision",
3
- "version": "1.2.38",
3
+ "version": "1.2.39",
4
4
  "description": "Hikvision camera device provider addon for CamStack — ISAPI over HTTP(S) with digest auth (snapshot, alarm stream, RTSP discovery)",
5
5
  "keywords": [
6
6
  "camstack",