@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.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",
@@ -21137,7 +21207,7 @@ var lifecycleJobSchema = object({
21137
21207
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21138
21208
  * as every other cap.
21139
21209
  */
21140
- var LogLevelSchema$1 = _enum([
21210
+ var LogLevelSchema$2 = _enum([
21141
21211
  "debug",
21142
21212
  "info",
21143
21213
  "warn",
@@ -21344,7 +21414,7 @@ var CustomActionInputSchema = object({
21344
21414
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
21345
21415
  addonId: string(),
21346
21416
  limit: number$1().min(1).max(500).default(100),
21347
- level: LogLevelSchema$1.optional()
21417
+ level: LogLevelSchema$2.optional()
21348
21418
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
21349
21419
  packageName: string(),
21350
21420
  version: string().optional()
@@ -21442,7 +21512,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21442
21512
  auth: "admin"
21443
21513
  }), method(object({
21444
21514
  addonId: string(),
21445
- level: LogLevelSchema$1.optional()
21515
+ level: LogLevelSchema$2.optional()
21446
21516
  }), LogStreamEntrySchema, { kind: "subscription" });
21447
21517
  object({
21448
21518
  /** Carbon dioxide concentration in ppm. */
@@ -22436,6 +22506,35 @@ var FaceFilterEnum = _enum([
22436
22506
  "identified",
22437
22507
  "all"
22438
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
+ });
22439
22538
  var MediaFileLiteSchema$1 = object({
22440
22539
  key: string(),
22441
22540
  kind: string(),
@@ -22482,24 +22581,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
22482
22581
  kind: "mutation",
22483
22582
  auth: "admin"
22484
22583
  }), method(object({
22485
- /** 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
+ */
22486
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(),
22487
22608
  limit: number$1().int().positive().optional(),
22488
22609
  filter: FaceFilterEnum.optional(),
22489
22610
  /**
22490
- * Inline the base64 crop on every row. Default `true` — the existing
22491
- * 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.
22492
22624
  *
22493
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
22494
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
22495
- * the browser cache the images.
22625
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
22626
+ * does under `'suggestionConfidence'`.
22496
22627
  *
22497
- * **This is an INPUT field, so it does not reach the addon until the
22498
- * next train.** The hub router validates cap inputs against its own
22499
- * compiled Zod, which strips a key it does not know — verified today
22500
- * on the OUTPUT side, where an additive field DOES arrive immediately
22501
- * (`Track.hasFace`). Until the train ships, sending `false` is
22502
- * 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.
22503
22650
  */
22504
22651
  includeCrops: boolean().optional()
22505
22652
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -22535,13 +22682,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
22535
22682
  }), method(object({
22536
22683
  threshold: number$1().min(0).max(1).optional(),
22537
22684
  minClusterSize: number$1().int().min(2).optional(),
22538
- limit: number$1().int().positive().optional()
22539
- }).optional(), array(object({
22540
- faceIds: array(string()).readonly(),
22541
- representativeFaceId: string(),
22542
- size: number$1().int(),
22543
- cohesion: number$1()
22544
- })).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());
22545
22718
  /**
22546
22719
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
22547
22720
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -26264,6 +26437,293 @@ var SetSiteLocationInputSchema = object({
26264
26437
  latitude: number$1().min(-90).max(90),
26265
26438
  longitude: number$1().min(-180).max(180)
26266
26439
  }).nullable();
26440
+ /**
26441
+ * The TRANSPORT a call arrived on.
26442
+ *
26443
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
26444
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
26445
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
26446
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
26447
+ * checkable rather than asserted.
26448
+ *
26449
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
26450
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
26451
+ * connection; the viewer talks to the hub over `wsLink`
26452
+ * exclusively, so this is the plane the HTTP census could not see.
26453
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
26454
+ * never touches a socket and therefore never touched a census.
26455
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
26456
+ * that is exactly what its `0` asserts: every plane the hub has can name
26457
+ * itself. It is an output bucket, never a knob — a call that arrives on a
26458
+ * plane nobody instrumented lands here instead of vanishing from the total.
26459
+ */
26460
+ var TransportPlaneSchema = _enum([
26461
+ "http",
26462
+ "ws",
26463
+ "mesh",
26464
+ "unknown"
26465
+ ]);
26466
+ /**
26467
+ * Calls per plane. Every key is always present, `0` included — an absent plane
26468
+ * reads as "not instrumented", which is the one thing this census must never
26469
+ * make an operator wonder about.
26470
+ */
26471
+ var TransportPlaneCountsSchema = object({
26472
+ http: number$1(),
26473
+ ws: number$1(),
26474
+ mesh: number$1(),
26475
+ unknown: number$1()
26476
+ });
26477
+ /**
26478
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
26479
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26480
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26481
+ * already prints - never a token, never an `Authorization` header.
26482
+ *
26483
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
26484
+ * and lives for hours, so folding it into a call count makes one long-lived
26485
+ * stream look like a storm.
26486
+ */
26487
+ var RequestCensusGroupSchema = object({
26488
+ plane: TransportPlaneSchema,
26489
+ procedure: string(),
26490
+ userAgent: string(),
26491
+ ip: string(),
26492
+ principal: string(),
26493
+ calls: number$1(),
26494
+ subscriptions: number$1(),
26495
+ perMin: number$1()
26496
+ });
26497
+ /**
26498
+ * A procedure's TOTAL over the window, across every caller.
26499
+ *
26500
+ * This block, not the group list, is what answers "did these calls arrive over
26501
+ * HTTP at all". A total far BELOW what a store-side census counted over the
26502
+ * same window excludes the HTTP plane, which is a result, not a failure.
26503
+ */
26504
+ var RequestCensusProcedureSchema = object({
26505
+ procedure: string(),
26506
+ calls: number$1(),
26507
+ /**
26508
+ * The same total, split by transport. THIS is the row that answers the
26509
+ * question the census exists for: one look at `deviceManager.listAll` says
26510
+ * which plane carried the 4 960, without joining two log lines by eye.
26511
+ */
26512
+ planes: TransportPlaneCountsSchema,
26513
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
26514
+ subscriptions: number$1(),
26515
+ perMin: number$1()
26516
+ });
26517
+ /**
26518
+ * The census as an operator sees it.
26519
+ *
26520
+ * `persisted` is the honest answer to "will this survive the restart I am
26521
+ * about to do": the arm deadline is written to `system-settings` so a window
26522
+ * armed now can measure the NEXT boot, and a write that failed must not look
26523
+ * like one that succeeded.
26524
+ */
26525
+ var RequestCensusStatusSchema = object({
26526
+ armed: boolean(),
26527
+ /** How long the current - or just-closed - window collected, in ms. */
26528
+ elapsedMs: number$1(),
26529
+ /** The window actually armed, after the server clamped the request. */
26530
+ windowMs: number$1(),
26531
+ /** Epoch ms the window closes at. 0 when disarmed. */
26532
+ armedUntilMs: number$1(),
26533
+ httpRequests: number$1(),
26534
+ batchedRequests: number$1(),
26535
+ /**
26536
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
26537
+ * is in play (`?batch=1` carries several procedures in one request); this is
26538
+ * the number comparable with a store-side call count.
26539
+ */
26540
+ procedureCalls: number$1(),
26541
+ /**
26542
+ * `procedureCalls` split by transport. The four keys sum to
26543
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
26544
+ * `planesExplainTotal` is that identity, checked rather than assumed.
26545
+ */
26546
+ planes: TransportPlaneCountsSchema,
26547
+ /**
26548
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
26549
+ * on no plane at all - which is a RESULT (a plane is missing from the
26550
+ * instrument), not a failure, and it has to be visible to be read as one.
26551
+ */
26552
+ planesExplainTotal: boolean(),
26553
+ /**
26554
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
26555
+ * adapter resolves one context per connection - kept because a plane's call
26556
+ * count of zero against 37 open connections says something different from a
26557
+ * plane with no connections at all.
26558
+ */
26559
+ wsConnections: number$1(),
26560
+ /**
26561
+ * Client frames the WS plane looked at. `wsMessages` far above
26562
+ * `planes.ws + subscriptions` means most traffic is not operations
26563
+ * (keepalives, connection params) - which is itself an answer.
26564
+ */
26565
+ wsMessages: number$1(),
26566
+ /**
26567
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
26568
+ * purpose: one live-events stream opened at boot and held for six hours is
26569
+ * one subscription, and counting it as a call would let a quiet plane
26570
+ * masquerade as the storm.
26571
+ */
26572
+ subscriptions: number$1(),
26573
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
26574
+ subscriptionStops: number$1(),
26575
+ distinctGroups: number$1(),
26576
+ /**
26577
+ * Operations counted in the totals whose CALLER attribution was shed at the
26578
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
26579
+ * which transport they arrived on, they just lost their group row.
26580
+ */
26581
+ unattributedCalls: number$1(),
26582
+ procedures: array(RequestCensusProcedureSchema).readonly(),
26583
+ groups: array(RequestCensusGroupSchema).readonly()
26584
+ }).extend({ persisted: boolean() });
26585
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
26586
+ var LogLevelSchema$1 = _enum([
26587
+ "debug",
26588
+ "info",
26589
+ "warn",
26590
+ "error"
26591
+ ]);
26592
+ /**
26593
+ * The diagnostics that can be ARMED for a window. Exactly one today.
26594
+ *
26595
+ * A diagnostic is anything whose cost is only worth paying while a question is
26596
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
26597
+ */
26598
+ var DiagnosticIdSchema = _enum(["request-census"]);
26599
+ /**
26600
+ * The layers of the level hierarchy, general → specific. The most specific
26601
+ * layer that carries an explicit value wins.
26602
+ *
26603
+ * `component` is DECLARED and not yet resolvable: the per-component channels
26604
+ * are a later slice of the same plan, and a `levelSource` enum that has to
26605
+ * grow later would force every consumer of this document to change with it.
26606
+ * Nothing returns `component` today.
26607
+ */
26608
+ var LoggingScopeKindSchema = _enum([
26609
+ "cluster",
26610
+ "node",
26611
+ "component"
26612
+ ]);
26613
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
26614
+ var LoggingLevelSourceSchema = _enum([
26615
+ "default",
26616
+ "cluster",
26617
+ "node",
26618
+ "component"
26619
+ ]);
26620
+ /**
26621
+ * One layer of the hierarchy as it actually STANDS.
26622
+ *
26623
+ * `level: null` is the whole reason this array is returned: it is the
26624
+ * difference between "this node is at `info` because I decided it" and
26625
+ * "...because it inherits". An operator who clears an override believing they
26626
+ * are clearing an inherited value has been handed the same defect as the two
26627
+ * contradicting knobs this document exists to remove, moved one floor up.
26628
+ */
26629
+ var LoggingLevelLayerSchema = object({
26630
+ scope: LoggingScopeKindSchema,
26631
+ /** The node this layer speaks for; `null` on the cluster layer. */
26632
+ nodeId: string().nullable(),
26633
+ /** Explicitly set here, or `null` when this layer inherits. */
26634
+ level: LogLevelSchema$1.nullable()
26635
+ });
26636
+ /** What a line is judged against, and WHICH layer decided it. */
26637
+ var LoggingEffectiveSchema = object({
26638
+ level: LogLevelSchema$1,
26639
+ levelSource: LoggingLevelSourceSchema
26640
+ });
26641
+ /** Every layer, general → specific. Never collapsed into the effective value. */
26642
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
26643
+ /**
26644
+ * An armed diagnostic, with its DEADLINE.
26645
+ *
26646
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
26647
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
26648
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
26649
+ * `armed` is false — a window is never reported as slightly expired.
26650
+ */
26651
+ var DiagnosticWindowSchema = object({
26652
+ id: DiagnosticIdSchema,
26653
+ armed: boolean(),
26654
+ /** Epoch ms the window closes at. 0 when disarmed. */
26655
+ armedUntilMs: number$1(),
26656
+ /** Ms left before it expires on its own. 0 when disarmed. */
26657
+ remainingMs: number$1(),
26658
+ /** Whether the stored deadline is the one the live diagnostic is running —
26659
+ * i.e. whether this window would survive a restart. */
26660
+ persisted: boolean()
26661
+ });
26662
+ /**
26663
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
26664
+ * server — there is no maximum here on purpose: a bound repeated in a schema
26665
+ * is a second knob that disagrees with the first the day one of them moves.
26666
+ */
26667
+ var DiagnosticWindowPatchSchema = object({
26668
+ id: DiagnosticIdSchema,
26669
+ armMs: number$1().int().min(0),
26670
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
26671
+ reportEveryMs: number$1().int().positive().optional()
26672
+ });
26673
+ /**
26674
+ * A PATCH, and patches MERGE.
26675
+ *
26676
+ * A field absent from the patch is left exactly as it was — arming a
26677
+ * diagnostic never resets a level, and setting a level never disarms a window.
26678
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
26679
+ * `setAll` already merges, and rebuilding the object is how an absent field
26680
+ * turns into an erased one.
26681
+ */
26682
+ var LoggingSettingsPatchSchema = object({
26683
+ /**
26684
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
26685
+ * addressed scope so it inherits again. A value sets it.
26686
+ */
26687
+ level: LogLevelSchema$1.nullable().optional(),
26688
+ /**
26689
+ * Only the diagnostics NAMED here change. An armed window that is not listed
26690
+ * keeps running — a patch is never a full replacement.
26691
+ */
26692
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
26693
+ });
26694
+ /**
26695
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
26696
+ *
26697
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
26698
+ * input — the generated router strips it and uses it to resolve the PROVIDER
26699
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
26700
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
26701
+ * by an agent that holds no cluster document at all. The hub is the single
26702
+ * authority over the whole hierarchy and answers for every layer, so the
26703
+ * layer selector needs a name the transport does not already own.
26704
+ */
26705
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
26706
+ var SetLoggingSettingsInputSchema = object({
26707
+ scopeNodeId: string().optional(),
26708
+ patch: LoggingSettingsPatchSchema
26709
+ });
26710
+ /**
26711
+ * The whole document, as read and as returned after every write.
26712
+ *
26713
+ * `persisted: false` means the settings store could not be read or written.
26714
+ * The in-memory mirror still governs behaviour and is unchanged by the
26715
+ * failure — a read that fails neither switches a level nor disarms a window
26716
+ * (D49) — but the operator is told that what they are looking at would not
26717
+ * survive a restart.
26718
+ */
26719
+ var LoggingSettingsStateSchema = object({
26720
+ /** The layer this document was read at. `null` = the cluster layer. */
26721
+ scopeNodeId: string().nullable(),
26722
+ effective: LoggingEffectiveSchema,
26723
+ explicit: LoggingExplicitSchema,
26724
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
26725
+ persisted: boolean()
26726
+ });
26267
26727
  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(), {
26268
26728
  kind: "mutation",
26269
26729
  auth: "admin"
@@ -26276,6 +26736,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
26276
26736
  }), method(_void(), SiteLocationStatusSchema, {
26277
26737
  kind: "mutation",
26278
26738
  auth: "admin"
26739
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
26740
+ kind: "mutation",
26741
+ auth: "admin"
26279
26742
  });
26280
26743
  object({
26281
26744
  /** True when the device's tamper switch / case-open contact is
@@ -32107,6 +32570,18 @@ Object.freeze({
32107
32570
  addonId: null,
32108
32571
  access: "create"
32109
32572
  },
32573
+ "system.getLoggingSettings": {
32574
+ capName: "system",
32575
+ capScope: "system",
32576
+ addonId: null,
32577
+ access: "view"
32578
+ },
32579
+ "system.getRequestCensus": {
32580
+ capName: "system",
32581
+ capScope: "system",
32582
+ addonId: null,
32583
+ access: "view"
32584
+ },
32110
32585
  "system.getRetentionConfig": {
32111
32586
  capName: "system",
32112
32587
  capScope: "system",
@@ -32137,6 +32612,12 @@ Object.freeze({
32137
32612
  addonId: null,
32138
32613
  access: "view"
32139
32614
  },
32615
+ "system.setLoggingSettings": {
32616
+ capName: "system",
32617
+ capScope: "system",
32618
+ addonId: null,
32619
+ access: "create"
32620
+ },
32140
32621
  "system.setRetentionConfig": {
32141
32622
  capName: "system",
32142
32623
  capScope: "system",
@@ -33292,6 +33773,10 @@ Object.freeze({
33292
33773
  name: "deviceId",
33293
33774
  form: "single",
33294
33775
  optional: true
33776
+ }, {
33777
+ name: "deviceIds",
33778
+ form: "array",
33779
+ optional: true
33295
33780
  }],
33296
33781
  "fanControl.setDirection": [{
33297
33782
  name: "deviceId",
@@ -34902,7 +35387,38 @@ object({
34902
35387
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
34903
35388
  * reproduce that.
34904
35389
  */
34905
- tileBudgetMb: number$1().int().min(0).max(1024)
35390
+ tileBudgetMb: number$1().int().min(0).max(1024),
35391
+ /**
35392
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
35393
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
35394
+ * subject tiles, on frames that detected something.
35395
+ *
35396
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
35397
+ * containment is strict by design, so the native `keyFrame`, the detail
35398
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
35399
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
35400
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
35401
+ * frame-time after delivery, with the request only p50 367 ms behind it.
35402
+ *
35403
+ * Sizing, and why this is a budget and not a duration: a scene tile is
35404
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
35405
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
35406
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
35407
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
35408
+ * binds only through a detection burst, where it still covers well past the
35409
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
35410
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
35411
+ * whole shape exists to avoid.
35412
+ *
35413
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
35414
+ * subject tile, so one shared budget would let a busy camera's key frames
35415
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
35416
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
35417
+ * pre-existing behaviour, where a late full-frame request had nothing but the
35418
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
35419
+ * nothing.
35420
+ */
35421
+ sceneBudgetMb: number$1().int().min(0).max(1024)
34906
35422
  });
34907
35423
  /**
34908
35424
  * The values in force when the operator has set nothing.
@@ -34918,12 +35434,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
34918
35434
  budgetMb: 1024,
34919
35435
  activityMs: 15e3,
34920
35436
  tileBudgetMb: 64,
35437
+ sceneBudgetMb: 48,
34921
35438
  admission: "inferred"
34922
35439
  };
34923
35440
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
34924
35441
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
34925
35442
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
34926
35443
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
35444
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
34927
35445
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
34928
35446
  var MB = 1024 * 1024;
34929
35447
  1024 * MB, 3072 * MB;