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