@camstack/addon-ai 0.4.23 → 0.4.25

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
@@ -7758,6 +7758,66 @@ var OpsLogQueryInputSchema = object({
7758
7758
  /** Max rows returned, newest-first. */
7759
7759
  limit: number$1().int().min(1).max(1e3).optional()
7760
7760
  });
7761
+ var LabelDefinitionSchema = object({
7762
+ id: string(),
7763
+ name: string(),
7764
+ category: string().optional(),
7765
+ description: string().optional(),
7766
+ icon: string().optional()
7767
+ });
7768
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
7769
+ var CLASS_MAP_MACRO_TARGETS = [
7770
+ "person",
7771
+ "vehicle",
7772
+ "animal",
7773
+ "package"
7774
+ ];
7775
+ /**
7776
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
7777
+ * un operatore può selezionare.
7778
+ *
7779
+ * Sono le tre offerte dallo step `object-detection`
7780
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
7781
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
7782
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
7783
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
7784
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
7785
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
7786
+ *
7787
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
7788
+ * dello step e una seconda volta come union `FirstLevelMacro`
7789
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
7790
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
7791
+ * successiva.
7792
+ */
7793
+ var FIRST_LEVEL_MACRO_CLASSES = [
7794
+ "person",
7795
+ "vehicle",
7796
+ "animal"
7797
+ ];
7798
+ /**
7799
+ * Wire schema for a per-model CATALOG classMap override
7800
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
7801
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
7802
+ * detection pipeline executor actually routes.
7803
+ *
7804
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
7805
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
7806
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
7807
+ * enum) — the two used to share the name `ClassMapDefinition`/
7808
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
7809
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
7810
+ * are not: it is two different concepts colliding on a name. Keep this type
7811
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
7812
+ * would either narrow every `ClassMapDefinition` consumer to the four
7813
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
7814
+ * schema exists for (see the "rejects a classMap whose target is not a
7815
+ * detection macro" test in `model-catalog-schema.test.ts`).
7816
+ */
7817
+ var DetectionCatalogClassMapSchema = object({
7818
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
7819
+ preserveOriginal: boolean()
7820
+ });
7761
7821
  /**
7762
7822
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
7763
7823
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -7780,10 +7840,55 @@ var RecordingStorageModeSchema = _enum([
7780
7840
  "events",
7781
7841
  "continuous"
7782
7842
  ]);
7843
+ /**
7844
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
7845
+ * tre offerte dallo step `object-detection`, da UNA lista
7846
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
7847
+ */
7848
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
7849
+ /**
7850
+ * True quando `values` non ripete un elemento.
7851
+ *
7852
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
7853
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
7854
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
7855
+ */
7856
+ var noDuplicates = (values) => new Set(values).size === values.length;
7783
7857
  /** Which detectors trigger an `events`-mode band. */
7784
7858
  var RecordingTriggersSchema = object({
7785
7859
  motion: boolean().optional(),
7786
- audioThresholdDbfs: number$1().optional()
7860
+ audioThresholdDbfs: number$1().optional(),
7861
+ /**
7862
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
7863
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
7864
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
7865
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
7866
+ *
7867
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
7868
+ * quelle che hanno attraversato `enabledMacroClasses`, i
7869
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
7870
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
7871
+ * finestre — vedi `recorder/object-trigger.ts`.
7872
+ */
7873
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
7874
+ /**
7875
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
7876
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
7877
+ * `objectClasses`.
7878
+ *
7879
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
7880
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
7881
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
7882
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
7883
+ * device (D12) — mai un elenco globale di cap.
7884
+ *
7885
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
7886
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
7887
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
7888
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
7889
+ * registrare.
7890
+ */
7891
+ sensorDeviceIds: array(number$1().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7787
7892
  });
7788
7893
  /**
7789
7894
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8235,41 +8340,6 @@ var DecoderSessionConfigSchema = object({
8235
8340
  */
8236
8341
  debug: boolean().optional()
8237
8342
  });
8238
- var LabelDefinitionSchema = object({
8239
- id: string(),
8240
- name: string(),
8241
- category: string().optional(),
8242
- description: string().optional(),
8243
- icon: string().optional()
8244
- });
8245
- /**
8246
- * Wire schema for a per-model CATALOG classMap override
8247
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8248
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8249
- * detection pipeline executor actually routes.
8250
- *
8251
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8252
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8253
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8254
- * enum) — the two used to share the name `ClassMapDefinition`/
8255
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8256
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8257
- * are not: it is two different concepts colliding on a name. Keep this type
8258
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8259
- * would either narrow every `ClassMapDefinition` consumer to the four
8260
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8261
- * schema exists for (see the "rejects a classMap whose target is not a
8262
- * detection macro" test in `model-catalog-schema.test.ts`).
8263
- */
8264
- var DetectionCatalogClassMapSchema = object({
8265
- mapping: record(string(), _enum([
8266
- "person",
8267
- "vehicle",
8268
- "animal",
8269
- "package"
8270
- ])),
8271
- preserveOriginal: boolean()
8272
- });
8273
8343
  var MODEL_FORMATS = [
8274
8344
  "onnx",
8275
8345
  "coreml",
@@ -15806,7 +15876,23 @@ var NcHistoryEntrySchema = object({
15806
15876
  updatedAt: number$1(),
15807
15877
  /** Failure detail — present on a `dead` row. */
15808
15878
  error: string().optional(),
15809
- subject: NcHistorySubjectSchema
15879
+ subject: NcHistorySubjectSchema,
15880
+ /**
15881
+ * Ids of the artefacts (still, then gif, then clip) this row's successful
15882
+ * delivery indexed in the artefact library — a REFERENCE, never the bytes
15883
+ * (an artefact is often megabytes; this row is durable JSON rewritten on
15884
+ * every delivery attempt). Absent on a row still pending/dead, a row
15885
+ * delivered before this field shipped, or a wiring with no artefact index.
15886
+ *
15887
+ * Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
15888
+ * outlives any one URL's TTL, so a caller mints a fresh link on demand
15889
+ * rather than trusting one frozen at delivery time. `resolveArtifactUrl`
15890
+ * also answers `null` for an id whose artefact has since expired past the
15891
+ * retained shelf's own age bound — the degrade a caller (the Home
15892
+ * Assistant export) must render as "no image right now", never as a
15893
+ * broken link.
15894
+ */
15895
+ artifactIds: array(string().min(1)).optional()
15810
15896
  });
15811
15897
  /**
15812
15898
  * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
@@ -16033,7 +16119,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
16033
16119
  }), method(object({}), object({
16034
16120
  catalog: array(NcConditionDescriptorSchema),
16035
16121
  taxonomy: NcTaxonomySchema.optional()
16036
- })), 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 }), {
16122
+ })), 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 }), {
16037
16123
  kind: "mutation",
16038
16124
  caller: "required"
16039
16125
  }), method(object({ snoozeId: string() }), object({ success: literal(true) }), {
@@ -21121,7 +21207,7 @@ var lifecycleJobSchema = object({
21121
21207
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21122
21208
  * as every other cap.
21123
21209
  */
21124
- var LogLevelSchema$1 = _enum([
21210
+ var LogLevelSchema$2 = _enum([
21125
21211
  "debug",
21126
21212
  "info",
21127
21213
  "warn",
@@ -21328,7 +21414,7 @@ var CustomActionInputSchema = object({
21328
21414
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21329
21415
  addonId: string(),
21330
21416
  limit: number$1().min(1).max(500).default(100),
21331
- level: LogLevelSchema$1.optional()
21417
+ level: LogLevelSchema$2.optional()
21332
21418
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21333
21419
  packageName: string(),
21334
21420
  version: string().optional()
@@ -21426,7 +21512,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21426
21512
  auth: "admin"
21427
21513
  }), method(object({
21428
21514
  addonId: string(),
21429
- level: LogLevelSchema$1.optional()
21515
+ level: LogLevelSchema$2.optional()
21430
21516
  }), LogStreamEntrySchema, { kind: "subscription" });
21431
21517
  object({
21432
21518
  /** Carbon dioxide concentration in ppm. */
@@ -22420,6 +22506,35 @@ var FaceFilterEnum = _enum([
22420
22506
  "identified",
22421
22507
  "all"
22422
22508
  ]);
22509
+ /**
22510
+ * What a `listRecentFaces` page is ORDERED BY.
22511
+ *
22512
+ * - `timestamp` — when the face was seen. The historical (and default) order.
22513
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
22514
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
22515
+ * order: it puts the suggestions an operator can confirm with one tap at the
22516
+ * top, and it is the reason this enum exists — a client that ranked a capped
22517
+ * page client-side was ranking the newest N, never the most certain N.
22518
+ *
22519
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
22520
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
22521
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
22522
+ * — flipping the direction reorders the rows that HAVE a certainty and never
22523
+ * floods the page with the ones that do not. `addon-post-analysis`'s
22524
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
22525
+ * then by faceId, and is what makes this a total order instead of the
22526
+ * backend's NULL-collation accident.
22527
+ */
22528
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
22529
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
22530
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
22531
+ * never leaves the server. */
22532
+ var FaceClusterSchema = object({
22533
+ faceIds: array(string()).readonly(),
22534
+ representativeFaceId: string(),
22535
+ size: number$1().int(),
22536
+ cohesion: number$1()
22537
+ });
22423
22538
  var MediaFileLiteSchema$1 = object({
22424
22539
  key: string(),
22425
22540
  kind: string(),
@@ -22466,24 +22581,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
22466
22581
  kind: "mutation",
22467
22582
  auth: "admin"
22468
22583
  }), method(object({
22469
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
22584
+ /**
22585
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
22586
+ *
22587
+ * The legacy single-camera form, kept verbatim for every caller that
22588
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
22589
+ * instead — never both: `deviceIds` is the authority whenever it is
22590
+ * present, and this field is then ignored rather than unioned, so
22591
+ * there is exactly one answer to "which cameras did I ask for".
22592
+ */
22470
22593
  deviceId: number$1().int().optional(),
22594
+ /**
22595
+ * Restrict to a SET of cameras — the review UI's camera filter, which
22596
+ * until now had to fetch the cluster-wide page and drop rows in the
22597
+ * client (so the `limit` it asked for was spent on cameras it was
22598
+ * about to discard).
22599
+ *
22600
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
22601
+ * "every camera". A request for no devices is a request, not an
22602
+ * omission; same contract as `deviceManager.listFleet` and
22603
+ * `pipelineAnalytics.listRecentTracks`.
22604
+ *
22605
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
22606
+ */
22607
+ deviceIds: array(number$1().int()).optional(),
22471
22608
  limit: number$1().int().positive().optional(),
22472
22609
  filter: FaceFilterEnum.optional(),
22473
22610
  /**
22474
- * Inline the base64 crop on every row. Default `true` — the existing
22475
- * behaviour, kept so no caller breaks.
22611
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
22612
+ * Absent means no lower bound.
22613
+ */
22614
+ since: number$1().int().optional(),
22615
+ /**
22616
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
22617
+ * Absent means no upper bound.
22618
+ */
22619
+ until: number$1().int().optional(),
22620
+ /**
22621
+ * Order the page by time or by suggestion certainty. Default
22622
+ * `'timestamp'` — the historical order, unchanged for every caller
22623
+ * that does not ask.
22476
22624
  *
22477
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
22478
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
22479
- * the browser cache the images.
22625
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
22626
+ * does under `'suggestionConfidence'`.
22480
22627
  *
22481
- * **This is an INPUT field, so it does not reach the addon until the
22482
- * next train.** The hub router validates cap inputs against its own
22483
- * compiled Zod, which strips a key it does not know — verified today
22484
- * on the OUTPUT side, where an additive field DOES arrive immediately
22485
- * (`Track.hasFace`). Until the train ships, sending `false` is
22486
- * harmless and simply keeps the crops inline.
22628
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
22629
+ * index and stops reading as soon as `limit` rows have PASSED the
22630
+ * filter. `'suggestionConfidence'` cannot stop early — the most
22631
+ * certain row may be the oldest — so it walks the window. Narrow it
22632
+ * with {@link since} / {@link until}.
22633
+ */
22634
+ sortBy: FaceSortFieldEnum.optional(),
22635
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
22636
+ sortDirection: FaceSortDirectionEnum.optional(),
22637
+ /**
22638
+ * Inline the base64 crop on every row.
22639
+ *
22640
+ * Default `false` since the 2026-08-25 inversion — see
22641
+ * `include-crops-default.ts`, which is the ONE place that resolves
22642
+ * this for every gallery, and which records why the inline shape had
22643
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
22644
+ * The doc here used to still say `true`; it was wrong, and a leftover
22645
+ * that describes the old design reads as permission to rely on it.
22646
+ *
22647
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
22648
+ * which the browser fetches off the `event-media` plane in parallel,
22649
+ * cached and ETagged.
22487
22650
  */
22488
22651
  includeCrops: boolean().optional()
22489
22652
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -22519,13 +22682,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
22519
22682
  }), method(object({
22520
22683
  threshold: number$1().min(0).max(1).optional(),
22521
22684
  minClusterSize: number$1().int().min(2).optional(),
22522
- limit: number$1().int().positive().optional()
22523
- }).optional(), array(object({
22524
- faceIds: array(string()).readonly(),
22525
- representativeFaceId: string(),
22526
- size: number$1().int(),
22527
- cohesion: number$1()
22528
- })).readonly());
22685
+ /**
22686
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
22687
+ * which read as though it bounded the work — it never did.
22688
+ *
22689
+ * Wins over {@link limit} when both are sent.
22690
+ */
22691
+ maxClusters: number$1().int().positive().optional(),
22692
+ /**
22693
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
22694
+ * RESULT, not the scan. Kept so existing callers keep working; send
22695
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
22696
+ */
22697
+ limit: number$1().int().positive().optional(),
22698
+ /**
22699
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
22700
+ * POOL, not the result.
22701
+ *
22702
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
22703
+ * used to read every unassigned face on the hub no matter what the
22704
+ * caller asked for, because the only bound cut the finished clusters
22705
+ * afterwards; a UI showing a window of 100 paid for a scan of the
22706
+ * whole corpus, on an addon whose disk is under contention.
22707
+ *
22708
+ * The pool is the NEWEST matching faces first — the same order the
22709
+ * gallery shows — so a bound here shortens the horizon, it does not
22710
+ * sample it randomly.
22711
+ *
22712
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
22713
+ * so the live corpus — 372 face rows — is unaffected while the
22714
+ * unbounded scan can never come back as the table grows.
22715
+ */
22716
+ maxFacesScanned: number$1().int().positive().optional()
22717
+ }).optional(), array(FaceClusterSchema).readonly());
22529
22718
  /**
22530
22719
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
22531
22720
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -25325,6 +25514,39 @@ var ReadGopBytesResultSchema = object({
25325
25514
  /** Media ms the returned fragment covers. */
25326
25515
  gopDurMs: number$1()
25327
25516
  });
25517
+ /**
25518
+ * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
25519
+ * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
25520
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
25521
+ * a replay needs several seconds of native pixels, not one frame.
25522
+ *
25523
+ * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
25524
+ * is `false` when the returned bytes were cut short by the read's own safety
25525
+ * byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
25526
+ * silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
25527
+ * degradation: a window whose end falls past the covering segment would need
25528
+ * bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
25529
+ * not one standalone-demuxable stream — the caller's answer is to request a
25530
+ * shorter window or one aligned to a single segment, not to receive spliced
25531
+ * bytes nothing has proven decodable.
25532
+ */
25533
+ var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
25534
+ kind: literal("ok"),
25535
+ data: _instanceof(Uint8Array),
25536
+ /** Absolute epoch ms of the returned bytes' first sample — at or before
25537
+ * the requested `fromMs` (anchored on the nearest keyframe). */
25538
+ gopStartMs: number$1(),
25539
+ /** Media ms the returned bytes cover, from `gopStartMs`. */
25540
+ gopDurMs: number$1(),
25541
+ /** `false` ⇒ the safety byte cap cut the read short before it reached
25542
+ * the requested `toMs`; the caller got fewer frames than asked for. */
25543
+ reachesRequestedEnd: boolean()
25544
+ }), object({
25545
+ kind: literal("spans-multiple-segments"),
25546
+ /** Where the covering segment's own footage runs out — informational,
25547
+ * not a retry hint (retrying the same window would refuse again). */
25548
+ segmentEndMs: number$1()
25549
+ })]);
25328
25550
  method(object({
25329
25551
  deviceId: number$1(),
25330
25552
  fromMs: number$1(),
@@ -25375,6 +25597,15 @@ method(object({
25375
25597
  }), ReadGopBytesResultSchema, {
25376
25598
  kind: "query",
25377
25599
  auth: "admin"
25600
+ }), method(object({
25601
+ deviceId: number$1(),
25602
+ profile: string(),
25603
+ startMs: number$1(),
25604
+ fromMs: number$1(),
25605
+ toMs: number$1()
25606
+ }), ReadWindowBytesResultSchema, {
25607
+ kind: "query",
25608
+ auth: "admin"
25378
25609
  }), method(object({
25379
25610
  deviceId: number$1(),
25380
25611
  config: RecordingConfigSchema
@@ -26206,6 +26437,211 @@ var SetSiteLocationInputSchema = object({
26206
26437
  latitude: number$1().min(-90).max(90),
26207
26438
  longitude: number$1().min(-180).max(180)
26208
26439
  }).nullable();
26440
+ /**
26441
+ * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
26442
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26443
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26444
+ * already prints - never a token, never an `Authorization` header.
26445
+ */
26446
+ var RequestCensusGroupSchema = object({
26447
+ procedure: string(),
26448
+ userAgent: string(),
26449
+ ip: string(),
26450
+ principal: string(),
26451
+ calls: number$1(),
26452
+ perMin: number$1()
26453
+ });
26454
+ /**
26455
+ * A procedure's TOTAL over the window, across every caller.
26456
+ *
26457
+ * This block, not the group list, is what answers "did these calls arrive over
26458
+ * HTTP at all". A total far BELOW what a store-side census counted over the
26459
+ * same window excludes the HTTP plane, which is a result, not a failure.
26460
+ */
26461
+ var RequestCensusProcedureSchema = object({
26462
+ procedure: string(),
26463
+ calls: number$1(),
26464
+ perMin: number$1()
26465
+ });
26466
+ /**
26467
+ * The census as an operator sees it.
26468
+ *
26469
+ * `persisted` is the honest answer to "will this survive the restart I am
26470
+ * about to do": the arm deadline is written to `system-settings` so a window
26471
+ * armed now can measure the NEXT boot, and a write that failed must not look
26472
+ * like one that succeeded.
26473
+ */
26474
+ var RequestCensusStatusSchema = object({
26475
+ armed: boolean(),
26476
+ /** How long the current - or just-closed - window collected, in ms. */
26477
+ elapsedMs: number$1(),
26478
+ /** The window actually armed, after the server clamped the request. */
26479
+ windowMs: number$1(),
26480
+ /** Epoch ms the window closes at. 0 when disarmed. */
26481
+ armedUntilMs: number$1(),
26482
+ httpRequests: number$1(),
26483
+ batchedRequests: number$1(),
26484
+ /**
26485
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
26486
+ * is in play (`?batch=1` carries several procedures in one request); this is
26487
+ * the number comparable with a store-side call count.
26488
+ */
26489
+ procedureCalls: number$1(),
26490
+ /**
26491
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
26492
+ * transport resolves one context per connection - but the number that says
26493
+ * whether a plane this census cannot see was busy while HTTP was quiet.
26494
+ */
26495
+ wsConnections: number$1(),
26496
+ distinctGroups: number$1(),
26497
+ /** Calls counted in the totals whose group attribution was shed at the
26498
+ * cardinality bound. */
26499
+ unattributedCalls: number$1(),
26500
+ procedures: array(RequestCensusProcedureSchema).readonly(),
26501
+ groups: array(RequestCensusGroupSchema).readonly()
26502
+ }).extend({ persisted: boolean() });
26503
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
26504
+ var LogLevelSchema$1 = _enum([
26505
+ "debug",
26506
+ "info",
26507
+ "warn",
26508
+ "error"
26509
+ ]);
26510
+ /**
26511
+ * The diagnostics that can be ARMED for a window. Exactly one today.
26512
+ *
26513
+ * A diagnostic is anything whose cost is only worth paying while a question is
26514
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
26515
+ */
26516
+ var DiagnosticIdSchema = _enum(["request-census"]);
26517
+ /**
26518
+ * The layers of the level hierarchy, general → specific. The most specific
26519
+ * layer that carries an explicit value wins.
26520
+ *
26521
+ * `component` is DECLARED and not yet resolvable: the per-component channels
26522
+ * are a later slice of the same plan, and a `levelSource` enum that has to
26523
+ * grow later would force every consumer of this document to change with it.
26524
+ * Nothing returns `component` today.
26525
+ */
26526
+ var LoggingScopeKindSchema = _enum([
26527
+ "cluster",
26528
+ "node",
26529
+ "component"
26530
+ ]);
26531
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
26532
+ var LoggingLevelSourceSchema = _enum([
26533
+ "default",
26534
+ "cluster",
26535
+ "node",
26536
+ "component"
26537
+ ]);
26538
+ /**
26539
+ * One layer of the hierarchy as it actually STANDS.
26540
+ *
26541
+ * `level: null` is the whole reason this array is returned: it is the
26542
+ * difference between "this node is at `info` because I decided it" and
26543
+ * "...because it inherits". An operator who clears an override believing they
26544
+ * are clearing an inherited value has been handed the same defect as the two
26545
+ * contradicting knobs this document exists to remove, moved one floor up.
26546
+ */
26547
+ var LoggingLevelLayerSchema = object({
26548
+ scope: LoggingScopeKindSchema,
26549
+ /** The node this layer speaks for; `null` on the cluster layer. */
26550
+ nodeId: string().nullable(),
26551
+ /** Explicitly set here, or `null` when this layer inherits. */
26552
+ level: LogLevelSchema$1.nullable()
26553
+ });
26554
+ /** What a line is judged against, and WHICH layer decided it. */
26555
+ var LoggingEffectiveSchema = object({
26556
+ level: LogLevelSchema$1,
26557
+ levelSource: LoggingLevelSourceSchema
26558
+ });
26559
+ /** Every layer, general → specific. Never collapsed into the effective value. */
26560
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
26561
+ /**
26562
+ * An armed diagnostic, with its DEADLINE.
26563
+ *
26564
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
26565
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
26566
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
26567
+ * `armed` is false — a window is never reported as slightly expired.
26568
+ */
26569
+ var DiagnosticWindowSchema = object({
26570
+ id: DiagnosticIdSchema,
26571
+ armed: boolean(),
26572
+ /** Epoch ms the window closes at. 0 when disarmed. */
26573
+ armedUntilMs: number$1(),
26574
+ /** Ms left before it expires on its own. 0 when disarmed. */
26575
+ remainingMs: number$1(),
26576
+ /** Whether the stored deadline is the one the live diagnostic is running —
26577
+ * i.e. whether this window would survive a restart. */
26578
+ persisted: boolean()
26579
+ });
26580
+ /**
26581
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
26582
+ * server — there is no maximum here on purpose: a bound repeated in a schema
26583
+ * is a second knob that disagrees with the first the day one of them moves.
26584
+ */
26585
+ var DiagnosticWindowPatchSchema = object({
26586
+ id: DiagnosticIdSchema,
26587
+ armMs: number$1().int().min(0),
26588
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
26589
+ reportEveryMs: number$1().int().positive().optional()
26590
+ });
26591
+ /**
26592
+ * A PATCH, and patches MERGE.
26593
+ *
26594
+ * A field absent from the patch is left exactly as it was — arming a
26595
+ * diagnostic never resets a level, and setting a level never disarms a window.
26596
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
26597
+ * `setAll` already merges, and rebuilding the object is how an absent field
26598
+ * turns into an erased one.
26599
+ */
26600
+ var LoggingSettingsPatchSchema = object({
26601
+ /**
26602
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
26603
+ * addressed scope so it inherits again. A value sets it.
26604
+ */
26605
+ level: LogLevelSchema$1.nullable().optional(),
26606
+ /**
26607
+ * Only the diagnostics NAMED here change. An armed window that is not listed
26608
+ * keeps running — a patch is never a full replacement.
26609
+ */
26610
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
26611
+ });
26612
+ /**
26613
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
26614
+ *
26615
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
26616
+ * input — the generated router strips it and uses it to resolve the PROVIDER
26617
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
26618
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
26619
+ * by an agent that holds no cluster document at all. The hub is the single
26620
+ * authority over the whole hierarchy and answers for every layer, so the
26621
+ * layer selector needs a name the transport does not already own.
26622
+ */
26623
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
26624
+ var SetLoggingSettingsInputSchema = object({
26625
+ scopeNodeId: string().optional(),
26626
+ patch: LoggingSettingsPatchSchema
26627
+ });
26628
+ /**
26629
+ * The whole document, as read and as returned after every write.
26630
+ *
26631
+ * `persisted: false` means the settings store could not be read or written.
26632
+ * The in-memory mirror still governs behaviour and is unchanged by the
26633
+ * failure — a read that fails neither switches a level nor disarms a window
26634
+ * (D49) — but the operator is told that what they are looking at would not
26635
+ * survive a restart.
26636
+ */
26637
+ var LoggingSettingsStateSchema = object({
26638
+ /** The layer this document was read at. `null` = the cluster layer. */
26639
+ scopeNodeId: string().nullable(),
26640
+ effective: LoggingEffectiveSchema,
26641
+ explicit: LoggingExplicitSchema,
26642
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
26643
+ persisted: boolean()
26644
+ });
26209
26645
  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(), {
26210
26646
  kind: "mutation",
26211
26647
  auth: "admin"
@@ -26218,6 +26654,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
26218
26654
  }), method(_void(), SiteLocationStatusSchema, {
26219
26655
  kind: "mutation",
26220
26656
  auth: "admin"
26657
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
26658
+ kind: "mutation",
26659
+ auth: "admin"
26221
26660
  });
26222
26661
  object({
26223
26662
  /** True when the device's tamper switch / case-open contact is
@@ -29793,6 +30232,12 @@ Object.freeze({
29793
30232
  addonId: null,
29794
30233
  access: "view"
29795
30234
  },
30235
+ "notificationRules.resolveArtifactUrl": {
30236
+ capName: "notification-rules",
30237
+ capScope: "system",
30238
+ addonId: null,
30239
+ access: "view"
30240
+ },
29796
30241
  "notificationRules.setAlarmConfig": {
29797
30242
  capName: "notification-rules",
29798
30243
  capScope: "system",
@@ -31197,6 +31642,12 @@ Object.freeze({
31197
31642
  addonId: null,
31198
31643
  access: "view"
31199
31644
  },
31645
+ "recording.readWindowBytes": {
31646
+ capName: "recording",
31647
+ capScope: "system",
31648
+ addonId: null,
31649
+ access: "view"
31650
+ },
31200
31651
  "recording.refreshStorageLocationsForMigration": {
31201
31652
  capName: "recording",
31202
31653
  capScope: "system",
@@ -32037,6 +32488,18 @@ Object.freeze({
32037
32488
  addonId: null,
32038
32489
  access: "create"
32039
32490
  },
32491
+ "system.getLoggingSettings": {
32492
+ capName: "system",
32493
+ capScope: "system",
32494
+ addonId: null,
32495
+ access: "view"
32496
+ },
32497
+ "system.getRequestCensus": {
32498
+ capName: "system",
32499
+ capScope: "system",
32500
+ addonId: null,
32501
+ access: "view"
32502
+ },
32040
32503
  "system.getRetentionConfig": {
32041
32504
  capName: "system",
32042
32505
  capScope: "system",
@@ -32067,6 +32530,12 @@ Object.freeze({
32067
32530
  addonId: null,
32068
32531
  access: "view"
32069
32532
  },
32533
+ "system.setLoggingSettings": {
32534
+ capName: "system",
32535
+ capScope: "system",
32536
+ addonId: null,
32537
+ access: "create"
32538
+ },
32070
32539
  "system.setRetentionConfig": {
32071
32540
  capName: "system",
32072
32541
  capScope: "system",
@@ -33222,6 +33691,10 @@ Object.freeze({
33222
33691
  name: "deviceId",
33223
33692
  form: "single",
33224
33693
  optional: true
33694
+ }, {
33695
+ name: "deviceIds",
33696
+ form: "array",
33697
+ optional: true
33225
33698
  }],
33226
33699
  "fanControl.setDirection": [{
33227
33700
  name: "deviceId",
@@ -34027,6 +34500,11 @@ Object.freeze({
34027
34500
  form: "single",
34028
34501
  optional: false
34029
34502
  }],
34503
+ "recording.readWindowBytes": [{
34504
+ name: "deviceId",
34505
+ form: "single",
34506
+ optional: false
34507
+ }],
34030
34508
  "recording.relocateFootage": [{
34031
34509
  name: "deviceId",
34032
34510
  form: "single",
@@ -34827,7 +35305,38 @@ object({
34827
35305
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
34828
35306
  * reproduce that.
34829
35307
  */
34830
- tileBudgetMb: number$1().int().min(0).max(1024)
35308
+ tileBudgetMb: number$1().int().min(0).max(1024),
35309
+ /**
35310
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
35311
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
35312
+ * subject tiles, on frames that detected something.
35313
+ *
35314
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
35315
+ * containment is strict by design, so the native `keyFrame`, the detail
35316
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
35317
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
35318
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
35319
+ * frame-time after delivery, with the request only p50 367 ms behind it.
35320
+ *
35321
+ * Sizing, and why this is a budget and not a duration: a scene tile is
35322
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
35323
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
35324
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
35325
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
35326
+ * binds only through a detection burst, where it still covers well past the
35327
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
35328
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
35329
+ * whole shape exists to avoid.
35330
+ *
35331
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
35332
+ * subject tile, so one shared budget would let a busy camera's key frames
35333
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
35334
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
35335
+ * pre-existing behaviour, where a late full-frame request had nothing but the
35336
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
35337
+ * nothing.
35338
+ */
35339
+ sceneBudgetMb: number$1().int().min(0).max(1024)
34831
35340
  });
34832
35341
  /**
34833
35342
  * The values in force when the operator has set nothing.
@@ -34843,12 +35352,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
34843
35352
  budgetMb: 1024,
34844
35353
  activityMs: 15e3,
34845
35354
  tileBudgetMb: 64,
35355
+ sceneBudgetMb: 48,
34846
35356
  admission: "inferred"
34847
35357
  };
34848
35358
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
34849
35359
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
34850
35360
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
34851
35361
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
35362
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
34852
35363
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
34853
35364
  var MB = 1024 * 1024;
34854
35365
  1024 * MB, 3072 * MB;