@camstack/addon-pipeline 1.2.76 → 1.2.78

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-CTpQfjSR.js → addon-utils-C-XbUkiG.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-CZLjObZZ.js → dist-BdVCXl5n.js} +429 -44
  7. package/dist/{dist-zksfWnEA.mjs → dist-CsP_DikG.mjs} +429 -44
  8. package/dist/{event-loop-stall-monitor-CcBQAI28.js → event-loop-stall-monitor-BOu8lGee.js} +1 -1
  9. package/dist/{event-loop-stall-monitor-BuZA3loB.mjs → event-loop-stall-monitor-C3cvE_Xk.mjs} +1 -1
  10. package/dist/{lazy-sharp-SWR_D1Um.js → lazy-sharp-1LkmyWqV.js} +1 -1
  11. package/dist/motion-wasm/index.js +2 -2
  12. package/dist/motion-wasm/index.mjs +1 -1
  13. package/dist/pipeline-runner/index.js +4 -4
  14. package/dist/pipeline-runner/index.mjs +3 -3
  15. package/dist/recorder/index.js +655 -46
  16. package/dist/recorder/index.mjs +654 -45
  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-Dd6XOtVn.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-DUi-lR4R.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-1QMyGZMB.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-COc_Q_xX.mjs → hostInit-DEtsjgBO.mjs} +3 -3
  24. package/dist/stream-broker/index.js +411 -93
  25. package/dist/stream-broker/index.mjs +411 -93
  26. package/dist/stream-broker/remoteEntry.js +1 -1
  27. package/dist/{worker-protocol-DAQ1iZFK.js → worker-protocol-B4fPjmXk.js} +1 -1
  28. package/dist/{worker-protocol-DyX_HbaJ.mjs → worker-protocol-BRwzX3f_.mjs} +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
@@ -13668,6 +13668,17 @@ var LlmImageSchema = object({
13668
13668
  bytes: _instanceof(Uint8Array),
13669
13669
  mimeType: string()
13670
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
+ });
13671
13682
  var LlmGenerateBaseInputSchema = object({
13672
13683
  /** Collection routing (the notification-output posture). */
13673
13684
  addonId: string().optional(),
@@ -13682,7 +13693,28 @@ var LlmGenerateBaseInputSchema = object({
13682
13693
  jsonSchema: record(string(), unknown()).optional(),
13683
13694
  /** Per-call override of the profile default. */
13684
13695
  maxTokens: number().int().positive().optional(),
13685
- 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()
13686
13718
  });
13687
13719
  /**
13688
13720
  * `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
@@ -13721,8 +13753,49 @@ var ManagedRuntimeConfigSchema = object({
13721
13753
  gpuLayers: number().int().default(0),
13722
13754
  /** Default: cpus-2, clamped ≥1 (resolved node-side). */
13723
13755
  threads: number().int().optional(),
13724
- /** Concurrent slots. */
13756
+ /** Concurrent slots (`--parallel`). */
13725
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(),
13726
13799
  /** Else lazy: first generate boots it. */
13727
13800
  autoStart: boolean().default(false),
13728
13801
  /** 0 = never; frees RAM after quiet periods. */
@@ -13810,10 +13883,44 @@ var LlmProfileSchema = object({
13810
13883
  baseUrl: string().optional(),
13811
13884
  /** ConfigUISchema type:'password' — never round-trips (spec §5). */
13812
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. */
13813
13889
  supportsVision: boolean(),
13814
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(),
13815
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. */
13816
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),
13817
13924
  extraHeaders: record(string(), string()).optional(),
13818
13925
  /** kind === 'managed-local' only (spec §4). */
13819
13926
  runtime: ManagedRuntimeConfigSchema.optional()
@@ -13875,7 +13982,10 @@ var ProfileRefInputSchema = object({
13875
13982
  addonId: string(),
13876
13983
  profileId: string()
13877
13984
  });
13878
- 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, {
13879
13989
  kind: "mutation",
13880
13990
  auth: "admin"
13881
13991
  }), method(ProfileRefInputSchema, _void(), {
@@ -15954,28 +16064,36 @@ var NcOccupancyConditionSchema = object({
15954
16064
  /**
15955
16065
  * Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
15956
16066
  *
15957
- * Operator-approved vocabulary (2026-08-12, option A — the same one the
15958
- * reference notifier uses, so an operator moving between them re-uses what
15959
- * they already know): a rule matches when, over a sampling window of
15960
- * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
15961
- * window are HITS. A sample is a hit when it satisfies BOTH present filters:
15962
- *
15963
- * - `dbThreshold` its level is at or above this many dBFS (see
15964
- * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
15965
- * - `labels` the classifier put at least one of these labels on it.
15966
- *
15967
- * Both are OPTIONAL and independent, which is the point of the shape: a
15968
- * loudness rule ("something loud at 3am") needs no model to be right, and a
15969
- * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
15970
- * is given** a window in which every sample is trivially a hit would fire on
15971
- * silence, so the engine refuses such a condition rather than notifying on
15972
- * nothing (the schema cannot express "at least one of" without becoming a
15973
- * ZodEffects the cap path would have to special-case).
15974
- *
15975
- * `hitPercent` is over the samples the window actually HOLDS, and the window
15976
- * must be FULL before it can match a window that has been open for two
15977
- * seconds of its ten is 100% of nothing, and firing on it would make
15978
- * `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).
15979
16097
  *
15980
16098
  * Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
15981
16099
  * `audio-*` ids). Both spellings are accepted — the matcher normalizes the
@@ -15983,13 +16101,13 @@ var NcOccupancyConditionSchema = object({
15983
16101
  * an operator who typed `dog` mean the same thing.
15984
16102
  */
15985
16103
  var NcAudioConditionSchema = object({
15986
- /** Audio macro labels; absent = any sound (level-only rule). */
16104
+ /** LABEL MODE: audio macro labels. Present fires on the first labelled frame. */
15987
16105
  labels: array(string().min(1)).min(1).optional(),
15988
- /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
16106
+ /** LEVEL MODE: floor in dBFS (negative-going, `0` = full scale). */
15989
16107
  dbThreshold: number().min(-96).max(0).optional(),
15990
- /** 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). */
15991
16109
  hitPercent: number().int().min(1).max(100).default(60),
15992
- /** Length of the sampling window in seconds. */
16110
+ /** LEVEL MODE ONLY: length of the sampling window in seconds. */
15993
16111
  samplingSeconds: number().int().min(1).max(300).default(10)
15994
16112
  });
15995
16113
  /**
@@ -16127,13 +16245,81 @@ var NcRuleActionsSchema = object({
16127
16245
  */
16128
16246
  buttons: array(NcRuleNotificationButtonSchema).max(8).optional()
16129
16247
  });
16248
+ /**
16249
+ * "This rule applies only while `deviceId` is in one of `states`."
16250
+ *
16251
+ * The states are the DEVICE's own vocabulary — `AlarmState` for a panel,
16252
+ * `on`/`off` for a switch — not a normalised set, because normalising would
16253
+ * make the condition lie about devices whose states have no equivalent.
16254
+ *
16255
+ * An unreadable state does NOT match: see the engine's fail-closed gate. A
16256
+ * condition that fired on "I could not read it" would be worse than no gate.
16257
+ */
16258
+ var NcDeviceStateConditionSchema = object({
16259
+ deviceId: number().int(),
16260
+ /** Any of these matches. */
16261
+ states: array(string().min(1)).min(1)
16262
+ });
16263
+ /**
16264
+ * "This rule applies only while scene `sceneId` is `matched` / `diverged`."
16265
+ *
16266
+ * A GATE, not a trigger. `occupancy` and `audio` each DISCRIMINATE their rule —
16267
+ * carrying one makes the rule fire on that subject and nothing else. Scene is
16268
+ * the other shape entirely, the `deviceState` shape: it narrows a rule that
16269
+ * already has a trigger ("tell me about a person at the front door, but only
16270
+ * while the bin is still out"). That is why it composes with every delivery
16271
+ * instead of owning one, and why no new `NcDelivery` member and no new subject
16272
+ * kind exist for it — see D159.
16273
+ *
16274
+ * ── Identity ───────────────────────────────────────────────────────────────
16275
+ * `sceneId` is `SceneMonitor.id`, a `randomUUID()` minted by `createScene` —
16276
+ * globally unique, so it needs no device to disambiguate it. `deviceId` is
16277
+ * carried as a HINT for the editor and for the log line, never as part of the
16278
+ * lookup key: a rule whose hint drifted must still gate correctly.
16279
+ *
16280
+ * ── Which boolean ──────────────────────────────────────────────────────────
16281
+ * `latched` ABSENT means "whatever the scene itself says" — `SceneMonitor.emit`
16282
+ * already declares which boolean drives notification rules, and a second knob
16283
+ * that could disagree with it is exactly the D62 failure. Set it only to
16284
+ * override one rule against the scene's own default.
16285
+ *
16286
+ * - LIVE reading (`emit`/`latched` resolve to live): passes iff
16287
+ * `verdict === requiredState`. `unknown` — no reference for this light, view
16288
+ * shifted, no snapshot — passes NEITHER. A scene that cannot judge is not
16289
+ * evidence, in either direction.
16290
+ * - LATCHED reading: passes iff `latched === (requiredState === 'diverged')`.
16291
+ * The latch is a durable fact about the past ("it has diverged since I armed
16292
+ * it"), so a camera that has gone dark does not clear it — that is the whole
16293
+ * reason the operator asked for a latch.
16294
+ *
16295
+ * The gate reads an in-memory mirror (`NcSceneStateCache`) refreshed OFF the
16296
+ * event path, never the cap: D49. A mirror that has never loaded, or a scene it
16297
+ * does not carry, reads absent and the rule does NOT fire — fail closed, and
16298
+ * said out loud in the log rather than dropped in silence.
16299
+ */
16300
+ var NcSceneConditionSchema = object({
16301
+ /** `SceneMonitor.id` — the uuid the cap mints. The whole lookup key. */
16302
+ sceneId: string().min(1),
16303
+ /** The camera the scene lives on. A hint for the editor and the log line. */
16304
+ deviceId: number().int().optional(),
16305
+ /** The state the scene must be in for the rule to fire. */
16306
+ requiredState: _enum(["matched", "diverged"]),
16307
+ /**
16308
+ * Read the LATCH (`true`) or the LIVE verdict (`false`). Absent = follow the
16309
+ * scene's own `emit` field, which is the only place that decision belongs.
16310
+ */
16311
+ latched: boolean().optional()
16312
+ });
16130
16313
  var NcConditionsSchema = object({
16131
16314
  /** Gate on ANOTHER device's current state (the alarm armed, a switch on). */
16132
- deviceState: object({
16133
- deviceId: number().int(),
16134
- /** Any of these matches. */
16135
- states: array(string().min(1)).min(1)
16136
- }).optional(),
16315
+ deviceState: NcDeviceStateConditionSchema.optional(),
16316
+ /**
16317
+ * Gate on a SCENE's state — "only while the bin is still out". Composes with
16318
+ * every trigger (detection, occupancy, audio, sensor, package, track-end);
16319
+ * unlike `occupancy`/`audio` it discriminates nothing. See
16320
+ * {@link NcSceneCondition} and D159.
16321
+ */
16322
+ scene: NcSceneConditionSchema.optional(),
16137
16323
  /** Device scope — absent = all devices. */
16138
16324
  devices: array(number()).optional(),
16139
16325
  /** Detector class names (any overlap with the record's class set). */
@@ -16771,6 +16957,7 @@ var NcConditionDescriptorSchema = object({
16771
16957
  "occupancy",
16772
16958
  "audio",
16773
16959
  "deviceState",
16960
+ "scene",
16774
16961
  "systemEvent"
16775
16962
  ]),
16776
16963
  operator: _enum([
@@ -26486,14 +26673,50 @@ var recordingExportCapability = {
26486
26673
  * thing except the comparator: `similarity` (CLIP cosine at the same ROI coords
26487
26674
  * vs condition-tagged references) and `llm` (vision-LLM judgment over the crop).
26488
26675
  *
26489
- * D14 device-config archetype (`deviceConfig.ui.kind:'widget'`) the framework
26490
- * derives the device-detail contribution; the provider carries NO hand-written
26491
- * settings-contribution methods. `status.kind:'push'` the engine pushes on
26492
- * every hysteresis flip / availability change; consumers never poll.
26493
- */
26494
- /** Extensible condition tag. Seeded 'day' | 'night'; open by design so more can
26495
- * be added without a wire break (matching falls back to any-condition refs). */
26676
+ * **No `deviceConfig`, deliberately.** This shipped as the D14 widget archetype,
26677
+ * which put a "Scenes" tab on one camera's detail page. That is the wrong shape
26678
+ * for the thing: a scene is a standing question about the property ("is the bin
26679
+ * still out"), and the operator's question is "which of my scenes have tripped",
26680
+ * across every camera at once — not "what does camera 617 think". Buried one
26681
+ * camera deep it also could not be found. The surface is now a top-level admin
26682
+ * page (`/scenes`, `pages/Scenes.tsx`) that lists every scene on every camera and
26683
+ * picks the camera inside the create flow, the same shape Events and Faces have.
26684
+ *
26685
+ * The consequence to keep in mind: `host/scene-monitor-editor` is gone from
26686
+ * `HOST_WIDGETS` too. `scripts/check-host-widget-resolves.ts` asserts BOTH
26687
+ * directions, so a registration nobody declares fails exactly as loudly as a
26688
+ * declaration nobody registers. The editor is imported directly by the page.
26689
+ *
26690
+ * `status.kind:'push'` — the engine pushes on every hysteresis flip /
26691
+ * availability change; consumers never poll.
26692
+ */
26693
+ /** Extensible condition tag. Seeded 'day' | 'ir' (the two variants the operator
26694
+ * captures) plus 'night' | 'dawn' | 'dusk' from the resolver's sun-times band.
26695
+ * Open by design so more can be added without a wire break.
26696
+ *
26697
+ * Matching does NOT fall back across conditions: cross-condition cosines are
26698
+ * not comparable, so "I have never seen this scene in this light" is reported
26699
+ * as `unknown`, never guessed. A day reference scored against an IR frame
26700
+ * collapses the cosine and would latch a false alarm every single night. */
26496
26701
  var SceneConditionSchema = string();
26702
+ /** `matched` = the baseline is what we see; `diverged` = it demonstrably is not;
26703
+ * `unknown` = we cannot judge (no reference for this condition, encoder model
26704
+ * changed, view shifted, no snapshot). `unknown` is a real value, not a null,
26705
+ * and never counts toward hysteresis in either direction. */
26706
+ var SceneVerdictSchema = _enum([
26707
+ "matched",
26708
+ "diverged",
26709
+ "unknown"
26710
+ ]);
26711
+ /** Why a scene cannot judge. Named, because this feature's failure mode is
26712
+ * silence that reads as "nothing has happened". */
26713
+ var SceneUnavailableSchema = _enum([
26714
+ "no-reference-for-condition",
26715
+ "view-shifted",
26716
+ "no-vision-profile",
26717
+ "encoder-model-changed",
26718
+ "no-snapshot"
26719
+ ]);
26497
26720
  /** One captured reference — condition-tagged, model-version-gated. `embedding`
26498
26721
  * is `number[]` (Float32Array does NOT survive MsgPack/UDS). */
26499
26722
  var SceneReferenceSchema = object({
@@ -26501,7 +26724,14 @@ var SceneReferenceSchema = object({
26501
26724
  modelId: string(),
26502
26725
  condition: SceneConditionSchema,
26503
26726
  capturedAt: number(),
26504
- thumbnailMediaId: string().optional()
26727
+ thumbnailMediaId: string().optional(),
26728
+ /** Whole-frame (downscaled) embedding captured alongside the ROI crop. The
26729
+ * anti-view-shift anchor: a bumped camera, a PTZ preset or a re-aim makes the
26730
+ * normalized rect frame a different piece of world, and the scene would
26731
+ * diverge forever with a perfectly plausible cosine. Checked LAZILY, only
26732
+ * when hysteresis is about to flip — one extra encode per candidate
26733
+ * transition, not per poll. */
26734
+ anchorEmbedding: array(number()).optional()
26505
26735
  });
26506
26736
  var SceneMonitorStateSchema = object({
26507
26737
  id: string(),
@@ -26523,6 +26753,25 @@ var SceneCheckSchema = discriminatedUnion("mode", [object({
26523
26753
  profileId: string().optional(),
26524
26754
  hysteresisCount: number().int().positive()
26525
26755
  })]);
26756
+ var SCENE_DEFAULT_ANCHOR_THRESHOLD = .85;
26757
+ /**
26758
+ * Vision-model adjudication of a candidate flip. Field names deliberately
26759
+ * mirror `NcConfirmSchema` so an operator meets one vocabulary, not two.
26760
+ *
26761
+ * `onTimeout` defaults to **'hold'**, the OPPOSITE of `NcConfirmGate`'s
26762
+ * fail-open: a notification suppressed is the worse error there, but a vision
26763
+ * model that timed out has not told us the bin is gone, and a latch is a
26764
+ * stateful claim that costs the operator a trip to reset.
26765
+ */
26766
+ var SceneConfirmSchema = object({
26767
+ enabled: boolean().default(false),
26768
+ prompt: string().min(1).max(1e3),
26769
+ profileId: string().optional(),
26770
+ timeoutMs: number().int().min(1e3).max(2e4).default(8e3),
26771
+ maxImagePx: number().int().min(64).max(2048).default(448),
26772
+ /** What a timeout / unavailable model means for the PENDING flip. */
26773
+ onTimeout: _enum(["flip", "hold"]).default("hold")
26774
+ });
26526
26775
  var SceneMonitorSchema = object({
26527
26776
  id: string(),
26528
26777
  label: string(),
@@ -26541,7 +26790,41 @@ var SceneMonitorSchema = object({
26541
26790
  lastConfidence: number().nullable(),
26542
26791
  currentCondition: SceneConditionSchema.nullable(),
26543
26792
  availability: _enum(["ok", "unavailable"]),
26544
- unavailableReason: string().nullable()
26793
+ unavailableReason: string().nullable(),
26794
+ /** Which state is "the initial screen". `null` until the first capture. */
26795
+ baselineStateId: string().nullable(),
26796
+ /** Which boolean drives notification rules and any export. */
26797
+ emit: _enum(["latched", "live"]).default("latched"),
26798
+ /** Live: does the region match the baseline RIGHT NOW. */
26799
+ verdict: SceneVerdictSchema,
26800
+ /** Has it been `diverged` at least once since `armedAt` — the operator's boolean. */
26801
+ latched: boolean(),
26802
+ /** Last reset (or creation). */
26803
+ armedAt: number(),
26804
+ divergedAt: number().nullable(),
26805
+ restoredAt: number().nullable(),
26806
+ /** A check is only COUNTED when the device has been quiet this long. Motion
26807
+ * during the window DISCARDS the observation — a car pulling up in front of
26808
+ * the bin must not be able to spend hysteresis credit. */
26809
+ quietSeconds: number().int().min(0).max(3600).default(60),
26810
+ /** An observation only advances the pending count when it is at least this
26811
+ * far from the previously counted one, so N agreeing checks span real time
26812
+ * rather than N adjacent polls inside one occlusion. */
26813
+ minObservationSpacingSec: number().int().min(0).max(3600).default(120),
26814
+ /** Vision-model adjudication of a candidate flip. Similarity primary only. */
26815
+ confirm: SceneConfirmSchema.optional(),
26816
+ /** Whole-frame anchor cosine below which a flip is REFUSED as `view-shifted`. */
26817
+ anchorThreshold: number().min(0).max(1).default(SCENE_DEFAULT_ANCHOR_THRESHOLD),
26818
+ /** Clear the latch on its own when the scene matches again? Default false —
26819
+ * `restoredAt` and the `scene-restored` edge are recorded regardless, so an
26820
+ * automation can react to the bin coming back without the operator's own
26821
+ * alarm silently clearing itself. */
26822
+ autoRestore: boolean().default(false),
26823
+ /** Named cause when `verdict === 'unknown'`. */
26824
+ unavailable: SceneUnavailableSchema.nullable(),
26825
+ /** Conditions that have at least one comparable reference — the coverage line
26826
+ * ("day ✓ · ir ✓ · dusk ✗") that turns a silent fallback into a visible fact. */
26827
+ coveredConditions: array(SceneConditionSchema)
26545
26828
  });
26546
26829
  var SceneMonitorStatusSchema = object({
26547
26830
  monitors: array(SceneMonitorSchema),
@@ -26574,7 +26857,14 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
26574
26857
  "both"
26575
26858
  ]).optional(),
26576
26859
  checkIntervalSec: number().optional(),
26577
- check: SceneCheckSchema.optional()
26860
+ check: SceneCheckSchema.optional(),
26861
+ emit: _enum(["latched", "live"]).optional(),
26862
+ quietSeconds: number().int().min(0).max(3600).optional(),
26863
+ minObservationSpacingSec: number().int().min(0).max(3600).optional(),
26864
+ anchorThreshold: number().min(0).max(1).optional(),
26865
+ autoRestore: boolean().optional(),
26866
+ /** `null` clears the vision-model adjudicator. */
26867
+ confirm: SceneConfirmSchema.nullable().optional()
26578
26868
  })
26579
26869
  }), _void(), {
26580
26870
  kind: "mutation",
@@ -26611,6 +26901,14 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
26611
26901
  }), _void(), {
26612
26902
  kind: "mutation",
26613
26903
  auth: "admin"
26904
+ }), method(object({
26905
+ deviceId: number(),
26906
+ monitorId: string(),
26907
+ /** Defaults to TRUE at the provider seam — see `SCENE_RESET_RECAPTURES`. */
26908
+ recapture: boolean().optional()
26909
+ }), _void(), {
26910
+ kind: "mutation",
26911
+ auth: "admin"
26614
26912
  });
26615
26913
  /**
26616
26914
  * Per-stage gating mode applied to the zones a rule references.
@@ -26919,12 +27217,64 @@ var NetworkAddressSchema = object({
26919
27217
  family: string(),
26920
27218
  internal: boolean()
26921
27219
  });
27220
+ /**
27221
+ * Provenance of the site coordinates, and the whole reason this is not just two
27222
+ * numbers.
27223
+ *
27224
+ * - `operator-set` — a human typed it, or accepted a detection. Authoritative;
27225
+ * nothing overwrites it.
27226
+ * - `derived-from-ip` — the hub geolocated its own public IP once, because a
27227
+ * default that is right to a few kilometres beats the coarse UTC clock split
27228
+ * the sun-times consumers otherwise fall back to.
27229
+ *
27230
+ * The UI shows which one it is. An operator who cannot tell a guess from their
27231
+ * own input will eventually trust the guess.
27232
+ */
27233
+ var SiteLocationSourceSchema = _enum(["operator-set", "derived-from-ip"]);
27234
+ /**
27235
+ * The read shape: the location plus the honest state of the one-shot derivation.
27236
+ *
27237
+ * `derivationAttemptedAt` is what makes the "one call, ever" contract
27238
+ * inspectable. When it is set and `location` is null, the geo-IP lookup ran and
27239
+ * failed; the hub will NOT try again on its own — the fallback is declared
27240
+ * (consumers degrade to their own last resort) and the operator either types the
27241
+ * coordinates or presses detect.
27242
+ */
27243
+ var SiteLocationStatusSchema = object({
27244
+ location: object({
27245
+ /** WGS84 decimal degrees. */
27246
+ latitude: number().min(-90).max(90),
27247
+ longitude: number().min(-180).max(180),
27248
+ source: SiteLocationSourceSchema,
27249
+ /** Epoch ms the value was last written. */
27250
+ updatedAt: number(),
27251
+ /**
27252
+ * Human-readable place the geo-IP service reported ("Napoli, IT"). Display
27253
+ * only — never parsed, never matched on. Absent for an operator-typed value.
27254
+ */
27255
+ label: string().optional()
27256
+ }).nullable(),
27257
+ derivationAttemptedAt: number().nullable(),
27258
+ /** Why the last derivation failed, for the UI to show instead of a shrug. */
27259
+ derivationError: string().nullable()
27260
+ });
27261
+ /** `null` clears the location and re-arms nothing — the derivation stays spent. */
27262
+ var SetSiteLocationInputSchema = object({
27263
+ latitude: number().min(-90).max(90),
27264
+ longitude: number().min(-180).max(180)
27265
+ }).nullable();
26922
27266
  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(), {
26923
27267
  kind: "mutation",
26924
27268
  auth: "admin"
26925
27269
  }), method(_void(), _void(), {
26926
27270
  kind: "mutation",
26927
27271
  auth: "admin"
27272
+ }), method(_void(), SiteLocationStatusSchema), method(SetSiteLocationInputSchema, SiteLocationStatusSchema, {
27273
+ kind: "mutation",
27274
+ auth: "admin"
27275
+ }), method(_void(), SiteLocationStatusSchema, {
27276
+ kind: "mutation",
27277
+ auth: "admin"
26928
27278
  });
26929
27279
  object({
26930
27280
  /** True when the device's tamper switch / case-open contact is
@@ -29655,6 +30005,12 @@ Object.freeze({
29655
30005
  addonId: null,
29656
30006
  access: "create"
29657
30007
  },
30008
+ "llm.cancel": {
30009
+ capName: "llm",
30010
+ capScope: "system",
30011
+ addonId: null,
30012
+ access: "create"
30013
+ },
29658
30014
  "llm.deleteModel": {
29659
30015
  capName: "llm",
29660
30016
  capScope: "system",
@@ -31905,6 +32261,12 @@ Object.freeze({
31905
32261
  addonId: null,
31906
32262
  access: "create"
31907
32263
  },
32264
+ "sceneMonitor.resetScene": {
32265
+ capName: "scene-monitor",
32266
+ capScope: "device",
32267
+ addonId: null,
32268
+ access: "delete"
32269
+ },
31908
32270
  "sceneMonitor.updateScene": {
31909
32271
  capName: "scene-monitor",
31910
32272
  capScope: "device",
@@ -32583,6 +32945,12 @@ Object.freeze({
32583
32945
  addonId: null,
32584
32946
  access: "create"
32585
32947
  },
32948
+ "system.detectSiteLocation": {
32949
+ capName: "system",
32950
+ capScope: "system",
32951
+ addonId: null,
32952
+ access: "create"
32953
+ },
32586
32954
  "system.featureFlags": {
32587
32955
  capName: "system",
32588
32956
  capScope: "system",
@@ -32601,6 +32969,12 @@ Object.freeze({
32601
32969
  addonId: null,
32602
32970
  access: "view"
32603
32971
  },
32972
+ "system.getSiteLocation": {
32973
+ capName: "system",
32974
+ capScope: "system",
32975
+ addonId: null,
32976
+ access: "view"
32977
+ },
32604
32978
  "system.health": {
32605
32979
  capName: "system",
32606
32980
  capScope: "system",
@@ -32625,6 +32999,12 @@ Object.freeze({
32625
32999
  addonId: null,
32626
33000
  access: "create"
32627
33001
  },
33002
+ "system.setSiteLocation": {
33003
+ capName: "system",
33004
+ capScope: "system",
33005
+ addonId: null,
33006
+ access: "create"
33007
+ },
32628
33008
  "terminalSession.adoptLegacyMonitor": {
32629
33009
  capName: "terminal-session",
32630
33010
  capScope: "system",
@@ -34587,6 +34967,11 @@ Object.freeze({
34587
34967
  form: "single",
34588
34968
  optional: false
34589
34969
  }],
34970
+ "sceneMonitor.resetScene": [{
34971
+ name: "deviceId",
34972
+ form: "single",
34973
+ optional: false
34974
+ }],
34590
34975
  "sceneMonitor.updateScene": [{
34591
34976
  name: "deviceId",
34592
34977
  form: "single",