@camstack/addon-provider-amcrest 0.2.31 → 0.2.33

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
@@ -7520,6 +7520,66 @@ var OpsLogQueryInputSchema = object({
7520
7520
  /** Max rows returned, newest-first. */
7521
7521
  limit: number().int().min(1).max(1e3).optional()
7522
7522
  });
7523
+ var LabelDefinitionSchema = object({
7524
+ id: string(),
7525
+ name: string(),
7526
+ category: string().optional(),
7527
+ description: string().optional(),
7528
+ icon: string().optional()
7529
+ });
7530
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
7531
+ var CLASS_MAP_MACRO_TARGETS = [
7532
+ "person",
7533
+ "vehicle",
7534
+ "animal",
7535
+ "package"
7536
+ ];
7537
+ /**
7538
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
7539
+ * un operatore può selezionare.
7540
+ *
7541
+ * Sono le tre offerte dallo step `object-detection`
7542
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
7543
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
7544
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
7545
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
7546
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
7547
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
7548
+ *
7549
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
7550
+ * dello step e una seconda volta come union `FirstLevelMacro`
7551
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
7552
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
7553
+ * successiva.
7554
+ */
7555
+ var FIRST_LEVEL_MACRO_CLASSES = [
7556
+ "person",
7557
+ "vehicle",
7558
+ "animal"
7559
+ ];
7560
+ /**
7561
+ * Wire schema for a per-model CATALOG classMap override
7562
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
7563
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
7564
+ * detection pipeline executor actually routes.
7565
+ *
7566
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
7567
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
7568
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
7569
+ * enum) — the two used to share the name `ClassMapDefinition`/
7570
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
7571
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
7572
+ * are not: it is two different concepts colliding on a name. Keep this type
7573
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
7574
+ * would either narrow every `ClassMapDefinition` consumer to the four
7575
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
7576
+ * schema exists for (see the "rejects a classMap whose target is not a
7577
+ * detection macro" test in `model-catalog-schema.test.ts`).
7578
+ */
7579
+ var DetectionCatalogClassMapSchema = object({
7580
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
7581
+ preserveOriginal: boolean()
7582
+ });
7523
7583
  /**
7524
7584
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
7525
7585
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -7542,10 +7602,55 @@ var RecordingStorageModeSchema = _enum([
7542
7602
  "events",
7543
7603
  "continuous"
7544
7604
  ]);
7605
+ /**
7606
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
7607
+ * tre offerte dallo step `object-detection`, da UNA lista
7608
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
7609
+ */
7610
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
7611
+ /**
7612
+ * True quando `values` non ripete un elemento.
7613
+ *
7614
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
7615
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
7616
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
7617
+ */
7618
+ var noDuplicates = (values) => new Set(values).size === values.length;
7545
7619
  /** Which detectors trigger an `events`-mode band. */
7546
7620
  var RecordingTriggersSchema = object({
7547
7621
  motion: boolean().optional(),
7548
- audioThresholdDbfs: number().optional()
7622
+ audioThresholdDbfs: number().optional(),
7623
+ /**
7624
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
7625
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
7626
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
7627
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
7628
+ *
7629
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
7630
+ * quelle che hanno attraversato `enabledMacroClasses`, i
7631
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
7632
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
7633
+ * finestre — vedi `recorder/object-trigger.ts`.
7634
+ */
7635
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
7636
+ /**
7637
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
7638
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
7639
+ * `objectClasses`.
7640
+ *
7641
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
7642
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
7643
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
7644
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
7645
+ * device (D12) — mai un elenco globale di cap.
7646
+ *
7647
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
7648
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
7649
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
7650
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
7651
+ * registrare.
7652
+ */
7653
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7549
7654
  });
7550
7655
  /**
7551
7656
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -7997,41 +8102,6 @@ var DecoderSessionConfigSchema = object({
7997
8102
  */
7998
8103
  debug: boolean().optional()
7999
8104
  });
8000
- var LabelDefinitionSchema = object({
8001
- id: string(),
8002
- name: string(),
8003
- category: string().optional(),
8004
- description: string().optional(),
8005
- icon: string().optional()
8006
- });
8007
- /**
8008
- * Wire schema for a per-model CATALOG classMap override
8009
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8010
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8011
- * detection pipeline executor actually routes.
8012
- *
8013
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8014
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8015
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8016
- * enum) — the two used to share the name `ClassMapDefinition`/
8017
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8018
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8019
- * are not: it is two different concepts colliding on a name. Keep this type
8020
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8021
- * would either narrow every `ClassMapDefinition` consumer to the four
8022
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8023
- * schema exists for (see the "rejects a classMap whose target is not a
8024
- * detection macro" test in `model-catalog-schema.test.ts`).
8025
- */
8026
- var DetectionCatalogClassMapSchema = object({
8027
- mapping: record(string(), _enum([
8028
- "person",
8029
- "vehicle",
8030
- "animal",
8031
- "package"
8032
- ])),
8033
- preserveOriginal: boolean()
8034
- });
8035
8105
  var MODEL_FORMATS = [
8036
8106
  "onnx",
8037
8107
  "coreml",
@@ -15776,7 +15846,23 @@ var NcHistoryEntrySchema = object({
15776
15846
  updatedAt: number(),
15777
15847
  /** Failure detail — present on a `dead` row. */
15778
15848
  error: string().optional(),
15779
- subject: NcHistorySubjectSchema
15849
+ subject: NcHistorySubjectSchema,
15850
+ /**
15851
+ * Ids of the artefacts (still, then gif, then clip) this row's successful
15852
+ * delivery indexed in the artefact library — a REFERENCE, never the bytes
15853
+ * (an artefact is often megabytes; this row is durable JSON rewritten on
15854
+ * every delivery attempt). Absent on a row still pending/dead, a row
15855
+ * delivered before this field shipped, or a wiring with no artefact index.
15856
+ *
15857
+ * Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
15858
+ * outlives any one URL's TTL, so a caller mints a fresh link on demand
15859
+ * rather than trusting one frozen at delivery time. `resolveArtifactUrl`
15860
+ * also answers `null` for an id whose artefact has since expired past the
15861
+ * retained shelf's own age bound — the degrade a caller (the Home
15862
+ * Assistant export) must render as "no image right now", never as a
15863
+ * broken link.
15864
+ */
15865
+ artifactIds: array(string().min(1)).optional()
15780
15866
  });
15781
15867
  /**
15782
15868
  * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
@@ -16003,7 +16089,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
16003
16089
  }), method(object({}), object({
16004
16090
  catalog: array(NcConditionDescriptorSchema),
16005
16091
  taxonomy: NcTaxonomySchema.optional()
16006
- })), 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 }), {
16092
+ })), 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 }), {
16007
16093
  kind: "mutation",
16008
16094
  caller: "required"
16009
16095
  }), method(object({ snoozeId: string() }), object({ success: literal(true) }), {
@@ -21235,7 +21321,7 @@ var lifecycleJobSchema = object({
21235
21321
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21236
21322
  * as every other cap.
21237
21323
  */
21238
- var LogLevelSchema$1 = _enum([
21324
+ var LogLevelSchema$2 = _enum([
21239
21325
  "debug",
21240
21326
  "info",
21241
21327
  "warn",
@@ -21442,7 +21528,7 @@ var CustomActionInputSchema = object({
21442
21528
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21443
21529
  addonId: string(),
21444
21530
  limit: number().min(1).max(500).default(100),
21445
- level: LogLevelSchema$1.optional()
21531
+ level: LogLevelSchema$2.optional()
21446
21532
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21447
21533
  packageName: string(),
21448
21534
  version: string().optional()
@@ -21540,7 +21626,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21540
21626
  auth: "admin"
21541
21627
  }), method(object({
21542
21628
  addonId: string(),
21543
- level: LogLevelSchema$1.optional()
21629
+ level: LogLevelSchema$2.optional()
21544
21630
  }), LogStreamEntrySchema, { kind: "subscription" });
21545
21631
  /**
21546
21632
  * Multi-metric air-quality slice. Covers CO₂, total VOCs, particulate
@@ -23264,6 +23350,35 @@ var FaceFilterEnum = _enum([
23264
23350
  "identified",
23265
23351
  "all"
23266
23352
  ]);
23353
+ /**
23354
+ * What a `listRecentFaces` page is ORDERED BY.
23355
+ *
23356
+ * - `timestamp` — when the face was seen. The historical (and default) order.
23357
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
23358
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
23359
+ * order: it puts the suggestions an operator can confirm with one tap at the
23360
+ * top, and it is the reason this enum exists — a client that ranked a capped
23361
+ * page client-side was ranking the newest N, never the most certain N.
23362
+ *
23363
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
23364
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
23365
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
23366
+ * — flipping the direction reorders the rows that HAVE a certainty and never
23367
+ * floods the page with the ones that do not. `addon-post-analysis`'s
23368
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
23369
+ * then by faceId, and is what makes this a total order instead of the
23370
+ * backend's NULL-collation accident.
23371
+ */
23372
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
23373
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
23374
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
23375
+ * never leaves the server. */
23376
+ var FaceClusterSchema = object({
23377
+ faceIds: array(string()).readonly(),
23378
+ representativeFaceId: string(),
23379
+ size: number().int(),
23380
+ cohesion: number()
23381
+ });
23267
23382
  var MediaFileLiteSchema$1 = object({
23268
23383
  key: string(),
23269
23384
  kind: string(),
@@ -23310,24 +23425,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23310
23425
  kind: "mutation",
23311
23426
  auth: "admin"
23312
23427
  }), method(object({
23313
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
23428
+ /**
23429
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
23430
+ *
23431
+ * The legacy single-camera form, kept verbatim for every caller that
23432
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
23433
+ * instead — never both: `deviceIds` is the authority whenever it is
23434
+ * present, and this field is then ignored rather than unioned, so
23435
+ * there is exactly one answer to "which cameras did I ask for".
23436
+ */
23314
23437
  deviceId: number().int().optional(),
23438
+ /**
23439
+ * Restrict to a SET of cameras — the review UI's camera filter, which
23440
+ * until now had to fetch the cluster-wide page and drop rows in the
23441
+ * client (so the `limit` it asked for was spent on cameras it was
23442
+ * about to discard).
23443
+ *
23444
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
23445
+ * "every camera". A request for no devices is a request, not an
23446
+ * omission; same contract as `deviceManager.listFleet` and
23447
+ * `pipelineAnalytics.listRecentTracks`.
23448
+ *
23449
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
23450
+ */
23451
+ deviceIds: array(number().int()).optional(),
23315
23452
  limit: number().int().positive().optional(),
23316
23453
  filter: FaceFilterEnum.optional(),
23317
23454
  /**
23318
- * Inline the base64 crop on every row. Default `true` — the existing
23319
- * behaviour, kept so no caller breaks.
23455
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23456
+ * Absent means no lower bound.
23457
+ */
23458
+ since: number().int().optional(),
23459
+ /**
23460
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23461
+ * Absent means no upper bound.
23462
+ */
23463
+ until: number().int().optional(),
23464
+ /**
23465
+ * Order the page by time or by suggestion certainty. Default
23466
+ * `'timestamp'` — the historical order, unchanged for every caller
23467
+ * that does not ask.
23320
23468
  *
23321
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
23322
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
23323
- * the browser cache the images.
23469
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
23470
+ * does under `'suggestionConfidence'`.
23324
23471
  *
23325
- * **This is an INPUT field, so it does not reach the addon until the
23326
- * next train.** The hub router validates cap inputs against its own
23327
- * compiled Zod, which strips a key it does not know verified today
23328
- * on the OUTPUT side, where an additive field DOES arrive immediately
23329
- * (`Track.hasFace`). Until the train ships, sending `false` is
23330
- * harmless and simply keeps the crops inline.
23472
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
23473
+ * index and stops reading as soon as `limit` rows have PASSED the
23474
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
23475
+ * certain row may be the oldest so it walks the window. Narrow it
23476
+ * with {@link since} / {@link until}.
23477
+ */
23478
+ sortBy: FaceSortFieldEnum.optional(),
23479
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
23480
+ sortDirection: FaceSortDirectionEnum.optional(),
23481
+ /**
23482
+ * Inline the base64 crop on every row.
23483
+ *
23484
+ * Default `false` since the 2026-08-25 inversion — see
23485
+ * `include-crops-default.ts`, which is the ONE place that resolves
23486
+ * this for every gallery, and which records why the inline shape had
23487
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
23488
+ * The doc here used to still say `true`; it was wrong, and a leftover
23489
+ * that describes the old design reads as permission to rely on it.
23490
+ *
23491
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
23492
+ * which the browser fetches off the `event-media` plane in parallel,
23493
+ * cached and ETagged.
23331
23494
  */
23332
23495
  includeCrops: boolean().optional()
23333
23496
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -23363,13 +23526,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
23363
23526
  }), method(object({
23364
23527
  threshold: number().min(0).max(1).optional(),
23365
23528
  minClusterSize: number().int().min(2).optional(),
23366
- limit: number().int().positive().optional()
23367
- }).optional(), array(object({
23368
- faceIds: array(string()).readonly(),
23369
- representativeFaceId: string(),
23370
- size: number().int(),
23371
- cohesion: number()
23372
- })).readonly());
23529
+ /**
23530
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
23531
+ * which read as though it bounded the work — it never did.
23532
+ *
23533
+ * Wins over {@link limit} when both are sent.
23534
+ */
23535
+ maxClusters: number().int().positive().optional(),
23536
+ /**
23537
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
23538
+ * RESULT, not the scan. Kept so existing callers keep working; send
23539
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
23540
+ */
23541
+ limit: number().int().positive().optional(),
23542
+ /**
23543
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
23544
+ * POOL, not the result.
23545
+ *
23546
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
23547
+ * used to read every unassigned face on the hub no matter what the
23548
+ * caller asked for, because the only bound cut the finished clusters
23549
+ * afterwards; a UI showing a window of 100 paid for a scan of the
23550
+ * whole corpus, on an addon whose disk is under contention.
23551
+ *
23552
+ * The pool is the NEWEST matching faces first — the same order the
23553
+ * gallery shows — so a bound here shortens the horizon, it does not
23554
+ * sample it randomly.
23555
+ *
23556
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
23557
+ * so the live corpus — 372 face rows — is unaffected while the
23558
+ * unbounded scan can never come back as the table grows.
23559
+ */
23560
+ maxFacesScanned: number().int().positive().optional()
23561
+ }).optional(), array(FaceClusterSchema).readonly());
23373
23562
  /**
23374
23563
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
23375
23564
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -27215,6 +27404,39 @@ var ReadGopBytesResultSchema = object({
27215
27404
  /** Media ms the returned fragment covers. */
27216
27405
  gopDurMs: number()
27217
27406
  });
27407
+ /**
27408
+ * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
27409
+ * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
27410
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
27411
+ * a replay needs several seconds of native pixels, not one frame.
27412
+ *
27413
+ * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
27414
+ * is `false` when the returned bytes were cut short by the read's own safety
27415
+ * byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
27416
+ * silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
27417
+ * degradation: a window whose end falls past the covering segment would need
27418
+ * bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
27419
+ * not one standalone-demuxable stream — the caller's answer is to request a
27420
+ * shorter window or one aligned to a single segment, not to receive spliced
27421
+ * bytes nothing has proven decodable.
27422
+ */
27423
+ var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
27424
+ kind: literal("ok"),
27425
+ data: _instanceof(Uint8Array),
27426
+ /** Absolute epoch ms of the returned bytes' first sample — at or before
27427
+ * the requested `fromMs` (anchored on the nearest keyframe). */
27428
+ gopStartMs: number(),
27429
+ /** Media ms the returned bytes cover, from `gopStartMs`. */
27430
+ gopDurMs: number(),
27431
+ /** `false` ⇒ the safety byte cap cut the read short before it reached
27432
+ * the requested `toMs`; the caller got fewer frames than asked for. */
27433
+ reachesRequestedEnd: boolean()
27434
+ }), object({
27435
+ kind: literal("spans-multiple-segments"),
27436
+ /** Where the covering segment's own footage runs out — informational,
27437
+ * not a retry hint (retrying the same window would refuse again). */
27438
+ segmentEndMs: number()
27439
+ })]);
27218
27440
  method(object({
27219
27441
  deviceId: number(),
27220
27442
  fromMs: number(),
@@ -27265,6 +27487,15 @@ method(object({
27265
27487
  }), ReadGopBytesResultSchema, {
27266
27488
  kind: "query",
27267
27489
  auth: "admin"
27490
+ }), method(object({
27491
+ deviceId: number(),
27492
+ profile: string(),
27493
+ startMs: number(),
27494
+ fromMs: number(),
27495
+ toMs: number()
27496
+ }), ReadWindowBytesResultSchema, {
27497
+ kind: "query",
27498
+ auth: "admin"
27268
27499
  }), method(object({
27269
27500
  deviceId: number(),
27270
27501
  config: RecordingConfigSchema
@@ -28555,6 +28786,211 @@ var SetSiteLocationInputSchema = object({
28555
28786
  latitude: number().min(-90).max(90),
28556
28787
  longitude: number().min(-180).max(180)
28557
28788
  }).nullable();
28789
+ /**
28790
+ * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28791
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28792
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28793
+ * already prints - never a token, never an `Authorization` header.
28794
+ */
28795
+ var RequestCensusGroupSchema = object({
28796
+ procedure: string(),
28797
+ userAgent: string(),
28798
+ ip: string(),
28799
+ principal: string(),
28800
+ calls: number(),
28801
+ perMin: number()
28802
+ });
28803
+ /**
28804
+ * A procedure's TOTAL over the window, across every caller.
28805
+ *
28806
+ * This block, not the group list, is what answers "did these calls arrive over
28807
+ * HTTP at all". A total far BELOW what a store-side census counted over the
28808
+ * same window excludes the HTTP plane, which is a result, not a failure.
28809
+ */
28810
+ var RequestCensusProcedureSchema = object({
28811
+ procedure: string(),
28812
+ calls: number(),
28813
+ perMin: number()
28814
+ });
28815
+ /**
28816
+ * The census as an operator sees it.
28817
+ *
28818
+ * `persisted` is the honest answer to "will this survive the restart I am
28819
+ * about to do": the arm deadline is written to `system-settings` so a window
28820
+ * armed now can measure the NEXT boot, and a write that failed must not look
28821
+ * like one that succeeded.
28822
+ */
28823
+ var RequestCensusStatusSchema = object({
28824
+ armed: boolean(),
28825
+ /** How long the current - or just-closed - window collected, in ms. */
28826
+ elapsedMs: number(),
28827
+ /** The window actually armed, after the server clamped the request. */
28828
+ windowMs: number(),
28829
+ /** Epoch ms the window closes at. 0 when disarmed. */
28830
+ armedUntilMs: number(),
28831
+ httpRequests: number(),
28832
+ batchedRequests: number(),
28833
+ /**
28834
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
28835
+ * is in play (`?batch=1` carries several procedures in one request); this is
28836
+ * the number comparable with a store-side call count.
28837
+ */
28838
+ procedureCalls: number(),
28839
+ /**
28840
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
28841
+ * transport resolves one context per connection - but the number that says
28842
+ * whether a plane this census cannot see was busy while HTTP was quiet.
28843
+ */
28844
+ wsConnections: number(),
28845
+ distinctGroups: number(),
28846
+ /** Calls counted in the totals whose group attribution was shed at the
28847
+ * cardinality bound. */
28848
+ unattributedCalls: number(),
28849
+ procedures: array(RequestCensusProcedureSchema).readonly(),
28850
+ groups: array(RequestCensusGroupSchema).readonly()
28851
+ }).extend({ persisted: boolean() });
28852
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
28853
+ var LogLevelSchema$1 = _enum([
28854
+ "debug",
28855
+ "info",
28856
+ "warn",
28857
+ "error"
28858
+ ]);
28859
+ /**
28860
+ * The diagnostics that can be ARMED for a window. Exactly one today.
28861
+ *
28862
+ * A diagnostic is anything whose cost is only worth paying while a question is
28863
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
28864
+ */
28865
+ var DiagnosticIdSchema = _enum(["request-census"]);
28866
+ /**
28867
+ * The layers of the level hierarchy, general → specific. The most specific
28868
+ * layer that carries an explicit value wins.
28869
+ *
28870
+ * `component` is DECLARED and not yet resolvable: the per-component channels
28871
+ * are a later slice of the same plan, and a `levelSource` enum that has to
28872
+ * grow later would force every consumer of this document to change with it.
28873
+ * Nothing returns `component` today.
28874
+ */
28875
+ var LoggingScopeKindSchema = _enum([
28876
+ "cluster",
28877
+ "node",
28878
+ "component"
28879
+ ]);
28880
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
28881
+ var LoggingLevelSourceSchema = _enum([
28882
+ "default",
28883
+ "cluster",
28884
+ "node",
28885
+ "component"
28886
+ ]);
28887
+ /**
28888
+ * One layer of the hierarchy as it actually STANDS.
28889
+ *
28890
+ * `level: null` is the whole reason this array is returned: it is the
28891
+ * difference between "this node is at `info` because I decided it" and
28892
+ * "...because it inherits". An operator who clears an override believing they
28893
+ * are clearing an inherited value has been handed the same defect as the two
28894
+ * contradicting knobs this document exists to remove, moved one floor up.
28895
+ */
28896
+ var LoggingLevelLayerSchema = object({
28897
+ scope: LoggingScopeKindSchema,
28898
+ /** The node this layer speaks for; `null` on the cluster layer. */
28899
+ nodeId: string().nullable(),
28900
+ /** Explicitly set here, or `null` when this layer inherits. */
28901
+ level: LogLevelSchema$1.nullable()
28902
+ });
28903
+ /** What a line is judged against, and WHICH layer decided it. */
28904
+ var LoggingEffectiveSchema = object({
28905
+ level: LogLevelSchema$1,
28906
+ levelSource: LoggingLevelSourceSchema
28907
+ });
28908
+ /** Every layer, general → specific. Never collapsed into the effective value. */
28909
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
28910
+ /**
28911
+ * An armed diagnostic, with its DEADLINE.
28912
+ *
28913
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
28914
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
28915
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
28916
+ * `armed` is false — a window is never reported as slightly expired.
28917
+ */
28918
+ var DiagnosticWindowSchema = object({
28919
+ id: DiagnosticIdSchema,
28920
+ armed: boolean(),
28921
+ /** Epoch ms the window closes at. 0 when disarmed. */
28922
+ armedUntilMs: number(),
28923
+ /** Ms left before it expires on its own. 0 when disarmed. */
28924
+ remainingMs: number(),
28925
+ /** Whether the stored deadline is the one the live diagnostic is running —
28926
+ * i.e. whether this window would survive a restart. */
28927
+ persisted: boolean()
28928
+ });
28929
+ /**
28930
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
28931
+ * server — there is no maximum here on purpose: a bound repeated in a schema
28932
+ * is a second knob that disagrees with the first the day one of them moves.
28933
+ */
28934
+ var DiagnosticWindowPatchSchema = object({
28935
+ id: DiagnosticIdSchema,
28936
+ armMs: number().int().min(0),
28937
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
28938
+ reportEveryMs: number().int().positive().optional()
28939
+ });
28940
+ /**
28941
+ * A PATCH, and patches MERGE.
28942
+ *
28943
+ * A field absent from the patch is left exactly as it was — arming a
28944
+ * diagnostic never resets a level, and setting a level never disarms a window.
28945
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
28946
+ * `setAll` already merges, and rebuilding the object is how an absent field
28947
+ * turns into an erased one.
28948
+ */
28949
+ var LoggingSettingsPatchSchema = object({
28950
+ /**
28951
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
28952
+ * addressed scope so it inherits again. A value sets it.
28953
+ */
28954
+ level: LogLevelSchema$1.nullable().optional(),
28955
+ /**
28956
+ * Only the diagnostics NAMED here change. An armed window that is not listed
28957
+ * keeps running — a patch is never a full replacement.
28958
+ */
28959
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28960
+ });
28961
+ /**
28962
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
28963
+ *
28964
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
28965
+ * input — the generated router strips it and uses it to resolve the PROVIDER
28966
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
28967
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
28968
+ * by an agent that holds no cluster document at all. The hub is the single
28969
+ * authority over the whole hierarchy and answers for every layer, so the
28970
+ * layer selector needs a name the transport does not already own.
28971
+ */
28972
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
28973
+ var SetLoggingSettingsInputSchema = object({
28974
+ scopeNodeId: string().optional(),
28975
+ patch: LoggingSettingsPatchSchema
28976
+ });
28977
+ /**
28978
+ * The whole document, as read and as returned after every write.
28979
+ *
28980
+ * `persisted: false` means the settings store could not be read or written.
28981
+ * The in-memory mirror still governs behaviour and is unchanged by the
28982
+ * failure — a read that fails neither switches a level nor disarms a window
28983
+ * (D49) — but the operator is told that what they are looking at would not
28984
+ * survive a restart.
28985
+ */
28986
+ var LoggingSettingsStateSchema = object({
28987
+ /** The layer this document was read at. `null` = the cluster layer. */
28988
+ scopeNodeId: string().nullable(),
28989
+ effective: LoggingEffectiveSchema,
28990
+ explicit: LoggingExplicitSchema,
28991
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
28992
+ persisted: boolean()
28993
+ });
28558
28994
  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(), {
28559
28995
  kind: "mutation",
28560
28996
  auth: "admin"
@@ -28567,6 +29003,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28567
29003
  }), method(_void(), SiteLocationStatusSchema, {
28568
29004
  kind: "mutation",
28569
29005
  auth: "admin"
29006
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29007
+ kind: "mutation",
29008
+ auth: "admin"
28570
29009
  });
28571
29010
  /**
28572
29011
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -33756,6 +34195,12 @@ Object.freeze({
33756
34195
  addonId: null,
33757
34196
  access: "view"
33758
34197
  },
34198
+ "notificationRules.resolveArtifactUrl": {
34199
+ capName: "notification-rules",
34200
+ capScope: "system",
34201
+ addonId: null,
34202
+ access: "view"
34203
+ },
33759
34204
  "notificationRules.setAlarmConfig": {
33760
34205
  capName: "notification-rules",
33761
34206
  capScope: "system",
@@ -35160,6 +35605,12 @@ Object.freeze({
35160
35605
  addonId: null,
35161
35606
  access: "view"
35162
35607
  },
35608
+ "recording.readWindowBytes": {
35609
+ capName: "recording",
35610
+ capScope: "system",
35611
+ addonId: null,
35612
+ access: "view"
35613
+ },
35163
35614
  "recording.refreshStorageLocationsForMigration": {
35164
35615
  capName: "recording",
35165
35616
  capScope: "system",
@@ -36000,6 +36451,18 @@ Object.freeze({
36000
36451
  addonId: null,
36001
36452
  access: "create"
36002
36453
  },
36454
+ "system.getLoggingSettings": {
36455
+ capName: "system",
36456
+ capScope: "system",
36457
+ addonId: null,
36458
+ access: "view"
36459
+ },
36460
+ "system.getRequestCensus": {
36461
+ capName: "system",
36462
+ capScope: "system",
36463
+ addonId: null,
36464
+ access: "view"
36465
+ },
36003
36466
  "system.getRetentionConfig": {
36004
36467
  capName: "system",
36005
36468
  capScope: "system",
@@ -36030,6 +36493,12 @@ Object.freeze({
36030
36493
  addonId: null,
36031
36494
  access: "view"
36032
36495
  },
36496
+ "system.setLoggingSettings": {
36497
+ capName: "system",
36498
+ capScope: "system",
36499
+ addonId: null,
36500
+ access: "create"
36501
+ },
36033
36502
  "system.setRetentionConfig": {
36034
36503
  capName: "system",
36035
36504
  capScope: "system",
@@ -37185,6 +37654,10 @@ Object.freeze({
37185
37654
  name: "deviceId",
37186
37655
  form: "single",
37187
37656
  optional: true
37657
+ }, {
37658
+ name: "deviceIds",
37659
+ form: "array",
37660
+ optional: true
37188
37661
  }],
37189
37662
  "fanControl.setDirection": [{
37190
37663
  name: "deviceId",
@@ -37990,6 +38463,11 @@ Object.freeze({
37990
38463
  form: "single",
37991
38464
  optional: false
37992
38465
  }],
38466
+ "recording.readWindowBytes": [{
38467
+ name: "deviceId",
38468
+ form: "single",
38469
+ optional: false
38470
+ }],
37993
38471
  "recording.relocateFootage": [{
37994
38472
  name: "deviceId",
37995
38473
  form: "single",
@@ -38790,7 +39268,38 @@ object({
38790
39268
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
38791
39269
  * reproduce that.
38792
39270
  */
38793
- tileBudgetMb: number().int().min(0).max(1024)
39271
+ tileBudgetMb: number().int().min(0).max(1024),
39272
+ /**
39273
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
39274
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
39275
+ * subject tiles, on frames that detected something.
39276
+ *
39277
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
39278
+ * containment is strict by design, so the native `keyFrame`, the detail
39279
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
39280
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
39281
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
39282
+ * frame-time after delivery, with the request only p50 367 ms behind it.
39283
+ *
39284
+ * Sizing, and why this is a budget and not a duration: a scene tile is
39285
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
39286
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
39287
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
39288
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
39289
+ * binds only through a detection burst, where it still covers well past the
39290
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
39291
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
39292
+ * whole shape exists to avoid.
39293
+ *
39294
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
39295
+ * subject tile, so one shared budget would let a busy camera's key frames
39296
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
39297
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
39298
+ * pre-existing behaviour, where a late full-frame request had nothing but the
39299
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
39300
+ * nothing.
39301
+ */
39302
+ sceneBudgetMb: number().int().min(0).max(1024)
38794
39303
  });
38795
39304
  /**
38796
39305
  * The values in force when the operator has set nothing.
@@ -38806,12 +39315,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
38806
39315
  budgetMb: 1024,
38807
39316
  activityMs: 15e3,
38808
39317
  tileBudgetMb: 64,
39318
+ sceneBudgetMb: 48,
38809
39319
  admission: "inferred"
38810
39320
  };
38811
39321
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
38812
39322
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
38813
39323
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
38814
39324
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
39325
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
38815
39326
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
38816
39327
  var MB = 1024 * 1024;
38817
39328
  1024 * MB, 3072 * MB;