@camstack/addon-pipeline 1.2.132 → 1.2.134

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 (36) hide show
  1. package/dist/{addon-utils-DzCn6z7v.js → addon-utils-Cg_Sl2UR.js} +1 -1
  2. package/dist/audio-analyzer/index.js +3 -3
  3. package/dist/audio-analyzer/index.mjs +2 -2
  4. package/dist/detection-pipeline/index.js +5 -5
  5. package/dist/detection-pipeline/index.mjs +3 -3
  6. package/dist/{dist-DBP47QOz.js → dist-BnwP1K09.js} +752 -64
  7. package/dist/{dist-BZYUUBUx.mjs → dist-Dsn9NGO3.mjs} +735 -65
  8. package/dist/{event-loop-stall-monitor-IACE22fK.mjs → event-loop-stall-monitor-CRdmHBpl.mjs} +1 -1
  9. package/dist/{event-loop-stall-monitor-CiH_MHfO.js → event-loop-stall-monitor-DRpAtCOy.js} +1 -1
  10. package/dist/{lazy-sharp-B_kETjyQ.js → lazy-sharp-Div0sK_l.js} +1 -1
  11. package/dist/motion-wasm/index.js +2 -2
  12. package/dist/motion-wasm/index.mjs +1 -1
  13. package/dist/pipeline-runner/index.js +4 -4
  14. package/dist/pipeline-runner/index.mjs +3 -3
  15. package/dist/{process-memory-C7rsraCR.mjs → process-memory-B-zF-wcr.mjs} +1 -1
  16. package/dist/{process-memory-CtXQAA3d.js → process-memory-C3Q8YXd_.js} +1 -1
  17. package/dist/recorder/index.js +446 -86
  18. package/dist/recorder/index.mjs +445 -85
  19. package/dist/{segment-demux-js-BL1UDdiI.mjs → segment-demux-js-BIyVwpSp.mjs} +1 -1
  20. package/dist/{segment-demux-js-wTzFi5UW.js → segment-demux-js-BOIExWSt.js} +1 -1
  21. package/dist/session-decode/decode-worker-child.js +195 -13
  22. package/dist/session-decode/decode-worker-child.mjs +194 -12
  23. package/dist/stream-broker/_stub.js +2 -2
  24. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-DlKJZ-_M.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-CASELLGa.mjs} +3 -3
  25. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BF-ziHjH.mjs +26 -0
  26. package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BUw_aTfK.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-77rGxv1J.mjs} +1 -1
  27. package/dist/stream-broker/demux-worker-child.js +1 -1
  28. package/dist/stream-broker/demux-worker-child.mjs +1 -1
  29. package/dist/stream-broker/{hostInit-kDKgfUjp.mjs → hostInit-BjhhoD3z.mjs} +3 -3
  30. package/dist/stream-broker/index.js +2 -2
  31. package/dist/stream-broker/index.mjs +2 -2
  32. package/dist/stream-broker/remoteEntry.js +1 -1
  33. package/dist/{worker-protocol-C3zaz0Jv.js → worker-protocol-Bo2fIjZ2.js} +12 -6
  34. package/dist/{worker-protocol-Cut8984B.mjs → worker-protocol-CaQCRtsw.mjs} +12 -6
  35. package/package.json +1 -1
  36. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DXKTNEae.mjs +0 -26
@@ -8471,6 +8471,74 @@ var OpsLogQueryInputSchema = object({
8471
8471
  /** Max rows returned, newest-first. */
8472
8472
  limit: number().int().min(1).max(1e3).optional()
8473
8473
  });
8474
+ var LabelDefinitionSchema = object({
8475
+ id: string(),
8476
+ name: string(),
8477
+ category: string().optional(),
8478
+ description: string().optional(),
8479
+ icon: string().optional()
8480
+ });
8481
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
8482
+ var CLASS_MAP_MACRO_TARGETS = [
8483
+ "person",
8484
+ "vehicle",
8485
+ "animal",
8486
+ "package"
8487
+ ];
8488
+ /**
8489
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
8490
+ * un operatore può selezionare.
8491
+ *
8492
+ * Sono le tre offerte dallo step `object-detection`
8493
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
8494
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
8495
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
8496
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
8497
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
8498
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
8499
+ *
8500
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
8501
+ * dello step e una seconda volta come union `FirstLevelMacro`
8502
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
8503
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
8504
+ * successiva.
8505
+ */
8506
+ var FIRST_LEVEL_MACRO_CLASSES = [
8507
+ "person",
8508
+ "vehicle",
8509
+ "animal"
8510
+ ];
8511
+ /**
8512
+ * True quando `value` è una macro di primo livello. Type guard, non cast: un
8513
+ * `className` che arriva dal bus è una stringa qualunque finché non passa di
8514
+ * qui.
8515
+ */
8516
+ function isFirstLevelMacroClass(value) {
8517
+ return FIRST_LEVEL_MACRO_CLASSES.some((macro) => macro === value);
8518
+ }
8519
+ /**
8520
+ * Wire schema for a per-model CATALOG classMap override
8521
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8522
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8523
+ * detection pipeline executor actually routes.
8524
+ *
8525
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8526
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8527
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8528
+ * enum) — the two used to share the name `ClassMapDefinition`/
8529
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8530
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8531
+ * are not: it is two different concepts colliding on a name. Keep this type
8532
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8533
+ * would either narrow every `ClassMapDefinition` consumer to the four
8534
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8535
+ * schema exists for (see the "rejects a classMap whose target is not a
8536
+ * detection macro" test in `model-catalog-schema.test.ts`).
8537
+ */
8538
+ var DetectionCatalogClassMapSchema = object({
8539
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
8540
+ preserveOriginal: boolean()
8541
+ });
8474
8542
  /**
8475
8543
  * THE canonical event-clip pad: the time window a single-timestamp analytics
8476
8544
  * event expands to when joined with footage (clip window = `[timestamp - preMs,
@@ -8512,10 +8580,55 @@ var RecordingStorageModeSchema = _enum([
8512
8580
  "events",
8513
8581
  "continuous"
8514
8582
  ]);
8583
+ /**
8584
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
8585
+ * tre offerte dallo step `object-detection`, da UNA lista
8586
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
8587
+ */
8588
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
8589
+ /**
8590
+ * True quando `values` non ripete un elemento.
8591
+ *
8592
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
8593
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
8594
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
8595
+ */
8596
+ var noDuplicates = (values) => new Set(values).size === values.length;
8515
8597
  /** Which detectors trigger an `events`-mode band. */
8516
8598
  var RecordingTriggersSchema = object({
8517
8599
  motion: boolean().optional(),
8518
- audioThresholdDbfs: number().optional()
8600
+ audioThresholdDbfs: number().optional(),
8601
+ /**
8602
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
8603
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
8604
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
8605
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
8606
+ *
8607
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
8608
+ * quelle che hanno attraversato `enabledMacroClasses`, i
8609
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
8610
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
8611
+ * finestre — vedi `recorder/object-trigger.ts`.
8612
+ */
8613
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
8614
+ /**
8615
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
8616
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
8617
+ * `objectClasses`.
8618
+ *
8619
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
8620
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
8621
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
8622
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
8623
+ * device (D12) — mai un elenco globale di cap.
8624
+ *
8625
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
8626
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
8627
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
8628
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
8629
+ * registrare.
8630
+ */
8631
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
8519
8632
  });
8520
8633
  /**
8521
8634
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -9041,41 +9154,6 @@ var DecoderSessionConfigSchema = object({
9041
9154
  */
9042
9155
  debug: boolean().optional()
9043
9156
  });
9044
- var LabelDefinitionSchema = object({
9045
- id: string(),
9046
- name: string(),
9047
- category: string().optional(),
9048
- description: string().optional(),
9049
- icon: string().optional()
9050
- });
9051
- /**
9052
- * Wire schema for a per-model CATALOG classMap override
9053
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
9054
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
9055
- * detection pipeline executor actually routes.
9056
- *
9057
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
9058
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
9059
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
9060
- * enum) — the two used to share the name `ClassMapDefinition`/
9061
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
9062
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
9063
- * are not: it is two different concepts colliding on a name. Keep this type
9064
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
9065
- * would either narrow every `ClassMapDefinition` consumer to the four
9066
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
9067
- * schema exists for (see the "rejects a classMap whose target is not a
9068
- * detection macro" test in `model-catalog-schema.test.ts`).
9069
- */
9070
- var DetectionCatalogClassMapSchema = object({
9071
- mapping: record(string(), _enum([
9072
- "person",
9073
- "vehicle",
9074
- "animal",
9075
- "package"
9076
- ])),
9077
- preserveOriginal: boolean()
9078
- });
9079
9157
  var MODEL_FORMATS = [
9080
9158
  "onnx",
9081
9159
  "coreml",
@@ -23096,7 +23174,7 @@ var lifecycleJobSchema = object({
23096
23174
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
23097
23175
  * as every other cap.
23098
23176
  */
23099
- var LogLevelSchema$1 = _enum([
23177
+ var LogLevelSchema$2 = _enum([
23100
23178
  "debug",
23101
23179
  "info",
23102
23180
  "warn",
@@ -23303,7 +23381,7 @@ var CustomActionInputSchema = object({
23303
23381
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
23304
23382
  addonId: string(),
23305
23383
  limit: number().min(1).max(500).default(100),
23306
- level: LogLevelSchema$1.optional()
23384
+ level: LogLevelSchema$2.optional()
23307
23385
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
23308
23386
  packageName: string(),
23309
23387
  version: string().optional()
@@ -23401,7 +23479,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
23401
23479
  auth: "admin"
23402
23480
  }), method(object({
23403
23481
  addonId: string(),
23404
- level: LogLevelSchema$1.optional()
23482
+ level: LogLevelSchema$2.optional()
23405
23483
  }), LogStreamEntrySchema, { kind: "subscription" });
23406
23484
  object({
23407
23485
  /** Carbon dioxide concentration in ppm. */
@@ -24462,6 +24540,35 @@ var FaceFilterEnum = _enum([
24462
24540
  "identified",
24463
24541
  "all"
24464
24542
  ]);
24543
+ /**
24544
+ * What a `listRecentFaces` page is ORDERED BY.
24545
+ *
24546
+ * - `timestamp` — when the face was seen. The historical (and default) order.
24547
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
24548
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
24549
+ * order: it puts the suggestions an operator can confirm with one tap at the
24550
+ * top, and it is the reason this enum exists — a client that ranked a capped
24551
+ * page client-side was ranking the newest N, never the most certain N.
24552
+ *
24553
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
24554
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
24555
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
24556
+ * — flipping the direction reorders the rows that HAVE a certainty and never
24557
+ * floods the page with the ones that do not. `addon-post-analysis`'s
24558
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
24559
+ * then by faceId, and is what makes this a total order instead of the
24560
+ * backend's NULL-collation accident.
24561
+ */
24562
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
24563
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
24564
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
24565
+ * never leaves the server. */
24566
+ var FaceClusterSchema = object({
24567
+ faceIds: array(string()).readonly(),
24568
+ representativeFaceId: string(),
24569
+ size: number().int(),
24570
+ cohesion: number()
24571
+ });
24465
24572
  var MediaFileLiteSchema$1 = object({
24466
24573
  key: string(),
24467
24574
  kind: string(),
@@ -24508,24 +24615,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24508
24615
  kind: "mutation",
24509
24616
  auth: "admin"
24510
24617
  }), method(object({
24511
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
24618
+ /**
24619
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
24620
+ *
24621
+ * The legacy single-camera form, kept verbatim for every caller that
24622
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
24623
+ * instead — never both: `deviceIds` is the authority whenever it is
24624
+ * present, and this field is then ignored rather than unioned, so
24625
+ * there is exactly one answer to "which cameras did I ask for".
24626
+ */
24512
24627
  deviceId: number().int().optional(),
24628
+ /**
24629
+ * Restrict to a SET of cameras — the review UI's camera filter, which
24630
+ * until now had to fetch the cluster-wide page and drop rows in the
24631
+ * client (so the `limit` it asked for was spent on cameras it was
24632
+ * about to discard).
24633
+ *
24634
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
24635
+ * "every camera". A request for no devices is a request, not an
24636
+ * omission; same contract as `deviceManager.listFleet` and
24637
+ * `pipelineAnalytics.listRecentTracks`.
24638
+ *
24639
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
24640
+ */
24641
+ deviceIds: array(number().int()).optional(),
24513
24642
  limit: number().int().positive().optional(),
24514
24643
  filter: FaceFilterEnum.optional(),
24515
24644
  /**
24516
- * Inline the base64 crop on every row. Default `true` — the existing
24517
- * behaviour, kept so no caller breaks.
24645
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24646
+ * Absent means no lower bound.
24647
+ */
24648
+ since: number().int().optional(),
24649
+ /**
24650
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24651
+ * Absent means no upper bound.
24652
+ */
24653
+ until: number().int().optional(),
24654
+ /**
24655
+ * Order the page by time or by suggestion certainty. Default
24656
+ * `'timestamp'` — the historical order, unchanged for every caller
24657
+ * that does not ask.
24518
24658
  *
24519
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
24520
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
24521
- * the browser cache the images.
24659
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
24660
+ * does under `'suggestionConfidence'`.
24522
24661
  *
24523
- * **This is an INPUT field, so it does not reach the addon until the
24524
- * next train.** The hub router validates cap inputs against its own
24525
- * compiled Zod, which strips a key it does not know verified today
24526
- * on the OUTPUT side, where an additive field DOES arrive immediately
24527
- * (`Track.hasFace`). Until the train ships, sending `false` is
24528
- * harmless and simply keeps the crops inline.
24662
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
24663
+ * index and stops reading as soon as `limit` rows have PASSED the
24664
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
24665
+ * certain row may be the oldest so it walks the window. Narrow it
24666
+ * with {@link since} / {@link until}.
24667
+ */
24668
+ sortBy: FaceSortFieldEnum.optional(),
24669
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
24670
+ sortDirection: FaceSortDirectionEnum.optional(),
24671
+ /**
24672
+ * Inline the base64 crop on every row.
24673
+ *
24674
+ * Default `false` since the 2026-08-25 inversion — see
24675
+ * `include-crops-default.ts`, which is the ONE place that resolves
24676
+ * this for every gallery, and which records why the inline shape had
24677
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
24678
+ * The doc here used to still say `true`; it was wrong, and a leftover
24679
+ * that describes the old design reads as permission to rely on it.
24680
+ *
24681
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
24682
+ * which the browser fetches off the `event-media` plane in parallel,
24683
+ * cached and ETagged.
24529
24684
  */
24530
24685
  includeCrops: boolean().optional()
24531
24686
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -24561,13 +24716,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24561
24716
  }), method(object({
24562
24717
  threshold: number().min(0).max(1).optional(),
24563
24718
  minClusterSize: number().int().min(2).optional(),
24564
- limit: number().int().positive().optional()
24565
- }).optional(), array(object({
24566
- faceIds: array(string()).readonly(),
24567
- representativeFaceId: string(),
24568
- size: number().int(),
24569
- cohesion: number()
24570
- })).readonly());
24719
+ /**
24720
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
24721
+ * which read as though it bounded the work — it never did.
24722
+ *
24723
+ * Wins over {@link limit} when both are sent.
24724
+ */
24725
+ maxClusters: number().int().positive().optional(),
24726
+ /**
24727
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
24728
+ * RESULT, not the scan. Kept so existing callers keep working; send
24729
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
24730
+ */
24731
+ limit: number().int().positive().optional(),
24732
+ /**
24733
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
24734
+ * POOL, not the result.
24735
+ *
24736
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
24737
+ * used to read every unassigned face on the hub no matter what the
24738
+ * caller asked for, because the only bound cut the finished clusters
24739
+ * afterwards; a UI showing a window of 100 paid for a scan of the
24740
+ * whole corpus, on an addon whose disk is under contention.
24741
+ *
24742
+ * The pool is the NEWEST matching faces first — the same order the
24743
+ * gallery shows — so a bound here shortens the horizon, it does not
24744
+ * sample it randomly.
24745
+ *
24746
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
24747
+ * so the live corpus — 372 face rows — is unaffected while the
24748
+ * unbounded scan can never come back as the table grows.
24749
+ */
24750
+ maxFacesScanned: number().int().positive().optional()
24751
+ }).optional(), array(FaceClusterSchema).readonly());
24571
24752
  /**
24572
24753
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
24573
24754
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -28449,6 +28630,293 @@ var SetSiteLocationInputSchema = object({
28449
28630
  latitude: number().min(-90).max(90),
28450
28631
  longitude: number().min(-180).max(180)
28451
28632
  }).nullable();
28633
+ /**
28634
+ * The TRANSPORT a call arrived on.
28635
+ *
28636
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28637
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28638
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28639
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28640
+ * checkable rather than asserted.
28641
+ *
28642
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28643
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28644
+ * connection; the viewer talks to the hub over `wsLink`
28645
+ * exclusively, so this is the plane the HTTP census could not see.
28646
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28647
+ * never touches a socket and therefore never touched a census.
28648
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28649
+ * that is exactly what its `0` asserts: every plane the hub has can name
28650
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28651
+ * plane nobody instrumented lands here instead of vanishing from the total.
28652
+ */
28653
+ var TransportPlaneSchema = _enum([
28654
+ "http",
28655
+ "ws",
28656
+ "mesh",
28657
+ "unknown"
28658
+ ]);
28659
+ /**
28660
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28661
+ * reads as "not instrumented", which is the one thing this census must never
28662
+ * make an operator wonder about.
28663
+ */
28664
+ var TransportPlaneCountsSchema = object({
28665
+ http: number(),
28666
+ ws: number(),
28667
+ mesh: number(),
28668
+ unknown: number()
28669
+ });
28670
+ /**
28671
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28672
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28673
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28674
+ * already prints - never a token, never an `Authorization` header.
28675
+ *
28676
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28677
+ * and lives for hours, so folding it into a call count makes one long-lived
28678
+ * stream look like a storm.
28679
+ */
28680
+ var RequestCensusGroupSchema = object({
28681
+ plane: TransportPlaneSchema,
28682
+ procedure: string(),
28683
+ userAgent: string(),
28684
+ ip: string(),
28685
+ principal: string(),
28686
+ calls: number(),
28687
+ subscriptions: number(),
28688
+ perMin: number()
28689
+ });
28690
+ /**
28691
+ * A procedure's TOTAL over the window, across every caller.
28692
+ *
28693
+ * This block, not the group list, is what answers "did these calls arrive over
28694
+ * HTTP at all". A total far BELOW what a store-side census counted over the
28695
+ * same window excludes the HTTP plane, which is a result, not a failure.
28696
+ */
28697
+ var RequestCensusProcedureSchema = object({
28698
+ procedure: string(),
28699
+ calls: number(),
28700
+ /**
28701
+ * The same total, split by transport. THIS is the row that answers the
28702
+ * question the census exists for: one look at `deviceManager.listAll` says
28703
+ * which plane carried the 4 960, without joining two log lines by eye.
28704
+ */
28705
+ planes: TransportPlaneCountsSchema,
28706
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28707
+ subscriptions: number(),
28708
+ perMin: number()
28709
+ });
28710
+ /**
28711
+ * The census as an operator sees it.
28712
+ *
28713
+ * `persisted` is the honest answer to "will this survive the restart I am
28714
+ * about to do": the arm deadline is written to `system-settings` so a window
28715
+ * armed now can measure the NEXT boot, and a write that failed must not look
28716
+ * like one that succeeded.
28717
+ */
28718
+ var RequestCensusStatusSchema = object({
28719
+ armed: boolean(),
28720
+ /** How long the current - or just-closed - window collected, in ms. */
28721
+ elapsedMs: number(),
28722
+ /** The window actually armed, after the server clamped the request. */
28723
+ windowMs: number(),
28724
+ /** Epoch ms the window closes at. 0 when disarmed. */
28725
+ armedUntilMs: number(),
28726
+ httpRequests: number(),
28727
+ batchedRequests: number(),
28728
+ /**
28729
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
28730
+ * is in play (`?batch=1` carries several procedures in one request); this is
28731
+ * the number comparable with a store-side call count.
28732
+ */
28733
+ procedureCalls: number(),
28734
+ /**
28735
+ * `procedureCalls` split by transport. The four keys sum to
28736
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28737
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28738
+ */
28739
+ planes: TransportPlaneCountsSchema,
28740
+ /**
28741
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28742
+ * on no plane at all - which is a RESULT (a plane is missing from the
28743
+ * instrument), not a failure, and it has to be visible to be read as one.
28744
+ */
28745
+ planesExplainTotal: boolean(),
28746
+ /**
28747
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
28748
+ * adapter resolves one context per connection - kept because a plane's call
28749
+ * count of zero against 37 open connections says something different from a
28750
+ * plane with no connections at all.
28751
+ */
28752
+ wsConnections: number(),
28753
+ /**
28754
+ * Client frames the WS plane looked at. `wsMessages` far above
28755
+ * `planes.ws + subscriptions` means most traffic is not operations
28756
+ * (keepalives, connection params) - which is itself an answer.
28757
+ */
28758
+ wsMessages: number(),
28759
+ /**
28760
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28761
+ * purpose: one live-events stream opened at boot and held for six hours is
28762
+ * one subscription, and counting it as a call would let a quiet plane
28763
+ * masquerade as the storm.
28764
+ */
28765
+ subscriptions: number(),
28766
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28767
+ subscriptionStops: number(),
28768
+ distinctGroups: number(),
28769
+ /**
28770
+ * Operations counted in the totals whose CALLER attribution was shed at the
28771
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28772
+ * which transport they arrived on, they just lost their group row.
28773
+ */
28774
+ unattributedCalls: number(),
28775
+ procedures: array(RequestCensusProcedureSchema).readonly(),
28776
+ groups: array(RequestCensusGroupSchema).readonly()
28777
+ }).extend({ persisted: boolean() });
28778
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
28779
+ var LogLevelSchema$1 = _enum([
28780
+ "debug",
28781
+ "info",
28782
+ "warn",
28783
+ "error"
28784
+ ]);
28785
+ /**
28786
+ * The diagnostics that can be ARMED for a window. Exactly one today.
28787
+ *
28788
+ * A diagnostic is anything whose cost is only worth paying while a question is
28789
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
28790
+ */
28791
+ var DiagnosticIdSchema = _enum(["request-census"]);
28792
+ /**
28793
+ * The layers of the level hierarchy, general → specific. The most specific
28794
+ * layer that carries an explicit value wins.
28795
+ *
28796
+ * `component` is DECLARED and not yet resolvable: the per-component channels
28797
+ * are a later slice of the same plan, and a `levelSource` enum that has to
28798
+ * grow later would force every consumer of this document to change with it.
28799
+ * Nothing returns `component` today.
28800
+ */
28801
+ var LoggingScopeKindSchema = _enum([
28802
+ "cluster",
28803
+ "node",
28804
+ "component"
28805
+ ]);
28806
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
28807
+ var LoggingLevelSourceSchema = _enum([
28808
+ "default",
28809
+ "cluster",
28810
+ "node",
28811
+ "component"
28812
+ ]);
28813
+ /**
28814
+ * One layer of the hierarchy as it actually STANDS.
28815
+ *
28816
+ * `level: null` is the whole reason this array is returned: it is the
28817
+ * difference between "this node is at `info` because I decided it" and
28818
+ * "...because it inherits". An operator who clears an override believing they
28819
+ * are clearing an inherited value has been handed the same defect as the two
28820
+ * contradicting knobs this document exists to remove, moved one floor up.
28821
+ */
28822
+ var LoggingLevelLayerSchema = object({
28823
+ scope: LoggingScopeKindSchema,
28824
+ /** The node this layer speaks for; `null` on the cluster layer. */
28825
+ nodeId: string().nullable(),
28826
+ /** Explicitly set here, or `null` when this layer inherits. */
28827
+ level: LogLevelSchema$1.nullable()
28828
+ });
28829
+ /** What a line is judged against, and WHICH layer decided it. */
28830
+ var LoggingEffectiveSchema = object({
28831
+ level: LogLevelSchema$1,
28832
+ levelSource: LoggingLevelSourceSchema
28833
+ });
28834
+ /** Every layer, general → specific. Never collapsed into the effective value. */
28835
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
28836
+ /**
28837
+ * An armed diagnostic, with its DEADLINE.
28838
+ *
28839
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
28840
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
28841
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
28842
+ * `armed` is false — a window is never reported as slightly expired.
28843
+ */
28844
+ var DiagnosticWindowSchema = object({
28845
+ id: DiagnosticIdSchema,
28846
+ armed: boolean(),
28847
+ /** Epoch ms the window closes at. 0 when disarmed. */
28848
+ armedUntilMs: number(),
28849
+ /** Ms left before it expires on its own. 0 when disarmed. */
28850
+ remainingMs: number(),
28851
+ /** Whether the stored deadline is the one the live diagnostic is running —
28852
+ * i.e. whether this window would survive a restart. */
28853
+ persisted: boolean()
28854
+ });
28855
+ /**
28856
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
28857
+ * server — there is no maximum here on purpose: a bound repeated in a schema
28858
+ * is a second knob that disagrees with the first the day one of them moves.
28859
+ */
28860
+ var DiagnosticWindowPatchSchema = object({
28861
+ id: DiagnosticIdSchema,
28862
+ armMs: number().int().min(0),
28863
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
28864
+ reportEveryMs: number().int().positive().optional()
28865
+ });
28866
+ /**
28867
+ * A PATCH, and patches MERGE.
28868
+ *
28869
+ * A field absent from the patch is left exactly as it was — arming a
28870
+ * diagnostic never resets a level, and setting a level never disarms a window.
28871
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
28872
+ * `setAll` already merges, and rebuilding the object is how an absent field
28873
+ * turns into an erased one.
28874
+ */
28875
+ var LoggingSettingsPatchSchema = object({
28876
+ /**
28877
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
28878
+ * addressed scope so it inherits again. A value sets it.
28879
+ */
28880
+ level: LogLevelSchema$1.nullable().optional(),
28881
+ /**
28882
+ * Only the diagnostics NAMED here change. An armed window that is not listed
28883
+ * keeps running — a patch is never a full replacement.
28884
+ */
28885
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28886
+ });
28887
+ /**
28888
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
28889
+ *
28890
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
28891
+ * input — the generated router strips it and uses it to resolve the PROVIDER
28892
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
28893
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
28894
+ * by an agent that holds no cluster document at all. The hub is the single
28895
+ * authority over the whole hierarchy and answers for every layer, so the
28896
+ * layer selector needs a name the transport does not already own.
28897
+ */
28898
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
28899
+ var SetLoggingSettingsInputSchema = object({
28900
+ scopeNodeId: string().optional(),
28901
+ patch: LoggingSettingsPatchSchema
28902
+ });
28903
+ /**
28904
+ * The whole document, as read and as returned after every write.
28905
+ *
28906
+ * `persisted: false` means the settings store could not be read or written.
28907
+ * The in-memory mirror still governs behaviour and is unchanged by the
28908
+ * failure — a read that fails neither switches a level nor disarms a window
28909
+ * (D49) — but the operator is told that what they are looking at would not
28910
+ * survive a restart.
28911
+ */
28912
+ var LoggingSettingsStateSchema = object({
28913
+ /** The layer this document was read at. `null` = the cluster layer. */
28914
+ scopeNodeId: string().nullable(),
28915
+ effective: LoggingEffectiveSchema,
28916
+ explicit: LoggingExplicitSchema,
28917
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
28918
+ persisted: boolean()
28919
+ });
28452
28920
  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(), {
28453
28921
  kind: "mutation",
28454
28922
  auth: "admin"
@@ -28461,6 +28929,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28461
28929
  }), method(_void(), SiteLocationStatusSchema, {
28462
28930
  kind: "mutation",
28463
28931
  auth: "admin"
28932
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
28933
+ kind: "mutation",
28934
+ auth: "admin"
28464
28935
  });
28465
28936
  object({
28466
28937
  /** True when the device's tamper switch / case-open contact is
@@ -29089,6 +29560,146 @@ DeviceType.Camera, method(object({
29089
29560
  detection: array(ZoneRuleSchema).readonly(),
29090
29561
  package: array(ZoneRuleSchema).readonly()
29091
29562
  });
29563
+ /**
29564
+ * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
29565
+ * valutatore puro del suo FRONTE.
29566
+ *
29567
+ * Viveva dentro il builtin virtual-doorbell
29568
+ * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
29569
+ * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
29570
+ * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
29571
+ * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
29572
+ * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
29573
+ * SPOSTA qui e il doorbell la ri-esporta.
29574
+ *
29575
+ * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
29576
+ * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
29577
+ * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
29578
+ * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
29579
+ */
29580
+ /**
29581
+ * Known binary / switch source caps → the boolean slice field whose
29582
+ * false→true rise counts as ACTIVE. Every entry is "fire on active".
29583
+ * Sensors whose "active" reading is not a plain boolean (presence's string
29584
+ * state, connectivity's connected flag) are deliberately excluded — a
29585
+ * reconnect is not a doorbell press, and it is not a recording either.
29586
+ */
29587
+ var SOURCE_CAP_ACTIVE_FIELD = {
29588
+ contact: "entryOpen",
29589
+ binary: "on",
29590
+ switch: "on",
29591
+ motion: "detected",
29592
+ flood: "flooded",
29593
+ gas: "detected",
29594
+ smoke: "detected",
29595
+ "carbon-monoxide": "detected",
29596
+ vibration: "detected",
29597
+ tamper: "tampered"
29598
+ };
29599
+ /**
29600
+ * The same caps → the slice field carrying the ms-epoch timestamp of the
29601
+ * last transition. Every source cap MUST appear here (guarded by a spec):
29602
+ * without a transition timestamp the evaluator cannot tell a genuine rise
29603
+ * from a boot-time hydration when the FIRST slice it ever sees is already
29604
+ * active, and errs towards silence — swallowing the rise.
29605
+ *
29606
+ * These timestamps are UPSTREAM ones, not ingest ones: the Home Assistant
29607
+ * provider derives them from `state.last_changed`, so they survive our own
29608
+ * restarts and correctly read as "hours ago" for a state that has been
29609
+ * active for hours. `motion` names its rise timestamp `lastDetectedAt`.
29610
+ */
29611
+ var SOURCE_CAP_CHANGED_AT_FIELD = {
29612
+ contact: "lastChangedAt",
29613
+ binary: "lastChangedAt",
29614
+ switch: "lastChangedAt",
29615
+ motion: "lastDetectedAt",
29616
+ flood: "lastChangedAt",
29617
+ gas: "lastChangedAt",
29618
+ smoke: "lastChangedAt",
29619
+ "carbon-monoxide": "lastChangedAt",
29620
+ vibration: "lastChangedAt",
29621
+ tamper: "lastChangedAt"
29622
+ };
29623
+ /** True when a cap is a recognised binary/switch source. */
29624
+ function isSourceCap(capName) {
29625
+ return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
29626
+ }
29627
+ /** Extract the "active" boolean a source cap's slice carries, or null when
29628
+ * the cap is unknown or the field is missing / non-boolean. */
29629
+ function sliceActiveValue(capName, slice) {
29630
+ const field = SOURCE_CAP_ACTIVE_FIELD[capName];
29631
+ if (field === void 0) return null;
29632
+ const raw = slice[field];
29633
+ return typeof raw === "boolean" ? raw : null;
29634
+ }
29635
+ /** Ms-epoch transition timestamp a source cap's slice carries, or null when
29636
+ * it is absent, non-numeric or the zero "never observed" sentinel. */
29637
+ function sliceChangedAt(capName, slice) {
29638
+ const field = SOURCE_CAP_CHANGED_AT_FIELD[capName];
29639
+ if (field === void 0) return null;
29640
+ const raw = slice[field];
29641
+ if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return null;
29642
+ return raw;
29643
+ }
29644
+ /**
29645
+ * How recent a source's own transition timestamp must be for a FIRST
29646
+ * sighting that is already active to count as a genuine rise rather than a
29647
+ * hydration of long-standing state.
29648
+ */
29649
+ var DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = 3e4;
29650
+ /**
29651
+ * IL fronte. Puro: nessun orologio proprio, nessuna memoria — il chiamante
29652
+ * porta `prior`, `nowMs` e il proprio `startedAtMs`.
29653
+ *
29654
+ * Il caso della PRIMA slice già attiva è trattato esplicitamente e vale come
29655
+ * fronte solo se il timestamp UPSTREAM della transizione è posteriore a
29656
+ * `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
29657
+ * servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
29658
+ * stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
29659
+ * iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
29660
+ * adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
29661
+ * SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
29662
+ */
29663
+ function evaluateSensorEdge(input) {
29664
+ const value = sliceActiveValue(input.capName, input.slice);
29665
+ if (value === null) return {
29666
+ edge: "none",
29667
+ value: null,
29668
+ reason: isSourceCap(input.capName) ? "non-boolean-value" : "unknown-cap"
29669
+ };
29670
+ if (input.prior === void 0) {
29671
+ if (!value) return {
29672
+ edge: "none",
29673
+ value,
29674
+ reason: "baseline-seeded-inactive"
29675
+ };
29676
+ const changedAt = sliceChangedAt(input.capName, input.slice);
29677
+ const floor = Math.max(input.startedAtMs, input.nowMs - input.firstSightingFreshnessMs);
29678
+ if (changedAt === null || changedAt < floor) return {
29679
+ edge: "none",
29680
+ value,
29681
+ reason: "baseline-seeded-stale-active"
29682
+ };
29683
+ return {
29684
+ edge: "rising",
29685
+ value: true
29686
+ };
29687
+ }
29688
+ if (input.prior === value) return {
29689
+ edge: "none",
29690
+ value,
29691
+ reason: "no-change"
29692
+ };
29693
+ if (!value) return {
29694
+ edge: "none",
29695
+ value,
29696
+ reason: "falling-edge"
29697
+ };
29698
+ return {
29699
+ edge: "rising",
29700
+ value: true
29701
+ };
29702
+ }
29092
29703
  var HF_BASE_URL = `https://huggingface.co/camstack/camstack-models/resolve/main`;
29093
29704
  /**
29094
29705
  * Accessory device helpers — shared across drivers.
@@ -29129,9 +29740,6 @@ var AccessoryKind = {
29129
29740
  PrivacyMask: DeviceRole.PrivacyMask
29130
29741
  };
29131
29742
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
29132
- DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
29133
- new Set(Object.values(DeviceType));
29134
- DeviceFeature.BatteryOperated;
29135
29743
  /**
29136
29744
  * THE derivation. One crop rectangle, one presence verdict — see D52 for why
29137
29745
  * this repo insists a derived value has exactly one implementation.
@@ -29150,6 +29758,9 @@ function deriveBatteryPresence(input) {
29150
29758
  const budget = input.unreachableAfterMs ?? 216e5;
29151
29759
  return input.nowMs - lastContactAt > budget ? "unreachable" : "sleeping";
29152
29760
  }
29761
+ DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
29762
+ new Set(Object.values(DeviceType));
29763
+ DeviceFeature.BatteryOperated;
29153
29764
  Object.freeze({
29154
29765
  "accessories.setChildHidden": {
29155
29766
  capName: "accessories",
@@ -34311,6 +34922,18 @@ Object.freeze({
34311
34922
  addonId: null,
34312
34923
  access: "create"
34313
34924
  },
34925
+ "system.getLoggingSettings": {
34926
+ capName: "system",
34927
+ capScope: "system",
34928
+ addonId: null,
34929
+ access: "view"
34930
+ },
34931
+ "system.getRequestCensus": {
34932
+ capName: "system",
34933
+ capScope: "system",
34934
+ addonId: null,
34935
+ access: "view"
34936
+ },
34314
34937
  "system.getRetentionConfig": {
34315
34938
  capName: "system",
34316
34939
  capScope: "system",
@@ -34341,6 +34964,12 @@ Object.freeze({
34341
34964
  addonId: null,
34342
34965
  access: "view"
34343
34966
  },
34967
+ "system.setLoggingSettings": {
34968
+ capName: "system",
34969
+ capScope: "system",
34970
+ addonId: null,
34971
+ access: "create"
34972
+ },
34344
34973
  "system.setRetentionConfig": {
34345
34974
  capName: "system",
34346
34975
  capScope: "system",
@@ -35496,6 +36125,10 @@ Object.freeze({
35496
36125
  name: "deviceId",
35497
36126
  form: "single",
35498
36127
  optional: true
36128
+ }, {
36129
+ name: "deviceIds",
36130
+ form: "array",
36131
+ optional: true
35499
36132
  }],
35500
36133
  "fanControl.setDirection": [{
35501
36134
  name: "deviceId",
@@ -37326,6 +37959,7 @@ var NATIVE_LEASE_BUDGET_KEY = "nativeLeaseBudgetMb";
37326
37959
  var NATIVE_LEASE_ACTIVITY_KEY = "nativeLeaseActivityMs";
37327
37960
  var NATIVE_LEASE_ADMISSION_KEY = "nativeLeaseAdmission";
37328
37961
  var NATIVE_LEASE_TILE_BUDGET_KEY = "nativeTileBudgetMb";
37962
+ var NATIVE_LEASE_SCENE_BUDGET_KEY = "nativeSceneBudgetMb";
37329
37963
  /**
37330
37964
  * WHICH delivered frames the decode worker retains a native copy of.
37331
37965
  *
@@ -37420,7 +38054,38 @@ var NativeLeaseSettingsSchema = object({
37420
38054
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
37421
38055
  * reproduce that.
37422
38056
  */
37423
- tileBudgetMb: number().int().min(0).max(1024)
38057
+ tileBudgetMb: number().int().min(0).max(1024),
38058
+ /**
38059
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
38060
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
38061
+ * subject tiles, on frames that detected something.
38062
+ *
38063
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
38064
+ * containment is strict by design, so the native `keyFrame`, the detail
38065
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
38066
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
38067
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
38068
+ * frame-time after delivery, with the request only p50 367 ms behind it.
38069
+ *
38070
+ * Sizing, and why this is a budget and not a duration: a scene tile is
38071
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
38072
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
38073
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
38074
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
38075
+ * binds only through a detection burst, where it still covers well past the
38076
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
38077
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
38078
+ * whole shape exists to avoid.
38079
+ *
38080
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
38081
+ * subject tile, so one shared budget would let a busy camera's key frames
38082
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
38083
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
38084
+ * pre-existing behaviour, where a late full-frame request had nothing but the
38085
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
38086
+ * nothing.
38087
+ */
38088
+ sceneBudgetMb: number().int().min(0).max(1024)
37424
38089
  });
37425
38090
  /**
37426
38091
  * The values in force when the operator has set nothing.
@@ -37436,12 +38101,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
37436
38101
  budgetMb: 1024,
37437
38102
  activityMs: 15e3,
37438
38103
  tileBudgetMb: 64,
38104
+ sceneBudgetMb: 48,
37439
38105
  admission: "inferred"
37440
38106
  };
37441
38107
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
37442
38108
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37443
38109
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37444
38110
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
38111
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
37445
38112
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37446
38113
  /**
37447
38114
  * Parse one knob, reporting `null` for absent, junk, out-of-bounds — AND for a
@@ -37490,12 +38157,14 @@ function readNativeLeaseOverride(config) {
37490
38157
  const activityMs = readKnob("activityMs", config[NATIVE_LEASE_ACTIVITY_KEY]);
37491
38158
  const admission = readAdmissionKnob(config[NATIVE_LEASE_ADMISSION_KEY]);
37492
38159
  const tileBudgetMb = readKnob("tileBudgetMb", config[NATIVE_LEASE_TILE_BUDGET_KEY]);
38160
+ const sceneBudgetMb = readKnob("sceneBudgetMb", config[NATIVE_LEASE_SCENE_BUDGET_KEY]);
37493
38161
  return {
37494
38162
  ...holdFrames === null ? {} : { holdFrames },
37495
38163
  ...budgetMb === null ? {} : { budgetMb },
37496
38164
  ...activityMs === null ? {} : { activityMs },
37497
38165
  ...admission === null ? {} : { admission },
37498
- ...tileBudgetMb === null ? {} : { tileBudgetMb }
38166
+ ...tileBudgetMb === null ? {} : { tileBudgetMb },
38167
+ ...sceneBudgetMb === null ? {} : { sceneBudgetMb }
37499
38168
  };
37500
38169
  }
37501
38170
  function isHydratedField(entry) {
@@ -37506,7 +38175,8 @@ var LEASE_KEYS = [
37506
38175
  NATIVE_LEASE_BUDGET_KEY,
37507
38176
  NATIVE_LEASE_ACTIVITY_KEY,
37508
38177
  NATIVE_LEASE_ADMISSION_KEY,
37509
- NATIVE_LEASE_TILE_BUDGET_KEY
38178
+ NATIVE_LEASE_TILE_BUDGET_KEY,
38179
+ NATIVE_LEASE_SCENE_BUDGET_KEY
37510
38180
  ];
37511
38181
  /**
37512
38182
  * Extract the operator's lease overrides from an
@@ -38228,4 +38898,4 @@ function enumerateInferenceDevices(hw) {
38228
38898
  return out;
38229
38899
  }
38230
38900
  //#endregion
38231
- export { pickClusterStepModels as $, audioAnalyzerCapability as A, makeSourceBrokerId as At, deriveRecordingMode as B, lazy as Bt, RATE_CONTROL_TIGHT as C, CAM_PROFILE_ORDER as Ct, YAMNET_TO_MACRO as D, hydrateSchema as Dt, RingBuffer as E, createEvent as Et, customAction as F, sleep as Ft, evaluateZoneRules as G, string as Gt, egressTranscodeSharingKey as H, number as Ht, defaultDeviceFor as I, _enum as It, mapAudioLabelToMacro as J, hfModelUrl as K, union as Kt, defineCustomActions as L, array as Lt, batteryCapability as M, parseJsonUnknown as Mt, cameraStreamsCapability as N, parseProfileBrokerId as Nt, addonWidgetsSourceCapability as O, isEvent as Ot, createHwAccelCache as P, selectAssignedProfileSlots as Pt, parseProcStatus as Q, deriveBatteryPresence as R, boolean as Rt, RATE_CONTROL_RELAXED as S, BaseAddon as St, RecordingConfigSchema as T, DeviceType as Tt, egressTransportFromRequest as U, object as Ut, detectionPipelineCapability as V, literal as Vt, enumerateInferenceDevices as W, record as Wt, motionDetectionCapability as X, maskUrlCredentials as Y, overlayClusterStepSettings as Z, HF_BASE_URL as _, AUDIO_PRESETS as _t, COCO_80_LABELS as a, recordingCapability as at, OpsLogEntrySchema as b, invocationFromEncodeProfile as bt, DEFAULT_CLUSTER_STEP_MODELS as c, resolveEgressDecodeHwAccel as ct, DEFAULT_EVENTS_BAND_BUFFER_SEC as d, runtimeDevices as dt, pickClusterStepSettings as et, DEFAULT_NATIVE_LEASE_SETTINGS as f, storageEvictableCapability as ft, ExportRecordSchema as g, errMsg as gt, EncodeProfileSchema as h, webrtcSessionCapability as ht, BatteryStatusSchema as i, pipelineRunnerCapability as it, audioKindId as j, nodePin as jt, audioAnalysisCapability as k, makeProfileBrokerId as kt, DEFAULT_CLUSTER_STEP_SETTINGS as l, resolvePoolMemoryPolicy as lt, EVENT_PAD_MS as m, supportedRuntimes as mt, AUDIO_BACKEND_CHOICES as n, pickNativeLeaseOverride as nt, COCO_TO_MACRO as o, recordingExportCapability as ot, DEVICE_BACKEND_TO_FORMAT as p, streamBrokerCapability as pt, inferModelProvider as q, EventCategory as qt, AUDIO_MACRO_LABELS as r, pipelineExecutorCapability as rt, DEFAULT_AUDIO_ANALYZER_CONFIG as s, resolveClusterStepModelId as st, APPLE_SA_TO_MACRO as t, pickDetailCropConvention as tt, DEFAULT_DETAIL_CROP_CONVENTION as u, resolveRecordingProfiles as ut, NativeLeaseAdmissionSchema as v, Fmp4BoxSplitter as vt, RECORDING_EXPORT_MAX_READ_BYTES as w, DeviceFeature as wt, PoolMemoryWatchdog as x, isSoftwareDecode as xt, NativeLeaseSettingsSchema as y, buildFfmpegArgs as yt, deriveDetailCropRect as z, discriminatedUnion as zt };
38901
+ export { motionDetectionCapability as $, audioAnalysisCapability as A, hydrateSchema as At, deriveDetailCropRect as B, array as Bt, RATE_CONTROL_RELAXED as C, invocationFromEncodeProfile as Ct, RingBuffer as D, DeviceFeature as Dt, RecordingConfigSchema as E, CAM_PROFILE_ORDER as Et, createHwAccelCache as F, parseJsonUnknown as Ft, enumerateInferenceDevices as G, number as Gt, detectionPipelineCapability as H, discriminatedUnion as Ht, customAction as I, parseProfileBrokerId as It, hfModelUrl as J, string as Jt, evaluateSensorEdge as K, object as Kt, defaultDeviceFor as L, selectAssignedProfileSlots as Lt, audioKindId as M, makeProfileBrokerId as Mt, batteryCapability as N, makeSourceBrokerId as Nt, YAMNET_TO_MACRO as O, DeviceType as Ot, cameraStreamsCapability as P, nodePin as Pt, maskUrlCredentials as Q, defineCustomActions as R, sleep as Rt, PoolMemoryWatchdog as S, buildFfmpegArgs as St, RECORDING_EXPORT_MAX_READ_BYTES as T, BaseAddon as Tt, egressTranscodeSharingKey as U, lazy as Ut, deriveRecordingMode as V, boolean as Vt, egressTransportFromRequest as W, literal as Wt, isFirstLevelMacroClass as X, EventCategory as Xt, inferModelProvider as Y, union as Yt, mapAudioLabelToMacro as Z, ExportRecordSchema as _, supportedRuntimes as _t, COCO_80_LABELS as a, pickNativeLeaseOverride as at, NativeLeaseSettingsSchema as b, AUDIO_PRESETS as bt, DEFAULT_CLUSTER_STEP_MODELS as c, recordingCapability as ct, DEFAULT_EVENTS_BAND_BUFFER_SEC as d, resolveEgressDecodeHwAccel as dt, overlayClusterStepSettings as et, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS as f, resolvePoolMemoryPolicy as ft, EncodeProfileSchema as g, streamBrokerCapability as gt, EVENT_PAD_MS as h, storageEvictableCapability as ht, BatteryStatusSchema as i, pickDetailCropConvention as it, audioAnalyzerCapability as j, isEvent as jt, addonWidgetsSourceCapability as k, createEvent as kt, DEFAULT_CLUSTER_STEP_SETTINGS as l, recordingExportCapability as lt, DEVICE_BACKEND_TO_FORMAT as m, runtimeDevices as mt, AUDIO_BACKEND_CHOICES as n, pickClusterStepModels as nt, COCO_TO_MACRO as o, pipelineExecutorCapability as ot, DEFAULT_NATIVE_LEASE_SETTINGS as p, resolveRecordingProfiles as pt, evaluateZoneRules as q, record as qt, AUDIO_MACRO_LABELS as r, pickClusterStepSettings as rt, DEFAULT_AUDIO_ANALYZER_CONFIG as s, pipelineRunnerCapability as st, APPLE_SA_TO_MACRO as t, parseProcStatus as tt, DEFAULT_DETAIL_CROP_CONVENTION as u, resolveClusterStepModelId as ut, HF_BASE_URL as v, webrtcSessionCapability as vt, RATE_CONTROL_TIGHT as w, isSoftwareDecode as wt, OpsLogEntrySchema as x, Fmp4BoxSplitter as xt, NativeLeaseAdmissionSchema as y, errMsg as yt, deriveBatteryPresence as z, _enum as zt };