@camstack/addon-matter-broker 0.2.29 → 0.2.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +572 -61
  2. package/dist/addon.mjs +572 -61
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -7540,6 +7540,66 @@ var OpsLogQueryInputSchema = object({
7540
7540
  /** Max rows returned, newest-first. */
7541
7541
  limit: number().int().min(1).max(1e3).optional()
7542
7542
  });
7543
+ var LabelDefinitionSchema = object({
7544
+ id: string$2(),
7545
+ name: string$2(),
7546
+ category: string$2().optional(),
7547
+ description: string$2().optional(),
7548
+ icon: string$2().optional()
7549
+ });
7550
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
7551
+ var CLASS_MAP_MACRO_TARGETS = [
7552
+ "person",
7553
+ "vehicle",
7554
+ "animal",
7555
+ "package"
7556
+ ];
7557
+ /**
7558
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
7559
+ * un operatore può selezionare.
7560
+ *
7561
+ * Sono le tre offerte dallo step `object-detection`
7562
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
7563
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
7564
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
7565
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
7566
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
7567
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
7568
+ *
7569
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
7570
+ * dello step e una seconda volta come union `FirstLevelMacro`
7571
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
7572
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
7573
+ * successiva.
7574
+ */
7575
+ var FIRST_LEVEL_MACRO_CLASSES = [
7576
+ "person",
7577
+ "vehicle",
7578
+ "animal"
7579
+ ];
7580
+ /**
7581
+ * Wire schema for a per-model CATALOG classMap override
7582
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
7583
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
7584
+ * detection pipeline executor actually routes.
7585
+ *
7586
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
7587
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
7588
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
7589
+ * enum) — the two used to share the name `ClassMapDefinition`/
7590
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
7591
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
7592
+ * are not: it is two different concepts colliding on a name. Keep this type
7593
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
7594
+ * would either narrow every `ClassMapDefinition` consumer to the four
7595
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
7596
+ * schema exists for (see the "rejects a classMap whose target is not a
7597
+ * detection macro" test in `model-catalog-schema.test.ts`).
7598
+ */
7599
+ var DetectionCatalogClassMapSchema = object({
7600
+ mapping: record(string$2(), _enum(CLASS_MAP_MACRO_TARGETS)),
7601
+ preserveOriginal: boolean()
7602
+ });
7543
7603
  /**
7544
7604
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
7545
7605
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -7562,10 +7622,55 @@ var RecordingStorageModeSchema = _enum([
7562
7622
  "events",
7563
7623
  "continuous"
7564
7624
  ]);
7625
+ /**
7626
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
7627
+ * tre offerte dallo step `object-detection`, da UNA lista
7628
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
7629
+ */
7630
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
7631
+ /**
7632
+ * True quando `values` non ripete un elemento.
7633
+ *
7634
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
7635
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
7636
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
7637
+ */
7638
+ var noDuplicates = (values) => new Set(values).size === values.length;
7565
7639
  /** Which detectors trigger an `events`-mode band. */
7566
7640
  var RecordingTriggersSchema = object({
7567
7641
  motion: boolean().optional(),
7568
- audioThresholdDbfs: number().optional()
7642
+ audioThresholdDbfs: number().optional(),
7643
+ /**
7644
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
7645
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
7646
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
7647
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
7648
+ *
7649
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
7650
+ * quelle che hanno attraversato `enabledMacroClasses`, i
7651
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
7652
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
7653
+ * finestre — vedi `recorder/object-trigger.ts`.
7654
+ */
7655
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
7656
+ /**
7657
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
7658
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
7659
+ * `objectClasses`.
7660
+ *
7661
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
7662
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
7663
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
7664
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
7665
+ * device (D12) — mai un elenco globale di cap.
7666
+ *
7667
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
7668
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
7669
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
7670
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
7671
+ * registrare.
7672
+ */
7673
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7569
7674
  });
7570
7675
  /**
7571
7676
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8017,41 +8122,6 @@ var DecoderSessionConfigSchema = object({
8017
8122
  */
8018
8123
  debug: boolean().optional()
8019
8124
  });
8020
- var LabelDefinitionSchema = object({
8021
- id: string$2(),
8022
- name: string$2(),
8023
- category: string$2().optional(),
8024
- description: string$2().optional(),
8025
- icon: string$2().optional()
8026
- });
8027
- /**
8028
- * Wire schema for a per-model CATALOG classMap override
8029
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8030
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8031
- * detection pipeline executor actually routes.
8032
- *
8033
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8034
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8035
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8036
- * enum) — the two used to share the name `ClassMapDefinition`/
8037
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8038
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8039
- * are not: it is two different concepts colliding on a name. Keep this type
8040
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8041
- * would either narrow every `ClassMapDefinition` consumer to the four
8042
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8043
- * schema exists for (see the "rejects a classMap whose target is not a
8044
- * detection macro" test in `model-catalog-schema.test.ts`).
8045
- */
8046
- var DetectionCatalogClassMapSchema = object({
8047
- mapping: record(string$2(), _enum([
8048
- "person",
8049
- "vehicle",
8050
- "animal",
8051
- "package"
8052
- ])),
8053
- preserveOriginal: boolean()
8054
- });
8055
8125
  var MODEL_FORMATS = [
8056
8126
  "onnx",
8057
8127
  "coreml",
@@ -15862,7 +15932,23 @@ var NcHistoryEntrySchema = object({
15862
15932
  updatedAt: number(),
15863
15933
  /** Failure detail — present on a `dead` row. */
15864
15934
  error: string$2().optional(),
15865
- subject: NcHistorySubjectSchema
15935
+ subject: NcHistorySubjectSchema,
15936
+ /**
15937
+ * Ids of the artefacts (still, then gif, then clip) this row's successful
15938
+ * delivery indexed in the artefact library — a REFERENCE, never the bytes
15939
+ * (an artefact is often megabytes; this row is durable JSON rewritten on
15940
+ * every delivery attempt). Absent on a row still pending/dead, a row
15941
+ * delivered before this field shipped, or a wiring with no artefact index.
15942
+ *
15943
+ * Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
15944
+ * outlives any one URL's TTL, so a caller mints a fresh link on demand
15945
+ * rather than trusting one frozen at delivery time. `resolveArtifactUrl`
15946
+ * also answers `null` for an id whose artefact has since expired past the
15947
+ * retained shelf's own age bound — the degrade a caller (the Home
15948
+ * Assistant export) must render as "no image right now", never as a
15949
+ * broken link.
15950
+ */
15951
+ artifactIds: array(string$2().min(1)).optional()
15866
15952
  });
15867
15953
  /**
15868
15954
  * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
@@ -16089,7 +16175,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
16089
16175
  }), method(object({}), object({
16090
16176
  catalog: array(NcConditionDescriptorSchema),
16091
16177
  taxonomy: NcTaxonomySchema.optional()
16092
- })), 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 }), {
16178
+ })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({ artifactId: string$2().min(1) }), object({ url: string$2().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
16093
16179
  kind: "mutation",
16094
16180
  caller: "required"
16095
16181
  }), method(object({ snoozeId: string$2() }), object({ success: literal(true) }), {
@@ -21217,7 +21303,7 @@ var lifecycleJobSchema = object({
21217
21303
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21218
21304
  * as every other cap.
21219
21305
  */
21220
- var LogLevelSchema$1 = _enum([
21306
+ var LogLevelSchema$2 = _enum([
21221
21307
  "debug",
21222
21308
  "info",
21223
21309
  "warn",
@@ -21424,7 +21510,7 @@ var CustomActionInputSchema = object({
21424
21510
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21425
21511
  addonId: string$2(),
21426
21512
  limit: number().min(1).max(500).default(100),
21427
- level: LogLevelSchema$1.optional()
21513
+ level: LogLevelSchema$2.optional()
21428
21514
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21429
21515
  packageName: string$2(),
21430
21516
  version: string$2().optional()
@@ -21522,7 +21608,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21522
21608
  auth: "admin"
21523
21609
  }), method(object({
21524
21610
  addonId: string$2(),
21525
- level: LogLevelSchema$1.optional()
21611
+ level: LogLevelSchema$2.optional()
21526
21612
  }), LogStreamEntrySchema, { kind: "subscription" });
21527
21613
  /**
21528
21614
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -23263,6 +23349,35 @@ var FaceFilterEnum = _enum([
23263
23349
  "identified",
23264
23350
  "all"
23265
23351
  ]);
23352
+ /**
23353
+ * What a `listRecentFaces` page is ORDERED BY.
23354
+ *
23355
+ * - `timestamp` — when the face was seen. The historical (and default) order.
23356
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
23357
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
23358
+ * order: it puts the suggestions an operator can confirm with one tap at the
23359
+ * top, and it is the reason this enum exists — a client that ranked a capped
23360
+ * page client-side was ranking the newest N, never the most certain N.
23361
+ *
23362
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
23363
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
23364
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
23365
+ * — flipping the direction reorders the rows that HAVE a certainty and never
23366
+ * floods the page with the ones that do not. `addon-post-analysis`'s
23367
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
23368
+ * then by faceId, and is what makes this a total order instead of the
23369
+ * backend's NULL-collation accident.
23370
+ */
23371
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
23372
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
23373
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
23374
+ * never leaves the server. */
23375
+ var FaceClusterSchema = object({
23376
+ faceIds: array(string$2()).readonly(),
23377
+ representativeFaceId: string$2(),
23378
+ size: number().int(),
23379
+ cohesion: number()
23380
+ });
23266
23381
  var MediaFileLiteSchema$1 = object({
23267
23382
  key: string$2(),
23268
23383
  kind: string$2(),
@@ -23309,24 +23424,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23309
23424
  kind: "mutation",
23310
23425
  auth: "admin"
23311
23426
  }), method(object({
23312
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
23427
+ /**
23428
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
23429
+ *
23430
+ * The legacy single-camera form, kept verbatim for every caller that
23431
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
23432
+ * instead — never both: `deviceIds` is the authority whenever it is
23433
+ * present, and this field is then ignored rather than unioned, so
23434
+ * there is exactly one answer to "which cameras did I ask for".
23435
+ */
23313
23436
  deviceId: number().int().optional(),
23437
+ /**
23438
+ * Restrict to a SET of cameras — the review UI's camera filter, which
23439
+ * until now had to fetch the cluster-wide page and drop rows in the
23440
+ * client (so the `limit` it asked for was spent on cameras it was
23441
+ * about to discard).
23442
+ *
23443
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
23444
+ * "every camera". A request for no devices is a request, not an
23445
+ * omission; same contract as `deviceManager.listFleet` and
23446
+ * `pipelineAnalytics.listRecentTracks`.
23447
+ *
23448
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
23449
+ */
23450
+ deviceIds: array(number().int()).optional(),
23314
23451
  limit: number().int().positive().optional(),
23315
23452
  filter: FaceFilterEnum.optional(),
23316
23453
  /**
23317
- * Inline the base64 crop on every row. Default `true` — the existing
23318
- * behaviour, kept so no caller breaks.
23454
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23455
+ * Absent means no lower bound.
23456
+ */
23457
+ since: number().int().optional(),
23458
+ /**
23459
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23460
+ * Absent means no upper bound.
23461
+ */
23462
+ until: number().int().optional(),
23463
+ /**
23464
+ * Order the page by time or by suggestion certainty. Default
23465
+ * `'timestamp'` — the historical order, unchanged for every caller
23466
+ * that does not ask.
23319
23467
  *
23320
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
23321
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
23322
- * the browser cache the images.
23468
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
23469
+ * does under `'suggestionConfidence'`.
23323
23470
  *
23324
- * **This is an INPUT field, so it does not reach the addon until the
23325
- * next train.** The hub router validates cap inputs against its own
23326
- * compiled Zod, which strips a key it does not know verified today
23327
- * on the OUTPUT side, where an additive field DOES arrive immediately
23328
- * (`Track.hasFace`). Until the train ships, sending `false` is
23329
- * harmless and simply keeps the crops inline.
23471
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
23472
+ * index and stops reading as soon as `limit` rows have PASSED the
23473
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
23474
+ * certain row may be the oldest so it walks the window. Narrow it
23475
+ * with {@link since} / {@link until}.
23476
+ */
23477
+ sortBy: FaceSortFieldEnum.optional(),
23478
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
23479
+ sortDirection: FaceSortDirectionEnum.optional(),
23480
+ /**
23481
+ * Inline the base64 crop on every row.
23482
+ *
23483
+ * Default `false` since the 2026-08-25 inversion — see
23484
+ * `include-crops-default.ts`, which is the ONE place that resolves
23485
+ * this for every gallery, and which records why the inline shape had
23486
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
23487
+ * The doc here used to still say `true`; it was wrong, and a leftover
23488
+ * that describes the old design reads as permission to rely on it.
23489
+ *
23490
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
23491
+ * which the browser fetches off the `event-media` plane in parallel,
23492
+ * cached and ETagged.
23330
23493
  */
23331
23494
  includeCrops: boolean().optional()
23332
23495
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -23362,13 +23525,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23362
23525
  }), method(object({
23363
23526
  threshold: number().min(0).max(1).optional(),
23364
23527
  minClusterSize: number().int().min(2).optional(),
23365
- limit: number().int().positive().optional()
23366
- }).optional(), array(object({
23367
- faceIds: array(string$2()).readonly(),
23368
- representativeFaceId: string$2(),
23369
- size: number().int(),
23370
- cohesion: number()
23371
- })).readonly());
23528
+ /**
23529
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
23530
+ * which read as though it bounded the work — it never did.
23531
+ *
23532
+ * Wins over {@link limit} when both are sent.
23533
+ */
23534
+ maxClusters: number().int().positive().optional(),
23535
+ /**
23536
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
23537
+ * RESULT, not the scan. Kept so existing callers keep working; send
23538
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
23539
+ */
23540
+ limit: number().int().positive().optional(),
23541
+ /**
23542
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
23543
+ * POOL, not the result.
23544
+ *
23545
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
23546
+ * used to read every unassigned face on the hub no matter what the
23547
+ * caller asked for, because the only bound cut the finished clusters
23548
+ * afterwards; a UI showing a window of 100 paid for a scan of the
23549
+ * whole corpus, on an addon whose disk is under contention.
23550
+ *
23551
+ * The pool is the NEWEST matching faces first — the same order the
23552
+ * gallery shows — so a bound here shortens the horizon, it does not
23553
+ * sample it randomly.
23554
+ *
23555
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
23556
+ * so the live corpus — 372 face rows — is unaffected while the
23557
+ * unbounded scan can never come back as the table grows.
23558
+ */
23559
+ maxFacesScanned: number().int().positive().optional()
23560
+ }).optional(), array(FaceClusterSchema).readonly());
23372
23561
  /**
23373
23562
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
23374
23563
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -27126,6 +27315,39 @@ var ReadGopBytesResultSchema = object({
27126
27315
  /** Media ms the returned fragment covers. */
27127
27316
  gopDurMs: number()
27128
27317
  });
27318
+ /**
27319
+ * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
27320
+ * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
27321
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
27322
+ * a replay needs several seconds of native pixels, not one frame.
27323
+ *
27324
+ * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
27325
+ * is `false` when the returned bytes were cut short by the read's own safety
27326
+ * byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
27327
+ * silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
27328
+ * degradation: a window whose end falls past the covering segment would need
27329
+ * bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
27330
+ * not one standalone-demuxable stream — the caller's answer is to request a
27331
+ * shorter window or one aligned to a single segment, not to receive spliced
27332
+ * bytes nothing has proven decodable.
27333
+ */
27334
+ var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
27335
+ kind: literal("ok"),
27336
+ data: _instanceof(Uint8Array),
27337
+ /** Absolute epoch ms of the returned bytes' first sample — at or before
27338
+ * the requested `fromMs` (anchored on the nearest keyframe). */
27339
+ gopStartMs: number(),
27340
+ /** Media ms the returned bytes cover, from `gopStartMs`. */
27341
+ gopDurMs: number(),
27342
+ /** `false` ⇒ the safety byte cap cut the read short before it reached
27343
+ * the requested `toMs`; the caller got fewer frames than asked for. */
27344
+ reachesRequestedEnd: boolean()
27345
+ }), object({
27346
+ kind: literal("spans-multiple-segments"),
27347
+ /** Where the covering segment's own footage runs out — informational,
27348
+ * not a retry hint (retrying the same window would refuse again). */
27349
+ segmentEndMs: number()
27350
+ })]);
27129
27351
  method(object({
27130
27352
  deviceId: number(),
27131
27353
  fromMs: number(),
@@ -27176,6 +27398,15 @@ method(object({
27176
27398
  }), ReadGopBytesResultSchema, {
27177
27399
  kind: "query",
27178
27400
  auth: "admin"
27401
+ }), method(object({
27402
+ deviceId: number(),
27403
+ profile: string$2(),
27404
+ startMs: number(),
27405
+ fromMs: number(),
27406
+ toMs: number()
27407
+ }), ReadWindowBytesResultSchema, {
27408
+ kind: "query",
27409
+ auth: "admin"
27179
27410
  }), method(object({
27180
27411
  deviceId: number(),
27181
27412
  config: RecordingConfigSchema
@@ -28268,6 +28499,211 @@ var SetSiteLocationInputSchema = object({
28268
28499
  latitude: number().min(-90).max(90),
28269
28500
  longitude: number().min(-180).max(180)
28270
28501
  }).nullable();
28502
+ /**
28503
+ * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28504
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28505
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28506
+ * already prints - never a token, never an `Authorization` header.
28507
+ */
28508
+ var RequestCensusGroupSchema = object({
28509
+ procedure: string$2(),
28510
+ userAgent: string$2(),
28511
+ ip: string$2(),
28512
+ principal: string$2(),
28513
+ calls: number(),
28514
+ perMin: number()
28515
+ });
28516
+ /**
28517
+ * A procedure's TOTAL over the window, across every caller.
28518
+ *
28519
+ * This block, not the group list, is what answers "did these calls arrive over
28520
+ * HTTP at all". A total far BELOW what a store-side census counted over the
28521
+ * same window excludes the HTTP plane, which is a result, not a failure.
28522
+ */
28523
+ var RequestCensusProcedureSchema = object({
28524
+ procedure: string$2(),
28525
+ calls: number(),
28526
+ perMin: number()
28527
+ });
28528
+ /**
28529
+ * The census as an operator sees it.
28530
+ *
28531
+ * `persisted` is the honest answer to "will this survive the restart I am
28532
+ * about to do": the arm deadline is written to `system-settings` so a window
28533
+ * armed now can measure the NEXT boot, and a write that failed must not look
28534
+ * like one that succeeded.
28535
+ */
28536
+ var RequestCensusStatusSchema = object({
28537
+ armed: boolean(),
28538
+ /** How long the current - or just-closed - window collected, in ms. */
28539
+ elapsedMs: number(),
28540
+ /** The window actually armed, after the server clamped the request. */
28541
+ windowMs: number(),
28542
+ /** Epoch ms the window closes at. 0 when disarmed. */
28543
+ armedUntilMs: number(),
28544
+ httpRequests: number(),
28545
+ batchedRequests: number(),
28546
+ /**
28547
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
28548
+ * is in play (`?batch=1` carries several procedures in one request); this is
28549
+ * the number comparable with a store-side call count.
28550
+ */
28551
+ procedureCalls: number(),
28552
+ /**
28553
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
28554
+ * transport resolves one context per connection - but the number that says
28555
+ * whether a plane this census cannot see was busy while HTTP was quiet.
28556
+ */
28557
+ wsConnections: number(),
28558
+ distinctGroups: number(),
28559
+ /** Calls counted in the totals whose group attribution was shed at the
28560
+ * cardinality bound. */
28561
+ unattributedCalls: number(),
28562
+ procedures: array(RequestCensusProcedureSchema).readonly(),
28563
+ groups: array(RequestCensusGroupSchema).readonly()
28564
+ }).extend({ persisted: boolean() });
28565
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
28566
+ var LogLevelSchema$1 = _enum([
28567
+ "debug",
28568
+ "info",
28569
+ "warn",
28570
+ "error"
28571
+ ]);
28572
+ /**
28573
+ * The diagnostics that can be ARMED for a window. Exactly one today.
28574
+ *
28575
+ * A diagnostic is anything whose cost is only worth paying while a question is
28576
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
28577
+ */
28578
+ var DiagnosticIdSchema = _enum(["request-census"]);
28579
+ /**
28580
+ * The layers of the level hierarchy, general → specific. The most specific
28581
+ * layer that carries an explicit value wins.
28582
+ *
28583
+ * `component` is DECLARED and not yet resolvable: the per-component channels
28584
+ * are a later slice of the same plan, and a `levelSource` enum that has to
28585
+ * grow later would force every consumer of this document to change with it.
28586
+ * Nothing returns `component` today.
28587
+ */
28588
+ var LoggingScopeKindSchema = _enum([
28589
+ "cluster",
28590
+ "node",
28591
+ "component"
28592
+ ]);
28593
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
28594
+ var LoggingLevelSourceSchema = _enum([
28595
+ "default",
28596
+ "cluster",
28597
+ "node",
28598
+ "component"
28599
+ ]);
28600
+ /**
28601
+ * One layer of the hierarchy as it actually STANDS.
28602
+ *
28603
+ * `level: null` is the whole reason this array is returned: it is the
28604
+ * difference between "this node is at `info` because I decided it" and
28605
+ * "...because it inherits". An operator who clears an override believing they
28606
+ * are clearing an inherited value has been handed the same defect as the two
28607
+ * contradicting knobs this document exists to remove, moved one floor up.
28608
+ */
28609
+ var LoggingLevelLayerSchema = object({
28610
+ scope: LoggingScopeKindSchema,
28611
+ /** The node this layer speaks for; `null` on the cluster layer. */
28612
+ nodeId: string$2().nullable(),
28613
+ /** Explicitly set here, or `null` when this layer inherits. */
28614
+ level: LogLevelSchema$1.nullable()
28615
+ });
28616
+ /** What a line is judged against, and WHICH layer decided it. */
28617
+ var LoggingEffectiveSchema = object({
28618
+ level: LogLevelSchema$1,
28619
+ levelSource: LoggingLevelSourceSchema
28620
+ });
28621
+ /** Every layer, general → specific. Never collapsed into the effective value. */
28622
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
28623
+ /**
28624
+ * An armed diagnostic, with its DEADLINE.
28625
+ *
28626
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
28627
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
28628
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
28629
+ * `armed` is false — a window is never reported as slightly expired.
28630
+ */
28631
+ var DiagnosticWindowSchema = object({
28632
+ id: DiagnosticIdSchema,
28633
+ armed: boolean(),
28634
+ /** Epoch ms the window closes at. 0 when disarmed. */
28635
+ armedUntilMs: number(),
28636
+ /** Ms left before it expires on its own. 0 when disarmed. */
28637
+ remainingMs: number(),
28638
+ /** Whether the stored deadline is the one the live diagnostic is running —
28639
+ * i.e. whether this window would survive a restart. */
28640
+ persisted: boolean()
28641
+ });
28642
+ /**
28643
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
28644
+ * server — there is no maximum here on purpose: a bound repeated in a schema
28645
+ * is a second knob that disagrees with the first the day one of them moves.
28646
+ */
28647
+ var DiagnosticWindowPatchSchema = object({
28648
+ id: DiagnosticIdSchema,
28649
+ armMs: number().int().min(0),
28650
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
28651
+ reportEveryMs: number().int().positive().optional()
28652
+ });
28653
+ /**
28654
+ * A PATCH, and patches MERGE.
28655
+ *
28656
+ * A field absent from the patch is left exactly as it was — arming a
28657
+ * diagnostic never resets a level, and setting a level never disarms a window.
28658
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
28659
+ * `setAll` already merges, and rebuilding the object is how an absent field
28660
+ * turns into an erased one.
28661
+ */
28662
+ var LoggingSettingsPatchSchema = object({
28663
+ /**
28664
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
28665
+ * addressed scope so it inherits again. A value sets it.
28666
+ */
28667
+ level: LogLevelSchema$1.nullable().optional(),
28668
+ /**
28669
+ * Only the diagnostics NAMED here change. An armed window that is not listed
28670
+ * keeps running — a patch is never a full replacement.
28671
+ */
28672
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28673
+ });
28674
+ /**
28675
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
28676
+ *
28677
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
28678
+ * input — the generated router strips it and uses it to resolve the PROVIDER
28679
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
28680
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
28681
+ * by an agent that holds no cluster document at all. The hub is the single
28682
+ * authority over the whole hierarchy and answers for every layer, so the
28683
+ * layer selector needs a name the transport does not already own.
28684
+ */
28685
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string$2().optional() });
28686
+ var SetLoggingSettingsInputSchema = object({
28687
+ scopeNodeId: string$2().optional(),
28688
+ patch: LoggingSettingsPatchSchema
28689
+ });
28690
+ /**
28691
+ * The whole document, as read and as returned after every write.
28692
+ *
28693
+ * `persisted: false` means the settings store could not be read or written.
28694
+ * The in-memory mirror still governs behaviour and is unchanged by the
28695
+ * failure — a read that fails neither switches a level nor disarms a window
28696
+ * (D49) — but the operator is told that what they are looking at would not
28697
+ * survive a restart.
28698
+ */
28699
+ var LoggingSettingsStateSchema = object({
28700
+ /** The layer this document was read at. `null` = the cluster layer. */
28701
+ scopeNodeId: string$2().nullable(),
28702
+ effective: LoggingEffectiveSchema,
28703
+ explicit: LoggingExplicitSchema,
28704
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
28705
+ persisted: boolean()
28706
+ });
28271
28707
  method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record(string$2(), unknown()), _null(), {
28272
28708
  kind: "mutation",
28273
28709
  auth: "admin"
@@ -28280,6 +28716,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28280
28716
  }), method(_void(), SiteLocationStatusSchema, {
28281
28717
  kind: "mutation",
28282
28718
  auth: "admin"
28719
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
28720
+ kind: "mutation",
28721
+ auth: "admin"
28283
28722
  });
28284
28723
  /**
28285
28724
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -33263,6 +33702,12 @@ Object.freeze({
33263
33702
  addonId: null,
33264
33703
  access: "view"
33265
33704
  },
33705
+ "notificationRules.resolveArtifactUrl": {
33706
+ capName: "notification-rules",
33707
+ capScope: "system",
33708
+ addonId: null,
33709
+ access: "view"
33710
+ },
33266
33711
  "notificationRules.setAlarmConfig": {
33267
33712
  capName: "notification-rules",
33268
33713
  capScope: "system",
@@ -34667,6 +35112,12 @@ Object.freeze({
34667
35112
  addonId: null,
34668
35113
  access: "view"
34669
35114
  },
35115
+ "recording.readWindowBytes": {
35116
+ capName: "recording",
35117
+ capScope: "system",
35118
+ addonId: null,
35119
+ access: "view"
35120
+ },
34670
35121
  "recording.refreshStorageLocationsForMigration": {
34671
35122
  capName: "recording",
34672
35123
  capScope: "system",
@@ -35507,6 +35958,18 @@ Object.freeze({
35507
35958
  addonId: null,
35508
35959
  access: "create"
35509
35960
  },
35961
+ "system.getLoggingSettings": {
35962
+ capName: "system",
35963
+ capScope: "system",
35964
+ addonId: null,
35965
+ access: "view"
35966
+ },
35967
+ "system.getRequestCensus": {
35968
+ capName: "system",
35969
+ capScope: "system",
35970
+ addonId: null,
35971
+ access: "view"
35972
+ },
35510
35973
  "system.getRetentionConfig": {
35511
35974
  capName: "system",
35512
35975
  capScope: "system",
@@ -35537,6 +36000,12 @@ Object.freeze({
35537
36000
  addonId: null,
35538
36001
  access: "view"
35539
36002
  },
36003
+ "system.setLoggingSettings": {
36004
+ capName: "system",
36005
+ capScope: "system",
36006
+ addonId: null,
36007
+ access: "create"
36008
+ },
35540
36009
  "system.setRetentionConfig": {
35541
36010
  capName: "system",
35542
36011
  capScope: "system",
@@ -36692,6 +37161,10 @@ Object.freeze({
36692
37161
  name: "deviceId",
36693
37162
  form: "single",
36694
37163
  optional: true
37164
+ }, {
37165
+ name: "deviceIds",
37166
+ form: "array",
37167
+ optional: true
36695
37168
  }],
36696
37169
  "fanControl.setDirection": [{
36697
37170
  name: "deviceId",
@@ -37497,6 +37970,11 @@ Object.freeze({
37497
37970
  form: "single",
37498
37971
  optional: false
37499
37972
  }],
37973
+ "recording.readWindowBytes": [{
37974
+ name: "deviceId",
37975
+ form: "single",
37976
+ optional: false
37977
+ }],
37500
37978
  "recording.relocateFootage": [{
37501
37979
  name: "deviceId",
37502
37980
  form: "single",
@@ -38297,7 +38775,38 @@ object({
38297
38775
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
38298
38776
  * reproduce that.
38299
38777
  */
38300
- tileBudgetMb: number().int().min(0).max(1024)
38778
+ tileBudgetMb: number().int().min(0).max(1024),
38779
+ /**
38780
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
38781
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
38782
+ * subject tiles, on frames that detected something.
38783
+ *
38784
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
38785
+ * containment is strict by design, so the native `keyFrame`, the detail
38786
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
38787
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
38788
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
38789
+ * frame-time after delivery, with the request only p50 367 ms behind it.
38790
+ *
38791
+ * Sizing, and why this is a budget and not a duration: a scene tile is
38792
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
38793
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
38794
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
38795
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
38796
+ * binds only through a detection burst, where it still covers well past the
38797
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
38798
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
38799
+ * whole shape exists to avoid.
38800
+ *
38801
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
38802
+ * subject tile, so one shared budget would let a busy camera's key frames
38803
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
38804
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
38805
+ * pre-existing behaviour, where a late full-frame request had nothing but the
38806
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
38807
+ * nothing.
38808
+ */
38809
+ sceneBudgetMb: number().int().min(0).max(1024)
38301
38810
  });
38302
38811
  /**
38303
38812
  * The values in force when the operator has set nothing.
@@ -38313,12 +38822,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
38313
38822
  budgetMb: 1024,
38314
38823
  activityMs: 15e3,
38315
38824
  tileBudgetMb: 64,
38825
+ sceneBudgetMb: 48,
38316
38826
  admission: "inferred"
38317
38827
  };
38318
38828
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
38319
38829
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
38320
38830
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
38321
38831
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
38832
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
38322
38833
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
38323
38834
  var MB = 1024 * 1024;
38324
38835
  1024 * MB, 3072 * MB;