@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
@@ -8494,6 +8494,74 @@ var OpsLogQueryInputSchema = object({
8494
8494
  /** Max rows returned, newest-first. */
8495
8495
  limit: number().int().min(1).max(1e3).optional()
8496
8496
  });
8497
+ var LabelDefinitionSchema = object({
8498
+ id: string(),
8499
+ name: string(),
8500
+ category: string().optional(),
8501
+ description: string().optional(),
8502
+ icon: string().optional()
8503
+ });
8504
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
8505
+ var CLASS_MAP_MACRO_TARGETS = [
8506
+ "person",
8507
+ "vehicle",
8508
+ "animal",
8509
+ "package"
8510
+ ];
8511
+ /**
8512
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
8513
+ * un operatore può selezionare.
8514
+ *
8515
+ * Sono le tre offerte dallo step `object-detection`
8516
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
8517
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
8518
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
8519
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
8520
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
8521
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
8522
+ *
8523
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
8524
+ * dello step e una seconda volta come union `FirstLevelMacro`
8525
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
8526
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
8527
+ * successiva.
8528
+ */
8529
+ var FIRST_LEVEL_MACRO_CLASSES = [
8530
+ "person",
8531
+ "vehicle",
8532
+ "animal"
8533
+ ];
8534
+ /**
8535
+ * True quando `value` è una macro di primo livello. Type guard, non cast: un
8536
+ * `className` che arriva dal bus è una stringa qualunque finché non passa di
8537
+ * qui.
8538
+ */
8539
+ function isFirstLevelMacroClass(value) {
8540
+ return FIRST_LEVEL_MACRO_CLASSES.some((macro) => macro === value);
8541
+ }
8542
+ /**
8543
+ * Wire schema for a per-model CATALOG classMap override
8544
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8545
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8546
+ * detection pipeline executor actually routes.
8547
+ *
8548
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8549
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8550
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8551
+ * enum) — the two used to share the name `ClassMapDefinition`/
8552
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8553
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8554
+ * are not: it is two different concepts colliding on a name. Keep this type
8555
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8556
+ * would either narrow every `ClassMapDefinition` consumer to the four
8557
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8558
+ * schema exists for (see the "rejects a classMap whose target is not a
8559
+ * detection macro" test in `model-catalog-schema.test.ts`).
8560
+ */
8561
+ var DetectionCatalogClassMapSchema = object({
8562
+ mapping: record(string(), _enum(CLASS_MAP_MACRO_TARGETS)),
8563
+ preserveOriginal: boolean()
8564
+ });
8497
8565
  /**
8498
8566
  * THE canonical event-clip pad: the time window a single-timestamp analytics
8499
8567
  * event expands to when joined with footage (clip window = `[timestamp - preMs,
@@ -8535,10 +8603,55 @@ var RecordingStorageModeSchema = _enum([
8535
8603
  "events",
8536
8604
  "continuous"
8537
8605
  ]);
8606
+ /**
8607
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
8608
+ * tre offerte dallo step `object-detection`, da UNA lista
8609
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
8610
+ */
8611
+ var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
8612
+ /**
8613
+ * True quando `values` non ripete un elemento.
8614
+ *
8615
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
8616
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
8617
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
8618
+ */
8619
+ var noDuplicates = (values) => new Set(values).size === values.length;
8538
8620
  /** Which detectors trigger an `events`-mode band. */
8539
8621
  var RecordingTriggersSchema = object({
8540
8622
  motion: boolean().optional(),
8541
- audioThresholdDbfs: number().optional()
8623
+ audioThresholdDbfs: number().optional(),
8624
+ /**
8625
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
8626
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
8627
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
8628
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
8629
+ *
8630
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
8631
+ * quelle che hanno attraversato `enabledMacroClasses`, i
8632
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
8633
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
8634
+ * finestre — vedi `recorder/object-trigger.ts`.
8635
+ */
8636
+ objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
8637
+ /**
8638
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
8639
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
8640
+ * `objectClasses`.
8641
+ *
8642
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
8643
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
8644
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
8645
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
8646
+ * device (D12) — mai un elenco globale di cap.
8647
+ *
8648
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
8649
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
8650
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
8651
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
8652
+ * registrare.
8653
+ */
8654
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
8542
8655
  });
8543
8656
  /**
8544
8657
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -9064,41 +9177,6 @@ var DecoderSessionConfigSchema = object({
9064
9177
  */
9065
9178
  debug: boolean().optional()
9066
9179
  });
9067
- var LabelDefinitionSchema = object({
9068
- id: string(),
9069
- name: string(),
9070
- category: string().optional(),
9071
- description: string().optional(),
9072
- icon: string().optional()
9073
- });
9074
- /**
9075
- * Wire schema for a per-model CATALOG classMap override
9076
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
9077
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
9078
- * detection pipeline executor actually routes.
9079
- *
9080
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
9081
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
9082
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
9083
- * enum) — the two used to share the name `ClassMapDefinition`/
9084
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
9085
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
9086
- * are not: it is two different concepts colliding on a name. Keep this type
9087
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
9088
- * would either narrow every `ClassMapDefinition` consumer to the four
9089
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
9090
- * schema exists for (see the "rejects a classMap whose target is not a
9091
- * detection macro" test in `model-catalog-schema.test.ts`).
9092
- */
9093
- var DetectionCatalogClassMapSchema = object({
9094
- mapping: record(string(), _enum([
9095
- "person",
9096
- "vehicle",
9097
- "animal",
9098
- "package"
9099
- ])),
9100
- preserveOriginal: boolean()
9101
- });
9102
9180
  var MODEL_FORMATS = [
9103
9181
  "onnx",
9104
9182
  "coreml",
@@ -23119,7 +23197,7 @@ var lifecycleJobSchema = object({
23119
23197
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
23120
23198
  * as every other cap.
23121
23199
  */
23122
- var LogLevelSchema$1 = _enum([
23200
+ var LogLevelSchema$2 = _enum([
23123
23201
  "debug",
23124
23202
  "info",
23125
23203
  "warn",
@@ -23326,7 +23404,7 @@ var CustomActionInputSchema = object({
23326
23404
  method(_void(), array(AddonListItemSchema).readonly()), method(object({
23327
23405
  addonId: string(),
23328
23406
  limit: number().min(1).max(500).default(100),
23329
- level: LogLevelSchema$1.optional()
23407
+ level: LogLevelSchema$2.optional()
23330
23408
  }), array(LogQueryEntrySchema)), method(_void(), array(InstalledPackageSchema).readonly()), method(object({
23331
23409
  packageName: string(),
23332
23410
  version: string().optional()
@@ -23424,7 +23502,7 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
23424
23502
  auth: "admin"
23425
23503
  }), method(object({
23426
23504
  addonId: string(),
23427
- level: LogLevelSchema$1.optional()
23505
+ level: LogLevelSchema$2.optional()
23428
23506
  }), LogStreamEntrySchema, { kind: "subscription" });
23429
23507
  object({
23430
23508
  /** Carbon dioxide concentration in ppm. */
@@ -24485,6 +24563,35 @@ var FaceFilterEnum = _enum([
24485
24563
  "identified",
24486
24564
  "all"
24487
24565
  ]);
24566
+ /**
24567
+ * What a `listRecentFaces` page is ORDERED BY.
24568
+ *
24569
+ * - `timestamp` — when the face was seen. The historical (and default) order.
24570
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
24571
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
24572
+ * order: it puts the suggestions an operator can confirm with one tap at the
24573
+ * top, and it is the reason this enum exists — a client that ranked a capped
24574
+ * page client-side was ranking the newest N, never the most certain N.
24575
+ *
24576
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
24577
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
24578
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
24579
+ * — flipping the direction reorders the rows that HAVE a certainty and never
24580
+ * floods the page with the ones that do not. `addon-post-analysis`'s
24581
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
24582
+ * then by faceId, and is what makes this a total order instead of the
24583
+ * backend's NULL-collation accident.
24584
+ */
24585
+ var FaceSortFieldEnum = _enum(["timestamp", "suggestionConfidence"]);
24586
+ var FaceSortDirectionEnum = _enum(["asc", "desc"]);
24587
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
24588
+ * never leaves the server. */
24589
+ var FaceClusterSchema = object({
24590
+ faceIds: array(string()).readonly(),
24591
+ representativeFaceId: string(),
24592
+ size: number().int(),
24593
+ cohesion: number()
24594
+ });
24488
24595
  var MediaFileLiteSchema$1 = object({
24489
24596
  key: string(),
24490
24597
  kind: string(),
@@ -24531,24 +24638,72 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24531
24638
  kind: "mutation",
24532
24639
  auth: "admin"
24533
24640
  }), method(object({
24534
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
24641
+ /**
24642
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
24643
+ *
24644
+ * The legacy single-camera form, kept verbatim for every caller that
24645
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
24646
+ * instead — never both: `deviceIds` is the authority whenever it is
24647
+ * present, and this field is then ignored rather than unioned, so
24648
+ * there is exactly one answer to "which cameras did I ask for".
24649
+ */
24535
24650
  deviceId: number().int().optional(),
24651
+ /**
24652
+ * Restrict to a SET of cameras — the review UI's camera filter, which
24653
+ * until now had to fetch the cluster-wide page and drop rows in the
24654
+ * client (so the `limit` it asked for was spent on cameras it was
24655
+ * about to discard).
24656
+ *
24657
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
24658
+ * "every camera". A request for no devices is a request, not an
24659
+ * omission; same contract as `deviceManager.listFleet` and
24660
+ * `pipelineAnalytics.listRecentTracks`.
24661
+ *
24662
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
24663
+ */
24664
+ deviceIds: array(number().int()).optional(),
24536
24665
  limit: number().int().positive().optional(),
24537
24666
  filter: FaceFilterEnum.optional(),
24538
24667
  /**
24539
- * Inline the base64 crop on every row. Default `true` — the existing
24540
- * behaviour, kept so no caller breaks.
24668
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24669
+ * Absent means no lower bound.
24670
+ */
24671
+ since: number().int().optional(),
24672
+ /**
24673
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
24674
+ * Absent means no upper bound.
24675
+ */
24676
+ until: number().int().optional(),
24677
+ /**
24678
+ * Order the page by time or by suggestion certainty. Default
24679
+ * `'timestamp'` — the historical order, unchanged for every caller
24680
+ * that does not ask.
24541
24681
  *
24542
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
24543
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
24544
- * the browser cache the images.
24682
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
24683
+ * does under `'suggestionConfidence'`.
24545
24684
  *
24546
- * **This is an INPUT field, so it does not reach the addon until the
24547
- * next train.** The hub router validates cap inputs against its own
24548
- * compiled Zod, which strips a key it does not know verified today
24549
- * on the OUTPUT side, where an additive field DOES arrive immediately
24550
- * (`Track.hasFace`). Until the train ships, sending `false` is
24551
- * harmless and simply keeps the crops inline.
24685
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
24686
+ * index and stops reading as soon as `limit` rows have PASSED the
24687
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
24688
+ * certain row may be the oldest so it walks the window. Narrow it
24689
+ * with {@link since} / {@link until}.
24690
+ */
24691
+ sortBy: FaceSortFieldEnum.optional(),
24692
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
24693
+ sortDirection: FaceSortDirectionEnum.optional(),
24694
+ /**
24695
+ * Inline the base64 crop on every row.
24696
+ *
24697
+ * Default `false` since the 2026-08-25 inversion — see
24698
+ * `include-crops-default.ts`, which is the ONE place that resolves
24699
+ * this for every gallery, and which records why the inline shape had
24700
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
24701
+ * The doc here used to still say `true`; it was wrong, and a leftover
24702
+ * that describes the old design reads as permission to rely on it.
24703
+ *
24704
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
24705
+ * which the browser fetches off the `event-media` plane in parallel,
24706
+ * cached and ETagged.
24552
24707
  */
24553
24708
  includeCrops: boolean().optional()
24554
24709
  }).optional(), array(FaceInfoSchema).readonly()), method(object({
@@ -24584,13 +24739,39 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24584
24739
  }), method(object({
24585
24740
  threshold: number().min(0).max(1).optional(),
24586
24741
  minClusterSize: number().int().min(2).optional(),
24587
- limit: number().int().positive().optional()
24588
- }).optional(), array(object({
24589
- faceIds: array(string()).readonly(),
24590
- representativeFaceId: string(),
24591
- size: number().int(),
24592
- cohesion: number()
24593
- })).readonly());
24742
+ /**
24743
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
24744
+ * which read as though it bounded the work — it never did.
24745
+ *
24746
+ * Wins over {@link limit} when both are sent.
24747
+ */
24748
+ maxClusters: number().int().positive().optional(),
24749
+ /**
24750
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
24751
+ * RESULT, not the scan. Kept so existing callers keep working; send
24752
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
24753
+ */
24754
+ limit: number().int().positive().optional(),
24755
+ /**
24756
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
24757
+ * POOL, not the result.
24758
+ *
24759
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
24760
+ * used to read every unassigned face on the hub no matter what the
24761
+ * caller asked for, because the only bound cut the finished clusters
24762
+ * afterwards; a UI showing a window of 100 paid for a scan of the
24763
+ * whole corpus, on an addon whose disk is under contention.
24764
+ *
24765
+ * The pool is the NEWEST matching faces first — the same order the
24766
+ * gallery shows — so a bound here shortens the horizon, it does not
24767
+ * sample it randomly.
24768
+ *
24769
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
24770
+ * so the live corpus — 372 face rows — is unaffected while the
24771
+ * unbounded scan can never come back as the table grows.
24772
+ */
24773
+ maxFacesScanned: number().int().positive().optional()
24774
+ }).optional(), array(FaceClusterSchema).readonly());
24594
24775
  /**
24595
24776
  * Fan-control cap. Models HA `fan.*` entity-specific surfaces:
24596
24777
  * speed percentage, preset modes, ceiling-fan direction, and
@@ -28472,6 +28653,293 @@ var SetSiteLocationInputSchema = object({
28472
28653
  latitude: number().min(-90).max(90),
28473
28654
  longitude: number().min(-180).max(180)
28474
28655
  }).nullable();
28656
+ /**
28657
+ * The TRANSPORT a call arrived on.
28658
+ *
28659
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28660
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28661
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28662
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28663
+ * checkable rather than asserted.
28664
+ *
28665
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28666
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28667
+ * connection; the viewer talks to the hub over `wsLink`
28668
+ * exclusively, so this is the plane the HTTP census could not see.
28669
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28670
+ * never touches a socket and therefore never touched a census.
28671
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28672
+ * that is exactly what its `0` asserts: every plane the hub has can name
28673
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28674
+ * plane nobody instrumented lands here instead of vanishing from the total.
28675
+ */
28676
+ var TransportPlaneSchema = _enum([
28677
+ "http",
28678
+ "ws",
28679
+ "mesh",
28680
+ "unknown"
28681
+ ]);
28682
+ /**
28683
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28684
+ * reads as "not instrumented", which is the one thing this census must never
28685
+ * make an operator wonder about.
28686
+ */
28687
+ var TransportPlaneCountsSchema = object({
28688
+ http: number(),
28689
+ ws: number(),
28690
+ mesh: number(),
28691
+ unknown: number()
28692
+ });
28693
+ /**
28694
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28695
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28696
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28697
+ * already prints - never a token, never an `Authorization` header.
28698
+ *
28699
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28700
+ * and lives for hours, so folding it into a call count makes one long-lived
28701
+ * stream look like a storm.
28702
+ */
28703
+ var RequestCensusGroupSchema = object({
28704
+ plane: TransportPlaneSchema,
28705
+ procedure: string(),
28706
+ userAgent: string(),
28707
+ ip: string(),
28708
+ principal: string(),
28709
+ calls: number(),
28710
+ subscriptions: number(),
28711
+ perMin: number()
28712
+ });
28713
+ /**
28714
+ * A procedure's TOTAL over the window, across every caller.
28715
+ *
28716
+ * This block, not the group list, is what answers "did these calls arrive over
28717
+ * HTTP at all". A total far BELOW what a store-side census counted over the
28718
+ * same window excludes the HTTP plane, which is a result, not a failure.
28719
+ */
28720
+ var RequestCensusProcedureSchema = object({
28721
+ procedure: string(),
28722
+ calls: number(),
28723
+ /**
28724
+ * The same total, split by transport. THIS is the row that answers the
28725
+ * question the census exists for: one look at `deviceManager.listAll` says
28726
+ * which plane carried the 4 960, without joining two log lines by eye.
28727
+ */
28728
+ planes: TransportPlaneCountsSchema,
28729
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28730
+ subscriptions: number(),
28731
+ perMin: number()
28732
+ });
28733
+ /**
28734
+ * The census as an operator sees it.
28735
+ *
28736
+ * `persisted` is the honest answer to "will this survive the restart I am
28737
+ * about to do": the arm deadline is written to `system-settings` so a window
28738
+ * armed now can measure the NEXT boot, and a write that failed must not look
28739
+ * like one that succeeded.
28740
+ */
28741
+ var RequestCensusStatusSchema = object({
28742
+ armed: boolean(),
28743
+ /** How long the current - or just-closed - window collected, in ms. */
28744
+ elapsedMs: number(),
28745
+ /** The window actually armed, after the server clamped the request. */
28746
+ windowMs: number(),
28747
+ /** Epoch ms the window closes at. 0 when disarmed. */
28748
+ armedUntilMs: number(),
28749
+ httpRequests: number(),
28750
+ batchedRequests: number(),
28751
+ /**
28752
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
28753
+ * is in play (`?batch=1` carries several procedures in one request); this is
28754
+ * the number comparable with a store-side call count.
28755
+ */
28756
+ procedureCalls: number(),
28757
+ /**
28758
+ * `procedureCalls` split by transport. The four keys sum to
28759
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28760
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28761
+ */
28762
+ planes: TransportPlaneCountsSchema,
28763
+ /**
28764
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28765
+ * on no plane at all - which is a RESULT (a plane is missing from the
28766
+ * instrument), not a failure, and it has to be visible to be read as one.
28767
+ */
28768
+ planesExplainTotal: boolean(),
28769
+ /**
28770
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
28771
+ * adapter resolves one context per connection - kept because a plane's call
28772
+ * count of zero against 37 open connections says something different from a
28773
+ * plane with no connections at all.
28774
+ */
28775
+ wsConnections: number(),
28776
+ /**
28777
+ * Client frames the WS plane looked at. `wsMessages` far above
28778
+ * `planes.ws + subscriptions` means most traffic is not operations
28779
+ * (keepalives, connection params) - which is itself an answer.
28780
+ */
28781
+ wsMessages: number(),
28782
+ /**
28783
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28784
+ * purpose: one live-events stream opened at boot and held for six hours is
28785
+ * one subscription, and counting it as a call would let a quiet plane
28786
+ * masquerade as the storm.
28787
+ */
28788
+ subscriptions: number(),
28789
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28790
+ subscriptionStops: number(),
28791
+ distinctGroups: number(),
28792
+ /**
28793
+ * Operations counted in the totals whose CALLER attribution was shed at the
28794
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28795
+ * which transport they arrived on, they just lost their group row.
28796
+ */
28797
+ unattributedCalls: number(),
28798
+ procedures: array(RequestCensusProcedureSchema).readonly(),
28799
+ groups: array(RequestCensusGroupSchema).readonly()
28800
+ }).extend({ persisted: boolean() });
28801
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
28802
+ var LogLevelSchema$1 = _enum([
28803
+ "debug",
28804
+ "info",
28805
+ "warn",
28806
+ "error"
28807
+ ]);
28808
+ /**
28809
+ * The diagnostics that can be ARMED for a window. Exactly one today.
28810
+ *
28811
+ * A diagnostic is anything whose cost is only worth paying while a question is
28812
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
28813
+ */
28814
+ var DiagnosticIdSchema = _enum(["request-census"]);
28815
+ /**
28816
+ * The layers of the level hierarchy, general → specific. The most specific
28817
+ * layer that carries an explicit value wins.
28818
+ *
28819
+ * `component` is DECLARED and not yet resolvable: the per-component channels
28820
+ * are a later slice of the same plan, and a `levelSource` enum that has to
28821
+ * grow later would force every consumer of this document to change with it.
28822
+ * Nothing returns `component` today.
28823
+ */
28824
+ var LoggingScopeKindSchema = _enum([
28825
+ "cluster",
28826
+ "node",
28827
+ "component"
28828
+ ]);
28829
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
28830
+ var LoggingLevelSourceSchema = _enum([
28831
+ "default",
28832
+ "cluster",
28833
+ "node",
28834
+ "component"
28835
+ ]);
28836
+ /**
28837
+ * One layer of the hierarchy as it actually STANDS.
28838
+ *
28839
+ * `level: null` is the whole reason this array is returned: it is the
28840
+ * difference between "this node is at `info` because I decided it" and
28841
+ * "...because it inherits". An operator who clears an override believing they
28842
+ * are clearing an inherited value has been handed the same defect as the two
28843
+ * contradicting knobs this document exists to remove, moved one floor up.
28844
+ */
28845
+ var LoggingLevelLayerSchema = object({
28846
+ scope: LoggingScopeKindSchema,
28847
+ /** The node this layer speaks for; `null` on the cluster layer. */
28848
+ nodeId: string().nullable(),
28849
+ /** Explicitly set here, or `null` when this layer inherits. */
28850
+ level: LogLevelSchema$1.nullable()
28851
+ });
28852
+ /** What a line is judged against, and WHICH layer decided it. */
28853
+ var LoggingEffectiveSchema = object({
28854
+ level: LogLevelSchema$1,
28855
+ levelSource: LoggingLevelSourceSchema
28856
+ });
28857
+ /** Every layer, general → specific. Never collapsed into the effective value. */
28858
+ var LoggingExplicitSchema = object({ layers: array(LoggingLevelLayerSchema).readonly() });
28859
+ /**
28860
+ * An armed diagnostic, with its DEADLINE.
28861
+ *
28862
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
28863
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
28864
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
28865
+ * `armed` is false — a window is never reported as slightly expired.
28866
+ */
28867
+ var DiagnosticWindowSchema = object({
28868
+ id: DiagnosticIdSchema,
28869
+ armed: boolean(),
28870
+ /** Epoch ms the window closes at. 0 when disarmed. */
28871
+ armedUntilMs: number(),
28872
+ /** Ms left before it expires on its own. 0 when disarmed. */
28873
+ remainingMs: number(),
28874
+ /** Whether the stored deadline is the one the live diagnostic is running —
28875
+ * i.e. whether this window would survive a restart. */
28876
+ persisted: boolean()
28877
+ });
28878
+ /**
28879
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
28880
+ * server — there is no maximum here on purpose: a bound repeated in a schema
28881
+ * is a second knob that disagrees with the first the day one of them moves.
28882
+ */
28883
+ var DiagnosticWindowPatchSchema = object({
28884
+ id: DiagnosticIdSchema,
28885
+ armMs: number().int().min(0),
28886
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
28887
+ reportEveryMs: number().int().positive().optional()
28888
+ });
28889
+ /**
28890
+ * A PATCH, and patches MERGE.
28891
+ *
28892
+ * A field absent from the patch is left exactly as it was — arming a
28893
+ * diagnostic never resets a level, and setting a level never disarms a window.
28894
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
28895
+ * `setAll` already merges, and rebuilding the object is how an absent field
28896
+ * turns into an erased one.
28897
+ */
28898
+ var LoggingSettingsPatchSchema = object({
28899
+ /**
28900
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
28901
+ * addressed scope so it inherits again. A value sets it.
28902
+ */
28903
+ level: LogLevelSchema$1.nullable().optional(),
28904
+ /**
28905
+ * Only the diagnostics NAMED here change. An armed window that is not listed
28906
+ * keeps running — a patch is never a full replacement.
28907
+ */
28908
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28909
+ });
28910
+ /**
28911
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
28912
+ *
28913
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
28914
+ * input — the generated router strips it and uses it to resolve the PROVIDER
28915
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
28916
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
28917
+ * by an agent that holds no cluster document at all. The hub is the single
28918
+ * authority over the whole hierarchy and answers for every layer, so the
28919
+ * layer selector needs a name the transport does not already own.
28920
+ */
28921
+ var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
28922
+ var SetLoggingSettingsInputSchema = object({
28923
+ scopeNodeId: string().optional(),
28924
+ patch: LoggingSettingsPatchSchema
28925
+ });
28926
+ /**
28927
+ * The whole document, as read and as returned after every write.
28928
+ *
28929
+ * `persisted: false` means the settings store could not be read or written.
28930
+ * The in-memory mirror still governs behaviour and is unchanged by the
28931
+ * failure — a read that fails neither switches a level nor disarms a window
28932
+ * (D49) — but the operator is told that what they are looking at would not
28933
+ * survive a restart.
28934
+ */
28935
+ var LoggingSettingsStateSchema = object({
28936
+ /** The layer this document was read at. `null` = the cluster layer. */
28937
+ scopeNodeId: string().nullable(),
28938
+ effective: LoggingEffectiveSchema,
28939
+ explicit: LoggingExplicitSchema,
28940
+ activeWindows: array(DiagnosticWindowSchema).readonly(),
28941
+ persisted: boolean()
28942
+ });
28475
28943
  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(), {
28476
28944
  kind: "mutation",
28477
28945
  auth: "admin"
@@ -28484,6 +28952,9 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28484
28952
  }), method(_void(), SiteLocationStatusSchema, {
28485
28953
  kind: "mutation",
28486
28954
  auth: "admin"
28955
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
28956
+ kind: "mutation",
28957
+ auth: "admin"
28487
28958
  });
28488
28959
  object({
28489
28960
  /** True when the device's tamper switch / case-open contact is
@@ -29112,6 +29583,146 @@ DeviceType.Camera, method(object({
29112
29583
  detection: array(ZoneRuleSchema).readonly(),
29113
29584
  package: array(ZoneRuleSchema).readonly()
29114
29585
  });
29586
+ /**
29587
+ * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
29588
+ * valutatore puro del suo FRONTE.
29589
+ *
29590
+ * Viveva dentro il builtin virtual-doorbell
29591
+ * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
29592
+ * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
29593
+ * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
29594
+ * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
29595
+ * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
29596
+ * SPOSTA qui e il doorbell la ri-esporta.
29597
+ *
29598
+ * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
29599
+ * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
29600
+ * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
29601
+ * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
29602
+ */
29603
+ /**
29604
+ * Known binary / switch source caps → the boolean slice field whose
29605
+ * false→true rise counts as ACTIVE. Every entry is "fire on active".
29606
+ * Sensors whose "active" reading is not a plain boolean (presence's string
29607
+ * state, connectivity's connected flag) are deliberately excluded — a
29608
+ * reconnect is not a doorbell press, and it is not a recording either.
29609
+ */
29610
+ var SOURCE_CAP_ACTIVE_FIELD = {
29611
+ contact: "entryOpen",
29612
+ binary: "on",
29613
+ switch: "on",
29614
+ motion: "detected",
29615
+ flood: "flooded",
29616
+ gas: "detected",
29617
+ smoke: "detected",
29618
+ "carbon-monoxide": "detected",
29619
+ vibration: "detected",
29620
+ tamper: "tampered"
29621
+ };
29622
+ /**
29623
+ * The same caps → the slice field carrying the ms-epoch timestamp of the
29624
+ * last transition. Every source cap MUST appear here (guarded by a spec):
29625
+ * without a transition timestamp the evaluator cannot tell a genuine rise
29626
+ * from a boot-time hydration when the FIRST slice it ever sees is already
29627
+ * active, and errs towards silence — swallowing the rise.
29628
+ *
29629
+ * These timestamps are UPSTREAM ones, not ingest ones: the Home Assistant
29630
+ * provider derives them from `state.last_changed`, so they survive our own
29631
+ * restarts and correctly read as "hours ago" for a state that has been
29632
+ * active for hours. `motion` names its rise timestamp `lastDetectedAt`.
29633
+ */
29634
+ var SOURCE_CAP_CHANGED_AT_FIELD = {
29635
+ contact: "lastChangedAt",
29636
+ binary: "lastChangedAt",
29637
+ switch: "lastChangedAt",
29638
+ motion: "lastDetectedAt",
29639
+ flood: "lastChangedAt",
29640
+ gas: "lastChangedAt",
29641
+ smoke: "lastChangedAt",
29642
+ "carbon-monoxide": "lastChangedAt",
29643
+ vibration: "lastChangedAt",
29644
+ tamper: "lastChangedAt"
29645
+ };
29646
+ /** True when a cap is a recognised binary/switch source. */
29647
+ function isSourceCap(capName) {
29648
+ return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
29649
+ }
29650
+ /** Extract the "active" boolean a source cap's slice carries, or null when
29651
+ * the cap is unknown or the field is missing / non-boolean. */
29652
+ function sliceActiveValue(capName, slice) {
29653
+ const field = SOURCE_CAP_ACTIVE_FIELD[capName];
29654
+ if (field === void 0) return null;
29655
+ const raw = slice[field];
29656
+ return typeof raw === "boolean" ? raw : null;
29657
+ }
29658
+ /** Ms-epoch transition timestamp a source cap's slice carries, or null when
29659
+ * it is absent, non-numeric or the zero "never observed" sentinel. */
29660
+ function sliceChangedAt(capName, slice) {
29661
+ const field = SOURCE_CAP_CHANGED_AT_FIELD[capName];
29662
+ if (field === void 0) return null;
29663
+ const raw = slice[field];
29664
+ if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return null;
29665
+ return raw;
29666
+ }
29667
+ /**
29668
+ * How recent a source's own transition timestamp must be for a FIRST
29669
+ * sighting that is already active to count as a genuine rise rather than a
29670
+ * hydration of long-standing state.
29671
+ */
29672
+ var DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = 3e4;
29673
+ /**
29674
+ * IL fronte. Puro: nessun orologio proprio, nessuna memoria — il chiamante
29675
+ * porta `prior`, `nowMs` e il proprio `startedAtMs`.
29676
+ *
29677
+ * Il caso della PRIMA slice già attiva è trattato esplicitamente e vale come
29678
+ * fronte solo se il timestamp UPSTREAM della transizione è posteriore a
29679
+ * `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
29680
+ * servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
29681
+ * stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
29682
+ * iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
29683
+ * adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
29684
+ * SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
29685
+ */
29686
+ function evaluateSensorEdge(input) {
29687
+ const value = sliceActiveValue(input.capName, input.slice);
29688
+ if (value === null) return {
29689
+ edge: "none",
29690
+ value: null,
29691
+ reason: isSourceCap(input.capName) ? "non-boolean-value" : "unknown-cap"
29692
+ };
29693
+ if (input.prior === void 0) {
29694
+ if (!value) return {
29695
+ edge: "none",
29696
+ value,
29697
+ reason: "baseline-seeded-inactive"
29698
+ };
29699
+ const changedAt = sliceChangedAt(input.capName, input.slice);
29700
+ const floor = Math.max(input.startedAtMs, input.nowMs - input.firstSightingFreshnessMs);
29701
+ if (changedAt === null || changedAt < floor) return {
29702
+ edge: "none",
29703
+ value,
29704
+ reason: "baseline-seeded-stale-active"
29705
+ };
29706
+ return {
29707
+ edge: "rising",
29708
+ value: true
29709
+ };
29710
+ }
29711
+ if (input.prior === value) return {
29712
+ edge: "none",
29713
+ value,
29714
+ reason: "no-change"
29715
+ };
29716
+ if (!value) return {
29717
+ edge: "none",
29718
+ value,
29719
+ reason: "falling-edge"
29720
+ };
29721
+ return {
29722
+ edge: "rising",
29723
+ value: true
29724
+ };
29725
+ }
29115
29726
  var HF_BASE_URL = `https://huggingface.co/camstack/camstack-models/resolve/main`;
29116
29727
  /**
29117
29728
  * Accessory device helpers — shared across drivers.
@@ -29152,9 +29763,6 @@ var AccessoryKind = {
29152
29763
  PrivacyMask: DeviceRole.PrivacyMask
29153
29764
  };
29154
29765
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
29155
- 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;
29156
- new Set(Object.values(DeviceType));
29157
- DeviceFeature.BatteryOperated;
29158
29766
  /**
29159
29767
  * THE derivation. One crop rectangle, one presence verdict — see D52 for why
29160
29768
  * this repo insists a derived value has exactly one implementation.
@@ -29173,6 +29781,9 @@ function deriveBatteryPresence(input) {
29173
29781
  const budget = input.unreachableAfterMs ?? 216e5;
29174
29782
  return input.nowMs - lastContactAt > budget ? "unreachable" : "sleeping";
29175
29783
  }
29784
+ 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;
29785
+ new Set(Object.values(DeviceType));
29786
+ DeviceFeature.BatteryOperated;
29176
29787
  Object.freeze({
29177
29788
  "accessories.setChildHidden": {
29178
29789
  capName: "accessories",
@@ -34334,6 +34945,18 @@ Object.freeze({
34334
34945
  addonId: null,
34335
34946
  access: "create"
34336
34947
  },
34948
+ "system.getLoggingSettings": {
34949
+ capName: "system",
34950
+ capScope: "system",
34951
+ addonId: null,
34952
+ access: "view"
34953
+ },
34954
+ "system.getRequestCensus": {
34955
+ capName: "system",
34956
+ capScope: "system",
34957
+ addonId: null,
34958
+ access: "view"
34959
+ },
34337
34960
  "system.getRetentionConfig": {
34338
34961
  capName: "system",
34339
34962
  capScope: "system",
@@ -34364,6 +34987,12 @@ Object.freeze({
34364
34987
  addonId: null,
34365
34988
  access: "view"
34366
34989
  },
34990
+ "system.setLoggingSettings": {
34991
+ capName: "system",
34992
+ capScope: "system",
34993
+ addonId: null,
34994
+ access: "create"
34995
+ },
34367
34996
  "system.setRetentionConfig": {
34368
34997
  capName: "system",
34369
34998
  capScope: "system",
@@ -35519,6 +36148,10 @@ Object.freeze({
35519
36148
  name: "deviceId",
35520
36149
  form: "single",
35521
36150
  optional: true
36151
+ }, {
36152
+ name: "deviceIds",
36153
+ form: "array",
36154
+ optional: true
35522
36155
  }],
35523
36156
  "fanControl.setDirection": [{
35524
36157
  name: "deviceId",
@@ -37349,6 +37982,7 @@ var NATIVE_LEASE_BUDGET_KEY = "nativeLeaseBudgetMb";
37349
37982
  var NATIVE_LEASE_ACTIVITY_KEY = "nativeLeaseActivityMs";
37350
37983
  var NATIVE_LEASE_ADMISSION_KEY = "nativeLeaseAdmission";
37351
37984
  var NATIVE_LEASE_TILE_BUDGET_KEY = "nativeTileBudgetMb";
37985
+ var NATIVE_LEASE_SCENE_BUDGET_KEY = "nativeSceneBudgetMb";
37352
37986
  /**
37353
37987
  * WHICH delivered frames the decode worker retains a native copy of.
37354
37988
  *
@@ -37443,7 +38077,38 @@ var NativeLeaseSettingsSchema = object({
37443
38077
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
37444
38078
  * reproduce that.
37445
38079
  */
37446
- tileBudgetMb: number().int().min(0).max(1024)
38080
+ tileBudgetMb: number().int().min(0).max(1024),
38081
+ /**
38082
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
38083
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
38084
+ * subject tiles, on frames that detected something.
38085
+ *
38086
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
38087
+ * containment is strict by design, so the native `keyFrame`, the detail
38088
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
38089
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
38090
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
38091
+ * frame-time after delivery, with the request only p50 367 ms behind it.
38092
+ *
38093
+ * Sizing, and why this is a budget and not a duration: a scene tile is
38094
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
38095
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
38096
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
38097
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
38098
+ * binds only through a detection burst, where it still covers well past the
38099
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
38100
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
38101
+ * whole shape exists to avoid.
38102
+ *
38103
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
38104
+ * subject tile, so one shared budget would let a busy camera's key frames
38105
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
38106
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
38107
+ * pre-existing behaviour, where a late full-frame request had nothing but the
38108
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
38109
+ * nothing.
38110
+ */
38111
+ sceneBudgetMb: number().int().min(0).max(1024)
37447
38112
  });
37448
38113
  /**
37449
38114
  * The values in force when the operator has set nothing.
@@ -37459,12 +38124,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
37459
38124
  budgetMb: 1024,
37460
38125
  activityMs: 15e3,
37461
38126
  tileBudgetMb: 64,
38127
+ sceneBudgetMb: 48,
37462
38128
  admission: "inferred"
37463
38129
  };
37464
38130
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
37465
38131
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37466
38132
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37467
38133
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
38134
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
37468
38135
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37469
38136
  /**
37470
38137
  * Parse one knob, reporting `null` for absent, junk, out-of-bounds — AND for a
@@ -37513,12 +38180,14 @@ function readNativeLeaseOverride(config) {
37513
38180
  const activityMs = readKnob("activityMs", config[NATIVE_LEASE_ACTIVITY_KEY]);
37514
38181
  const admission = readAdmissionKnob(config[NATIVE_LEASE_ADMISSION_KEY]);
37515
38182
  const tileBudgetMb = readKnob("tileBudgetMb", config[NATIVE_LEASE_TILE_BUDGET_KEY]);
38183
+ const sceneBudgetMb = readKnob("sceneBudgetMb", config[NATIVE_LEASE_SCENE_BUDGET_KEY]);
37516
38184
  return {
37517
38185
  ...holdFrames === null ? {} : { holdFrames },
37518
38186
  ...budgetMb === null ? {} : { budgetMb },
37519
38187
  ...activityMs === null ? {} : { activityMs },
37520
38188
  ...admission === null ? {} : { admission },
37521
- ...tileBudgetMb === null ? {} : { tileBudgetMb }
38189
+ ...tileBudgetMb === null ? {} : { tileBudgetMb },
38190
+ ...sceneBudgetMb === null ? {} : { sceneBudgetMb }
37522
38191
  };
37523
38192
  }
37524
38193
  function isHydratedField(entry) {
@@ -37529,7 +38198,8 @@ var LEASE_KEYS = [
37529
38198
  NATIVE_LEASE_BUDGET_KEY,
37530
38199
  NATIVE_LEASE_ACTIVITY_KEY,
37531
38200
  NATIVE_LEASE_ADMISSION_KEY,
37532
- NATIVE_LEASE_TILE_BUDGET_KEY
38201
+ NATIVE_LEASE_TILE_BUDGET_KEY,
38202
+ NATIVE_LEASE_SCENE_BUDGET_KEY
37533
38203
  ];
37534
38204
  /**
37535
38205
  * Extract the operator's lease overrides from an
@@ -38335,6 +39005,12 @@ Object.defineProperty(exports, "DEFAULT_EVENTS_BAND_BUFFER_SEC", {
38335
39005
  return DEFAULT_EVENTS_BAND_BUFFER_SEC;
38336
39006
  }
38337
39007
  });
39008
+ Object.defineProperty(exports, "DEFAULT_FIRST_SIGHTING_FRESHNESS_MS", {
39009
+ enumerable: true,
39010
+ get: function() {
39011
+ return DEFAULT_FIRST_SIGHTING_FRESHNESS_MS;
39012
+ }
39013
+ });
38338
39014
  Object.defineProperty(exports, "DEFAULT_NATIVE_LEASE_SETTINGS", {
38339
39015
  enumerable: true,
38340
39016
  get: function() {
@@ -38611,6 +39287,12 @@ Object.defineProperty(exports, "errMsg", {
38611
39287
  return errMsg;
38612
39288
  }
38613
39289
  });
39290
+ Object.defineProperty(exports, "evaluateSensorEdge", {
39291
+ enumerable: true,
39292
+ get: function() {
39293
+ return evaluateSensorEdge;
39294
+ }
39295
+ });
38614
39296
  Object.defineProperty(exports, "evaluateZoneRules", {
38615
39297
  enumerable: true,
38616
39298
  get: function() {
@@ -38647,6 +39329,12 @@ Object.defineProperty(exports, "isEvent", {
38647
39329
  return isEvent;
38648
39330
  }
38649
39331
  });
39332
+ Object.defineProperty(exports, "isFirstLevelMacroClass", {
39333
+ enumerable: true,
39334
+ get: function() {
39335
+ return isFirstLevelMacroClass;
39336
+ }
39337
+ });
38650
39338
  Object.defineProperty(exports, "isSoftwareDecode", {
38651
39339
  enumerable: true,
38652
39340
  get: function() {