@camstack/system 1.2.141 → 1.2.143

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 (60) 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-BNhvXrQk.js → dist-CQs1b7uh.js} +838 -78
  49. package/dist/{dist-6mn3LQvB.mjs → dist-CVuVKA-O.mjs} +803 -79
  50. package/dist/index.d.ts +3 -0
  51. package/dist/index.js +127 -3
  52. package/dist/index.mjs +124 -4
  53. package/dist/logging/log-manager.d.ts +16 -0
  54. package/dist/logging/logging-gate.d.ts +32 -0
  55. package/dist/logging/logging-gate.singleton.d.ts +5 -0
  56. package/dist/{manifest-python-deps-DBQarwp9.js → manifest-python-deps-B_mCU6gz.js} +25 -2
  57. package/dist/{manifest-python-deps-D3zYlMEa.mjs → manifest-python-deps-BuhBXCg0.mjs} +25 -2
  58. package/dist/{retired-settings-keys-SYwVv_Ym.mjs → retired-settings-keys-DnMYSIEr.mjs} +1 -1
  59. package/dist/{retired-settings-keys-DVgdWTd7.js → retired-settings-keys-Dvei9nhG.js} +1 -1
  60. 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",
@@ -13849,7 +13919,23 @@ var NcHistoryEntrySchema = z.object({
13849
13919
  updatedAt: z.number(),
13850
13920
  /** Failure detail — present on a `dead` row. */
13851
13921
  error: z.string().optional(),
13852
- subject: NcHistorySubjectSchema
13922
+ subject: NcHistorySubjectSchema,
13923
+ /**
13924
+ * Ids of the artefacts (still, then gif, then clip) this row's successful
13925
+ * delivery indexed in the artefact library — a REFERENCE, never the bytes
13926
+ * (an artefact is often megabytes; this row is durable JSON rewritten on
13927
+ * every delivery attempt). Absent on a row still pending/dead, a row
13928
+ * delivered before this field shipped, or a wiring with no artefact index.
13929
+ *
13930
+ * Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
13931
+ * outlives any one URL's TTL, so a caller mints a fresh link on demand
13932
+ * rather than trusting one frozen at delivery time. `resolveArtifactUrl`
13933
+ * also answers `null` for an id whose artefact has since expired past the
13934
+ * retained shelf's own age bound — the degrade a caller (the Home
13935
+ * Assistant export) must render as "no image right now", never as a
13936
+ * broken link.
13937
+ */
13938
+ artifactIds: z.array(z.string().min(1)).optional()
13853
13939
  });
13854
13940
  /**
13855
13941
  * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
@@ -14138,6 +14224,20 @@ var notificationRulesCapability = {
14138
14224
  */
14139
14225
  getHistory: method(z.object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), z.object({ entries: z.array(NcHistoryEntrySchema) }), { auth: "admin" }),
14140
14226
  /**
14227
+ * Mint a fresh, externally-reachable URL for one artefact a history row
14228
+ * named in {@link NcHistoryEntrySchema.shape.artifactIds} — the SAME
14229
+ * signed-link mechanism the dispatcher uses to attach media to an
14230
+ * outgoing notification (one derivation; this never re-implements it).
14231
+ *
14232
+ * `url: null` on THREE causes a caller must treat identically ("no image
14233
+ * right now", never a broken link): the id is unknown, its artefact has
14234
+ * expired past the retained shelf's own age bound, or this install has no
14235
+ * externally-reachable base URL. A caller that received a URL on a
14236
+ * previous call and now gets `null` must stop showing it — a link that
14237
+ * worked five minutes ago is not proof it works now.
14238
+ */
14239
+ resolveArtifactUrl: method(z.object({ artifactId: z.string().min(1) }), z.object({ url: z.string().nullable() }), { auth: "admin" }),
14240
+ /**
14141
14241
  * Snooze windows currently in effect, plus any whose digest has not yet
14142
14242
  * gone out. `caller: 'required'`: a user sees their OWN windows and the
14143
14243
  * global ones that silence them, never another person's private silence.
@@ -21066,7 +21166,7 @@ var lifecycleJobSchema = z.object({
21066
21166
  * `useAddonsOnAddonLogs`, etc. flow through the same codegen pipeline
21067
21167
  * as every other cap.
21068
21168
  */
21069
- var LogLevelSchema$1 = z.enum([
21169
+ var LogLevelSchema$2 = z.enum([
21070
21170
  "debug",
21071
21171
  "info",
21072
21172
  "warn",
@@ -21293,7 +21393,7 @@ var addonsCapability = {
21293
21393
  getLogs: method(z.object({
21294
21394
  addonId: z.string(),
21295
21395
  limit: z.number().min(1).max(500).default(100),
21296
- level: LogLevelSchema$1.optional()
21396
+ level: LogLevelSchema$2.optional()
21297
21397
  }), z.array(LogQueryEntrySchema)),
21298
21398
  listPackages: method(z.void(), z.array(InstalledPackageSchema).readonly()),
21299
21399
  installPackage: method(z.object({
@@ -21531,7 +21631,7 @@ var addonsCapability = {
21531
21631
  }),
21532
21632
  onAddonLogs: method(z.object({
21533
21633
  addonId: z.string(),
21534
- level: LogLevelSchema$1.optional()
21634
+ level: LogLevelSchema$2.optional()
21535
21635
  }), LogStreamEntrySchema, { kind: "subscription" })
21536
21636
  },
21537
21637
  /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
@@ -23373,6 +23473,35 @@ var FaceFilterEnum = z.enum([
23373
23473
  "identified",
23374
23474
  "all"
23375
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
+ });
23376
23505
  var MediaFileLiteSchema$1 = z.object({
23377
23506
  key: z.string(),
23378
23507
  kind: z.string(),
@@ -23430,24 +23559,72 @@ includeCrops: z.boolean().optional() }).optional(), z.array(IdentitySchema).read
23430
23559
  auth: "admin"
23431
23560
  }),
23432
23561
  listRecentFaces: method(z.object({
23433
- /** 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
+ */
23434
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(),
23435
23586
  limit: z.number().int().positive().optional(),
23436
23587
  filter: FaceFilterEnum.optional(),
23437
23588
  /**
23438
- * Inline the base64 crop on every row. Default `true` — the existing
23439
- * 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.
23440
23602
  *
23441
- * Set `false` once the caller renders {@link FaceInfo.cropUrl}: that
23442
- * drops ~2.87 MiB per 500-row page to a few KiB of metadata and lets
23443
- * the browser cache the images.
23603
+ * See {@link FaceSortFieldEnum} for what a row with no suggestion
23604
+ * does under `'suggestionConfidence'`.
23444
23605
  *
23445
- * **This is an INPUT field, so it does not reach the addon until the
23446
- * next train.** The hub router validates cap inputs against its own
23447
- * compiled Zod, which strips a key it does not know verified today
23448
- * on the OUTPUT side, where an additive field DOES arrive immediately
23449
- * (`Track.hasFace`). Until the train ships, sending `false` is
23450
- * 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.
23451
23628
  */
23452
23629
  includeCrops: z.boolean().optional()
23453
23630
  }).optional(), z.array(FaceInfoSchema).readonly()),
@@ -23496,13 +23673,39 @@ includeCrops: z.boolean().optional() }).optional(), z.array(IdentitySchema).read
23496
23673
  suggestFaceClusters: method(z.object({
23497
23674
  threshold: z.number().min(0).max(1).optional(),
23498
23675
  minClusterSize: z.number().int().min(2).optional(),
23499
- limit: z.number().int().positive().optional()
23500
- }).optional(), z.array(z.object({
23501
- faceIds: z.array(z.string()).readonly(),
23502
- representativeFaceId: z.string(),
23503
- size: z.number().int(),
23504
- cohesion: z.number()
23505
- })).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())
23506
23709
  }
23507
23710
  };
23508
23711
  /**
@@ -27773,6 +27976,39 @@ var ReadGopBytesResultSchema = z.object({
27773
27976
  /** Media ms the returned fragment covers. */
27774
27977
  gopDurMs: z.number()
27775
27978
  });
27979
+ /**
27980
+ * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
27981
+ * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
27982
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
27983
+ * a replay needs several seconds of native pixels, not one frame.
27984
+ *
27985
+ * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
27986
+ * is `false` when the returned bytes were cut short by the read's own safety
27987
+ * byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
27988
+ * silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
27989
+ * degradation: a window whose end falls past the covering segment would need
27990
+ * bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
27991
+ * not one standalone-demuxable stream — the caller's answer is to request a
27992
+ * shorter window or one aligned to a single segment, not to receive spliced
27993
+ * bytes nothing has proven decodable.
27994
+ */
27995
+ var ReadWindowBytesResultSchema = z.discriminatedUnion("kind", [z.object({
27996
+ kind: z.literal("ok"),
27997
+ data: z.instanceof(Uint8Array),
27998
+ /** Absolute epoch ms of the returned bytes' first sample — at or before
27999
+ * the requested `fromMs` (anchored on the nearest keyframe). */
28000
+ gopStartMs: z.number(),
28001
+ /** Media ms the returned bytes cover, from `gopStartMs`. */
28002
+ gopDurMs: z.number(),
28003
+ /** `false` ⇒ the safety byte cap cut the read short before it reached
28004
+ * the requested `toMs`; the caller got fewer frames than asked for. */
28005
+ reachesRequestedEnd: z.boolean()
28006
+ }), z.object({
28007
+ kind: z.literal("spans-multiple-segments"),
28008
+ /** Where the covering segment's own footage runs out — informational,
28009
+ * not a retry hint (retrying the same window would refuse again). */
28010
+ segmentEndMs: z.number()
28011
+ })]);
27776
28012
  var recordingCapability = {
27777
28013
  name: "recording",
27778
28014
  scope: "system",
@@ -27852,6 +28088,21 @@ var recordingCapability = {
27852
28088
  kind: "query",
27853
28089
  auth: "admin"
27854
28090
  }),
28091
+ /** Read a WINDOW `[fromMs, toMs)` of segment `startMs`, by mfra byte
28092
+ * range — the multi-GOP twin of `readGopBytes`. Refuses (does not
28093
+ * degrade) when the window runs past the covering segment. Used by the
28094
+ * replay clip's `recording` source to fetch several seconds of native
28095
+ * footage for its single ffmpeg decode pass. */
28096
+ readWindowBytes: method(z.object({
28097
+ deviceId: z.number(),
28098
+ profile: z.string(),
28099
+ startMs: z.number(),
28100
+ fromMs: z.number(),
28101
+ toMs: z.number()
28102
+ }), ReadWindowBytesResultSchema, {
28103
+ kind: "query",
28104
+ auth: "admin"
28105
+ }),
27855
28106
  setDeviceConfig: method(z.object({
27856
28107
  deviceId: z.number(),
27857
28108
  config: RecordingConfigSchema
@@ -29315,6 +29566,211 @@ var SetSiteLocationInputSchema = z.object({
29315
29566
  latitude: z.number().min(-90).max(90),
29316
29567
  longitude: z.number().min(-180).max(180)
29317
29568
  }).nullable();
29569
+ /**
29570
+ * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
29571
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29572
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29573
+ * already prints - never a token, never an `Authorization` header.
29574
+ */
29575
+ var RequestCensusGroupSchema = z.object({
29576
+ procedure: z.string(),
29577
+ userAgent: z.string(),
29578
+ ip: z.string(),
29579
+ principal: z.string(),
29580
+ calls: z.number(),
29581
+ perMin: z.number()
29582
+ });
29583
+ /**
29584
+ * A procedure's TOTAL over the window, across every caller.
29585
+ *
29586
+ * This block, not the group list, is what answers "did these calls arrive over
29587
+ * HTTP at all". A total far BELOW what a store-side census counted over the
29588
+ * same window excludes the HTTP plane, which is a result, not a failure.
29589
+ */
29590
+ var RequestCensusProcedureSchema = z.object({
29591
+ procedure: z.string(),
29592
+ calls: z.number(),
29593
+ perMin: z.number()
29594
+ });
29595
+ /**
29596
+ * The census as an operator sees it.
29597
+ *
29598
+ * `persisted` is the honest answer to "will this survive the restart I am
29599
+ * about to do": the arm deadline is written to `system-settings` so a window
29600
+ * armed now can measure the NEXT boot, and a write that failed must not look
29601
+ * like one that succeeded.
29602
+ */
29603
+ var RequestCensusStatusSchema = z.object({
29604
+ armed: z.boolean(),
29605
+ /** How long the current - or just-closed - window collected, in ms. */
29606
+ elapsedMs: z.number(),
29607
+ /** The window actually armed, after the server clamped the request. */
29608
+ windowMs: z.number(),
29609
+ /** Epoch ms the window closes at. 0 when disarmed. */
29610
+ armedUntilMs: z.number(),
29611
+ httpRequests: z.number(),
29612
+ batchedRequests: z.number(),
29613
+ /**
29614
+ * Procedure invocations. Higher than `httpRequests` whenever tRPC batching
29615
+ * is in play (`?batch=1` carries several procedures in one request); this is
29616
+ * the number comparable with a store-side call count.
29617
+ */
29618
+ procedureCalls: z.number(),
29619
+ /**
29620
+ * tRPC WebSocket connections opened during the window. NOT calls - the WS
29621
+ * transport resolves one context per connection - but the number that says
29622
+ * whether a plane this census cannot see was busy while HTTP was quiet.
29623
+ */
29624
+ wsConnections: z.number(),
29625
+ distinctGroups: z.number(),
29626
+ /** Calls counted in the totals whose group attribution was shed at the
29627
+ * cardinality bound. */
29628
+ unattributedCalls: z.number(),
29629
+ procedures: z.array(RequestCensusProcedureSchema).readonly(),
29630
+ groups: z.array(RequestCensusGroupSchema).readonly()
29631
+ }).extend({ persisted: z.boolean() });
29632
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
29633
+ var LogLevelSchema$1 = z.enum([
29634
+ "debug",
29635
+ "info",
29636
+ "warn",
29637
+ "error"
29638
+ ]);
29639
+ /**
29640
+ * The diagnostics that can be ARMED for a window. Exactly one today.
29641
+ *
29642
+ * A diagnostic is anything whose cost is only worth paying while a question is
29643
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
29644
+ */
29645
+ var DiagnosticIdSchema = z.enum(["request-census"]);
29646
+ /**
29647
+ * The layers of the level hierarchy, general → specific. The most specific
29648
+ * layer that carries an explicit value wins.
29649
+ *
29650
+ * `component` is DECLARED and not yet resolvable: the per-component channels
29651
+ * are a later slice of the same plan, and a `levelSource` enum that has to
29652
+ * grow later would force every consumer of this document to change with it.
29653
+ * Nothing returns `component` today.
29654
+ */
29655
+ var LoggingScopeKindSchema = z.enum([
29656
+ "cluster",
29657
+ "node",
29658
+ "component"
29659
+ ]);
29660
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
29661
+ var LoggingLevelSourceSchema = z.enum([
29662
+ "default",
29663
+ "cluster",
29664
+ "node",
29665
+ "component"
29666
+ ]);
29667
+ /**
29668
+ * One layer of the hierarchy as it actually STANDS.
29669
+ *
29670
+ * `level: null` is the whole reason this array is returned: it is the
29671
+ * difference between "this node is at `info` because I decided it" and
29672
+ * "...because it inherits". An operator who clears an override believing they
29673
+ * are clearing an inherited value has been handed the same defect as the two
29674
+ * contradicting knobs this document exists to remove, moved one floor up.
29675
+ */
29676
+ var LoggingLevelLayerSchema = z.object({
29677
+ scope: LoggingScopeKindSchema,
29678
+ /** The node this layer speaks for; `null` on the cluster layer. */
29679
+ nodeId: z.string().nullable(),
29680
+ /** Explicitly set here, or `null` when this layer inherits. */
29681
+ level: LogLevelSchema$1.nullable()
29682
+ });
29683
+ /** What a line is judged against, and WHICH layer decided it. */
29684
+ var LoggingEffectiveSchema = z.object({
29685
+ level: LogLevelSchema$1,
29686
+ levelSource: LoggingLevelSourceSchema
29687
+ });
29688
+ /** Every layer, general → specific. Never collapsed into the effective value. */
29689
+ var LoggingExplicitSchema = z.object({ layers: z.array(LoggingLevelLayerSchema).readonly() });
29690
+ /**
29691
+ * An armed diagnostic, with its DEADLINE.
29692
+ *
29693
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
29694
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
29695
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
29696
+ * `armed` is false — a window is never reported as slightly expired.
29697
+ */
29698
+ var DiagnosticWindowSchema = z.object({
29699
+ id: DiagnosticIdSchema,
29700
+ armed: z.boolean(),
29701
+ /** Epoch ms the window closes at. 0 when disarmed. */
29702
+ armedUntilMs: z.number(),
29703
+ /** Ms left before it expires on its own. 0 when disarmed. */
29704
+ remainingMs: z.number(),
29705
+ /** Whether the stored deadline is the one the live diagnostic is running —
29706
+ * i.e. whether this window would survive a restart. */
29707
+ persisted: z.boolean()
29708
+ });
29709
+ /**
29710
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
29711
+ * server — there is no maximum here on purpose: a bound repeated in a schema
29712
+ * is a second knob that disagrees with the first the day one of them moves.
29713
+ */
29714
+ var DiagnosticWindowPatchSchema = z.object({
29715
+ id: DiagnosticIdSchema,
29716
+ armMs: z.number().int().min(0),
29717
+ /** Cadence of the diagnostic's aggregated report line. Clamped by the server. */
29718
+ reportEveryMs: z.number().int().positive().optional()
29719
+ });
29720
+ /**
29721
+ * A PATCH, and patches MERGE.
29722
+ *
29723
+ * A field absent from the patch is left exactly as it was — arming a
29724
+ * diagnostic never resets a level, and setting a level never disarms a window.
29725
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
29726
+ * `setAll` already merges, and rebuilding the object is how an absent field
29727
+ * turns into an erased one.
29728
+ */
29729
+ var LoggingSettingsPatchSchema = z.object({
29730
+ /**
29731
+ * Absent leaves the level untouched. `null` CLEARS the explicit value at the
29732
+ * addressed scope so it inherits again. A value sets it.
29733
+ */
29734
+ level: LogLevelSchema$1.nullable().optional(),
29735
+ /**
29736
+ * Only the diagnostics NAMED here change. An armed window that is not listed
29737
+ * keeps running — a patch is never a full replacement.
29738
+ */
29739
+ diagnostics: z.array(DiagnosticWindowPatchSchema).readonly().optional()
29740
+ });
29741
+ /**
29742
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
29743
+ *
29744
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
29745
+ * input — the generated router strips it and uses it to resolve the PROVIDER
29746
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
29747
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
29748
+ * by an agent that holds no cluster document at all. The hub is the single
29749
+ * authority over the whole hierarchy and answers for every layer, so the
29750
+ * layer selector needs a name the transport does not already own.
29751
+ */
29752
+ var GetLoggingSettingsInputSchema = z.object({ scopeNodeId: z.string().optional() });
29753
+ var SetLoggingSettingsInputSchema = z.object({
29754
+ scopeNodeId: z.string().optional(),
29755
+ patch: LoggingSettingsPatchSchema
29756
+ });
29757
+ /**
29758
+ * The whole document, as read and as returned after every write.
29759
+ *
29760
+ * `persisted: false` means the settings store could not be read or written.
29761
+ * The in-memory mirror still governs behaviour and is unchanged by the
29762
+ * failure — a read that fails neither switches a level nor disarms a window
29763
+ * (D49) — but the operator is told that what they are looking at would not
29764
+ * survive a restart.
29765
+ */
29766
+ var LoggingSettingsStateSchema = z.object({
29767
+ /** The layer this document was read at. `null` = the cluster layer. */
29768
+ scopeNodeId: z.string().nullable(),
29769
+ effective: LoggingEffectiveSchema,
29770
+ explicit: LoggingExplicitSchema,
29771
+ activeWindows: z.array(DiagnosticWindowSchema).readonly(),
29772
+ persisted: z.boolean()
29773
+ });
29318
29774
  var systemCapability = {
29319
29775
  name: "system",
29320
29776
  scope: "system",
@@ -29358,6 +29814,38 @@ var systemCapability = {
29358
29814
  detectSiteLocation: method(z.void(), SiteLocationStatusSchema, {
29359
29815
  kind: "mutation",
29360
29816
  auth: "admin"
29817
+ }),
29818
+ /**
29819
+ * Read the HTTP request census - which caller, from which address, with
29820
+ * which user-agent, invoked which tRPC procedure, and how often.
29821
+ *
29822
+ * Reading NEVER re-arms: re-arming clears the counts, which would throw
29823
+ * away exactly the numbers being asked for. A closed window may be read as
29824
+ * many times as the operator likes and always describes the same window.
29825
+ *
29826
+ * Admin-only: the rows carry source addresses and principal names.
29827
+ */
29828
+ getRequestCensus: method(z.void(), RequestCensusStatusSchema, { auth: "admin" }),
29829
+ /**
29830
+ * The logging settings document — levels and armed diagnostics — resolved
29831
+ * for `nodeId`, or for the cluster when `nodeId` is absent.
29832
+ *
29833
+ * Returns BOTH `effective` and `explicit`. See
29834
+ * {@link LoggingLevelLayerSchema} for why collapsing them is the defect.
29835
+ */
29836
+ getLoggingSettings: method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }),
29837
+ /**
29838
+ * Write the logging settings document. The ONLY write authority over log
29839
+ * levels and diagnostic windows — arming the request census went through
29840
+ * `system.setRequestCensus` until 2026-08-27 and no longer does, because
29841
+ * two writes that disagree about the same window is exactly the defect
29842
+ * this document exists to remove (D245).
29843
+ *
29844
+ * The patch MERGES: see {@link LoggingSettingsPatchSchema}.
29845
+ */
29846
+ setLoggingSettings: method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29847
+ kind: "mutation",
29848
+ auth: "admin"
29361
29849
  })
29362
29850
  },
29363
29851
  /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
@@ -30429,6 +30917,170 @@ var zoneRulesCapability = {
30429
30917
  durability: "restored"
30430
30918
  };
30431
30919
  /**
30920
+ * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
30921
+ * valutatore puro del suo FRONTE.
30922
+ *
30923
+ * Viveva dentro il builtin virtual-doorbell
30924
+ * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
30925
+ * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
30926
+ * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
30927
+ * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
30928
+ * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
30929
+ * SPOSTA qui e il doorbell la ri-esporta.
30930
+ *
30931
+ * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
30932
+ * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
30933
+ * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
30934
+ * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
30935
+ */
30936
+ /**
30937
+ * Known binary / switch source caps → the boolean slice field whose
30938
+ * false→true rise counts as ACTIVE. Every entry is "fire on active".
30939
+ * Sensors whose "active" reading is not a plain boolean (presence's string
30940
+ * state, connectivity's connected flag) are deliberately excluded — a
30941
+ * reconnect is not a doorbell press, and it is not a recording either.
30942
+ */
30943
+ var SOURCE_CAP_ACTIVE_FIELD = {
30944
+ contact: "entryOpen",
30945
+ binary: "on",
30946
+ switch: "on",
30947
+ motion: "detected",
30948
+ flood: "flooded",
30949
+ gas: "detected",
30950
+ smoke: "detected",
30951
+ "carbon-monoxide": "detected",
30952
+ vibration: "detected",
30953
+ tamper: "tampered"
30954
+ };
30955
+ /**
30956
+ * The same caps → the slice field carrying the ms-epoch timestamp of the
30957
+ * last transition. Every source cap MUST appear here (guarded by a spec):
30958
+ * without a transition timestamp the evaluator cannot tell a genuine rise
30959
+ * from a boot-time hydration when the FIRST slice it ever sees is already
30960
+ * active, and errs towards silence — swallowing the rise.
30961
+ *
30962
+ * These timestamps are UPSTREAM ones, not ingest ones: the Home Assistant
30963
+ * provider derives them from `state.last_changed`, so they survive our own
30964
+ * restarts and correctly read as "hours ago" for a state that has been
30965
+ * active for hours. `motion` names its rise timestamp `lastDetectedAt`.
30966
+ */
30967
+ var SOURCE_CAP_CHANGED_AT_FIELD = {
30968
+ contact: "lastChangedAt",
30969
+ binary: "lastChangedAt",
30970
+ switch: "lastChangedAt",
30971
+ motion: "lastDetectedAt",
30972
+ flood: "lastChangedAt",
30973
+ gas: "lastChangedAt",
30974
+ smoke: "lastChangedAt",
30975
+ "carbon-monoxide": "lastChangedAt",
30976
+ vibration: "lastChangedAt",
30977
+ tamper: "lastChangedAt"
30978
+ };
30979
+ /** Cap names whose presence in a device's bindings qualify it as a source. */
30980
+ var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
30981
+ /**
30982
+ * Device `type` values (from `DeviceType`) that can host a binary/switch
30983
+ * source cap. Used by the camera's `device-multiselect` picker as the
30984
+ * CLIENT-SIDE filter, alongside `SOURCE_CAPS`.
30985
+ *
30986
+ * Why types and not caps alone: the shared picker filters
30987
+ * `deviceManager.listAll` rows client-side, and those rows carry only the
30988
+ * device's advertised `features` — NOT its registered cap list. On the live
30989
+ * cluster binary sensors and switches advertise EMPTY features (features
30990
+ * mirror only a handful of caps like `motion-trigger`), so a caps-only
30991
+ * filter matched against `features` would list nothing (the very bug this
30992
+ * replaced, which relied on the now-empty `getAllBindings`). Matching by
30993
+ * `type` is the reliable client-side signal; the union with `SOURCE_CAPS`
30994
+ * still captures any device that DOES advertise a source-cap feature.
30995
+ * `sensor` covers contact/motion/flood/gas/smoke/CO/vibration/tamper,
30996
+ * `switch` covers switches, `control` covers generic binary actuators.
30997
+ */
30998
+ var SOURCE_DEVICE_TYPES = [
30999
+ "sensor",
31000
+ "switch",
31001
+ "control"
31002
+ ];
31003
+ /** True when a cap is a recognised binary/switch source. */
31004
+ function isSourceCap(capName) {
31005
+ return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
31006
+ }
31007
+ /** Extract the "active" boolean a source cap's slice carries, or null when
31008
+ * the cap is unknown or the field is missing / non-boolean. */
31009
+ function sliceActiveValue(capName, slice) {
31010
+ const field = SOURCE_CAP_ACTIVE_FIELD[capName];
31011
+ if (field === void 0) return null;
31012
+ const raw = slice[field];
31013
+ return typeof raw === "boolean" ? raw : null;
31014
+ }
31015
+ /** Ms-epoch transition timestamp a source cap's slice carries, or null when
31016
+ * it is absent, non-numeric or the zero "never observed" sentinel. */
31017
+ function sliceChangedAt(capName, slice) {
31018
+ const field = SOURCE_CAP_CHANGED_AT_FIELD[capName];
31019
+ if (field === void 0) return null;
31020
+ const raw = slice[field];
31021
+ if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return null;
31022
+ return raw;
31023
+ }
31024
+ /**
31025
+ * How recent a source's own transition timestamp must be for a FIRST
31026
+ * sighting that is already active to count as a genuine rise rather than a
31027
+ * hydration of long-standing state.
31028
+ */
31029
+ var DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = 3e4;
31030
+ /**
31031
+ * IL fronte. Puro: nessun orologio proprio, nessuna memoria — il chiamante
31032
+ * porta `prior`, `nowMs` e il proprio `startedAtMs`.
31033
+ *
31034
+ * Il caso della PRIMA slice già attiva è trattato esplicitamente e vale come
31035
+ * fronte solo se il timestamp UPSTREAM della transizione è posteriore a
31036
+ * `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
31037
+ * servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
31038
+ * stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
31039
+ * iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
31040
+ * adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
31041
+ * SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
31042
+ */
31043
+ function evaluateSensorEdge(input) {
31044
+ const value = sliceActiveValue(input.capName, input.slice);
31045
+ if (value === null) return {
31046
+ edge: "none",
31047
+ value: null,
31048
+ reason: isSourceCap(input.capName) ? "non-boolean-value" : "unknown-cap"
31049
+ };
31050
+ if (input.prior === void 0) {
31051
+ if (!value) return {
31052
+ edge: "none",
31053
+ value,
31054
+ reason: "baseline-seeded-inactive"
31055
+ };
31056
+ const changedAt = sliceChangedAt(input.capName, input.slice);
31057
+ const floor = Math.max(input.startedAtMs, input.nowMs - input.firstSightingFreshnessMs);
31058
+ if (changedAt === null || changedAt < floor) return {
31059
+ edge: "none",
31060
+ value,
31061
+ reason: "baseline-seeded-stale-active"
31062
+ };
31063
+ return {
31064
+ edge: "rising",
31065
+ value: true
31066
+ };
31067
+ }
31068
+ if (input.prior === value) return {
31069
+ edge: "none",
31070
+ value,
31071
+ reason: "no-change"
31072
+ };
31073
+ if (!value) return {
31074
+ edge: "none",
31075
+ value,
31076
+ reason: "falling-edge"
31077
+ };
31078
+ return {
31079
+ edge: "rising",
31080
+ value: true
31081
+ };
31082
+ }
31083
+ /**
30432
31084
  * Runtime defaults -- used by ConfigManager.get() for backward compatibility
30433
31085
  * until Plan B wires all runtime settings to the system_settings SQL table.
30434
31086
  *
@@ -30504,6 +31156,24 @@ var AccessoryKind = {
30504
31156
  PrivacyMask: DeviceRole.PrivacyMask
30505
31157
  };
30506
31158
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
31159
+ /**
31160
+ * THE derivation. One crop rectangle, one presence verdict — see D52 for why
31161
+ * this repo insists a derived value has exactly one implementation.
31162
+ *
31163
+ * `undefined` status ⇒ `sleeping`. A device with no slice has made no claim,
31164
+ * and the caller decides separately whether it is even battery-operated
31165
+ * (`DeviceFeature.BatteryOperated`); this function never answers that
31166
+ * question, only what a battery device is doing.
31167
+ */
31168
+ function deriveBatteryPresence(input) {
31169
+ const status = input.status;
31170
+ if (!status) return "sleeping";
31171
+ if (status.sleeping !== true) return "awake";
31172
+ const lastContactAt = status.lastContactAt;
31173
+ if (typeof lastContactAt !== "number" || lastContactAt <= 0) return "sleeping";
31174
+ const budget = input.unreachableAfterMs ?? 216e5;
31175
+ return input.nowMs - lastContactAt > budget ? "unreachable" : "sleeping";
31176
+ }
30507
31177
  /** Marker written to a declared integration's `info`. */
30508
31178
  var DECLARED_INTEGRATION_FIXED_KEY = "fixed";
30509
31179
  /**
@@ -30745,24 +31415,6 @@ var DeclaredDevices = class {
30745
31415
  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;
30746
31416
  new Set(Object.values(DeviceType));
30747
31417
  DeviceFeature.BatteryOperated;
30748
- /**
30749
- * THE derivation. One crop rectangle, one presence verdict — see D52 for why
30750
- * this repo insists a derived value has exactly one implementation.
30751
- *
30752
- * `undefined` status ⇒ `sleeping`. A device with no slice has made no claim,
30753
- * and the caller decides separately whether it is even battery-operated
30754
- * (`DeviceFeature.BatteryOperated`); this function never answers that
30755
- * question, only what a battery device is doing.
30756
- */
30757
- function deriveBatteryPresence(input) {
30758
- const status = input.status;
30759
- if (!status) return "sleeping";
30760
- if (status.sleeping !== true) return "awake";
30761
- const lastContactAt = status.lastContactAt;
30762
- if (typeof lastContactAt !== "number" || lastContactAt <= 0) return "sleeping";
30763
- const budget = input.unreachableAfterMs ?? 216e5;
30764
- return input.nowMs - lastContactAt > budget ? "unreachable" : "sleeping";
30765
- }
30766
31418
  /** Unwrap ZodNullable / ZodOptional / ZodDefault wrappers to reach the inner type.
30767
31419
  * Zod v4 exposes `.unwrap()` on all three wrapper classes. */
30768
31420
  function unwrap(schema) {
@@ -33957,6 +34609,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
33957
34609
  addonId: null,
33958
34610
  access: "view"
33959
34611
  },
34612
+ "notificationRules.resolveArtifactUrl": {
34613
+ capName: "notification-rules",
34614
+ capScope: "system",
34615
+ addonId: null,
34616
+ access: "view"
34617
+ },
33960
34618
  "notificationRules.setAlarmConfig": {
33961
34619
  capName: "notification-rules",
33962
34620
  capScope: "system",
@@ -35361,6 +36019,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
35361
36019
  addonId: null,
35362
36020
  access: "view"
35363
36021
  },
36022
+ "recording.readWindowBytes": {
36023
+ capName: "recording",
36024
+ capScope: "system",
36025
+ addonId: null,
36026
+ access: "view"
36027
+ },
35364
36028
  "recording.refreshStorageLocationsForMigration": {
35365
36029
  capName: "recording",
35366
36030
  capScope: "system",
@@ -36201,6 +36865,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
36201
36865
  addonId: null,
36202
36866
  access: "create"
36203
36867
  },
36868
+ "system.getLoggingSettings": {
36869
+ capName: "system",
36870
+ capScope: "system",
36871
+ addonId: null,
36872
+ access: "view"
36873
+ },
36874
+ "system.getRequestCensus": {
36875
+ capName: "system",
36876
+ capScope: "system",
36877
+ addonId: null,
36878
+ access: "view"
36879
+ },
36204
36880
  "system.getRetentionConfig": {
36205
36881
  capName: "system",
36206
36882
  capScope: "system",
@@ -36231,6 +36907,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
36231
36907
  addonId: null,
36232
36908
  access: "view"
36233
36909
  },
36910
+ "system.setLoggingSettings": {
36911
+ capName: "system",
36912
+ capScope: "system",
36913
+ addonId: null,
36914
+ access: "create"
36915
+ },
36234
36916
  "system.setRetentionConfig": {
36235
36917
  capName: "system",
36236
36918
  capScope: "system",
@@ -37386,6 +38068,10 @@ Object.freeze({
37386
38068
  name: "deviceId",
37387
38069
  form: "single",
37388
38070
  optional: true
38071
+ }, {
38072
+ name: "deviceIds",
38073
+ form: "array",
38074
+ optional: true
37389
38075
  }],
37390
38076
  "fanControl.setDirection": [{
37391
38077
  name: "deviceId",
@@ -38191,6 +38877,11 @@ Object.freeze({
38191
38877
  form: "single",
38192
38878
  optional: false
38193
38879
  }],
38880
+ "recording.readWindowBytes": [{
38881
+ name: "deviceId",
38882
+ form: "single",
38883
+ optional: false
38884
+ }],
38194
38885
  "recording.relocateFootage": [{
38195
38886
  name: "deviceId",
38196
38887
  form: "single",
@@ -39271,7 +39962,38 @@ z.object({
39271
39962
  * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
39272
39963
  * reproduce that.
39273
39964
  */
39274
- tileBudgetMb: z.number().int().min(0).max(1024)
39965
+ tileBudgetMb: z.number().int().min(0).max(1024),
39966
+ /**
39967
+ * RAM ceiling per decode worker, in MB, for the SCENE TILES — one
39968
+ * JPEG-encoded copy of the WHOLE native frame, cut in the same instant as the
39969
+ * subject tiles, on frames that detected something.
39970
+ *
39971
+ * It exists because a subject tile cannot answer a FULL-FRAME request:
39972
+ * containment is strict by design, so the native `keyFrame`, the detail
39973
+ * plane's `frameJpeg` rung and the display-crop fallback had no rung at all
39974
+ * below the hold. Measured on the live cluster: 23.3% of key-frame captures
39975
+ * missed, 95.7% of them with `worker-lease-gone` — the raster released one
39976
+ * frame-time after delivery, with the request only p50 367 ms behind it.
39977
+ *
39978
+ * Sizing, and why this is a budget and not a duration: a scene tile is
39979
+ * ~1.5-2.5 MB at 4K (against ~23.75 MB for the raster it was cut from and
39980
+ * ~60-120 KB for a subject tile), and it is cut ~0.4 times a second per busy
39981
+ * camera — only detection-bearing frames get one. 48 MB is therefore ~20-30
39982
+ * frames, i.e. the store's 30 s TTL binds at the steady state and the budget
39983
+ * binds only through a detection burst, where it still covers well past the
39984
+ * measured p90 ask age of 4.3 s. Holding the RASTERS for the same window
39985
+ * would be ~498 MB per camera and ~6 GB at peak concurrency — the OOM this
39986
+ * whole shape exists to avoid.
39987
+ *
39988
+ * A SEPARATE ceiling from `tileBudgetMb` on purpose: a scene tile is ~20× a
39989
+ * subject tile, so one shared budget would let a busy camera's key frames
39990
+ * evict the face/plate tiles the recognisers depend on. Two budgets make that
39991
+ * impossible rather than unlikely. `0` DISABLES scene tiles and restores the
39992
+ * pre-existing behaviour, where a late full-frame request had nothing but the
39993
+ * ≤640 RAM raster — which the `keyFrame` gate rejects, so in practice it had
39994
+ * nothing.
39995
+ */
39996
+ sceneBudgetMb: z.number().int().min(0).max(1024)
39275
39997
  });
39276
39998
  /**
39277
39999
  * The values in force when the operator has set nothing.
@@ -39287,12 +40009,14 @@ var DEFAULT_NATIVE_LEASE_SETTINGS = {
39287
40009
  budgetMb: 1024,
39288
40010
  activityMs: 15e3,
39289
40011
  tileBudgetMb: 64,
40012
+ sceneBudgetMb: 48,
39290
40013
  admission: "inferred"
39291
40014
  };
39292
40015
  DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
39293
40016
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
39294
40017
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
39295
40018
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
40019
+ DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
39296
40020
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
39297
40021
  /**
39298
40022
  * The addon id as the REGISTRY, the wire and the durable stores spell it.
@@ -39464,4 +40188,4 @@ function enumerateInferenceDevices(hw) {
39464
40188
  return out;
39465
40189
  }
39466
40190
  //#endregion
39467
- 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 };
40191
+ 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 };