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