@camstack/system 1.2.142 → 1.2.144

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 (62) hide show
  1. package/dist/addon-runner.js +1 -1
  2. package/dist/addon-runner.mjs +1 -1
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/console-logging/index.js +1 -1
  12. package/dist/builtins/console-logging/index.mjs +1 -1
  13. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  14. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  15. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  16. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  17. package/dist/builtins/doorbell/trigger-engine.d.ts +7 -81
  18. package/dist/builtins/doorbell/virtual-doorbell.addon.js +29 -109
  19. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +26 -106
  20. package/dist/builtins/hub-forwarder/index.js +1 -1
  21. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  22. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  23. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  24. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  25. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  26. package/dist/builtins/local-network/local-network.addon.js +1 -1
  27. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  28. package/dist/builtins/loki-logging/index.js +1 -1
  29. package/dist/builtins/loki-logging/index.mjs +1 -1
  30. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  31. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  32. package/dist/builtins/platform-probe/index.js +1 -1
  33. package/dist/builtins/platform-probe/index.mjs +1 -1
  34. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  35. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  36. package/dist/builtins/snapshot/index.js +1 -1
  37. package/dist/builtins/snapshot/index.mjs +1 -1
  38. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  39. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  40. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  41. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  42. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  43. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  44. package/dist/builtins/system-config/system-config.addon.js +1 -1
  45. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  46. package/dist/builtins/winston-logging/index.js +1 -1
  47. package/dist/builtins/winston-logging/index.mjs +1 -1
  48. package/dist/{dist-XjWZZYr9.mjs → dist-6rM7chzb.mjs} +789 -78
  49. package/dist/{dist-jRSrzoXr.js → dist-D3lqzV40.js} +824 -77
  50. package/dist/index.d.ts +3 -0
  51. package/dist/index.js +138 -4
  52. package/dist/index.mjs +135 -5
  53. package/dist/kernel/index.d.ts +1 -1
  54. package/dist/kernel/moleculer/core-cap-service.d.ts +17 -2
  55. package/dist/logging/log-manager.d.ts +16 -0
  56. package/dist/logging/logging-gate.d.ts +32 -0
  57. package/dist/logging/logging-gate.singleton.d.ts +5 -0
  58. package/dist/{manifest-python-deps-DBQarwp9.js → manifest-python-deps-B_mCU6gz.js} +25 -2
  59. package/dist/{manifest-python-deps-D3zYlMEa.mjs → manifest-python-deps-BuhBXCg0.mjs} +25 -2
  60. package/dist/{retired-settings-keys-C8FeTH36.mjs → retired-settings-keys-BtvClSPu.mjs} +1 -1
  61. package/dist/{retired-settings-keys-ovd_DQzc.js → retired-settings-keys-OtUQtEbq.js} +1 -1
  62. package/package.json +1 -1
@@ -3653,6 +3653,66 @@ var OpsLogQueryInputSchema = z.object({
3653
3653
  /** Max rows returned, newest-first. */
3654
3654
  limit: z.number().int().min(1).max(1e3).optional()
3655
3655
  });
3656
+ var LabelDefinitionSchema = z.object({
3657
+ id: z.string(),
3658
+ name: z.string(),
3659
+ category: z.string().optional(),
3660
+ description: z.string().optional(),
3661
+ icon: z.string().optional()
3662
+ });
3663
+ /** Detection-macro targets a catalog `classMap` may resolve to. */
3664
+ var CLASS_MAP_MACRO_TARGETS = [
3665
+ "person",
3666
+ "vehicle",
3667
+ "animal",
3668
+ "package"
3669
+ ];
3670
+ /**
3671
+ * Le macro classi di PRIMO LIVELLO: quelle che un object detector emette e che
3672
+ * un operatore può selezionare.
3673
+ *
3674
+ * Sono le tre offerte dallo step `object-detection`
3675
+ * (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
3676
+ * `enabledMacroClasses`). `package` sta in {@link CLASS_MAP_MACRO_TARGETS} e in
3677
+ * `MACRO_LABELS` — è una macro vera — ma NON qui: appartiene allo step
3678
+ * `package-detection`, la cui abilitazione è guidata dalle zone, e offrire la
3679
+ * stessa parola due volte ha già fatto accendere a un operatore il proxy COCO
3680
+ * (suitcase/backpack/handbag) lasciando spento il detector dedicato.
3681
+ *
3682
+ * UNA lista. Prima di oggi le stesse tre erano scritte a mano nell'offerta
3683
+ * dello step e una seconda volta come union `FirstLevelMacro`
3684
+ * (`types/detection.ts`); una terza copia per il trigger di registrazione
3685
+ * (`RecordingTriggers.objectClasses`) avrebbe reso invisibile la divergenza
3686
+ * successiva.
3687
+ */
3688
+ var FIRST_LEVEL_MACRO_CLASSES = [
3689
+ "person",
3690
+ "vehicle",
3691
+ "animal"
3692
+ ];
3693
+ /**
3694
+ * Wire schema for a per-model CATALOG classMap override
3695
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
3696
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
3697
+ * detection pipeline executor actually routes.
3698
+ *
3699
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
3700
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
3701
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
3702
+ * enum) — the two used to share the name `ClassMapDefinition`/
3703
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
3704
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
3705
+ * are not: it is two different concepts colliding on a name. Keep this type
3706
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
3707
+ * would either narrow every `ClassMapDefinition` consumer to the four
3708
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
3709
+ * schema exists for (see the "rejects a classMap whose target is not a
3710
+ * detection macro" test in `model-catalog-schema.test.ts`).
3711
+ */
3712
+ var DetectionCatalogClassMapSchema = z.object({
3713
+ mapping: z.record(z.string(), z.enum(CLASS_MAP_MACRO_TARGETS)),
3714
+ preserveOriginal: z.boolean()
3715
+ });
3656
3716
  /**
3657
3717
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
3658
3718
  * Named `RecordingWeekday` to avoid collision with the string-union
@@ -3675,10 +3735,55 @@ var RecordingStorageModeSchema = z.enum([
3675
3735
  "events",
3676
3736
  "continuous"
3677
3737
  ]);
3738
+ /**
3739
+ * Le macro classi che possono aprire una finestra di registrazione — le stesse
3740
+ * tre offerte dallo step `object-detection`, da UNA lista
3741
+ * ({@link FIRST_LEVEL_MACRO_CLASSES}).
3742
+ */
3743
+ var RecordingObjectTriggerClassSchema = z.enum(FIRST_LEVEL_MACRO_CLASSES);
3744
+ /**
3745
+ * True quando `values` non ripete un elemento.
3746
+ *
3747
+ * Un duplicato non è innocuo: ogni voce di `objectClasses` / `sensorDeviceIds`
3748
+ * diventa una SORGENTE in `bandTriggerSources`, e la stessa sorgente due volte
3749
+ * conterebbe due volte le sue finestre in `segmentMissedByMs`.
3750
+ */
3751
+ var noDuplicates = (values) => new Set(values).size === values.length;
3678
3752
  /** Which detectors trigger an `events`-mode band. */
3679
3753
  var RecordingTriggersSchema = z.object({
3680
3754
  motion: z.boolean().optional(),
3681
- audioThresholdDbfs: z.number().optional()
3755
+ audioThresholdDbfs: z.number().optional(),
3756
+ /**
3757
+ * Le macro classi la cui detection apre una finestra. ASSENTE = la sorgente
3758
+ * non è ascoltata; un array VUOTO è rifiutato, perché "banda events, trigger
3759
+ * object acceso, nessuna classe" è la stessa forma "abilitata e non registra
3760
+ * nulla, per sempre" contro cui è scritto `eventsBandCanEverDemand`.
3761
+ *
3762
+ * Il segnale letto è GIÀ FILTRATO: solo detection `source: 'pipeline'`, cioè
3763
+ * quelle che hanno attraversato `enabledMacroClasses`, i
3764
+ * `minConfidence<Macro>` e il full-frame guard. L'AI a bordo camera
3765
+ * (`source: 'onboard'`) non attraversa nessuno di quei gate e NON apre
3766
+ * finestre — vedi `recorder/object-trigger.ts`.
3767
+ */
3768
+ objectClasses: z.array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
3769
+ /**
3770
+ * I device LINKED il cui FRONTE ALTO apre una finestra. Assente = la sorgente
3771
+ * non è ascoltata; un array vuoto è rifiutato per la stessa ragione di
3772
+ * `objectClasses`.
3773
+ *
3774
+ * Sono id di device SORGENTE, non camere: la banda li nomina, quindi il
3775
+ * percorso caldo (`DeviceStateChanged`, a ritmo di bus su tutta la flotta)
3776
+ * non fa RPC. L'OFFERTA da cui l'operatore li sceglie è un'altra domanda, e
3777
+ * si risolve con `deviceManager.getLinkedDevices` + `getBindingsBatch` per
3778
+ * device (D12) — mai un elenco globale di cap.
3779
+ *
3780
+ * Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
3781
+ * `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
3782
+ * la stessa che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
3783
+ * il livello: un contatto trovato già aperto al riavvio del runner non fa
3784
+ * registrare.
3785
+ */
3786
+ sensorDeviceIds: z.array(z.number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
3682
3787
  });
3683
3788
  /**
3684
3789
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -4130,41 +4235,6 @@ var DecoderSessionConfigSchema = z.object({
4130
4235
  */
4131
4236
  debug: z.boolean().optional()
4132
4237
  });
4133
- var LabelDefinitionSchema = z.object({
4134
- id: z.string(),
4135
- name: z.string(),
4136
- category: z.string().optional(),
4137
- description: z.string().optional(),
4138
- icon: z.string().optional()
4139
- });
4140
- /**
4141
- * Wire schema for a per-model CATALOG classMap override
4142
- * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
4143
- * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
4144
- * detection pipeline executor actually routes.
4145
- *
4146
- * This is deliberately a DIFFERENT, narrower shape than the general-purpose
4147
- * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
4148
- * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
4149
- * enum) — the two used to share the name `ClassMapDefinition`/
4150
- * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
4151
- * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
4152
- * are not: it is two different concepts colliding on a name. Keep this type
4153
- * under its own name rather than reusing `ClassMapDefinition` — reusing it
4154
- * would either narrow every `ClassMapDefinition` consumer to the four
4155
- * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
4156
- * schema exists for (see the "rejects a classMap whose target is not a
4157
- * detection macro" test in `model-catalog-schema.test.ts`).
4158
- */
4159
- var DetectionCatalogClassMapSchema = z.object({
4160
- mapping: z.record(z.string(), z.enum([
4161
- "person",
4162
- "vehicle",
4163
- "animal",
4164
- "package"
4165
- ])),
4166
- preserveOriginal: z.boolean()
4167
- });
4168
4238
  var MODEL_FORMATS = [
4169
4239
  "onnx",
4170
4240
  "coreml",
@@ -21096,7 +21166,7 @@ var lifecycleJobSchema = z.object({
21096
21166
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21097
21167
  * as every other cap.
21098
21168
  */
21099
- var LogLevelSchema$1 = z.enum([
21169
+ var LogLevelSchema$2 = z.enum([
21100
21170
  "debug",
21101
21171
  "info",
21102
21172
  "warn",
@@ -21323,7 +21393,7 @@ var addonsCapability = {
21323
21393
  getLogs: method(z.object({
21324
21394
  addonId: z.string(),
21325
21395
  limit: z.number().min(1).max(500).default(100),
21326
- level: LogLevelSchema$1.optional()
21396
+ level: LogLevelSchema$2.optional()
21327
21397
  }), z.array(LogQueryEntrySchema)),
21328
21398
  listPackages: method(z.void(), z.array(InstalledPackageSchema).readonly()),
21329
21399
  installPackage: method(z.object({
@@ -21561,7 +21631,7 @@ var addonsCapability = {
21561
21631
  }),
21562
21632
  onAddonLogs: method(z.object({
21563
21633
  addonId: z.string(),
21564
- level: LogLevelSchema$1.optional()
21634
+ level: LogLevelSchema$2.optional()
21565
21635
  }), LogStreamEntrySchema, { kind: "subscription" })
21566
21636
  },
21567
21637
  /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
@@ -23403,6 +23473,35 @@ var FaceFilterEnum = z.enum([
23403
23473
  "identified",
23404
23474
  "all"
23405
23475
  ]);
23476
+ /**
23477
+ * What a `listRecentFaces` page is ORDERED BY.
23478
+ *
23479
+ * - `timestamp` — when the face was seen. The historical (and default) order.
23480
+ * - `suggestionConfidence` — {@link FaceInfo.suggestedMatchScore}, the peak
23481
+ * cosine of the face's SUGGESTED identity. This is the "review by certainty"
23482
+ * order: it puts the suggestions an operator can confirm with one tap at the
23483
+ * top, and it is the reason this enum exists — a client that ranked a capped
23484
+ * page client-side was ranking the newest N, never the most certain N.
23485
+ *
23486
+ * A row with NO suggestion (`suggestedMatchScore` absent — a legacy row, an
23487
+ * auto-assigned face, or a face below the suggestion band) has no certainty to
23488
+ * compare. Under `suggestionConfidence` it sorts **LAST, in BOTH directions**
23489
+ * — flipping the direction reorders the rows that HAVE a certainty and never
23490
+ * floods the page with the ones that do not. `addon-post-analysis`'s
23491
+ * `store/face-sort.ts` is the single implementation, tiebreaks newest-first
23492
+ * then by faceId, and is what makes this a total order instead of the
23493
+ * backend's NULL-collation accident.
23494
+ */
23495
+ var FaceSortFieldEnum = z.enum(["timestamp", "suggestionConfidence"]);
23496
+ var FaceSortDirectionEnum = z.enum(["asc", "desc"]);
23497
+ /** One suggested group of look-alike UNASSIGNED faces. Ids only — an embedding
23498
+ * never leaves the server. */
23499
+ var FaceClusterSchema = z.object({
23500
+ faceIds: z.array(z.string()).readonly(),
23501
+ representativeFaceId: z.string(),
23502
+ size: z.number().int(),
23503
+ cohesion: z.number()
23504
+ });
23406
23505
  var MediaFileLiteSchema$1 = z.object({
23407
23506
  key: z.string(),
23408
23507
  kind: z.string(),
@@ -23460,24 +23559,72 @@ includeCrops: z.boolean().optional() }).optional(), z.array(IdentitySchema).read
23460
23559
  auth: "admin"
23461
23560
  }),
23462
23561
  listRecentFaces: method(z.object({
23463
- /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
23562
+ /**
23563
+ * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
23564
+ *
23565
+ * The legacy single-camera form, kept verbatim for every caller that
23566
+ * already sends it. A caller that wants a SET sends {@link deviceIds}
23567
+ * instead — never both: `deviceIds` is the authority whenever it is
23568
+ * present, and this field is then ignored rather than unioned, so
23569
+ * there is exactly one answer to "which cameras did I ask for".
23570
+ */
23464
23571
  deviceId: z.number().int().optional(),
23572
+ /**
23573
+ * Restrict to a SET of cameras — the review UI's camera filter, which
23574
+ * until now had to fetch the cluster-wide page and drop rows in the
23575
+ * client (so the `limit` it asked for was spent on cameras it was
23576
+ * about to discard).
23577
+ *
23578
+ * An **empty array reads NOTHING** — `[]` is an empty page, never
23579
+ * "every camera". A request for no devices is a request, not an
23580
+ * omission; same contract as `deviceManager.listFleet` and
23581
+ * `pipelineAnalytics.listRecentTracks`.
23582
+ *
23583
+ * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
23584
+ */
23585
+ deviceIds: z.array(z.number().int()).optional(),
23465
23586
  limit: z.number().int().positive().optional(),
23466
23587
  filter: FaceFilterEnum.optional(),
23467
23588
  /**
23468
- * Inline the base64 crop on every row. Default `true` — the existing
23469
- * behaviour, kept so no caller breaks.
23589
+ * Window lower bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23590
+ * Absent means no lower bound.
23591
+ */
23592
+ since: z.number().int().optional(),
23593
+ /**
23594
+ * Window upper bound on {@link FaceInfo.timestamp}, INCLUSIVE.
23595
+ * Absent means no upper bound.
23596
+ */
23597
+ until: z.number().int().optional(),
23598
+ /**
23599
+ * Order the page by time or by suggestion certainty. Default
23600
+ * `'timestamp'` — the historical order, unchanged for every caller
23601
+ * that does not ask.
23470
23602
  *
23471
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
23472
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
23473
- * the browser cache the images.
23603
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
23604
+ * does under `'suggestionConfidence'`.
23474
23605
  *
23475
- * **This is an INPUT field, so it does not reach the addon until the
23476
- * next train.** The hub router validates cap inputs against its own
23477
- * compiled Zod, which strips a key it does not know verified today
23478
- * on the OUTPUT side, where an additive field DOES arrive immediately
23479
- * (`Track.hasFace`). Until the train ships, sending `false` is
23480
- * harmless and simply keeps the crops inline.
23606
+ * Cost note: `'timestamp'` is served by the `(deviceId, timestamp)`
23607
+ * index and stops reading as soon as `limit` rows have PASSED the
23608
+ * filter. `'suggestionConfidence'` cannot stop earlythe most
23609
+ * certain row may be the oldest so it walks the window. Narrow it
23610
+ * with {@link since} / {@link until}.
23611
+ */
23612
+ sortBy: FaceSortFieldEnum.optional(),
23613
+ /** Sort direction for {@link sortBy}. Default `'desc'`. */
23614
+ sortDirection: FaceSortDirectionEnum.optional(),
23615
+ /**
23616
+ * Inline the base64 crop on every row.
23617
+ *
23618
+ * Default `false` since the 2026-08-25 inversion — see
23619
+ * `include-crops-default.ts`, which is the ONE place that resolves
23620
+ * this for every gallery, and which records why the inline shape had
23621
+ * to become the one you ASK for (60 457 ms → UDS timeout at 500 rows).
23622
+ * The doc here used to still say `true`; it was wrong, and a leftover
23623
+ * that describes the old design reads as permission to rely on it.
23624
+ *
23625
+ * Nothing loses its image: the row carries {@link FaceInfo.cropUrl},
23626
+ * which the browser fetches off the `event-media` plane in parallel,
23627
+ * cached and ETagged.
23481
23628
  */
23482
23629
  includeCrops: z.boolean().optional()
23483
23630
  }).optional(), z.array(FaceInfoSchema).readonly()),
@@ -23526,13 +23673,39 @@ includeCrops: z.boolean().optional() }).optional(), z.array(IdentitySchema).read
23526
23673
  suggestFaceClusters: method(z.object({
23527
23674
  threshold: z.number().min(0).max(1).optional(),
23528
23675
  minClusterSize: z.number().int().min(2).optional(),
23529
- limit: z.number().int().positive().optional()
23530
- }).optional(), z.array(z.object({
23531
- faceIds: z.array(z.string()).readonly(),
23532
- representativeFaceId: z.string(),
23533
- size: z.number().int(),
23534
- cohesion: z.number()
23535
- })).readonly())
23676
+ /**
23677
+ * Cap on the number of CLUSTERS returned. Renamed from `limit`,
23678
+ * which read as though it bounded the work — it never did.
23679
+ *
23680
+ * Wins over {@link limit} when both are sent.
23681
+ */
23682
+ maxClusters: z.number().int().positive().optional(),
23683
+ /**
23684
+ * @deprecated Ambiguous name for {@link maxClusters} — it cuts the
23685
+ * RESULT, not the scan. Kept so existing callers keep working; send
23686
+ * `maxClusters` (and, if you care about cost, {@link maxFacesScanned}).
23687
+ */
23688
+ limit: z.number().int().positive().optional(),
23689
+ /**
23690
+ * Cap on the number of unassigned faces READ AND CLUSTERED — the
23691
+ * POOL, not the result.
23692
+ *
23693
+ * This is the knob {@link maxClusters} was mistaken for. Clustering
23694
+ * used to read every unassigned face on the hub no matter what the
23695
+ * caller asked for, because the only bound cut the finished clusters
23696
+ * afterwards; a UI showing a window of 100 paid for a scan of the
23697
+ * whole corpus, on an addon whose disk is under contention.
23698
+ *
23699
+ * The pool is the NEWEST matching faces first — the same order the
23700
+ * gallery shows — so a bound here shortens the horizon, it does not
23701
+ * sample it randomly.
23702
+ *
23703
+ * Default: 1 000 (`FACE_SWEEP_PAGE`, exactly one store page). Chosen
23704
+ * so the live corpus — 372 face rows — is unaffected while the
23705
+ * unbounded scan can never come back as the table grows.
23706
+ */
23707
+ maxFacesScanned: z.number().int().positive().optional()
23708
+ }).optional(), z.array(FaceClusterSchema).readonly())
23536
23709
  }
23537
23710
  };
23538
23711
  /**
@@ -29393,6 +29566,293 @@ var SetSiteLocationInputSchema = z.object({
29393
29566
  latitude: z.number().min(-90).max(90),
29394
29567
  longitude: z.number().min(-180).max(180)
29395
29568
  }).nullable();
29569
+ /**
29570
+ * The TRANSPORT a call arrived on.
29571
+ *
29572
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
29573
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
29574
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
29575
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
29576
+ * checkable rather than asserted.
29577
+ *
29578
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
29579
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
29580
+ * connection; the viewer talks to the hub over `wsLink`
29581
+ * exclusively, so this is the plane the HTTP census could not see.
29582
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
29583
+ * never touches a socket and therefore never touched a census.
29584
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
29585
+ * that is exactly what its `0` asserts: every plane the hub has can name
29586
+ * itself. It is an output bucket, never a knob — a call that arrives on a
29587
+ * plane nobody instrumented lands here instead of vanishing from the total.
29588
+ */
29589
+ var TransportPlaneSchema = z.enum([
29590
+ "http",
29591
+ "ws",
29592
+ "mesh",
29593
+ "unknown"
29594
+ ]);
29595
+ /**
29596
+ * Calls per plane. Every key is always present, `0` included — an absent plane
29597
+ * reads as "not instrumented", which is the one thing this census must never
29598
+ * make an operator wonder about.
29599
+ */
29600
+ var TransportPlaneCountsSchema = z.object({
29601
+ http: z.number(),
29602
+ ws: z.number(),
29603
+ mesh: z.number(),
29604
+ unknown: z.number()
29605
+ });
29606
+ /**
29607
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
29608
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29609
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29610
+ * already prints - never a token, never an `Authorization` header.
29611
+ *
29612
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
29613
+ * and lives for hours, so folding it into a call count makes one long-lived
29614
+ * stream look like a storm.
29615
+ */
29616
+ var RequestCensusGroupSchema = z.object({
29617
+ plane: TransportPlaneSchema,
29618
+ procedure: z.string(),
29619
+ userAgent: z.string(),
29620
+ ip: z.string(),
29621
+ principal: z.string(),
29622
+ calls: z.number(),
29623
+ subscriptions: z.number(),
29624
+ perMin: z.number()
29625
+ });
29626
+ /**
29627
+ * A procedure's TOTAL over the window, across every caller.
29628
+ *
29629
+ * This block, not the group list, is what answers "did these calls arrive over
29630
+ * HTTP at all". A total far BELOW what a store-side census counted over the
29631
+ * same window excludes the HTTP plane, which is a result, not a failure.
29632
+ */
29633
+ var RequestCensusProcedureSchema = z.object({
29634
+ procedure: z.string(),
29635
+ calls: z.number(),
29636
+ /**
29637
+ * The same total, split by transport. THIS is the row that answers the
29638
+ * question the census exists for: one look at `deviceManager.listAll` says
29639
+ * which plane carried the 4 960, without joining two log lines by eye.
29640
+ */
29641
+ planes: TransportPlaneCountsSchema,
29642
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
29643
+ subscriptions: z.number(),
29644
+ perMin: z.number()
29645
+ });
29646
+ /**
29647
+ * The census as an operator sees it.
29648
+ *
29649
+ * `persisted` is the honest answer to "will this survive the restart I am
29650
+ * about to do": the arm deadline is written to `system-settings` so a window
29651
+ * armed now can measure the NEXT boot, and a write that failed must not look
29652
+ * like one that succeeded.
29653
+ */
29654
+ var RequestCensusStatusSchema = z.object({
29655
+ armed: z.boolean(),
29656
+ /** How long the current - or just-closed - window collected, in ms. */
29657
+ elapsedMs: z.number(),
29658
+ /** The window actually armed, after the server clamped the request. */
29659
+ windowMs: z.number(),
29660
+ /** Epoch ms the window closes at. 0 when disarmed. */
29661
+ armedUntilMs: z.number(),
29662
+ httpRequests: z.number(),
29663
+ batchedRequests: z.number(),
29664
+ /**
29665
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
29666
+ * is in play (`?batch=1` carries several procedures in one request); this is
29667
+ * the number comparable with a store-side call count.
29668
+ */
29669
+ procedureCalls: z.number(),
29670
+ /**
29671
+ * `procedureCalls` split by transport. The four keys sum to
29672
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
29673
+ * `planesExplainTotal` is that identity, checked rather than assumed.
29674
+ */
29675
+ planes: TransportPlaneCountsSchema,
29676
+ /**
29677
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
29678
+ * on no plane at all - which is a RESULT (a plane is missing from the
29679
+ * instrument), not a failure, and it has to be visible to be read as one.
29680
+ */
29681
+ planesExplainTotal: z.boolean(),
29682
+ /**
29683
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
29684
+ * adapter resolves one context per connection - kept because a plane's call
29685
+ * count of zero against 37 open connections says something different from a
29686
+ * plane with no connections at all.
29687
+ */
29688
+ wsConnections: z.number(),
29689
+ /**
29690
+ * Client frames the WS plane looked at. `wsMessages` far above
29691
+ * `planes.ws + subscriptions` means most traffic is not operations
29692
+ * (keepalives, connection params) - which is itself an answer.
29693
+ */
29694
+ wsMessages: z.number(),
29695
+ /**
29696
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
29697
+ * purpose: one live-events stream opened at boot and held for six hours is
29698
+ * one subscription, and counting it as a call would let a quiet plane
29699
+ * masquerade as the storm.
29700
+ */
29701
+ subscriptions: z.number(),
29702
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
29703
+ subscriptionStops: z.number(),
29704
+ distinctGroups: z.number(),
29705
+ /**
29706
+ * Operations counted in the totals whose CALLER attribution was shed at the
29707
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
29708
+ * which transport they arrived on, they just lost their group row.
29709
+ */
29710
+ unattributedCalls: z.number(),
29711
+ procedures: z.array(RequestCensusProcedureSchema).readonly(),
29712
+ groups: z.array(RequestCensusGroupSchema).readonly()
29713
+ }).extend({ persisted: z.boolean() });
29714
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
29715
+ var LogLevelSchema$1 = z.enum([
29716
+ "debug",
29717
+ "info",
29718
+ "warn",
29719
+ "error"
29720
+ ]);
29721
+ /**
29722
+ * The diagnostics that can be ARMED for a window. Exactly one today.
29723
+ *
29724
+ * A diagnostic is anything whose cost is only worth paying while a question is
29725
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
29726
+ */
29727
+ var DiagnosticIdSchema = z.enum(["request-census"]);
29728
+ /**
29729
+ * The layers of the level hierarchy, general → specific. The most specific
29730
+ * layer that carries an explicit value wins.
29731
+ *
29732
+ * `component` is DECLARED and not yet resolvable: the per-component channels
29733
+ * are a later slice of the same plan, and a `levelSource` enum that has to
29734
+ * grow later would force every consumer of this document to change with it.
29735
+ * Nothing returns `component` today.
29736
+ */
29737
+ var LoggingScopeKindSchema = z.enum([
29738
+ "cluster",
29739
+ "node",
29740
+ "component"
29741
+ ]);
29742
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
29743
+ var LoggingLevelSourceSchema = z.enum([
29744
+ "default",
29745
+ "cluster",
29746
+ "node",
29747
+ "component"
29748
+ ]);
29749
+ /**
29750
+ * One layer of the hierarchy as it actually STANDS.
29751
+ *
29752
+ * `level: null` is the whole reason this array is returned: it is the
29753
+ * difference between "this node is at `info` because I decided it" and
29754
+ * "...because it inherits". An operator who clears an override believing they
29755
+ * are clearing an inherited value has been handed the same defect as the two
29756
+ * contradicting knobs this document exists to remove, moved one floor up.
29757
+ */
29758
+ var LoggingLevelLayerSchema = z.object({
29759
+ scope: LoggingScopeKindSchema,
29760
+ /** The node this layer speaks for; `null` on the cluster layer. */
29761
+ nodeId: z.string().nullable(),
29762
+ /** Explicitly set here, or `null` when this layer inherits. */
29763
+ level: LogLevelSchema$1.nullable()
29764
+ });
29765
+ /** What a line is judged against, and WHICH layer decided it. */
29766
+ var LoggingEffectiveSchema = z.object({
29767
+ level: LogLevelSchema$1,
29768
+ levelSource: LoggingLevelSourceSchema
29769
+ });
29770
+ /** Every layer, general → specific. Never collapsed into the effective value. */
29771
+ var LoggingExplicitSchema = z.object({ layers: z.array(LoggingLevelLayerSchema).readonly() });
29772
+ /**
29773
+ * An armed diagnostic, with its DEADLINE.
29774
+ *
29775
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
29776
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
29777
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
29778
+ * `armed` is false — a window is never reported as slightly expired.
29779
+ */
29780
+ var DiagnosticWindowSchema = z.object({
29781
+ id: DiagnosticIdSchema,
29782
+ armed: z.boolean(),
29783
+ /** Epoch ms the window closes at. 0 when disarmed. */
29784
+ armedUntilMs: z.number(),
29785
+ /** Ms left before it expires on its own. 0 when disarmed. */
29786
+ remainingMs: z.number(),
29787
+ /** Whether the stored deadline is the one the live diagnostic is running —
29788
+ * i.e. whether this window would survive a restart. */
29789
+ persisted: z.boolean()
29790
+ });
29791
+ /**
29792
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
29793
+ * server — there is no maximum here on purpose: a bound repeated in a schema
29794
+ * is a second knob that disagrees with the first the day one of them moves.
29795
+ */
29796
+ var DiagnosticWindowPatchSchema = z.object({
29797
+ id: DiagnosticIdSchema,
29798
+ armMs: z.number().int().min(0),
29799
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
29800
+ reportEveryMs: z.number().int().positive().optional()
29801
+ });
29802
+ /**
29803
+ * A PATCH, and patches MERGE.
29804
+ *
29805
+ * A field absent from the patch is left exactly as it was — arming a
29806
+ * diagnostic never resets a level, and setting a level never disarms a window.
29807
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
29808
+ * `setAll` already merges, and rebuilding the object is how an absent field
29809
+ * turns into an erased one.
29810
+ */
29811
+ var LoggingSettingsPatchSchema = z.object({
29812
+ /**
29813
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
29814
+ * addressed scope so it inherits again. A value sets it.
29815
+ */
29816
+ level: LogLevelSchema$1.nullable().optional(),
29817
+ /**
29818
+ * Only the diagnostics NAMED here change. An armed window that is not listed
29819
+ * keeps running — a patch is never a full replacement.
29820
+ */
29821
+ diagnostics: z.array(DiagnosticWindowPatchSchema).readonly().optional()
29822
+ });
29823
+ /**
29824
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
29825
+ *
29826
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
29827
+ * input — the generated router strips it and uses it to resolve the PROVIDER
29828
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
29829
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
29830
+ * by an agent that holds no cluster document at all. The hub is the single
29831
+ * authority over the whole hierarchy and answers for every layer, so the
29832
+ * layer selector needs a name the transport does not already own.
29833
+ */
29834
+ var GetLoggingSettingsInputSchema = z.object({ scopeNodeId: z.string().optional() });
29835
+ var SetLoggingSettingsInputSchema = z.object({
29836
+ scopeNodeId: z.string().optional(),
29837
+ patch: LoggingSettingsPatchSchema
29838
+ });
29839
+ /**
29840
+ * The whole document, as read and as returned after every write.
29841
+ *
29842
+ * `persisted: false` means the settings store could not be read or written.
29843
+ * The in-memory mirror still governs behaviour and is unchanged by the
29844
+ * failure — a read that fails neither switches a level nor disarms a window
29845
+ * (D49) — but the operator is told that what they are looking at would not
29846
+ * survive a restart.
29847
+ */
29848
+ var LoggingSettingsStateSchema = z.object({
29849
+ /** The layer this document was read at. `null` = the cluster layer. */
29850
+ scopeNodeId: z.string().nullable(),
29851
+ effective: LoggingEffectiveSchema,
29852
+ explicit: LoggingExplicitSchema,
29853
+ activeWindows: z.array(DiagnosticWindowSchema).readonly(),
29854
+ persisted: z.boolean()
29855
+ });
29396
29856
  var systemCapability = {
29397
29857
  name: "system",
29398
29858
  scope: "system",
@@ -29436,6 +29896,38 @@ var systemCapability = {
29436
29896
  detectSiteLocation: method(z.void(), SiteLocationStatusSchema, {
29437
29897
  kind: "mutation",
29438
29898
  auth: "admin"
29899
+ }),
29900
+ /**
29901
+ * Read the HTTP request census - which caller, from which address, with
29902
+ * which user-agent, invoked which tRPC procedure, and how often.
29903
+ *
29904
+ * Reading NEVER re-arms: re-arming clears the counts, which would throw
29905
+ * away exactly the numbers being asked for. A closed window may be read as
29906
+ * many times as the operator likes and always describes the same window.
29907
+ *
29908
+ * Admin-only: the rows carry source addresses and principal names.
29909
+ */
29910
+ getRequestCensus: method(z.void(), RequestCensusStatusSchema, { auth: "admin" }),
29911
+ /**
29912
+ * The logging settings document — levels and armed diagnostics — resolved
29913
+ * for `nodeId`, or for the cluster when `nodeId` is absent.
29914
+ *
29915
+ * Returns BOTH `effective` and `explicit`. See
29916
+ * {@link LoggingLevelLayerSchema} for why collapsing them is the defect.
29917
+ */
29918
+ getLoggingSettings: method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }),
29919
+ /**
29920
+ * Write the logging settings document. The ONLY write authority over log
29921
+ * levels and diagnostic windows — arming the request census went through
29922
+ * `system.setRequestCensus` until 2026-08-27 and no longer does, because
29923
+ * two writes that disagree about the same window is exactly the defect
29924
+ * this document exists to remove (D245).
29925
+ *
29926
+ * The patch MERGES: see {@link LoggingSettingsPatchSchema}.
29927
+ */
29928
+ setLoggingSettings: method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29929
+ kind: "mutation",
29930
+ auth: "admin"
29439
29931
  })
29440
29932
  },
29441
29933
  /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
@@ -30507,6 +30999,170 @@ var zoneRulesCapability = {
30507
30999
  durability: "restored"
30508
31000
  };
30509
31001
  /**
31002
+ * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
31003
+ * valutatore puro del suo FRONTE.
31004
+ *
31005
+ * Viveva dentro il builtin virtual-doorbell
31006
+ * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
31007
+ * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
31008
+ * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
31009
+ * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
31010
+ * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
31011
+ * SPOSTA qui e il doorbell la ri-esporta.
31012
+ *
31013
+ * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
31014
+ * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
31015
+ * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
31016
+ * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
31017
+ */
31018
+ /**
31019
+ * Known binary / switch source caps → the boolean slice field whose
31020
+ * false→true rise counts as ACTIVE. Every entry is "fire on active".
31021
+ * Sensors whose "active" reading is not a plain boolean (presence's string
31022
+ * state, connectivity's connected flag) are deliberately excluded — a
31023
+ * reconnect is not a doorbell press, and it is not a recording either.
31024
+ */
31025
+ var SOURCE_CAP_ACTIVE_FIELD = {
31026
+ contact: "entryOpen",
31027
+ binary: "on",
31028
+ switch: "on",
31029
+ motion: "detected",
31030
+ flood: "flooded",
31031
+ gas: "detected",
31032
+ smoke: "detected",
31033
+ "carbon-monoxide": "detected",
31034
+ vibration: "detected",
31035
+ tamper: "tampered"
31036
+ };
31037
+ /**
31038
+ * The same caps → the slice field carrying the ms-epoch timestamp of the
31039
+ * last transition. Every source cap MUST appear here (guarded by a spec):
31040
+ * without a transition timestamp the evaluator cannot tell a genuine rise
31041
+ * from a boot-time hydration when the FIRST slice it ever sees is already
31042
+ * active, and errs towards silence — swallowing the rise.
31043
+ *
31044
+ * These timestamps are UPSTREAM ones, not ingest ones: the Home Assistant
31045
+ * provider derives them from `state.last_changed`, so they survive our own
31046
+ * restarts and correctly read as "hours ago" for a state that has been
31047
+ * active for hours. `motion` names its rise timestamp `lastDetectedAt`.
31048
+ */
31049
+ var SOURCE_CAP_CHANGED_AT_FIELD = {
31050
+ contact: "lastChangedAt",
31051
+ binary: "lastChangedAt",
31052
+ switch: "lastChangedAt",
31053
+ motion: "lastDetectedAt",
31054
+ flood: "lastChangedAt",
31055
+ gas: "lastChangedAt",
31056
+ smoke: "lastChangedAt",
31057
+ "carbon-monoxide": "lastChangedAt",
31058
+ vibration: "lastChangedAt",
31059
+ tamper: "lastChangedAt"
31060
+ };
31061
+ /** Cap names whose presence in a device's bindings qualify it as a source. */
31062
+ var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
31063
+ /**
31064
+ * Device `type` values (from `DeviceType`) that can host a binary/switch
31065
+ * source cap. Used by the camera's `device-multiselect` picker as the
31066
+ * CLIENT-SIDE filter, alongside `SOURCE_CAPS`.
31067
+ *
31068
+ * Why types and not caps alone: the shared picker filters
31069
+ * `deviceManager.listAll` rows client-side, and those rows carry only the
31070
+ * device's advertised `features` — NOT its registered cap list. On the live
31071
+ * cluster binary sensors and switches advertise EMPTY features (features
31072
+ * mirror only a handful of caps like `motion-trigger`), so a caps-only
31073
+ * filter matched against `features` would list nothing (the very bug this
31074
+ * replaced, which relied on the now-empty `getAllBindings`). Matching by
31075
+ * `type` is the reliable client-side signal; the union with `SOURCE_CAPS`
31076
+ * still captures any device that DOES advertise a source-cap feature.
31077
+ * `sensor` covers contact/motion/flood/gas/smoke/CO/vibration/tamper,
31078
+ * `switch` covers switches, `control` covers generic binary actuators.
31079
+ */
31080
+ var SOURCE_DEVICE_TYPES = [
31081
+ "sensor",
31082
+ "switch",
31083
+ "control"
31084
+ ];
31085
+ /** True when a cap is a recognised binary/switch source. */
31086
+ function isSourceCap(capName) {
31087
+ return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
31088
+ }
31089
+ /** Extract the "active" boolean a source cap's slice carries, or null when
31090
+ * the cap is unknown or the field is missing / non-boolean. */
31091
+ function sliceActiveValue(capName, slice) {
31092
+ const field = SOURCE_CAP_ACTIVE_FIELD[capName];
31093
+ if (field === void 0) return null;
31094
+ const raw = slice[field];
31095
+ return typeof raw === "boolean" ? raw : null;
31096
+ }
31097
+ /** Ms-epoch transition timestamp a source cap's slice carries, or null when
31098
+ * it is absent, non-numeric or the zero "never observed" sentinel. */
31099
+ function sliceChangedAt(capName, slice) {
31100
+ const field = SOURCE_CAP_CHANGED_AT_FIELD[capName];
31101
+ if (field === void 0) return null;
31102
+ const raw = slice[field];
31103
+ if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return null;
31104
+ return raw;
31105
+ }
31106
+ /**
31107
+ * How recent a source's own transition timestamp must be for a FIRST
31108
+ * sighting that is already active to count as a genuine rise rather than a
31109
+ * hydration of long-standing state.
31110
+ */
31111
+ var DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = 3e4;
31112
+ /**
31113
+ * IL fronte. Puro: nessun orologio proprio, nessuna memoria — il chiamante
31114
+ * porta `prior`, `nowMs` e il proprio `startedAtMs`.
31115
+ *
31116
+ * Il caso della PRIMA slice già attiva è trattato esplicitamente e vale come
31117
+ * fronte solo se il timestamp UPSTREAM della transizione è posteriore a
31118
+ * `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
31119
+ * servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
31120
+ * stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
31121
+ * iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
31122
+ * adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
31123
+ * SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
31124
+ */
31125
+ function evaluateSensorEdge(input) {
31126
+ const value = sliceActiveValue(input.capName, input.slice);
31127
+ if (value === null) return {
31128
+ edge: "none",
31129
+ value: null,
31130
+ reason: isSourceCap(input.capName) ? "non-boolean-value" : "unknown-cap"
31131
+ };
31132
+ if (input.prior === void 0) {
31133
+ if (!value) return {
31134
+ edge: "none",
31135
+ value,
31136
+ reason: "baseline-seeded-inactive"
31137
+ };
31138
+ const changedAt = sliceChangedAt(input.capName, input.slice);
31139
+ const floor = Math.max(input.startedAtMs, input.nowMs - input.firstSightingFreshnessMs);
31140
+ if (changedAt === null || changedAt < floor) return {
31141
+ edge: "none",
31142
+ value,
31143
+ reason: "baseline-seeded-stale-active"
31144
+ };
31145
+ return {
31146
+ edge: "rising",
31147
+ value: true
31148
+ };
31149
+ }
31150
+ if (input.prior === value) return {
31151
+ edge: "none",
31152
+ value,
31153
+ reason: "no-change"
31154
+ };
31155
+ if (!value) return {
31156
+ edge: "none",
31157
+ value,
31158
+ reason: "falling-edge"
31159
+ };
31160
+ return {
31161
+ edge: "rising",
31162
+ value: true
31163
+ };
31164
+ }
31165
+ /**
30510
31166
  * Runtime defaults -- used by ConfigManager.get() for backward compatibility
30511
31167
  * until Plan B wires all runtime settings to the system_settings SQL table.
30512
31168
  *
@@ -30582,6 +31238,24 @@ var AccessoryKind = {
30582
31238
  PrivacyMask: DeviceRole.PrivacyMask
30583
31239
  };
30584
31240
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
31241
+ /**
31242
+ * THE derivation. One crop rectangle, one presence verdict — see D52 for why
31243
+ * this repo insists a derived value has exactly one implementation.
31244
+ *
31245
+ * `undefined` status ⇒ `sleeping`. A device with no slice has made no claim,
31246
+ * and the caller decides separately whether it is even battery-operated
31247
+ * (`DeviceFeature.BatteryOperated`); this function never answers that
31248
+ * question, only what a battery device is doing.
31249
+ */
31250
+ function deriveBatteryPresence(input) {
31251
+ const status = input.status;
31252
+ if (!status) return "sleeping";
31253
+ if (status.sleeping !== true) return "awake";
31254
+ const lastContactAt = status.lastContactAt;
31255
+ if (typeof lastContactAt !== "number" || lastContactAt <= 0) return "sleeping";
31256
+ const budget = input.unreachableAfterMs ?? 216e5;
31257
+ return input.nowMs - lastContactAt > budget ? "unreachable" : "sleeping";
31258
+ }
30585
31259
  /** Marker written to a declared integration's `info`. */
30586
31260
  var DECLARED_INTEGRATION_FIXED_KEY = "fixed";
30587
31261
  /**
@@ -30823,24 +31497,6 @@ var DeclaredDevices = class {
30823
31497
  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;
30824
31498
  new Set(Object.values(DeviceType));
30825
31499
  DeviceFeature.BatteryOperated;
30826
- /**
30827
- * THE derivation. One crop rectangle, one presence verdict — see D52 for why
30828
- * this repo insists a derived value has exactly one implementation.
30829
- *
30830
- * `undefined` status ⇒ `sleeping`. A device with no slice has made no claim,
30831
- * and the caller decides separately whether it is even battery-operated
30832
- * (`DeviceFeature.BatteryOperated`); this function never answers that
30833
- * question, only what a battery device is doing.
30834
- */
30835
- function deriveBatteryPresence(input) {
30836
- const status = input.status;
30837
- if (!status) return "sleeping";
30838
- if (status.sleeping !== true) return "awake";
30839
- const lastContactAt = status.lastContactAt;
30840
- if (typeof lastContactAt !== "number" || lastContactAt <= 0) return "sleeping";
30841
- const budget = input.unreachableAfterMs ?? 216e5;
30842
- return input.nowMs - lastContactAt > budget ? "unreachable" : "sleeping";
30843
- }
30844
31500
  /** Unwrap ZodNullable / ZodOptional / ZodDefault wrappers to reach the inner type.
30845
31501
  * Zod v4 exposes `.unwrap()` on all three wrapper classes. */
30846
31502
  function unwrap(schema) {
@@ -36291,6 +36947,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
36291
36947
  addonId: null,
36292
36948
  access: "create"
36293
36949
  },
36950
+ "system.getLoggingSettings": {
36951
+ capName: "system",
36952
+ capScope: "system",
36953
+ addonId: null,
36954
+ access: "view"
36955
+ },
36956
+ "system.getRequestCensus": {
36957
+ capName: "system",
36958
+ capScope: "system",
36959
+ addonId: null,
36960
+ access: "view"
36961
+ },
36294
36962
  "system.getRetentionConfig": {
36295
36963
  capName: "system",
36296
36964
  capScope: "system",
@@ -36321,6 +36989,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
36321
36989
  addonId: null,
36322
36990
  access: "view"
36323
36991
  },
36992
+ "system.setLoggingSettings": {
36993
+ capName: "system",
36994
+ capScope: "system",
36995
+ addonId: null,
36996
+ access: "create"
36997
+ },
36324
36998
  "system.setRetentionConfig": {
36325
36999
  capName: "system",
36326
37000
  capScope: "system",
@@ -37476,6 +38150,10 @@ Object.freeze({
37476
38150
  name: "deviceId",
37477
38151
  form: "single",
37478
38152
  optional: true
38153
+ }, {
38154
+ name: "deviceIds",
38155
+ form: "array",
38156
+ optional: true
37479
38157
  }],
37480
38158
  "fanControl.setDirection": [{
37481
38159
  name: "deviceId",
@@ -39366,7 +40044,38 @@ z.object({
39366
40044
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
39367
40045
  * reproduce that.
39368
40046
  */
39369
- tileBudgetMb: z.number().int().min(0).max(1024)
40047
+ tileBudgetMb: z.number().int().min(0).max(1024),
40048
+ /**
40049
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
40050
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
40051
+ * subject tiles, on frames that detected something.
40052
+ *
40053
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
40054
+ * containment is strict by design, so the native `keyFrame`, the detail
40055
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
40056
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
40057
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
40058
+ * frame-time after delivery, with the request only p50 367 ms behind it.
40059
+ *
40060
+ * Sizing, and why this is a budget and not a duration: a scene tile is
40061
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
40062
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
40063
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
40064
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
40065
+ * binds only through a detection burst, where it still covers well past the
40066
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
40067
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
40068
+ * whole shape exists to avoid.
40069
+ *
40070
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
40071
+ * subject tile, so one shared budget would let a busy camera's key frames
40072
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
40073
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
40074
+ * pre-existing behaviour, where a late full-frame request had nothing but the
40075
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
40076
+ * nothing.
40077
+ */
40078
+ sceneBudgetMb: z.number().int().min(0).max(1024)
39370
40079
  });
39371
40080
  /**
39372
40081
  * The values in force when the operator has set nothing.
@@ -39382,12 +40091,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
39382
40091
  budgetMb: 1024,
39383
40092
  activityMs: 15e3,
39384
40093
  tileBudgetMb: 64,
40094
+ sceneBudgetMb: 48,
39385
40095
  admission: "inferred"
39386
40096
  };
39387
40097
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
39388
40098
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
39389
40099
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
39390
40100
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
40101
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
39391
40102
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
39392
40103
  /**
39393
40104
  * The addon id as the REGISTRY, the wire and the durable stores spell it.
@@ -39559,4 +40270,4 @@ function enumerateInferenceDevices(hw) {
39559
40270
  return out;
39560
40271
  }
39561
40272
  //#endregion
39562
- export { metricsProviderCapability as $, dataStoreProviderCapability as A, asJsonObject as At, extractNestedAddonId as B, parseJsonObject as Bt, backupCapability as C, DEVICE_STATUS_METHOD as Ct, coreBlockAddonId as D, ReadinessRegistry as Dt, buildStreamParamsConfigSchema as E, DeviceType as Et, deviceStatusCapability as F, emitReadiness as Ft, isSameAddonId as G, sleep as Gt, isArrayOutputSchema as H, readinessKey as Ht, doorbellCapability as I, expandCapMethods as It, lifecycleJobSchema as J, isVoidInput as K, EventCategory as Kt, enumerateInferenceDevices as L, hydrateSchema as Lt, deriveBatteryPresence as M, asString as Mt, deviceManagerCapability as N, createEvent as Nt, coreBlockIdFromAddonId as O, ReadinessTimeoutError as Ot, deviceStateCapability as P, emitDownForOwnedCaps as Pt, looseSchema as Q, enumerateItemArrayFields as R, isDeviceConfigCap as Rt, authProviderCapability as S, DEVICE_SETTINGS_CONTRIBUTION_METHODS as St, batteryCapability as T, DeviceRole as Tt, isCollectionArrayMethod as U, resolveCapMount as Ut, filesystemBrowseCapability as V, parseJsonUnknown as Vt, isObjectInput as W, scopeKey as Wt, logDestinationCapability as X, localNetworkCapability as Y, logLevelAtMost as Z, UserRecordSchema as _, vectorDimFromBase64 as _t, CAP_NAMES_WITH_STATUS as a, resolveMethodAuth as at, addonWidgetsCapability as b, BaseAddon as bt, CoreBlockSchema as c, scopesAllowDeviceCap as ct, METHOD_ACCESS_MAP as d, snapshotCapability as dt, normalizeUnit as et, RUNTIME_DEFAULTS as f, storageCapability as ft, StorageMigrationJobSchema as g, userManagementCapability as gt, StorageLocationTypeSchema as h, streamQualityLabel as ht, BatteryStatusSchema as i, procedureAuthKey as it, decodeVectorBase64 as j, asNumber as jt, coreBlocksCapability as k, WELL_KNOWN_TAB_MAP as kt, DeclaredDevices as l, scoreRuntimes as lt, ScopedTokenSchema as m, storageProviderCapability as mt, AlertSchema as n, parseStreamParamsFormPatch as nt, CORE_BLOCKS_ADDON_ID as o, runtimeStatePolicyFor as ot, STREAM_PROFILE_META as p, storageMigrationCapability as pt, kebabToCamel as q, ApiKeyRecordSchema as r, platformProbeCapability as rt, CORE_BLOCK_ADDON_PREFIX as s, scopesAllowAddon as st, ALL_CAPABILITY_DEFINITIONS as t, objectInputDeclaresAddonId as tt, DeviceStatusSchema as u, settingsStoreCapability as ut, addonPagesCapability as v, vectorStoreCapability as vt, bareAddonId as w, DeviceFeature as wt, alertsCapability as x, DATAPLANE_SECRET_HEADER as xt, addonSettingsCapability as y, errMsg as yt, enumerateSchemaFields as z, nodePin as zt };
40273
+ export { kebabToCamel as $, buildStreamParamsConfigSchema as A, DeviceFeature as At, doorbellCapability as B, emitDownForOwnedCaps as Bt, addonSettingsCapability as C, vectorDimFromBase64 as Ct, backupCapability as D, DATAPLANE_SECRET_HEADER as Dt, authProviderCapability as E, BaseAddon as Et, decodeVectorBase64 as F, WELL_KNOWN_TAB_MAP as Ft, extractNestedAddonId as G, nodePin as Gt, enumerateItemArrayFields as H, expandCapMethods as Ht, deriveBatteryPresence as I, asJsonObject as It, isCollectionArrayMethod as J, readinessKey as Jt, filesystemBrowseCapability as K, parseJsonObject as Kt, deviceManagerCapability as L, asNumber as Lt, coreBlockIdFromAddonId as M, DeviceType as Mt, coreBlocksCapability as N, ReadinessRegistry as Nt, bareAddonId as O, DEVICE_SETTINGS_CONTRIBUTION_METHODS as Ot, dataStoreProviderCapability as P, ReadinessTimeoutError as Pt, isVoidInput as Q, EventCategory as Qt, deviceStateCapability as R, asString as Rt, addonPagesCapability as S, userManagementCapability as St, alertsCapability as T, errMsg as Tt, enumerateSchemaFields as U, hydrateSchema as Ut, enumerateInferenceDevices as V, emitReadiness as Vt, evaluateSensorEdge as W, isDeviceConfigCap as Wt, isSameAddonId as X, scopeKey as Xt, isObjectInput as Y, resolveCapMount as Yt, isSourceCap as Z, sleep as Zt, STREAM_PROFILE_META as _, snapshotCapability as _t, CAP_NAMES_WITH_STATUS as a, metricsProviderCapability as at, StorageMigrationJobSchema as b, storageProviderCapability as bt, CoreBlockSchema as c, parseStreamParamsFormPatch as ct, DeviceStatusSchema as d, resolveMethodAuth as dt, lifecycleJobSchema as et, LOG_LEVEL_RANK as f, runtimeStatePolicyFor as ft, SOURCE_DEVICE_TYPES as g, settingsStoreCapability as gt, SOURCE_CAPS as h, scoreRuntimes as ht, BatteryStatusSchema as i, looseSchema as it, coreBlockAddonId as j, DeviceRole as jt, batteryCapability as k, DEVICE_STATUS_METHOD as kt, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS as l, platformProbeCapability as lt, RUNTIME_DEFAULTS as m, scopesAllowDeviceCap as mt, AlertSchema as n, logDestinationCapability as nt, CORE_BLOCKS_ADDON_ID as o, normalizeUnit as ot, METHOD_ACCESS_MAP as p, scopesAllowAddon as pt, isArrayOutputSchema as q, parseJsonUnknown as qt, ApiKeyRecordSchema as r, logLevelAtMost as rt, CORE_BLOCK_ADDON_PREFIX as s, objectInputDeclaresAddonId as st, ALL_CAPABILITY_DEFINITIONS as t, localNetworkCapability as tt, DeclaredDevices as u, procedureAuthKey as ut, ScopedTokenSchema as v, storageCapability as vt, addonWidgetsCapability as w, vectorStoreCapability as wt, UserRecordSchema as x, streamQualityLabel as xt, StorageLocationTypeSchema as y, storageMigrationCapability as yt, deviceStatusCapability as z, createEvent as zt };