@camstack/addon-provider-tuya 0.2.30 → 0.2.32

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
@@ -8346,6 +8346,66 @@ var OpsLogQueryInputSchema = object({
8346
8346
  /** Max rows returned, newest-first. */
8347
8347
  limit: number().int().min(1).max(1e3).optional()
8348
8348
  });
8349
+ var LabelDefinitionSchema = object({
8350
+ id: string(),
8351
+ name: string(),
8352
+ category: string().optional(),
8353
+ description: string().optional(),
8354
+ icon: string().optional()
8355
+ });
8356
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
8357
+ var CLASS_MAP_MACRO_TARGETS = [
8358
+ "person",
8359
+ "vehicle",
8360
+ "animal",
8361
+ "package"
8362
+ ];
8363
+ /**
8364
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
8365
+ * un operatore può selezionare.
8366
+ *
8367
+ * Sono le tre offerte dallo step `object-detection`
8368
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
8369
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
8370
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
8371
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
8372
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
8373
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
8374
+ *
8375
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
8376
+ * dello step e una seconda volta come union `FirstLevelMacro`
8377
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
8378
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
8379
+ * successiva.
8380
+ */
8381
+ var FIRST_LEVEL_MACRO_CLASSES = [
8382
+ "person",
8383
+ "vehicle",
8384
+ "animal"
8385
+ ];
8386
+ /**
8387
+ * Wire schema for a per-model CATALOG classMap override
8388
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8389
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8390
+ * detection pipeline executor actually routes.
8391
+ *
8392
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8393
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8394
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8395
+ * enum) — the two used to share the name `ClassMapDefinition`/
8396
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8397
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8398
+ * are not: it is two different concepts colliding on a name. Keep this type
8399
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8400
+ * would either narrow every `ClassMapDefinition` consumer to the four
8401
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8402
+ * schema exists for (see the "rejects a classMap whose target is not a
8403
+ * detection macro" test in `model-catalog-schema.test.ts`).
8404
+ */
8405
+ var DetectionCatalogClassMapSchema = object({
8406
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
8407
+ preserveOriginal: boolean()
8408
+ });
8349
8409
  /**
8350
8410
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
8351
8411
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -8368,10 +8428,55 @@ var RecordingStorageModeSchema = _enum([
8368
8428
  "events",
8369
8429
  "continuous"
8370
8430
  ]);
8431
+ /**
8432
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
8433
+ * tre offerte dallo step `object-detection`, da UNA lista
8434
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
8435
+ */
8436
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
8437
+ /**
8438
+ * True quando `values` non ripete un elemento.
8439
+ *
8440
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
8441
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
8442
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
8443
+ */
8444
+ var noDuplicates = (values) => new Set(values).size === values.length;
8371
8445
  /** Which detectors trigger an `events`-mode band. */
8372
8446
  var RecordingTriggersSchema = object({
8373
8447
  motion: boolean().optional(),
8374
- audioThresholdDbfs: number().optional()
8448
+ audioThresholdDbfs: number().optional(),
8449
+ /**
8450
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
8451
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
8452
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
8453
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
8454
+ *
8455
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
8456
+ * quelle che hanno attraversato `enabledMacroClasses`, i
8457
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
8458
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
8459
+ * finestre — vedi `recorder/object-trigger.ts`.
8460
+ */
8461
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
8462
+ /**
8463
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
8464
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
8465
+ * `objectClasses`.
8466
+ *
8467
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
8468
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
8469
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
8470
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
8471
+ * device (D12) — mai un elenco globale di cap.
8472
+ *
8473
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
8474
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
8475
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
8476
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
8477
+ * registrare.
8478
+ */
8479
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
8375
8480
  });
8376
8481
  /**
8377
8482
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8823,41 +8928,6 @@ var DecoderSessionConfigSchema = object({
8823
8928
  */
8824
8929
  debug: boolean().optional()
8825
8930
  });
8826
- var LabelDefinitionSchema = object({
8827
- id: string(),
8828
- name: string(),
8829
- category: string().optional(),
8830
- description: string().optional(),
8831
- icon: string().optional()
8832
- });
8833
- /**
8834
- * Wire schema for a per-model CATALOG classMap override
8835
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8836
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8837
- * detection pipeline executor actually routes.
8838
- *
8839
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8840
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8841
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8842
- * enum) — the two used to share the name `ClassMapDefinition`/
8843
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8844
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8845
- * are not: it is two different concepts colliding on a name. Keep this type
8846
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8847
- * would either narrow every `ClassMapDefinition` consumer to the four
8848
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8849
- * schema exists for (see the "rejects a classMap whose target is not a
8850
- * detection macro" test in `model-catalog-schema.test.ts`).
8851
- */
8852
- var DetectionCatalogClassMapSchema = object({
8853
- mapping: record(string(), _enum([
8854
- "person",
8855
- "vehicle",
8856
- "animal",
8857
- "package"
8858
- ])),
8859
- preserveOriginal: boolean()
8860
- });
8861
8931
  var MODEL_FORMATS = [
8862
8932
  "onnx",
8863
8933
  "coreml",
@@ -16619,7 +16689,23 @@ var NcHistoryEntrySchema = object({
16619
16689
  updatedAt: number(),
16620
16690
  /** Failure detail — present on a `dead` row. */
16621
16691
  error: string().optional(),
16622
- subject: NcHistorySubjectSchema
16692
+ subject: NcHistorySubjectSchema,
16693
+ /**
16694
+ * Ids of the artefacts (still, then gif, then clip) this row's successful
16695
+ * delivery indexed in the artefact library — a REFERENCE, never the bytes
16696
+ * (an artefact is often megabytes; this row is durable JSON rewritten on
16697
+ * every delivery attempt). Absent on a row still pending/dead, a row
16698
+ * delivered before this field shipped, or a wiring with no artefact index.
16699
+ *
16700
+ * Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
16701
+ * outlives any one URL's TTL, so a caller mints a fresh link on demand
16702
+ * rather than trusting one frozen at delivery time. `resolveArtifactUrl`
16703
+ * also answers `null` for an id whose artefact has since expired past the
16704
+ * retained shelf's own age bound — the degrade a caller (the Home
16705
+ * Assistant export) must render as "no image right now", never as a
16706
+ * broken link.
16707
+ */
16708
+ artifactIds: array(string().min(1)).optional()
16623
16709
  });
16624
16710
  /**
16625
16711
  * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
@@ -16846,7 +16932,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
16846
16932
  }), method(object({}), object({
16847
16933
  catalog: array(NcConditionDescriptorSchema),
16848
16934
  taxonomy: NcTaxonomySchema.optional()
16849
- })), 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 }), {
16935
+ })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
16850
16936
  kind: "mutation",
16851
16937
  caller: "required"
16852
16938
  }), method(object({ snoozeId: string() }), object({ success: literal(true) }), {
@@ -21974,7 +22060,7 @@ var lifecycleJobSchema = object({
21974
22060
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21975
22061
  * as every other cap.
21976
22062
  */
21977
- var LogLevelSchema$1 = _enum([
22063
+ var LogLevelSchema$2 = _enum([
21978
22064
  "debug",
21979
22065
  "info",
21980
22066
  "warn",
@@ -22181,7 +22267,7 @@ var CustomActionInputSchema = object({
22181
22267
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
22182
22268
  addonId: string(),
22183
22269
  limit: number().min(1).max(500).default(100),
22184
- level: LogLevelSchema$1.optional()
22270
+ level: LogLevelSchema$2.optional()
22185
22271
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
22186
22272
  packageName: string(),
22187
22273
  version: string().optional()
@@ -22279,7 +22365,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
22279
22365
  auth: "admin"
22280
22366
  }), method(object({
22281
22367
  addonId: string(),
22282
- level: LogLevelSchema$1.optional()
22368
+ level: LogLevelSchema$2.optional()
22283
22369
  }), LogStreamEntrySchema, { kind: "subscription" });
22284
22370
  /**
22285
22371
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -24011,6 +24097,35 @@ var FaceFilterEnum = _enum([
24011
24097
  "identified",
24012
24098
  "all"
24013
24099
  ]);
24100
+ /**
24101
+ * What a `listRecentFaces` page is ORDERED BY.
24102
+ *
24103
+ * - `timestamp` — when the face was seen. The historical (and default) order.
24104
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
24105
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
24106
+ * order: it puts the suggestions an operator can confirm with one tap at the
24107
+ * top, and it is the reason this enum exists — a client that ranked a capped
24108
+ * page client-side was ranking the newest N, never the most certain N.
24109
+ *
24110
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
24111
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
24112
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
24113
+ * — flipping the direction reorders the rows that HAVE a certainty and never
24114
+ * floods the page with the ones that do not. `addon-post-analysis`'s
24115
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
24116
+ * then by faceId, and is what makes this a total order instead of the
24117
+ * backend's NULL-collation accident.
24118
+ */
24119
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
24120
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
24121
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
24122
+ * never leaves the server. */
24123
+ var FaceClusterSchema = object({
24124
+ faceIds: array(string()).readonly(),
24125
+ representativeFaceId: string(),
24126
+ size: number().int(),
24127
+ cohesion: number()
24128
+ });
24014
24129
  var MediaFileLiteSchema$1 = object({
24015
24130
  key: string(),
24016
24131
  kind: string(),
@@ -24057,24 +24172,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24057
24172
  kind: "mutation",
24058
24173
  auth: "admin"
24059
24174
  }), method(object({
24060
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
24175
+ /**
24176
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
24177
+ *
24178
+ * The legacy single-camera form, kept verbatim for every caller that
24179
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
24180
+ * instead — never both: `deviceIds` is the authority whenever it is
24181
+ * present, and this field is then ignored rather than unioned, so
24182
+ * there is exactly one answer to "which cameras did I ask for".
24183
+ */
24061
24184
  deviceId: number().int().optional(),
24185
+ /**
24186
+ * Restrict to a SET of cameras — the review UI's camera filter, which
24187
+ * until now had to fetch the cluster-wide page and drop rows in the
24188
+ * client (so the `limit` it asked for was spent on cameras it was
24189
+ * about to discard).
24190
+ *
24191
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
24192
+ * "every camera". A request for no devices is a request, not an
24193
+ * omission; same contract as `deviceManager.listFleet` and
24194
+ * `pipelineAnalytics.listRecentTracks`.
24195
+ *
24196
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
24197
+ */
24198
+ deviceIds: array(number().int()).optional(),
24062
24199
  limit: number().int().positive().optional(),
24063
24200
  filter: FaceFilterEnum.optional(),
24064
24201
  /**
24065
- * Inline the base64 crop on every row. Default `true` — the existing
24066
- * behaviour, kept so no caller breaks.
24202
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24203
+ * Absent means no lower bound.
24204
+ */
24205
+ since: number().int().optional(),
24206
+ /**
24207
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24208
+ * Absent means no upper bound.
24209
+ */
24210
+ until: number().int().optional(),
24211
+ /**
24212
+ * Order the page by time or by suggestion certainty. Default
24213
+ * `'timestamp'` — the historical order, unchanged for every caller
24214
+ * that does not ask.
24067
24215
  *
24068
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
24069
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
24070
- * the browser cache the images.
24216
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
24217
+ * does under `'suggestionConfidence'`.
24071
24218
  *
24072
- * **This is an INPUT field, so it does not reach the addon until the
24073
- * next train.** The hub router validates cap inputs against its own
24074
- * compiled Zod, which strips a key it does not know — verified today
24075
- * on the OUTPUT side, where an additive field DOES arrive immediately
24076
- * (`Track.hasFace`). Until the train ships, sending `false` is
24077
- * harmless and simply keeps the crops inline.
24219
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
24220
+ * index and stops reading as soon as `limit` rows have PASSED the
24221
+ * filter. `'suggestionConfidence'` cannot stop early — the most
24222
+ * certain row may be the oldest — so it walks the window. Narrow it
24223
+ * with {@link since} / {@link until}.
24224
+ */
24225
+ sortBy: FaceSortFieldEnum.optional(),
24226
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
24227
+ sortDirection: FaceSortDirectionEnum.optional(),
24228
+ /**
24229
+ * Inline the base64 crop on every row.
24230
+ *
24231
+ * Default `false` since the 2026-08-25 inversion — see
24232
+ * `include-crops-default.ts`, which is the ONE place that resolves
24233
+ * this for every gallery, and which records why the inline shape had
24234
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
24235
+ * The doc here used to still say `true`; it was wrong, and a leftover
24236
+ * that describes the old design reads as permission to rely on it.
24237
+ *
24238
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
24239
+ * which the browser fetches off the `event-media` plane in parallel,
24240
+ * cached and ETagged.
24078
24241
  */
24079
24242
  includeCrops: boolean().optional()
24080
24243
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -24110,13 +24273,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24110
24273
  }), method(object({
24111
24274
  threshold: number().min(0).max(1).optional(),
24112
24275
  minClusterSize: number().int().min(2).optional(),
24113
- limit: number().int().positive().optional()
24114
- }).optional(), array(object({
24115
- faceIds: array(string()).readonly(),
24116
- representativeFaceId: string(),
24117
- size: number().int(),
24118
- cohesion: number()
24119
- })).readonly());
24276
+ /**
24277
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
24278
+ * which read as though it bounded the work — it never did.
24279
+ *
24280
+ * Wins over {@link limit} when both are sent.
24281
+ */
24282
+ maxClusters: number().int().positive().optional(),
24283
+ /**
24284
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
24285
+ * RESULT, not the scan. Kept so existing callers keep working; send
24286
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
24287
+ */
24288
+ limit: number().int().positive().optional(),
24289
+ /**
24290
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
24291
+ * POOL, not the result.
24292
+ *
24293
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
24294
+ * used to read every unassigned face on the hub no matter what the
24295
+ * caller asked for, because the only bound cut the finished clusters
24296
+ * afterwards; a UI showing a window of 100 paid for a scan of the
24297
+ * whole corpus, on an addon whose disk is under contention.
24298
+ *
24299
+ * The pool is the NEWEST matching faces first — the same order the
24300
+ * gallery shows — so a bound here shortens the horizon, it does not
24301
+ * sample it randomly.
24302
+ *
24303
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
24304
+ * so the live corpus — 372 face rows — is unaffected while the
24305
+ * unbounded scan can never come back as the table grows.
24306
+ */
24307
+ maxFacesScanned: number().int().positive().optional()
24308
+ }).optional(), array(FaceClusterSchema).readonly());
24120
24309
  /**
24121
24310
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
24122
24311
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -27874,6 +28063,39 @@ var ReadGopBytesResultSchema = object({
27874
28063
  /** Media ms the returned fragment covers. */
27875
28064
  gopDurMs: number()
27876
28065
  });
28066
+ /**
28067
+ * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
28068
+ * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
28069
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
28070
+ * a replay needs several seconds of native pixels, not one frame.
28071
+ *
28072
+ * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
28073
+ * is `false` when the returned bytes were cut short by the read's own safety
28074
+ * byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
28075
+ * silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
28076
+ * degradation: a window whose end falls past the covering segment would need
28077
+ * bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
28078
+ * not one standalone-demuxable stream — the caller's answer is to request a
28079
+ * shorter window or one aligned to a single segment, not to receive spliced
28080
+ * bytes nothing has proven decodable.
28081
+ */
28082
+ var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
28083
+ kind: literal("ok"),
28084
+ data: _instanceof(Uint8Array),
28085
+ /** Absolute epoch ms of the returned bytes' first sample — at or before
28086
+ * the requested `fromMs` (anchored on the nearest keyframe). */
28087
+ gopStartMs: number(),
28088
+ /** Media ms the returned bytes cover, from `gopStartMs`. */
28089
+ gopDurMs: number(),
28090
+ /** `false` ⇒ the safety byte cap cut the read short before it reached
28091
+ * the requested `toMs`; the caller got fewer frames than asked for. */
28092
+ reachesRequestedEnd: boolean()
28093
+ }), object({
28094
+ kind: literal("spans-multiple-segments"),
28095
+ /** Where the covering segment's own footage runs out — informational,
28096
+ * not a retry hint (retrying the same window would refuse again). */
28097
+ segmentEndMs: number()
28098
+ })]);
27877
28099
  method(object({
27878
28100
  deviceId: number(),
27879
28101
  fromMs: number(),
@@ -27924,6 +28146,15 @@ method(object({
27924
28146
  }), ReadGopBytesResultSchema, {
27925
28147
  kind: "query",
27926
28148
  auth: "admin"
28149
+ }), method(object({
28150
+ deviceId: number(),
28151
+ profile: string(),
28152
+ startMs: number(),
28153
+ fromMs: number(),
28154
+ toMs: number()
28155
+ }), ReadWindowBytesResultSchema, {
28156
+ kind: "query",
28157
+ auth: "admin"
27927
28158
  }), method(object({
27928
28159
  deviceId: number(),
27929
28160
  config: RecordingConfigSchema
@@ -29016,6 +29247,211 @@ var SetSiteLocationInputSchema = object({
29016
29247
  latitude: number().min(-90).max(90),
29017
29248
  longitude: number().min(-180).max(180)
29018
29249
  }).nullable();
29250
+ /**
29251
+ * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
29252
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29253
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29254
+ * already prints - never a token, never an `Authorization` header.
29255
+ */
29256
+ var RequestCensusGroupSchema = object({
29257
+ procedure: string(),
29258
+ userAgent: string(),
29259
+ ip: string(),
29260
+ principal: string(),
29261
+ calls: number(),
29262
+ perMin: number()
29263
+ });
29264
+ /**
29265
+ * A procedure's TOTAL over the window, across every caller.
29266
+ *
29267
+ * This block, not the group list, is what answers "did these calls arrive over
29268
+ * HTTP at all". A total far BELOW what a store-side census counted over the
29269
+ * same window excludes the HTTP plane, which is a result, not a failure.
29270
+ */
29271
+ var RequestCensusProcedureSchema = object({
29272
+ procedure: string(),
29273
+ calls: number(),
29274
+ perMin: number()
29275
+ });
29276
+ /**
29277
+ * The census as an operator sees it.
29278
+ *
29279
+ * `persisted` is the honest answer to "will this survive the restart I am
29280
+ * about to do": the arm deadline is written to `system-settings` so a window
29281
+ * armed now can measure the NEXT boot, and a write that failed must not look
29282
+ * like one that succeeded.
29283
+ */
29284
+ var RequestCensusStatusSchema = object({
29285
+ armed: boolean(),
29286
+ /** How long the current - or just-closed - window collected, in ms. */
29287
+ elapsedMs: number(),
29288
+ /** The window actually armed, after the server clamped the request. */
29289
+ windowMs: number(),
29290
+ /** Epoch ms the window closes at. 0 when disarmed. */
29291
+ armedUntilMs: number(),
29292
+ httpRequests: number(),
29293
+ batchedRequests: number(),
29294
+ /**
29295
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
29296
+ * is in play (`?batch=1` carries several procedures in one request); this is
29297
+ * the number comparable with a store-side call count.
29298
+ */
29299
+ procedureCalls: number(),
29300
+ /**
29301
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
29302
+ * transport resolves one context per connection - but the number that says
29303
+ * whether a plane this census cannot see was busy while HTTP was quiet.
29304
+ */
29305
+ wsConnections: number(),
29306
+ distinctGroups: number(),
29307
+ /** Calls counted in the totals whose group attribution was shed at the
29308
+ * cardinality bound. */
29309
+ unattributedCalls: number(),
29310
+ procedures: array(RequestCensusProcedureSchema).readonly(),
29311
+ groups: array(RequestCensusGroupSchema).readonly()
29312
+ }).extend({ persisted: boolean() });
29313
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
29314
+ var LogLevelSchema$1 = _enum([
29315
+ "debug",
29316
+ "info",
29317
+ "warn",
29318
+ "error"
29319
+ ]);
29320
+ /**
29321
+ * The diagnostics that can be ARMED for a window. Exactly one today.
29322
+ *
29323
+ * A diagnostic is anything whose cost is only worth paying while a question is
29324
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
29325
+ */
29326
+ var DiagnosticIdSchema = _enum(["request-census"]);
29327
+ /**
29328
+ * The layers of the level hierarchy, general → specific. The most specific
29329
+ * layer that carries an explicit value wins.
29330
+ *
29331
+ * `component` is DECLARED and not yet resolvable: the per-component channels
29332
+ * are a later slice of the same plan, and a `levelSource` enum that has to
29333
+ * grow later would force every consumer of this document to change with it.
29334
+ * Nothing returns `component` today.
29335
+ */
29336
+ var LoggingScopeKindSchema = _enum([
29337
+ "cluster",
29338
+ "node",
29339
+ "component"
29340
+ ]);
29341
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
29342
+ var LoggingLevelSourceSchema = _enum([
29343
+ "default",
29344
+ "cluster",
29345
+ "node",
29346
+ "component"
29347
+ ]);
29348
+ /**
29349
+ * One layer of the hierarchy as it actually STANDS.
29350
+ *
29351
+ * `level: null` is the whole reason this array is returned: it is the
29352
+ * difference between "this node is at `info` because I decided it" and
29353
+ * "...because it inherits". An operator who clears an override believing they
29354
+ * are clearing an inherited value has been handed the same defect as the two
29355
+ * contradicting knobs this document exists to remove, moved one floor up.
29356
+ */
29357
+ var LoggingLevelLayerSchema = object({
29358
+ scope: LoggingScopeKindSchema,
29359
+ /** The node this layer speaks for; `null` on the cluster layer. */
29360
+ nodeId: string().nullable(),
29361
+ /** Explicitly set here, or `null` when this layer inherits. */
29362
+ level: LogLevelSchema$1.nullable()
29363
+ });
29364
+ /** What a line is judged against, and WHICH layer decided it. */
29365
+ var LoggingEffectiveSchema = object({
29366
+ level: LogLevelSchema$1,
29367
+ levelSource: LoggingLevelSourceSchema
29368
+ });
29369
+ /** Every layer, general → specific. Never collapsed into the effective value. */
29370
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
29371
+ /**
29372
+ * An armed diagnostic, with its DEADLINE.
29373
+ *
29374
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
29375
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
29376
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
29377
+ * `armed` is false — a window is never reported as slightly expired.
29378
+ */
29379
+ var DiagnosticWindowSchema = object({
29380
+ id: DiagnosticIdSchema,
29381
+ armed: boolean(),
29382
+ /** Epoch ms the window closes at. 0 when disarmed. */
29383
+ armedUntilMs: number(),
29384
+ /** Ms left before it expires on its own. 0 when disarmed. */
29385
+ remainingMs: number(),
29386
+ /** Whether the stored deadline is the one the live diagnostic is running —
29387
+ * i.e. whether this window would survive a restart. */
29388
+ persisted: boolean()
29389
+ });
29390
+ /**
29391
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
29392
+ * server — there is no maximum here on purpose: a bound repeated in a schema
29393
+ * is a second knob that disagrees with the first the day one of them moves.
29394
+ */
29395
+ var DiagnosticWindowPatchSchema = object({
29396
+ id: DiagnosticIdSchema,
29397
+ armMs: number().int().min(0),
29398
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
29399
+ reportEveryMs: number().int().positive().optional()
29400
+ });
29401
+ /**
29402
+ * A PATCH, and patches MERGE.
29403
+ *
29404
+ * A field absent from the patch is left exactly as it was — arming a
29405
+ * diagnostic never resets a level, and setting a level never disarms a window.
29406
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
29407
+ * `setAll` already merges, and rebuilding the object is how an absent field
29408
+ * turns into an erased one.
29409
+ */
29410
+ var LoggingSettingsPatchSchema = object({
29411
+ /**
29412
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
29413
+ * addressed scope so it inherits again. A value sets it.
29414
+ */
29415
+ level: LogLevelSchema$1.nullable().optional(),
29416
+ /**
29417
+ * Only the diagnostics NAMED here change. An armed window that is not listed
29418
+ * keeps running — a patch is never a full replacement.
29419
+ */
29420
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29421
+ });
29422
+ /**
29423
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
29424
+ *
29425
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
29426
+ * input — the generated router strips it and uses it to resolve the PROVIDER
29427
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
29428
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
29429
+ * by an agent that holds no cluster document at all. The hub is the single
29430
+ * authority over the whole hierarchy and answers for every layer, so the
29431
+ * layer selector needs a name the transport does not already own.
29432
+ */
29433
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29434
+ var SetLoggingSettingsInputSchema = object({
29435
+ scopeNodeId: string().optional(),
29436
+ patch: LoggingSettingsPatchSchema
29437
+ });
29438
+ /**
29439
+ * The whole document, as read and as returned after every write.
29440
+ *
29441
+ * `persisted: false` means the settings store could not be read or written.
29442
+ * The in-memory mirror still governs behaviour and is unchanged by the
29443
+ * failure — a read that fails neither switches a level nor disarms a window
29444
+ * (D49) — but the operator is told that what they are looking at would not
29445
+ * survive a restart.
29446
+ */
29447
+ var LoggingSettingsStateSchema = object({
29448
+ /** The layer this document was read at. `null` = the cluster layer. */
29449
+ scopeNodeId: string().nullable(),
29450
+ effective: LoggingEffectiveSchema,
29451
+ explicit: LoggingExplicitSchema,
29452
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
29453
+ persisted: boolean()
29454
+ });
29019
29455
  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(), {
29020
29456
  kind: "mutation",
29021
29457
  auth: "admin"
@@ -29028,6 +29464,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29028
29464
  }), method(_void(), SiteLocationStatusSchema, {
29029
29465
  kind: "mutation",
29030
29466
  auth: "admin"
29467
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29468
+ kind: "mutation",
29469
+ auth: "admin"
29031
29470
  });
29032
29471
  /**
29033
29472
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -34011,6 +34450,12 @@ Object.freeze({
34011
34450
  addonId: null,
34012
34451
  access: "view"
34013
34452
  },
34453
+ "notificationRules.resolveArtifactUrl": {
34454
+ capName: "notification-rules",
34455
+ capScope: "system",
34456
+ addonId: null,
34457
+ access: "view"
34458
+ },
34014
34459
  "notificationRules.setAlarmConfig": {
34015
34460
  capName: "notification-rules",
34016
34461
  capScope: "system",
@@ -35415,6 +35860,12 @@ Object.freeze({
35415
35860
  addonId: null,
35416
35861
  access: "view"
35417
35862
  },
35863
+ "recording.readWindowBytes": {
35864
+ capName: "recording",
35865
+ capScope: "system",
35866
+ addonId: null,
35867
+ access: "view"
35868
+ },
35418
35869
  "recording.refreshStorageLocationsForMigration": {
35419
35870
  capName: "recording",
35420
35871
  capScope: "system",
@@ -36255,6 +36706,18 @@ Object.freeze({
36255
36706
  addonId: null,
36256
36707
  access: "create"
36257
36708
  },
36709
+ "system.getLoggingSettings": {
36710
+ capName: "system",
36711
+ capScope: "system",
36712
+ addonId: null,
36713
+ access: "view"
36714
+ },
36715
+ "system.getRequestCensus": {
36716
+ capName: "system",
36717
+ capScope: "system",
36718
+ addonId: null,
36719
+ access: "view"
36720
+ },
36258
36721
  "system.getRetentionConfig": {
36259
36722
  capName: "system",
36260
36723
  capScope: "system",
@@ -36285,6 +36748,12 @@ Object.freeze({
36285
36748
  addonId: null,
36286
36749
  access: "view"
36287
36750
  },
36751
+ "system.setLoggingSettings": {
36752
+ capName: "system",
36753
+ capScope: "system",
36754
+ addonId: null,
36755
+ access: "create"
36756
+ },
36288
36757
  "system.setRetentionConfig": {
36289
36758
  capName: "system",
36290
36759
  capScope: "system",
@@ -37440,6 +37909,10 @@ Object.freeze({
37440
37909
  name: "deviceId",
37441
37910
  form: "single",
37442
37911
  optional: true
37912
+ }, {
37913
+ name: "deviceIds",
37914
+ form: "array",
37915
+ optional: true
37443
37916
  }],
37444
37917
  "fanControl.setDirection": [{
37445
37918
  name: "deviceId",
@@ -38245,6 +38718,11 @@ Object.freeze({
38245
38718
  form: "single",
38246
38719
  optional: false
38247
38720
  }],
38721
+ "recording.readWindowBytes": [{
38722
+ name: "deviceId",
38723
+ form: "single",
38724
+ optional: false
38725
+ }],
38248
38726
  "recording.relocateFootage": [{
38249
38727
  name: "deviceId",
38250
38728
  form: "single",
@@ -39045,7 +39523,38 @@ object({
39045
39523
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
39046
39524
  * reproduce that.
39047
39525
  */
39048
- tileBudgetMb: number().int().min(0).max(1024)
39526
+ tileBudgetMb: number().int().min(0).max(1024),
39527
+ /**
39528
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
39529
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
39530
+ * subject tiles, on frames that detected something.
39531
+ *
39532
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
39533
+ * containment is strict by design, so the native `keyFrame`, the detail
39534
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
39535
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
39536
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
39537
+ * frame-time after delivery, with the request only p50 367 ms behind it.
39538
+ *
39539
+ * Sizing, and why this is a budget and not a duration: a scene tile is
39540
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
39541
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
39542
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
39543
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
39544
+ * binds only through a detection burst, where it still covers well past the
39545
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
39546
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
39547
+ * whole shape exists to avoid.
39548
+ *
39549
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
39550
+ * subject tile, so one shared budget would let a busy camera's key frames
39551
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
39552
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
39553
+ * pre-existing behaviour, where a late full-frame request had nothing but the
39554
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
39555
+ * nothing.
39556
+ */
39557
+ sceneBudgetMb: number().int().min(0).max(1024)
39049
39558
  });
39050
39559
  /**
39051
39560
  * The values in force when the operator has set nothing.
@@ -39061,12 +39570,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
39061
39570
  budgetMb: 1024,
39062
39571
  activityMs: 15e3,
39063
39572
  tileBudgetMb: 64,
39573
+ sceneBudgetMb: 48,
39064
39574
  admission: "inferred"
39065
39575
  };
39066
39576
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
39067
39577
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
39068
39578
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
39069
39579
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
39580
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
39070
39581
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
39071
39582
  var MB = 1024 * 1024;
39072
39583
  1024 * MB, 3072 * MB;