@camstack/addon-post-analysis 1.2.129 → 1.2.131

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.
@@ -7749,6 +7749,66 @@ var OpsLogQueryInputSchema = object({
7749
7749
  /** Max rows returned, newest-first. */
7750
7750
  limit: number().int().min(1).max(1e3).optional()
7751
7751
  });
7752
+ var LabelDefinitionSchema = object({
7753
+ id: string(),
7754
+ name: string(),
7755
+ category: string().optional(),
7756
+ description: string().optional(),
7757
+ icon: string().optional()
7758
+ });
7759
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
7760
+ var CLASS_MAP_MACRO_TARGETS = [
7761
+ "person",
7762
+ "vehicle",
7763
+ "animal",
7764
+ "package"
7765
+ ];
7766
+ /**
7767
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
7768
+ * un operatore può selezionare.
7769
+ *
7770
+ * Sono le tre offerte dallo step `object-detection`
7771
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
7772
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
7773
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
7774
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
7775
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
7776
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
7777
+ *
7778
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
7779
+ * dello step e una seconda volta come union `FirstLevelMacro`
7780
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
7781
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
7782
+ * successiva.
7783
+ */
7784
+ var FIRST_LEVEL_MACRO_CLASSES = [
7785
+ "person",
7786
+ "vehicle",
7787
+ "animal"
7788
+ ];
7789
+ /**
7790
+ * Wire schema for a per-model CATALOG classMap override
7791
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
7792
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
7793
+ * detection pipeline executor actually routes.
7794
+ *
7795
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
7796
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
7797
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
7798
+ * enum) — the two used to share the name `ClassMapDefinition`/
7799
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
7800
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
7801
+ * are not: it is two different concepts colliding on a name. Keep this type
7802
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
7803
+ * would either narrow every `ClassMapDefinition` consumer to the four
7804
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
7805
+ * schema exists for (see the "rejects a classMap whose target is not a
7806
+ * detection macro" test in `model-catalog-schema.test.ts`).
7807
+ */
7808
+ var DetectionCatalogClassMapSchema = object({
7809
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
7810
+ preserveOriginal: boolean()
7811
+ });
7752
7812
  /**
7753
7813
  * THE canonical event-clip pad: the time window a single-timestamp analytics
7754
7814
  * event expands to when joined with footage (clip window = `[timestamp - preMs,
@@ -7790,10 +7850,55 @@ var RecordingStorageModeSchema = _enum([
7790
7850
  "events",
7791
7851
  "continuous"
7792
7852
  ]);
7853
+ /**
7854
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
7855
+ * tre offerte dallo step `object-detection`, da UNA lista
7856
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
7857
+ */
7858
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
7859
+ /**
7860
+ * True quando `values` non ripete un elemento.
7861
+ *
7862
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
7863
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
7864
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
7865
+ */
7866
+ var noDuplicates = (values) => new Set(values).size === values.length;
7793
7867
  /** Which detectors trigger an `events`-mode band. */
7794
7868
  var RecordingTriggersSchema = object({
7795
7869
  motion: boolean().optional(),
7796
- audioThresholdDbfs: number().optional()
7870
+ audioThresholdDbfs: number().optional(),
7871
+ /**
7872
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
7873
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
7874
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
7875
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
7876
+ *
7877
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
7878
+ * quelle che hanno attraversato `enabledMacroClasses`, i
7879
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
7880
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
7881
+ * finestre — vedi `recorder/object-trigger.ts`.
7882
+ */
7883
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
7884
+ /**
7885
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
7886
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
7887
+ * `objectClasses`.
7888
+ *
7889
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
7890
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
7891
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
7892
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
7893
+ * device (D12) — mai un elenco globale di cap.
7894
+ *
7895
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
7896
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
7897
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
7898
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
7899
+ * registrare.
7900
+ */
7901
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7797
7902
  });
7798
7903
  /**
7799
7904
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8274,41 +8379,6 @@ var DecoderSessionConfigSchema = object({
8274
8379
  */
8275
8380
  debug: boolean().optional()
8276
8381
  });
8277
- var LabelDefinitionSchema = object({
8278
- id: string(),
8279
- name: string(),
8280
- category: string().optional(),
8281
- description: string().optional(),
8282
- icon: string().optional()
8283
- });
8284
- /**
8285
- * Wire schema for a per-model CATALOG classMap override
8286
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8287
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8288
- * detection pipeline executor actually routes.
8289
- *
8290
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8291
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8292
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8293
- * enum) — the two used to share the name `ClassMapDefinition`/
8294
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8295
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8296
- * are not: it is two different concepts colliding on a name. Keep this type
8297
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8298
- * would either narrow every `ClassMapDefinition` consumer to the four
8299
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8300
- * schema exists for (see the "rejects a classMap whose target is not a
8301
- * detection macro" test in `model-catalog-schema.test.ts`).
8302
- */
8303
- var DetectionCatalogClassMapSchema = object({
8304
- mapping: record(string(), _enum([
8305
- "person",
8306
- "vehicle",
8307
- "animal",
8308
- "package"
8309
- ])),
8310
- preserveOriginal: boolean()
8311
- });
8312
8382
  var MODEL_FORMATS = [
8313
8383
  "onnx",
8314
8384
  "coreml",
@@ -16571,7 +16641,23 @@ var NcHistoryEntrySchema = object({
16571
16641
  updatedAt: number(),
16572
16642
  /** Failure detail — present on a `dead` row. */
16573
16643
  error: string().optional(),
16574
- subject: NcHistorySubjectSchema
16644
+ subject: NcHistorySubjectSchema,
16645
+ /**
16646
+ * Ids of the artefacts (still, then gif, then clip) this row's successful
16647
+ * delivery indexed in the artefact library — a REFERENCE, never the bytes
16648
+ * (an artefact is often megabytes; this row is durable JSON rewritten on
16649
+ * every delivery attempt). Absent on a row still pending/dead, a row
16650
+ * delivered before this field shipped, or a wiring with no artefact index.
16651
+ *
16652
+ * Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
16653
+ * outlives any one URL's TTL, so a caller mints a fresh link on demand
16654
+ * rather than trusting one frozen at delivery time. `resolveArtifactUrl`
16655
+ * also answers `null` for an id whose artefact has since expired past the
16656
+ * retained shelf's own age bound — the degrade a caller (the Home
16657
+ * Assistant export) must render as "no image right now", never as a
16658
+ * broken link.
16659
+ */
16660
+ artifactIds: array(string().min(1)).optional()
16575
16661
  });
16576
16662
  /**
16577
16663
  * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
@@ -16861,6 +16947,20 @@ var notificationRulesCapability = {
16861
16947
  */
16862
16948
  getHistory: method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }),
16863
16949
  /**
16950
+ * Mint a fresh, externally-reachable URL for one artefact a history row
16951
+ * named in {@link NcHistoryEntrySchema.shape.artifactIds} — the SAME
16952
+ * signed-link mechanism the dispatcher uses to attach media to an
16953
+ * outgoing notification (one derivation; this never re-implements it).
16954
+ *
16955
+ * `url: null` on THREE causes a caller must treat identically ("no image
16956
+ * right now", never a broken link): the id is unknown, its artefact has
16957
+ * expired past the retained shelf's own age bound, or this install has no
16958
+ * externally-reachable base URL. A caller that received a URL on a
16959
+ * previous call and now gets `null` must stop showing it — a link that
16960
+ * worked five minutes ago is not proof it works now.
16961
+ */
16962
+ resolveArtifactUrl: method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }),
16963
+ /**
16864
16964
  * Snooze windows currently in effect, plus any whose digest has not yet
16865
16965
  * gone out. `caller: 'required'`: a user sees their OWN windows and the
16866
16966
  * global ones that silence them, never another person's private silence.
@@ -22511,7 +22611,7 @@ var lifecycleJobSchema = object({
22511
22611
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
22512
22612
  * as every other cap.
22513
22613
  */
22514
- var LogLevelSchema$1 = _enum([
22614
+ var LogLevelSchema$2 = _enum([
22515
22615
  "debug",
22516
22616
  "info",
22517
22617
  "warn",
@@ -22718,7 +22818,7 @@ var CustomActionInputSchema = object({
22718
22818
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
22719
22819
  addonId: string(),
22720
22820
  limit: number().min(1).max(500).default(100),
22721
- level: LogLevelSchema$1.optional()
22821
+ level: LogLevelSchema$2.optional()
22722
22822
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
22723
22823
  packageName: string(),
22724
22824
  version: string().optional()
@@ -22816,7 +22916,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
22816
22916
  auth: "admin"
22817
22917
  }), method(object({
22818
22918
  addonId: string(),
22819
- level: LogLevelSchema$1.optional()
22919
+ level: LogLevelSchema$2.optional()
22820
22920
  }), LogStreamEntrySchema, { kind: "subscription" });
22821
22921
  /**
22822
22922
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -24540,6 +24640,35 @@ var FaceFilterEnum = _enum([
24540
24640
  "identified",
24541
24641
  "all"
24542
24642
  ]);
24643
+ /**
24644
+ * What a `listRecentFaces` page is ORDERED BY.
24645
+ *
24646
+ * - `timestamp` — when the face was seen. The historical (and default) order.
24647
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
24648
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
24649
+ * order: it puts the suggestions an operator can confirm with one tap at the
24650
+ * top, and it is the reason this enum exists — a client that ranked a capped
24651
+ * page client-side was ranking the newest N, never the most certain N.
24652
+ *
24653
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
24654
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
24655
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
24656
+ * — flipping the direction reorders the rows that HAVE a certainty and never
24657
+ * floods the page with the ones that do not. `addon-post-analysis`'s
24658
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
24659
+ * then by faceId, and is what makes this a total order instead of the
24660
+ * backend's NULL-collation accident.
24661
+ */
24662
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
24663
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
24664
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
24665
+ * never leaves the server. */
24666
+ var FaceClusterSchema = object({
24667
+ faceIds: array(string()).readonly(),
24668
+ representativeFaceId: string(),
24669
+ size: number().int(),
24670
+ cohesion: number()
24671
+ });
24543
24672
  var MediaFileLiteSchema$1 = object({
24544
24673
  key: string(),
24545
24674
  kind: string(),
@@ -24597,24 +24726,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24597
24726
  auth: "admin"
24598
24727
  }),
24599
24728
  listRecentFaces: method(object({
24600
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
24729
+ /**
24730
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
24731
+ *
24732
+ * The legacy single-camera form, kept verbatim for every caller that
24733
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
24734
+ * instead — never both: `deviceIds` is the authority whenever it is
24735
+ * present, and this field is then ignored rather than unioned, so
24736
+ * there is exactly one answer to "which cameras did I ask for".
24737
+ */
24601
24738
  deviceId: number().int().optional(),
24739
+ /**
24740
+ * Restrict to a SET of cameras — the review UI's camera filter, which
24741
+ * until now had to fetch the cluster-wide page and drop rows in the
24742
+ * client (so the `limit` it asked for was spent on cameras it was
24743
+ * about to discard).
24744
+ *
24745
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
24746
+ * "every camera". A request for no devices is a request, not an
24747
+ * omission; same contract as `deviceManager.listFleet` and
24748
+ * `pipelineAnalytics.listRecentTracks`.
24749
+ *
24750
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
24751
+ */
24752
+ deviceIds: array(number().int()).optional(),
24602
24753
  limit: number().int().positive().optional(),
24603
24754
  filter: FaceFilterEnum.optional(),
24604
24755
  /**
24605
- * Inline the base64 crop on every row. Default `true` — the existing
24606
- * behaviour, kept so no caller breaks.
24756
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24757
+ * Absent means no lower bound.
24758
+ */
24759
+ since: number().int().optional(),
24760
+ /**
24761
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24762
+ * Absent means no upper bound.
24763
+ */
24764
+ until: number().int().optional(),
24765
+ /**
24766
+ * Order the page by time or by suggestion certainty. Default
24767
+ * `'timestamp'` — the historical order, unchanged for every caller
24768
+ * that does not ask.
24607
24769
  *
24608
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
24609
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
24610
- * the browser cache the images.
24770
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
24771
+ * does under `'suggestionConfidence'`.
24611
24772
  *
24612
- * **This is an INPUT field, so it does not reach the addon until the
24613
- * next train.** The hub router validates cap inputs against its own
24614
- * compiled Zod, which strips a key it does not know — verified today
24615
- * on the OUTPUT side, where an additive field DOES arrive immediately
24616
- * (`Track.hasFace`). Until the train ships, sending `false` is
24617
- * harmless and simply keeps the crops inline.
24773
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
24774
+ * index and stops reading as soon as `limit` rows have PASSED the
24775
+ * filter. `'suggestionConfidence'` cannot stop early — the most
24776
+ * certain row may be the oldest — so it walks the window. Narrow it
24777
+ * with {@link since} / {@link until}.
24778
+ */
24779
+ sortBy: FaceSortFieldEnum.optional(),
24780
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
24781
+ sortDirection: FaceSortDirectionEnum.optional(),
24782
+ /**
24783
+ * Inline the base64 crop on every row.
24784
+ *
24785
+ * Default `false` since the 2026-08-25 inversion — see
24786
+ * `include-crops-default.ts`, which is the ONE place that resolves
24787
+ * this for every gallery, and which records why the inline shape had
24788
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
24789
+ * The doc here used to still say `true`; it was wrong, and a leftover
24790
+ * that describes the old design reads as permission to rely on it.
24791
+ *
24792
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
24793
+ * which the browser fetches off the `event-media` plane in parallel,
24794
+ * cached and ETagged.
24618
24795
  */
24619
24796
  includeCrops: boolean().optional()
24620
24797
  }).optional(), array(FaceInfoSchema).readonly()),
@@ -24663,13 +24840,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24663
24840
  suggestFaceClusters: method(object({
24664
24841
  threshold: number().min(0).max(1).optional(),
24665
24842
  minClusterSize: number().int().min(2).optional(),
24666
- limit: number().int().positive().optional()
24667
- }).optional(), array(object({
24668
- faceIds: array(string()).readonly(),
24669
- representativeFaceId: string(),
24670
- size: number().int(),
24671
- cohesion: number()
24672
- })).readonly())
24843
+ /**
24844
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
24845
+ * which read as though it bounded the work — it never did.
24846
+ *
24847
+ * Wins over {@link limit} when both are sent.
24848
+ */
24849
+ maxClusters: number().int().positive().optional(),
24850
+ /**
24851
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
24852
+ * RESULT, not the scan. Kept so existing callers keep working; send
24853
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
24854
+ */
24855
+ limit: number().int().positive().optional(),
24856
+ /**
24857
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
24858
+ * POOL, not the result.
24859
+ *
24860
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
24861
+ * used to read every unassigned face on the hub no matter what the
24862
+ * caller asked for, because the only bound cut the finished clusters
24863
+ * afterwards; a UI showing a window of 100 paid for a scan of the
24864
+ * whole corpus, on an addon whose disk is under contention.
24865
+ *
24866
+ * The pool is the NEWEST matching faces first — the same order the
24867
+ * gallery shows — so a bound here shortens the horizon, it does not
24868
+ * sample it randomly.
24869
+ *
24870
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
24871
+ * so the live corpus — 372 face rows — is unaffected while the
24872
+ * unbounded scan can never come back as the table grows.
24873
+ */
24874
+ maxFacesScanned: number().int().positive().optional()
24875
+ }).optional(), array(FaceClusterSchema).readonly())
24673
24876
  }
24674
24877
  };
24675
24878
  /**
@@ -28463,6 +28666,39 @@ var ReadGopBytesResultSchema = object({
28463
28666
  /** Media ms the returned fragment covers. */
28464
28667
  gopDurMs: number()
28465
28668
  });
28669
+ /**
28670
+ * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
28671
+ * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
28672
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
28673
+ * a replay needs several seconds of native pixels, not one frame.
28674
+ *
28675
+ * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
28676
+ * is `false` when the returned bytes were cut short by the read's own safety
28677
+ * byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
28678
+ * silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
28679
+ * degradation: a window whose end falls past the covering segment would need
28680
+ * bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
28681
+ * not one standalone-demuxable stream — the caller's answer is to request a
28682
+ * shorter window or one aligned to a single segment, not to receive spliced
28683
+ * bytes nothing has proven decodable.
28684
+ */
28685
+ var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
28686
+ kind: literal("ok"),
28687
+ data: _instanceof(Uint8Array),
28688
+ /** Absolute epoch ms of the returned bytes' first sample — at or before
28689
+ * the requested `fromMs` (anchored on the nearest keyframe). */
28690
+ gopStartMs: number(),
28691
+ /** Media ms the returned bytes cover, from `gopStartMs`. */
28692
+ gopDurMs: number(),
28693
+ /** `false` ⇒ the safety byte cap cut the read short before it reached
28694
+ * the requested `toMs`; the caller got fewer frames than asked for. */
28695
+ reachesRequestedEnd: boolean()
28696
+ }), object({
28697
+ kind: literal("spans-multiple-segments"),
28698
+ /** Where the covering segment's own footage runs out — informational,
28699
+ * not a retry hint (retrying the same window would refuse again). */
28700
+ segmentEndMs: number()
28701
+ })]);
28466
28702
  method(object({
28467
28703
  deviceId: number(),
28468
28704
  fromMs: number(),
@@ -28513,6 +28749,15 @@ method(object({
28513
28749
  }), ReadGopBytesResultSchema, {
28514
28750
  kind: "query",
28515
28751
  auth: "admin"
28752
+ }), method(object({
28753
+ deviceId: number(),
28754
+ profile: string(),
28755
+ startMs: number(),
28756
+ fromMs: number(),
28757
+ toMs: number()
28758
+ }), ReadWindowBytesResultSchema, {
28759
+ kind: "query",
28760
+ auth: "admin"
28516
28761
  }), method(object({
28517
28762
  deviceId: number(),
28518
28763
  config: RecordingConfigSchema
@@ -29630,6 +29875,211 @@ var SetSiteLocationInputSchema = object({
29630
29875
  latitude: number().min(-90).max(90),
29631
29876
  longitude: number().min(-180).max(180)
29632
29877
  }).nullable();
29878
+ /**
29879
+ * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
29880
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29881
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29882
+ * already prints - never a token, never an `Authorization` header.
29883
+ */
29884
+ var RequestCensusGroupSchema = object({
29885
+ procedure: string(),
29886
+ userAgent: string(),
29887
+ ip: string(),
29888
+ principal: string(),
29889
+ calls: number(),
29890
+ perMin: number()
29891
+ });
29892
+ /**
29893
+ * A procedure's TOTAL over the window, across every caller.
29894
+ *
29895
+ * This block, not the group list, is what answers "did these calls arrive over
29896
+ * HTTP at all". A total far BELOW what a store-side census counted over the
29897
+ * same window excludes the HTTP plane, which is a result, not a failure.
29898
+ */
29899
+ var RequestCensusProcedureSchema = object({
29900
+ procedure: string(),
29901
+ calls: number(),
29902
+ perMin: number()
29903
+ });
29904
+ /**
29905
+ * The census as an operator sees it.
29906
+ *
29907
+ * `persisted` is the honest answer to "will this survive the restart I am
29908
+ * about to do": the arm deadline is written to `system-settings` so a window
29909
+ * armed now can measure the NEXT boot, and a write that failed must not look
29910
+ * like one that succeeded.
29911
+ */
29912
+ var RequestCensusStatusSchema = object({
29913
+ armed: boolean(),
29914
+ /** How long the current - or just-closed - window collected, in ms. */
29915
+ elapsedMs: number(),
29916
+ /** The window actually armed, after the server clamped the request. */
29917
+ windowMs: number(),
29918
+ /** Epoch ms the window closes at. 0 when disarmed. */
29919
+ armedUntilMs: number(),
29920
+ httpRequests: number(),
29921
+ batchedRequests: number(),
29922
+ /**
29923
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
29924
+ * is in play (`?batch=1` carries several procedures in one request); this is
29925
+ * the number comparable with a store-side call count.
29926
+ */
29927
+ procedureCalls: number(),
29928
+ /**
29929
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
29930
+ * transport resolves one context per connection - but the number that says
29931
+ * whether a plane this census cannot see was busy while HTTP was quiet.
29932
+ */
29933
+ wsConnections: number(),
29934
+ distinctGroups: number(),
29935
+ /** Calls counted in the totals whose group attribution was shed at the
29936
+ * cardinality bound. */
29937
+ unattributedCalls: number(),
29938
+ procedures: array(RequestCensusProcedureSchema).readonly(),
29939
+ groups: array(RequestCensusGroupSchema).readonly()
29940
+ }).extend({ persisted: boolean() });
29941
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
29942
+ var LogLevelSchema$1 = _enum([
29943
+ "debug",
29944
+ "info",
29945
+ "warn",
29946
+ "error"
29947
+ ]);
29948
+ /**
29949
+ * The diagnostics that can be ARMED for a window. Exactly one today.
29950
+ *
29951
+ * A diagnostic is anything whose cost is only worth paying while a question is
29952
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
29953
+ */
29954
+ var DiagnosticIdSchema = _enum(["request-census"]);
29955
+ /**
29956
+ * The layers of the level hierarchy, general → specific. The most specific
29957
+ * layer that carries an explicit value wins.
29958
+ *
29959
+ * `component` is DECLARED and not yet resolvable: the per-component channels
29960
+ * are a later slice of the same plan, and a `levelSource` enum that has to
29961
+ * grow later would force every consumer of this document to change with it.
29962
+ * Nothing returns `component` today.
29963
+ */
29964
+ var LoggingScopeKindSchema = _enum([
29965
+ "cluster",
29966
+ "node",
29967
+ "component"
29968
+ ]);
29969
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
29970
+ var LoggingLevelSourceSchema = _enum([
29971
+ "default",
29972
+ "cluster",
29973
+ "node",
29974
+ "component"
29975
+ ]);
29976
+ /**
29977
+ * One layer of the hierarchy as it actually STANDS.
29978
+ *
29979
+ * `level: null` is the whole reason this array is returned: it is the
29980
+ * difference between "this node is at `info` because I decided it" and
29981
+ * "...because it inherits". An operator who clears an override believing they
29982
+ * are clearing an inherited value has been handed the same defect as the two
29983
+ * contradicting knobs this document exists to remove, moved one floor up.
29984
+ */
29985
+ var LoggingLevelLayerSchema = object({
29986
+ scope: LoggingScopeKindSchema,
29987
+ /** The node this layer speaks for; `null` on the cluster layer. */
29988
+ nodeId: string().nullable(),
29989
+ /** Explicitly set here, or `null` when this layer inherits. */
29990
+ level: LogLevelSchema$1.nullable()
29991
+ });
29992
+ /** What a line is judged against, and WHICH layer decided it. */
29993
+ var LoggingEffectiveSchema = object({
29994
+ level: LogLevelSchema$1,
29995
+ levelSource: LoggingLevelSourceSchema
29996
+ });
29997
+ /** Every layer, general → specific. Never collapsed into the effective value. */
29998
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
29999
+ /**
30000
+ * An armed diagnostic, with its DEADLINE.
30001
+ *
30002
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
30003
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
30004
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
30005
+ * `armed` is false — a window is never reported as slightly expired.
30006
+ */
30007
+ var DiagnosticWindowSchema = object({
30008
+ id: DiagnosticIdSchema,
30009
+ armed: boolean(),
30010
+ /** Epoch ms the window closes at. 0 when disarmed. */
30011
+ armedUntilMs: number(),
30012
+ /** Ms left before it expires on its own. 0 when disarmed. */
30013
+ remainingMs: number(),
30014
+ /** Whether the stored deadline is the one the live diagnostic is running —
30015
+ * i.e. whether this window would survive a restart. */
30016
+ persisted: boolean()
30017
+ });
30018
+ /**
30019
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
30020
+ * server — there is no maximum here on purpose: a bound repeated in a schema
30021
+ * is a second knob that disagrees with the first the day one of them moves.
30022
+ */
30023
+ var DiagnosticWindowPatchSchema = object({
30024
+ id: DiagnosticIdSchema,
30025
+ armMs: number().int().min(0),
30026
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
30027
+ reportEveryMs: number().int().positive().optional()
30028
+ });
30029
+ /**
30030
+ * A PATCH, and patches MERGE.
30031
+ *
30032
+ * A field absent from the patch is left exactly as it was — arming a
30033
+ * diagnostic never resets a level, and setting a level never disarms a window.
30034
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
30035
+ * `setAll` already merges, and rebuilding the object is how an absent field
30036
+ * turns into an erased one.
30037
+ */
30038
+ var LoggingSettingsPatchSchema = object({
30039
+ /**
30040
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
30041
+ * addressed scope so it inherits again. A value sets it.
30042
+ */
30043
+ level: LogLevelSchema$1.nullable().optional(),
30044
+ /**
30045
+ * Only the diagnostics NAMED here change. An armed window that is not listed
30046
+ * keeps running — a patch is never a full replacement.
30047
+ */
30048
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
30049
+ });
30050
+ /**
30051
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
30052
+ *
30053
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
30054
+ * input — the generated router strips it and uses it to resolve the PROVIDER
30055
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
30056
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
30057
+ * by an agent that holds no cluster document at all. The hub is the single
30058
+ * authority over the whole hierarchy and answers for every layer, so the
30059
+ * layer selector needs a name the transport does not already own.
30060
+ */
30061
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
30062
+ var SetLoggingSettingsInputSchema = object({
30063
+ scopeNodeId: string().optional(),
30064
+ patch: LoggingSettingsPatchSchema
30065
+ });
30066
+ /**
30067
+ * The whole document, as read and as returned after every write.
30068
+ *
30069
+ * `persisted: false` means the settings store could not be read or written.
30070
+ * The in-memory mirror still governs behaviour and is unchanged by the
30071
+ * failure — a read that fails neither switches a level nor disarms a window
30072
+ * (D49) — but the operator is told that what they are looking at would not
30073
+ * survive a restart.
30074
+ */
30075
+ var LoggingSettingsStateSchema = object({
30076
+ /** The layer this document was read at. `null` = the cluster layer. */
30077
+ scopeNodeId: string().nullable(),
30078
+ effective: LoggingEffectiveSchema,
30079
+ explicit: LoggingExplicitSchema,
30080
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
30081
+ persisted: boolean()
30082
+ });
29633
30083
  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(), {
29634
30084
  kind: "mutation",
29635
30085
  auth: "admin"
@@ -29642,6 +30092,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29642
30092
  }), method(_void(), SiteLocationStatusSchema, {
29643
30093
  kind: "mutation",
29644
30094
  auth: "admin"
30095
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
30096
+ kind: "mutation",
30097
+ auth: "admin"
29645
30098
  });
29646
30099
  /**
29647
30100
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -34677,6 +35130,12 @@ Object.freeze({
34677
35130
  addonId: null,
34678
35131
  access: "view"
34679
35132
  },
35133
+ "notificationRules.resolveArtifactUrl": {
35134
+ capName: "notification-rules",
35135
+ capScope: "system",
35136
+ addonId: null,
35137
+ access: "view"
35138
+ },
34680
35139
  "notificationRules.setAlarmConfig": {
34681
35140
  capName: "notification-rules",
34682
35141
  capScope: "system",
@@ -36081,6 +36540,12 @@ Object.freeze({
36081
36540
  addonId: null,
36082
36541
  access: "view"
36083
36542
  },
36543
+ "recording.readWindowBytes": {
36544
+ capName: "recording",
36545
+ capScope: "system",
36546
+ addonId: null,
36547
+ access: "view"
36548
+ },
36084
36549
  "recording.refreshStorageLocationsForMigration": {
36085
36550
  capName: "recording",
36086
36551
  capScope: "system",
@@ -36921,6 +37386,18 @@ Object.freeze({
36921
37386
  addonId: null,
36922
37387
  access: "create"
36923
37388
  },
37389
+ "system.getLoggingSettings": {
37390
+ capName: "system",
37391
+ capScope: "system",
37392
+ addonId: null,
37393
+ access: "view"
37394
+ },
37395
+ "system.getRequestCensus": {
37396
+ capName: "system",
37397
+ capScope: "system",
37398
+ addonId: null,
37399
+ access: "view"
37400
+ },
36924
37401
  "system.getRetentionConfig": {
36925
37402
  capName: "system",
36926
37403
  capScope: "system",
@@ -36951,6 +37428,12 @@ Object.freeze({
36951
37428
  addonId: null,
36952
37429
  access: "view"
36953
37430
  },
37431
+ "system.setLoggingSettings": {
37432
+ capName: "system",
37433
+ capScope: "system",
37434
+ addonId: null,
37435
+ access: "create"
37436
+ },
36954
37437
  "system.setRetentionConfig": {
36955
37438
  capName: "system",
36956
37439
  capScope: "system",
@@ -38106,6 +38589,10 @@ Object.freeze({
38106
38589
  name: "deviceId",
38107
38590
  form: "single",
38108
38591
  optional: true
38592
+ }, {
38593
+ name: "deviceIds",
38594
+ form: "array",
38595
+ optional: true
38109
38596
  }],
38110
38597
  "fanControl.setDirection": [{
38111
38598
  name: "deviceId",
@@ -38911,6 +39398,11 @@ Object.freeze({
38911
39398
  form: "single",
38912
39399
  optional: false
38913
39400
  }],
39401
+ "recording.readWindowBytes": [{
39402
+ name: "deviceId",
39403
+ form: "single",
39404
+ optional: false
39405
+ }],
38914
39406
  "recording.relocateFootage": [{
38915
39407
  name: "deviceId",
38916
39408
  form: "single",
@@ -39993,7 +40485,38 @@ object({
39993
40485
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
39994
40486
  * reproduce that.
39995
40487
  */
39996
- tileBudgetMb: number().int().min(0).max(1024)
40488
+ tileBudgetMb: number().int().min(0).max(1024),
40489
+ /**
40490
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
40491
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
40492
+ * subject tiles, on frames that detected something.
40493
+ *
40494
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
40495
+ * containment is strict by design, so the native `keyFrame`, the detail
40496
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
40497
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
40498
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
40499
+ * frame-time after delivery, with the request only p50 367 ms behind it.
40500
+ *
40501
+ * Sizing, and why this is a budget and not a duration: a scene tile is
40502
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
40503
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
40504
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
40505
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
40506
+ * binds only through a detection burst, where it still covers well past the
40507
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
40508
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
40509
+ * whole shape exists to avoid.
40510
+ *
40511
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
40512
+ * subject tile, so one shared budget would let a busy camera's key frames
40513
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
40514
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
40515
+ * pre-existing behaviour, where a late full-frame request had nothing but the
40516
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
40517
+ * nothing.
40518
+ */
40519
+ sceneBudgetMb: number().int().min(0).max(1024)
39997
40520
  });
39998
40521
  /**
39999
40522
  * The values in force when the operator has set nothing.
@@ -40009,12 +40532,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
40009
40532
  budgetMb: 1024,
40010
40533
  activityMs: 15e3,
40011
40534
  tileBudgetMb: 64,
40535
+ sceneBudgetMb: 48,
40012
40536
  admission: "inferred"
40013
40537
  };
40014
40538
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
40015
40539
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
40016
40540
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
40017
40541
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
40542
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
40018
40543
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
40019
40544
  /** Cosine similarity between two embedding vectors */
40020
40545
  function cosineSimilarity(a, b) {