@camstack/addon-provider-hikvision 1.2.37 → 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 +572 -61
  2. package/dist/addon.mjs +572 -61
  3. package/package.json +1 -1
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",
@@ -15965,7 +16035,23 @@ var NcHistoryEntrySchema = object({
15965
16035
  updatedAt: number(),
15966
16036
  /** Failure detail — present on a `dead` row. */
15967
16037
  error: string().optional(),
15968
- subject: NcHistorySubjectSchema
16038
+ subject: NcHistorySubjectSchema,
16039
+ /**
16040
+ * Ids of the artefacts (still, then gif, then clip) this row's successful
16041
+ * delivery indexed in the artefact library — a REFERENCE, never the bytes
16042
+ * (an artefact is often megabytes; this row is durable JSON rewritten on
16043
+ * every delivery attempt). Absent on a row still pending/dead, a row
16044
+ * delivered before this field shipped, or a wiring with no artefact index.
16045
+ *
16046
+ * Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
16047
+ * outlives any one URL's TTL, so a caller mints a fresh link on demand
16048
+ * rather than trusting one frozen at delivery time. `resolveArtifactUrl`
16049
+ * also answers `null` for an id whose artefact has since expired past the
16050
+ * retained shelf's own age bound — the degrade a caller (the Home
16051
+ * Assistant export) must render as "no image right now", never as a
16052
+ * broken link.
16053
+ */
16054
+ artifactIds: array(string().min(1)).optional()
15969
16055
  });
15970
16056
  /**
15971
16057
  * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
@@ -16192,7 +16278,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
16192
16278
  }), method(object({}), object({
16193
16279
  catalog: array(NcConditionDescriptorSchema),
16194
16280
  taxonomy: NcTaxonomySchema.optional()
16195
- })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
16281
+ })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
16196
16282
  kind: "mutation",
16197
16283
  caller: "required"
16198
16284
  }), method(object({ snoozeId: string() }), object({ success: literal(true) }), {
@@ -21424,7 +21510,7 @@ var lifecycleJobSchema = object({
21424
21510
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21425
21511
  * as every other cap.
21426
21512
  */
21427
- var LogLevelSchema$1 = _enum([
21513
+ var LogLevelSchema$2 = _enum([
21428
21514
  "debug",
21429
21515
  "info",
21430
21516
  "warn",
@@ -21631,7 +21717,7 @@ var CustomActionInputSchema = object({
21631
21717
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21632
21718
  addonId: string(),
21633
21719
  limit: number().min(1).max(500).default(100),
21634
- level: LogLevelSchema$1.optional()
21720
+ level: LogLevelSchema$2.optional()
21635
21721
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21636
21722
  packageName: string(),
21637
21723
  version: string().optional()
@@ -21729,7 +21815,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21729
21815
  auth: "admin"
21730
21816
  }), method(object({
21731
21817
  addonId: string(),
21732
- level: LogLevelSchema$1.optional()
21818
+ level: LogLevelSchema$2.optional()
21733
21819
  }), LogStreamEntrySchema, { kind: "subscription" });
21734
21820
  /**
21735
21821
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -23453,6 +23539,35 @@ var FaceFilterEnum = _enum([
23453
23539
  "identified",
23454
23540
  "all"
23455
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
+ });
23456
23571
  var MediaFileLiteSchema$1 = object({
23457
23572
  key: string(),
23458
23573
  kind: string(),
@@ -23499,24 +23614,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23499
23614
  kind: "mutation",
23500
23615
  auth: "admin"
23501
23616
  }), method(object({
23502
- /** 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
+ */
23503
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(),
23504
23641
  limit: number().int().positive().optional(),
23505
23642
  filter: FaceFilterEnum.optional(),
23506
23643
  /**
23507
- * Inline the base64 crop on every row. Default `true` — the existing
23508
- * 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.
23509
23657
  *
23510
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
23511
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
23512
- * the browser cache the images.
23658
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
23659
+ * does under `'suggestionConfidence'`.
23513
23660
  *
23514
- * **This is an INPUT field, so it does not reach the addon until the
23515
- * next train.** The hub router validates cap inputs against its own
23516
- * compiled Zod, which strips a key it does not know verified today
23517
- * on the OUTPUT side, where an additive field DOES arrive immediately
23518
- * (`Track.hasFace`). Until the train ships, sending `false` is
23519
- * 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.
23520
23683
  */
23521
23684
  includeCrops: boolean().optional()
23522
23685
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -23552,13 +23715,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23552
23715
  }), method(object({
23553
23716
  threshold: number().min(0).max(1).optional(),
23554
23717
  minClusterSize: number().int().min(2).optional(),
23555
- limit: number().int().positive().optional()
23556
- }).optional(), array(object({
23557
- faceIds: array(string()).readonly(),
23558
- representativeFaceId: string(),
23559
- size: number().int(),
23560
- cohesion: number()
23561
- })).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());
23562
23751
  /**
23563
23752
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
23564
23753
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -27449,6 +27638,39 @@ var ReadGopBytesResultSchema = object({
27449
27638
  /** Media ms the returned fragment covers. */
27450
27639
  gopDurMs: number()
27451
27640
  });
27641
+ /**
27642
+ * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
27643
+ * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
27644
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
27645
+ * a replay needs several seconds of native pixels, not one frame.
27646
+ *
27647
+ * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
27648
+ * is `false` when the returned bytes were cut short by the read's own safety
27649
+ * byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
27650
+ * silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
27651
+ * degradation: a window whose end falls past the covering segment would need
27652
+ * bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
27653
+ * not one standalone-demuxable stream — the caller's answer is to request a
27654
+ * shorter window or one aligned to a single segment, not to receive spliced
27655
+ * bytes nothing has proven decodable.
27656
+ */
27657
+ var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
27658
+ kind: literal("ok"),
27659
+ data: _instanceof(Uint8Array),
27660
+ /** Absolute epoch ms of the returned bytes' first sample — at or before
27661
+ * the requested `fromMs` (anchored on the nearest keyframe). */
27662
+ gopStartMs: number(),
27663
+ /** Media ms the returned bytes cover, from `gopStartMs`. */
27664
+ gopDurMs: number(),
27665
+ /** `false` ⇒ the safety byte cap cut the read short before it reached
27666
+ * the requested `toMs`; the caller got fewer frames than asked for. */
27667
+ reachesRequestedEnd: boolean()
27668
+ }), object({
27669
+ kind: literal("spans-multiple-segments"),
27670
+ /** Where the covering segment's own footage runs out — informational,
27671
+ * not a retry hint (retrying the same window would refuse again). */
27672
+ segmentEndMs: number()
27673
+ })]);
27452
27674
  method(object({
27453
27675
  deviceId: number(),
27454
27676
  fromMs: number(),
@@ -27499,6 +27721,15 @@ method(object({
27499
27721
  }), ReadGopBytesResultSchema, {
27500
27722
  kind: "query",
27501
27723
  auth: "admin"
27724
+ }), method(object({
27725
+ deviceId: number(),
27726
+ profile: string(),
27727
+ startMs: number(),
27728
+ fromMs: number(),
27729
+ toMs: number()
27730
+ }), ReadWindowBytesResultSchema, {
27731
+ kind: "query",
27732
+ auth: "admin"
27502
27733
  }), method(object({
27503
27734
  deviceId: number(),
27504
27735
  config: RecordingConfigSchema
@@ -28789,6 +29020,211 @@ var SetSiteLocationInputSchema = object({
28789
29020
  latitude: number().min(-90).max(90),
28790
29021
  longitude: number().min(-180).max(180)
28791
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
+ });
28792
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(), {
28793
29229
  kind: "mutation",
28794
29230
  auth: "admin"
@@ -28801,6 +29237,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28801
29237
  }), method(_void(), SiteLocationStatusSchema, {
28802
29238
  kind: "mutation",
28803
29239
  auth: "admin"
29240
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29241
+ kind: "mutation",
29242
+ auth: "admin"
28804
29243
  });
28805
29244
  /**
28806
29245
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -34017,6 +34456,12 @@ Object.freeze({
34017
34456
  addonId: null,
34018
34457
  access: "view"
34019
34458
  },
34459
+ "notificationRules.resolveArtifactUrl": {
34460
+ capName: "notification-rules",
34461
+ capScope: "system",
34462
+ addonId: null,
34463
+ access: "view"
34464
+ },
34020
34465
  "notificationRules.setAlarmConfig": {
34021
34466
  capName: "notification-rules",
34022
34467
  capScope: "system",
@@ -35421,6 +35866,12 @@ Object.freeze({
35421
35866
  addonId: null,
35422
35867
  access: "view"
35423
35868
  },
35869
+ "recording.readWindowBytes": {
35870
+ capName: "recording",
35871
+ capScope: "system",
35872
+ addonId: null,
35873
+ access: "view"
35874
+ },
35424
35875
  "recording.refreshStorageLocationsForMigration": {
35425
35876
  capName: "recording",
35426
35877
  capScope: "system",
@@ -36261,6 +36712,18 @@ Object.freeze({
36261
36712
  addonId: null,
36262
36713
  access: "create"
36263
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
+ },
36264
36727
  "system.getRetentionConfig": {
36265
36728
  capName: "system",
36266
36729
  capScope: "system",
@@ -36291,6 +36754,12 @@ Object.freeze({
36291
36754
  addonId: null,
36292
36755
  access: "view"
36293
36756
  },
36757
+ "system.setLoggingSettings": {
36758
+ capName: "system",
36759
+ capScope: "system",
36760
+ addonId: null,
36761
+ access: "create"
36762
+ },
36294
36763
  "system.setRetentionConfig": {
36295
36764
  capName: "system",
36296
36765
  capScope: "system",
@@ -37446,6 +37915,10 @@ Object.freeze({
37446
37915
  name: "deviceId",
37447
37916
  form: "single",
37448
37917
  optional: true
37918
+ }, {
37919
+ name: "deviceIds",
37920
+ form: "array",
37921
+ optional: true
37449
37922
  }],
37450
37923
  "fanControl.setDirection": [{
37451
37924
  name: "deviceId",
@@ -38251,6 +38724,11 @@ Object.freeze({
38251
38724
  form: "single",
38252
38725
  optional: false
38253
38726
  }],
38727
+ "recording.readWindowBytes": [{
38728
+ name: "deviceId",
38729
+ form: "single",
38730
+ optional: false
38731
+ }],
38254
38732
  "recording.relocateFootage": [{
38255
38733
  name: "deviceId",
38256
38734
  form: "single",
@@ -39051,7 +39529,38 @@ object({
39051
39529
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
39052
39530
  * reproduce that.
39053
39531
  */
39054
- 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)
39055
39564
  });
39056
39565
  /**
39057
39566
  * The values in force when the operator has set nothing.
@@ -39067,12 +39576,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
39067
39576
  budgetMb: 1024,
39068
39577
  activityMs: 15e3,
39069
39578
  tileBudgetMb: 64,
39579
+ sceneBudgetMb: 48,
39070
39580
  admission: "inferred"
39071
39581
  };
39072
39582
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
39073
39583
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
39074
39584
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
39075
39585
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
39586
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
39076
39587
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
39077
39588
  var MB = 1024 * 1024;
39078
39589
  1024 * MB, 3072 * MB;