@camstack/addon-pipeline 1.2.75 → 1.2.77

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 (31) hide show
  1. package/dist/{addon-utils-a_36HH_N.js → addon-utils-bZcwLaVW.js} +1 -1
  2. package/dist/audio-analyzer/index.js +2 -2
  3. package/dist/audio-analyzer/index.mjs +1 -1
  4. package/dist/detection-pipeline/index.js +4 -4
  5. package/dist/detection-pipeline/index.mjs +2 -2
  6. package/dist/{dist-6ZJCV0jY.js → dist-DQZzL0Ri.js} +452 -42
  7. package/dist/{dist-T_8jMw7d.mjs → dist-HhcoV-Ky.mjs} +452 -42
  8. package/dist/{event-loop-stall-monitor-Cjof8vA1.js → event-loop-stall-monitor-CBOo1oh_.js} +1 -1
  9. package/dist/{event-loop-stall-monitor-XeGmL4xr.mjs → event-loop-stall-monitor-CqBEWGSZ.mjs} +1 -1
  10. package/dist/{lazy-sharp-DvwPafeP.js → lazy-sharp-DIC1rpea.js} +1 -1
  11. package/dist/motion-wasm/index.js +2 -2
  12. package/dist/motion-wasm/index.mjs +1 -1
  13. package/dist/pipeline-runner/index.js +278 -15
  14. package/dist/pipeline-runner/index.mjs +277 -14
  15. package/dist/recorder/index.js +368 -18
  16. package/dist/recorder/index.mjs +367 -17
  17. package/dist/session-decode/decode-worker-child.js +2 -2
  18. package/dist/session-decode/decode-worker-child.mjs +1 -1
  19. package/dist/stream-broker/_stub.js +2 -2
  20. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-H2OTmgR6.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-De_xzvjU.mjs} +3 -3
  21. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DHJSxHH1.mjs +26 -0
  22. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Dg08SxUW.mjs +26 -0
  23. package/dist/stream-broker/{hostInit-4XDN_Nt0.mjs → hostInit-CDS5frmk.mjs} +3 -3
  24. package/dist/stream-broker/index.js +306 -71
  25. package/dist/stream-broker/index.mjs +306 -71
  26. package/dist/stream-broker/remoteEntry.js +1 -1
  27. package/dist/{worker-protocol-SqED7Y9i.mjs → worker-protocol-BNlLGLBV.mjs} +1 -1
  28. package/dist/{worker-protocol-B0cbTXyw.js → worker-protocol-DZVGVAPU.js} +1 -1
  29. package/package.json +1 -1
  30. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-RYTOS6B-.mjs +0 -26
  31. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DfsLsn2e.mjs +0 -26
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  }) : target, mod));
23
23
  //#endregion
24
24
  let node_crypto = require("node:crypto");
25
- //#region ../types/dist/event-category-Cv9dO26A.mjs
25
+ //#region ../types/dist/event-category-Bxo5yJjt.mjs
26
26
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
27
27
  EventCategory["SystemBoot"] = "system.boot";
28
28
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -229,6 +229,33 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
229
229
  EventCategory["PipelineCameraAssigned"] = "pipeline.camera-assigned";
230
230
  EventCategory["PipelineCameraUnassigned"] = "pipeline.camera-unassigned";
231
231
  /**
232
+ * A node the orchestrator would otherwise place cameras on has NO usable
233
+ * inference device: the operator enabled one or more accelerators there and
234
+ * the live probe reports every one of them unavailable. Emitted once per
235
+ * TRANSITION into that state (never per dispatch), and the node is dropped
236
+ * from the placement candidate set for as long as it holds.
237
+ *
238
+ * This exists because the state was previously invisible: little-unraid
239
+ * absorbed 283k inference errors in a day while still being handed cameras,
240
+ * and nothing in the system said so.
241
+ *
242
+ * A node with no accelerators configured at all is NOT this — its devices
243
+ * are `disabled`, not `unavailable`, and the runner's default CPU pool
244
+ * serves it exactly as before.
245
+ */
246
+ EventCategory["PipelineNodeInferenceUnavailable"] = "pipeline.node-inference-unavailable";
247
+ /**
248
+ * A camera has an OPEN detection session and has produced no detection at
249
+ * all for longer than the blind threshold — the camera is being decoded and
250
+ * inferred and is returning nothing. Emitted once per transition into blind,
251
+ * per camera.
252
+ *
253
+ * The failure it reports: a 1h43 detection blackout on the entrance camera
254
+ * that nobody noticed, because "a camera that detects nothing" and "a quiet
255
+ * camera" produce byte-identical silence.
256
+ */
257
+ EventCategory["PipelineDetectionBlind"] = "pipeline.detection-blind";
258
+ /**
232
259
  * Per-camera pipeline config was mutated by the orchestrator
233
260
  * (3-level settings change via `setAgentAddonDefaults` /
234
261
  * `setCameraStepToggle` / `setCameraPipelineForAgent` or a
@@ -13641,6 +13668,17 @@ var LlmImageSchema = object({
13641
13668
  bytes: _instanceof(Uint8Array),
13642
13669
  mimeType: string()
13643
13670
  });
13671
+ /**
13672
+ * Retry policy. `enabled: false` is NOT the same as `maxAttempts: 1` in intent —
13673
+ * the flag is what a consumer table flips, the count is what the operator tunes.
13674
+ * A retry doubles the wall time of a call, so the two gates that run inside a
13675
+ * notification's budget keep it off (see `CONSUMER_RETRY_POLICY` in addon-ai).
13676
+ */
13677
+ var LlmRetryPolicySchema = object({
13678
+ enabled: boolean().default(false),
13679
+ /** Total attempts INCLUDING the first. 1 = no retry. */
13680
+ maxAttempts: number().int().min(1).max(5).default(1)
13681
+ });
13644
13682
  var LlmGenerateBaseInputSchema = object({
13645
13683
  /** Collection routing (the notification-output posture). */
13646
13684
  addonId: string().optional(),
@@ -13655,7 +13693,28 @@ var LlmGenerateBaseInputSchema = object({
13655
13693
  jsonSchema: record(string(), unknown()).optional(),
13656
13694
  /** Per-call override of the profile default. */
13657
13695
  maxTokens: number().int().positive().optional(),
13658
- temperature: number().optional()
13696
+ temperature: number().optional(),
13697
+ /** Per-call override of the profile default (nucleus sampling). */
13698
+ topP: number().min(0).max(1).optional(),
13699
+ /** Per-call override of the profile default (top-k sampling). */
13700
+ topK: number().int().positive().optional(),
13701
+ /** Per-call override of `profile.timeoutMs` — the total generation bound. */
13702
+ timeoutMs: number().int().positive().optional(),
13703
+ /** Per-call override; beats both the consumer table and the profile. */
13704
+ retry: LlmRetryPolicySchema.optional(),
13705
+ /**
13706
+ * Caller-minted id that makes this generation CANCELLABLE.
13707
+ *
13708
+ * Without it a caller that stops waiting cannot stop the work: the gates race
13709
+ * the call against 8 s and free their own slot when the timer wins, while the
13710
+ * generation upstream keeps running to `profile.timeoutMs` — 60 s by default,
13711
+ * on a single-threaded local model. The per-camera bound then counts WAITS,
13712
+ * not generations, and the real load is unbounded.
13713
+ *
13714
+ * `AbortSignal` cannot cross a process boundary; an id can. Pass one here and
13715
+ * `llm.cancel({ requestId })` tears the socket down.
13716
+ */
13717
+ requestId: string().optional()
13659
13718
  });
13660
13719
  /**
13661
13720
  * `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
@@ -13694,8 +13753,49 @@ var ManagedRuntimeConfigSchema = object({
13694
13753
  gpuLayers: number().int().default(0),
13695
13754
  /** Default: cpus-2, clamped ≥1 (resolved node-side). */
13696
13755
  threads: number().int().optional(),
13697
- /** Concurrent slots. */
13756
+ /** Concurrent slots (`--parallel`). */
13698
13757
  parallel: number().int().default(1),
13758
+ /** Logical batch size (`-b`). Larger = faster prompt ingest, more RAM. */
13759
+ batchSize: number().int().positive().optional(),
13760
+ /** Physical batch / micro-batch (`-ub`). */
13761
+ ubatchSize: number().int().positive().optional(),
13762
+ /**
13763
+ * `--flash-attn`. Cuts KV-cache memory on the backends that implement it and
13764
+ * is a no-op elsewhere, so it is offered rather than assumed.
13765
+ */
13766
+ flashAttention: boolean().default(false),
13767
+ /**
13768
+ * `--mlock`. Pins the weights in RAM so the OS cannot page them out mid
13769
+ * inference. Costs the full model size in resident memory — which is exactly
13770
+ * what the RAM budget is counting.
13771
+ */
13772
+ mlock: boolean().default(false),
13773
+ /**
13774
+ * `--no-mmap`. Reads the whole GGUF up front instead of mapping it. Slower to
13775
+ * start, but avoids the page-fault stalls a network or spinning-disk model
13776
+ * store produces on every first token.
13777
+ */
13778
+ noMmap: boolean().default(false),
13779
+ /** `--cache-type-k` / `--cache-type-v` — quantising the KV cache is the
13780
+ * cheapest way to fit a longer context in the same RAM. */
13781
+ cacheTypeK: _enum([
13782
+ "f32",
13783
+ "f16",
13784
+ "q8_0",
13785
+ "q5_1",
13786
+ "q5_0",
13787
+ "q4_1",
13788
+ "q4_0"
13789
+ ]).optional(),
13790
+ cacheTypeV: _enum([
13791
+ "f32",
13792
+ "f16",
13793
+ "q8_0",
13794
+ "q5_1",
13795
+ "q5_0",
13796
+ "q4_1",
13797
+ "q4_0"
13798
+ ]).optional(),
13699
13799
  /** Else lazy: first generate boots it. */
13700
13800
  autoStart: boolean().default(false),
13701
13801
  /** 0 = never; frees RAM after quiet periods. */
@@ -13783,10 +13883,44 @@ var LlmProfileSchema = object({
13783
13883
  baseUrl: string().optional(),
13784
13884
  /** ConfigUISchema type:'password' — never round-trips (spec §5). */
13785
13885
  apiKey: string().optional(),
13886
+ /** Vision on/off. A vision call against a `false` profile is REFUSED, never
13887
+ * degraded to text — that shipped once and produced a confident answer to a
13888
+ * question about a picture nobody sent. */
13786
13889
  supportsVision: boolean(),
13787
13890
  temperature: number().min(0).max(2).optional(),
13891
+ /** Nucleus sampling. Every wire we speak has it. */
13892
+ topP: number().min(0).max(1).optional(),
13893
+ /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
13894
+ * wire does, and the client drops it there (measured: the request body gets
13895
+ * `top_p` and no `top_k`). The profile editor hides the field wherever it
13896
+ * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
13897
+ topK: number().int().positive().optional(),
13788
13898
  maxTokens: number().int().positive().optional(),
13899
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own);
13900
+ * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
13901
+ * the model with, so it is the one field that changes a PROCESS. */
13902
+ contextLength: number().int().positive().optional(),
13903
+ /** Default system prompt. A caller's `system` REPLACES it (never appends —
13904
+ * two system prompts fighting is worse than either alone). */
13905
+ systemPrompt: string().optional(),
13906
+ /** Total generation bound — the only one a unary call has. */
13789
13907
  timeoutMs: number().int().positive().default(6e4),
13908
+ /** Wait for response headers only. */
13909
+ connectTimeoutMs: number().int().positive().default(1e4),
13910
+ /** Accepted, but no output yet — a cold GPU load lives here. */
13911
+ firstTokenTimeoutMs: number().int().positive().default(12e4),
13912
+ /** Output started then stopped. */
13913
+ idleTimeoutMs: number().int().positive().default(6e4),
13914
+ /** Profile-level default. The per-consumer table and a per-call override
13915
+ * both beat it — see `resolveRetryPolicy`. */
13916
+ retry: LlmRetryPolicySchema.default({
13917
+ enabled: false,
13918
+ maxAttempts: 1
13919
+ }),
13920
+ /** Whether this profile may use tools. The tool-call plumbing rides the
13921
+ * library; the REGISTRY of callable tools is ours and is empty in v1, so a
13922
+ * `true` here buys the wiring, not behaviour, until tools are registered. */
13923
+ toolsEnabled: boolean().default(false),
13790
13924
  extraHeaders: record(string(), string()).optional(),
13791
13925
  /** kind === 'managed-local' only (spec §4). */
13792
13926
  runtime: ManagedRuntimeConfigSchema.optional()
@@ -13848,7 +13982,10 @@ var ProfileRefInputSchema = object({
13848
13982
  addonId: string(),
13849
13983
  profileId: string()
13850
13984
  });
13851
- method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
13985
+ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({
13986
+ addonId: string().optional(),
13987
+ requestId: string()
13988
+ }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
13852
13989
  kind: "mutation",
13853
13990
  auth: "admin"
13854
13991
  }), method(ProfileRefInputSchema, _void(), {
@@ -15821,6 +15958,8 @@ var NcSystemEventKindSchema = _enum([
15821
15958
  "stream-offline",
15822
15959
  "node-online",
15823
15960
  "node-offline",
15961
+ "node-inference-unavailable",
15962
+ "detection-blind",
15824
15963
  "addon-update-available",
15825
15964
  "server-update-available",
15826
15965
  "alarm-triggered",
@@ -15925,28 +16064,36 @@ var NcOccupancyConditionSchema = object({
15925
16064
  /**
15926
16065
  * Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
15927
16066
  *
15928
- * Operator-approved vocabulary (2026-08-12, option A — the same one the
15929
- * reference notifier uses, so an operator moving between them re-uses what
15930
- * they already know): a rule matches when, over a sampling window of
15931
- * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
15932
- * window are HITS. A sample is a hit when it satisfies BOTH present filters:
15933
- *
15934
- * - `dbThreshold` its level is at or above this many dBFS (see
15935
- * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
15936
- * - `labels` the classifier put at least one of these labels on it.
15937
- *
15938
- * Both are OPTIONAL and independent, which is the point of the shape: a
15939
- * loudness rule ("something loud at 3am") needs no model to be right, and a
15940
- * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
15941
- * is given** a window in which every sample is trivially a hit would fire on
15942
- * silence, so the engine refuses such a condition rather than notifying on
15943
- * nothing (the schema cannot express "at least one of" without becoming a
15944
- * ZodEffects the cap path would have to special-case).
15945
- *
15946
- * `hitPercent` is over the samples the window actually HOLDS, and the window
15947
- * must be FULL before it can match a window that has been open for two
15948
- * seconds of its ten is 100% of nothing, and firing on it would make
15949
- * `samplingSeconds` decorative.
16067
+ * **TWO EXCLUSIVE MODES** (operator decision 2026-08-14, D157). Which one a
16068
+ * rule is in is not a stored field it is WHICH FILTER the rule carries, so
16069
+ * there is no second switch that can disagree with the first and every rule
16070
+ * authored before the decision migrates for free (`audioModeOf`):
16071
+ *
16072
+ * - **LABEL mode — `labels` present.** The rule fires on the FIRST frame the
16073
+ * classifier labels with one of them. No window, no percentage:
16074
+ * `hitPercent` and `samplingSeconds` are ignored, and the rule's own
16075
+ * `throttle` cooldown is the only brake. The per-label confidence floor is
16076
+ * the analyzer's (`classificationMinScore`, per device) — a label only
16077
+ * reaches this condition if the classifier was already confident enough.
16078
+ * - **LEVEL mode `dbThreshold` present, no labels.** The sampling window IS
16079
+ * the condition: at least `hitPercent`% of the samples over
16080
+ * `samplingSeconds` must be at or above `dbThreshold` dBFS (see
16081
+ * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale). The window
16082
+ * must be FULL before it can match a window open for two of its ten
16083
+ * seconds is 100% of nothing.
16084
+ *
16085
+ * **Why label mode has no window.** It had one, and it never fired: the
16086
+ * analyzer emits ~1 audio frame per second but YAMNet only LABELS one to three
16087
+ * of them per episode, even through continuous crying. The measured maximum
16088
+ * `hitPercent` over the whole live history was 40 — under the shipped default
16089
+ * of 60, so a label rule could not fire at all, ever. A percentage of frames is
16090
+ * the wrong question to ask of a sparse classifier.
16091
+ *
16092
+ * **Fail-closed when NEITHER is given** — every sample would be a trivial hit
16093
+ * and the rule would fire on silence. The schema cannot express "exactly one
16094
+ * of" without becoming a ZodEffects the cap path would have to special-case, so
16095
+ * the exclusivity is enforced where every editor writes (`patchAudio`) and a
16096
+ * legacy rule carrying both resolves to LABEL (the mode that fires).
15950
16097
  *
15951
16098
  * Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
15952
16099
  * `audio-*` ids). Both spellings are accepted — the matcher normalizes the
@@ -15954,13 +16101,13 @@ var NcOccupancyConditionSchema = object({
15954
16101
  * an operator who typed `dog` mean the same thing.
15955
16102
  */
15956
16103
  var NcAudioConditionSchema = object({
15957
- /** Audio macro labels; absent = any sound (level-only rule). */
16104
+ /** LABEL MODE: audio macro labels. Present fires on the first labelled frame. */
15958
16105
  labels: array(string().min(1)).min(1).optional(),
15959
- /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
16106
+ /** LEVEL MODE: floor in dBFS (negative-going, `0` = full scale). */
15960
16107
  dbThreshold: number().min(-96).max(0).optional(),
15961
- /** Percentage of the window's samples that must be hits (1–100). */
16108
+ /** LEVEL MODE ONLY: percentage of the window's samples that must be hits (1–100). */
15962
16109
  hitPercent: number().int().min(1).max(100).default(60),
15963
- /** Length of the sampling window in seconds. */
16110
+ /** LEVEL MODE ONLY: length of the sampling window in seconds. */
15964
16111
  samplingSeconds: number().int().min(1).max(300).default(10)
15965
16112
  });
15966
16113
  /**
@@ -16592,7 +16739,50 @@ var NcRuleInputSchema = object({
16592
16739
  * tests every zone the track visited and a `crossing` condition can no longer
16593
16740
  * be satisfied, because a closed track carries no crossing.
16594
16741
  */
16595
- waitForEnhancement: boolean().optional()
16742
+ waitForEnhancement: boolean().optional(),
16743
+ /**
16744
+ * GROUP a burst of subjects into ONE notification that grows.
16745
+ *
16746
+ * Seconds of quiet after the last matching subject before the burst is
16747
+ * considered over. While it is open, the first subject enqueues immediately —
16748
+ * **exactly as today, with no added latency** — and every real growth (a new
16749
+ * subject, or a name confirmed on one already in it) REPLACES that
16750
+ * notification with an updated one naming everybody. The push carries the
16751
+ * group's own coalescing tag, so the phone replaces rather than stacks.
16752
+ *
16753
+ * `0` / absent = off, and off is today's behaviour byte for byte.
16754
+ *
16755
+ * ### Why an idle cutoff and not a window
16756
+ *
16757
+ * The measured seven-person arrival on device 590 spans 110 s with every
16758
+ * internal gap under 30 s. A 12 s fixed window cuts it into three groups; an
16759
+ * idle cutoff holds it as one and ends it when the arrival actually ends.
16760
+ * 30 is Frigate's shipped value for the same decision.
16761
+ *
16762
+ * ### What it replaces
16763
+ *
16764
+ * The blind cooldown, which collapses a burst by DISCARDING it. Measured on
16765
+ * device 615 / *Persona su Uscio* over six days: 116 qualifying tracks → 74
16766
+ * notifications, **44 (37.9%) suppressed outright**, 23 of them overlapping a
16767
+ * track that did fire and 7 carrying a confirmed identity nobody heard about.
16768
+ * A group collapses the same volume by MERGING, so the cooldown becomes a
16769
+ * budget over GROUPS — which is what it always meant — and a growth is never
16770
+ * throttled by the window its own first member spent.
16771
+ *
16772
+ * ### Interaction with {@link waitForEnhancement}
16773
+ *
16774
+ * They compose, and the order matters. `waitForEnhancement` defers the rule to
16775
+ * TRACK CLOSE, so with both set the group is opened by the first member to
16776
+ * CLOSE — already carrying its name — and grows as later members close. That
16777
+ * is later, and complete. With grouping alone the group opens on the first
16778
+ * object event and picks up names as they are confirmed, through the growth
16779
+ * path. Neither combination fires twice for one subject.
16780
+ *
16781
+ * `.optional()` and deliberately NOT `.default()`: a Zod default does not run
16782
+ * on the addon cap path, so absent must keep meaning what it meant before this
16783
+ * field existed.
16784
+ */
16785
+ groupIdleSec: number().int().min(0).max(600).optional()
16596
16786
  });
16597
16787
  /**
16598
16788
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -17518,7 +17708,7 @@ var TrackEnvelopeSchema = object({
17518
17708
  * `snapshots[]` references — megabytes across a page of tracks. `slim`
17519
17709
  * keeps every scalar the list surfaces actually render (ids, class(es),
17520
17710
  * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
17521
- * zonesVisited, bestEventId, envelope, hasFace) and returns `positions` /
17711
+ * zonesVisited, bestEventId, envelope, hasFace, hasRider) and returns `positions` /
17522
17712
  * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
17523
17713
  * `getTrack`. Mirrors the event-store `projection` convention
17524
17714
  * (`getObjectEvents` et al.).
@@ -17805,6 +17995,28 @@ var TrackSchema = object({
17805
17995
  * `=== true` and render nothing otherwise, never infer "no face".
17806
17996
  */
17807
17997
  hasFace: boolean().optional(),
17998
+ /**
17999
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
18000
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
18001
+ * so the passage is tracked once and as a VEHICLE.
18002
+ *
18003
+ * It exists because the fold's record was dishonest. D34 and the code both
18004
+ * said "the person is not lost — it is reported so both entities stay on the
18005
+ * record"; in fact the pair went into a per-processor RAM field behind an
18006
+ * accessor nobody called, and every durable surface said `vehicle`, full
18007
+ * stop. This is the composition note that makes the row true.
18008
+ *
18009
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
18010
+ * person" is not an answer to "what is this" — both label tiers would refuse
18011
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
18012
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
18013
+ * and a `person` rule still does not fire for someone cycling past.
18014
+ *
18015
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
18016
+ * the column, and every hub that predates the field, omits it. Test
18017
+ * `=== true` and render nothing otherwise — never infer "no rider".
18018
+ */
18019
+ hasRider: boolean().optional(),
17808
18020
  ...TrackFlagFields,
17809
18021
  ...TrackRetrainFields
17810
18022
  });
@@ -26392,14 +26604,50 @@ var recordingExportCapability = {
26392
26604
  * thing except the comparator: `similarity` (CLIP cosine at the same ROI coords
26393
26605
  * vs condition-tagged references) and `llm` (vision-LLM judgment over the crop).
26394
26606
  *
26395
- * D14 device-config archetype (`deviceConfig.ui.kind:'widget'`) the framework
26396
- * derives the device-detail contribution; the provider carries NO hand-written
26397
- * settings-contribution methods. `status.kind:'push'` the engine pushes on
26398
- * every hysteresis flip / availability change; consumers never poll.
26399
- */
26400
- /** Extensible condition tag. Seeded 'day' | 'night'; open by design so more can
26401
- * be added without a wire break (matching falls back to any-condition refs). */
26607
+ * **No `deviceConfig`, deliberately.** This shipped as the D14 widget archetype,
26608
+ * which put a "Scenes" tab on one camera's detail page. That is the wrong shape
26609
+ * for the thing: a scene is a standing question about the property ("is the bin
26610
+ * still out"), and the operator's question is "which of my scenes have tripped",
26611
+ * across every camera at once — not "what does camera 617 think". Buried one
26612
+ * camera deep it also could not be found. The surface is now a top-level admin
26613
+ * page (`/scenes`, `pages/Scenes.tsx`) that lists every scene on every camera and
26614
+ * picks the camera inside the create flow, the same shape Events and Faces have.
26615
+ *
26616
+ * The consequence to keep in mind: `host/scene-monitor-editor` is gone from
26617
+ * `HOST_WIDGETS` too. `scripts/check-host-widget-resolves.ts` asserts BOTH
26618
+ * directions, so a registration nobody declares fails exactly as loudly as a
26619
+ * declaration nobody registers. The editor is imported directly by the page.
26620
+ *
26621
+ * `status.kind:'push'` — the engine pushes on every hysteresis flip /
26622
+ * availability change; consumers never poll.
26623
+ */
26624
+ /** Extensible condition tag. Seeded 'day' | 'ir' (the two variants the operator
26625
+ * captures) plus 'night' | 'dawn' | 'dusk' from the resolver's sun-times band.
26626
+ * Open by design so more can be added without a wire break.
26627
+ *
26628
+ * Matching does NOT fall back across conditions: cross-condition cosines are
26629
+ * not comparable, so "I have never seen this scene in this light" is reported
26630
+ * as `unknown`, never guessed. A day reference scored against an IR frame
26631
+ * collapses the cosine and would latch a false alarm every single night. */
26402
26632
  var SceneConditionSchema = string();
26633
+ /** `matched` = the baseline is what we see; `diverged` = it demonstrably is not;
26634
+ * `unknown` = we cannot judge (no reference for this condition, encoder model
26635
+ * changed, view shifted, no snapshot). `unknown` is a real value, not a null,
26636
+ * and never counts toward hysteresis in either direction. */
26637
+ var SceneVerdictSchema = _enum([
26638
+ "matched",
26639
+ "diverged",
26640
+ "unknown"
26641
+ ]);
26642
+ /** Why a scene cannot judge. Named, because this feature's failure mode is
26643
+ * silence that reads as "nothing has happened". */
26644
+ var SceneUnavailableSchema = _enum([
26645
+ "no-reference-for-condition",
26646
+ "view-shifted",
26647
+ "no-vision-profile",
26648
+ "encoder-model-changed",
26649
+ "no-snapshot"
26650
+ ]);
26403
26651
  /** One captured reference — condition-tagged, model-version-gated. `embedding`
26404
26652
  * is `number[]` (Float32Array does NOT survive MsgPack/UDS). */
26405
26653
  var SceneReferenceSchema = object({
@@ -26407,7 +26655,14 @@ var SceneReferenceSchema = object({
26407
26655
  modelId: string(),
26408
26656
  condition: SceneConditionSchema,
26409
26657
  capturedAt: number(),
26410
- thumbnailMediaId: string().optional()
26658
+ thumbnailMediaId: string().optional(),
26659
+ /** Whole-frame (downscaled) embedding captured alongside the ROI crop. The
26660
+ * anti-view-shift anchor: a bumped camera, a PTZ preset or a re-aim makes the
26661
+ * normalized rect frame a different piece of world, and the scene would
26662
+ * diverge forever with a perfectly plausible cosine. Checked LAZILY, only
26663
+ * when hysteresis is about to flip — one extra encode per candidate
26664
+ * transition, not per poll. */
26665
+ anchorEmbedding: array(number()).optional()
26411
26666
  });
26412
26667
  var SceneMonitorStateSchema = object({
26413
26668
  id: string(),
@@ -26429,6 +26684,25 @@ var SceneCheckSchema = discriminatedUnion("mode", [object({
26429
26684
  profileId: string().optional(),
26430
26685
  hysteresisCount: number().int().positive()
26431
26686
  })]);
26687
+ var SCENE_DEFAULT_ANCHOR_THRESHOLD = .85;
26688
+ /**
26689
+ * Vision-model adjudication of a candidate flip. Field names deliberately
26690
+ * mirror `NcConfirmSchema` so an operator meets one vocabulary, not two.
26691
+ *
26692
+ * `onTimeout` defaults to **'hold'**, the OPPOSITE of `NcConfirmGate`'s
26693
+ * fail-open: a notification suppressed is the worse error there, but a vision
26694
+ * model that timed out has not told us the bin is gone, and a latch is a
26695
+ * stateful claim that costs the operator a trip to reset.
26696
+ */
26697
+ var SceneConfirmSchema = object({
26698
+ enabled: boolean().default(false),
26699
+ prompt: string().min(1).max(1e3),
26700
+ profileId: string().optional(),
26701
+ timeoutMs: number().int().min(1e3).max(2e4).default(8e3),
26702
+ maxImagePx: number().int().min(64).max(2048).default(448),
26703
+ /** What a timeout / unavailable model means for the PENDING flip. */
26704
+ onTimeout: _enum(["flip", "hold"]).default("hold")
26705
+ });
26432
26706
  var SceneMonitorSchema = object({
26433
26707
  id: string(),
26434
26708
  label: string(),
@@ -26447,7 +26721,41 @@ var SceneMonitorSchema = object({
26447
26721
  lastConfidence: number().nullable(),
26448
26722
  currentCondition: SceneConditionSchema.nullable(),
26449
26723
  availability: _enum(["ok", "unavailable"]),
26450
- unavailableReason: string().nullable()
26724
+ unavailableReason: string().nullable(),
26725
+ /** Which state is "the initial screen". `null` until the first capture. */
26726
+ baselineStateId: string().nullable(),
26727
+ /** Which boolean drives notification rules and any export. */
26728
+ emit: _enum(["latched", "live"]).default("latched"),
26729
+ /** Live: does the region match the baseline RIGHT NOW. */
26730
+ verdict: SceneVerdictSchema,
26731
+ /** Has it been `diverged` at least once since `armedAt` — the operator's boolean. */
26732
+ latched: boolean(),
26733
+ /** Last reset (or creation). */
26734
+ armedAt: number(),
26735
+ divergedAt: number().nullable(),
26736
+ restoredAt: number().nullable(),
26737
+ /** A check is only COUNTED when the device has been quiet this long. Motion
26738
+ * during the window DISCARDS the observation — a car pulling up in front of
26739
+ * the bin must not be able to spend hysteresis credit. */
26740
+ quietSeconds: number().int().min(0).max(3600).default(60),
26741
+ /** An observation only advances the pending count when it is at least this
26742
+ * far from the previously counted one, so N agreeing checks span real time
26743
+ * rather than N adjacent polls inside one occlusion. */
26744
+ minObservationSpacingSec: number().int().min(0).max(3600).default(120),
26745
+ /** Vision-model adjudication of a candidate flip. Similarity primary only. */
26746
+ confirm: SceneConfirmSchema.optional(),
26747
+ /** Whole-frame anchor cosine below which a flip is REFUSED as `view-shifted`. */
26748
+ anchorThreshold: number().min(0).max(1).default(SCENE_DEFAULT_ANCHOR_THRESHOLD),
26749
+ /** Clear the latch on its own when the scene matches again? Default false —
26750
+ * `restoredAt` and the `scene-restored` edge are recorded regardless, so an
26751
+ * automation can react to the bin coming back without the operator's own
26752
+ * alarm silently clearing itself. */
26753
+ autoRestore: boolean().default(false),
26754
+ /** Named cause when `verdict === 'unknown'`. */
26755
+ unavailable: SceneUnavailableSchema.nullable(),
26756
+ /** Conditions that have at least one comparable reference — the coverage line
26757
+ * ("day ✓ · ir ✓ · dusk ✗") that turns a silent fallback into a visible fact. */
26758
+ coveredConditions: array(SceneConditionSchema)
26451
26759
  });
26452
26760
  var SceneMonitorStatusSchema = object({
26453
26761
  monitors: array(SceneMonitorSchema),
@@ -26480,7 +26788,14 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
26480
26788
  "both"
26481
26789
  ]).optional(),
26482
26790
  checkIntervalSec: number().optional(),
26483
- check: SceneCheckSchema.optional()
26791
+ check: SceneCheckSchema.optional(),
26792
+ emit: _enum(["latched", "live"]).optional(),
26793
+ quietSeconds: number().int().min(0).max(3600).optional(),
26794
+ minObservationSpacingSec: number().int().min(0).max(3600).optional(),
26795
+ anchorThreshold: number().min(0).max(1).optional(),
26796
+ autoRestore: boolean().optional(),
26797
+ /** `null` clears the vision-model adjudicator. */
26798
+ confirm: SceneConfirmSchema.nullable().optional()
26484
26799
  })
26485
26800
  }), _void(), {
26486
26801
  kind: "mutation",
@@ -26517,6 +26832,14 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
26517
26832
  }), _void(), {
26518
26833
  kind: "mutation",
26519
26834
  auth: "admin"
26835
+ }), method(object({
26836
+ deviceId: number(),
26837
+ monitorId: string(),
26838
+ /** Defaults to TRUE at the provider seam — see `SCENE_RESET_RECAPTURES`. */
26839
+ recapture: boolean().optional()
26840
+ }), _void(), {
26841
+ kind: "mutation",
26842
+ auth: "admin"
26520
26843
  });
26521
26844
  /**
26522
26845
  * Per-stage gating mode applied to the zones a rule references.
@@ -26825,12 +27148,64 @@ var NetworkAddressSchema = object({
26825
27148
  family: string(),
26826
27149
  internal: boolean()
26827
27150
  });
27151
+ /**
27152
+ * Provenance of the site coordinates, and the whole reason this is not just two
27153
+ * numbers.
27154
+ *
27155
+ * - `operator-set` — a human typed it, or accepted a detection. Authoritative;
27156
+ * nothing overwrites it.
27157
+ * - `derived-from-ip` — the hub geolocated its own public IP once, because a
27158
+ * default that is right to a few kilometres beats the coarse UTC clock split
27159
+ * the sun-times consumers otherwise fall back to.
27160
+ *
27161
+ * The UI shows which one it is. An operator who cannot tell a guess from their
27162
+ * own input will eventually trust the guess.
27163
+ */
27164
+ var SiteLocationSourceSchema = _enum(["operator-set", "derived-from-ip"]);
27165
+ /**
27166
+ * The read shape: the location plus the honest state of the one-shot derivation.
27167
+ *
27168
+ * `derivationAttemptedAt` is what makes the "one call, ever" contract
27169
+ * inspectable. When it is set and `location` is null, the geo-IP lookup ran and
27170
+ * failed; the hub will NOT try again on its own — the fallback is declared
27171
+ * (consumers degrade to their own last resort) and the operator either types the
27172
+ * coordinates or presses detect.
27173
+ */
27174
+ var SiteLocationStatusSchema = object({
27175
+ location: object({
27176
+ /** WGS84 decimal degrees. */
27177
+ latitude: number().min(-90).max(90),
27178
+ longitude: number().min(-180).max(180),
27179
+ source: SiteLocationSourceSchema,
27180
+ /** Epoch ms the value was last written. */
27181
+ updatedAt: number(),
27182
+ /**
27183
+ * Human-readable place the geo-IP service reported ("Napoli, IT"). Display
27184
+ * only — never parsed, never matched on. Absent for an operator-typed value.
27185
+ */
27186
+ label: string().optional()
27187
+ }).nullable(),
27188
+ derivationAttemptedAt: number().nullable(),
27189
+ /** Why the last derivation failed, for the UI to show instead of a shrug. */
27190
+ derivationError: string().nullable()
27191
+ });
27192
+ /** `null` clears the location and re-arms nothing — the derivation stays spent. */
27193
+ var SetSiteLocationInputSchema = object({
27194
+ latitude: number().min(-90).max(90),
27195
+ longitude: number().min(-180).max(180)
27196
+ }).nullable();
26828
27197
  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(), {
26829
27198
  kind: "mutation",
26830
27199
  auth: "admin"
26831
27200
  }), method(_void(), _void(), {
26832
27201
  kind: "mutation",
26833
27202
  auth: "admin"
27203
+ }), method(_void(), SiteLocationStatusSchema), method(SetSiteLocationInputSchema, SiteLocationStatusSchema, {
27204
+ kind: "mutation",
27205
+ auth: "admin"
27206
+ }), method(_void(), SiteLocationStatusSchema, {
27207
+ kind: "mutation",
27208
+ auth: "admin"
26834
27209
  });
26835
27210
  object({
26836
27211
  /** True when the device's tamper switch / case-open contact is
@@ -29561,6 +29936,12 @@ Object.freeze({
29561
29936
  addonId: null,
29562
29937
  access: "create"
29563
29938
  },
29939
+ "llm.cancel": {
29940
+ capName: "llm",
29941
+ capScope: "system",
29942
+ addonId: null,
29943
+ access: "create"
29944
+ },
29564
29945
  "llm.deleteModel": {
29565
29946
  capName: "llm",
29566
29947
  capScope: "system",
@@ -31811,6 +32192,12 @@ Object.freeze({
31811
32192
  addonId: null,
31812
32193
  access: "create"
31813
32194
  },
32195
+ "sceneMonitor.resetScene": {
32196
+ capName: "scene-monitor",
32197
+ capScope: "device",
32198
+ addonId: null,
32199
+ access: "delete"
32200
+ },
31814
32201
  "sceneMonitor.updateScene": {
31815
32202
  capName: "scene-monitor",
31816
32203
  capScope: "device",
@@ -32489,6 +32876,12 @@ Object.freeze({
32489
32876
  addonId: null,
32490
32877
  access: "create"
32491
32878
  },
32879
+ "system.detectSiteLocation": {
32880
+ capName: "system",
32881
+ capScope: "system",
32882
+ addonId: null,
32883
+ access: "create"
32884
+ },
32492
32885
  "system.featureFlags": {
32493
32886
  capName: "system",
32494
32887
  capScope: "system",
@@ -32507,6 +32900,12 @@ Object.freeze({
32507
32900
  addonId: null,
32508
32901
  access: "view"
32509
32902
  },
32903
+ "system.getSiteLocation": {
32904
+ capName: "system",
32905
+ capScope: "system",
32906
+ addonId: null,
32907
+ access: "view"
32908
+ },
32510
32909
  "system.health": {
32511
32910
  capName: "system",
32512
32911
  capScope: "system",
@@ -32531,6 +32930,12 @@ Object.freeze({
32531
32930
  addonId: null,
32532
32931
  access: "create"
32533
32932
  },
32933
+ "system.setSiteLocation": {
32934
+ capName: "system",
32935
+ capScope: "system",
32936
+ addonId: null,
32937
+ access: "create"
32938
+ },
32534
32939
  "terminalSession.adoptLegacyMonitor": {
32535
32940
  capName: "terminal-session",
32536
32941
  capScope: "system",
@@ -34493,6 +34898,11 @@ Object.freeze({
34493
34898
  form: "single",
34494
34899
  optional: false
34495
34900
  }],
34901
+ "sceneMonitor.resetScene": [{
34902
+ name: "deviceId",
34903
+ form: "single",
34904
+ optional: false
34905
+ }],
34496
34906
  "sceneMonitor.updateScene": [{
34497
34907
  name: "deviceId",
34498
34908
  form: "single",