@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.
@@ -7718,6 +7718,66 @@ var OpsLogQueryInputSchema = object({
7718
7718
  /** Max rows returned, newest-first. */
7719
7719
  limit: number().int().min(1).max(1e3).optional()
7720
7720
  });
7721
+ var LabelDefinitionSchema = object({
7722
+ id: string(),
7723
+ name: string(),
7724
+ category: string().optional(),
7725
+ description: string().optional(),
7726
+ icon: string().optional()
7727
+ });
7728
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
7729
+ var CLASS_MAP_MACRO_TARGETS = [
7730
+ "person",
7731
+ "vehicle",
7732
+ "animal",
7733
+ "package"
7734
+ ];
7735
+ /**
7736
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
7737
+ * un operatore può selezionare.
7738
+ *
7739
+ * Sono le tre offerte dallo step `object-detection`
7740
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
7741
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
7742
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
7743
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
7744
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
7745
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
7746
+ *
7747
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
7748
+ * dello step e una seconda volta come union `FirstLevelMacro`
7749
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
7750
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
7751
+ * successiva.
7752
+ */
7753
+ var FIRST_LEVEL_MACRO_CLASSES = [
7754
+ "person",
7755
+ "vehicle",
7756
+ "animal"
7757
+ ];
7758
+ /**
7759
+ * Wire schema for a per-model CATALOG classMap override
7760
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
7761
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
7762
+ * detection pipeline executor actually routes.
7763
+ *
7764
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
7765
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
7766
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
7767
+ * enum) — the two used to share the name `ClassMapDefinition`/
7768
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
7769
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
7770
+ * are not: it is two different concepts colliding on a name. Keep this type
7771
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
7772
+ * would either narrow every `ClassMapDefinition` consumer to the four
7773
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
7774
+ * schema exists for (see the "rejects a classMap whose target is not a
7775
+ * detection macro" test in `model-catalog-schema.test.ts`).
7776
+ */
7777
+ var DetectionCatalogClassMapSchema = object({
7778
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
7779
+ preserveOriginal: boolean()
7780
+ });
7721
7781
  /**
7722
7782
  * THE canonical event-clip pad: the time window a single-timestamp analytics
7723
7783
  * event expands to when joined with footage (clip window = `[timestamp - preMs,
@@ -7759,10 +7819,55 @@ var RecordingStorageModeSchema = _enum([
7759
7819
  "events",
7760
7820
  "continuous"
7761
7821
  ]);
7822
+ /**
7823
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
7824
+ * tre offerte dallo step `object-detection`, da UNA lista
7825
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
7826
+ */
7827
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
7828
+ /**
7829
+ * True quando `values` non ripete un elemento.
7830
+ *
7831
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
7832
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
7833
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
7834
+ */
7835
+ var noDuplicates = (values) => new Set(values).size === values.length;
7762
7836
  /** Which detectors trigger an `events`-mode band. */
7763
7837
  var RecordingTriggersSchema = object({
7764
7838
  motion: boolean().optional(),
7765
- audioThresholdDbfs: number().optional()
7839
+ audioThresholdDbfs: number().optional(),
7840
+ /**
7841
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
7842
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
7843
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
7844
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
7845
+ *
7846
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
7847
+ * quelle che hanno attraversato `enabledMacroClasses`, i
7848
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
7849
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
7850
+ * finestre — vedi `recorder/object-trigger.ts`.
7851
+ */
7852
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
7853
+ /**
7854
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
7855
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
7856
+ * `objectClasses`.
7857
+ *
7858
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
7859
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
7860
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
7861
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
7862
+ * device (D12) — mai un elenco globale di cap.
7863
+ *
7864
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
7865
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
7866
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
7867
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
7868
+ * registrare.
7869
+ */
7870
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7766
7871
  });
7767
7872
  /**
7768
7873
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8243,41 +8348,6 @@ var DecoderSessionConfigSchema = object({
8243
8348
  */
8244
8349
  debug: boolean().optional()
8245
8350
  });
8246
- var LabelDefinitionSchema = object({
8247
- id: string(),
8248
- name: string(),
8249
- category: string().optional(),
8250
- description: string().optional(),
8251
- icon: string().optional()
8252
- });
8253
- /**
8254
- * Wire schema for a per-model CATALOG classMap override
8255
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8256
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8257
- * detection pipeline executor actually routes.
8258
- *
8259
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8260
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8261
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8262
- * enum) — the two used to share the name `ClassMapDefinition`/
8263
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8264
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8265
- * are not: it is two different concepts colliding on a name. Keep this type
8266
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8267
- * would either narrow every `ClassMapDefinition` consumer to the four
8268
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8269
- * schema exists for (see the "rejects a classMap whose target is not a
8270
- * detection macro" test in `model-catalog-schema.test.ts`).
8271
- */
8272
- var DetectionCatalogClassMapSchema = object({
8273
- mapping: record(string(), _enum([
8274
- "person",
8275
- "vehicle",
8276
- "animal",
8277
- "package"
8278
- ])),
8279
- preserveOriginal: boolean()
8280
- });
8281
8351
  var MODEL_FORMATS = [
8282
8352
  "onnx",
8283
8353
  "coreml",
@@ -16540,7 +16610,23 @@ var NcHistoryEntrySchema = object({
16540
16610
  updatedAt: number(),
16541
16611
  /** Failure detail — present on a `dead` row. */
16542
16612
  error: string().optional(),
16543
- subject: NcHistorySubjectSchema
16613
+ subject: NcHistorySubjectSchema,
16614
+ /**
16615
+ * Ids of the artefacts (still, then gif, then clip) this row's successful
16616
+ * delivery indexed in the artefact library — a REFERENCE, never the bytes
16617
+ * (an artefact is often megabytes; this row is durable JSON rewritten on
16618
+ * every delivery attempt). Absent on a row still pending/dead, a row
16619
+ * delivered before this field shipped, or a wiring with no artefact index.
16620
+ *
16621
+ * Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
16622
+ * outlives any one URL's TTL, so a caller mints a fresh link on demand
16623
+ * rather than trusting one frozen at delivery time. `resolveArtifactUrl`
16624
+ * also answers `null` for an id whose artefact has since expired past the
16625
+ * retained shelf's own age bound — the degrade a caller (the Home
16626
+ * Assistant export) must render as "no image right now", never as a
16627
+ * broken link.
16628
+ */
16629
+ artifactIds: array(string().min(1)).optional()
16544
16630
  });
16545
16631
  /**
16546
16632
  * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
@@ -16830,6 +16916,20 @@ var notificationRulesCapability = {
16830
16916
  */
16831
16917
  getHistory: method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }),
16832
16918
  /**
16919
+ * Mint a fresh, externally-reachable URL for one artefact a history row
16920
+ * named in {@link NcHistoryEntrySchema.shape.artifactIds} — the SAME
16921
+ * signed-link mechanism the dispatcher uses to attach media to an
16922
+ * outgoing notification (one derivation; this never re-implements it).
16923
+ *
16924
+ * `url: null` on THREE causes a caller must treat identically ("no image
16925
+ * right now", never a broken link): the id is unknown, its artefact has
16926
+ * expired past the retained shelf's own age bound, or this install has no
16927
+ * externally-reachable base URL. A caller that received a URL on a
16928
+ * previous call and now gets `null` must stop showing it — a link that
16929
+ * worked five minutes ago is not proof it works now.
16930
+ */
16931
+ resolveArtifactUrl: method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }),
16932
+ /**
16833
16933
  * Snooze windows currently in effect, plus any whose digest has not yet
16834
16934
  * gone out. `caller: 'required'`: a user sees their OWN windows and the
16835
16935
  * global ones that silence them, never another person's private silence.
@@ -22480,7 +22580,7 @@ var lifecycleJobSchema = object({
22480
22580
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
22481
22581
  * as every other cap.
22482
22582
  */
22483
- var LogLevelSchema$1 = _enum([
22583
+ var LogLevelSchema$2 = _enum([
22484
22584
  "debug",
22485
22585
  "info",
22486
22586
  "warn",
@@ -22687,7 +22787,7 @@ var CustomActionInputSchema = object({
22687
22787
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
22688
22788
  addonId: string(),
22689
22789
  limit: number().min(1).max(500).default(100),
22690
- level: LogLevelSchema$1.optional()
22790
+ level: LogLevelSchema$2.optional()
22691
22791
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
22692
22792
  packageName: string(),
22693
22793
  version: string().optional()
@@ -22785,7 +22885,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
22785
22885
  auth: "admin"
22786
22886
  }), method(object({
22787
22887
  addonId: string(),
22788
- level: LogLevelSchema$1.optional()
22888
+ level: LogLevelSchema$2.optional()
22789
22889
  }), LogStreamEntrySchema, { kind: "subscription" });
22790
22890
  /**
22791
22891
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -24509,6 +24609,35 @@ var FaceFilterEnum = _enum([
24509
24609
  "identified",
24510
24610
  "all"
24511
24611
  ]);
24612
+ /**
24613
+ * What a `listRecentFaces` page is ORDERED BY.
24614
+ *
24615
+ * - `timestamp` — when the face was seen. The historical (and default) order.
24616
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
24617
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
24618
+ * order: it puts the suggestions an operator can confirm with one tap at the
24619
+ * top, and it is the reason this enum exists — a client that ranked a capped
24620
+ * page client-side was ranking the newest N, never the most certain N.
24621
+ *
24622
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
24623
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
24624
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
24625
+ * — flipping the direction reorders the rows that HAVE a certainty and never
24626
+ * floods the page with the ones that do not. `addon-post-analysis`'s
24627
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
24628
+ * then by faceId, and is what makes this a total order instead of the
24629
+ * backend's NULL-collation accident.
24630
+ */
24631
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
24632
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
24633
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
24634
+ * never leaves the server. */
24635
+ var FaceClusterSchema = object({
24636
+ faceIds: array(string()).readonly(),
24637
+ representativeFaceId: string(),
24638
+ size: number().int(),
24639
+ cohesion: number()
24640
+ });
24512
24641
  var MediaFileLiteSchema$1 = object({
24513
24642
  key: string(),
24514
24643
  kind: string(),
@@ -24566,24 +24695,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24566
24695
  auth: "admin"
24567
24696
  }),
24568
24697
  listRecentFaces: method(object({
24569
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
24698
+ /**
24699
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
24700
+ *
24701
+ * The legacy single-camera form, kept verbatim for every caller that
24702
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
24703
+ * instead — never both: `deviceIds` is the authority whenever it is
24704
+ * present, and this field is then ignored rather than unioned, so
24705
+ * there is exactly one answer to "which cameras did I ask for".
24706
+ */
24570
24707
  deviceId: number().int().optional(),
24708
+ /**
24709
+ * Restrict to a SET of cameras — the review UI's camera filter, which
24710
+ * until now had to fetch the cluster-wide page and drop rows in the
24711
+ * client (so the `limit` it asked for was spent on cameras it was
24712
+ * about to discard).
24713
+ *
24714
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
24715
+ * "every camera". A request for no devices is a request, not an
24716
+ * omission; same contract as `deviceManager.listFleet` and
24717
+ * `pipelineAnalytics.listRecentTracks`.
24718
+ *
24719
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
24720
+ */
24721
+ deviceIds: array(number().int()).optional(),
24571
24722
  limit: number().int().positive().optional(),
24572
24723
  filter: FaceFilterEnum.optional(),
24573
24724
  /**
24574
- * Inline the base64 crop on every row. Default `true` — the existing
24575
- * behaviour, kept so no caller breaks.
24725
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24726
+ * Absent means no lower bound.
24727
+ */
24728
+ since: number().int().optional(),
24729
+ /**
24730
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24731
+ * Absent means no upper bound.
24732
+ */
24733
+ until: number().int().optional(),
24734
+ /**
24735
+ * Order the page by time or by suggestion certainty. Default
24736
+ * `'timestamp'` — the historical order, unchanged for every caller
24737
+ * that does not ask.
24576
24738
  *
24577
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
24578
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
24579
- * the browser cache the images.
24739
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
24740
+ * does under `'suggestionConfidence'`.
24580
24741
  *
24581
- * **This is an INPUT field, so it does not reach the addon until the
24582
- * next train.** The hub router validates cap inputs against its own
24583
- * compiled Zod, which strips a key it does not know — verified today
24584
- * on the OUTPUT side, where an additive field DOES arrive immediately
24585
- * (`Track.hasFace`). Until the train ships, sending `false` is
24586
- * harmless and simply keeps the crops inline.
24742
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
24743
+ * index and stops reading as soon as `limit` rows have PASSED the
24744
+ * filter. `'suggestionConfidence'` cannot stop early — the most
24745
+ * certain row may be the oldest — so it walks the window. Narrow it
24746
+ * with {@link since} / {@link until}.
24747
+ */
24748
+ sortBy: FaceSortFieldEnum.optional(),
24749
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
24750
+ sortDirection: FaceSortDirectionEnum.optional(),
24751
+ /**
24752
+ * Inline the base64 crop on every row.
24753
+ *
24754
+ * Default `false` since the 2026-08-25 inversion — see
24755
+ * `include-crops-default.ts`, which is the ONE place that resolves
24756
+ * this for every gallery, and which records why the inline shape had
24757
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
24758
+ * The doc here used to still say `true`; it was wrong, and a leftover
24759
+ * that describes the old design reads as permission to rely on it.
24760
+ *
24761
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
24762
+ * which the browser fetches off the `event-media` plane in parallel,
24763
+ * cached and ETagged.
24587
24764
  */
24588
24765
  includeCrops: boolean().optional()
24589
24766
  }).optional(), array(FaceInfoSchema).readonly()),
@@ -24632,13 +24809,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24632
24809
  suggestFaceClusters: method(object({
24633
24810
  threshold: number().min(0).max(1).optional(),
24634
24811
  minClusterSize: number().int().min(2).optional(),
24635
- limit: number().int().positive().optional()
24636
- }).optional(), array(object({
24637
- faceIds: array(string()).readonly(),
24638
- representativeFaceId: string(),
24639
- size: number().int(),
24640
- cohesion: number()
24641
- })).readonly())
24812
+ /**
24813
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
24814
+ * which read as though it bounded the work — it never did.
24815
+ *
24816
+ * Wins over {@link limit} when both are sent.
24817
+ */
24818
+ maxClusters: number().int().positive().optional(),
24819
+ /**
24820
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
24821
+ * RESULT, not the scan. Kept so existing callers keep working; send
24822
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
24823
+ */
24824
+ limit: number().int().positive().optional(),
24825
+ /**
24826
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
24827
+ * POOL, not the result.
24828
+ *
24829
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
24830
+ * used to read every unassigned face on the hub no matter what the
24831
+ * caller asked for, because the only bound cut the finished clusters
24832
+ * afterwards; a UI showing a window of 100 paid for a scan of the
24833
+ * whole corpus, on an addon whose disk is under contention.
24834
+ *
24835
+ * The pool is the NEWEST matching faces first — the same order the
24836
+ * gallery shows — so a bound here shortens the horizon, it does not
24837
+ * sample it randomly.
24838
+ *
24839
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
24840
+ * so the live corpus — 372 face rows — is unaffected while the
24841
+ * unbounded scan can never come back as the table grows.
24842
+ */
24843
+ maxFacesScanned: number().int().positive().optional()
24844
+ }).optional(), array(FaceClusterSchema).readonly())
24642
24845
  }
24643
24846
  };
24644
24847
  /**
@@ -28432,6 +28635,39 @@ var ReadGopBytesResultSchema = object({
28432
28635
  /** Media ms the returned fragment covers. */
28433
28636
  gopDurMs: number()
28434
28637
  });
28638
+ /**
28639
+ * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
28640
+ * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
28641
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
28642
+ * a replay needs several seconds of native pixels, not one frame.
28643
+ *
28644
+ * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
28645
+ * is `false` when the returned bytes were cut short by the read's own safety
28646
+ * byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
28647
+ * silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
28648
+ * degradation: a window whose end falls past the covering segment would need
28649
+ * bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
28650
+ * not one standalone-demuxable stream — the caller's answer is to request a
28651
+ * shorter window or one aligned to a single segment, not to receive spliced
28652
+ * bytes nothing has proven decodable.
28653
+ */
28654
+ var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
28655
+ kind: literal("ok"),
28656
+ data: _instanceof(Uint8Array),
28657
+ /** Absolute epoch ms of the returned bytes' first sample — at or before
28658
+ * the requested `fromMs` (anchored on the nearest keyframe). */
28659
+ gopStartMs: number(),
28660
+ /** Media ms the returned bytes cover, from `gopStartMs`. */
28661
+ gopDurMs: number(),
28662
+ /** `false` ⇒ the safety byte cap cut the read short before it reached
28663
+ * the requested `toMs`; the caller got fewer frames than asked for. */
28664
+ reachesRequestedEnd: boolean()
28665
+ }), object({
28666
+ kind: literal("spans-multiple-segments"),
28667
+ /** Where the covering segment's own footage runs out — informational,
28668
+ * not a retry hint (retrying the same window would refuse again). */
28669
+ segmentEndMs: number()
28670
+ })]);
28435
28671
  method(object({
28436
28672
  deviceId: number(),
28437
28673
  fromMs: number(),
@@ -28482,6 +28718,15 @@ method(object({
28482
28718
  }), ReadGopBytesResultSchema, {
28483
28719
  kind: "query",
28484
28720
  auth: "admin"
28721
+ }), method(object({
28722
+ deviceId: number(),
28723
+ profile: string(),
28724
+ startMs: number(),
28725
+ fromMs: number(),
28726
+ toMs: number()
28727
+ }), ReadWindowBytesResultSchema, {
28728
+ kind: "query",
28729
+ auth: "admin"
28485
28730
  }), method(object({
28486
28731
  deviceId: number(),
28487
28732
  config: RecordingConfigSchema
@@ -29599,6 +29844,211 @@ var SetSiteLocationInputSchema = object({
29599
29844
  latitude: number().min(-90).max(90),
29600
29845
  longitude: number().min(-180).max(180)
29601
29846
  }).nullable();
29847
+ /**
29848
+ * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
29849
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29850
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29851
+ * already prints - never a token, never an `Authorization` header.
29852
+ */
29853
+ var RequestCensusGroupSchema = object({
29854
+ procedure: string(),
29855
+ userAgent: string(),
29856
+ ip: string(),
29857
+ principal: string(),
29858
+ calls: number(),
29859
+ perMin: number()
29860
+ });
29861
+ /**
29862
+ * A procedure's TOTAL over the window, across every caller.
29863
+ *
29864
+ * This block, not the group list, is what answers "did these calls arrive over
29865
+ * HTTP at all". A total far BELOW what a store-side census counted over the
29866
+ * same window excludes the HTTP plane, which is a result, not a failure.
29867
+ */
29868
+ var RequestCensusProcedureSchema = object({
29869
+ procedure: string(),
29870
+ calls: number(),
29871
+ perMin: number()
29872
+ });
29873
+ /**
29874
+ * The census as an operator sees it.
29875
+ *
29876
+ * `persisted` is the honest answer to "will this survive the restart I am
29877
+ * about to do": the arm deadline is written to `system-settings` so a window
29878
+ * armed now can measure the NEXT boot, and a write that failed must not look
29879
+ * like one that succeeded.
29880
+ */
29881
+ var RequestCensusStatusSchema = object({
29882
+ armed: boolean(),
29883
+ /** How long the current - or just-closed - window collected, in ms. */
29884
+ elapsedMs: number(),
29885
+ /** The window actually armed, after the server clamped the request. */
29886
+ windowMs: number(),
29887
+ /** Epoch ms the window closes at. 0 when disarmed. */
29888
+ armedUntilMs: number(),
29889
+ httpRequests: number(),
29890
+ batchedRequests: number(),
29891
+ /**
29892
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
29893
+ * is in play (`?batch=1` carries several procedures in one request); this is
29894
+ * the number comparable with a store-side call count.
29895
+ */
29896
+ procedureCalls: number(),
29897
+ /**
29898
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
29899
+ * transport resolves one context per connection - but the number that says
29900
+ * whether a plane this census cannot see was busy while HTTP was quiet.
29901
+ */
29902
+ wsConnections: number(),
29903
+ distinctGroups: number(),
29904
+ /** Calls counted in the totals whose group attribution was shed at the
29905
+ * cardinality bound. */
29906
+ unattributedCalls: number(),
29907
+ procedures: array(RequestCensusProcedureSchema).readonly(),
29908
+ groups: array(RequestCensusGroupSchema).readonly()
29909
+ }).extend({ persisted: boolean() });
29910
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
29911
+ var LogLevelSchema$1 = _enum([
29912
+ "debug",
29913
+ "info",
29914
+ "warn",
29915
+ "error"
29916
+ ]);
29917
+ /**
29918
+ * The diagnostics that can be ARMED for a window. Exactly one today.
29919
+ *
29920
+ * A diagnostic is anything whose cost is only worth paying while a question is
29921
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
29922
+ */
29923
+ var DiagnosticIdSchema = _enum(["request-census"]);
29924
+ /**
29925
+ * The layers of the level hierarchy, general → specific. The most specific
29926
+ * layer that carries an explicit value wins.
29927
+ *
29928
+ * `component` is DECLARED and not yet resolvable: the per-component channels
29929
+ * are a later slice of the same plan, and a `levelSource` enum that has to
29930
+ * grow later would force every consumer of this document to change with it.
29931
+ * Nothing returns `component` today.
29932
+ */
29933
+ var LoggingScopeKindSchema = _enum([
29934
+ "cluster",
29935
+ "node",
29936
+ "component"
29937
+ ]);
29938
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
29939
+ var LoggingLevelSourceSchema = _enum([
29940
+ "default",
29941
+ "cluster",
29942
+ "node",
29943
+ "component"
29944
+ ]);
29945
+ /**
29946
+ * One layer of the hierarchy as it actually STANDS.
29947
+ *
29948
+ * `level: null` is the whole reason this array is returned: it is the
29949
+ * difference between "this node is at `info` because I decided it" and
29950
+ * "...because it inherits". An operator who clears an override believing they
29951
+ * are clearing an inherited value has been handed the same defect as the two
29952
+ * contradicting knobs this document exists to remove, moved one floor up.
29953
+ */
29954
+ var LoggingLevelLayerSchema = object({
29955
+ scope: LoggingScopeKindSchema,
29956
+ /** The node this layer speaks for; `null` on the cluster layer. */
29957
+ nodeId: string().nullable(),
29958
+ /** Explicitly set here, or `null` when this layer inherits. */
29959
+ level: LogLevelSchema$1.nullable()
29960
+ });
29961
+ /** What a line is judged against, and WHICH layer decided it. */
29962
+ var LoggingEffectiveSchema = object({
29963
+ level: LogLevelSchema$1,
29964
+ levelSource: LoggingLevelSourceSchema
29965
+ });
29966
+ /** Every layer, general → specific. Never collapsed into the effective value. */
29967
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
29968
+ /**
29969
+ * An armed diagnostic, with its DEADLINE.
29970
+ *
29971
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
29972
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
29973
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
29974
+ * `armed` is false — a window is never reported as slightly expired.
29975
+ */
29976
+ var DiagnosticWindowSchema = object({
29977
+ id: DiagnosticIdSchema,
29978
+ armed: boolean(),
29979
+ /** Epoch ms the window closes at. 0 when disarmed. */
29980
+ armedUntilMs: number(),
29981
+ /** Ms left before it expires on its own. 0 when disarmed. */
29982
+ remainingMs: number(),
29983
+ /** Whether the stored deadline is the one the live diagnostic is running —
29984
+ * i.e. whether this window would survive a restart. */
29985
+ persisted: boolean()
29986
+ });
29987
+ /**
29988
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
29989
+ * server — there is no maximum here on purpose: a bound repeated in a schema
29990
+ * is a second knob that disagrees with the first the day one of them moves.
29991
+ */
29992
+ var DiagnosticWindowPatchSchema = object({
29993
+ id: DiagnosticIdSchema,
29994
+ armMs: number().int().min(0),
29995
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
29996
+ reportEveryMs: number().int().positive().optional()
29997
+ });
29998
+ /**
29999
+ * A PATCH, and patches MERGE.
30000
+ *
30001
+ * A field absent from the patch is left exactly as it was — arming a
30002
+ * diagnostic never resets a level, and setting a level never disarms a window.
30003
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
30004
+ * `setAll` already merges, and rebuilding the object is how an absent field
30005
+ * turns into an erased one.
30006
+ */
30007
+ var LoggingSettingsPatchSchema = object({
30008
+ /**
30009
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
30010
+ * addressed scope so it inherits again. A value sets it.
30011
+ */
30012
+ level: LogLevelSchema$1.nullable().optional(),
30013
+ /**
30014
+ * Only the diagnostics NAMED here change. An armed window that is not listed
30015
+ * keeps running — a patch is never a full replacement.
30016
+ */
30017
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
30018
+ });
30019
+ /**
30020
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
30021
+ *
30022
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
30023
+ * input — the generated router strips it and uses it to resolve the PROVIDER
30024
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
30025
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
30026
+ * by an agent that holds no cluster document at all. The hub is the single
30027
+ * authority over the whole hierarchy and answers for every layer, so the
30028
+ * layer selector needs a name the transport does not already own.
30029
+ */
30030
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
30031
+ var SetLoggingSettingsInputSchema = object({
30032
+ scopeNodeId: string().optional(),
30033
+ patch: LoggingSettingsPatchSchema
30034
+ });
30035
+ /**
30036
+ * The whole document, as read and as returned after every write.
30037
+ *
30038
+ * `persisted: false` means the settings store could not be read or written.
30039
+ * The in-memory mirror still governs behaviour and is unchanged by the
30040
+ * failure — a read that fails neither switches a level nor disarms a window
30041
+ * (D49) — but the operator is told that what they are looking at would not
30042
+ * survive a restart.
30043
+ */
30044
+ var LoggingSettingsStateSchema = object({
30045
+ /** The layer this document was read at. `null` = the cluster layer. */
30046
+ scopeNodeId: string().nullable(),
30047
+ effective: LoggingEffectiveSchema,
30048
+ explicit: LoggingExplicitSchema,
30049
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
30050
+ persisted: boolean()
30051
+ });
29602
30052
  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(), {
29603
30053
  kind: "mutation",
29604
30054
  auth: "admin"
@@ -29611,6 +30061,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29611
30061
  }), method(_void(), SiteLocationStatusSchema, {
29612
30062
  kind: "mutation",
29613
30063
  auth: "admin"
30064
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
30065
+ kind: "mutation",
30066
+ auth: "admin"
29614
30067
  });
29615
30068
  /**
29616
30069
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -34646,6 +35099,12 @@ Object.freeze({
34646
35099
  addonId: null,
34647
35100
  access: "view"
34648
35101
  },
35102
+ "notificationRules.resolveArtifactUrl": {
35103
+ capName: "notification-rules",
35104
+ capScope: "system",
35105
+ addonId: null,
35106
+ access: "view"
35107
+ },
34649
35108
  "notificationRules.setAlarmConfig": {
34650
35109
  capName: "notification-rules",
34651
35110
  capScope: "system",
@@ -36050,6 +36509,12 @@ Object.freeze({
36050
36509
  addonId: null,
36051
36510
  access: "view"
36052
36511
  },
36512
+ "recording.readWindowBytes": {
36513
+ capName: "recording",
36514
+ capScope: "system",
36515
+ addonId: null,
36516
+ access: "view"
36517
+ },
36053
36518
  "recording.refreshStorageLocationsForMigration": {
36054
36519
  capName: "recording",
36055
36520
  capScope: "system",
@@ -36890,6 +37355,18 @@ Object.freeze({
36890
37355
  addonId: null,
36891
37356
  access: "create"
36892
37357
  },
37358
+ "system.getLoggingSettings": {
37359
+ capName: "system",
37360
+ capScope: "system",
37361
+ addonId: null,
37362
+ access: "view"
37363
+ },
37364
+ "system.getRequestCensus": {
37365
+ capName: "system",
37366
+ capScope: "system",
37367
+ addonId: null,
37368
+ access: "view"
37369
+ },
36893
37370
  "system.getRetentionConfig": {
36894
37371
  capName: "system",
36895
37372
  capScope: "system",
@@ -36920,6 +37397,12 @@ Object.freeze({
36920
37397
  addonId: null,
36921
37398
  access: "view"
36922
37399
  },
37400
+ "system.setLoggingSettings": {
37401
+ capName: "system",
37402
+ capScope: "system",
37403
+ addonId: null,
37404
+ access: "create"
37405
+ },
36923
37406
  "system.setRetentionConfig": {
36924
37407
  capName: "system",
36925
37408
  capScope: "system",
@@ -38075,6 +38558,10 @@ Object.freeze({
38075
38558
  name: "deviceId",
38076
38559
  form: "single",
38077
38560
  optional: true
38561
+ }, {
38562
+ name: "deviceIds",
38563
+ form: "array",
38564
+ optional: true
38078
38565
  }],
38079
38566
  "fanControl.setDirection": [{
38080
38567
  name: "deviceId",
@@ -38880,6 +39367,11 @@ Object.freeze({
38880
39367
  form: "single",
38881
39368
  optional: false
38882
39369
  }],
39370
+ "recording.readWindowBytes": [{
39371
+ name: "deviceId",
39372
+ form: "single",
39373
+ optional: false
39374
+ }],
38883
39375
  "recording.relocateFootage": [{
38884
39376
  name: "deviceId",
38885
39377
  form: "single",
@@ -39962,7 +40454,38 @@ object({
39962
40454
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
39963
40455
  * reproduce that.
39964
40456
  */
39965
- tileBudgetMb: number().int().min(0).max(1024)
40457
+ tileBudgetMb: number().int().min(0).max(1024),
40458
+ /**
40459
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
40460
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
40461
+ * subject tiles, on frames that detected something.
40462
+ *
40463
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
40464
+ * containment is strict by design, so the native `keyFrame`, the detail
40465
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
40466
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
40467
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
40468
+ * frame-time after delivery, with the request only p50 367 ms behind it.
40469
+ *
40470
+ * Sizing, and why this is a budget and not a duration: a scene tile is
40471
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
40472
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
40473
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
40474
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
40475
+ * binds only through a detection burst, where it still covers well past the
40476
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
40477
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
40478
+ * whole shape exists to avoid.
40479
+ *
40480
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
40481
+ * subject tile, so one shared budget would let a busy camera's key frames
40482
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
40483
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
40484
+ * pre-existing behaviour, where a late full-frame request had nothing but the
40485
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
40486
+ * nothing.
40487
+ */
40488
+ sceneBudgetMb: number().int().min(0).max(1024)
39966
40489
  });
39967
40490
  /**
39968
40491
  * The values in force when the operator has set nothing.
@@ -39978,12 +40501,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
39978
40501
  budgetMb: 1024,
39979
40502
  activityMs: 15e3,
39980
40503
  tileBudgetMb: 64,
40504
+ sceneBudgetMb: 48,
39981
40505
  admission: "inferred"
39982
40506
  };
39983
40507
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
39984
40508
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
39985
40509
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
39986
40510
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
40511
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
39987
40512
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
39988
40513
  /** Cosine similarity between two embedding vectors */
39989
40514
  function cosineSimilarity(a, b) {