@camstack/addon-export-hap 1.2.41 → 1.2.43

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.
@@ -8180,6 +8180,66 @@ var OpsLogQueryInputSchema = object({
8180
8180
  /** Max rows returned, newest-first. */
8181
8181
  limit: number().int().min(1).max(1e3).optional()
8182
8182
  });
8183
+ var LabelDefinitionSchema = object({
8184
+ id: string(),
8185
+ name: string(),
8186
+ category: string().optional(),
8187
+ description: string().optional(),
8188
+ icon: string().optional()
8189
+ });
8190
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
8191
+ var CLASS_MAP_MACRO_TARGETS = [
8192
+ "person",
8193
+ "vehicle",
8194
+ "animal",
8195
+ "package"
8196
+ ];
8197
+ /**
8198
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
8199
+ * un operatore può selezionare.
8200
+ *
8201
+ * Sono le tre offerte dallo step `object-detection`
8202
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
8203
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
8204
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
8205
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
8206
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
8207
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
8208
+ *
8209
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
8210
+ * dello step e una seconda volta come union `FirstLevelMacro`
8211
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
8212
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
8213
+ * successiva.
8214
+ */
8215
+ var FIRST_LEVEL_MACRO_CLASSES = [
8216
+ "person",
8217
+ "vehicle",
8218
+ "animal"
8219
+ ];
8220
+ /**
8221
+ * Wire schema for a per-model CATALOG classMap override
8222
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8223
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8224
+ * detection pipeline executor actually routes.
8225
+ *
8226
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8227
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8228
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8229
+ * enum) — the two used to share the name `ClassMapDefinition`/
8230
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8231
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8232
+ * are not: it is two different concepts colliding on a name. Keep this type
8233
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8234
+ * would either narrow every `ClassMapDefinition` consumer to the four
8235
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8236
+ * schema exists for (see the "rejects a classMap whose target is not a
8237
+ * detection macro" test in `model-catalog-schema.test.ts`).
8238
+ */
8239
+ var DetectionCatalogClassMapSchema = object({
8240
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
8241
+ preserveOriginal: boolean()
8242
+ });
8183
8243
  /**
8184
8244
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
8185
8245
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -8202,10 +8262,55 @@ var RecordingStorageModeSchema = _enum([
8202
8262
  "events",
8203
8263
  "continuous"
8204
8264
  ]);
8265
+ /**
8266
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
8267
+ * tre offerte dallo step `object-detection`, da UNA lista
8268
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
8269
+ */
8270
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
8271
+ /**
8272
+ * True quando `values` non ripete un elemento.
8273
+ *
8274
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
8275
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
8276
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
8277
+ */
8278
+ var noDuplicates = (values) => new Set(values).size === values.length;
8205
8279
  /** Which detectors trigger an `events`-mode band. */
8206
8280
  var RecordingTriggersSchema = object({
8207
8281
  motion: boolean().optional(),
8208
- audioThresholdDbfs: number().optional()
8282
+ audioThresholdDbfs: number().optional(),
8283
+ /**
8284
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
8285
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
8286
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
8287
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
8288
+ *
8289
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
8290
+ * quelle che hanno attraversato `enabledMacroClasses`, i
8291
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
8292
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
8293
+ * finestre — vedi `recorder/object-trigger.ts`.
8294
+ */
8295
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
8296
+ /**
8297
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
8298
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
8299
+ * `objectClasses`.
8300
+ *
8301
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
8302
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
8303
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
8304
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
8305
+ * device (D12) — mai un elenco globale di cap.
8306
+ *
8307
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
8308
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
8309
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
8310
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
8311
+ * registrare.
8312
+ */
8313
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
8209
8314
  });
8210
8315
  /**
8211
8316
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8711,41 +8816,6 @@ function pickClosestResolution(entries, target) {
8711
8816
  }
8712
8817
  return bestAbove?.entry ?? bestBelow?.entry;
8713
8818
  }
8714
- var LabelDefinitionSchema = object({
8715
- id: string(),
8716
- name: string(),
8717
- category: string().optional(),
8718
- description: string().optional(),
8719
- icon: string().optional()
8720
- });
8721
- /**
8722
- * Wire schema for a per-model CATALOG classMap override
8723
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8724
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8725
- * detection pipeline executor actually routes.
8726
- *
8727
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8728
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8729
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8730
- * enum) — the two used to share the name `ClassMapDefinition`/
8731
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8732
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8733
- * are not: it is two different concepts colliding on a name. Keep this type
8734
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8735
- * would either narrow every `ClassMapDefinition` consumer to the four
8736
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8737
- * schema exists for (see the "rejects a classMap whose target is not a
8738
- * detection macro" test in `model-catalog-schema.test.ts`).
8739
- */
8740
- var DetectionCatalogClassMapSchema = object({
8741
- mapping: record(string(), _enum([
8742
- "person",
8743
- "vehicle",
8744
- "animal",
8745
- "package"
8746
- ])),
8747
- preserveOriginal: boolean()
8748
- });
8749
8819
  var MODEL_FORMATS = [
8750
8820
  "onnx",
8751
8821
  "coreml",
@@ -16269,7 +16339,23 @@ var NcHistoryEntrySchema = object({
16269
16339
  updatedAt: number(),
16270
16340
  /** Failure detail — present on a `dead` row. */
16271
16341
  error: string().optional(),
16272
- subject: NcHistorySubjectSchema
16342
+ subject: NcHistorySubjectSchema,
16343
+ /**
16344
+ * Ids of the artefacts (still, then gif, then clip) this row's successful
16345
+ * delivery indexed in the artefact library — a REFERENCE, never the bytes
16346
+ * (an artefact is often megabytes; this row is durable JSON rewritten on
16347
+ * every delivery attempt). Absent on a row still pending/dead, a row
16348
+ * delivered before this field shipped, or a wiring with no artefact index.
16349
+ *
16350
+ * Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
16351
+ * outlives any one URL's TTL, so a caller mints a fresh link on demand
16352
+ * rather than trusting one frozen at delivery time. `resolveArtifactUrl`
16353
+ * also answers `null` for an id whose artefact has since expired past the
16354
+ * retained shelf's own age bound — the degrade a caller (the Home
16355
+ * Assistant export) must render as "no image right now", never as a
16356
+ * broken link.
16357
+ */
16358
+ artifactIds: array(string().min(1)).optional()
16273
16359
  });
16274
16360
  /**
16275
16361
  * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
@@ -16496,7 +16582,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
16496
16582
  }), method(object({}), object({
16497
16583
  catalog: array(NcConditionDescriptorSchema),
16498
16584
  taxonomy: NcTaxonomySchema.optional()
16499
- })), 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 }), {
16585
+ })), 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 }), {
16500
16586
  kind: "mutation",
16501
16587
  caller: "required"
16502
16588
  }), method(object({ snoozeId: string() }), object({ success: literal(true) }), {
@@ -21584,7 +21670,7 @@ var lifecycleJobSchema = object({
21584
21670
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21585
21671
  * as every other cap.
21586
21672
  */
21587
- var LogLevelSchema$1 = _enum([
21673
+ var LogLevelSchema$2 = _enum([
21588
21674
  "debug",
21589
21675
  "info",
21590
21676
  "warn",
@@ -21791,7 +21877,7 @@ var CustomActionInputSchema = object({
21791
21877
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21792
21878
  addonId: string(),
21793
21879
  limit: number().min(1).max(500).default(100),
21794
- level: LogLevelSchema$1.optional()
21880
+ level: LogLevelSchema$2.optional()
21795
21881
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21796
21882
  packageName: string(),
21797
21883
  version: string().optional()
@@ -21889,7 +21975,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21889
21975
  auth: "admin"
21890
21976
  }), method(object({
21891
21977
  addonId: string(),
21892
- level: LogLevelSchema$1.optional()
21978
+ level: LogLevelSchema$2.optional()
21893
21979
  }), LogStreamEntrySchema, { kind: "subscription" });
21894
21980
  object({
21895
21981
  /** Carbon dioxide concentration in ppm. */
@@ -22903,6 +22989,35 @@ var FaceFilterEnum = _enum([
22903
22989
  "identified",
22904
22990
  "all"
22905
22991
  ]);
22992
+ /**
22993
+ * What a `listRecentFaces` page is ORDERED BY.
22994
+ *
22995
+ * - `timestamp` — when the face was seen. The historical (and default) order.
22996
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
22997
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
22998
+ * order: it puts the suggestions an operator can confirm with one tap at the
22999
+ * top, and it is the reason this enum exists — a client that ranked a capped
23000
+ * page client-side was ranking the newest N, never the most certain N.
23001
+ *
23002
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
23003
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
23004
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
23005
+ * — flipping the direction reorders the rows that HAVE a certainty and never
23006
+ * floods the page with the ones that do not. `addon-post-analysis`'s
23007
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
23008
+ * then by faceId, and is what makes this a total order instead of the
23009
+ * backend's NULL-collation accident.
23010
+ */
23011
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
23012
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
23013
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
23014
+ * never leaves the server. */
23015
+ var FaceClusterSchema = object({
23016
+ faceIds: array(string()).readonly(),
23017
+ representativeFaceId: string(),
23018
+ size: number().int(),
23019
+ cohesion: number()
23020
+ });
22906
23021
  var MediaFileLiteSchema$1 = object({
22907
23022
  key: string(),
22908
23023
  kind: string(),
@@ -22949,24 +23064,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
22949
23064
  kind: "mutation",
22950
23065
  auth: "admin"
22951
23066
  }), method(object({
22952
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
23067
+ /**
23068
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
23069
+ *
23070
+ * The legacy single-camera form, kept verbatim for every caller that
23071
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
23072
+ * instead — never both: `deviceIds` is the authority whenever it is
23073
+ * present, and this field is then ignored rather than unioned, so
23074
+ * there is exactly one answer to "which cameras did I ask for".
23075
+ */
22953
23076
  deviceId: number().int().optional(),
23077
+ /**
23078
+ * Restrict to a SET of cameras — the review UI's camera filter, which
23079
+ * until now had to fetch the cluster-wide page and drop rows in the
23080
+ * client (so the `limit` it asked for was spent on cameras it was
23081
+ * about to discard).
23082
+ *
23083
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
23084
+ * "every camera". A request for no devices is a request, not an
23085
+ * omission; same contract as `deviceManager.listFleet` and
23086
+ * `pipelineAnalytics.listRecentTracks`.
23087
+ *
23088
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
23089
+ */
23090
+ deviceIds: array(number().int()).optional(),
22954
23091
  limit: number().int().positive().optional(),
22955
23092
  filter: FaceFilterEnum.optional(),
22956
23093
  /**
22957
- * Inline the base64 crop on every row. Default `true` — the existing
22958
- * behaviour, kept so no caller breaks.
23094
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23095
+ * Absent means no lower bound.
23096
+ */
23097
+ since: number().int().optional(),
23098
+ /**
23099
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23100
+ * Absent means no upper bound.
23101
+ */
23102
+ until: number().int().optional(),
23103
+ /**
23104
+ * Order the page by time or by suggestion certainty. Default
23105
+ * `'timestamp'` — the historical order, unchanged for every caller
23106
+ * that does not ask.
22959
23107
  *
22960
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
22961
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
22962
- * the browser cache the images.
23108
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
23109
+ * does under `'suggestionConfidence'`.
22963
23110
  *
22964
- * **This is an INPUT field, so it does not reach the addon until the
22965
- * next train.** The hub router validates cap inputs against its own
22966
- * compiled Zod, which strips a key it does not know verified today
22967
- * on the OUTPUT side, where an additive field DOES arrive immediately
22968
- * (`Track.hasFace`). Until the train ships, sending `false` is
22969
- * harmless and simply keeps the crops inline.
23111
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
23112
+ * index and stops reading as soon as `limit` rows have PASSED the
23113
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
23114
+ * certain row may be the oldest so it walks the window. Narrow it
23115
+ * with {@link since} / {@link until}.
23116
+ */
23117
+ sortBy: FaceSortFieldEnum.optional(),
23118
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
23119
+ sortDirection: FaceSortDirectionEnum.optional(),
23120
+ /**
23121
+ * Inline the base64 crop on every row.
23122
+ *
23123
+ * Default `false` since the 2026-08-25 inversion — see
23124
+ * `include-crops-default.ts`, which is the ONE place that resolves
23125
+ * this for every gallery, and which records why the inline shape had
23126
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
23127
+ * The doc here used to still say `true`; it was wrong, and a leftover
23128
+ * that describes the old design reads as permission to rely on it.
23129
+ *
23130
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
23131
+ * which the browser fetches off the `event-media` plane in parallel,
23132
+ * cached and ETagged.
22970
23133
  */
22971
23134
  includeCrops: boolean().optional()
22972
23135
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -23002,13 +23165,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23002
23165
  }), method(object({
23003
23166
  threshold: number().min(0).max(1).optional(),
23004
23167
  minClusterSize: number().int().min(2).optional(),
23005
- limit: number().int().positive().optional()
23006
- }).optional(), array(object({
23007
- faceIds: array(string()).readonly(),
23008
- representativeFaceId: string(),
23009
- size: number().int(),
23010
- cohesion: number()
23011
- })).readonly());
23168
+ /**
23169
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
23170
+ * which read as though it bounded the work — it never did.
23171
+ *
23172
+ * Wins over {@link limit} when both are sent.
23173
+ */
23174
+ maxClusters: number().int().positive().optional(),
23175
+ /**
23176
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
23177
+ * RESULT, not the scan. Kept so existing callers keep working; send
23178
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
23179
+ */
23180
+ limit: number().int().positive().optional(),
23181
+ /**
23182
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
23183
+ * POOL, not the result.
23184
+ *
23185
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
23186
+ * used to read every unassigned face on the hub no matter what the
23187
+ * caller asked for, because the only bound cut the finished clusters
23188
+ * afterwards; a UI showing a window of 100 paid for a scan of the
23189
+ * whole corpus, on an addon whose disk is under contention.
23190
+ *
23191
+ * The pool is the NEWEST matching faces first — the same order the
23192
+ * gallery shows — so a bound here shortens the horizon, it does not
23193
+ * sample it randomly.
23194
+ *
23195
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
23196
+ * so the live corpus — 372 face rows — is unaffected while the
23197
+ * unbounded scan can never come back as the table grows.
23198
+ */
23199
+ maxFacesScanned: number().int().positive().optional()
23200
+ }).optional(), array(FaceClusterSchema).readonly());
23012
23201
  /**
23013
23202
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
23014
23203
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -25836,6 +26025,39 @@ var ReadGopBytesResultSchema = object({
25836
26025
  /** Media ms the returned fragment covers. */
25837
26026
  gopDurMs: number()
25838
26027
  });
26028
+ /**
26029
+ * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
26030
+ * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
26031
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
26032
+ * a replay needs several seconds of native pixels, not one frame.
26033
+ *
26034
+ * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
26035
+ * is `false` when the returned bytes were cut short by the read's own safety
26036
+ * byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
26037
+ * silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
26038
+ * degradation: a window whose end falls past the covering segment would need
26039
+ * bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
26040
+ * not one standalone-demuxable stream — the caller's answer is to request a
26041
+ * shorter window or one aligned to a single segment, not to receive spliced
26042
+ * bytes nothing has proven decodable.
26043
+ */
26044
+ var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
26045
+ kind: literal("ok"),
26046
+ data: _instanceof(Uint8Array),
26047
+ /** Absolute epoch ms of the returned bytes' first sample — at or before
26048
+ * the requested `fromMs` (anchored on the nearest keyframe). */
26049
+ gopStartMs: number(),
26050
+ /** Media ms the returned bytes cover, from `gopStartMs`. */
26051
+ gopDurMs: number(),
26052
+ /** `false` ⇒ the safety byte cap cut the read short before it reached
26053
+ * the requested `toMs`; the caller got fewer frames than asked for. */
26054
+ reachesRequestedEnd: boolean()
26055
+ }), object({
26056
+ kind: literal("spans-multiple-segments"),
26057
+ /** Where the covering segment's own footage runs out — informational,
26058
+ * not a retry hint (retrying the same window would refuse again). */
26059
+ segmentEndMs: number()
26060
+ })]);
25839
26061
  method(object({
25840
26062
  deviceId: number(),
25841
26063
  fromMs: number(),
@@ -25886,6 +26108,15 @@ method(object({
25886
26108
  }), ReadGopBytesResultSchema, {
25887
26109
  kind: "query",
25888
26110
  auth: "admin"
26111
+ }), method(object({
26112
+ deviceId: number(),
26113
+ profile: string(),
26114
+ startMs: number(),
26115
+ fromMs: number(),
26116
+ toMs: number()
26117
+ }), ReadWindowBytesResultSchema, {
26118
+ kind: "query",
26119
+ auth: "admin"
25889
26120
  }), method(object({
25890
26121
  deviceId: number(),
25891
26122
  config: RecordingConfigSchema
@@ -26726,6 +26957,211 @@ var SetSiteLocationInputSchema = object({
26726
26957
  latitude: number().min(-90).max(90),
26727
26958
  longitude: number().min(-180).max(180)
26728
26959
  }).nullable();
26960
+ /**
26961
+ * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
26962
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26963
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26964
+ * already prints - never a token, never an `Authorization` header.
26965
+ */
26966
+ var RequestCensusGroupSchema = object({
26967
+ procedure: string(),
26968
+ userAgent: string(),
26969
+ ip: string(),
26970
+ principal: string(),
26971
+ calls: number(),
26972
+ perMin: number()
26973
+ });
26974
+ /**
26975
+ * A procedure's TOTAL over the window, across every caller.
26976
+ *
26977
+ * This block, not the group list, is what answers "did these calls arrive over
26978
+ * HTTP at all". A total far BELOW what a store-side census counted over the
26979
+ * same window excludes the HTTP plane, which is a result, not a failure.
26980
+ */
26981
+ var RequestCensusProcedureSchema = object({
26982
+ procedure: string(),
26983
+ calls: number(),
26984
+ perMin: number()
26985
+ });
26986
+ /**
26987
+ * The census as an operator sees it.
26988
+ *
26989
+ * `persisted` is the honest answer to "will this survive the restart I am
26990
+ * about to do": the arm deadline is written to `system-settings` so a window
26991
+ * armed now can measure the NEXT boot, and a write that failed must not look
26992
+ * like one that succeeded.
26993
+ */
26994
+ var RequestCensusStatusSchema = object({
26995
+ armed: boolean(),
26996
+ /** How long the current - or just-closed - window collected, in ms. */
26997
+ elapsedMs: number(),
26998
+ /** The window actually armed, after the server clamped the request. */
26999
+ windowMs: number(),
27000
+ /** Epoch ms the window closes at. 0 when disarmed. */
27001
+ armedUntilMs: number(),
27002
+ httpRequests: number(),
27003
+ batchedRequests: number(),
27004
+ /**
27005
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
27006
+ * is in play (`?batch=1` carries several procedures in one request); this is
27007
+ * the number comparable with a store-side call count.
27008
+ */
27009
+ procedureCalls: number(),
27010
+ /**
27011
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
27012
+ * transport resolves one context per connection - but the number that says
27013
+ * whether a plane this census cannot see was busy while HTTP was quiet.
27014
+ */
27015
+ wsConnections: number(),
27016
+ distinctGroups: number(),
27017
+ /** Calls counted in the totals whose group attribution was shed at the
27018
+ * cardinality bound. */
27019
+ unattributedCalls: number(),
27020
+ procedures: array(RequestCensusProcedureSchema).readonly(),
27021
+ groups: array(RequestCensusGroupSchema).readonly()
27022
+ }).extend({ persisted: boolean() });
27023
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
27024
+ var LogLevelSchema$1 = _enum([
27025
+ "debug",
27026
+ "info",
27027
+ "warn",
27028
+ "error"
27029
+ ]);
27030
+ /**
27031
+ * The diagnostics that can be ARMED for a window. Exactly one today.
27032
+ *
27033
+ * A diagnostic is anything whose cost is only worth paying while a question is
27034
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
27035
+ */
27036
+ var DiagnosticIdSchema = _enum(["request-census"]);
27037
+ /**
27038
+ * The layers of the level hierarchy, general → specific. The most specific
27039
+ * layer that carries an explicit value wins.
27040
+ *
27041
+ * `component` is DECLARED and not yet resolvable: the per-component channels
27042
+ * are a later slice of the same plan, and a `levelSource` enum that has to
27043
+ * grow later would force every consumer of this document to change with it.
27044
+ * Nothing returns `component` today.
27045
+ */
27046
+ var LoggingScopeKindSchema = _enum([
27047
+ "cluster",
27048
+ "node",
27049
+ "component"
27050
+ ]);
27051
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
27052
+ var LoggingLevelSourceSchema = _enum([
27053
+ "default",
27054
+ "cluster",
27055
+ "node",
27056
+ "component"
27057
+ ]);
27058
+ /**
27059
+ * One layer of the hierarchy as it actually STANDS.
27060
+ *
27061
+ * `level: null` is the whole reason this array is returned: it is the
27062
+ * difference between "this node is at `info` because I decided it" and
27063
+ * "...because it inherits". An operator who clears an override believing they
27064
+ * are clearing an inherited value has been handed the same defect as the two
27065
+ * contradicting knobs this document exists to remove, moved one floor up.
27066
+ */
27067
+ var LoggingLevelLayerSchema = object({
27068
+ scope: LoggingScopeKindSchema,
27069
+ /** The node this layer speaks for; `null` on the cluster layer. */
27070
+ nodeId: string().nullable(),
27071
+ /** Explicitly set here, or `null` when this layer inherits. */
27072
+ level: LogLevelSchema$1.nullable()
27073
+ });
27074
+ /** What a line is judged against, and WHICH layer decided it. */
27075
+ var LoggingEffectiveSchema = object({
27076
+ level: LogLevelSchema$1,
27077
+ levelSource: LoggingLevelSourceSchema
27078
+ });
27079
+ /** Every layer, general → specific. Never collapsed into the effective value. */
27080
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
27081
+ /**
27082
+ * An armed diagnostic, with its DEADLINE.
27083
+ *
27084
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
27085
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
27086
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
27087
+ * `armed` is false — a window is never reported as slightly expired.
27088
+ */
27089
+ var DiagnosticWindowSchema = object({
27090
+ id: DiagnosticIdSchema,
27091
+ armed: boolean(),
27092
+ /** Epoch ms the window closes at. 0 when disarmed. */
27093
+ armedUntilMs: number(),
27094
+ /** Ms left before it expires on its own. 0 when disarmed. */
27095
+ remainingMs: number(),
27096
+ /** Whether the stored deadline is the one the live diagnostic is running —
27097
+ * i.e. whether this window would survive a restart. */
27098
+ persisted: boolean()
27099
+ });
27100
+ /**
27101
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
27102
+ * server — there is no maximum here on purpose: a bound repeated in a schema
27103
+ * is a second knob that disagrees with the first the day one of them moves.
27104
+ */
27105
+ var DiagnosticWindowPatchSchema = object({
27106
+ id: DiagnosticIdSchema,
27107
+ armMs: number().int().min(0),
27108
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
27109
+ reportEveryMs: number().int().positive().optional()
27110
+ });
27111
+ /**
27112
+ * A PATCH, and patches MERGE.
27113
+ *
27114
+ * A field absent from the patch is left exactly as it was — arming a
27115
+ * diagnostic never resets a level, and setting a level never disarms a window.
27116
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
27117
+ * `setAll` already merges, and rebuilding the object is how an absent field
27118
+ * turns into an erased one.
27119
+ */
27120
+ var LoggingSettingsPatchSchema = object({
27121
+ /**
27122
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
27123
+ * addressed scope so it inherits again. A value sets it.
27124
+ */
27125
+ level: LogLevelSchema$1.nullable().optional(),
27126
+ /**
27127
+ * Only the diagnostics NAMED here change. An armed window that is not listed
27128
+ * keeps running — a patch is never a full replacement.
27129
+ */
27130
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
27131
+ });
27132
+ /**
27133
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
27134
+ *
27135
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
27136
+ * input — the generated router strips it and uses it to resolve the PROVIDER
27137
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
27138
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
27139
+ * by an agent that holds no cluster document at all. The hub is the single
27140
+ * authority over the whole hierarchy and answers for every layer, so the
27141
+ * layer selector needs a name the transport does not already own.
27142
+ */
27143
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
27144
+ var SetLoggingSettingsInputSchema = object({
27145
+ scopeNodeId: string().optional(),
27146
+ patch: LoggingSettingsPatchSchema
27147
+ });
27148
+ /**
27149
+ * The whole document, as read and as returned after every write.
27150
+ *
27151
+ * `persisted: false` means the settings store could not be read or written.
27152
+ * The in-memory mirror still governs behaviour and is unchanged by the
27153
+ * failure — a read that fails neither switches a level nor disarms a window
27154
+ * (D49) — but the operator is told that what they are looking at would not
27155
+ * survive a restart.
27156
+ */
27157
+ var LoggingSettingsStateSchema = object({
27158
+ /** The layer this document was read at. `null` = the cluster layer. */
27159
+ scopeNodeId: string().nullable(),
27160
+ effective: LoggingEffectiveSchema,
27161
+ explicit: LoggingExplicitSchema,
27162
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
27163
+ persisted: boolean()
27164
+ });
26729
27165
  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(), {
26730
27166
  kind: "mutation",
26731
27167
  auth: "admin"
@@ -26738,6 +27174,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
26738
27174
  }), method(_void(), SiteLocationStatusSchema, {
26739
27175
  kind: "mutation",
26740
27176
  auth: "admin"
27177
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
27178
+ kind: "mutation",
27179
+ auth: "admin"
26741
27180
  });
26742
27181
  object({
26743
27182
  /** True when the device's tamper switch / case-open contact is
@@ -30329,6 +30768,12 @@ Object.freeze({
30329
30768
  addonId: null,
30330
30769
  access: "view"
30331
30770
  },
30771
+ "notificationRules.resolveArtifactUrl": {
30772
+ capName: "notification-rules",
30773
+ capScope: "system",
30774
+ addonId: null,
30775
+ access: "view"
30776
+ },
30332
30777
  "notificationRules.setAlarmConfig": {
30333
30778
  capName: "notification-rules",
30334
30779
  capScope: "system",
@@ -31733,6 +32178,12 @@ Object.freeze({
31733
32178
  addonId: null,
31734
32179
  access: "view"
31735
32180
  },
32181
+ "recording.readWindowBytes": {
32182
+ capName: "recording",
32183
+ capScope: "system",
32184
+ addonId: null,
32185
+ access: "view"
32186
+ },
31736
32187
  "recording.refreshStorageLocationsForMigration": {
31737
32188
  capName: "recording",
31738
32189
  capScope: "system",
@@ -32573,6 +33024,18 @@ Object.freeze({
32573
33024
  addonId: null,
32574
33025
  access: "create"
32575
33026
  },
33027
+ "system.getLoggingSettings": {
33028
+ capName: "system",
33029
+ capScope: "system",
33030
+ addonId: null,
33031
+ access: "view"
33032
+ },
33033
+ "system.getRequestCensus": {
33034
+ capName: "system",
33035
+ capScope: "system",
33036
+ addonId: null,
33037
+ access: "view"
33038
+ },
32576
33039
  "system.getRetentionConfig": {
32577
33040
  capName: "system",
32578
33041
  capScope: "system",
@@ -32603,6 +33066,12 @@ Object.freeze({
32603
33066
  addonId: null,
32604
33067
  access: "view"
32605
33068
  },
33069
+ "system.setLoggingSettings": {
33070
+ capName: "system",
33071
+ capScope: "system",
33072
+ addonId: null,
33073
+ access: "create"
33074
+ },
32606
33075
  "system.setRetentionConfig": {
32607
33076
  capName: "system",
32608
33077
  capScope: "system",
@@ -33758,6 +34227,10 @@ Object.freeze({
33758
34227
  name: "deviceId",
33759
34228
  form: "single",
33760
34229
  optional: true
34230
+ }, {
34231
+ name: "deviceIds",
34232
+ form: "array",
34233
+ optional: true
33761
34234
  }],
33762
34235
  "fanControl.setDirection": [{
33763
34236
  name: "deviceId",
@@ -34563,6 +35036,11 @@ Object.freeze({
34563
35036
  form: "single",
34564
35037
  optional: false
34565
35038
  }],
35039
+ "recording.readWindowBytes": [{
35040
+ name: "deviceId",
35041
+ form: "single",
35042
+ optional: false
35043
+ }],
34566
35044
  "recording.relocateFootage": [{
34567
35045
  name: "deviceId",
34568
35046
  form: "single",
@@ -35363,7 +35841,38 @@ object({
35363
35841
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
35364
35842
  * reproduce that.
35365
35843
  */
35366
- tileBudgetMb: number().int().min(0).max(1024)
35844
+ tileBudgetMb: number().int().min(0).max(1024),
35845
+ /**
35846
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
35847
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
35848
+ * subject tiles, on frames that detected something.
35849
+ *
35850
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
35851
+ * containment is strict by design, so the native `keyFrame`, the detail
35852
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
35853
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
35854
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
35855
+ * frame-time after delivery, with the request only p50 367 ms behind it.
35856
+ *
35857
+ * Sizing, and why this is a budget and not a duration: a scene tile is
35858
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
35859
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
35860
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
35861
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
35862
+ * binds only through a detection burst, where it still covers well past the
35863
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
35864
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
35865
+ * whole shape exists to avoid.
35866
+ *
35867
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
35868
+ * subject tile, so one shared budget would let a busy camera's key frames
35869
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
35870
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
35871
+ * pre-existing behaviour, where a late full-frame request had nothing but the
35872
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
35873
+ * nothing.
35874
+ */
35875
+ sceneBudgetMb: number().int().min(0).max(1024)
35367
35876
  });
35368
35877
  /**
35369
35878
  * The values in force when the operator has set nothing.
@@ -35379,12 +35888,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
35379
35888
  budgetMb: 1024,
35380
35889
  activityMs: 15e3,
35381
35890
  tileBudgetMb: 64,
35891
+ sceneBudgetMb: 48,
35382
35892
  admission: "inferred"
35383
35893
  };
35384
35894
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
35385
35895
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
35386
35896
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
35387
35897
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
35898
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
35388
35899
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
35389
35900
  var MB = 1024 * 1024;
35390
35901
  1024 * MB, 3072 * MB;