@camstack/addon-ai 0.4.24 → 0.4.26

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 +577 -59
  2. package/dist/addon.mjs +577 -59
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -7732,6 +7732,66 @@ var OpsLogQueryInputSchema = object({
7732
7732
  /** Max rows returned, newest-first. */
7733
7733
  limit: number$1().int().min(1).max(1e3).optional()
7734
7734
  });
7735
+ var LabelDefinitionSchema = object({
7736
+ id: string(),
7737
+ name: string(),
7738
+ category: string().optional(),
7739
+ description: string().optional(),
7740
+ icon: string().optional()
7741
+ });
7742
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
7743
+ var CLASS_MAP_MACRO_TARGETS = [
7744
+ "person",
7745
+ "vehicle",
7746
+ "animal",
7747
+ "package"
7748
+ ];
7749
+ /**
7750
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
7751
+ * un operatore può selezionare.
7752
+ *
7753
+ * Sono le tre offerte dallo step `object-detection`
7754
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
7755
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
7756
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
7757
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
7758
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
7759
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
7760
+ *
7761
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
7762
+ * dello step e una seconda volta come union `FirstLevelMacro`
7763
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
7764
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
7765
+ * successiva.
7766
+ */
7767
+ var FIRST_LEVEL_MACRO_CLASSES = [
7768
+ "person",
7769
+ "vehicle",
7770
+ "animal"
7771
+ ];
7772
+ /**
7773
+ * Wire schema for a per-model CATALOG classMap override
7774
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
7775
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
7776
+ * detection pipeline executor actually routes.
7777
+ *
7778
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
7779
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
7780
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
7781
+ * enum) — the two used to share the name `ClassMapDefinition`/
7782
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
7783
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
7784
+ * are not: it is two different concepts colliding on a name. Keep this type
7785
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
7786
+ * would either narrow every `ClassMapDefinition` consumer to the four
7787
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
7788
+ * schema exists for (see the "rejects a classMap whose target is not a
7789
+ * detection macro" test in `model-catalog-schema.test.ts`).
7790
+ */
7791
+ var DetectionCatalogClassMapSchema = object({
7792
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
7793
+ preserveOriginal: boolean()
7794
+ });
7735
7795
  /**
7736
7796
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
7737
7797
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -7754,10 +7814,55 @@ var RecordingStorageModeSchema = _enum([
7754
7814
  "events",
7755
7815
  "continuous"
7756
7816
  ]);
7817
+ /**
7818
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
7819
+ * tre offerte dallo step `object-detection`, da UNA lista
7820
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
7821
+ */
7822
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
7823
+ /**
7824
+ * True quando `values` non ripete un elemento.
7825
+ *
7826
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
7827
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
7828
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
7829
+ */
7830
+ var noDuplicates = (values) => new Set(values).size === values.length;
7757
7831
  /** Which detectors trigger an `events`-mode band. */
7758
7832
  var RecordingTriggersSchema = object({
7759
7833
  motion: boolean().optional(),
7760
- audioThresholdDbfs: number$1().optional()
7834
+ audioThresholdDbfs: number$1().optional(),
7835
+ /**
7836
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
7837
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
7838
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
7839
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
7840
+ *
7841
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
7842
+ * quelle che hanno attraversato `enabledMacroClasses`, i
7843
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
7844
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
7845
+ * finestre — vedi `recorder/object-trigger.ts`.
7846
+ */
7847
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
7848
+ /**
7849
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
7850
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
7851
+ * `objectClasses`.
7852
+ *
7853
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
7854
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
7855
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
7856
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
7857
+ * device (D12) — mai un elenco globale di cap.
7858
+ *
7859
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
7860
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
7861
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
7862
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
7863
+ * registrare.
7864
+ */
7865
+ sensorDeviceIds: array(number$1().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7761
7866
  });
7762
7867
  /**
7763
7868
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -8209,41 +8314,6 @@ var DecoderSessionConfigSchema = object({
8209
8314
  */
8210
8315
  debug: boolean().optional()
8211
8316
  });
8212
- var LabelDefinitionSchema = object({
8213
- id: string(),
8214
- name: string(),
8215
- category: string().optional(),
8216
- description: string().optional(),
8217
- icon: string().optional()
8218
- });
8219
- /**
8220
- * Wire schema for a per-model CATALOG classMap override
8221
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8222
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8223
- * detection pipeline executor actually routes.
8224
- *
8225
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8226
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8227
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8228
- * enum) — the two used to share the name `ClassMapDefinition`/
8229
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8230
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8231
- * are not: it is two different concepts colliding on a name. Keep this type
8232
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
8233
- * would either narrow every `ClassMapDefinition` consumer to the four
8234
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8235
- * schema exists for (see the "rejects a classMap whose target is not a
8236
- * detection macro" test in `model-catalog-schema.test.ts`).
8237
- */
8238
- var DetectionCatalogClassMapSchema = object({
8239
- mapping: record(string(), _enum([
8240
- "person",
8241
- "vehicle",
8242
- "animal",
8243
- "package"
8244
- ])),
8245
- preserveOriginal: boolean()
8246
- });
8247
8317
  var MODEL_FORMATS = [
8248
8318
  "onnx",
8249
8319
  "coreml",
@@ -21111,7 +21181,7 @@ var lifecycleJobSchema = object({
21111
21181
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21112
21182
  * as every other cap.
21113
21183
  */
21114
- var LogLevelSchema$1 = _enum([
21184
+ var LogLevelSchema$2 = _enum([
21115
21185
  "debug",
21116
21186
  "info",
21117
21187
  "warn",
@@ -21318,7 +21388,7 @@ var CustomActionInputSchema = object({
21318
21388
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21319
21389
  addonId: string(),
21320
21390
  limit: number$1().min(1).max(500).default(100),
21321
- level: LogLevelSchema$1.optional()
21391
+ level: LogLevelSchema$2.optional()
21322
21392
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21323
21393
  packageName: string(),
21324
21394
  version: string().optional()
@@ -21416,7 +21486,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21416
21486
  auth: "admin"
21417
21487
  }), method(object({
21418
21488
  addonId: string(),
21419
- level: LogLevelSchema$1.optional()
21489
+ level: LogLevelSchema$2.optional()
21420
21490
  }), LogStreamEntrySchema, { kind: "subscription" });
21421
21491
  object({
21422
21492
  /** Carbon dioxide concentration in ppm. */
@@ -22410,6 +22480,35 @@ var FaceFilterEnum = _enum([
22410
22480
  "identified",
22411
22481
  "all"
22412
22482
  ]);
22483
+ /**
22484
+ * What a `listRecentFaces` page is ORDERED BY.
22485
+ *
22486
+ * - `timestamp` — when the face was seen. The historical (and default) order.
22487
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
22488
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
22489
+ * order: it puts the suggestions an operator can confirm with one tap at the
22490
+ * top, and it is the reason this enum exists — a client that ranked a capped
22491
+ * page client-side was ranking the newest N, never the most certain N.
22492
+ *
22493
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
22494
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
22495
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
22496
+ * — flipping the direction reorders the rows that HAVE a certainty and never
22497
+ * floods the page with the ones that do not. `addon-post-analysis`'s
22498
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
22499
+ * then by faceId, and is what makes this a total order instead of the
22500
+ * backend's NULL-collation accident.
22501
+ */
22502
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
22503
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
22504
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
22505
+ * never leaves the server. */
22506
+ var FaceClusterSchema = object({
22507
+ faceIds: array(string()).readonly(),
22508
+ representativeFaceId: string(),
22509
+ size: number$1().int(),
22510
+ cohesion: number$1()
22511
+ });
22413
22512
  var MediaFileLiteSchema$1 = object({
22414
22513
  key: string(),
22415
22514
  kind: string(),
@@ -22456,24 +22555,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
22456
22555
  kind: "mutation",
22457
22556
  auth: "admin"
22458
22557
  }), method(object({
22459
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
22558
+ /**
22559
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
22560
+ *
22561
+ * The legacy single-camera form, kept verbatim for every caller that
22562
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
22563
+ * instead — never both: `deviceIds` is the authority whenever it is
22564
+ * present, and this field is then ignored rather than unioned, so
22565
+ * there is exactly one answer to "which cameras did I ask for".
22566
+ */
22460
22567
  deviceId: number$1().int().optional(),
22568
+ /**
22569
+ * Restrict to a SET of cameras — the review UI's camera filter, which
22570
+ * until now had to fetch the cluster-wide page and drop rows in the
22571
+ * client (so the `limit` it asked for was spent on cameras it was
22572
+ * about to discard).
22573
+ *
22574
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
22575
+ * "every camera". A request for no devices is a request, not an
22576
+ * omission; same contract as `deviceManager.listFleet` and
22577
+ * `pipelineAnalytics.listRecentTracks`.
22578
+ *
22579
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
22580
+ */
22581
+ deviceIds: array(number$1().int()).optional(),
22461
22582
  limit: number$1().int().positive().optional(),
22462
22583
  filter: FaceFilterEnum.optional(),
22463
22584
  /**
22464
- * Inline the base64 crop on every row. Default `true` — the existing
22465
- * behaviour, kept so no caller breaks.
22585
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
22586
+ * Absent means no lower bound.
22587
+ */
22588
+ since: number$1().int().optional(),
22589
+ /**
22590
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
22591
+ * Absent means no upper bound.
22592
+ */
22593
+ until: number$1().int().optional(),
22594
+ /**
22595
+ * Order the page by time or by suggestion certainty. Default
22596
+ * `'timestamp'` — the historical order, unchanged for every caller
22597
+ * that does not ask.
22466
22598
  *
22467
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
22468
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
22469
- * the browser cache the images.
22599
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
22600
+ * does under `'suggestionConfidence'`.
22470
22601
  *
22471
- * **This is an INPUT field, so it does not reach the addon until the
22472
- * next train.** The hub router validates cap inputs against its own
22473
- * compiled Zod, which strips a key it does not know — verified today
22474
- * on the OUTPUT side, where an additive field DOES arrive immediately
22475
- * (`Track.hasFace`). Until the train ships, sending `false` is
22476
- * harmless and simply keeps the crops inline.
22602
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
22603
+ * index and stops reading as soon as `limit` rows have PASSED the
22604
+ * filter. `'suggestionConfidence'` cannot stop early — the most
22605
+ * certain row may be the oldest — so it walks the window. Narrow it
22606
+ * with {@link since} / {@link until}.
22607
+ */
22608
+ sortBy: FaceSortFieldEnum.optional(),
22609
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
22610
+ sortDirection: FaceSortDirectionEnum.optional(),
22611
+ /**
22612
+ * Inline the base64 crop on every row.
22613
+ *
22614
+ * Default `false` since the 2026-08-25 inversion — see
22615
+ * `include-crops-default.ts`, which is the ONE place that resolves
22616
+ * this for every gallery, and which records why the inline shape had
22617
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
22618
+ * The doc here used to still say `true`; it was wrong, and a leftover
22619
+ * that describes the old design reads as permission to rely on it.
22620
+ *
22621
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
22622
+ * which the browser fetches off the `event-media` plane in parallel,
22623
+ * cached and ETagged.
22477
22624
  */
22478
22625
  includeCrops: boolean().optional()
22479
22626
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -22509,13 +22656,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
22509
22656
  }), method(object({
22510
22657
  threshold: number$1().min(0).max(1).optional(),
22511
22658
  minClusterSize: number$1().int().min(2).optional(),
22512
- limit: number$1().int().positive().optional()
22513
- }).optional(), array(object({
22514
- faceIds: array(string()).readonly(),
22515
- representativeFaceId: string(),
22516
- size: number$1().int(),
22517
- cohesion: number$1()
22518
- })).readonly());
22659
+ /**
22660
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
22661
+ * which read as though it bounded the work — it never did.
22662
+ *
22663
+ * Wins over {@link limit} when both are sent.
22664
+ */
22665
+ maxClusters: number$1().int().positive().optional(),
22666
+ /**
22667
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
22668
+ * RESULT, not the scan. Kept so existing callers keep working; send
22669
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
22670
+ */
22671
+ limit: number$1().int().positive().optional(),
22672
+ /**
22673
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
22674
+ * POOL, not the result.
22675
+ *
22676
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
22677
+ * used to read every unassigned face on the hub no matter what the
22678
+ * caller asked for, because the only bound cut the finished clusters
22679
+ * afterwards; a UI showing a window of 100 paid for a scan of the
22680
+ * whole corpus, on an addon whose disk is under contention.
22681
+ *
22682
+ * The pool is the NEWEST matching faces first — the same order the
22683
+ * gallery shows — so a bound here shortens the horizon, it does not
22684
+ * sample it randomly.
22685
+ *
22686
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
22687
+ * so the live corpus — 372 face rows — is unaffected while the
22688
+ * unbounded scan can never come back as the table grows.
22689
+ */
22690
+ maxFacesScanned: number$1().int().positive().optional()
22691
+ }).optional(), array(FaceClusterSchema).readonly());
22519
22692
  /**
22520
22693
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
22521
22694
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -26238,6 +26411,293 @@ var SetSiteLocationInputSchema = object({
26238
26411
  latitude: number$1().min(-90).max(90),
26239
26412
  longitude: number$1().min(-180).max(180)
26240
26413
  }).nullable();
26414
+ /**
26415
+ * The TRANSPORT a call arrived on.
26416
+ *
26417
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
26418
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
26419
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
26420
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
26421
+ * checkable rather than asserted.
26422
+ *
26423
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
26424
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
26425
+ * connection; the viewer talks to the hub over `wsLink`
26426
+ * exclusively, so this is the plane the HTTP census could not see.
26427
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
26428
+ * never touches a socket and therefore never touched a census.
26429
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
26430
+ * that is exactly what its `0` asserts: every plane the hub has can name
26431
+ * itself. It is an output bucket, never a knob — a call that arrives on a
26432
+ * plane nobody instrumented lands here instead of vanishing from the total.
26433
+ */
26434
+ var TransportPlaneSchema = _enum([
26435
+ "http",
26436
+ "ws",
26437
+ "mesh",
26438
+ "unknown"
26439
+ ]);
26440
+ /**
26441
+ * Calls per plane. Every key is always present, `0` included — an absent plane
26442
+ * reads as "not instrumented", which is the one thing this census must never
26443
+ * make an operator wonder about.
26444
+ */
26445
+ var TransportPlaneCountsSchema = object({
26446
+ http: number$1(),
26447
+ ws: number$1(),
26448
+ mesh: number$1(),
26449
+ unknown: number$1()
26450
+ });
26451
+ /**
26452
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
26453
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26454
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26455
+ * already prints - never a token, never an `Authorization` header.
26456
+ *
26457
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
26458
+ * and lives for hours, so folding it into a call count makes one long-lived
26459
+ * stream look like a storm.
26460
+ */
26461
+ var RequestCensusGroupSchema = object({
26462
+ plane: TransportPlaneSchema,
26463
+ procedure: string(),
26464
+ userAgent: string(),
26465
+ ip: string(),
26466
+ principal: string(),
26467
+ calls: number$1(),
26468
+ subscriptions: number$1(),
26469
+ perMin: number$1()
26470
+ });
26471
+ /**
26472
+ * A procedure's TOTAL over the window, across every caller.
26473
+ *
26474
+ * This block, not the group list, is what answers "did these calls arrive over
26475
+ * HTTP at all". A total far BELOW what a store-side census counted over the
26476
+ * same window excludes the HTTP plane, which is a result, not a failure.
26477
+ */
26478
+ var RequestCensusProcedureSchema = object({
26479
+ procedure: string(),
26480
+ calls: number$1(),
26481
+ /**
26482
+ * The same total, split by transport. THIS is the row that answers the
26483
+ * question the census exists for: one look at `deviceManager.listAll` says
26484
+ * which plane carried the 4 960, without joining two log lines by eye.
26485
+ */
26486
+ planes: TransportPlaneCountsSchema,
26487
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
26488
+ subscriptions: number$1(),
26489
+ perMin: number$1()
26490
+ });
26491
+ /**
26492
+ * The census as an operator sees it.
26493
+ *
26494
+ * `persisted` is the honest answer to "will this survive the restart I am
26495
+ * about to do": the arm deadline is written to `system-settings` so a window
26496
+ * armed now can measure the NEXT boot, and a write that failed must not look
26497
+ * like one that succeeded.
26498
+ */
26499
+ var RequestCensusStatusSchema = object({
26500
+ armed: boolean(),
26501
+ /** How long the current - or just-closed - window collected, in ms. */
26502
+ elapsedMs: number$1(),
26503
+ /** The window actually armed, after the server clamped the request. */
26504
+ windowMs: number$1(),
26505
+ /** Epoch ms the window closes at. 0 when disarmed. */
26506
+ armedUntilMs: number$1(),
26507
+ httpRequests: number$1(),
26508
+ batchedRequests: number$1(),
26509
+ /**
26510
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
26511
+ * is in play (`?batch=1` carries several procedures in one request); this is
26512
+ * the number comparable with a store-side call count.
26513
+ */
26514
+ procedureCalls: number$1(),
26515
+ /**
26516
+ * `procedureCalls` split by transport. The four keys sum to
26517
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
26518
+ * `planesExplainTotal` is that identity, checked rather than assumed.
26519
+ */
26520
+ planes: TransportPlaneCountsSchema,
26521
+ /**
26522
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
26523
+ * on no plane at all - which is a RESULT (a plane is missing from the
26524
+ * instrument), not a failure, and it has to be visible to be read as one.
26525
+ */
26526
+ planesExplainTotal: boolean(),
26527
+ /**
26528
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
26529
+ * adapter resolves one context per connection - kept because a plane's call
26530
+ * count of zero against 37 open connections says something different from a
26531
+ * plane with no connections at all.
26532
+ */
26533
+ wsConnections: number$1(),
26534
+ /**
26535
+ * Client frames the WS plane looked at. `wsMessages` far above
26536
+ * `planes.ws + subscriptions` means most traffic is not operations
26537
+ * (keepalives, connection params) - which is itself an answer.
26538
+ */
26539
+ wsMessages: number$1(),
26540
+ /**
26541
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
26542
+ * purpose: one live-events stream opened at boot and held for six hours is
26543
+ * one subscription, and counting it as a call would let a quiet plane
26544
+ * masquerade as the storm.
26545
+ */
26546
+ subscriptions: number$1(),
26547
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
26548
+ subscriptionStops: number$1(),
26549
+ distinctGroups: number$1(),
26550
+ /**
26551
+ * Operations counted in the totals whose CALLER attribution was shed at the
26552
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
26553
+ * which transport they arrived on, they just lost their group row.
26554
+ */
26555
+ unattributedCalls: number$1(),
26556
+ procedures: array(RequestCensusProcedureSchema).readonly(),
26557
+ groups: array(RequestCensusGroupSchema).readonly()
26558
+ }).extend({ persisted: boolean() });
26559
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
26560
+ var LogLevelSchema$1 = _enum([
26561
+ "debug",
26562
+ "info",
26563
+ "warn",
26564
+ "error"
26565
+ ]);
26566
+ /**
26567
+ * The diagnostics that can be ARMED for a window. Exactly one today.
26568
+ *
26569
+ * A diagnostic is anything whose cost is only worth paying while a question is
26570
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
26571
+ */
26572
+ var DiagnosticIdSchema = _enum(["request-census"]);
26573
+ /**
26574
+ * The layers of the level hierarchy, general → specific. The most specific
26575
+ * layer that carries an explicit value wins.
26576
+ *
26577
+ * `component` is DECLARED and not yet resolvable: the per-component channels
26578
+ * are a later slice of the same plan, and a `levelSource` enum that has to
26579
+ * grow later would force every consumer of this document to change with it.
26580
+ * Nothing returns `component` today.
26581
+ */
26582
+ var LoggingScopeKindSchema = _enum([
26583
+ "cluster",
26584
+ "node",
26585
+ "component"
26586
+ ]);
26587
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
26588
+ var LoggingLevelSourceSchema = _enum([
26589
+ "default",
26590
+ "cluster",
26591
+ "node",
26592
+ "component"
26593
+ ]);
26594
+ /**
26595
+ * One layer of the hierarchy as it actually STANDS.
26596
+ *
26597
+ * `level: null` is the whole reason this array is returned: it is the
26598
+ * difference between "this node is at `info` because I decided it" and
26599
+ * "...because it inherits". An operator who clears an override believing they
26600
+ * are clearing an inherited value has been handed the same defect as the two
26601
+ * contradicting knobs this document exists to remove, moved one floor up.
26602
+ */
26603
+ var LoggingLevelLayerSchema = object({
26604
+ scope: LoggingScopeKindSchema,
26605
+ /** The node this layer speaks for; `null` on the cluster layer. */
26606
+ nodeId: string().nullable(),
26607
+ /** Explicitly set here, or `null` when this layer inherits. */
26608
+ level: LogLevelSchema$1.nullable()
26609
+ });
26610
+ /** What a line is judged against, and WHICH layer decided it. */
26611
+ var LoggingEffectiveSchema = object({
26612
+ level: LogLevelSchema$1,
26613
+ levelSource: LoggingLevelSourceSchema
26614
+ });
26615
+ /** Every layer, general → specific. Never collapsed into the effective value. */
26616
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
26617
+ /**
26618
+ * An armed diagnostic, with its DEADLINE.
26619
+ *
26620
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
26621
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
26622
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
26623
+ * `armed` is false — a window is never reported as slightly expired.
26624
+ */
26625
+ var DiagnosticWindowSchema = object({
26626
+ id: DiagnosticIdSchema,
26627
+ armed: boolean(),
26628
+ /** Epoch ms the window closes at. 0 when disarmed. */
26629
+ armedUntilMs: number$1(),
26630
+ /** Ms left before it expires on its own. 0 when disarmed. */
26631
+ remainingMs: number$1(),
26632
+ /** Whether the stored deadline is the one the live diagnostic is running —
26633
+ * i.e. whether this window would survive a restart. */
26634
+ persisted: boolean()
26635
+ });
26636
+ /**
26637
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
26638
+ * server — there is no maximum here on purpose: a bound repeated in a schema
26639
+ * is a second knob that disagrees with the first the day one of them moves.
26640
+ */
26641
+ var DiagnosticWindowPatchSchema = object({
26642
+ id: DiagnosticIdSchema,
26643
+ armMs: number$1().int().min(0),
26644
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
26645
+ reportEveryMs: number$1().int().positive().optional()
26646
+ });
26647
+ /**
26648
+ * A PATCH, and patches MERGE.
26649
+ *
26650
+ * A field absent from the patch is left exactly as it was — arming a
26651
+ * diagnostic never resets a level, and setting a level never disarms a window.
26652
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
26653
+ * `setAll` already merges, and rebuilding the object is how an absent field
26654
+ * turns into an erased one.
26655
+ */
26656
+ var LoggingSettingsPatchSchema = object({
26657
+ /**
26658
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
26659
+ * addressed scope so it inherits again. A value sets it.
26660
+ */
26661
+ level: LogLevelSchema$1.nullable().optional(),
26662
+ /**
26663
+ * Only the diagnostics NAMED here change. An armed window that is not listed
26664
+ * keeps running — a patch is never a full replacement.
26665
+ */
26666
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
26667
+ });
26668
+ /**
26669
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
26670
+ *
26671
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
26672
+ * input — the generated router strips it and uses it to resolve the PROVIDER
26673
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
26674
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
26675
+ * by an agent that holds no cluster document at all. The hub is the single
26676
+ * authority over the whole hierarchy and answers for every layer, so the
26677
+ * layer selector needs a name the transport does not already own.
26678
+ */
26679
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
26680
+ var SetLoggingSettingsInputSchema = object({
26681
+ scopeNodeId: string().optional(),
26682
+ patch: LoggingSettingsPatchSchema
26683
+ });
26684
+ /**
26685
+ * The whole document, as read and as returned after every write.
26686
+ *
26687
+ * `persisted: false` means the settings store could not be read or written.
26688
+ * The in-memory mirror still governs behaviour and is unchanged by the
26689
+ * failure — a read that fails neither switches a level nor disarms a window
26690
+ * (D49) — but the operator is told that what they are looking at would not
26691
+ * survive a restart.
26692
+ */
26693
+ var LoggingSettingsStateSchema = object({
26694
+ /** The layer this document was read at. `null` = the cluster layer. */
26695
+ scopeNodeId: string().nullable(),
26696
+ effective: LoggingEffectiveSchema,
26697
+ explicit: LoggingExplicitSchema,
26698
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
26699
+ persisted: boolean()
26700
+ });
26241
26701
  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(), {
26242
26702
  kind: "mutation",
26243
26703
  auth: "admin"
@@ -26250,6 +26710,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
26250
26710
  }), method(_void(), SiteLocationStatusSchema, {
26251
26711
  kind: "mutation",
26252
26712
  auth: "admin"
26713
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
26714
+ kind: "mutation",
26715
+ auth: "admin"
26253
26716
  });
26254
26717
  object({
26255
26718
  /** True when the device's tamper switch / case-open contact is
@@ -32081,6 +32544,18 @@ Object.freeze({
32081
32544
  addonId: null,
32082
32545
  access: "create"
32083
32546
  },
32547
+ "system.getLoggingSettings": {
32548
+ capName: "system",
32549
+ capScope: "system",
32550
+ addonId: null,
32551
+ access: "view"
32552
+ },
32553
+ "system.getRequestCensus": {
32554
+ capName: "system",
32555
+ capScope: "system",
32556
+ addonId: null,
32557
+ access: "view"
32558
+ },
32084
32559
  "system.getRetentionConfig": {
32085
32560
  capName: "system",
32086
32561
  capScope: "system",
@@ -32111,6 +32586,12 @@ Object.freeze({
32111
32586
  addonId: null,
32112
32587
  access: "view"
32113
32588
  },
32589
+ "system.setLoggingSettings": {
32590
+ capName: "system",
32591
+ capScope: "system",
32592
+ addonId: null,
32593
+ access: "create"
32594
+ },
32114
32595
  "system.setRetentionConfig": {
32115
32596
  capName: "system",
32116
32597
  capScope: "system",
@@ -33266,6 +33747,10 @@ Object.freeze({
33266
33747
  name: "deviceId",
33267
33748
  form: "single",
33268
33749
  optional: true
33750
+ }, {
33751
+ name: "deviceIds",
33752
+ form: "array",
33753
+ optional: true
33269
33754
  }],
33270
33755
  "fanControl.setDirection": [{
33271
33756
  name: "deviceId",
@@ -34876,7 +35361,38 @@ object({
34876
35361
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
34877
35362
  * reproduce that.
34878
35363
  */
34879
- tileBudgetMb: number$1().int().min(0).max(1024)
35364
+ tileBudgetMb: number$1().int().min(0).max(1024),
35365
+ /**
35366
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
35367
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
35368
+ * subject tiles, on frames that detected something.
35369
+ *
35370
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
35371
+ * containment is strict by design, so the native `keyFrame`, the detail
35372
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
35373
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
35374
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
35375
+ * frame-time after delivery, with the request only p50 367 ms behind it.
35376
+ *
35377
+ * Sizing, and why this is a budget and not a duration: a scene tile is
35378
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
35379
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
35380
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
35381
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
35382
+ * binds only through a detection burst, where it still covers well past the
35383
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
35384
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
35385
+ * whole shape exists to avoid.
35386
+ *
35387
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
35388
+ * subject tile, so one shared budget would let a busy camera's key frames
35389
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
35390
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
35391
+ * pre-existing behaviour, where a late full-frame request had nothing but the
35392
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
35393
+ * nothing.
35394
+ */
35395
+ sceneBudgetMb: number$1().int().min(0).max(1024)
34880
35396
  });
34881
35397
  /**
34882
35398
  * The values in force when the operator has set nothing.
@@ -34892,12 +35408,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
34892
35408
  budgetMb: 1024,
34893
35409
  activityMs: 15e3,
34894
35410
  tileBudgetMb: 64,
35411
+ sceneBudgetMb: 48,
34895
35412
  admission: "inferred"
34896
35413
  };
34897
35414
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
34898
35415
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
34899
35416
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
34900
35417
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
35418
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
34901
35419
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
34902
35420
  var MB = 1024 * 1024;
34903
35421
  1024 * MB, 3072 * MB;