@camstack/addon-provider-homeassistant 1.2.29 → 1.2.30

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.
@@ -1,4 +1,4 @@
1
- //#region ../types/dist/event-category-Cv9dO26A.mjs
1
+ //#region ../types/dist/event-category-Bxo5yJjt.mjs
2
2
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
3
3
  EventCategory["SystemBoot"] = "system.boot";
4
4
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -205,6 +205,33 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
205
205
  EventCategory["PipelineCameraAssigned"] = "pipeline.camera-assigned";
206
206
  EventCategory["PipelineCameraUnassigned"] = "pipeline.camera-unassigned";
207
207
  /**
208
+ * A node the orchestrator would otherwise place cameras on has NO usable
209
+ * inference device: the operator enabled one or more accelerators there and
210
+ * the live probe reports every one of them unavailable. Emitted once per
211
+ * TRANSITION into that state (never per dispatch), and the node is dropped
212
+ * from the placement candidate set for as long as it holds.
213
+ *
214
+ * This exists because the state was previously invisible: little-unraid
215
+ * absorbed 283k inference errors in a day while still being handed cameras,
216
+ * and nothing in the system said so.
217
+ *
218
+ * A node with no accelerators configured at all is NOT this — its devices
219
+ * are `disabled`, not `unavailable`, and the runner's default CPU pool
220
+ * serves it exactly as before.
221
+ */
222
+ EventCategory["PipelineNodeInferenceUnavailable"] = "pipeline.node-inference-unavailable";
223
+ /**
224
+ * A camera has an OPEN detection session and has produced no detection at
225
+ * all for longer than the blind threshold — the camera is being decoded and
226
+ * inferred and is returning nothing. Emitted once per transition into blind,
227
+ * per camera.
228
+ *
229
+ * The failure it reports: a 1h43 detection blackout on the entrance camera
230
+ * that nobody noticed, because "a camera that detects nothing" and "a quiet
231
+ * camera" produce byte-identical silence.
232
+ */
233
+ EventCategory["PipelineDetectionBlind"] = "pipeline.detection-blind";
234
+ /**
208
235
  * Per-camera pipeline config was mutated by the orchestrator
209
236
  * (3-level settings change via `setAgentAddonDefaults` /
210
237
  * `setCameraStepToggle` / `setCameraPipelineForAgent` or a
@@ -12701,6 +12728,17 @@ var LlmImageSchema = object({
12701
12728
  bytes: _instanceof(Uint8Array),
12702
12729
  mimeType: string()
12703
12730
  });
12731
+ /**
12732
+ * Retry policy. `enabled: false` is NOT the same as `maxAttempts: 1` in intent —
12733
+ * the flag is what a consumer table flips, the count is what the operator tunes.
12734
+ * A retry doubles the wall time of a call, so the two gates that run inside a
12735
+ * notification's budget keep it off (see `CONSUMER_RETRY_POLICY` in addon-ai).
12736
+ */
12737
+ var LlmRetryPolicySchema = object({
12738
+ enabled: boolean().default(false),
12739
+ /** Total attempts INCLUDING the first. 1 = no retry. */
12740
+ maxAttempts: number().int().min(1).max(5).default(1)
12741
+ });
12704
12742
  var LlmGenerateBaseInputSchema = object({
12705
12743
  /** Collection routing (the notification-output posture). */
12706
12744
  addonId: string().optional(),
@@ -12715,7 +12753,28 @@ var LlmGenerateBaseInputSchema = object({
12715
12753
  jsonSchema: record(string(), unknown()).optional(),
12716
12754
  /** Per-call override of the profile default. */
12717
12755
  maxTokens: number().int().positive().optional(),
12718
- temperature: number().optional()
12756
+ temperature: number().optional(),
12757
+ /** Per-call override of the profile default (nucleus sampling). */
12758
+ topP: number().min(0).max(1).optional(),
12759
+ /** Per-call override of the profile default (top-k sampling). */
12760
+ topK: number().int().positive().optional(),
12761
+ /** Per-call override of `profile.timeoutMs` — the total generation bound. */
12762
+ timeoutMs: number().int().positive().optional(),
12763
+ /** Per-call override; beats both the consumer table and the profile. */
12764
+ retry: LlmRetryPolicySchema.optional(),
12765
+ /**
12766
+ * Caller-minted id that makes this generation CANCELLABLE.
12767
+ *
12768
+ * Without it a caller that stops waiting cannot stop the work: the gates race
12769
+ * the call against 8 s and free their own slot when the timer wins, while the
12770
+ * generation upstream keeps running to `profile.timeoutMs` — 60 s by default,
12771
+ * on a single-threaded local model. The per-camera bound then counts WAITS,
12772
+ * not generations, and the real load is unbounded.
12773
+ *
12774
+ * `AbortSignal` cannot cross a process boundary; an id can. Pass one here and
12775
+ * `llm.cancel({ requestId })` tears the socket down.
12776
+ */
12777
+ requestId: string().optional()
12719
12778
  });
12720
12779
  /**
12721
12780
  * `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
@@ -12754,8 +12813,49 @@ var ManagedRuntimeConfigSchema = object({
12754
12813
  gpuLayers: number().int().default(0),
12755
12814
  /** Default: cpus-2, clamped ≥1 (resolved node-side). */
12756
12815
  threads: number().int().optional(),
12757
- /** Concurrent slots. */
12816
+ /** Concurrent slots (`--parallel`). */
12758
12817
  parallel: number().int().default(1),
12818
+ /** Logical batch size (`-b`). Larger = faster prompt ingest, more RAM. */
12819
+ batchSize: number().int().positive().optional(),
12820
+ /** Physical batch / micro-batch (`-ub`). */
12821
+ ubatchSize: number().int().positive().optional(),
12822
+ /**
12823
+ * `--flash-attn`. Cuts KV-cache memory on the backends that implement it and
12824
+ * is a no-op elsewhere, so it is offered rather than assumed.
12825
+ */
12826
+ flashAttention: boolean().default(false),
12827
+ /**
12828
+ * `--mlock`. Pins the weights in RAM so the OS cannot page them out mid
12829
+ * inference. Costs the full model size in resident memory — which is exactly
12830
+ * what the RAM budget is counting.
12831
+ */
12832
+ mlock: boolean().default(false),
12833
+ /**
12834
+ * `--no-mmap`. Reads the whole GGUF up front instead of mapping it. Slower to
12835
+ * start, but avoids the page-fault stalls a network or spinning-disk model
12836
+ * store produces on every first token.
12837
+ */
12838
+ noMmap: boolean().default(false),
12839
+ /** `--cache-type-k` / `--cache-type-v` — quantising the KV cache is the
12840
+ * cheapest way to fit a longer context in the same RAM. */
12841
+ cacheTypeK: _enum([
12842
+ "f32",
12843
+ "f16",
12844
+ "q8_0",
12845
+ "q5_1",
12846
+ "q5_0",
12847
+ "q4_1",
12848
+ "q4_0"
12849
+ ]).optional(),
12850
+ cacheTypeV: _enum([
12851
+ "f32",
12852
+ "f16",
12853
+ "q8_0",
12854
+ "q5_1",
12855
+ "q5_0",
12856
+ "q4_1",
12857
+ "q4_0"
12858
+ ]).optional(),
12759
12859
  /** Else lazy: first generate boots it. */
12760
12860
  autoStart: boolean().default(false),
12761
12861
  /** 0 = never; frees RAM after quiet periods. */
@@ -12843,10 +12943,44 @@ var LlmProfileSchema = object({
12843
12943
  baseUrl: string().optional(),
12844
12944
  /** ConfigUISchema type:'password' — never round-trips (spec §5). */
12845
12945
  apiKey: string().optional(),
12946
+ /** Vision on/off. A vision call against a `false` profile is REFUSED, never
12947
+ * degraded to text — that shipped once and produced a confident answer to a
12948
+ * question about a picture nobody sent. */
12846
12949
  supportsVision: boolean(),
12847
12950
  temperature: number().min(0).max(2).optional(),
12951
+ /** Nucleus sampling. Every wire we speak has it. */
12952
+ topP: number().min(0).max(1).optional(),
12953
+ /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
12954
+ * wire does, and the client drops it there (measured: the request body gets
12955
+ * `top_p` and no `top_k`). The profile editor hides the field wherever it
12956
+ * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
12957
+ topK: number().int().positive().optional(),
12848
12958
  maxTokens: number().int().positive().optional(),
12959
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own);
12960
+ * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
12961
+ * the model with, so it is the one field that changes a PROCESS. */
12962
+ contextLength: number().int().positive().optional(),
12963
+ /** Default system prompt. A caller's `system` REPLACES it (never appends —
12964
+ * two system prompts fighting is worse than either alone). */
12965
+ systemPrompt: string().optional(),
12966
+ /** Total generation bound — the only one a unary call has. */
12849
12967
  timeoutMs: number().int().positive().default(6e4),
12968
+ /** Wait for response headers only. */
12969
+ connectTimeoutMs: number().int().positive().default(1e4),
12970
+ /** Accepted, but no output yet — a cold GPU load lives here. */
12971
+ firstTokenTimeoutMs: number().int().positive().default(12e4),
12972
+ /** Output started then stopped. */
12973
+ idleTimeoutMs: number().int().positive().default(6e4),
12974
+ /** Profile-level default. The per-consumer table and a per-call override
12975
+ * both beat it — see `resolveRetryPolicy`. */
12976
+ retry: LlmRetryPolicySchema.default({
12977
+ enabled: false,
12978
+ maxAttempts: 1
12979
+ }),
12980
+ /** Whether this profile may use tools. The tool-call plumbing rides the
12981
+ * library; the REGISTRY of callable tools is ours and is empty in v1, so a
12982
+ * `true` here buys the wiring, not behaviour, until tools are registered. */
12983
+ toolsEnabled: boolean().default(false),
12850
12984
  extraHeaders: record(string(), string()).optional(),
12851
12985
  /** kind === 'managed-local' only (spec §4). */
12852
12986
  runtime: ManagedRuntimeConfigSchema.optional()
@@ -12908,7 +13042,10 @@ var ProfileRefInputSchema = object({
12908
13042
  addonId: string(),
12909
13043
  profileId: string()
12910
13044
  });
12911
- method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
13045
+ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({
13046
+ addonId: string().optional(),
13047
+ requestId: string()
13048
+ }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
12912
13049
  kind: "mutation",
12913
13050
  auth: "admin"
12914
13051
  }), method(ProfileRefInputSchema, _void(), {
@@ -14590,6 +14727,8 @@ var NcSystemEventKindSchema = _enum([
14590
14727
  "stream-offline",
14591
14728
  "node-online",
14592
14729
  "node-offline",
14730
+ "node-inference-unavailable",
14731
+ "detection-blind",
14593
14732
  "addon-update-available",
14594
14733
  "server-update-available",
14595
14734
  "alarm-triggered",
@@ -14651,7 +14790,16 @@ var NcScheduleSchema = object({
14651
14790
  });
14652
14791
  /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
14653
14792
  var NcPlateMatcherSchema = object({
14654
- values: array(string().min(1)).min(1),
14793
+ /**
14794
+ * Plate texts (or gallery vehicle names) to match. EMPTY = **any plate the
14795
+ * pipeline could read** — the plate half of "no selection = no narrowing",
14796
+ * and the switch that says this rule is about vehicles that were IDENTIFIED
14797
+ * rather than merely seen. A subject carrying no plate still fails.
14798
+ *
14799
+ * The `.min(1)` this used to carry made that state unauthorable; nothing has
14800
+ * ever persisted an empty list, so widening it cannot change an existing rule.
14801
+ */
14802
+ values: array(string().min(1)),
14655
14803
  /** Max Levenshtein distance after normalization (uppercase alphanumeric). */
14656
14804
  maxDistance: number().int().min(0).max(3).default(1)
14657
14805
  });
@@ -14685,28 +14833,36 @@ var NcOccupancyConditionSchema = object({
14685
14833
  /**
14686
14834
  * Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
14687
14835
  *
14688
- * Operator-approved vocabulary (2026-08-12, option A — the same one the
14689
- * reference notifier uses, so an operator moving between them re-uses what
14690
- * they already know): a rule matches when, over a sampling window of
14691
- * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
14692
- * window are HITS. A sample is a hit when it satisfies BOTH present filters:
14693
- *
14694
- * - `dbThreshold` its level is at or above this many dBFS (see
14695
- * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
14696
- * - `labels` the classifier put at least one of these labels on it.
14697
- *
14698
- * Both are OPTIONAL and independent, which is the point of the shape: a
14699
- * loudness rule ("something loud at 3am") needs no model to be right, and a
14700
- * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
14701
- * is given** a window in which every sample is trivially a hit would fire on
14702
- * silence, so the engine refuses such a condition rather than notifying on
14703
- * nothing (the schema cannot express "at least one of" without becoming a
14704
- * ZodEffects the cap path would have to special-case).
14705
- *
14706
- * `hitPercent` is over the samples the window actually HOLDS, and the window
14707
- * must be FULL before it can match a window that has been open for two
14708
- * seconds of its ten is 100% of nothing, and firing on it would make
14709
- * `samplingSeconds` decorative.
14836
+ * **TWO EXCLUSIVE MODES** (operator decision 2026-08-14, D157). Which one a
14837
+ * rule is in is not a stored field it is WHICH FILTER the rule carries, so
14838
+ * there is no second switch that can disagree with the first and every rule
14839
+ * authored before the decision migrates for free (`audioModeOf`):
14840
+ *
14841
+ * - **LABEL mode — `labels` present.** The rule fires on the FIRST frame the
14842
+ * classifier labels with one of them. No window, no percentage:
14843
+ * `hitPercent` and `samplingSeconds` are ignored, and the rule's own
14844
+ * `throttle` cooldown is the only brake. The per-label confidence floor is
14845
+ * the analyzer's (`classificationMinScore`, per device) — a label only
14846
+ * reaches this condition if the classifier was already confident enough.
14847
+ * - **LEVEL mode `dbThreshold` present, no labels.** The sampling window IS
14848
+ * the condition: at least `hitPercent`% of the samples over
14849
+ * `samplingSeconds` must be at or above `dbThreshold` dBFS (see
14850
+ * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale). The window
14851
+ * must be FULL before it can match a window open for two of its ten
14852
+ * seconds is 100% of nothing.
14853
+ *
14854
+ * **Why label mode has no window.** It had one, and it never fired: the
14855
+ * analyzer emits ~1 audio frame per second but YAMNet only LABELS one to three
14856
+ * of them per episode, even through continuous crying. The measured maximum
14857
+ * `hitPercent` over the whole live history was 40 — under the shipped default
14858
+ * of 60, so a label rule could not fire at all, ever. A percentage of frames is
14859
+ * the wrong question to ask of a sparse classifier.
14860
+ *
14861
+ * **Fail-closed when NEITHER is given** — every sample would be a trivial hit
14862
+ * and the rule would fire on silence. The schema cannot express "exactly one
14863
+ * of" without becoming a ZodEffects the cap path would have to special-case, so
14864
+ * the exclusivity is enforced where every editor writes (`patchAudio`) and a
14865
+ * legacy rule carrying both resolves to LABEL (the mode that fires).
14710
14866
  *
14711
14867
  * Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
14712
14868
  * `audio-*` ids). Both spellings are accepted — the matcher normalizes the
@@ -14714,13 +14870,13 @@ var NcOccupancyConditionSchema = object({
14714
14870
  * an operator who typed `dog` mean the same thing.
14715
14871
  */
14716
14872
  var NcAudioConditionSchema = object({
14717
- /** Audio macro labels; absent = any sound (level-only rule). */
14873
+ /** LABEL MODE: audio macro labels. Present fires on the first labelled frame. */
14718
14874
  labels: array(string().min(1)).min(1).optional(),
14719
- /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
14875
+ /** LEVEL MODE: floor in dBFS (negative-going, `0` = full scale). */
14720
14876
  dbThreshold: number().min(-96).max(0).optional(),
14721
- /** Percentage of the window's samples that must be hits (1–100). */
14877
+ /** LEVEL MODE ONLY: percentage of the window's samples that must be hits (1–100). */
14722
14878
  hitPercent: number().int().min(1).max(100).default(60),
14723
- /** Length of the sampling window in seconds. */
14879
+ /** LEVEL MODE ONLY: length of the sampling window in seconds. */
14724
14880
  samplingSeconds: number().int().min(1).max(300).default(10)
14725
14881
  });
14726
14882
  /**
@@ -14890,18 +15046,47 @@ var NcConditionsSchema = object({
14890
15046
  */
14891
15047
  labelEquals: array(string().min(1)).optional(),
14892
15048
  /**
14893
- * Identity matcher. P1 boundary: matched against the record's collapsed
14894
- * `label` (the identity display name propagated by the face pipeline) —
14895
- * identity-ID matching rides in P2 when identity ids reach the record.
15049
+ * KNOWN FACES the rule's identity scope, and the switch that says the rule
15050
+ * is about recognised people at all.
15051
+ *
15052
+ * Three states, and the empty one is the point:
15053
+ *
15054
+ * | value | meaning |
15055
+ * | --- | --- |
15056
+ * | absent | the rule does not care who it is; an unrecognised person matches |
15057
+ * | `[]` | **only known faces** — any identity in the gallery, nobody in particular |
15058
+ * | a list | only these identities |
15059
+ *
15060
+ * `[]` is the repo-wide "no selection = no narrowing" reading (an absent
15061
+ * `devices` list is every device), applied one level down: the operator has
15062
+ * turned the face scope ON and narrowed it to nothing, which is every known
15063
+ * face. No second field states the same thing — a switch that can disagree
15064
+ * with the list under it is worse than no switch (D62).
15065
+ *
15066
+ * MEMBERS ARE FACE-GALLERY `Identity.id`s (uuid), not display names. A name is
15067
+ * renameable, and a rule authored on "Gianluca" went silently dark the moment
15068
+ * the operator fixed the spelling. The id reaches the record on
15069
+ * `LabelAttribution.identityId`; the name is what the editor shows and what
15070
+ * `{{label}}` renders.
15071
+ *
15072
+ * Rules written before this carry NAMES, and are resolved to ids lazily at
15073
+ * load (`NcRuleStore.load`) against the live gallery — a name nothing answers
15074
+ * for is left as it stands and reported, never dropped. The engine also
15075
+ * accepts a display-name hit as a compatibility leg, so a rule whose
15076
+ * migration could not resolve keeps matching exactly what it matched before.
14896
15077
  */
14897
15078
  identities: array(string().min(1)).optional(),
14898
- /** Fuzzy plate matcher against the record's `label` (plate text). */
15079
+ /**
15080
+ * KNOWN PLATES / VEHICLES — the plate mirror of {@link identities}, including
15081
+ * the empty-list reading: `values: []` is "any plate the OCR could read",
15082
+ * a non-empty list is those plates (fuzzily). See {@link NcPlateMatcherSchema}.
15083
+ */
14899
15084
  plates: NcPlateMatcherSchema.optional(),
14900
15085
  /**
14901
- * Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
14902
- * Same P1 boundary: matched against the record's collapsed `label` (the
14903
- * identity display name). A record with NO label passes (nothing to
14904
- * exclude), unlike the include variant which fails on an absent label.
15086
+ * Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics, and
15087
+ * the same id members and the same lazy name→id migration. A record with NO
15088
+ * identity passes (nothing to exclude), unlike the include variant which
15089
+ * fails on an unrecognised subject. An EMPTY list excludes nobody.
14905
15090
  */
14906
15091
  identitiesExclude: array(string().min(1)).optional(),
14907
15092
  /**
@@ -15293,7 +15478,80 @@ var NcRuleInputSchema = object({
15293
15478
  * a rule that predates the gate must keep delivering byte-for-byte as it
15294
15479
  * did, and absent is the only way to say that without a migration.
15295
15480
  */
15296
- confirm: NcConfirmSchema.optional()
15481
+ confirm: NcConfirmSchema.optional(),
15482
+ /**
15483
+ * WAIT for face/plate recognition before saying anything.
15484
+ *
15485
+ * A notification's TEXT is frozen at enqueue and its media is re-resolved at
15486
+ * send; the identity is neither. A face is confirmed after `confirmFrames`
15487
+ * agreeing observations — p50 **11.4 s** after the track was first seen,
15488
+ * measured on this hub — and an `immediate` rule enqueues on the first object
15489
+ * event, seconds before that. So "Gianluca è arrivato" is unsayable on the
15490
+ * immediate path, and no amount of media re-resolution fixes a sentence.
15491
+ *
15492
+ * Only two honest answers exist, and this flag picks between them. It has
15493
+ * effect ONLY on a rule that declares a recognition scope
15494
+ * ({@link NcConditions.identities} or {@link NcConditions.plates}) — on any
15495
+ * other rule there is nothing to wait for and the flag is inert.
15496
+ *
15497
+ * | value | what happens |
15498
+ * | --- | --- |
15499
+ * | `true` | the rule stops firing on the object event and fires at TRACK CLOSE instead, once, with the name — later, and complete |
15500
+ * | absent / `false` | it fires at once WITHOUT the name, and if recognition lands before the track closes a SECOND, "…is Gianluca" notification follows (one per track, per rule, per target) |
15501
+ *
15502
+ * `.optional()` and deliberately NOT `.default()`: a Zod default does not run
15503
+ * on the addon cap path, and absent has to keep meaning exactly what every
15504
+ * rule authored before this field meant.
15505
+ *
15506
+ * The cost of `true` is stated here because the editor states it too: a rule
15507
+ * that waits also inherits track-close SEMANTICS — its `zones` condition
15508
+ * tests every zone the track visited and a `crossing` condition can no longer
15509
+ * be satisfied, because a closed track carries no crossing.
15510
+ */
15511
+ waitForEnhancement: boolean().optional(),
15512
+ /**
15513
+ * GROUP a burst of subjects into ONE notification that grows.
15514
+ *
15515
+ * Seconds of quiet after the last matching subject before the burst is
15516
+ * considered over. While it is open, the first subject enqueues immediately —
15517
+ * **exactly as today, with no added latency** — and every real growth (a new
15518
+ * subject, or a name confirmed on one already in it) REPLACES that
15519
+ * notification with an updated one naming everybody. The push carries the
15520
+ * group's own coalescing tag, so the phone replaces rather than stacks.
15521
+ *
15522
+ * `0` / absent = off, and off is today's behaviour byte for byte.
15523
+ *
15524
+ * ### Why an idle cutoff and not a window
15525
+ *
15526
+ * The measured seven-person arrival on device 590 spans 110 s with every
15527
+ * internal gap under 30 s. A 12 s fixed window cuts it into three groups; an
15528
+ * idle cutoff holds it as one and ends it when the arrival actually ends.
15529
+ * 30 is Frigate's shipped value for the same decision.
15530
+ *
15531
+ * ### What it replaces
15532
+ *
15533
+ * The blind cooldown, which collapses a burst by DISCARDING it. Measured on
15534
+ * device 615 / *Persona su Uscio* over six days: 116 qualifying tracks → 74
15535
+ * notifications, **44 (37.9%) suppressed outright**, 23 of them overlapping a
15536
+ * track that did fire and 7 carrying a confirmed identity nobody heard about.
15537
+ * A group collapses the same volume by MERGING, so the cooldown becomes a
15538
+ * budget over GROUPS — which is what it always meant — and a growth is never
15539
+ * throttled by the window its own first member spent.
15540
+ *
15541
+ * ### Interaction with {@link waitForEnhancement}
15542
+ *
15543
+ * They compose, and the order matters. `waitForEnhancement` defers the rule to
15544
+ * TRACK CLOSE, so with both set the group is opened by the first member to
15545
+ * CLOSE — already carrying its name — and grows as later members close. That
15546
+ * is later, and complete. With grouping alone the group opens on the first
15547
+ * object event and picks up names as they are confirmed, through the growth
15548
+ * path. Neither combination fires twice for one subject.
15549
+ *
15550
+ * `.optional()` and deliberately NOT `.default()`: a Zod default does not run
15551
+ * on the addon cap path, so absent must keep meaning what it meant before this
15552
+ * field existed.
15553
+ */
15554
+ groupIdleSec: number().int().min(0).max(600).optional()
15297
15555
  });
15298
15556
  /**
15299
15557
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -16225,7 +16483,7 @@ var TrackEnvelopeSchema = object({
16225
16483
  * `snapshots[]` references — megabytes across a page of tracks. `slim`
16226
16484
  * keeps every scalar the list surfaces actually render (ids, class(es),
16227
16485
  * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16228
- * zonesVisited, bestEventId, envelope, hasFace) and returns `positions` /
16486
+ * zonesVisited, bestEventId, envelope, hasFace, hasRider) and returns `positions` /
16229
16487
  * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16230
16488
  * `getTrack`. Mirrors the event-store `projection` convention
16231
16489
  * (`getObjectEvents` et al.).
@@ -16361,7 +16619,21 @@ union([literal(1), literal(2)]);
16361
16619
  var LabelAttributionSchema = object({
16362
16620
  stepId: string(),
16363
16621
  modelId: string().optional(),
16364
- decidedAt: number()
16622
+ decidedAt: number(),
16623
+ /**
16624
+ * The GALLERY id behind a recognised tier-2 label — a face-gallery
16625
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
16626
+ *
16627
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
16628
+ * notification rule authored on "Gianluca" stopped matching the moment the
16629
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
16630
+ * the thing that does not move, so it is what a rule matches on
16631
+ * (`NcConditions.identities`) and the text is what a human is shown.
16632
+ *
16633
+ * Absent when the label names no gallery row — a plate the OCR read but no
16634
+ * vehicle claims, a sub-class, a species, any tier-1 value.
16635
+ */
16636
+ identityId: string().optional()
16365
16637
  });
16366
16638
  /**
16367
16639
  * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
@@ -16498,6 +16770,28 @@ var TrackSchema = object({
16498
16770
  * `=== true` and render nothing otherwise, never infer "no face".
16499
16771
  */
16500
16772
  hasFace: boolean().optional(),
16773
+ /**
16774
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
16775
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
16776
+ * so the passage is tracked once and as a VEHICLE.
16777
+ *
16778
+ * It exists because the fold's record was dishonest. D34 and the code both
16779
+ * said "the person is not lost — it is reported so both entities stay on the
16780
+ * record"; in fact the pair went into a per-processor RAM field behind an
16781
+ * accessor nobody called, and every durable surface said `vehicle`, full
16782
+ * stop. This is the composition note that makes the row true.
16783
+ *
16784
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
16785
+ * person" is not an answer to "what is this" — both label tiers would refuse
16786
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
16787
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
16788
+ * and a `person` rule still does not fire for someone cycling past.
16789
+ *
16790
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
16791
+ * the column, and every hub that predates the field, omits it. Test
16792
+ * `=== true` and render nothing otherwise — never infer "no rider".
16793
+ */
16794
+ hasRider: boolean().optional(),
16501
16795
  ...TrackFlagFields,
16502
16796
  ...TrackRetrainFields
16503
16797
  });
@@ -26361,14 +26655,50 @@ method(object({
26361
26655
  * thing except the comparator: `similarity` (CLIP cosine at the same ROI coords
26362
26656
  * vs condition-tagged references) and `llm` (vision-LLM judgment over the crop).
26363
26657
  *
26364
- * D14 device-config archetype (`deviceConfig.ui.kind:'widget'`) the framework
26365
- * derives the device-detail contribution; the provider carries NO hand-written
26366
- * settings-contribution methods. `status.kind:'push'` the engine pushes on
26367
- * every hysteresis flip / availability change; consumers never poll.
26368
- */
26369
- /** Extensible condition tag. Seeded 'day' | 'night'; open by design so more can
26370
- * be added without a wire break (matching falls back to any-condition refs). */
26658
+ * **No `deviceConfig`, deliberately.** This shipped as the D14 widget archetype,
26659
+ * which put a "Scenes" tab on one camera's detail page. That is the wrong shape
26660
+ * for the thing: a scene is a standing question about the property ("is the bin
26661
+ * still out"), and the operator's question is "which of my scenes have tripped",
26662
+ * across every camera at once — not "what does camera 617 think". Buried one
26663
+ * camera deep it also could not be found. The surface is now a top-level admin
26664
+ * page (`/scenes`, `pages/Scenes.tsx`) that lists every scene on every camera and
26665
+ * picks the camera inside the create flow, the same shape Events and Faces have.
26666
+ *
26667
+ * The consequence to keep in mind: `host/scene-monitor-editor` is gone from
26668
+ * `HOST_WIDGETS` too. `scripts/check-host-widget-resolves.ts` asserts BOTH
26669
+ * directions, so a registration nobody declares fails exactly as loudly as a
26670
+ * declaration nobody registers. The editor is imported directly by the page.
26671
+ *
26672
+ * `status.kind:'push'` — the engine pushes on every hysteresis flip /
26673
+ * availability change; consumers never poll.
26674
+ */
26675
+ /** Extensible condition tag. Seeded 'day' | 'ir' (the two variants the operator
26676
+ * captures) plus 'night' | 'dawn' | 'dusk' from the resolver's sun-times band.
26677
+ * Open by design so more can be added without a wire break.
26678
+ *
26679
+ * Matching does NOT fall back across conditions: cross-condition cosines are
26680
+ * not comparable, so "I have never seen this scene in this light" is reported
26681
+ * as `unknown`, never guessed. A day reference scored against an IR frame
26682
+ * collapses the cosine and would latch a false alarm every single night. */
26371
26683
  var SceneConditionSchema = string();
26684
+ /** `matched` = the baseline is what we see; `diverged` = it demonstrably is not;
26685
+ * `unknown` = we cannot judge (no reference for this condition, encoder model
26686
+ * changed, view shifted, no snapshot). `unknown` is a real value, not a null,
26687
+ * and never counts toward hysteresis in either direction. */
26688
+ var SceneVerdictSchema = _enum([
26689
+ "matched",
26690
+ "diverged",
26691
+ "unknown"
26692
+ ]);
26693
+ /** Why a scene cannot judge. Named, because this feature's failure mode is
26694
+ * silence that reads as "nothing has happened". */
26695
+ var SceneUnavailableSchema = _enum([
26696
+ "no-reference-for-condition",
26697
+ "view-shifted",
26698
+ "no-vision-profile",
26699
+ "encoder-model-changed",
26700
+ "no-snapshot"
26701
+ ]);
26372
26702
  /** One captured reference — condition-tagged, model-version-gated. `embedding`
26373
26703
  * is `number[]` (Float32Array does NOT survive MsgPack/UDS). */
26374
26704
  var SceneReferenceSchema = object({
@@ -26376,7 +26706,14 @@ var SceneReferenceSchema = object({
26376
26706
  modelId: string(),
26377
26707
  condition: SceneConditionSchema,
26378
26708
  capturedAt: number(),
26379
- thumbnailMediaId: string().optional()
26709
+ thumbnailMediaId: string().optional(),
26710
+ /** Whole-frame (downscaled) embedding captured alongside the ROI crop. The
26711
+ * anti-view-shift anchor: a bumped camera, a PTZ preset or a re-aim makes the
26712
+ * normalized rect frame a different piece of world, and the scene would
26713
+ * diverge forever with a perfectly plausible cosine. Checked LAZILY, only
26714
+ * when hysteresis is about to flip — one extra encode per candidate
26715
+ * transition, not per poll. */
26716
+ anchorEmbedding: array(number()).optional()
26380
26717
  });
26381
26718
  var SceneMonitorStateSchema = object({
26382
26719
  id: string(),
@@ -26398,6 +26735,25 @@ var SceneCheckSchema = discriminatedUnion("mode", [object({
26398
26735
  profileId: string().optional(),
26399
26736
  hysteresisCount: number().int().positive()
26400
26737
  })]);
26738
+ var SCENE_DEFAULT_ANCHOR_THRESHOLD = .85;
26739
+ /**
26740
+ * Vision-model adjudication of a candidate flip. Field names deliberately
26741
+ * mirror `NcConfirmSchema` so an operator meets one vocabulary, not two.
26742
+ *
26743
+ * `onTimeout` defaults to **'hold'**, the OPPOSITE of `NcConfirmGate`'s
26744
+ * fail-open: a notification suppressed is the worse error there, but a vision
26745
+ * model that timed out has not told us the bin is gone, and a latch is a
26746
+ * stateful claim that costs the operator a trip to reset.
26747
+ */
26748
+ var SceneConfirmSchema = object({
26749
+ enabled: boolean().default(false),
26750
+ prompt: string().min(1).max(1e3),
26751
+ profileId: string().optional(),
26752
+ timeoutMs: number().int().min(1e3).max(2e4).default(8e3),
26753
+ maxImagePx: number().int().min(64).max(2048).default(448),
26754
+ /** What a timeout / unavailable model means for the PENDING flip. */
26755
+ onTimeout: _enum(["flip", "hold"]).default("hold")
26756
+ });
26401
26757
  var SceneMonitorSchema = object({
26402
26758
  id: string(),
26403
26759
  label: string(),
@@ -26416,7 +26772,41 @@ var SceneMonitorSchema = object({
26416
26772
  lastConfidence: number().nullable(),
26417
26773
  currentCondition: SceneConditionSchema.nullable(),
26418
26774
  availability: _enum(["ok", "unavailable"]),
26419
- unavailableReason: string().nullable()
26775
+ unavailableReason: string().nullable(),
26776
+ /** Which state is "the initial screen". `null` until the first capture. */
26777
+ baselineStateId: string().nullable(),
26778
+ /** Which boolean drives notification rules and any export. */
26779
+ emit: _enum(["latched", "live"]).default("latched"),
26780
+ /** Live: does the region match the baseline RIGHT NOW. */
26781
+ verdict: SceneVerdictSchema,
26782
+ /** Has it been `diverged` at least once since `armedAt` — the operator's boolean. */
26783
+ latched: boolean(),
26784
+ /** Last reset (or creation). */
26785
+ armedAt: number(),
26786
+ divergedAt: number().nullable(),
26787
+ restoredAt: number().nullable(),
26788
+ /** A check is only COUNTED when the device has been quiet this long. Motion
26789
+ * during the window DISCARDS the observation — a car pulling up in front of
26790
+ * the bin must not be able to spend hysteresis credit. */
26791
+ quietSeconds: number().int().min(0).max(3600).default(60),
26792
+ /** An observation only advances the pending count when it is at least this
26793
+ * far from the previously counted one, so N agreeing checks span real time
26794
+ * rather than N adjacent polls inside one occlusion. */
26795
+ minObservationSpacingSec: number().int().min(0).max(3600).default(120),
26796
+ /** Vision-model adjudication of a candidate flip. Similarity primary only. */
26797
+ confirm: SceneConfirmSchema.optional(),
26798
+ /** Whole-frame anchor cosine below which a flip is REFUSED as `view-shifted`. */
26799
+ anchorThreshold: number().min(0).max(1).default(SCENE_DEFAULT_ANCHOR_THRESHOLD),
26800
+ /** Clear the latch on its own when the scene matches again? Default false —
26801
+ * `restoredAt` and the `scene-restored` edge are recorded regardless, so an
26802
+ * automation can react to the bin coming back without the operator's own
26803
+ * alarm silently clearing itself. */
26804
+ autoRestore: boolean().default(false),
26805
+ /** Named cause when `verdict === 'unknown'`. */
26806
+ unavailable: SceneUnavailableSchema.nullable(),
26807
+ /** Conditions that have at least one comparable reference — the coverage line
26808
+ * ("day ✓ · ir ✓ · dusk ✗") that turns a silent fallback into a visible fact. */
26809
+ coveredConditions: array(SceneConditionSchema)
26420
26810
  });
26421
26811
  var SceneMonitorStatusSchema = object({
26422
26812
  monitors: array(SceneMonitorSchema),
@@ -26429,12 +26819,6 @@ var sceneMonitorCapability = {
26429
26819
  kind: "wrapper",
26430
26820
  defaultActive: true,
26431
26821
  deviceTypes: [DeviceType.Camera],
26432
- deviceConfig: { ui: {
26433
- kind: "widget",
26434
- widgetId: "host/scene-monitor-editor",
26435
- tab: "scenes",
26436
- label: "Scenes"
26437
- } },
26438
26822
  methods: {
26439
26823
  listScenes: method(object({ deviceId: number() }), SceneMonitorStatusSchema),
26440
26824
  createScene: method(object({
@@ -26465,7 +26849,14 @@ var sceneMonitorCapability = {
26465
26849
  "both"
26466
26850
  ]).optional(),
26467
26851
  checkIntervalSec: number().optional(),
26468
- check: SceneCheckSchema.optional()
26852
+ check: SceneCheckSchema.optional(),
26853
+ emit: _enum(["latched", "live"]).optional(),
26854
+ quietSeconds: number().int().min(0).max(3600).optional(),
26855
+ minObservationSpacingSec: number().int().min(0).max(3600).optional(),
26856
+ anchorThreshold: number().min(0).max(1).optional(),
26857
+ autoRestore: boolean().optional(),
26858
+ /** `null` clears the vision-model adjudicator. */
26859
+ confirm: SceneConfirmSchema.nullable().optional()
26469
26860
  })
26470
26861
  }), _void(), {
26471
26862
  kind: "mutation",
@@ -26506,6 +26897,26 @@ var sceneMonitorCapability = {
26506
26897
  }), _void(), {
26507
26898
  kind: "mutation",
26508
26899
  auth: "admin"
26900
+ }),
26901
+ /**
26902
+ * Clear the latch, re-arm, and — by default — RE-CAPTURE the baseline for
26903
+ * the CURRENT condition. The bin never goes back in exactly the same spot;
26904
+ * "reset" in the operator's head means *this is the new normal*, and
26905
+ * re-capture is what makes the feature self-healing against slow drift
26906
+ * instead of failing silently weeks later.
26907
+ *
26908
+ * Reachable from three surfaces on this one mutation: the scene card, a
26909
+ * notification button (an `onTrigger` sequence with a `kind:'cap'` step —
26910
+ * no new Notification-Center code at all), and tRPC for scripts.
26911
+ */
26912
+ resetScene: method(object({
26913
+ deviceId: number(),
26914
+ monitorId: string(),
26915
+ /** Defaults to TRUE at the provider seam — see `SCENE_RESET_RECAPTURES`. */
26916
+ recapture: boolean().optional()
26917
+ }), _void(), {
26918
+ kind: "mutation",
26919
+ auth: "admin"
26509
26920
  })
26510
26921
  },
26511
26922
  status: {
@@ -26996,12 +27407,64 @@ var NetworkAddressSchema = object({
26996
27407
  family: string(),
26997
27408
  internal: boolean()
26998
27409
  });
27410
+ /**
27411
+ * Provenance of the site coordinates, and the whole reason this is not just two
27412
+ * numbers.
27413
+ *
27414
+ * - `operator-set` — a human typed it, or accepted a detection. Authoritative;
27415
+ * nothing overwrites it.
27416
+ * - `derived-from-ip` — the hub geolocated its own public IP once, because a
27417
+ * default that is right to a few kilometres beats the coarse UTC clock split
27418
+ * the sun-times consumers otherwise fall back to.
27419
+ *
27420
+ * The UI shows which one it is. An operator who cannot tell a guess from their
27421
+ * own input will eventually trust the guess.
27422
+ */
27423
+ var SiteLocationSourceSchema = _enum(["operator-set", "derived-from-ip"]);
27424
+ /**
27425
+ * The read shape: the location plus the honest state of the one-shot derivation.
27426
+ *
27427
+ * `derivationAttemptedAt` is what makes the "one call, ever" contract
27428
+ * inspectable. When it is set and `location` is null, the geo-IP lookup ran and
27429
+ * failed; the hub will NOT try again on its own — the fallback is declared
27430
+ * (consumers degrade to their own last resort) and the operator either types the
27431
+ * coordinates or presses detect.
27432
+ */
27433
+ var SiteLocationStatusSchema = object({
27434
+ location: object({
27435
+ /** WGS84 decimal degrees. */
27436
+ latitude: number().min(-90).max(90),
27437
+ longitude: number().min(-180).max(180),
27438
+ source: SiteLocationSourceSchema,
27439
+ /** Epoch ms the value was last written. */
27440
+ updatedAt: number(),
27441
+ /**
27442
+ * Human-readable place the geo-IP service reported ("Napoli, IT"). Display
27443
+ * only — never parsed, never matched on. Absent for an operator-typed value.
27444
+ */
27445
+ label: string().optional()
27446
+ }).nullable(),
27447
+ derivationAttemptedAt: number().nullable(),
27448
+ /** Why the last derivation failed, for the UI to show instead of a shrug. */
27449
+ derivationError: string().nullable()
27450
+ });
27451
+ /** `null` clears the location and re-arms nothing — the derivation stays spent. */
27452
+ var SetSiteLocationInputSchema = object({
27453
+ latitude: number().min(-90).max(90),
27454
+ longitude: number().min(-180).max(180)
27455
+ }).nullable();
26999
27456
  method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record(string(), unknown()), _null(), {
27000
27457
  kind: "mutation",
27001
27458
  auth: "admin"
27002
27459
  }), method(_void(), _void(), {
27003
27460
  kind: "mutation",
27004
27461
  auth: "admin"
27462
+ }), method(_void(), SiteLocationStatusSchema), method(SetSiteLocationInputSchema, SiteLocationStatusSchema, {
27463
+ kind: "mutation",
27464
+ auth: "admin"
27465
+ }), method(_void(), SiteLocationStatusSchema, {
27466
+ kind: "mutation",
27467
+ auth: "admin"
27005
27468
  });
27006
27469
  /**
27007
27470
  * Tamper / case-open detection sensor. Drives Home Assistant
@@ -31137,6 +31600,12 @@ Object.freeze({
31137
31600
  addonId: null,
31138
31601
  access: "create"
31139
31602
  },
31603
+ "llm.cancel": {
31604
+ capName: "llm",
31605
+ capScope: "system",
31606
+ addonId: null,
31607
+ access: "create"
31608
+ },
31140
31609
  "llm.deleteModel": {
31141
31610
  capName: "llm",
31142
31611
  capScope: "system",
@@ -33387,6 +33856,12 @@ Object.freeze({
33387
33856
  addonId: null,
33388
33857
  access: "create"
33389
33858
  },
33859
+ "sceneMonitor.resetScene": {
33860
+ capName: "scene-monitor",
33861
+ capScope: "device",
33862
+ addonId: null,
33863
+ access: "delete"
33864
+ },
33390
33865
  "sceneMonitor.updateScene": {
33391
33866
  capName: "scene-monitor",
33392
33867
  capScope: "device",
@@ -34065,6 +34540,12 @@ Object.freeze({
34065
34540
  addonId: null,
34066
34541
  access: "create"
34067
34542
  },
34543
+ "system.detectSiteLocation": {
34544
+ capName: "system",
34545
+ capScope: "system",
34546
+ addonId: null,
34547
+ access: "create"
34548
+ },
34068
34549
  "system.featureFlags": {
34069
34550
  capName: "system",
34070
34551
  capScope: "system",
@@ -34083,6 +34564,12 @@ Object.freeze({
34083
34564
  addonId: null,
34084
34565
  access: "view"
34085
34566
  },
34567
+ "system.getSiteLocation": {
34568
+ capName: "system",
34569
+ capScope: "system",
34570
+ addonId: null,
34571
+ access: "view"
34572
+ },
34086
34573
  "system.health": {
34087
34574
  capName: "system",
34088
34575
  capScope: "system",
@@ -34107,6 +34594,12 @@ Object.freeze({
34107
34594
  addonId: null,
34108
34595
  access: "create"
34109
34596
  },
34597
+ "system.setSiteLocation": {
34598
+ capName: "system",
34599
+ capScope: "system",
34600
+ addonId: null,
34601
+ access: "create"
34602
+ },
34110
34603
  "terminalSession.adoptLegacyMonitor": {
34111
34604
  capName: "terminal-session",
34112
34605
  capScope: "system",
@@ -36069,6 +36562,11 @@ Object.freeze({
36069
36562
  form: "single",
36070
36563
  optional: false
36071
36564
  }],
36565
+ "sceneMonitor.resetScene": [{
36566
+ name: "deviceId",
36567
+ form: "single",
36568
+ optional: false
36569
+ }],
36072
36570
  "sceneMonitor.updateScene": [{
36073
36571
  name: "deviceId",
36074
36572
  form: "single",