@camstack/addon-export-hap 1.2.27 → 1.2.29

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.
@@ -72,7 +72,7 @@ function carryForward(base, existing, keys) {
72
72
  return out;
73
73
  }
74
74
  //#endregion
75
- //#region ../types/dist/event-category-Cv9dO26A.mjs
75
+ //#region ../types/dist/event-category-Bxo5yJjt.mjs
76
76
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
77
77
  EventCategory["SystemBoot"] = "system.boot";
78
78
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -279,6 +279,33 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
279
279
  EventCategory["PipelineCameraAssigned"] = "pipeline.camera-assigned";
280
280
  EventCategory["PipelineCameraUnassigned"] = "pipeline.camera-unassigned";
281
281
  /**
282
+ * A node the orchestrator would otherwise place cameras on has NO usable
283
+ * inference device: the operator enabled one or more accelerators there and
284
+ * the live probe reports every one of them unavailable. Emitted once per
285
+ * TRANSITION into that state (never per dispatch), and the node is dropped
286
+ * from the placement candidate set for as long as it holds.
287
+ *
288
+ * This exists because the state was previously invisible: little-unraid
289
+ * absorbed 283k inference errors in a day while still being handed cameras,
290
+ * and nothing in the system said so.
291
+ *
292
+ * A node with no accelerators configured at all is NOT this — its devices
293
+ * are `disabled`, not `unavailable`, and the runner's default CPU pool
294
+ * serves it exactly as before.
295
+ */
296
+ EventCategory["PipelineNodeInferenceUnavailable"] = "pipeline.node-inference-unavailable";
297
+ /**
298
+ * A camera has an OPEN detection session and has produced no detection at
299
+ * all for longer than the blind threshold — the camera is being decoded and
300
+ * inferred and is returning nothing. Emitted once per transition into blind,
301
+ * per camera.
302
+ *
303
+ * The failure it reports: a 1h43 detection blackout on the entrance camera
304
+ * that nobody noticed, because "a camera that detects nothing" and "a quiet
305
+ * camera" produce byte-identical silence.
306
+ */
307
+ EventCategory["PipelineDetectionBlind"] = "pipeline.detection-blind";
308
+ /**
282
309
  * Per-camera pipeline config was mutated by the orchestrator
283
310
  * (3-level settings change via `setAgentAddonDefaults` /
284
311
  * `setCameraStepToggle` / `setCameraPipelineForAgent` or a
@@ -3070,6 +3097,9 @@ function handlePipeResult(left, next, ctx) {
3070
3097
  fallback: left.fallback
3071
3098
  }, ctx);
3072
3099
  }
3100
+ var $ZodPreprocess = /*@__PURE__*/ $constructor("$ZodPreprocess", (inst, def) => {
3101
+ $ZodPipe.init(inst, def);
3102
+ });
3073
3103
  var $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
3074
3104
  $ZodType.init(inst, def);
3075
3105
  defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
@@ -5255,6 +5285,10 @@ function pipe(in_, out) {
5255
5285
  out
5256
5286
  });
5257
5287
  }
5288
+ var ZodPreprocess = /*@__PURE__*/ $constructor("ZodPreprocess", (inst, def) => {
5289
+ ZodPipe.init(inst, def);
5290
+ $ZodPreprocess.init(inst, def);
5291
+ });
5258
5292
  var ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
5259
5293
  $ZodReadonly.init(inst, def);
5260
5294
  ZodType.init(inst, def);
@@ -5313,6 +5347,13 @@ function _instanceof(cls, params = {}) {
5313
5347
  };
5314
5348
  return inst;
5315
5349
  }
5350
+ function preprocess(fn, schema) {
5351
+ return new ZodPreprocess({
5352
+ type: "pipe",
5353
+ in: transform(fn),
5354
+ out: schema
5355
+ });
5356
+ }
5316
5357
  //#endregion
5317
5358
  //#region ../../node_modules/zod/v4/classic/compat.js
5318
5359
  /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
@@ -7589,7 +7630,7 @@ import { errMsg } from '@camstack/types'
7589
7630
  * Extract a human-readable message from an unknown error value.
7590
7631
  * Replaces the ubiquitous `errMsg(err)` pattern.
7591
7632
  */
7592
- function errMsg$12(err) {
7633
+ function errMsg$15(err) {
7593
7634
  if (err instanceof Error) return err.message;
7594
7635
  if (typeof err === "string") return err;
7595
7636
  return String(err);
@@ -11482,6 +11523,8 @@ var QueryFilterSchema = object({
11482
11523
  where: record(string(), unknown()).optional(),
11483
11524
  whereIn: record(string(), array(unknown())).optional(),
11484
11525
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11526
+ /** NULL-safe exclusion: matches rows whose field is NULL OR != the value. */
11527
+ whereNot: record(string(), unknown()).optional(),
11485
11528
  orderBy: object({
11486
11529
  field: string(),
11487
11530
  direction: _enum(["asc", "desc"])
@@ -11501,7 +11544,8 @@ var QueryFilterSchema = object({
11501
11544
  var MutationFilterSchema = object({
11502
11545
  where: record(string(), unknown()).optional(),
11503
11546
  whereIn: record(string(), array(unknown())).optional(),
11504
- whereBetween: record(string(), tuple([unknown(), unknown()])).optional()
11547
+ whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11548
+ whereNot: record(string(), unknown()).optional()
11505
11549
  });
11506
11550
  /** A single stored record: `{ id, data }`. */
11507
11551
  var SettingsRecordSchema = object({
@@ -12939,6 +12983,17 @@ var LlmImageSchema = object({
12939
12983
  bytes: _instanceof(Uint8Array),
12940
12984
  mimeType: string()
12941
12985
  });
12986
+ /**
12987
+ * Retry policy. `enabled: false` is NOT the same as `maxAttempts: 1` in intent —
12988
+ * the flag is what a consumer table flips, the count is what the operator tunes.
12989
+ * A retry doubles the wall time of a call, so the two gates that run inside a
12990
+ * notification's budget keep it off (see `CONSUMER_RETRY_POLICY` in addon-ai).
12991
+ */
12992
+ var LlmRetryPolicySchema = object({
12993
+ enabled: boolean().default(false),
12994
+ /** Total attempts INCLUDING the first. 1 = no retry. */
12995
+ maxAttempts: number().int().min(1).max(5).default(1)
12996
+ });
12942
12997
  var LlmGenerateBaseInputSchema = object({
12943
12998
  /** Collection routing (the notification-output posture). */
12944
12999
  addonId: string().optional(),
@@ -12953,7 +13008,28 @@ var LlmGenerateBaseInputSchema = object({
12953
13008
  jsonSchema: record(string(), unknown()).optional(),
12954
13009
  /** Per-call override of the profile default. */
12955
13010
  maxTokens: number().int().positive().optional(),
12956
- temperature: number().optional()
13011
+ temperature: number().optional(),
13012
+ /** Per-call override of the profile default (nucleus sampling). */
13013
+ topP: number().min(0).max(1).optional(),
13014
+ /** Per-call override of the profile default (top-k sampling). */
13015
+ topK: number().int().positive().optional(),
13016
+ /** Per-call override of `profile.timeoutMs` — the total generation bound. */
13017
+ timeoutMs: number().int().positive().optional(),
13018
+ /** Per-call override; beats both the consumer table and the profile. */
13019
+ retry: LlmRetryPolicySchema.optional(),
13020
+ /**
13021
+ * Caller-minted id that makes this generation CANCELLABLE.
13022
+ *
13023
+ * Without it a caller that stops waiting cannot stop the work: the gates race
13024
+ * the call against 8 s and free their own slot when the timer wins, while the
13025
+ * generation upstream keeps running to `profile.timeoutMs` — 60 s by default,
13026
+ * on a single-threaded local model. The per-camera bound then counts WAITS,
13027
+ * not generations, and the real load is unbounded.
13028
+ *
13029
+ * `AbortSignal` cannot cross a process boundary; an id can. Pass one here and
13030
+ * `llm.cancel({ requestId })` tears the socket down.
13031
+ */
13032
+ requestId: string().optional()
12957
13033
  });
12958
13034
  /**
12959
13035
  * `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
@@ -12966,6 +13042,18 @@ var LlmGenerateBaseInputSchema = object({
12966
13042
  * Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
12967
13043
  * watchdog — operator decision #3).
12968
13044
  */
13045
+ /**
13046
+ * A companion artifact that MUST land beside the main GGUF: the `mmproj`
13047
+ * projector of a vision model, or shards 2..N of a split GGUF. Carried on the
13048
+ * REF rather than looked up at install time, so what the operator approved in
13049
+ * the preview is exactly what the node downloads.
13050
+ */
13051
+ var ManagedModelExtraFileSchema = object({
13052
+ url: string(),
13053
+ filename: string(),
13054
+ sizeBytes: number(),
13055
+ sha256: string().optional()
13056
+ });
12969
13057
  var ManagedModelRefSchema = discriminatedUnion("kind", [
12970
13058
  object({
12971
13059
  kind: literal("catalog"),
@@ -12974,7 +13062,11 @@ var ManagedModelRefSchema = discriminatedUnion("kind", [
12974
13062
  object({
12975
13063
  kind: literal("url"),
12976
13064
  url: string(),
12977
- sha256: string().optional()
13065
+ sha256: string().optional(),
13066
+ /** Picker/status label; the file basename when absent. */
13067
+ label: string().optional(),
13068
+ sizeBytes: number().optional(),
13069
+ extraFiles: array(ManagedModelExtraFileSchema).optional()
12978
13070
  }),
12979
13071
  object({
12980
13072
  kind: literal("path"),
@@ -12992,13 +13084,82 @@ var ManagedRuntimeConfigSchema = object({
12992
13084
  gpuLayers: number().int().default(0),
12993
13085
  /** Default: cpus-2, clamped ≥1 (resolved node-side). */
12994
13086
  threads: number().int().optional(),
12995
- /** Concurrent slots. */
13087
+ /** Concurrent slots (`--parallel`). */
12996
13088
  parallel: number().int().default(1),
13089
+ /** Logical batch size (`-b`). Larger = faster prompt ingest, more RAM. */
13090
+ batchSize: number().int().positive().optional(),
13091
+ /** Physical batch / micro-batch (`-ub`). */
13092
+ ubatchSize: number().int().positive().optional(),
13093
+ /**
13094
+ * `--flash-attn`. Cuts KV-cache memory on the backends that implement it and
13095
+ * is a no-op elsewhere, so it is offered rather than assumed.
13096
+ */
13097
+ flashAttention: boolean().default(false),
13098
+ /**
13099
+ * `--mlock`. Pins the weights in RAM so the OS cannot page them out mid
13100
+ * inference. Costs the full model size in resident memory — which is exactly
13101
+ * what the RAM budget is counting.
13102
+ */
13103
+ mlock: boolean().default(false),
13104
+ /**
13105
+ * `--no-mmap`. Reads the whole GGUF up front instead of mapping it. Slower to
13106
+ * start, but avoids the page-fault stalls a network or spinning-disk model
13107
+ * store produces on every first token.
13108
+ */
13109
+ noMmap: boolean().default(false),
13110
+ /** `--cache-type-k` / `--cache-type-v` — quantising the KV cache is the
13111
+ * cheapest way to fit a longer context in the same RAM. */
13112
+ cacheTypeK: _enum([
13113
+ "f32",
13114
+ "f16",
13115
+ "q8_0",
13116
+ "q5_1",
13117
+ "q5_0",
13118
+ "q4_1",
13119
+ "q4_0"
13120
+ ]).optional(),
13121
+ cacheTypeV: _enum([
13122
+ "f32",
13123
+ "f16",
13124
+ "q8_0",
13125
+ "q5_1",
13126
+ "q5_0",
13127
+ "q4_1",
13128
+ "q4_0"
13129
+ ]).optional(),
13130
+ /**
13131
+ * Escape hatch for llama-server flags this schema does NOT model — `--jinja`
13132
+ * (which most vision chat templates need and some language-only models
13133
+ * dislike), `--cont-batching`, `--rope-scaling`, …
13134
+ *
13135
+ * It is NOT a second place to set the flags above. A token that collides
13136
+ * with a typed field is REJECTED at start, naming the field that owns it
13137
+ * (`assertNoOwnedFlags`), because two knobs writing the same argv is exactly
13138
+ * the "two switches that disagree" failure this repo has already shipped
13139
+ * twice (D62).
13140
+ */
13141
+ extraArgs: array(string()).default([]),
12997
13142
  /** Else lazy: first generate boots it. */
12998
13143
  autoStart: boolean().default(false),
12999
13144
  /** 0 = never; frees RAM after quiet periods. */
13000
13145
  idleStopMinutes: number().int().default(30)
13001
13146
  });
13147
+ /**
13148
+ * Where a multi-GB install currently is. A single 0..1 fraction cannot answer
13149
+ * "is it stuck?" for an install that is three files (shards + mmproj) followed
13150
+ * by a sha256 pass over 22 GB — during which the fraction sat at 1.0 and the
13151
+ * node looked hung. Phase + file + bytes is the smallest shape that does.
13152
+ */
13153
+ var LlmDownloadProgressSchema = object({
13154
+ phase: _enum(["downloading", "verifying"]),
13155
+ /** The artifact currently moving, e.g. `mmproj-F16.gguf`. */
13156
+ file: string(),
13157
+ fileIndex: number().int(),
13158
+ fileCount: number().int(),
13159
+ /** Across the WHOLE install, not the current file. */
13160
+ downloadedBytes: number(),
13161
+ totalBytes: number().optional()
13162
+ });
13002
13163
  var LlmRuntimeStatusSchema = object({
13003
13164
  /** Status is ALWAYS node-qualified. */
13004
13165
  nodeId: string(),
@@ -13015,6 +13176,8 @@ var LlmRuntimeStatusSchema = object({
13015
13176
  modelPath: string().optional(),
13016
13177
  modelId: string().optional(),
13017
13178
  downloadProgress: number().min(0).max(1).optional(),
13179
+ /** Detail behind `downloadProgress`; present for the same lifetime. */
13180
+ download: LlmDownloadProgressSchema.optional(),
13018
13181
  lastError: string().optional(),
13019
13182
  crashesInWindow: number(),
13020
13183
  /** Child RSS (sampled best-effort). */
@@ -13025,7 +13188,14 @@ var LlmNodeModelSchema = object({
13025
13188
  file: string(),
13026
13189
  sizeBytes: number(),
13027
13190
  catalogId: string().optional(),
13028
- installedAt: number().optional()
13191
+ installedAt: number().optional(),
13192
+ /**
13193
+ * Absolute path on the node. Present so a file that is on disk but matches
13194
+ * no catalog entry — a custom Hugging Face install, or a GGUF the operator
13195
+ * copied in by hand — is still SELECTABLE, as a `{kind:'path'}` ref. Without
13196
+ * it the picker could list such a file and do nothing with it.
13197
+ */
13198
+ path: string().optional()
13029
13199
  });
13030
13200
  var LlmRuntimeDiskUsageSchema = object({
13031
13201
  nodeId: string(),
@@ -13081,10 +13251,47 @@ var LlmProfileSchema = object({
13081
13251
  baseUrl: string().optional(),
13082
13252
  /** ConfigUISchema type:'password' — never round-trips (spec §5). */
13083
13253
  apiKey: string().optional(),
13254
+ /** Vision on/off. A vision call against a `false` profile is REFUSED, never
13255
+ * degraded to text — that shipped once and produced a confident answer to a
13256
+ * question about a picture nobody sent. */
13084
13257
  supportsVision: boolean(),
13085
13258
  temperature: number().min(0).max(2).optional(),
13259
+ /** Nucleus sampling. Every wire we speak has it. */
13260
+ topP: number().min(0).max(1).optional(),
13261
+ /** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
13262
+ * wire does, and the client drops it there (measured: the request body gets
13263
+ * `top_p` and no `top_k`). The profile editor hides the field wherever it
13264
+ * would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
13265
+ topK: number().int().positive().optional(),
13086
13266
  maxTokens: number().int().positive().optional(),
13267
+ /** Prompt context window. Advisory for cloud kinds (they enforce their own);
13268
+ * for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
13269
+ * the model with, so it is the one field that changes a PROCESS. */
13270
+ contextLength: number().int().positive().optional(),
13271
+ /** Default system prompt. A caller's `system` REPLACES it (never appends —
13272
+ * two system prompts fighting is worse than either alone). */
13273
+ systemPrompt: string().optional(),
13274
+ /** Total generation bound — the only one a unary call has. */
13087
13275
  timeoutMs: number().int().positive().default(6e4),
13276
+ /** The TCP handshake only — "is the port even open". NOT the wait for
13277
+ * response headers: on the LM Studio / llama-server wire those are written
13278
+ * once the model has finished loading, so they belong to the bound below. */
13279
+ connectTimeoutMs: number().int().positive().default(1e4),
13280
+ /** Accepted, but no output yet — response headers included, because a cold
13281
+ * GPU load is exactly what happens before them. */
13282
+ firstTokenTimeoutMs: number().int().positive().default(12e4),
13283
+ /** Output started then stopped. */
13284
+ idleTimeoutMs: number().int().positive().default(6e4),
13285
+ /** Profile-level default. The per-consumer table and a per-call override
13286
+ * both beat it — see `resolveRetryPolicy`. */
13287
+ retry: LlmRetryPolicySchema.default({
13288
+ enabled: false,
13289
+ maxAttempts: 1
13290
+ }),
13291
+ /** Whether this profile may use tools. The tool-call plumbing rides the
13292
+ * library; the REGISTRY of callable tools is ours and is empty in v1, so a
13293
+ * `true` here buys the wiring, not behaviour, until tools are registered. */
13294
+ toolsEnabled: boolean().default(false),
13088
13295
  extraHeaders: record(string(), string()).optional(),
13089
13296
  /** kind === 'managed-local' only (spec §4). */
13090
13297
  runtime: ManagedRuntimeConfigSchema.optional()
@@ -13134,6 +13341,36 @@ var ManagedModelCatalogEntrySchema = object({
13134
13341
  /** Vision models: companion projector file. */
13135
13342
  mmprojUrl: string().optional()
13136
13343
  });
13344
+ /**
13345
+ * The outcome of turning one operator-typed Hugging Face reference into a
13346
+ * download plan. A RESULT, never a throw: "this repo has 24 quantizations and
13347
+ * I will not pick for you" is a normal answer the UI has to render, not an
13348
+ * exception.
13349
+ *
13350
+ * `candidates` is the whole reason the refusal is usable — every string in it
13351
+ * is a tag that resolves when pasted back as `<org>/<repo>:<TAG>`.
13352
+ */
13353
+ var HfModelResolutionSchema = discriminatedUnion("ok", [object({
13354
+ ok: literal(true),
13355
+ /** Ready to hand to `installModel` unchanged. */
13356
+ model: ManagedModelRefSchema,
13357
+ label: string(),
13358
+ repo: string(),
13359
+ quantization: string(),
13360
+ purpose: _enum(["text", "vision"]),
13361
+ totalBytes: number(),
13362
+ /** mmproj + shards, for the preview: an operator approving 23 GB should
13363
+ * see that 0.9 GB of it is a projector they did not name. */
13364
+ extraFilenames: array(string())
13365
+ }), object({
13366
+ ok: literal(false),
13367
+ code: string(),
13368
+ message: string(),
13369
+ candidates: array(string()).optional(),
13370
+ /** Set when the refusal was only the ceiling: re-calling with
13371
+ * `maxBytes: requiredBytes` is the operator's explicit override. */
13372
+ requiredBytes: number().optional()
13373
+ })]);
13137
13374
  var LlmRuntimeNodeSchema = object({
13138
13375
  nodeId: string(),
13139
13376
  reachable: boolean(),
@@ -13146,7 +13383,10 @@ var ProfileRefInputSchema = object({
13146
13383
  addonId: string(),
13147
13384
  profileId: string()
13148
13385
  });
13149
- method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
13386
+ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({
13387
+ addonId: string().optional(),
13388
+ requestId: string()
13389
+ }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
13150
13390
  kind: "mutation",
13151
13391
  auth: "admin"
13152
13392
  }), method(ProfileRefInputSchema, _void(), {
@@ -13167,6 +13407,15 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13167
13407
  consumer: string().optional(),
13168
13408
  profileId: string().optional()
13169
13409
  }), array(LlmUsageRollupSchema)), method(object({}), array(ManagedModelCatalogEntrySchema)), method(object({}), array(LlmRuntimeNodeSchema)), method(object({ nodeId: string() }), array(LlmNodeModelSchema)), method(object({
13410
+ /** `https://huggingface.co/<org>/<repo>/resolve/main/<f>.gguf`,
13411
+ * `<org>/<repo>/<f>.gguf`, `<org>/<repo>` or `<org>/<repo>:<QUANT>`. */
13412
+ ref: string(),
13413
+ /** Explicit ceiling override, in bytes. Absent = the built-in ceiling. */
13414
+ maxBytes: number().positive().optional()
13415
+ }), HfModelResolutionSchema, {
13416
+ kind: "mutation",
13417
+ auth: "admin"
13418
+ }), method(object({
13170
13419
  nodeId: string(),
13171
13420
  model: ManagedModelRefSchema
13172
13421
  }), _void(), {
@@ -14776,6 +15025,8 @@ var NcSystemEventKindSchema = _enum([
14776
15025
  "stream-offline",
14777
15026
  "node-online",
14778
15027
  "node-offline",
15028
+ "node-inference-unavailable",
15029
+ "detection-blind",
14779
15030
  "addon-update-available",
14780
15031
  "server-update-available",
14781
15032
  "alarm-triggered",
@@ -14837,7 +15088,16 @@ var NcScheduleSchema = object({
14837
15088
  });
14838
15089
  /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
14839
15090
  var NcPlateMatcherSchema = object({
14840
- values: array(string().min(1)).min(1),
15091
+ /**
15092
+ * Plate texts (or gallery vehicle names) to match. EMPTY = **any plate the
15093
+ * pipeline could read** — the plate half of "no selection = no narrowing",
15094
+ * and the switch that says this rule is about vehicles that were IDENTIFIED
15095
+ * rather than merely seen. A subject carrying no plate still fails.
15096
+ *
15097
+ * The `.min(1)` this used to carry made that state unauthorable; nothing has
15098
+ * ever persisted an empty list, so widening it cannot change an existing rule.
15099
+ */
15100
+ values: array(string().min(1)),
14841
15101
  /** Max Levenshtein distance after normalization (uppercase alphanumeric). */
14842
15102
  maxDistance: number().int().min(0).max(3).default(1)
14843
15103
  });
@@ -14871,28 +15131,36 @@ var NcOccupancyConditionSchema = object({
14871
15131
  /**
14872
15132
  * Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
14873
15133
  *
14874
- * Operator-approved vocabulary (2026-08-12, option A — the same one the
14875
- * reference notifier uses, so an operator moving between them re-uses what
14876
- * they already know): a rule matches when, over a sampling window of
14877
- * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
14878
- * window are HITS. A sample is a hit when it satisfies BOTH present filters:
14879
- *
14880
- * - `dbThreshold` its level is at or above this many dBFS (see
14881
- * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
14882
- * - `labels` the classifier put at least one of these labels on it.
14883
- *
14884
- * Both are OPTIONAL and independent, which is the point of the shape: a
14885
- * loudness rule ("something loud at 3am") needs no model to be right, and a
14886
- * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
14887
- * is given** a window in which every sample is trivially a hit would fire on
14888
- * silence, so the engine refuses such a condition rather than notifying on
14889
- * nothing (the schema cannot express "at least one of" without becoming a
14890
- * ZodEffects the cap path would have to special-case).
14891
- *
14892
- * `hitPercent` is over the samples the window actually HOLDS, and the window
14893
- * must be FULL before it can match a window that has been open for two
14894
- * seconds of its ten is 100% of nothing, and firing on it would make
14895
- * `samplingSeconds` decorative.
15134
+ * **TWO EXCLUSIVE MODES** (operator decision 2026-08-14, D157). Which one a
15135
+ * rule is in is not a stored field it is WHICH FILTER the rule carries, so
15136
+ * there is no second switch that can disagree with the first and every rule
15137
+ * authored before the decision migrates for free (`audioModeOf`):
15138
+ *
15139
+ * - **LABEL mode — `labels` present.** The rule fires on the FIRST frame the
15140
+ * classifier labels with one of them. No window, no percentage:
15141
+ * `hitPercent` and `samplingSeconds` are ignored, and the rule's own
15142
+ * `throttle` cooldown is the only brake. The per-label confidence floor is
15143
+ * the analyzer's (`classificationMinScore`, per device) — a label only
15144
+ * reaches this condition if the classifier was already confident enough.
15145
+ * - **LEVEL mode `dbThreshold` present, no labels.** The sampling window IS
15146
+ * the condition: at least `hitPercent`% of the samples over
15147
+ * `samplingSeconds` must be at or above `dbThreshold` dBFS (see
15148
+ * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale). The window
15149
+ * must be FULL before it can match a window open for two of its ten
15150
+ * seconds is 100% of nothing.
15151
+ *
15152
+ * **Why label mode has no window.** It had one, and it never fired: the
15153
+ * analyzer emits ~1 audio frame per second but YAMNet only LABELS one to three
15154
+ * of them per episode, even through continuous crying. The measured maximum
15155
+ * `hitPercent` over the whole live history was 40 — under the shipped default
15156
+ * of 60, so a label rule could not fire at all, ever. A percentage of frames is
15157
+ * the wrong question to ask of a sparse classifier.
15158
+ *
15159
+ * **Fail-closed when NEITHER is given** — every sample would be a trivial hit
15160
+ * and the rule would fire on silence. The schema cannot express "exactly one
15161
+ * of" without becoming a ZodEffects the cap path would have to special-case, so
15162
+ * the exclusivity is enforced where every editor writes (`patchAudio`) and a
15163
+ * legacy rule carrying both resolves to LABEL (the mode that fires).
14896
15164
  *
14897
15165
  * Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
14898
15166
  * `audio-*` ids). Both spellings are accepted — the matcher normalizes the
@@ -14900,13 +15168,13 @@ var NcOccupancyConditionSchema = object({
14900
15168
  * an operator who typed `dog` mean the same thing.
14901
15169
  */
14902
15170
  var NcAudioConditionSchema = object({
14903
- /** Audio macro labels; absent = any sound (level-only rule). */
15171
+ /** LABEL MODE: audio macro labels. Present fires on the first labelled frame. */
14904
15172
  labels: array(string().min(1)).min(1).optional(),
14905
- /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
15173
+ /** LEVEL MODE: floor in dBFS (negative-going, `0` = full scale). */
14906
15174
  dbThreshold: number().min(-96).max(0).optional(),
14907
- /** Percentage of the window's samples that must be hits (1–100). */
15175
+ /** LEVEL MODE ONLY: percentage of the window's samples that must be hits (1–100). */
14908
15176
  hitPercent: number().int().min(1).max(100).default(60),
14909
- /** Length of the sampling window in seconds. */
15177
+ /** LEVEL MODE ONLY: length of the sampling window in seconds. */
14910
15178
  samplingSeconds: number().int().min(1).max(300).default(10)
14911
15179
  });
14912
15180
  /**
@@ -15044,13 +15312,81 @@ var NcRuleActionsSchema = object({
15044
15312
  */
15045
15313
  buttons: array(NcRuleNotificationButtonSchema).max(8).optional()
15046
15314
  });
15315
+ /**
15316
+ * "This rule applies only while `deviceId` is in one of `states`."
15317
+ *
15318
+ * The states are the DEVICE's own vocabulary — `AlarmState` for a panel,
15319
+ * `on`/`off` for a switch — not a normalised set, because normalising would
15320
+ * make the condition lie about devices whose states have no equivalent.
15321
+ *
15322
+ * An unreadable state does NOT match: see the engine's fail-closed gate. A
15323
+ * condition that fired on "I could not read it" would be worse than no gate.
15324
+ */
15325
+ var NcDeviceStateConditionSchema = object({
15326
+ deviceId: number().int(),
15327
+ /** Any of these matches. */
15328
+ states: array(string().min(1)).min(1)
15329
+ });
15330
+ /**
15331
+ * "This rule applies only while scene `sceneId` is `matched` / `diverged`."
15332
+ *
15333
+ * A GATE, not a trigger. `occupancy` and `audio` each DISCRIMINATE their rule —
15334
+ * carrying one makes the rule fire on that subject and nothing else. Scene is
15335
+ * the other shape entirely, the `deviceState` shape: it narrows a rule that
15336
+ * already has a trigger ("tell me about a person at the front door, but only
15337
+ * while the bin is still out"). That is why it composes with every delivery
15338
+ * instead of owning one, and why no new `NcDelivery` member and no new subject
15339
+ * kind exist for it — see D159.
15340
+ *
15341
+ * ── Identity ───────────────────────────────────────────────────────────────
15342
+ * `sceneId` is `SceneMonitor.id`, a `randomUUID()` minted by `createScene` —
15343
+ * globally unique, so it needs no device to disambiguate it. `deviceId` is
15344
+ * carried as a HINT for the editor and for the log line, never as part of the
15345
+ * lookup key: a rule whose hint drifted must still gate correctly.
15346
+ *
15347
+ * ── Which boolean ──────────────────────────────────────────────────────────
15348
+ * `latched` ABSENT means "whatever the scene itself says" — `SceneMonitor.emit`
15349
+ * already declares which boolean drives notification rules, and a second knob
15350
+ * that could disagree with it is exactly the D62 failure. Set it only to
15351
+ * override one rule against the scene's own default.
15352
+ *
15353
+ * - LIVE reading (`emit`/`latched` resolve to live): passes iff
15354
+ * `verdict === requiredState`. `unknown` — no reference for this light, view
15355
+ * shifted, no snapshot — passes NEITHER. A scene that cannot judge is not
15356
+ * evidence, in either direction.
15357
+ * - LATCHED reading: passes iff `latched === (requiredState === 'diverged')`.
15358
+ * The latch is a durable fact about the past ("it has diverged since I armed
15359
+ * it"), so a camera that has gone dark does not clear it — that is the whole
15360
+ * reason the operator asked for a latch.
15361
+ *
15362
+ * The gate reads an in-memory mirror (`NcSceneStateCache`) refreshed OFF the
15363
+ * event path, never the cap: D49. A mirror that has never loaded, or a scene it
15364
+ * does not carry, reads absent and the rule does NOT fire — fail closed, and
15365
+ * said out loud in the log rather than dropped in silence.
15366
+ */
15367
+ var NcSceneConditionSchema = object({
15368
+ /** `SceneMonitor.id` — the uuid the cap mints. The whole lookup key. */
15369
+ sceneId: string().min(1),
15370
+ /** The camera the scene lives on. A hint for the editor and the log line. */
15371
+ deviceId: number().int().optional(),
15372
+ /** The state the scene must be in for the rule to fire. */
15373
+ requiredState: _enum(["matched", "diverged"]),
15374
+ /**
15375
+ * Read the LATCH (`true`) or the LIVE verdict (`false`). Absent = follow the
15376
+ * scene's own `emit` field, which is the only place that decision belongs.
15377
+ */
15378
+ latched: boolean().optional()
15379
+ });
15047
15380
  var NcConditionsSchema = object({
15048
15381
  /** Gate on ANOTHER device's current state (the alarm armed, a switch on). */
15049
- deviceState: object({
15050
- deviceId: number().int(),
15051
- /** Any of these matches. */
15052
- states: array(string().min(1)).min(1)
15053
- }).optional(),
15382
+ deviceState: NcDeviceStateConditionSchema.optional(),
15383
+ /**
15384
+ * Gate on a SCENE's state — "only while the bin is still out". Composes with
15385
+ * every trigger (detection, occupancy, audio, sensor, package, track-end);
15386
+ * unlike `occupancy`/`audio` it discriminates nothing. See
15387
+ * {@link NcSceneCondition} and D159.
15388
+ */
15389
+ scene: NcSceneConditionSchema.optional(),
15054
15390
  /** Device scope — absent = all devices. */
15055
15391
  devices: array(number()).optional(),
15056
15392
  /** Detector class names (any overlap with the record's class set). */
@@ -15076,18 +15412,47 @@ var NcConditionsSchema = object({
15076
15412
  */
15077
15413
  labelEquals: array(string().min(1)).optional(),
15078
15414
  /**
15079
- * Identity matcher. P1 boundary: matched against the record's collapsed
15080
- * `label` (the identity display name propagated by the face pipeline) —
15081
- * identity-ID matching rides in P2 when identity ids reach the record.
15415
+ * KNOWN FACES the rule's identity scope, and the switch that says the rule
15416
+ * is about recognised people at all.
15417
+ *
15418
+ * Three states, and the empty one is the point:
15419
+ *
15420
+ * | value | meaning |
15421
+ * | --- | --- |
15422
+ * | absent | the rule does not care who it is; an unrecognised person matches |
15423
+ * | `[]` | **only known faces** — any identity in the gallery, nobody in particular |
15424
+ * | a list | only these identities |
15425
+ *
15426
+ * `[]` is the repo-wide "no selection = no narrowing" reading (an absent
15427
+ * `devices` list is every device), applied one level down: the operator has
15428
+ * turned the face scope ON and narrowed it to nothing, which is every known
15429
+ * face. No second field states the same thing — a switch that can disagree
15430
+ * with the list under it is worse than no switch (D62).
15431
+ *
15432
+ * MEMBERS ARE FACE-GALLERY `Identity.id`s (uuid), not display names. A name is
15433
+ * renameable, and a rule authored on "Gianluca" went silently dark the moment
15434
+ * the operator fixed the spelling. The id reaches the record on
15435
+ * `LabelAttribution.identityId`; the name is what the editor shows and what
15436
+ * `{{label}}` renders.
15437
+ *
15438
+ * Rules written before this carry NAMES, and are resolved to ids lazily at
15439
+ * load (`NcRuleStore.load`) against the live gallery — a name nothing answers
15440
+ * for is left as it stands and reported, never dropped. The engine also
15441
+ * accepts a display-name hit as a compatibility leg, so a rule whose
15442
+ * migration could not resolve keeps matching exactly what it matched before.
15082
15443
  */
15083
15444
  identities: array(string().min(1)).optional(),
15084
- /** Fuzzy plate matcher against the record's `label` (plate text). */
15445
+ /**
15446
+ * KNOWN PLATES / VEHICLES — the plate mirror of {@link identities}, including
15447
+ * the empty-list reading: `values: []` is "any plate the OCR could read",
15448
+ * a non-empty list is those plates (fuzzily). See {@link NcPlateMatcherSchema}.
15449
+ */
15085
15450
  plates: NcPlateMatcherSchema.optional(),
15086
15451
  /**
15087
- * Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
15088
- * Same P1 boundary: matched against the record's collapsed `label` (the
15089
- * identity display name). A record with NO label passes (nothing to
15090
- * exclude), unlike the include variant which fails on an absent label.
15452
+ * Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics, and
15453
+ * the same id members and the same lazy name→id migration. A record with NO
15454
+ * identity passes (nothing to exclude), unlike the include variant which
15455
+ * fails on an unrecognised subject. An EMPTY list excludes nobody.
15091
15456
  */
15092
15457
  identitiesExclude: array(string().min(1)).optional(),
15093
15458
  /**
@@ -15479,7 +15844,80 @@ var NcRuleInputSchema = object({
15479
15844
  * a rule that predates the gate must keep delivering byte-for-byte as it
15480
15845
  * did, and absent is the only way to say that without a migration.
15481
15846
  */
15482
- confirm: NcConfirmSchema.optional()
15847
+ confirm: NcConfirmSchema.optional(),
15848
+ /**
15849
+ * WAIT for face/plate recognition before saying anything.
15850
+ *
15851
+ * A notification's TEXT is frozen at enqueue and its media is re-resolved at
15852
+ * send; the identity is neither. A face is confirmed after `confirmFrames`
15853
+ * agreeing observations — p50 **11.4 s** after the track was first seen,
15854
+ * measured on this hub — and an `immediate` rule enqueues on the first object
15855
+ * event, seconds before that. So "Gianluca è arrivato" is unsayable on the
15856
+ * immediate path, and no amount of media re-resolution fixes a sentence.
15857
+ *
15858
+ * Only two honest answers exist, and this flag picks between them. It has
15859
+ * effect ONLY on a rule that declares a recognition scope
15860
+ * ({@link NcConditions.identities} or {@link NcConditions.plates}) — on any
15861
+ * other rule there is nothing to wait for and the flag is inert.
15862
+ *
15863
+ * | value | what happens |
15864
+ * | --- | --- |
15865
+ * | `true` | the rule stops firing on the object event and fires at TRACK CLOSE instead, once, with the name — later, and complete |
15866
+ * | 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) |
15867
+ *
15868
+ * `.optional()` and deliberately NOT `.default()`: a Zod default does not run
15869
+ * on the addon cap path, and absent has to keep meaning exactly what every
15870
+ * rule authored before this field meant.
15871
+ *
15872
+ * The cost of `true` is stated here because the editor states it too: a rule
15873
+ * that waits also inherits track-close SEMANTICS — its `zones` condition
15874
+ * tests every zone the track visited and a `crossing` condition can no longer
15875
+ * be satisfied, because a closed track carries no crossing.
15876
+ */
15877
+ waitForEnhancement: boolean().optional(),
15878
+ /**
15879
+ * GROUP a burst of subjects into ONE notification that grows.
15880
+ *
15881
+ * Seconds of quiet after the last matching subject before the burst is
15882
+ * considered over. While it is open, the first subject enqueues immediately —
15883
+ * **exactly as today, with no added latency** — and every real growth (a new
15884
+ * subject, or a name confirmed on one already in it) REPLACES that
15885
+ * notification with an updated one naming everybody. The push carries the
15886
+ * group's own coalescing tag, so the phone replaces rather than stacks.
15887
+ *
15888
+ * `0` / absent = off, and off is today's behaviour byte for byte.
15889
+ *
15890
+ * ### Why an idle cutoff and not a window
15891
+ *
15892
+ * The measured seven-person arrival on device 590 spans 110 s with every
15893
+ * internal gap under 30 s. A 12 s fixed window cuts it into three groups; an
15894
+ * idle cutoff holds it as one and ends it when the arrival actually ends.
15895
+ * 30 is Frigate's shipped value for the same decision.
15896
+ *
15897
+ * ### What it replaces
15898
+ *
15899
+ * The blind cooldown, which collapses a burst by DISCARDING it. Measured on
15900
+ * device 615 / *Persona su Uscio* over six days: 116 qualifying tracks → 74
15901
+ * notifications, **44 (37.9%) suppressed outright**, 23 of them overlapping a
15902
+ * track that did fire and 7 carrying a confirmed identity nobody heard about.
15903
+ * A group collapses the same volume by MERGING, so the cooldown becomes a
15904
+ * budget over GROUPS — which is what it always meant — and a growth is never
15905
+ * throttled by the window its own first member spent.
15906
+ *
15907
+ * ### Interaction with {@link waitForEnhancement}
15908
+ *
15909
+ * They compose, and the order matters. `waitForEnhancement` defers the rule to
15910
+ * TRACK CLOSE, so with both set the group is opened by the first member to
15911
+ * CLOSE — already carrying its name — and grows as later members close. That
15912
+ * is later, and complete. With grouping alone the group opens on the first
15913
+ * object event and picks up names as they are confirmed, through the growth
15914
+ * path. Neither combination fires twice for one subject.
15915
+ *
15916
+ * `.optional()` and deliberately NOT `.default()`: a Zod default does not run
15917
+ * on the addon cap path, so absent must keep meaning what it meant before this
15918
+ * field existed.
15919
+ */
15920
+ groupIdleSec: number().int().min(0).max(600).optional()
15483
15921
  });
15484
15922
  /**
15485
15923
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -15586,6 +16024,7 @@ var NcConditionDescriptorSchema = object({
15586
16024
  "occupancy",
15587
16025
  "audio",
15588
16026
  "deviceState",
16027
+ "scene",
15589
16028
  "systemEvent"
15590
16029
  ]),
15591
16030
  operator: _enum([
@@ -15991,7 +16430,87 @@ var MethodAccessSchema = _enum([
15991
16430
  var AllowedProviderSchema = union([literal("*"), array(string())]);
15992
16431
  var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
15993
16432
  var CapScopeSchema = _enum(["device", "system"]);
15994
- var TokenScopeSchema = discriminatedUnion("type", [
16433
+ /**
16434
+ * DeviceSelector (scope model v3 — 2026-08-12).
16435
+ *
16436
+ * A `device` grant no longer carries a frozen list of deviceIds. It carries
16437
+ * a SELECTOR the matcher resolves against the live fleet, so the grant can be
16438
+ * DYNAMIC: a `types:['camera']` selector automatically covers a camera added
16439
+ * AFTER the grant was minted — no re-grant, no re-login.
16440
+ *
16441
+ * - `all` — every device in the deployment. The broad viewer/operator
16442
+ * lever without a `category` grant (a `category` grant also covers device
16443
+ * caps that carry no deviceId; `all` is specifically the device set).
16444
+ * - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
16445
+ * grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
16446
+ * is NOT covered until the grant is edited.
16447
+ * - `types` — every device of a `DeviceType` (e.g. every `camera`).
16448
+ * DYNAMIC. A device that changes type, or a new device of the type,
16449
+ * re-resolves on the next request.
16450
+ * - `locations` — every device whose operator-assigned `location` label is
16451
+ * in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
16452
+ * null/unset location matches NO `locations` selector.
16453
+ */
16454
+ var DeviceSelectorSchema = discriminatedUnion("kind", [
16455
+ object({ kind: literal("all") }),
16456
+ object({
16457
+ kind: literal("ids"),
16458
+ ids: array(number().int()).min(1)
16459
+ }),
16460
+ object({
16461
+ kind: literal("types"),
16462
+ types: array(_enum(DeviceType)).min(1)
16463
+ }),
16464
+ object({
16465
+ kind: literal("locations"),
16466
+ locations: array(string().min(1)).min(1)
16467
+ })
16468
+ ]);
16469
+ var DeviceTokenScopeSchema = object({
16470
+ type: literal("device"),
16471
+ /** The device SET this grant covers — resolved against the live fleet. */
16472
+ selector: DeviceSelectorSchema,
16473
+ access: array(MethodAccessSchema).min(1),
16474
+ /**
16475
+ * Whether a grant on a PARENT device transparently covers its accessory
16476
+ * CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
16477
+ * Direction is parent → children ONLY.
16478
+ *
16479
+ * Absent → the matcher DERIVES it from the access flavour: `view`
16480
+ * inherits (a camera viewer sees the camera's accessories), `create` /
16481
+ * `delete` do NOT (actuating/removing a child is an explicit act the
16482
+ * operator must grant on the child, not inherit from the parent). Set it
16483
+ * explicitly to override that default per grant.
16484
+ */
16485
+ includeLinked: boolean().optional()
16486
+ });
16487
+ /**
16488
+ * v2 → v3 lazy migration. A pre-v3 `device` grant carried
16489
+ * `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
16490
+ * `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
16491
+ * EVERY parse path — stored records AND the JWT-carried scope arrays
16492
+ * normalised at the request boundary ({@link normalizeTokenScopes} in
16493
+ * `device-selector.ts`). Chosen over a one-time DB migration because a
16494
+ * migration cannot reach a JWT already in a client's hands; parse-time
16495
+ * migration covers both without a flag day. No cast — the raw object is read
16496
+ * through `Reflect.get` (its static type is `unknown`).
16497
+ */
16498
+ function migrateLegacyTokenScope(raw) {
16499
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
16500
+ if (Reflect.get(raw, "type") !== "device") return raw;
16501
+ if (Reflect.get(raw, "selector") !== void 0) return raw;
16502
+ const targets = Reflect.get(raw, "targets");
16503
+ if (!Array.isArray(targets)) return raw;
16504
+ return {
16505
+ type: "device",
16506
+ selector: {
16507
+ kind: "ids",
16508
+ ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
16509
+ },
16510
+ access: Reflect.get(raw, "access")
16511
+ };
16512
+ }
16513
+ var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
15995
16514
  object({
15996
16515
  type: literal("category"),
15997
16516
  target: CapScopeSchema,
@@ -16007,18 +16526,8 @@ var TokenScopeSchema = discriminatedUnion("type", [
16007
16526
  target: string(),
16008
16527
  access: array(MethodAccessSchema).min(1)
16009
16528
  }),
16010
- object({
16011
- type: literal("device"),
16012
- /**
16013
- * One or more deviceIds (serialised as strings for wire-format
16014
- * consistency with the rest of the union). Matcher accepts if
16015
- * `input.deviceId` ∈ `targets`. Array shape avoids the row-explosion
16016
- * of one scope-per-device when granting access to a set of cameras.
16017
- */
16018
- targets: array(string()).min(1),
16019
- access: array(MethodAccessSchema).min(1)
16020
- })
16021
- ]);
16529
+ DeviceTokenScopeSchema
16530
+ ]));
16022
16531
  object({
16023
16532
  id: string(),
16024
16533
  username: string(),
@@ -16335,7 +16844,7 @@ var TrackEnvelopeSchema = object({
16335
16844
  * `snapshots[]` references — megabytes across a page of tracks. `slim`
16336
16845
  * keeps every scalar the list surfaces actually render (ids, class(es),
16337
16846
  * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16338
- * zonesVisited, bestEventId, envelope, hasFace) and returns `positions` /
16847
+ * zonesVisited, bestEventId, envelope, hasFace, hasRider) and returns `positions` /
16339
16848
  * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16340
16849
  * `getTrack`. Mirrors the event-store `projection` convention
16341
16850
  * (`getObjectEvents` et al.).
@@ -16471,7 +16980,21 @@ union([literal(1), literal(2)]);
16471
16980
  var LabelAttributionSchema = object({
16472
16981
  stepId: string(),
16473
16982
  modelId: string().optional(),
16474
- decidedAt: number()
16983
+ decidedAt: number(),
16984
+ /**
16985
+ * The GALLERY id behind a recognised tier-2 label — a face-gallery
16986
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
16987
+ *
16988
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
16989
+ * notification rule authored on "Gianluca" stopped matching the moment the
16990
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
16991
+ * the thing that does not move, so it is what a rule matches on
16992
+ * (`NcConditions.identities`) and the text is what a human is shown.
16993
+ *
16994
+ * Absent when the label names no gallery row — a plate the OCR read but no
16995
+ * vehicle claims, a sub-class, a species, any tier-1 value.
16996
+ */
16997
+ identityId: string().optional()
16475
16998
  });
16476
16999
  /**
16477
17000
  * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
@@ -16608,6 +17131,28 @@ var TrackSchema = object({
16608
17131
  * `=== true` and render nothing otherwise, never infer "no face".
16609
17132
  */
16610
17133
  hasFace: boolean().optional(),
17134
+ /**
17135
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
17136
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
17137
+ * so the passage is tracked once and as a VEHICLE.
17138
+ *
17139
+ * It exists because the fold's record was dishonest. D34 and the code both
17140
+ * said "the person is not lost — it is reported so both entities stay on the
17141
+ * record"; in fact the pair went into a per-processor RAM field behind an
17142
+ * accessor nobody called, and every durable surface said `vehicle`, full
17143
+ * stop. This is the composition note that makes the row true.
17144
+ *
17145
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
17146
+ * person" is not an answer to "what is this" — both label tiers would refuse
17147
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
17148
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
17149
+ * and a `person` rule still does not fire for someone cycling past.
17150
+ *
17151
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
17152
+ * the column, and every hub that predates the field, omits it. Test
17153
+ * `=== true` and render nothing otherwise — never infer "no rider".
17154
+ */
17155
+ hasRider: boolean().optional(),
16611
17156
  ...TrackFlagFields,
16612
17157
  ...TrackRetrainFields
16613
17158
  });
@@ -16957,7 +17502,10 @@ var RecentTracksQueryInput = object({
16957
17502
  * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
16958
17503
  cursor: string().optional(),
16959
17504
  /** See {@link TrackProjectionSchema}. Default `full`. */
16960
- projection: TrackProjectionSchema.optional()
17505
+ projection: TrackProjectionSchema.optional(),
17506
+ /** Include stationary-promoted rows (parked objects). Default false: the
17507
+ * feed lists passages; parking records live on the stationary registry. */
17508
+ includeStationary: boolean().optional()
16961
17509
  });
16962
17510
  var RecentTracksPageSchema = object({
16963
17511
  /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
@@ -17175,7 +17723,11 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17175
17723
  zone: TrackZoneFilterSchema.optional(),
17176
17724
  /** See {@link TrackProjectionSchema}. Default `full` (backward
17177
17725
  * compatible — omitting the field keeps today's exact behaviour). */
17178
- projection: TrackProjectionSchema.optional()
17726
+ projection: TrackProjectionSchema.optional(),
17727
+ /** Include stationary-promoted rows (parked objects handed to the
17728
+ * stationary registry). Default false: the timeline lists passages,
17729
+ * not parking records (operator decision, 2026-08-15). */
17730
+ includeStationary: boolean().optional()
17179
17731
  }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
17180
17732
  kind: "mutation",
17181
17733
  auth: "admin"
@@ -17339,11 +17891,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17339
17891
  auth: "admin"
17340
17892
  }), method(object({
17341
17893
  eventId: string(),
17342
- kind: MediaFileKindEnum.optional()
17894
+ kind: MediaFileKindEnum.optional(),
17895
+ deviceId: number()
17896
+ }), array(MediaFileSchema).readonly()), method(object({
17897
+ trackId: string(),
17898
+ kinds: array(MediaFileKindEnum).optional(),
17899
+ deviceId: number()
17343
17900
  }), array(MediaFileSchema).readonly()), method(object({
17344
17901
  trackId: string(),
17345
- kinds: array(MediaFileKindEnum).optional()
17346
- }), array(MediaFileSchema).readonly()), method(object({ trackId: string() }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
17902
+ deviceId: number()
17903
+ }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
17347
17904
  kind: "mutation",
17348
17905
  auth: "admin"
17349
17906
  }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
@@ -18003,6 +18560,17 @@ var maxSessionHoldMsField = {
18003
18560
  default: 12e4,
18004
18561
  step: 5e3
18005
18562
  };
18563
+ /**
18564
+ * Quiet period that closes an `audioMode: 'on-motion'` audio window. Floor of
18565
+ * 5s so a rearm can never degenerate into per-event stream churn; default 90s
18566
+ * comfortably outlives the gap between two PIR wakes on a battery camera.
18567
+ */
18568
+ var audioMotionWindowMsField = {
18569
+ min: 5e3,
18570
+ max: 6e5,
18571
+ default: 9e4,
18572
+ step: 5e3
18573
+ };
18006
18574
  var motionFpsField = {
18007
18575
  min: 1,
18008
18576
  max: 30,
@@ -18034,7 +18602,7 @@ var detectionFpsField = {
18034
18602
  var occupancyRecheckSecField = {
18035
18603
  min: 0,
18036
18604
  max: 300,
18037
- default: 30,
18605
+ default: 300,
18038
18606
  step: 5
18039
18607
  };
18040
18608
  var occupancyRecheckFramesField = {
@@ -18179,6 +18747,27 @@ var RunnerCameraConfigSchema = object({
18179
18747
  * resolved `CameraDetectionConfig`.
18180
18748
  */
18181
18749
  maxSessionHoldMs: number().min(maxSessionHoldMsField.min).max(maxSessionHoldMsField.max).optional(),
18750
+ /**
18751
+ * Orchestrator-side quiet period (ms) that closes an `audioMode:
18752
+ * 'on-motion'` audio window, measured from the LAST motion event.
18753
+ *
18754
+ * This exists because the falling edge cannot be relied on. Camera-native
18755
+ * providers emit motion as a RISING EDGE ONLY (Reolink's Baichuan push and
18756
+ * its email-push SMTP path both emit `detected: true` and never the
18757
+ * counterpart); only the frame-diff analyzer emits falls. So on an
18758
+ * onboard-only camera a window that closed only on `detected: false` never
18759
+ * closed at all, and `on-motion` silently behaved as `always-on` — on a
18760
+ * battery camera, the one failure mode the mode exists to prevent.
18761
+ *
18762
+ * Every motion event rearms this timer WITHOUT restarting the stream, so a
18763
+ * burst of re-fires costs nothing. A falling edge, when one does arrive,
18764
+ * still closes earlier via `motionCooldownMs` — whichever comes first wins.
18765
+ *
18766
+ * Not consumed by the runner: carried here so it shares the per-camera
18767
+ * device-settings surface with `motionCooldownMs`, exactly like
18768
+ * `maxSessionHoldMs`.
18769
+ */
18770
+ audioMotionWindowMs: number().min(audioMotionWindowMsField.min).max(audioMotionWindowMsField.max).optional(),
18182
18771
  motionFps: number().min(motionFpsField.min).max(motionFpsField.max).default(motionFpsField.default),
18183
18772
  detectionFps: number().min(detectionFpsField.min).max(detectionFpsField.max).default(detectionFpsField.default),
18184
18773
  motionStreamId: string(),
@@ -18274,7 +18863,7 @@ var RunnerCameraConfigSchema = object({
18274
18863
  */
18275
18864
  inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
18276
18865
  });
18277
- motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, maxSessionHoldMsField.min, maxSessionHoldMsField.max, maxSessionHoldMsField.step, maxSessionHoldMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
18866
+ motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, maxSessionHoldMsField.min, maxSessionHoldMsField.max, maxSessionHoldMsField.step, maxSessionHoldMsField.default, audioMotionWindowMsField.min, audioMotionWindowMsField.max, audioMotionWindowMsField.step, audioMotionWindowMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
18278
18867
  /**
18279
18868
  * Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
18280
18869
  * load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
@@ -19290,7 +19879,16 @@ targets: array(object({
19290
19879
  /** A sleeping battery camera: the frame is deliberately stale and will
19291
19880
  * NOT refresh in the background. A surface should say so rather than
19292
19881
  * present it as current. */
19293
- sleeping: boolean()
19882
+ sleeping: boolean(),
19883
+ /** Current device state rendered over the cached frame. State images
19884
+ * remain authoritative even when their photographic background is
19885
+ * old; null means the link must carry a current camera frame. */
19886
+ stateReason: _enum([
19887
+ "disabled",
19888
+ "sleeping",
19889
+ "unreachable",
19890
+ "waking"
19891
+ ]).nullable()
19294
19892
  })));
19295
19893
  /**
19296
19894
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
@@ -20647,7 +21245,11 @@ object({
20647
21245
  precision: number().int().min(0).max(10).optional()
20648
21246
  });
20649
21247
  DeviceType.Sensor;
20650
- object({
21248
+ /**
21249
+ * Ambient illuminance reading in lux. Drives Home Assistant `sensor`
21250
+ * entries with `device_class: illuminance`.
21251
+ */
21252
+ var AmbientLightSensorStatusSchema = object({
20651
21253
  /** Current illuminance in lux (lx). */
20652
21254
  lux: number().min(0),
20653
21255
  /** Ms epoch when the slice was last updated. */
@@ -20812,6 +21414,25 @@ var BatteryStatusSchema = object({
20812
21414
  /** Ms epoch of the last observation. Lets consumers reason about freshness. */
20813
21415
  lastUpdated: number(),
20814
21416
  /**
21417
+ * Ms epoch of the last time the device PROVED it was reachable — a
21418
+ * completed firmware round-trip, an observed wake, or an inbound push
21419
+ * (firmware event, email). `0`/absent = never since this slice was born.
21420
+ *
21421
+ * This is the ONLY input that separates "asleep" from "gone", and it is
21422
+ * fed exclusively by PASSIVE signals: nothing may write it by reaching
21423
+ * for the radio, because a poll that confirms reachability is the same
21424
+ * poll that drains the battery. See {@link deriveBatteryPresence} — the
21425
+ * single derivation every consumer must use; no surface computes its own.
21426
+ *
21427
+ * It is deliberately NOT a clock in the
21428
+ * `scripts/check-runtime-state-durability.ts` sense: it is the
21429
+ * observation itself, and it is the only thing a 30-hour silence is
21430
+ * visible in. Writers quantise it (see `CONTACT_WRITE_QUANTUM_MS` in the
21431
+ * Reolink provider) so a value that means "recently" cannot cost a
21432
+ * SQLite commit per round-trip.
21433
+ */
21434
+ lastContactAt: number().optional(),
21435
+ /**
20815
21436
  * True when the source is a BINARY low-battery indicator (HA
20816
21437
  * `binary_sensor` device_class=battery / `LOW_BAT`) that has no real
20817
21438
  * charge level — `percentage` is then a coarse stand-in (100 = normal,
@@ -20920,7 +21541,11 @@ DeviceType.Camera, method(object({ deviceId: number() }), CameraCredentialsSchem
20920
21541
  kind: "query",
20921
21542
  auth: "admin"
20922
21543
  });
20923
- object({
21544
+ /**
21545
+ * Carbon-monoxide alarm sensor. Drives Home Assistant `binary_sensor`
21546
+ * entries with `device_class: carbon_monoxide`. Push-driven.
21547
+ */
21548
+ var CarbonMonoxideStatusSchema = object({
20924
21549
  detected: boolean(),
20925
21550
  /** Ms epoch of the last transition. 0 if never observed. */
20926
21551
  lastChangedAt: number()
@@ -21208,7 +21833,19 @@ Object.values(DeviceType), method(object({
21208
21833
  kind: "mutation",
21209
21834
  auth: "admin"
21210
21835
  }), ConsumablesStatusSchema.extend({ lastFetchedAt: number() });
21211
- object({
21836
+ /**
21837
+ * Door / window / opening / garage / valve contact sensor. Boolean
21838
+ * "is the entry currently open" with the timestamp of the last
21839
+ * transition. Drives Home Assistant `binary_sensor` entries whose
21840
+ * `device_class` is `door`, `window`, `opening`, `garage`, or
21841
+ * `garage_door` — and any future native integration that needs
21842
+ * the same semantics.
21843
+ *
21844
+ * Push-driven: providers update the slice on transition events from
21845
+ * the upstream source (HA WebSocket `state_changed`, ZWave
21846
+ * `notification` …). Consumers read the slice; no polling.
21847
+ */
21848
+ var ContactStatusSchema = object({
21212
21849
  /** True when the entry is open; false when closed. */
21213
21850
  entryOpen: boolean(),
21214
21851
  /** Ms epoch of the last open↔closed transition. 0 if never observed. */
@@ -21807,7 +22444,15 @@ object({
21807
22444
  deviceId: number(),
21808
22445
  status: FeatureProbeStatusSchema
21809
22446
  });
21810
- object({
22447
+ /**
22448
+ * Water leak / moisture sensor. Boolean "is liquid currently
22449
+ * detected" with the timestamp of the last transition. Drives Home
22450
+ * Assistant `binary_sensor` entries with `device_class: moisture`,
22451
+ * and any future native flood sensor.
22452
+ *
22453
+ * Push-driven from the upstream source.
22454
+ */
22455
+ var FloodStatusSchema = object({
21811
22456
  /** True when leak is currently detected. */
21812
22457
  flooded: boolean(),
21813
22458
  /** Ms epoch of the last flooded↔dry transition. 0 if never observed. */
@@ -21861,7 +22506,15 @@ DeviceType.Humidifier, method(object({
21861
22506
  kind: "mutation",
21862
22507
  auth: "admin"
21863
22508
  });
21864
- object({
22509
+ /**
22510
+ * Single-metric humidity reading. Drives Home Assistant `sensor`
22511
+ * entries with `device_class: humidity`.
22512
+ *
22513
+ * Unit normalisation: percent. The canonical display unit (`%`) is a
22514
+ * descriptor constant in the UI (ROLE_DESCRIPTOR), not stored in
22515
+ * `sourceInfo`.
22516
+ */
22517
+ var HumiditySensorStatusSchema = object({
21865
22518
  /** Current relative humidity, 0..100. */
21866
22519
  percent: number().min(0).max(100),
21867
22520
  /** Ms epoch when the slice was last updated. */
@@ -22483,7 +23136,7 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
22483
23136
  * tunnel always emits `https://` regardless. */
22484
23137
  scheme: _enum(["http", "https"]).optional()
22485
23138
  }), GetConnectionEndpointsResultSchema), method(_void(), NotificationEndpointSchema), method(object({ baseUrl: string().nullable() }), NotificationEndpointSchema, { kind: "mutation" }), method(_void(), AllowedAddressesSchema), method(AllowedAddressesSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), AllowedAddressesSchema, { kind: "mutation" });
22486
- object({
23139
+ var LockControlStatusSchema = object({
22487
23140
  /** Lifecycle state of the lock. `jammed` means the motor reported
22488
23141
  * failure to reach the target — operator intervention required. */
22489
23142
  state: _enum([
@@ -22821,7 +23474,19 @@ authKey: string().optional() }), object({
22821
23474
  /** Human-readable error when `ok: false`. */
22822
23475
  error: string().optional()
22823
23476
  }), { kind: "mutation" });
22824
- object({
23477
+ /**
23478
+ * Hardware / firmware motion sensor cap — binary detected state plus
23479
+ * a timestamp of the last observation. Distinct from
23480
+ * `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
23481
+ * `motion` is the lightweight readout from on-camera motion (Reolink
23482
+ * `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
23483
+ *
23484
+ * Native-motion providers also fan out to `detection.camera-native`
23485
+ * with `source: 'onboard'` so cross-cutting system services
23486
+ * (alert-center, advanced-notifier) can subscribe once and receive
23487
+ * motion from every camera.
23488
+ */
23489
+ var MotionStatusSchema = object({
22825
23490
  detected: boolean(),
22826
23491
  /** Ms epoch of the last detected-true observation. Null if never detected. */
22827
23492
  lastDetectedAt: number().nullable(),
@@ -23933,7 +24598,7 @@ var GpsLocationSchema = object({
23933
24598
  /** Reported accuracy in meters (lower = better). */
23934
24599
  accuracyMeters: number().nonnegative()
23935
24600
  });
23936
- object({
24601
+ var PresenceStatusSchema = object({
23937
24602
  /** `home` / `not_home` / any user-defined zone name. */
23938
24603
  state: string(),
23939
24604
  /** Optional textual location label (zone name, city, address). Null
@@ -24349,7 +25014,7 @@ method(object({
24349
25014
  toMs: number()
24350
25015
  }), RecordingAvailabilitySchema, {
24351
25016
  kind: "query",
24352
- auth: "admin"
25017
+ auth: "protected"
24353
25018
  }), method(object({
24354
25019
  deviceId: number(),
24355
25020
  fromMs: number(),
@@ -24357,14 +25022,14 @@ method(object({
24357
25022
  tzOffsetMinutes: number()
24358
25023
  }), RecordingDaysSchema, {
24359
25024
  kind: "query",
24360
- auth: "admin"
25025
+ auth: "protected"
24361
25026
  }), method(object({
24362
25027
  deviceId: number(),
24363
25028
  fromMs: number(),
24364
25029
  toMs: number()
24365
25030
  }), RecordingManifestSchema, {
24366
25031
  kind: "query",
24367
- auth: "admin"
25032
+ auth: "protected"
24368
25033
  }), method(object({}), RecordingStorageUsageSchema, {
24369
25034
  kind: "query",
24370
25035
  auth: "admin"
@@ -24654,14 +25319,77 @@ method(object({
24654
25319
  * thing except the comparator: `similarity` (CLIP cosine at the same ROI coords
24655
25320
  * vs condition-tagged references) and `llm` (vision-LLM judgment over the crop).
24656
25321
  *
24657
- * D14 device-config archetype (`deviceConfig.ui.kind:'widget'`) the framework
24658
- * derives the device-detail contribution; the provider carries NO hand-written
24659
- * settings-contribution methods. `status.kind:'push'` the engine pushes on
24660
- * every hysteresis flip / availability change; consumers never poll.
25322
+ * **No `deviceConfig`, deliberately.** This shipped as the D14 widget archetype,
25323
+ * which put a "Scenes" tab on one camera's detail page. That is the wrong shape
25324
+ * for the thing: a scene is a standing question about the property ("is the bin
25325
+ * still out"), and the operator's question is "which of my scenes have tripped",
25326
+ * across every camera at once — not "what does camera 617 think". Buried one
25327
+ * camera deep it also could not be found. The surface is now a top-level admin
25328
+ * page (`/scenes`, `pages/Scenes.tsx`) that lists every scene on every camera and
25329
+ * picks the camera inside the create flow, the same shape Events and Faces have.
25330
+ *
25331
+ * The consequence to keep in mind: `host/scene-monitor-editor` is gone from
25332
+ * `HOST_WIDGETS` too. `scripts/check-host-widget-resolves.ts` asserts BOTH
25333
+ * directions, so a registration nobody declares fails exactly as loudly as a
25334
+ * declaration nobody registers. The editor is imported directly by the page.
25335
+ *
25336
+ * `status.kind:'push'` — the engine pushes on every hysteresis flip /
25337
+ * availability change; consumers never poll.
24661
25338
  */
24662
- /** Extensible condition tag. Seeded 'day' | 'night'; open by design so more can
24663
- * be added without a wire break (matching falls back to any-condition refs). */
25339
+ /** Extensible condition tag. Seeded 'day' | 'ir' (the two variants the operator
25340
+ * captures) plus 'night' | 'dawn' | 'dusk' from the resolver's sun-times band.
25341
+ * Open by design so more can be added without a wire break.
25342
+ *
25343
+ * Matching does NOT fall back across conditions: cross-condition cosines are
25344
+ * not comparable, so "I have never seen this scene in this light" is reported
25345
+ * as `unknown`, never guessed. A day reference scored against an IR frame
25346
+ * collapses the cosine and would latch a false alarm every single night. */
24664
25347
  var SceneConditionSchema = string();
25348
+ /**
25349
+ * What a scene does when the CURRENT light has no reference of its own.
25350
+ *
25351
+ * The lighting variants are not equally likely to exist. Almost every operator
25352
+ * captures daylight and then never stands outside at 22:00 to capture IR, and a
25353
+ * scene that is only ever going to be asked about a daytime question ("is the
25354
+ * bin still on the kerb at 08:00") does not need a night reference at all. The
25355
+ * night half must therefore be OPTIONAL, and optional means the scene keeps
25356
+ * working without it rather than degrading into a permanent complaint.
25357
+ *
25358
+ * - `skip` (default) — the check in that light is not made. Not a verdict, not
25359
+ * an alarm, not even an `unknown`: the live state simply stays whatever the
25360
+ * last covered light left it at, the latch is untouched, and the hysteresis
25361
+ * run is neither spent nor cleared. The scene resumes by itself at first
25362
+ * light. This is the only behaviour under which "I never captured IR" is a
25363
+ * configuration choice instead of a nightly fault.
25364
+ * - `judge-anyway` — score against the OTHER conditions' references. Available
25365
+ * for cameras whose IR frame is close enough to daylight (a floodlit
25366
+ * driveway, an always-white-light doorbell), and wrong for everything else:
25367
+ * cross-condition cosines are not comparable, so a day reference against a
25368
+ * true IR frame collapses and the scene reports a theft at 21:40.
25369
+ *
25370
+ * Never applies when the scene has NO comparable reference at all — that is
25371
+ * "not armed yet", it is reported as `no-reference-for-condition`, and silence
25372
+ * there would hide a scene the operator never finished setting up.
25373
+ */
25374
+ var SceneUncoveredPolicySchema = _enum(["skip", "judge-anyway"]);
25375
+ /** `matched` = the baseline is what we see; `diverged` = it demonstrably is not;
25376
+ * `unknown` = we cannot judge (no reference for this condition, encoder model
25377
+ * changed, view shifted, no snapshot). `unknown` is a real value, not a null,
25378
+ * and never counts toward hysteresis in either direction. */
25379
+ var SceneVerdictSchema = _enum([
25380
+ "matched",
25381
+ "diverged",
25382
+ "unknown"
25383
+ ]);
25384
+ /** Why a scene cannot judge. Named, because this feature's failure mode is
25385
+ * silence that reads as "nothing has happened". */
25386
+ var SceneUnavailableSchema = _enum([
25387
+ "no-reference-for-condition",
25388
+ "view-shifted",
25389
+ "no-vision-profile",
25390
+ "encoder-model-changed",
25391
+ "no-snapshot"
25392
+ ]);
24665
25393
  /** One captured reference — condition-tagged, model-version-gated. `embedding`
24666
25394
  * is `number[]` (Float32Array does NOT survive MsgPack/UDS). */
24667
25395
  var SceneReferenceSchema = object({
@@ -24669,7 +25397,14 @@ var SceneReferenceSchema = object({
24669
25397
  modelId: string(),
24670
25398
  condition: SceneConditionSchema,
24671
25399
  capturedAt: number(),
24672
- thumbnailMediaId: string().optional()
25400
+ thumbnailMediaId: string().optional(),
25401
+ /** Whole-frame (downscaled) embedding captured alongside the ROI crop. The
25402
+ * anti-view-shift anchor: a bumped camera, a PTZ preset or a re-aim makes the
25403
+ * normalized rect frame a different piece of world, and the scene would
25404
+ * diverge forever with a perfectly plausible cosine. Checked LAZILY, only
25405
+ * when hysteresis is about to flip — one extra encode per candidate
25406
+ * transition, not per poll. */
25407
+ anchorEmbedding: array(number()).optional()
24673
25408
  });
24674
25409
  var SceneMonitorStateSchema = object({
24675
25410
  id: string(),
@@ -24691,6 +25426,28 @@ var SceneCheckSchema = discriminatedUnion("mode", [object({
24691
25426
  profileId: string().optional(),
24692
25427
  hysteresisCount: number().int().positive()
24693
25428
  })]);
25429
+ var SCENE_DEFAULT_ANCHOR_THRESHOLD = .85;
25430
+ /** Night is OPTIONAL. A scene with only a daylight reference sits the IR hours
25431
+ * out in silence rather than reporting a fault every night. */
25432
+ var SCENE_DEFAULT_UNCOVERED_POLICY = "skip";
25433
+ /**
25434
+ * Vision-model adjudication of a candidate flip. Field names deliberately
25435
+ * mirror `NcConfirmSchema` so an operator meets one vocabulary, not two.
25436
+ *
25437
+ * `onTimeout` defaults to **'hold'**, the OPPOSITE of `NcConfirmGate`'s
25438
+ * fail-open: a notification suppressed is the worse error there, but a vision
25439
+ * model that timed out has not told us the bin is gone, and a latch is a
25440
+ * stateful claim that costs the operator a trip to reset.
25441
+ */
25442
+ var SceneConfirmSchema = object({
25443
+ enabled: boolean().default(false),
25444
+ prompt: string().min(1).max(1e3),
25445
+ profileId: string().optional(),
25446
+ timeoutMs: number().int().min(1e3).max(2e4).default(8e3),
25447
+ maxImagePx: number().int().min(64).max(2048).default(448),
25448
+ /** What a timeout / unavailable model means for the PENDING flip. */
25449
+ onTimeout: _enum(["flip", "hold"]).default("hold")
25450
+ });
24694
25451
  var SceneMonitorSchema = object({
24695
25452
  id: string(),
24696
25453
  label: string(),
@@ -24709,7 +25466,56 @@ var SceneMonitorSchema = object({
24709
25466
  lastConfidence: number().nullable(),
24710
25467
  currentCondition: SceneConditionSchema.nullable(),
24711
25468
  availability: _enum(["ok", "unavailable"]),
24712
- unavailableReason: string().nullable()
25469
+ unavailableReason: string().nullable(),
25470
+ /** Which state is "the initial screen". `null` until the first capture. */
25471
+ baselineStateId: string().nullable(),
25472
+ /** Which boolean drives notification rules and any export. */
25473
+ emit: _enum(["latched", "live"]).default("latched"),
25474
+ /** Live: does the region match the baseline RIGHT NOW. */
25475
+ verdict: SceneVerdictSchema,
25476
+ /** Has it been `diverged` at least once since `armedAt` — the operator's boolean. */
25477
+ latched: boolean(),
25478
+ /** Last reset (or creation). */
25479
+ armedAt: number(),
25480
+ divergedAt: number().nullable(),
25481
+ restoredAt: number().nullable(),
25482
+ /** A check is only COUNTED when the device has been quiet this long. Motion
25483
+ * during the window DISCARDS the observation — a car pulling up in front of
25484
+ * the bin must not be able to spend hysteresis credit. */
25485
+ quietSeconds: number().int().min(0).max(3600).default(60),
25486
+ /** An observation only advances the pending count when it is at least this
25487
+ * far from the previously counted one, so N agreeing checks span real time
25488
+ * rather than N adjacent polls inside one occlusion. */
25489
+ minObservationSpacingSec: number().int().min(0).max(3600).default(120),
25490
+ /** Vision-model adjudication of a candidate flip. Similarity primary only. */
25491
+ confirm: SceneConfirmSchema.optional(),
25492
+ /** Whole-frame anchor cosine below which a flip is REFUSED as `view-shifted`. */
25493
+ anchorThreshold: number().min(0).max(1).default(SCENE_DEFAULT_ANCHOR_THRESHOLD),
25494
+ /** Clear the latch on its own when the scene matches again? Default false —
25495
+ * `restoredAt` and the `scene-restored` edge are recorded regardless, so an
25496
+ * automation can react to the bin coming back without the operator's own
25497
+ * alarm silently clearing itself. */
25498
+ autoRestore: boolean().default(false),
25499
+ /** What to do when the current light has no reference of its own. See
25500
+ * {@link SceneUncoveredPolicySchema} — the default makes night OPTIONAL. */
25501
+ onUncoveredCondition: SceneUncoveredPolicySchema.default(SCENE_DEFAULT_UNCOVERED_POLICY),
25502
+ /**
25503
+ * The light whose checks are currently being SAT OUT under
25504
+ * `onUncoveredCondition: 'skip'` — `null` when the scene is checking normally.
25505
+ *
25506
+ * Engine-reported and advisory only: it moves no verdict, no latch and no
25507
+ * hysteresis. It exists so the card can say *"night (IR) — checks paused,
25508
+ * nothing captured in this light"* in the same calm voice as the coverage
25509
+ * line, because the alternative is a scene that silently stops answering
25510
+ * after sunset with nothing anywhere saying why. A skipped check must never
25511
+ * read as a broken one.
25512
+ */
25513
+ suspendedCondition: SceneConditionSchema.nullable().default(null),
25514
+ /** Named cause when `verdict === 'unknown'`. */
25515
+ unavailable: SceneUnavailableSchema.nullable(),
25516
+ /** Conditions that have at least one comparable reference — the coverage line
25517
+ * ("day ✓ · ir ✓ · dusk ✗") that turns a silent fallback into a visible fact. */
25518
+ coveredConditions: array(SceneConditionSchema)
24713
25519
  });
24714
25520
  var SceneMonitorStatusSchema = object({
24715
25521
  monitors: array(SceneMonitorSchema),
@@ -24742,7 +25548,15 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
24742
25548
  "both"
24743
25549
  ]).optional(),
24744
25550
  checkIntervalSec: number().optional(),
24745
- check: SceneCheckSchema.optional()
25551
+ check: SceneCheckSchema.optional(),
25552
+ emit: _enum(["latched", "live"]).optional(),
25553
+ quietSeconds: number().int().min(0).max(3600).optional(),
25554
+ minObservationSpacingSec: number().int().min(0).max(3600).optional(),
25555
+ anchorThreshold: number().min(0).max(1).optional(),
25556
+ autoRestore: boolean().optional(),
25557
+ onUncoveredCondition: SceneUncoveredPolicySchema.optional(),
25558
+ /** `null` clears the vision-model adjudicator. */
25559
+ confirm: SceneConfirmSchema.nullable().optional()
24746
25560
  })
24747
25561
  }), _void(), {
24748
25562
  kind: "mutation",
@@ -24779,6 +25593,14 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
24779
25593
  }), _void(), {
24780
25594
  kind: "mutation",
24781
25595
  auth: "admin"
25596
+ }), method(object({
25597
+ deviceId: number(),
25598
+ monitorId: string(),
25599
+ /** Defaults to TRUE at the provider seam — see `SCENE_RESET_RECAPTURES`. */
25600
+ recapture: boolean().optional()
25601
+ }), _void(), {
25602
+ kind: "mutation",
25603
+ auth: "admin"
24782
25604
  });
24783
25605
  /**
24784
25606
  * Per-stage gating mode applied to the zones a rule references.
@@ -24893,7 +25715,16 @@ DeviceType.Script, method(object({
24893
25715
  kind: "mutation",
24894
25716
  auth: "admin"
24895
25717
  });
24896
- object({
25718
+ /**
25719
+ * Smoke alarm sensor — boolean "is smoke currently detected" with
25720
+ * timestamp of the last transition. Drives Home Assistant
25721
+ * `binary_sensor` entries with `device_class: smoke`.
25722
+ *
25723
+ * Push-driven: a smoke event is critical, so the slice updates
25724
+ * immediately on the upstream signal. Auto-clearing back to false is
25725
+ * provider-controlled (some alarms latch until manually reset).
25726
+ */
25727
+ var SmokeStatusSchema = object({
24897
25728
  detected: boolean(),
24898
25729
  /** Ms epoch of the last transition. 0 if never observed. */
24899
25730
  lastChangedAt: number()
@@ -24932,6 +25763,16 @@ var CamStreamDescriptorSchema = object({
24932
25763
  /** Transport-specific opaque metadata (e.g. rfc4571 SDP). */
24933
25764
  metadata: record(string(), unknown()).optional()
24934
25765
  });
25766
+ object({
25767
+ /** The descriptors as last built from a real camera response. Never a guess:
25768
+ * a failed or refused build writes NOTHING, so a restored catalog is always
25769
+ * one the camera itself once produced. */
25770
+ descriptors: array(CamStreamDescriptorSchema),
25771
+ /** Ms epoch of the build that produced {@link descriptors}. Lets the wake
25772
+ * path decide whether the camera's own awake window is worth spending on a
25773
+ * re-read. */
25774
+ lastFetchedAt: number()
25775
+ });
24935
25776
  DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), array(CamStreamDescriptorSchema).readonly());
24936
25777
  /** One of the camera's stream profiles. */
24937
25778
  var StreamProfileSchema = _enum([
@@ -25087,12 +25928,64 @@ var NetworkAddressSchema = object({
25087
25928
  family: string(),
25088
25929
  internal: boolean()
25089
25930
  });
25931
+ /**
25932
+ * Provenance of the site coordinates, and the whole reason this is not just two
25933
+ * numbers.
25934
+ *
25935
+ * - `operator-set` — a human typed it, or accepted a detection. Authoritative;
25936
+ * nothing overwrites it.
25937
+ * - `derived-from-ip` — the hub geolocated its own public IP once, because a
25938
+ * default that is right to a few kilometres beats the coarse UTC clock split
25939
+ * the sun-times consumers otherwise fall back to.
25940
+ *
25941
+ * The UI shows which one it is. An operator who cannot tell a guess from their
25942
+ * own input will eventually trust the guess.
25943
+ */
25944
+ var SiteLocationSourceSchema = _enum(["operator-set", "derived-from-ip"]);
25945
+ /**
25946
+ * The read shape: the location plus the honest state of the one-shot derivation.
25947
+ *
25948
+ * `derivationAttemptedAt` is what makes the "one call, ever" contract
25949
+ * inspectable. When it is set and `location` is null, the geo-IP lookup ran and
25950
+ * failed; the hub will NOT try again on its own — the fallback is declared
25951
+ * (consumers degrade to their own last resort) and the operator either types the
25952
+ * coordinates or presses detect.
25953
+ */
25954
+ var SiteLocationStatusSchema = object({
25955
+ location: object({
25956
+ /** WGS84 decimal degrees. */
25957
+ latitude: number().min(-90).max(90),
25958
+ longitude: number().min(-180).max(180),
25959
+ source: SiteLocationSourceSchema,
25960
+ /** Epoch ms the value was last written. */
25961
+ updatedAt: number(),
25962
+ /**
25963
+ * Human-readable place the geo-IP service reported ("Napoli, IT"). Display
25964
+ * only — never parsed, never matched on. Absent for an operator-typed value.
25965
+ */
25966
+ label: string().optional()
25967
+ }).nullable(),
25968
+ derivationAttemptedAt: number().nullable(),
25969
+ /** Why the last derivation failed, for the UI to show instead of a shrug. */
25970
+ derivationError: string().nullable()
25971
+ });
25972
+ /** `null` clears the location and re-arms nothing — the derivation stays spent. */
25973
+ var SetSiteLocationInputSchema = object({
25974
+ latitude: number().min(-90).max(90),
25975
+ longitude: number().min(-180).max(180)
25976
+ }).nullable();
25090
25977
  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(), {
25091
25978
  kind: "mutation",
25092
25979
  auth: "admin"
25093
25980
  }), method(_void(), _void(), {
25094
25981
  kind: "mutation",
25095
25982
  auth: "admin"
25983
+ }), method(_void(), SiteLocationStatusSchema), method(SetSiteLocationInputSchema, SiteLocationStatusSchema, {
25984
+ kind: "mutation",
25985
+ auth: "admin"
25986
+ }), method(_void(), SiteLocationStatusSchema, {
25987
+ kind: "mutation",
25988
+ auth: "admin"
25096
25989
  });
25097
25990
  object({
25098
25991
  /** True when the device's tamper switch / case-open contact is
@@ -25102,7 +25995,23 @@ object({
25102
25995
  lastChangedAt: number()
25103
25996
  });
25104
25997
  DeviceType.Sensor;
25105
- object({
25998
+ /**
25999
+ * Single-metric temperature reading. Drives Home Assistant `sensor`
26000
+ * entries with `device_class: temperature` and any future native
26001
+ * thermometer.
26002
+ *
26003
+ * Unit normalisation: providers convert to Celsius before storing.
26004
+ * The slice value is always Celsius so cross-cap aggregators
26005
+ * (climate-control's `currentTemp`, energy analytics) can compose
26006
+ * without per-source unit fixups. The canonical display unit (`°C`) is
26007
+ * a descriptor constant in the UI (ROLE_DESCRIPTOR), not stored in
26008
+ * `sourceInfo`.
26009
+ *
26010
+ * Status `lastFetchedAt` lets staleness-aware consumers detect a
26011
+ * frozen feed (provider hung) distinct from a "temperature hasn't
26012
+ * changed" steady state.
26013
+ */
26014
+ var TemperatureSensorStatusSchema = object({
25106
26015
  /** Current temperature in Celsius. */
25107
26016
  celsius: number(),
25108
26017
  /** Ms epoch when the slice was last updated (push or poll). */
@@ -27822,6 +28731,12 @@ Object.freeze({
27822
28731
  addonId: null,
27823
28732
  access: "create"
27824
28733
  },
28734
+ "llm.cancel": {
28735
+ capName: "llm",
28736
+ capScope: "system",
28737
+ addonId: null,
28738
+ access: "create"
28739
+ },
27825
28740
  "llm.deleteModel": {
27826
28741
  capName: "llm",
27827
28742
  capScope: "system",
@@ -27906,6 +28821,12 @@ Object.freeze({
27906
28821
  addonId: null,
27907
28822
  access: "view"
27908
28823
  },
28824
+ "llm.resolveModelRef": {
28825
+ capName: "llm",
28826
+ capScope: "system",
28827
+ addonId: null,
28828
+ access: "create"
28829
+ },
27909
28830
  "llm.setDefault": {
27910
28831
  capName: "llm",
27911
28832
  capScope: "system",
@@ -30072,6 +30993,12 @@ Object.freeze({
30072
30993
  addonId: null,
30073
30994
  access: "create"
30074
30995
  },
30996
+ "sceneMonitor.resetScene": {
30997
+ capName: "scene-monitor",
30998
+ capScope: "device",
30999
+ addonId: null,
31000
+ access: "delete"
31001
+ },
30075
31002
  "sceneMonitor.updateScene": {
30076
31003
  capName: "scene-monitor",
30077
31004
  capScope: "device",
@@ -30750,6 +31677,12 @@ Object.freeze({
30750
31677
  addonId: null,
30751
31678
  access: "create"
30752
31679
  },
31680
+ "system.detectSiteLocation": {
31681
+ capName: "system",
31682
+ capScope: "system",
31683
+ addonId: null,
31684
+ access: "create"
31685
+ },
30753
31686
  "system.featureFlags": {
30754
31687
  capName: "system",
30755
31688
  capScope: "system",
@@ -30768,6 +31701,12 @@ Object.freeze({
30768
31701
  addonId: null,
30769
31702
  access: "view"
30770
31703
  },
31704
+ "system.getSiteLocation": {
31705
+ capName: "system",
31706
+ capScope: "system",
31707
+ addonId: null,
31708
+ access: "view"
31709
+ },
30771
31710
  "system.health": {
30772
31711
  capName: "system",
30773
31712
  capScope: "system",
@@ -30792,6 +31731,12 @@ Object.freeze({
30792
31731
  addonId: null,
30793
31732
  access: "create"
30794
31733
  },
31734
+ "system.setSiteLocation": {
31735
+ capName: "system",
31736
+ capScope: "system",
31737
+ addonId: null,
31738
+ access: "create"
31739
+ },
30795
31740
  "terminalSession.adoptLegacyMonitor": {
30796
31741
  capName: "terminal-session",
30797
31742
  capScope: "system",
@@ -31363,6 +32308,1704 @@ Object.freeze({
31363
32308
  access: "create"
31364
32309
  }
31365
32310
  });
32311
+ Object.freeze({
32312
+ "accessories.setChildHidden": [{
32313
+ name: "childDeviceId",
32314
+ form: "single",
32315
+ optional: false
32316
+ }, {
32317
+ name: "deviceId",
32318
+ form: "single",
32319
+ optional: false
32320
+ }],
32321
+ "addonSettings.getDeviceSettings": [{
32322
+ name: "deviceId",
32323
+ form: "single",
32324
+ optional: false
32325
+ }],
32326
+ "addonSettings.updateDeviceSettings": [{
32327
+ name: "deviceId",
32328
+ form: "single",
32329
+ optional: false
32330
+ }],
32331
+ "alarmPanel.arm": [{
32332
+ name: "deviceId",
32333
+ form: "single",
32334
+ optional: false
32335
+ }],
32336
+ "alarmPanel.disarm": [{
32337
+ name: "deviceId",
32338
+ form: "single",
32339
+ optional: false
32340
+ }],
32341
+ "alarmPanel.trigger": [{
32342
+ name: "deviceId",
32343
+ form: "single",
32344
+ optional: false
32345
+ }],
32346
+ "audioAnalysis.resolveDeviceSettings": [{
32347
+ name: "deviceId",
32348
+ form: "single",
32349
+ optional: false
32350
+ }],
32351
+ "audioAnalyzer.classify": [{
32352
+ name: "deviceId",
32353
+ form: "single",
32354
+ optional: true
32355
+ }],
32356
+ "audioMetrics.getCurrentSnapshot": [{
32357
+ name: "deviceId",
32358
+ form: "single",
32359
+ optional: false
32360
+ }],
32361
+ "audioMetrics.getHistory": [{
32362
+ name: "deviceId",
32363
+ form: "single",
32364
+ optional: false
32365
+ }],
32366
+ "automationControl.disable": [{
32367
+ name: "deviceId",
32368
+ form: "single",
32369
+ optional: false
32370
+ }],
32371
+ "automationControl.enable": [{
32372
+ name: "deviceId",
32373
+ form: "single",
32374
+ optional: false
32375
+ }],
32376
+ "automationControl.trigger": [{
32377
+ name: "deviceId",
32378
+ form: "single",
32379
+ optional: false
32380
+ }],
32381
+ "battery.wakeForStream": [{
32382
+ name: "deviceId",
32383
+ form: "single",
32384
+ optional: false
32385
+ }],
32386
+ "brightness.setBrightness": [{
32387
+ name: "deviceId",
32388
+ form: "single",
32389
+ optional: false
32390
+ }],
32391
+ "button.press": [{
32392
+ name: "deviceId",
32393
+ form: "single",
32394
+ optional: false
32395
+ }],
32396
+ "cameraCredentials.getCredentials": [{
32397
+ name: "deviceId",
32398
+ form: "single",
32399
+ optional: false
32400
+ }],
32401
+ "cameraStreams.getBrokerStreams": [{
32402
+ name: "deviceId",
32403
+ form: "single",
32404
+ optional: false
32405
+ }],
32406
+ "cameraStreams.getCameraStreams": [{
32407
+ name: "deviceId",
32408
+ form: "single",
32409
+ optional: false
32410
+ }],
32411
+ "cameraStreams.getProfileRtspEntries": [{
32412
+ name: "deviceId",
32413
+ form: "single",
32414
+ optional: false
32415
+ }],
32416
+ "cameraStreams.getRtspEntries": [{
32417
+ name: "deviceId",
32418
+ form: "single",
32419
+ optional: false
32420
+ }],
32421
+ "cameraStreams.pickStream": [{
32422
+ name: "deviceId",
32423
+ form: "single",
32424
+ optional: false
32425
+ }],
32426
+ "climateControl.setFanMode": [{
32427
+ name: "deviceId",
32428
+ form: "single",
32429
+ optional: false
32430
+ }],
32431
+ "climateControl.setMode": [{
32432
+ name: "deviceId",
32433
+ form: "single",
32434
+ optional: false
32435
+ }],
32436
+ "climateControl.setPreset": [{
32437
+ name: "deviceId",
32438
+ form: "single",
32439
+ optional: false
32440
+ }],
32441
+ "climateControl.setSwingHorizontal": [{
32442
+ name: "deviceId",
32443
+ form: "single",
32444
+ optional: false
32445
+ }],
32446
+ "climateControl.setSwingVertical": [{
32447
+ name: "deviceId",
32448
+ form: "single",
32449
+ optional: false
32450
+ }],
32451
+ "climateControl.setTarget": [{
32452
+ name: "deviceId",
32453
+ form: "single",
32454
+ optional: false
32455
+ }],
32456
+ "climateControl.setTargetHumidity": [{
32457
+ name: "deviceId",
32458
+ form: "single",
32459
+ optional: false
32460
+ }],
32461
+ "climateControl.setTargetRange": [{
32462
+ name: "deviceId",
32463
+ form: "single",
32464
+ optional: false
32465
+ }],
32466
+ "color.setColor": [{
32467
+ name: "deviceId",
32468
+ form: "single",
32469
+ optional: false
32470
+ }],
32471
+ "consumables.reset": [{
32472
+ name: "deviceId",
32473
+ form: "single",
32474
+ optional: false
32475
+ }],
32476
+ "control.setValue": [{
32477
+ name: "deviceId",
32478
+ form: "single",
32479
+ optional: false
32480
+ }],
32481
+ "cover.close": [{
32482
+ name: "deviceId",
32483
+ form: "single",
32484
+ optional: false
32485
+ }],
32486
+ "cover.open": [{
32487
+ name: "deviceId",
32488
+ form: "single",
32489
+ optional: false
32490
+ }],
32491
+ "cover.setPosition": [{
32492
+ name: "deviceId",
32493
+ form: "single",
32494
+ optional: false
32495
+ }],
32496
+ "cover.setTiltPosition": [{
32497
+ name: "deviceId",
32498
+ form: "single",
32499
+ optional: false
32500
+ }],
32501
+ "cover.stop": [{
32502
+ name: "deviceId",
32503
+ form: "single",
32504
+ optional: false
32505
+ }],
32506
+ "dayNight.getOptions": [{
32507
+ name: "deviceId",
32508
+ form: "single",
32509
+ optional: false
32510
+ }],
32511
+ "dayNight.setSettings": [{
32512
+ name: "deviceId",
32513
+ form: "single",
32514
+ optional: false
32515
+ }],
32516
+ "decoder.createSession": [{
32517
+ name: "deviceId",
32518
+ form: "single",
32519
+ optional: true
32520
+ }],
32521
+ "deviceAdoption.release": [{
32522
+ name: "camDeviceId",
32523
+ form: "single",
32524
+ optional: false
32525
+ }],
32526
+ "deviceAdoption.resync": [{
32527
+ name: "camDeviceId",
32528
+ form: "single",
32529
+ optional: false
32530
+ }],
32531
+ "deviceDiscovery.adoptDevice": [{
32532
+ name: "deviceId",
32533
+ form: "single",
32534
+ optional: false
32535
+ }],
32536
+ "deviceDiscovery.listDiscovered": [{
32537
+ name: "deviceId",
32538
+ form: "single",
32539
+ optional: false
32540
+ }],
32541
+ "deviceDiscovery.refreshDiscovery": [{
32542
+ name: "deviceId",
32543
+ form: "single",
32544
+ optional: false
32545
+ }],
32546
+ "deviceDiscovery.releaseDevice": [{
32547
+ name: "childDeviceId",
32548
+ form: "single",
32549
+ optional: false
32550
+ }, {
32551
+ name: "deviceId",
32552
+ form: "single",
32553
+ optional: false
32554
+ }],
32555
+ "deviceManager.adoptionRelease": [{
32556
+ name: "camDeviceId",
32557
+ form: "single",
32558
+ optional: false
32559
+ }],
32560
+ "deviceManager.adoptionResync": [{
32561
+ name: "camDeviceId",
32562
+ form: "single",
32563
+ optional: false
32564
+ }],
32565
+ "deviceManager.applyInitialMeta": [{
32566
+ name: "deviceId",
32567
+ form: "single",
32568
+ optional: false
32569
+ }, {
32570
+ name: "linkDeviceId",
32571
+ form: "single",
32572
+ optional: true
32573
+ }],
32574
+ "deviceManager.disable": [{
32575
+ name: "deviceId",
32576
+ form: "single",
32577
+ optional: false
32578
+ }],
32579
+ "deviceManager.enable": [{
32580
+ name: "deviceId",
32581
+ form: "single",
32582
+ optional: false
32583
+ }],
32584
+ "deviceManager.getBindings": [{
32585
+ name: "deviceId",
32586
+ form: "single",
32587
+ optional: false
32588
+ }],
32589
+ "deviceManager.getChildren": [{
32590
+ name: "parentDeviceId",
32591
+ form: "single",
32592
+ optional: false
32593
+ }],
32594
+ "deviceManager.getConfigSchema": [{
32595
+ name: "deviceId",
32596
+ form: "single",
32597
+ optional: false
32598
+ }],
32599
+ "deviceManager.getDevice": [{
32600
+ name: "deviceId",
32601
+ form: "single",
32602
+ optional: false
32603
+ }],
32604
+ "deviceManager.getDeviceAggregate": [{
32605
+ name: "deviceId",
32606
+ form: "single",
32607
+ optional: false
32608
+ }],
32609
+ "deviceManager.getDeviceLiveInfoAggregate": [{
32610
+ name: "deviceId",
32611
+ form: "single",
32612
+ optional: false
32613
+ }],
32614
+ "deviceManager.getDeviceSettingsAggregate": [{
32615
+ name: "deviceId",
32616
+ form: "single",
32617
+ optional: false
32618
+ }],
32619
+ "deviceManager.getDeviceStatusAggregate": [{
32620
+ name: "deviceId",
32621
+ form: "single",
32622
+ optional: false
32623
+ }],
32624
+ "deviceManager.getDeviceStatusAggregateBatch": [{
32625
+ name: "deviceIds",
32626
+ form: "array",
32627
+ optional: false
32628
+ }],
32629
+ "deviceManager.getLinkedDevices": [{
32630
+ name: "deviceId",
32631
+ form: "single",
32632
+ optional: false
32633
+ }],
32634
+ "deviceManager.getSettingsSchema": [{
32635
+ name: "deviceId",
32636
+ form: "single",
32637
+ optional: false
32638
+ }],
32639
+ "deviceManager.getStreamProfileMap": [{
32640
+ name: "deviceId",
32641
+ form: "single",
32642
+ optional: false
32643
+ }],
32644
+ "deviceManager.getStreamSources": [{
32645
+ name: "deviceId",
32646
+ form: "single",
32647
+ optional: false
32648
+ }],
32649
+ "deviceManager.getWireableFields": [{
32650
+ name: "deviceId",
32651
+ form: "single",
32652
+ optional: false
32653
+ }],
32654
+ "deviceManager.loadConfig": [{
32655
+ name: "deviceId",
32656
+ form: "single",
32657
+ optional: false
32658
+ }],
32659
+ "deviceManager.loadMeta": [{
32660
+ name: "deviceId",
32661
+ form: "single",
32662
+ optional: false
32663
+ }],
32664
+ "deviceManager.loadRuntimeState": [{
32665
+ name: "deviceId",
32666
+ form: "single",
32667
+ optional: false
32668
+ }],
32669
+ "deviceManager.persistConfig": [{
32670
+ name: "deviceId",
32671
+ form: "single",
32672
+ optional: false
32673
+ }],
32674
+ "deviceManager.probeStreams": [{
32675
+ name: "deviceId",
32676
+ form: "single",
32677
+ optional: false
32678
+ }],
32679
+ "deviceManager.registerDevice": [{
32680
+ name: "parentDeviceId",
32681
+ form: "single",
32682
+ optional: true
32683
+ }],
32684
+ "deviceManager.remove": [{
32685
+ name: "deviceId",
32686
+ form: "single",
32687
+ optional: false
32688
+ }],
32689
+ "deviceManager.removeDevice": [{
32690
+ name: "deviceId",
32691
+ form: "single",
32692
+ optional: false
32693
+ }],
32694
+ "deviceManager.runDeviceAction": [{
32695
+ name: "deviceId",
32696
+ form: "single",
32697
+ optional: false
32698
+ }],
32699
+ "deviceManager.setChildLayout": [{
32700
+ name: "deviceId",
32701
+ form: "single",
32702
+ optional: false
32703
+ }],
32704
+ "deviceManager.setDisabled": [{
32705
+ name: "deviceId",
32706
+ form: "single",
32707
+ optional: false
32708
+ }],
32709
+ "deviceManager.setDisplay": [{
32710
+ name: "deviceId",
32711
+ form: "single",
32712
+ optional: false
32713
+ }],
32714
+ "deviceManager.setIntegrationId": [{
32715
+ name: "deviceId",
32716
+ form: "single",
32717
+ optional: false
32718
+ }],
32719
+ "deviceManager.setLinkDeviceId": [{
32720
+ name: "deviceId",
32721
+ form: "single",
32722
+ optional: false
32723
+ }, {
32724
+ name: "linkDeviceId",
32725
+ form: "single",
32726
+ optional: true
32727
+ }],
32728
+ "deviceManager.setLocation": [{
32729
+ name: "deviceId",
32730
+ form: "single",
32731
+ optional: false
32732
+ }],
32733
+ "deviceManager.setMetadata": [{
32734
+ name: "deviceId",
32735
+ form: "single",
32736
+ optional: false
32737
+ }],
32738
+ "deviceManager.setName": [{
32739
+ name: "deviceId",
32740
+ form: "single",
32741
+ optional: false
32742
+ }],
32743
+ "deviceManager.setPrimaryChildEntityId": [{
32744
+ name: "deviceId",
32745
+ form: "single",
32746
+ optional: false
32747
+ }],
32748
+ "deviceManager.setRole": [{
32749
+ name: "deviceId",
32750
+ form: "single",
32751
+ optional: false
32752
+ }],
32753
+ "deviceManager.setStreamProfileMap": [{
32754
+ name: "deviceId",
32755
+ form: "single",
32756
+ optional: false
32757
+ }],
32758
+ "deviceManager.setType": [{
32759
+ name: "deviceId",
32760
+ form: "single",
32761
+ optional: false
32762
+ }],
32763
+ "deviceManager.setWrapperActive": [{
32764
+ name: "deviceId",
32765
+ form: "single",
32766
+ optional: false
32767
+ }],
32768
+ "deviceManager.testField": [{
32769
+ name: "deviceId",
32770
+ form: "single",
32771
+ optional: false
32772
+ }],
32773
+ "deviceManager.updateConfig": [{
32774
+ name: "deviceId",
32775
+ form: "single",
32776
+ optional: false
32777
+ }],
32778
+ "deviceManager.updateDeviceField": [{
32779
+ name: "deviceId",
32780
+ form: "single",
32781
+ optional: false
32782
+ }],
32783
+ "deviceManager.updateDeviceFieldsBatch": [{
32784
+ name: "deviceId",
32785
+ form: "single",
32786
+ optional: false
32787
+ }],
32788
+ "deviceOps.getConfigEntries": [{
32789
+ name: "deviceId",
32790
+ form: "single",
32791
+ optional: false
32792
+ }],
32793
+ "deviceOps.getRawState": [{
32794
+ name: "deviceId",
32795
+ form: "single",
32796
+ optional: false
32797
+ }],
32798
+ "deviceOps.getSettingsSchema": [{
32799
+ name: "deviceId",
32800
+ form: "single",
32801
+ optional: false
32802
+ }],
32803
+ "deviceOps.getStreamSources": [{
32804
+ name: "deviceId",
32805
+ form: "single",
32806
+ optional: false
32807
+ }],
32808
+ "deviceOps.removeDevice": [{
32809
+ name: "deviceId",
32810
+ form: "single",
32811
+ optional: false
32812
+ }],
32813
+ "deviceOps.runAction": [{
32814
+ name: "deviceId",
32815
+ form: "single",
32816
+ optional: false
32817
+ }],
32818
+ "deviceOps.setConfig": [{
32819
+ name: "deviceId",
32820
+ form: "single",
32821
+ optional: false
32822
+ }],
32823
+ "deviceState.getCapSlice": [{
32824
+ name: "deviceId",
32825
+ form: "single",
32826
+ optional: false
32827
+ }],
32828
+ "deviceState.getSnapshot": [{
32829
+ name: "deviceId",
32830
+ form: "single",
32831
+ optional: false
32832
+ }],
32833
+ "deviceState.setCapSlice": [{
32834
+ name: "deviceId",
32835
+ form: "single",
32836
+ optional: false
32837
+ }],
32838
+ "events.getEventClipUrl": [{
32839
+ name: "deviceId",
32840
+ form: "single",
32841
+ optional: false
32842
+ }],
32843
+ "events.getEvents": [{
32844
+ name: "deviceId",
32845
+ form: "single",
32846
+ optional: false
32847
+ }],
32848
+ "events.getEventThumbnail": [{
32849
+ name: "deviceId",
32850
+ form: "single",
32851
+ optional: false
32852
+ }],
32853
+ "faceGallery.getFaceByTrack": [{
32854
+ name: "deviceId",
32855
+ form: "single",
32856
+ optional: false
32857
+ }],
32858
+ "faceGallery.listRecentFaces": [{
32859
+ name: "deviceId",
32860
+ form: "single",
32861
+ optional: true
32862
+ }],
32863
+ "fanControl.setDirection": [{
32864
+ name: "deviceId",
32865
+ form: "single",
32866
+ optional: false
32867
+ }],
32868
+ "fanControl.setOscillating": [{
32869
+ name: "deviceId",
32870
+ form: "single",
32871
+ optional: false
32872
+ }],
32873
+ "fanControl.setPercentage": [{
32874
+ name: "deviceId",
32875
+ form: "single",
32876
+ optional: false
32877
+ }],
32878
+ "fanControl.setPreset": [{
32879
+ name: "deviceId",
32880
+ form: "single",
32881
+ optional: false
32882
+ }],
32883
+ "humidifier.setMode": [{
32884
+ name: "deviceId",
32885
+ form: "single",
32886
+ optional: false
32887
+ }],
32888
+ "humidifier.setOn": [{
32889
+ name: "deviceId",
32890
+ form: "single",
32891
+ optional: false
32892
+ }],
32893
+ "humidifier.setTargetHumidity": [{
32894
+ name: "deviceId",
32895
+ form: "single",
32896
+ optional: false
32897
+ }],
32898
+ "imageSettings.getOptions": [{
32899
+ name: "deviceId",
32900
+ form: "single",
32901
+ optional: false
32902
+ }],
32903
+ "imageSettings.setSettings": [{
32904
+ name: "deviceId",
32905
+ form: "single",
32906
+ optional: false
32907
+ }],
32908
+ "intercom.endTalkSession": [{
32909
+ name: "deviceId",
32910
+ form: "single",
32911
+ optional: false
32912
+ }],
32913
+ "intercom.handleAnswer": [{
32914
+ name: "deviceId",
32915
+ form: "single",
32916
+ optional: false
32917
+ }],
32918
+ "intercom.pushTalkAudio": [{
32919
+ name: "deviceId",
32920
+ form: "single",
32921
+ optional: false
32922
+ }],
32923
+ "intercom.startSession": [{
32924
+ name: "deviceId",
32925
+ form: "single",
32926
+ optional: false
32927
+ }],
32928
+ "intercom.startTalkSession": [{
32929
+ name: "deviceId",
32930
+ form: "single",
32931
+ optional: false
32932
+ }],
32933
+ "intercom.stopSession": [{
32934
+ name: "deviceId",
32935
+ form: "single",
32936
+ optional: false
32937
+ }],
32938
+ "lawnMowerControl.dock": [{
32939
+ name: "deviceId",
32940
+ form: "single",
32941
+ optional: false
32942
+ }],
32943
+ "lawnMowerControl.pause": [{
32944
+ name: "deviceId",
32945
+ form: "single",
32946
+ optional: false
32947
+ }],
32948
+ "lawnMowerControl.startMowing": [{
32949
+ name: "deviceId",
32950
+ form: "single",
32951
+ optional: false
32952
+ }],
32953
+ "lockControl.lock": [{
32954
+ name: "deviceId",
32955
+ form: "single",
32956
+ optional: false
32957
+ }],
32958
+ "lockControl.open": [{
32959
+ name: "deviceId",
32960
+ form: "single",
32961
+ optional: false
32962
+ }],
32963
+ "lockControl.unlock": [{
32964
+ name: "deviceId",
32965
+ form: "single",
32966
+ optional: false
32967
+ }],
32968
+ "mediaPlayer.next": [{
32969
+ name: "deviceId",
32970
+ form: "single",
32971
+ optional: false
32972
+ }],
32973
+ "mediaPlayer.pause": [{
32974
+ name: "deviceId",
32975
+ form: "single",
32976
+ optional: false
32977
+ }],
32978
+ "mediaPlayer.play": [{
32979
+ name: "deviceId",
32980
+ form: "single",
32981
+ optional: false
32982
+ }],
32983
+ "mediaPlayer.playMedia": [{
32984
+ name: "deviceId",
32985
+ form: "single",
32986
+ optional: false
32987
+ }],
32988
+ "mediaPlayer.previous": [{
32989
+ name: "deviceId",
32990
+ form: "single",
32991
+ optional: false
32992
+ }],
32993
+ "mediaPlayer.seek": [{
32994
+ name: "deviceId",
32995
+ form: "single",
32996
+ optional: false
32997
+ }],
32998
+ "mediaPlayer.selectSource": [{
32999
+ name: "deviceId",
33000
+ form: "single",
33001
+ optional: false
33002
+ }],
33003
+ "mediaPlayer.setMute": [{
33004
+ name: "deviceId",
33005
+ form: "single",
33006
+ optional: false
33007
+ }],
33008
+ "mediaPlayer.setRepeat": [{
33009
+ name: "deviceId",
33010
+ form: "single",
33011
+ optional: false
33012
+ }],
33013
+ "mediaPlayer.setShuffle": [{
33014
+ name: "deviceId",
33015
+ form: "single",
33016
+ optional: false
33017
+ }],
33018
+ "mediaPlayer.setVolume": [{
33019
+ name: "deviceId",
33020
+ form: "single",
33021
+ optional: false
33022
+ }],
33023
+ "mediaPlayer.stop": [{
33024
+ name: "deviceId",
33025
+ form: "single",
33026
+ optional: false
33027
+ }],
33028
+ "motion.isDetected": [{
33029
+ name: "deviceId",
33030
+ form: "single",
33031
+ optional: false
33032
+ }],
33033
+ "motionDetection.analyze": [{
33034
+ name: "deviceId",
33035
+ form: "single",
33036
+ optional: false
33037
+ }],
33038
+ "motionDetection.removeCamera": [{
33039
+ name: "deviceId",
33040
+ form: "single",
33041
+ optional: false
33042
+ }],
33043
+ "motionTrigger.setMotionTrigger": [{
33044
+ name: "deviceId",
33045
+ form: "single",
33046
+ optional: false
33047
+ }],
33048
+ "motionZones.getOptions": [{
33049
+ name: "deviceId",
33050
+ form: "single",
33051
+ optional: false
33052
+ }],
33053
+ "motionZones.setZone": [{
33054
+ name: "deviceId",
33055
+ form: "single",
33056
+ optional: false
33057
+ }],
33058
+ "nativeObjectDetection.setEnabled": [{
33059
+ name: "deviceId",
33060
+ form: "single",
33061
+ optional: false
33062
+ }],
33063
+ "networkQuality.getDeviceStats": [{
33064
+ name: "deviceId",
33065
+ form: "single",
33066
+ optional: false
33067
+ }],
33068
+ "networkQuality.reportClientStats": [{
33069
+ name: "deviceId",
33070
+ form: "single",
33071
+ optional: false
33072
+ }],
33073
+ "notificationRules.setDeviceMuted": [{
33074
+ name: "deviceId",
33075
+ form: "single",
33076
+ optional: false
33077
+ }],
33078
+ "notifier.cancel": [{
33079
+ name: "deviceId",
33080
+ form: "single",
33081
+ optional: false
33082
+ }],
33083
+ "notifier.send": [{
33084
+ name: "deviceId",
33085
+ form: "single",
33086
+ optional: false
33087
+ }],
33088
+ "osd.setOverlay": [{
33089
+ name: "deviceId",
33090
+ form: "single",
33091
+ optional: false
33092
+ }],
33093
+ "osdManager.clearSlotBinding": [{
33094
+ name: "deviceId",
33095
+ form: "single",
33096
+ optional: false
33097
+ }],
33098
+ "osdManager.copyDeviceConfiguration": [{
33099
+ name: "sourceDeviceId",
33100
+ form: "single",
33101
+ optional: false
33102
+ }, {
33103
+ name: "targetDeviceId",
33104
+ form: "single",
33105
+ optional: false
33106
+ }],
33107
+ "osdManager.getDeviceOsd": [{
33108
+ name: "deviceId",
33109
+ form: "single",
33110
+ optional: false
33111
+ }],
33112
+ "osdManager.getSourceCatalog": [{
33113
+ name: "deviceId",
33114
+ form: "single",
33115
+ optional: false
33116
+ }],
33117
+ "osdManager.previewSlot": [{
33118
+ name: "deviceId",
33119
+ form: "single",
33120
+ optional: false
33121
+ }],
33122
+ "osdManager.renderDevice": [{
33123
+ name: "deviceId",
33124
+ form: "single",
33125
+ optional: false
33126
+ }],
33127
+ "osdManager.setSlotBinding": [{
33128
+ name: "deviceId",
33129
+ form: "single",
33130
+ optional: false
33131
+ }],
33132
+ "petFeeder.callPet": [{
33133
+ name: "deviceId",
33134
+ form: "single",
33135
+ optional: false
33136
+ }],
33137
+ "petFeeder.cancelFeed": [{
33138
+ name: "deviceId",
33139
+ form: "single",
33140
+ optional: false
33141
+ }],
33142
+ "petFeeder.feed": [{
33143
+ name: "deviceId",
33144
+ form: "single",
33145
+ optional: false
33146
+ }],
33147
+ "petFeeder.markFoodReplenished": [{
33148
+ name: "deviceId",
33149
+ form: "single",
33150
+ optional: false
33151
+ }],
33152
+ "petFeeder.playSound": [{
33153
+ name: "deviceId",
33154
+ form: "single",
33155
+ optional: false
33156
+ }],
33157
+ "petFeeder.resetDesiccant": [{
33158
+ name: "deviceId",
33159
+ form: "single",
33160
+ optional: false
33161
+ }],
33162
+ "petFeeder.setChildLock": [{
33163
+ name: "deviceId",
33164
+ form: "single",
33165
+ optional: false
33166
+ }],
33167
+ "petFeeder.setFeedSound": [{
33168
+ name: "deviceId",
33169
+ form: "single",
33170
+ optional: false
33171
+ }],
33172
+ "petFeeder.setIndicatorLight": [{
33173
+ name: "deviceId",
33174
+ form: "single",
33175
+ optional: false
33176
+ }],
33177
+ "petFeeder.setVolume": [{
33178
+ name: "deviceId",
33179
+ form: "single",
33180
+ optional: false
33181
+ }],
33182
+ "pipelineAnalytics.clearTracks": [{
33183
+ name: "deviceId",
33184
+ form: "single",
33185
+ optional: false
33186
+ }],
33187
+ "pipelineAnalytics.completeRetrainTrack": [{
33188
+ name: "deviceId",
33189
+ form: "single",
33190
+ optional: false
33191
+ }],
33192
+ "pipelineAnalytics.deleteDeviceEvents": [{
33193
+ name: "deviceId",
33194
+ form: "single",
33195
+ optional: false
33196
+ }],
33197
+ "pipelineAnalytics.deleteTracks": [{
33198
+ name: "deviceId",
33199
+ form: "single",
33200
+ optional: false
33201
+ }],
33202
+ "pipelineAnalytics.deselectRetrainFrame": [{
33203
+ name: "deviceId",
33204
+ form: "single",
33205
+ optional: false
33206
+ }],
33207
+ "pipelineAnalytics.getActiveTracks": [{
33208
+ name: "deviceId",
33209
+ form: "single",
33210
+ optional: false
33211
+ }],
33212
+ "pipelineAnalytics.getAudioEvents": [{
33213
+ name: "deviceId",
33214
+ form: "single",
33215
+ optional: false
33216
+ }],
33217
+ "pipelineAnalytics.getEventDensity": [{
33218
+ name: "deviceId",
33219
+ form: "single",
33220
+ optional: false
33221
+ }],
33222
+ "pipelineAnalytics.getEventMedia": [{
33223
+ name: "deviceId",
33224
+ form: "single",
33225
+ optional: false
33226
+ }],
33227
+ "pipelineAnalytics.getKeyEvents": [{
33228
+ name: "deviceId",
33229
+ form: "single",
33230
+ optional: false
33231
+ }],
33232
+ "pipelineAnalytics.getMotionEvents": [{
33233
+ name: "deviceId",
33234
+ form: "single",
33235
+ optional: false
33236
+ }],
33237
+ "pipelineAnalytics.getObjectEvents": [{
33238
+ name: "deviceId",
33239
+ form: "single",
33240
+ optional: false
33241
+ }],
33242
+ "pipelineAnalytics.getRetrainExportUrl": [{
33243
+ name: "deviceIds",
33244
+ form: "array",
33245
+ optional: true
33246
+ }],
33247
+ "pipelineAnalytics.getSensorEvents": [{
33248
+ name: "deviceId",
33249
+ form: "single",
33250
+ optional: false
33251
+ }],
33252
+ "pipelineAnalytics.getTrack": [{
33253
+ name: "deviceId",
33254
+ form: "single",
33255
+ optional: false
33256
+ }],
33257
+ "pipelineAnalytics.getTrackMedia": [{
33258
+ name: "deviceId",
33259
+ form: "single",
33260
+ optional: false
33261
+ }],
33262
+ "pipelineAnalytics.getTrainingExportSummary": [{
33263
+ name: "deviceIds",
33264
+ form: "array",
33265
+ optional: true
33266
+ }],
33267
+ "pipelineAnalytics.getTrainingExportUrl": [{
33268
+ name: "deviceIds",
33269
+ form: "array",
33270
+ optional: true
33271
+ }],
33272
+ "pipelineAnalytics.listEventKinds": [{
33273
+ name: "deviceId",
33274
+ form: "single",
33275
+ optional: false
33276
+ }],
33277
+ "pipelineAnalytics.listEventKindsBatch": [{
33278
+ name: "deviceIds",
33279
+ form: "array",
33280
+ optional: false
33281
+ }],
33282
+ "pipelineAnalytics.listOpsLog": [{
33283
+ name: "deviceId",
33284
+ form: "single",
33285
+ optional: true
33286
+ }],
33287
+ "pipelineAnalytics.listRecentTracks": [{
33288
+ name: "deviceIds",
33289
+ form: "array",
33290
+ optional: false
33291
+ }],
33292
+ "pipelineAnalytics.listRetrainStaging": [{
33293
+ name: "deviceIds",
33294
+ form: "array",
33295
+ optional: true
33296
+ }],
33297
+ "pipelineAnalytics.listTrackMedia": [{
33298
+ name: "deviceId",
33299
+ form: "single",
33300
+ optional: false
33301
+ }],
33302
+ "pipelineAnalytics.listTracks": [{
33303
+ name: "deviceId",
33304
+ form: "single",
33305
+ optional: false
33306
+ }],
33307
+ "pipelineAnalytics.proposeRetrainAnnotations": [{
33308
+ name: "deviceId",
33309
+ form: "single",
33310
+ optional: false
33311
+ }],
33312
+ "pipelineAnalytics.pruneEventsBefore": [{
33313
+ name: "deviceId",
33314
+ form: "single",
33315
+ optional: false
33316
+ }],
33317
+ "pipelineAnalytics.pruneTracksBefore": [{
33318
+ name: "deviceId",
33319
+ form: "single",
33320
+ optional: false
33321
+ }],
33322
+ "pipelineAnalytics.rebuildObjectEmbeddings": [{
33323
+ name: "deviceId",
33324
+ form: "single",
33325
+ optional: true
33326
+ }],
33327
+ "pipelineAnalytics.restageRetrainTrack": [{
33328
+ name: "deviceId",
33329
+ form: "single",
33330
+ optional: false
33331
+ }],
33332
+ "pipelineAnalytics.saveRetrainAnnotations": [{
33333
+ name: "deviceId",
33334
+ form: "single",
33335
+ optional: false
33336
+ }],
33337
+ "pipelineAnalytics.searchObjectEvents": [{
33338
+ name: "deviceId",
33339
+ form: "single",
33340
+ optional: true
33341
+ }],
33342
+ "pipelineAnalytics.selectRetrainFrames": [{
33343
+ name: "deviceId",
33344
+ form: "single",
33345
+ optional: false
33346
+ }],
33347
+ "pipelineAnalytics.setTrackFlags": [{
33348
+ name: "deviceId",
33349
+ form: "single",
33350
+ optional: false
33351
+ }],
33352
+ "pipelineAnalytics.wipeAllAnalytics": [{
33353
+ name: "deviceId",
33354
+ form: "single",
33355
+ optional: false
33356
+ }],
33357
+ "pipelineExecutor.runPipeline": [{
33358
+ name: "deviceId",
33359
+ form: "single",
33360
+ optional: true
33361
+ }],
33362
+ "pipelineExecutor.runPipelineBatch": [{
33363
+ name: "deviceId",
33364
+ form: "single",
33365
+ optional: true
33366
+ }],
33367
+ "pipelineOrchestrator.assignAudio": [{
33368
+ name: "deviceId",
33369
+ form: "single",
33370
+ optional: false
33371
+ }],
33372
+ "pipelineOrchestrator.assignPipeline": [{
33373
+ name: "deviceId",
33374
+ form: "single",
33375
+ optional: false
33376
+ }],
33377
+ "pipelineOrchestrator.getAudioAssignment": [{
33378
+ name: "deviceId",
33379
+ form: "single",
33380
+ optional: false
33381
+ }],
33382
+ "pipelineOrchestrator.getCameraMetrics": [{
33383
+ name: "deviceId",
33384
+ form: "single",
33385
+ optional: false
33386
+ }],
33387
+ "pipelineOrchestrator.getCameraSettings": [{
33388
+ name: "deviceId",
33389
+ form: "single",
33390
+ optional: false
33391
+ }],
33392
+ "pipelineOrchestrator.getCameraStatus": [{
33393
+ name: "deviceId",
33394
+ form: "single",
33395
+ optional: false
33396
+ }],
33397
+ "pipelineOrchestrator.getCameraStatuses": [{
33398
+ name: "deviceIds",
33399
+ form: "array",
33400
+ optional: true
33401
+ }],
33402
+ "pipelineOrchestrator.getCameraStepOverrides": [{
33403
+ name: "deviceId",
33404
+ form: "single",
33405
+ optional: false
33406
+ }],
33407
+ "pipelineOrchestrator.getCameraSwitches": [{
33408
+ name: "deviceId",
33409
+ form: "single",
33410
+ optional: false
33411
+ }],
33412
+ "pipelineOrchestrator.getPipelineAssignment": [{
33413
+ name: "deviceId",
33414
+ form: "single",
33415
+ optional: false
33416
+ }],
33417
+ "pipelineOrchestrator.getPipelineDevicePin": [{
33418
+ name: "deviceId",
33419
+ form: "single",
33420
+ optional: false
33421
+ }],
33422
+ "pipelineOrchestrator.resolvePipeline": [{
33423
+ name: "deviceId",
33424
+ form: "single",
33425
+ optional: false
33426
+ }],
33427
+ "pipelineOrchestrator.setCameraPipelineForAgent": [{
33428
+ name: "deviceId",
33429
+ form: "single",
33430
+ optional: false
33431
+ }],
33432
+ "pipelineOrchestrator.setCameraStepOverride": [{
33433
+ name: "deviceId",
33434
+ form: "single",
33435
+ optional: false
33436
+ }],
33437
+ "pipelineOrchestrator.setCameraStepToggle": [{
33438
+ name: "deviceId",
33439
+ form: "single",
33440
+ optional: false
33441
+ }],
33442
+ "pipelineOrchestrator.setCameraSwitch": [{
33443
+ name: "deviceId",
33444
+ form: "single",
33445
+ optional: false
33446
+ }],
33447
+ "pipelineOrchestrator.setPipelineDevicePin": [{
33448
+ name: "deviceId",
33449
+ form: "single",
33450
+ optional: false
33451
+ }],
33452
+ "pipelineOrchestrator.unassignAudio": [{
33453
+ name: "deviceId",
33454
+ form: "single",
33455
+ optional: false
33456
+ }],
33457
+ "pipelineOrchestrator.unassignPipeline": [{
33458
+ name: "deviceId",
33459
+ form: "single",
33460
+ optional: false
33461
+ }],
33462
+ "pipelineRunner.attachCamera": [{
33463
+ name: "deviceId",
33464
+ form: "single",
33465
+ optional: false
33466
+ }],
33467
+ "pipelineRunner.detachCamera": [{
33468
+ name: "deviceId",
33469
+ form: "single",
33470
+ optional: false
33471
+ }],
33472
+ "pipelineRunner.getCameraMetrics": [{
33473
+ name: "deviceId",
33474
+ form: "single",
33475
+ optional: false
33476
+ }],
33477
+ "pipelineRunner.reportMotion": [{
33478
+ name: "deviceId",
33479
+ form: "single",
33480
+ optional: false
33481
+ }],
33482
+ "pipelineRunner.runDetailSubtree": [{
33483
+ name: "deviceId",
33484
+ form: "single",
33485
+ optional: false
33486
+ }],
33487
+ "pipelineRunner.runStatelessStep": [{
33488
+ name: "sourceDeviceId",
33489
+ form: "single",
33490
+ optional: false
33491
+ }],
33492
+ "plateGallery.getPlateByTrack": [{
33493
+ name: "deviceId",
33494
+ form: "single",
33495
+ optional: false
33496
+ }],
33497
+ "plateGallery.listPlates": [{
33498
+ name: "deviceId",
33499
+ form: "single",
33500
+ optional: true
33501
+ }],
33502
+ "privacyMask.getOptions": [{
33503
+ name: "deviceId",
33504
+ form: "single",
33505
+ optional: false
33506
+ }],
33507
+ "privacyMask.setAudioEnabled": [{
33508
+ name: "deviceId",
33509
+ form: "single",
33510
+ optional: false
33511
+ }],
33512
+ "privacyMask.setMask": [{
33513
+ name: "deviceId",
33514
+ form: "single",
33515
+ optional: false
33516
+ }],
33517
+ "ptz.continuousMove": [{
33518
+ name: "deviceId",
33519
+ form: "single",
33520
+ optional: false
33521
+ }],
33522
+ "ptz.deletePreset": [{
33523
+ name: "deviceId",
33524
+ form: "single",
33525
+ optional: false
33526
+ }],
33527
+ "ptz.getOptions": [{
33528
+ name: "deviceId",
33529
+ form: "single",
33530
+ optional: false
33531
+ }],
33532
+ "ptz.getPosition": [{
33533
+ name: "deviceId",
33534
+ form: "single",
33535
+ optional: false
33536
+ }],
33537
+ "ptz.getPresets": [{
33538
+ name: "deviceId",
33539
+ form: "single",
33540
+ optional: false
33541
+ }],
33542
+ "ptz.goHome": [{
33543
+ name: "deviceId",
33544
+ form: "single",
33545
+ optional: false
33546
+ }],
33547
+ "ptz.goToPreset": [{
33548
+ name: "deviceId",
33549
+ form: "single",
33550
+ optional: false
33551
+ }],
33552
+ "ptz.move": [{
33553
+ name: "deviceId",
33554
+ form: "single",
33555
+ optional: false
33556
+ }],
33557
+ "ptz.savePreset": [{
33558
+ name: "deviceId",
33559
+ form: "single",
33560
+ optional: false
33561
+ }],
33562
+ "ptz.setAutofocus": [{
33563
+ name: "deviceId",
33564
+ form: "single",
33565
+ optional: false
33566
+ }],
33567
+ "ptz.stop": [{
33568
+ name: "deviceId",
33569
+ form: "single",
33570
+ optional: false
33571
+ }],
33572
+ "ptzAutotrack.getSettings": [{
33573
+ name: "deviceId",
33574
+ form: "single",
33575
+ optional: false
33576
+ }],
33577
+ "ptzAutotrack.getStatus": [{
33578
+ name: "deviceId",
33579
+ form: "single",
33580
+ optional: false
33581
+ }],
33582
+ "ptzAutotrack.setEnabled": [{
33583
+ name: "deviceId",
33584
+ form: "single",
33585
+ optional: false
33586
+ }],
33587
+ "ptzAutotrack.setSettings": [{
33588
+ name: "deviceId",
33589
+ form: "single",
33590
+ optional: false
33591
+ }],
33592
+ "reboot.reboot": [{
33593
+ name: "deviceId",
33594
+ form: "single",
33595
+ optional: false
33596
+ }],
33597
+ "recording.deleteFootprint": [{
33598
+ name: "deviceId",
33599
+ form: "single",
33600
+ optional: false
33601
+ }],
33602
+ "recording.getAvailability": [{
33603
+ name: "deviceId",
33604
+ form: "single",
33605
+ optional: false
33606
+ }],
33607
+ "recording.getDaysWithRecordings": [{
33608
+ name: "deviceId",
33609
+ form: "single",
33610
+ optional: false
33611
+ }],
33612
+ "recording.getDeviceConfig": [{
33613
+ name: "deviceId",
33614
+ form: "single",
33615
+ optional: false
33616
+ }],
33617
+ "recording.getPlaybackManifest": [{
33618
+ name: "deviceId",
33619
+ form: "single",
33620
+ optional: false
33621
+ }],
33622
+ "recording.listOpsLog": [{
33623
+ name: "deviceId",
33624
+ form: "single",
33625
+ optional: true
33626
+ }],
33627
+ "recording.locateSegment": [{
33628
+ name: "deviceId",
33629
+ form: "single",
33630
+ optional: false
33631
+ }],
33632
+ "recording.pruneFootage": [{
33633
+ name: "deviceId",
33634
+ form: "single",
33635
+ optional: false
33636
+ }],
33637
+ "recording.readGopBytes": [{
33638
+ name: "deviceId",
33639
+ form: "single",
33640
+ optional: false
33641
+ }],
33642
+ "recording.readSegmentBytes": [{
33643
+ name: "deviceId",
33644
+ form: "single",
33645
+ optional: false
33646
+ }],
33647
+ "recording.relocateFootage": [{
33648
+ name: "deviceId",
33649
+ form: "single",
33650
+ optional: true
33651
+ }],
33652
+ "recording.renderClip": [{
33653
+ name: "deviceId",
33654
+ form: "single",
33655
+ optional: false
33656
+ }],
33657
+ "recording.renderGif": [{
33658
+ name: "deviceId",
33659
+ form: "single",
33660
+ optional: false
33661
+ }],
33662
+ "recording.rescanStorage": [{
33663
+ name: "deviceId",
33664
+ form: "single",
33665
+ optional: false
33666
+ }],
33667
+ "recording.setDeviceConfig": [{
33668
+ name: "deviceId",
33669
+ form: "single",
33670
+ optional: false
33671
+ }],
33672
+ "recording.startStorageMigrationMove": [{
33673
+ name: "deviceId",
33674
+ form: "single",
33675
+ optional: true
33676
+ }],
33677
+ "recordingExport.createExport": [{
33678
+ name: "deviceId",
33679
+ form: "single",
33680
+ optional: false
33681
+ }],
33682
+ "recordingExport.listExports": [{
33683
+ name: "deviceId",
33684
+ form: "single",
33685
+ optional: true
33686
+ }],
33687
+ "sceneMonitor.captureReference": [{
33688
+ name: "deviceId",
33689
+ form: "single",
33690
+ optional: false
33691
+ }],
33692
+ "sceneMonitor.createScene": [{
33693
+ name: "deviceId",
33694
+ form: "single",
33695
+ optional: false
33696
+ }],
33697
+ "sceneMonitor.deleteReference": [{
33698
+ name: "deviceId",
33699
+ form: "single",
33700
+ optional: false
33701
+ }],
33702
+ "sceneMonitor.deleteScene": [{
33703
+ name: "deviceId",
33704
+ form: "single",
33705
+ optional: false
33706
+ }],
33707
+ "sceneMonitor.listScenes": [{
33708
+ name: "deviceId",
33709
+ form: "single",
33710
+ optional: false
33711
+ }],
33712
+ "sceneMonitor.recheckNow": [{
33713
+ name: "deviceId",
33714
+ form: "single",
33715
+ optional: false
33716
+ }],
33717
+ "sceneMonitor.resetScene": [{
33718
+ name: "deviceId",
33719
+ form: "single",
33720
+ optional: false
33721
+ }],
33722
+ "sceneMonitor.updateScene": [{
33723
+ name: "deviceId",
33724
+ form: "single",
33725
+ optional: false
33726
+ }],
33727
+ "scriptRunner.run": [{
33728
+ name: "deviceId",
33729
+ form: "single",
33730
+ optional: false
33731
+ }],
33732
+ "scriptRunner.stop": [{
33733
+ name: "deviceId",
33734
+ form: "single",
33735
+ optional: false
33736
+ }],
33737
+ "snapshot.getSnapshot": [{
33738
+ name: "deviceId",
33739
+ form: "single",
33740
+ optional: false
33741
+ }],
33742
+ "snapshot.getSnapshotLinks": [{
33743
+ name: "targets",
33744
+ form: "object-array",
33745
+ optional: false,
33746
+ itemField: "deviceId"
33747
+ }],
33748
+ "snapshot.getSnapshotOverview": [{
33749
+ name: "deviceIds",
33750
+ form: "array",
33751
+ optional: false
33752
+ }],
33753
+ "snapshot.invalidateCache": [{
33754
+ name: "deviceId",
33755
+ form: "single",
33756
+ optional: false
33757
+ }],
33758
+ "streamBroker.acquireEgressTranscode": [{
33759
+ name: "deviceId",
33760
+ form: "single",
33761
+ optional: false
33762
+ }],
33763
+ "streamBroker.assignProfile": [{
33764
+ name: "deviceId",
33765
+ form: "single",
33766
+ optional: false
33767
+ }],
33768
+ "streamBroker.getDeviceAudioMute": [{
33769
+ name: "deviceId",
33770
+ form: "single",
33771
+ optional: false
33772
+ }],
33773
+ "streamBroker.getStreamWithCodec": [{
33774
+ name: "deviceId",
33775
+ form: "single",
33776
+ optional: false
33777
+ }],
33778
+ "streamBroker.produceEventMedia": [{
33779
+ name: "deviceId",
33780
+ form: "single",
33781
+ optional: false
33782
+ }],
33783
+ "streamBroker.publishCameraStream": [{
33784
+ name: "deviceId",
33785
+ form: "single",
33786
+ optional: false
33787
+ }],
33788
+ "streamBroker.renderPreBufferClip": [{
33789
+ name: "deviceId",
33790
+ form: "single",
33791
+ optional: false
33792
+ }],
33793
+ "streamBroker.restartProfile": [{
33794
+ name: "deviceId",
33795
+ form: "single",
33796
+ optional: false
33797
+ }],
33798
+ "streamBroker.retractCameraStream": [{
33799
+ name: "deviceId",
33800
+ form: "single",
33801
+ optional: false
33802
+ }],
33803
+ "streamBroker.setDeviceAudioMute": [{
33804
+ name: "deviceId",
33805
+ form: "single",
33806
+ optional: false
33807
+ }],
33808
+ "streamBroker.unassignProfile": [{
33809
+ name: "deviceId",
33810
+ form: "single",
33811
+ optional: false
33812
+ }],
33813
+ "streamCatalog.getCatalog": [{
33814
+ name: "deviceId",
33815
+ form: "single",
33816
+ optional: false
33817
+ }],
33818
+ "streamParams.getConfigSchema": [{
33819
+ name: "deviceId",
33820
+ form: "single",
33821
+ optional: false
33822
+ }],
33823
+ "streamParams.getOptions": [{
33824
+ name: "deviceId",
33825
+ form: "single",
33826
+ optional: false
33827
+ }],
33828
+ "streamParams.setProfile": [{
33829
+ name: "deviceId",
33830
+ form: "single",
33831
+ optional: false
33832
+ }],
33833
+ "switch.setState": [{
33834
+ name: "deviceId",
33835
+ form: "single",
33836
+ optional: false
33837
+ }],
33838
+ "vacuumControl.locate": [{
33839
+ name: "deviceId",
33840
+ form: "single",
33841
+ optional: false
33842
+ }],
33843
+ "vacuumControl.pause": [{
33844
+ name: "deviceId",
33845
+ form: "single",
33846
+ optional: false
33847
+ }],
33848
+ "vacuumControl.returnToBase": [{
33849
+ name: "deviceId",
33850
+ form: "single",
33851
+ optional: false
33852
+ }],
33853
+ "vacuumControl.setFanSpeed": [{
33854
+ name: "deviceId",
33855
+ form: "single",
33856
+ optional: false
33857
+ }],
33858
+ "vacuumControl.start": [{
33859
+ name: "deviceId",
33860
+ form: "single",
33861
+ optional: false
33862
+ }],
33863
+ "vacuumControl.stop": [{
33864
+ name: "deviceId",
33865
+ form: "single",
33866
+ optional: false
33867
+ }],
33868
+ "valve.close": [{
33869
+ name: "deviceId",
33870
+ form: "single",
33871
+ optional: false
33872
+ }],
33873
+ "valve.open": [{
33874
+ name: "deviceId",
33875
+ form: "single",
33876
+ optional: false
33877
+ }],
33878
+ "valve.setPosition": [{
33879
+ name: "deviceId",
33880
+ form: "single",
33881
+ optional: false
33882
+ }],
33883
+ "valve.stop": [{
33884
+ name: "deviceId",
33885
+ form: "single",
33886
+ optional: false
33887
+ }],
33888
+ "videoclips.getClipPlayback": [{
33889
+ name: "deviceId",
33890
+ form: "single",
33891
+ optional: false
33892
+ }],
33893
+ "videoclips.listClips": [{
33894
+ name: "deviceId",
33895
+ form: "single",
33896
+ optional: false
33897
+ }],
33898
+ "waterHeater.setAway": [{
33899
+ name: "deviceId",
33900
+ form: "single",
33901
+ optional: false
33902
+ }],
33903
+ "waterHeater.setOperationMode": [{
33904
+ name: "deviceId",
33905
+ form: "single",
33906
+ optional: false
33907
+ }],
33908
+ "waterHeater.setTargetTemp": [{
33909
+ name: "deviceId",
33910
+ form: "single",
33911
+ optional: false
33912
+ }],
33913
+ "webrtcSession.addIceCandidate": [{
33914
+ name: "deviceId",
33915
+ form: "single",
33916
+ optional: false
33917
+ }],
33918
+ "webrtcSession.closeSession": [{
33919
+ name: "deviceId",
33920
+ form: "single",
33921
+ optional: false
33922
+ }],
33923
+ "webrtcSession.createSession": [{
33924
+ name: "deviceId",
33925
+ form: "single",
33926
+ optional: false
33927
+ }],
33928
+ "webrtcSession.getIceCandidates": [{
33929
+ name: "deviceId",
33930
+ form: "single",
33931
+ optional: false
33932
+ }],
33933
+ "webrtcSession.getSessionState": [{
33934
+ name: "deviceId",
33935
+ form: "single",
33936
+ optional: false
33937
+ }],
33938
+ "webrtcSession.handleAnswer": [{
33939
+ name: "deviceId",
33940
+ form: "single",
33941
+ optional: false
33942
+ }],
33943
+ "webrtcSession.handleOffer": [{
33944
+ name: "deviceId",
33945
+ form: "single",
33946
+ optional: false
33947
+ }],
33948
+ "webrtcSession.hasAdaptiveBitrate": [{
33949
+ name: "deviceId",
33950
+ form: "single",
33951
+ optional: false
33952
+ }],
33953
+ "webrtcSession.listStreams": [{
33954
+ name: "deviceId",
33955
+ form: "single",
33956
+ optional: false
33957
+ }],
33958
+ "zoneAnalytics.getCameraHistory": [{
33959
+ name: "deviceId",
33960
+ form: "single",
33961
+ optional: false
33962
+ }],
33963
+ "zoneAnalytics.getCurrentSnapshot": [{
33964
+ name: "deviceId",
33965
+ form: "single",
33966
+ optional: false
33967
+ }],
33968
+ "zoneAnalytics.getUnzonedHistory": [{
33969
+ name: "deviceId",
33970
+ form: "single",
33971
+ optional: false
33972
+ }],
33973
+ "zoneAnalytics.getZoneHistory": [{
33974
+ name: "deviceId",
33975
+ form: "single",
33976
+ optional: false
33977
+ }],
33978
+ "zoneRules.listRules": [{
33979
+ name: "deviceId",
33980
+ form: "single",
33981
+ optional: false
33982
+ }],
33983
+ "zoneRules.setRules": [{
33984
+ name: "deviceId",
33985
+ form: "single",
33986
+ optional: false
33987
+ }],
33988
+ "zones.addZone": [{
33989
+ name: "deviceId",
33990
+ form: "single",
33991
+ optional: false
33992
+ }],
33993
+ "zones.listZones": [{
33994
+ name: "deviceId",
33995
+ form: "single",
33996
+ optional: false
33997
+ }],
33998
+ "zones.removeZone": [{
33999
+ name: "deviceId",
34000
+ form: "single",
34001
+ optional: false
34002
+ }],
34003
+ "zones.updateZone": [{
34004
+ name: "deviceId",
34005
+ form: "single",
34006
+ optional: false
34007
+ }]
34008
+ });
31366
34009
  Object.freeze({
31367
34010
  "broker": "broker",
31368
34011
  "device-export": "device-export",
@@ -32082,7 +34725,7 @@ var Fmp4FragmentChild = class {
32082
34725
  meta: {
32083
34726
  sourceId: this.args.sourceId,
32084
34727
  decodeHwAccel: requested,
32085
- error: errMsg$12(err)
34728
+ error: errMsg$15(err)
32086
34729
  }
32087
34730
  });
32088
34731
  this.killChild();
@@ -32261,7 +34904,7 @@ var Fmp4FragmentChild = class {
32261
34904
  tags: { deviceId: this.args.deviceId },
32262
34905
  meta: {
32263
34906
  sourceId: this.args.sourceId,
32264
- error: errMsg$12(err)
34907
+ error: errMsg$15(err)
32265
34908
  }
32266
34909
  });
32267
34910
  }
@@ -78606,7 +81249,7 @@ function clearPairingFiles(accessoryUuid, logger) {
78606
81249
  }
78607
81250
  //#endregion
78608
81251
  //#region src/hap-setup-uri.ts
78609
- function errMsg$11(e) {
81252
+ function errMsg$14(e) {
78610
81253
  return e instanceof Error ? e.message : String(e);
78611
81254
  }
78612
81255
  /**
@@ -78633,11 +81276,79 @@ function firstExposedAccessorySetupUri(exposed, logger) {
78633
81276
  try {
78634
81277
  return first.setupURI();
78635
81278
  } catch (err) {
78636
- logger.debug("export-hap: setupURI failed on first exposed accessory", { meta: { error: errMsg$11(err) } });
81279
+ logger.debug("export-hap: setupURI failed on first exposed accessory", { meta: { error: errMsg$14(err) } });
78637
81280
  return;
78638
81281
  }
78639
81282
  }
78640
81283
  }
81284
+ //#endregion
81285
+ //#region src/mappers/builders/accessory-info.ts
81286
+ /**
81287
+ * `Service.AccessoryInformation` — the manufacturer / model / firmware /
81288
+ * serial block every HomeKit accessory carries.
81289
+ *
81290
+ * One implementation for both accessory shapes (camera and generic): the
81291
+ * fields come from the device's own metadata either way, and a second copy
81292
+ * would be a second answer to "what serial does this device publish".
81293
+ * Metadata is best-effort — a device that cannot answer still publishes.
81294
+ */
81295
+ async function populateAccessoryInfo(accessory, proxy, displayName, modelFallback) {
81296
+ const info = accessory.getService(import_dist.Service.AccessoryInformation);
81297
+ if (!info) return;
81298
+ try {
81299
+ const device = await proxy.deviceManager?.getDevice({});
81300
+ const metadata = readMetadata(device);
81301
+ info.setCharacteristic(import_dist.Characteristic.Name, device?.name ?? displayName);
81302
+ info.setCharacteristic(import_dist.Characteristic.Manufacturer, stringOr(metadata?.manufacturer, "CamStack"));
81303
+ info.setCharacteristic(import_dist.Characteristic.Model, stringOr(metadata?.model, modelFallback));
81304
+ info.setCharacteristic(import_dist.Characteristic.FirmwareRevision, stringOr(metadata?.firmware, "0.0.0"));
81305
+ info.setCharacteristic(import_dist.Characteristic.SerialNumber, stringOr(metadata?.sn, `camstack-${proxy.deviceId}`));
81306
+ } catch {}
81307
+ }
81308
+ /** The four fields this module reads, or `null` — the device record's
81309
+ * `metadata` is an open bag and nothing else here depends on its shape. */
81310
+ function readMetadata(device) {
81311
+ const metadata = device?.metadata;
81312
+ if (metadata === null || typeof metadata !== "object") return {};
81313
+ const entries = new Map(Object.entries(metadata));
81314
+ return {
81315
+ model: stringOrNull(entries.get("model")),
81316
+ manufacturer: stringOrNull(entries.get("manufacturer")),
81317
+ firmware: stringOrNull(entries.get("firmware")),
81318
+ sn: stringOrNull(entries.get("sn"))
81319
+ };
81320
+ }
81321
+ function stringOrNull(value) {
81322
+ return typeof value === "string" ? value : null;
81323
+ }
81324
+ function stringOr(value, fallback) {
81325
+ return typeof value === "string" && value.length > 0 ? value : fallback;
81326
+ }
81327
+ //#endregion
81328
+ //#region src/mappers/builders/generic/characteristic-update.ts
81329
+ /**
81330
+ * Parse `status` with the capability's OWN Zod schema and turn it into
81331
+ * characteristic writes.
81332
+ *
81333
+ * Duck-typing the payload here would be the second source of truth about what a
81334
+ * cap reports; the schema is the first and only one. A payload that does not
81335
+ * match yields NO updates — never a partial or invented value — and the caller
81336
+ * logs the drop, because a sensor that silently stops moving is
81337
+ * indistinguishable from a sensor that never changed.
81338
+ *
81339
+ * Rows `.pick()` only the fields they read, so a provider omitting a timestamp
81340
+ * cannot silence a sensor.
81341
+ */
81342
+ function reader(schema, toUpdates) {
81343
+ return (status) => {
81344
+ const parsed = schema.safeParse(status);
81345
+ return parsed.success ? toUpdates(parsed.data) : [];
81346
+ };
81347
+ }
81348
+ /** Push every update onto `service`. */
81349
+ function applyUpdates(service, updates) {
81350
+ for (const update of updates) service.updateCharacteristic(update.characteristic, update.value);
81351
+ }
78641
81352
  /**
78642
81353
  * hap-nodejs' `checkName` regex, verbatim.
78643
81354
  *
@@ -78774,6 +81485,92 @@ function titleCase(raw) {
78774
81485
  return raw.split(/[-_\s]+/u).filter((part) => part.length > 0).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
78775
81486
  }
78776
81487
  //#endregion
81488
+ //#region src/mappers/builders/service-label.ts
81489
+ /**
81490
+ * The ONE place a secondary service on the camera accessory gets its label.
81491
+ *
81492
+ * A "secondary service" here is a Switch or Lightbulb published alongside the
81493
+ * camera on the same accessory — the privacy switch, each accessory child
81494
+ * (siren, floodlight), each PTZ action. iOS Home renders these as their own
81495
+ * controls, and the operator has seen them as "Interruttore 1", "Interruttore
81496
+ * 2" through three separate rounds of fixes.
81497
+ *
81498
+ * ## Why `Name` alone cannot rename anything
81499
+ *
81500
+ * Two facts about hap-nodejs 2.1.7, both measured against the installed copy
81501
+ * rather than reasoned about:
81502
+ *
81503
+ * 1. `accessory.addService(Type, displayName, subtype)` ALREADY writes
81504
+ * `displayName` to `Characteristic.Name` (`Service` constructor). So every
81505
+ * round of this bug — including the one that moved the label onto
81506
+ * `ConfiguredName` — shipped with `Name` correctly set. "iOS had no name
81507
+ * to render" was never true.
81508
+ * 2. The mDNS configuration number (`c#`) is a sha1 over
81509
+ * `internalHAPRepresentation(false)`, which OMITS characteristic VALUES.
81510
+ * Changing the string in `Name` therefore does not bump `c#`, a paired
81511
+ * controller gets no signal to re-read `/accessories`, and the name it
81512
+ * cached at first enumeration stands forever.
81513
+ *
81514
+ * `Name` is also declared `pr` only — paired read, no write, no notify. It is
81515
+ * the seed a controller seeds its database from once; it is not a channel.
81516
+ *
81517
+ * ## Why `ConfiguredName`
81518
+ *
81519
+ * `ConfiguredName` (`000000E3`) is declared `pr | pw | ev` — the only name
81520
+ * characteristic a controller may write and may subscribe to. It is what iOS
81521
+ * 16+ reads for a service the user can rename, and adding it CHANGES the
81522
+ * accessory structure, so `c#` does bump and the controller re-reads.
81523
+ *
81524
+ * It was removed once because hap-nodejs logged
81525
+ *
81526
+ * ```
81527
+ * Characteristic not in required or optional characteristic section for
81528
+ * service Switch. Adding anyway.
81529
+ * ```
81530
+ *
81531
+ * That line is a WARNING, not a rejection: `Service.getCharacteristic` calls
81532
+ * `addCharacteristic` unconditionally and only then emits the warning. The
81533
+ * characteristic was always present and always published. hap-nodejs'
81534
+ * per-service optional lists simply predate `ConfiguredName` being valid on
81535
+ * any service.
81536
+ *
81537
+ * Registering it with {@link Service.addOptionalCharacteristic} first takes
81538
+ * the branch above the warning, so the accessory still builds with ZERO
81539
+ * characteristic warnings — which is what `service-naming.spec.ts` asserts.
81540
+ *
81541
+ * ## Scope: EVERY service, including the sensors
81542
+ *
81543
+ * An earlier round applied this to Switch- and Lightbulb-shaped services only,
81544
+ * on the theory that `Service.MotionSensor` and `Service.Battery` are not
81545
+ * separately named tiles in iOS Home and that naming them would be a guess.
81546
+ *
81547
+ * That theory was never measured, and it had a cost: it left services on the
81548
+ * accessory whose name a paired controller could never be told about, and it
81549
+ * made "did `ConfiguredName` fix the operator's 'Interruttore N'?" unanswerable
81550
+ * — a negative result on a partial application proves nothing about the
81551
+ * mechanism. Every service this addon publishes now carries both
81552
+ * characteristics, on the camera accessory and on the generic one.
81553
+ *
81554
+ * The reasoning above is mechanism, not measurement: it says why `Name` alone
81555
+ * CANNOT work and why `ConfiguredName` is the only characteristic that can. It
81556
+ * does not prove iOS renders it on every service shape. That is an observation
81557
+ * only a re-paired controller can make — and after a change like this one, the
81558
+ * controller must be re-paired, because a cached accessory database is exactly
81559
+ * what the whole mechanism is about.
81560
+ */
81561
+ /**
81562
+ * Publish `name` as both the immutable `Name` and the controller-visible
81563
+ * `ConfiguredName` of `service`.
81564
+ *
81565
+ * `name` must already be HAP-valid — build it with `service-names.ts`, which
81566
+ * cannot return a string hap-nodejs' `checkName` would warn about.
81567
+ */
81568
+ function applyServiceLabel(service, name) {
81569
+ service.setCharacteristic(import_dist.Characteristic.Name, name);
81570
+ if (!service.optionalCharacteristics.some((characteristic) => characteristic.UUID === import_dist.Characteristic.ConfiguredName.UUID)) service.addOptionalCharacteristic(import_dist.Characteristic.ConfiguredName);
81571
+ service.setCharacteristic(import_dist.Characteristic.ConfiguredName, name);
81572
+ }
81573
+ //#endregion
78777
81574
  //#region src/mappers/builders/battery.ts
78778
81575
  /**
78779
81576
  * Battery builder — surfaces a battery-operated camera's power state
@@ -78783,34 +81580,56 @@ function titleCase(raw) {
78783
81580
  * subscribes to the runtime-state slice so iOS Home reflects level /
78784
81581
  * charging changes pushed by the firmware without a poll loop.
78785
81582
  *
81583
+ * The status→characteristic mapping is {@link batteryCharacteristicUpdates},
81584
+ * exported because the generic (non-camera) export path publishes the same
81585
+ * `Service.Battery` from the same cap — one derivation, two accessory shapes.
81586
+ *
81587
+ * Skipped silently when the `battery` cap is not bound — caller checks
81588
+ * cap presence before invoking this builder (see `camera-accessory.ts`).
81589
+ */
81590
+ var LOW_BATTERY_THRESHOLD_PCT = 20;
81591
+ /**
78786
81592
  * Mapping:
78787
81593
  * - `BatteryStatus.percentage` (0..100) → `Characteristic.BatteryLevel`
78788
81594
  * - `BatteryStatus.charging`:
78789
81595
  * `'none'` → `ChargingState.NOT_CHARGING`
78790
81596
  * `'dc' | 'solar'` → `ChargingState.CHARGING`
78791
81597
  * - `percentage <= LOW_BATTERY_THRESHOLD_PCT` → `StatusLowBattery.LOW`
78792
- *
78793
- * Skipped silently when the `battery` cap is not bound — caller checks
78794
- * cap presence before invoking this builder (see `camera-accessory.ts`).
78795
81598
  */
78796
- var LOW_BATTERY_THRESHOLD_PCT = 20;
81599
+ var batteryCharacteristicUpdates = reader(BatteryStatusSchema.pick({ percentage: true }).extend({ charging: BatteryStatusSchema.shape.charging.optional() }), (status) => {
81600
+ const pct = Math.max(0, Math.min(100, Math.round(status.percentage)));
81601
+ return [
81602
+ {
81603
+ characteristic: import_dist.Characteristic.BatteryLevel,
81604
+ value: pct
81605
+ },
81606
+ ...status.charging === void 0 ? [] : [{
81607
+ characteristic: import_dist.Characteristic.ChargingState,
81608
+ value: status.charging === "none" ? import_dist.Characteristic.ChargingState.NOT_CHARGING : import_dist.Characteristic.ChargingState.CHARGING
81609
+ }],
81610
+ {
81611
+ characteristic: import_dist.Characteristic.StatusLowBattery,
81612
+ value: pct <= LOW_BATTERY_THRESHOLD_PCT ? import_dist.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW : import_dist.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
81613
+ }
81614
+ ];
81615
+ });
78797
81616
  async function buildBattery(bctx) {
78798
81617
  const { ctx, accessory, proxy, numericDeviceId, displayName } = bctx;
78799
81618
  const log = ctx.logger.withTags({ deviceId: numericDeviceId });
78800
- const service = accessory.addService(import_dist.Service.Battery, hapServiceName([displayName], `Camera ${numericDeviceId}`));
81619
+ const label = hapServiceName([displayName], `Camera ${numericDeviceId}`);
81620
+ const service = accessory.addService(import_dist.Service.Battery, label);
81621
+ applyServiceLabel(service, label);
78801
81622
  try {
78802
81623
  const status = await proxy.battery?.getStatus({});
78803
- if (status) applyToService(service, status);
81624
+ if (status !== void 0 && status !== null) applyToService(service, status);
78804
81625
  } catch (err) {
78805
- log.debug("export-hap: battery getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$10(err) } });
81626
+ log.debug("export-hap: battery getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$13(err) } });
78806
81627
  }
78807
81628
  const unsubscribes = [];
78808
81629
  if (proxy.state.battery) {
78809
81630
  const unsub = proxy.state.battery.subscribe((value) => {
78810
81631
  if (!value) return;
78811
- const status = value;
78812
- if (typeof status.percentage !== "number") return;
78813
- applyToService(service, status);
81632
+ applyToService(service, value);
78814
81633
  });
78815
81634
  unsubscribes.push(unsub);
78816
81635
  }
@@ -78821,14 +81640,9 @@ async function buildBattery(bctx) {
78821
81640
  } };
78822
81641
  }
78823
81642
  function applyToService(service, status) {
78824
- const pct = Math.max(0, Math.min(100, Math.round(status.percentage)));
78825
- service.updateCharacteristic(import_dist.Characteristic.BatteryLevel, pct);
78826
- const chargingState = status.charging === "none" ? import_dist.Characteristic.ChargingState.NOT_CHARGING : import_dist.Characteristic.ChargingState.CHARGING;
78827
- service.updateCharacteristic(import_dist.Characteristic.ChargingState, chargingState);
78828
- const lowBattery = pct <= LOW_BATTERY_THRESHOLD_PCT ? import_dist.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW : import_dist.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
78829
- service.updateCharacteristic(import_dist.Characteristic.StatusLowBattery, lowBattery);
81643
+ applyUpdates(service, batteryCharacteristicUpdates(status));
78830
81644
  }
78831
- function errMsg$10(err) {
81645
+ function errMsg$13(err) {
78832
81646
  return err instanceof Error ? err.message : String(err);
78833
81647
  }
78834
81648
  //#endregion
@@ -89580,7 +92394,7 @@ var VIDEO_LOOPBACK_RCVBUF_BYTES = 8 * 1024 * 1024;
89580
92394
  * not burst size.
89581
92395
  */
89582
92396
  var AUDIO_LOOPBACK_RCVBUF_BYTES = 1024 * 1024;
89583
- function errMsg$9(err) {
92397
+ function errMsg$12(err) {
89584
92398
  return err instanceof Error ? err.message : String(err);
89585
92399
  }
89586
92400
  /**
@@ -89595,13 +92409,13 @@ function applyReceiveBuffer(socket, requestedBytes) {
89595
92409
  try {
89596
92410
  socket.setRecvBufferSize(requestedBytes);
89597
92411
  } catch (err) {
89598
- error = errMsg$9(err);
92412
+ error = errMsg$12(err);
89599
92413
  }
89600
92414
  let effectiveBytes = null;
89601
92415
  try {
89602
92416
  effectiveBytes = socket.getRecvBufferSize();
89603
92417
  } catch (err) {
89604
- if (error === null) error = errMsg$9(err);
92418
+ if (error === null) error = errMsg$12(err);
89605
92419
  }
89606
92420
  return {
89607
92421
  requestedBytes,
@@ -89861,20 +92675,20 @@ function buildCameraStreamingDelegate(bctx, advertised) {
89861
92675
  delegate: {
89862
92676
  handleSnapshotRequest(request, callback) {
89863
92677
  handleSnapshot(bctx, request).then((buf) => callback(void 0, buf)).catch((err) => {
89864
- log.warn("export-hap: snapshot failed", { meta: { error: errMsg$8(err) } });
89865
- callback(err instanceof Error ? err : new Error(errMsg$8(err)));
92678
+ log.warn("export-hap: snapshot failed", { meta: { error: errMsg$11(err) } });
92679
+ callback(err instanceof Error ? err : new Error(errMsg$11(err)));
89866
92680
  });
89867
92681
  },
89868
92682
  prepareStream(request, callback) {
89869
92683
  prepareStream(request, sessions, bctx).then((resp) => callback(void 0, resp)).catch((err) => {
89870
- log.warn("export-hap: prepareStream failed", { meta: { error: errMsg$8(err) } });
89871
- callback(err instanceof Error ? err : new Error(errMsg$8(err)));
92684
+ log.warn("export-hap: prepareStream failed", { meta: { error: errMsg$11(err) } });
92685
+ callback(err instanceof Error ? err : new Error(errMsg$11(err)));
89872
92686
  });
89873
92687
  },
89874
92688
  handleStreamRequest(request, callback) {
89875
92689
  handleStreamRequest(request, sessions, bctx, advertised).then(() => callback()).catch((err) => {
89876
- log.warn("export-hap: handleStreamRequest failed", { meta: { error: errMsg$8(err) } });
89877
- callback(err instanceof Error ? err : new Error(errMsg$8(err)));
92690
+ log.warn("export-hap: handleStreamRequest failed", { meta: { error: errMsg$11(err) } });
92691
+ callback(err instanceof Error ? err : new Error(errMsg$11(err)));
89878
92692
  });
89879
92693
  }
89880
92694
  },
@@ -89990,7 +92804,7 @@ async function prepareStream(request, sessions, bctx) {
89990
92804
  closeSocket(audioUdp);
89991
92805
  closeSocket(videoLoopUdp);
89992
92806
  closeSocket(audioLoopUdp);
89993
- throw new Error(`export-hap: outbound SrtpSession init failed: ${errMsg$8(err)}`, { cause: err });
92807
+ throw new Error(`export-hap: outbound SrtpSession init failed: ${errMsg$11(err)}`, { cause: err });
89994
92808
  }
89995
92809
  let upstreamAudioSrtp = null;
89996
92810
  try {
@@ -90004,7 +92818,7 @@ async function prepareStream(request, sessions, bctx) {
90004
92818
  profile: import_src.ProtectionProfileAes128CmHmacSha1_80
90005
92819
  });
90006
92820
  } catch (err) {
90007
- bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).warn("export-hap: SrtpSession init failed (upstream audio decrypt disabled)", { meta: { error: errMsg$8(err) } });
92821
+ bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).warn("export-hap: SrtpSession init failed (upstream audio decrypt disabled)", { meta: { error: errMsg$11(err) } });
90008
92822
  }
90009
92823
  const videoSsrc = randomSsrc();
90010
92824
  const audioSsrc = randomSsrc();
@@ -90121,7 +92935,7 @@ async function prepareStream(request, sessions, bctx) {
90121
92935
  });
90122
92936
  audioUdp.on("message", (packet, rinfo) => {
90123
92937
  handleIncomingAudioRtp(session, packet, rinfo.address, bctx).catch((err) => {
90124
- bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).debug("export-hap: incoming-audio handler error (dropped)", { meta: { error: errMsg$8(err) } });
92938
+ bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).debug("export-hap: incoming-audio handler error (dropped)", { meta: { error: errMsg$11(err) } });
90125
92939
  });
90126
92940
  });
90127
92941
  logLoopbackBuffer(tagLog, request.sessionID, "video", videoLoop.buffer);
@@ -90317,7 +93131,7 @@ function readControllerRtcp(session, leg, packet, log) {
90317
93131
  } catch (err) {
90318
93132
  drop(session, "inbound-rtcp-decrypt-failed");
90319
93133
  storeReceiverReports(session, leg, recordUnreadableRtcp(tally));
90320
- logUnreadableRtcp(session, leg, `decrypt: ${errMsg$8(err)}`, log);
93134
+ logUnreadableRtcp(session, leg, `decrypt: ${errMsg$11(err)}`, log);
90321
93135
  return;
90322
93136
  }
90323
93137
  const outcome = ingestDecryptedRtcp(plaintext, tally);
@@ -91083,7 +93897,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
91083
93897
  session.upstreamRtpDecryptFailures += 1;
91084
93898
  if (session.upstreamRtpDecryptFailures % 100 === 1) log.debug("export-hap: SRTP decrypt failed (rate-limited)", { meta: {
91085
93899
  failures: session.upstreamRtpDecryptFailures,
91086
- error: errMsg$8(err)
93900
+ error: errMsg$11(err)
91087
93901
  } });
91088
93902
  return;
91089
93903
  }
@@ -91097,7 +93911,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
91097
93911
  rtpPayloadType = parsedRtp.header.payloadType;
91098
93912
  } catch (err) {
91099
93913
  drop(session, "upstream-parse-failed");
91100
- log.debug("export-hap: RTP parse failed after decrypt", { meta: { error: errMsg$8(err) } });
93914
+ log.debug("export-hap: RTP parse failed after decrypt", { meta: { error: errMsg$11(err) } });
91101
93915
  return;
91102
93916
  }
91103
93917
  const negotiatedAudioPt = session.lastStartParams?.audioPt;
@@ -91121,7 +93935,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
91121
93935
  if (session.intercomTalkSessionId === null) {
91122
93936
  session.intercomTalkSessionId = "";
91123
93937
  const opened = await openIntercomTalkSession(bctx).catch((err) => {
91124
- log.warn("export-hap: intercom.startTalkSession failed", { meta: { error: errMsg$8(err) } });
93938
+ log.warn("export-hap: intercom.startTalkSession failed", { meta: { error: errMsg$11(err) } });
91125
93939
  return null;
91126
93940
  });
91127
93941
  if (opened) {
@@ -91148,7 +93962,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
91148
93962
  drop(session, "upstream-push-failed");
91149
93963
  log.debug("export-hap: intercom.pushTalkAudio failed (will re-open on next frame)", { meta: {
91150
93964
  sequenceNumber: session.intercomPcmSequence,
91151
- error: errMsg$8(err)
93965
+ error: errMsg$11(err)
91152
93966
  } });
91153
93967
  session.intercomTalkSessionId = null;
91154
93968
  }
@@ -91180,7 +93994,7 @@ async function closeIntercomTalkSession(session, bctx) {
91180
93994
  } catch (err) {
91181
93995
  log.debug("export-hap: intercom.endTalkSession failed (continuing)", { meta: {
91182
93996
  sessionId,
91183
- error: errMsg$8(err)
93997
+ error: errMsg$11(err)
91184
93998
  } });
91185
93999
  }
91186
94000
  }
@@ -91205,7 +94019,7 @@ function closeSocket(udp) {
91205
94019
  function randomSsrc() {
91206
94020
  return Math.floor(Math.random() * 2147483646) + 1 | 0;
91207
94021
  }
91208
- function errMsg$8(err) {
94022
+ function errMsg$11(err) {
91209
94023
  return err instanceof Error ? err.message : String(err);
91210
94024
  }
91211
94025
  //#endregion
@@ -91289,14 +94103,14 @@ async function buildDoorbell(input) {
91289
94103
  }
91290
94104
  log.info("export-hap: doorbell SINGLE_PRESS pushed to HomeKit", { meta: { ...delivery } });
91291
94105
  } catch (err) {
91292
- log.warn("export-hap: ringDoorbell() failed", { meta: { error: errMsg$7(err) } });
94106
+ log.warn("export-hap: ringDoorbell() failed", { meta: { error: errMsg$10(err) } });
91293
94107
  }
91294
94108
  });
91295
94109
  return { async dispose() {
91296
94110
  unsubscribe();
91297
94111
  } };
91298
94112
  }
91299
- function errMsg$7(err) {
94113
+ function errMsg$10(err) {
91300
94114
  return err instanceof Error ? err.message : String(err);
91301
94115
  }
91302
94116
  //#endregion
@@ -91336,13 +94150,15 @@ var RESET_DEBOUNCE_MS = 5e3;
91336
94150
  */
91337
94151
  async function buildMotionSensor(bctx, existing = null) {
91338
94152
  const { ctx, accessory, proxy, numericDeviceId, displayName } = bctx;
91339
- const motionService = existing ?? accessory.addService(import_dist.Service.MotionSensor, hapServiceName([displayName], `Camera ${numericDeviceId}`));
94153
+ const label = hapServiceName([displayName], `Camera ${numericDeviceId}`);
94154
+ const motionService = existing ?? accessory.addService(import_dist.Service.MotionSensor, label);
94155
+ applyServiceLabel(motionService, label);
91340
94156
  motionService.setCharacteristic(import_dist.Characteristic.MotionDetected, false);
91341
94157
  try {
91342
94158
  const detected = await proxy.motion?.isDetected({});
91343
94159
  if (typeof detected === "boolean") motionService.updateCharacteristic(import_dist.Characteristic.MotionDetected, detected);
91344
94160
  } catch (err) {
91345
- ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: initial motion hydrate failed (non-fatal)", { meta: { error: errMsg$6(err) } });
94161
+ ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: initial motion hydrate failed (non-fatal)", { meta: { error: errMsg$9(err) } });
91346
94162
  }
91347
94163
  let resetTimer = null;
91348
94164
  const armReset = () => {
@@ -91376,82 +94192,10 @@ async function buildMotionSensor(bctx, existing = null) {
91376
94192
  }
91377
94193
  } };
91378
94194
  }
91379
- function errMsg$6(err) {
94195
+ function errMsg$9(err) {
91380
94196
  return err instanceof Error ? err.message : String(err);
91381
94197
  }
91382
94198
  //#endregion
91383
- //#region src/mappers/builders/service-label.ts
91384
- /**
91385
- * The ONE place a secondary service on the camera accessory gets its label.
91386
- *
91387
- * A "secondary service" here is a Switch or Lightbulb published alongside the
91388
- * camera on the same accessory — the privacy switch, each accessory child
91389
- * (siren, floodlight), each PTZ action. iOS Home renders these as their own
91390
- * controls, and the operator has seen them as "Interruttore 1", "Interruttore
91391
- * 2" through three separate rounds of fixes.
91392
- *
91393
- * ## Why `Name` alone cannot rename anything
91394
- *
91395
- * Two facts about hap-nodejs 2.1.7, both measured against the installed copy
91396
- * rather than reasoned about:
91397
- *
91398
- * 1. `accessory.addService(Type, displayName, subtype)` ALREADY writes
91399
- * `displayName` to `Characteristic.Name` (`Service` constructor). So every
91400
- * round of this bug — including the one that moved the label onto
91401
- * `ConfiguredName` — shipped with `Name` correctly set. "iOS had no name
91402
- * to render" was never true.
91403
- * 2. The mDNS configuration number (`c#`) is a sha1 over
91404
- * `internalHAPRepresentation(false)`, which OMITS characteristic VALUES.
91405
- * Changing the string in `Name` therefore does not bump `c#`, a paired
91406
- * controller gets no signal to re-read `/accessories`, and the name it
91407
- * cached at first enumeration stands forever.
91408
- *
91409
- * `Name` is also declared `pr` only — paired read, no write, no notify. It is
91410
- * the seed a controller seeds its database from once; it is not a channel.
91411
- *
91412
- * ## Why `ConfiguredName`
91413
- *
91414
- * `ConfiguredName` (`000000E3`) is declared `pr | pw | ev` — the only name
91415
- * characteristic a controller may write and may subscribe to. It is what iOS
91416
- * 16+ reads for a service the user can rename, and adding it CHANGES the
91417
- * accessory structure, so `c#` does bump and the controller re-reads.
91418
- *
91419
- * It was removed once because hap-nodejs logged
91420
- *
91421
- * ```
91422
- * Characteristic not in required or optional characteristic section for
91423
- * service Switch. Adding anyway.
91424
- * ```
91425
- *
91426
- * That line is a WARNING, not a rejection: `Service.getCharacteristic` calls
91427
- * `addCharacteristic` unconditionally and only then emits the warning. The
91428
- * characteristic was always present and always published. hap-nodejs'
91429
- * per-service optional lists simply predate `ConfiguredName` being valid on
91430
- * any service.
91431
- *
91432
- * Registering it with {@link Service.addOptionalCharacteristic} first takes
91433
- * the branch above the warning, so the accessory still builds with ZERO
91434
- * characteristic warnings — which is what `service-naming.spec.ts` asserts.
91435
- *
91436
- * ## Scope
91437
- *
91438
- * Switch- and Lightbulb-shaped services only. `Service.MotionSensor` on a
91439
- * camera accessory is not a separately named tile in iOS Home, so giving it a
91440
- * writable name would be a guess, and this module does not guess.
91441
- */
91442
- /**
91443
- * Publish `name` as both the immutable `Name` and the controller-visible
91444
- * `ConfiguredName` of `service`.
91445
- *
91446
- * `name` must already be HAP-valid — build it with `service-names.ts`, which
91447
- * cannot return a string hap-nodejs' `checkName` would warn about.
91448
- */
91449
- function applyServiceLabel(service, name) {
91450
- service.setCharacteristic(import_dist.Characteristic.Name, name);
91451
- if (!service.optionalCharacteristics.some((characteristic) => characteristic.UUID === import_dist.Characteristic.ConfiguredName.UUID)) service.addOptionalCharacteristic(import_dist.Characteristic.ConfiguredName);
91452
- service.setCharacteristic(import_dist.Characteristic.ConfiguredName, name);
91453
- }
91454
- //#endregion
91455
94199
  //#region src/mappers/builders/privacy-switch.ts
91456
94200
  /**
91457
94201
  * Privacy-mask switch builder — turns the camstack `privacy-mask` cap's
@@ -91479,7 +94223,7 @@ async function buildPrivacySwitch(bctx) {
91479
94223
  const status = await proxy.privacyMask?.getStatus({});
91480
94224
  if (status && typeof status.enabled === "boolean") service.updateCharacteristic(import_dist.Characteristic.On, status.enabled);
91481
94225
  } catch (err) {
91482
- log.debug("export-hap: privacy-mask getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$5(err) } });
94226
+ log.debug("export-hap: privacy-mask getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$8(err) } });
91483
94227
  }
91484
94228
  service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
91485
94229
  const enabled = value === true;
@@ -91488,7 +94232,7 @@ async function buildPrivacySwitch(bctx) {
91488
94232
  } catch (err) {
91489
94233
  log.warn("export-hap: privacy-mask setMask failed", { meta: {
91490
94234
  enabled,
91491
- error: errMsg$5(err)
94235
+ error: errMsg$8(err)
91492
94236
  } });
91493
94237
  }
91494
94238
  });
@@ -91506,7 +94250,7 @@ async function buildPrivacySwitch(bctx) {
91506
94250
  } catch {}
91507
94251
  } };
91508
94252
  }
91509
- function errMsg$5(err) {
94253
+ function errMsg$8(err) {
91510
94254
  return err instanceof Error ? err.message : String(err);
91511
94255
  }
91512
94256
  //#endregion
@@ -91597,7 +94341,7 @@ async function buildPtz(bctx) {
91597
94341
  } catch (err) {
91598
94342
  log.warn("export-hap: ptz.goToPreset failed", { meta: {
91599
94343
  presetId: preset.id,
91600
- error: errMsg$4(err)
94344
+ error: errMsg$7(err)
91601
94345
  } });
91602
94346
  }
91603
94347
  armReset(() => service.updateCharacteristic(import_dist.Characteristic.On, false), MOMENTARY_RESET_MS);
@@ -91615,14 +94359,14 @@ async function buildPtz(bctx) {
91615
94359
  try {
91616
94360
  await proxy.ptz?.stop({});
91617
94361
  } catch (err) {
91618
- log.debug("export-hap: ptz.stop failed (non-fatal)", { meta: { error: errMsg$4(err) } });
94362
+ log.debug("export-hap: ptz.stop failed (non-fatal)", { meta: { error: errMsg$7(err) } });
91619
94363
  }
91620
94364
  service.updateCharacteristic(import_dist.Characteristic.On, false);
91621
94365
  }, options.ptzPulseMs);
91622
94366
  } catch (err) {
91623
94367
  log.warn("export-hap: ptz.continuousMove failed", { meta: {
91624
94368
  dir: dir.label,
91625
- error: errMsg$4(err)
94369
+ error: errMsg$7(err)
91626
94370
  } });
91627
94371
  service.updateCharacteristic(import_dist.Characteristic.On, false);
91628
94372
  }
@@ -91645,7 +94389,7 @@ async function readPresets(bctx) {
91645
94389
  name: p.name
91646
94390
  }));
91647
94391
  } catch (err) {
91648
- ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: ptz.getPresets failed (non-fatal)", { meta: { error: errMsg$4(err) } });
94392
+ ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: ptz.getPresets failed (non-fatal)", { meta: { error: errMsg$7(err) } });
91649
94393
  return [];
91650
94394
  }
91651
94395
  }
@@ -91660,7 +94404,7 @@ async function tryBuildAutotrack(bctx) {
91660
94404
  const status = await proxy.ptzAutotrack.getStatus({});
91661
94405
  if (status && typeof status.enabled === "boolean") service.updateCharacteristic(import_dist.Characteristic.On, status.enabled);
91662
94406
  } catch (err) {
91663
- log.debug("export-hap: ptzAutotrack.getStatus failed (non-fatal)", { meta: { error: errMsg$4(err) } });
94407
+ log.debug("export-hap: ptzAutotrack.getStatus failed (non-fatal)", { meta: { error: errMsg$7(err) } });
91664
94408
  }
91665
94409
  service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
91666
94410
  const enabled = value === true;
@@ -91669,13 +94413,13 @@ async function tryBuildAutotrack(bctx) {
91669
94413
  } catch (err) {
91670
94414
  log.warn("export-hap: ptzAutotrack.setEnabled failed", { meta: {
91671
94415
  enabled,
91672
- error: errMsg$4(err)
94416
+ error: errMsg$7(err)
91673
94417
  } });
91674
94418
  }
91675
94419
  });
91676
94420
  return { async dispose() {} };
91677
94421
  }
91678
- function errMsg$4(err) {
94422
+ function errMsg$7(err) {
91679
94423
  return err instanceof Error ? err.message : String(err);
91680
94424
  }
91681
94425
  //#endregion
@@ -92706,13 +95450,13 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
92706
95450
  const switchStatus = await proxy.switch?.getStatus({});
92707
95451
  if (switchStatus && typeof switchStatus.on === "boolean") service.updateCharacteristic(import_dist.Characteristic.On, switchStatus.on);
92708
95452
  } catch (err) {
92709
- log.debug("export-hap: child switch.getStatus failed (non-fatal)", { meta: { error: errMsg$3(err) } });
95453
+ log.debug("export-hap: child switch.getStatus failed (non-fatal)", { meta: { error: errMsg$6(err) } });
92710
95454
  }
92711
95455
  if (useLightbulb) try {
92712
95456
  const status = await proxy.brightness?.getStatus({});
92713
95457
  if (status && typeof status.percentage === "number") service.updateCharacteristic(import_dist.Characteristic.Brightness, status.percentage);
92714
95458
  } catch (err) {
92715
- log.debug("export-hap: child brightness.getStatus failed (non-fatal)", { meta: { error: errMsg$3(err) } });
95459
+ log.debug("export-hap: child brightness.getStatus failed (non-fatal)", { meta: { error: errMsg$6(err) } });
92716
95460
  }
92717
95461
  if (hasSwitch) service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
92718
95462
  const on = value === true;
@@ -92721,7 +95465,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
92721
95465
  } catch (err) {
92722
95466
  log.warn("export-hap: child switch.setState failed", { meta: {
92723
95467
  on,
92724
- error: errMsg$3(err)
95468
+ error: errMsg$6(err)
92725
95469
  } });
92726
95470
  }
92727
95471
  });
@@ -92733,7 +95477,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
92733
95477
  } catch (err) {
92734
95478
  log.warn("export-hap: child brightness.setBrightness failed", { meta: {
92735
95479
  percentage,
92736
- error: errMsg$3(err)
95480
+ error: errMsg$6(err)
92737
95481
  } });
92738
95482
  }
92739
95483
  });
@@ -92756,7 +95500,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
92756
95500
  } catch {}
92757
95501
  } };
92758
95502
  }
92759
- function errMsg$3(err) {
95503
+ function errMsg$6(err) {
92760
95504
  return err instanceof Error ? err.message : String(err);
92761
95505
  }
92762
95506
  //#endregion
@@ -92783,7 +95527,7 @@ async function buildChildServicesFor(input) {
92783
95527
  for (const h of handles) try {
92784
95528
  await h.dispose();
92785
95529
  } catch (err) {
92786
- ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: child service dispose failed (continuing)", { meta: { error: errMsg$2(err) } });
95530
+ ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: child service dispose failed (continuing)", { meta: { error: errMsg$5(err) } });
92787
95531
  }
92788
95532
  } };
92789
95533
  }
@@ -92799,7 +95543,7 @@ async function listChildren(ctx, parentNumericId) {
92799
95543
  features: Array.isArray(c.features) ? c.features.filter((f) => typeof f === "string") : []
92800
95544
  }));
92801
95545
  } catch (err) {
92802
- ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: deviceManager.getChildren failed (non-fatal)", { meta: { error: errMsg$2(err) } });
95546
+ ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: deviceManager.getChildren failed (non-fatal)", { meta: { error: errMsg$5(err) } });
92803
95547
  return [];
92804
95548
  }
92805
95549
  }
@@ -92815,10 +95559,76 @@ function asDeviceType(raw) {
92815
95559
  for (const value of Object.values(DeviceType)) if (value === lower) return value;
92816
95560
  return DeviceType.Generic;
92817
95561
  }
92818
- function errMsg$2(err) {
95562
+ function errMsg$5(err) {
92819
95563
  return err instanceof Error ? err.message : String(err);
92820
95564
  }
92821
95565
  //#endregion
95566
+ //#region src/mappers/kind.ts
95567
+ /**
95568
+ * Which orchestrator a device gets, which device types the picker offers, and
95569
+ * what a device's HomeKit accessory is called on the wire.
95570
+ *
95571
+ * Separate from `index.ts` (the factory registry) only so the orchestrators can
95572
+ * import the uuid convention without importing the registry that imports them.
95573
+ */
95574
+ var SUPPORTED_MAPPER_KINDS = ["camera", "generic"];
95575
+ /**
95576
+ * The device types the Export picker offers, and the answer to the cap's
95577
+ * `listSupportedDeviceKinds`.
95578
+ *
95579
+ * A UI FILTER, nothing more. Whether a device actually exports anything is
95580
+ * decided by its capabilities (`rowsForCaps` in the capability table) — the
95581
+ * doctrine the HA exporter writes down, and the thing that confined the
95582
+ * previous exporter to cameras when it was ignored.
95583
+ *
95584
+ * Tier A: the types whose HomeKit services exist today and need no
95585
+ * feature-dependent shape. `cover`, `climate`, `fan`, `valve`, `humidifier`,
95586
+ * `water-heater`, `alarm-panel`, `button` and `media-player` are deliberately
95587
+ * absent — each needs a service whose semantics the table cannot yet honour,
95588
+ * and offering the tab before the mapping exists is how an operator gets an
95589
+ * accessory that pairs and does nothing.
95590
+ */
95591
+ var HAP_EXPORTABLE_DEVICE_TYPES = [
95592
+ DeviceType.Camera,
95593
+ DeviceType.Light,
95594
+ DeviceType.Switch,
95595
+ DeviceType.Siren,
95596
+ DeviceType.Sensor,
95597
+ DeviceType.Lock,
95598
+ DeviceType.Presence,
95599
+ DeviceType.Generic
95600
+ ];
95601
+ /**
95602
+ * Resolve the orchestrator for a device from its TYPE.
95603
+ *
95604
+ * `null` means "no Export tab": the picker must not offer a type no
95605
+ * orchestrator can build. An UNKNOWN type (the device-manager read failed) maps
95606
+ * to `camera` — that is what every entry persisted before this function existed
95607
+ * carries, and a transient API failure must never re-shape an exposed camera.
95608
+ */
95609
+ function pickMapperKind(deviceType) {
95610
+ if (deviceType === null || deviceType === void 0 || deviceType.length === 0) return "camera";
95611
+ if (deviceType === DeviceType.Camera) return "camera";
95612
+ return HAP_EXPORTABLE_DEVICE_TYPES.find((type) => type === deviceType) === void 0 ? null : "generic";
95613
+ }
95614
+ /**
95615
+ * The deterministic HAP accessory UUID for a device.
95616
+ *
95617
+ * One function, because three call sites depend on the answer agreeing: the
95618
+ * orchestrator that builds the accessory, `unexposeDevice` (which wipes
95619
+ * hap-nodejs' pairing blobs by uuid, on a device whose mapper is already gone)
95620
+ * and the export sync state that records it.
95621
+ *
95622
+ * The camera namespace is FROZEN — every camera paired to date derives its MAC
95623
+ * from `sha256("camstack:hap:" + uuid)` of this exact string, and changing it
95624
+ * would make every paired camera a stranger. Generic devices get their own
95625
+ * namespace so a switch and a camera that happen to share a device id are not
95626
+ * the same HomeKit accessory.
95627
+ */
95628
+ function accessoryUuidFor(kind, deviceId) {
95629
+ return import_dist.uuid.generate(kind === "camera" ? `camstack:camera:${deviceId}` : `camstack:device:${deviceId}`);
95630
+ }
95631
+ //#endregion
92822
95632
  //#region src/mappers/camera-accessory.ts
92823
95633
  /**
92824
95634
  * Camera accessory orchestrator — given a camstack deviceId, builds one
@@ -92851,9 +95661,9 @@ async function buildCameraAccessory(input) {
92851
95661
  const capNames = new Set(proxy.binding?.entries.map((e) => e.capName) ?? []);
92852
95662
  const isDoorbell = capNames.has("doorbell");
92853
95663
  const category = isDoorbell ? import_dist.Categories.VIDEO_DOORBELL : import_dist.Categories.IP_CAMERA;
92854
- const accessory = new import_dist.Accessory(displayName, import_dist.uuid.generate(`camstack:camera:${numericId}`));
95664
+ const accessory = new import_dist.Accessory(displayName, accessoryUuidFor("camera", numericId));
92855
95665
  accessory.category = category;
92856
- await populateAccessoryInfo(accessory, proxy, displayName);
95666
+ await populateAccessoryInfo(accessory, proxy, displayName, "Camera");
92857
95667
  const bctx = {
92858
95668
  ctx,
92859
95669
  accessory,
@@ -92911,55 +95721,462 @@ async function buildCameraAccessory(input) {
92911
95721
  for (const h of handles) try {
92912
95722
  await h.dispose();
92913
95723
  } catch (err) {
92914
- log.debug("export-hap: builder dispose failed (continuing)", { meta: { error: errMsg$1(err) } });
95724
+ log.debug("export-hap: builder dispose failed (continuing)", { meta: { error: errMsg$4(err) } });
92915
95725
  }
92916
95726
  try {
92917
95727
  await streams.dispose();
92918
95728
  } catch (err) {
92919
- log.debug("export-hap: streams dispose failed", { meta: { error: errMsg$1(err) } });
95729
+ log.debug("export-hap: streams dispose failed", { meta: { error: errMsg$4(err) } });
92920
95730
  }
92921
95731
  }
92922
95732
  };
92923
95733
  }
92924
- async function populateAccessoryInfo(accessory, proxy, displayName) {
92925
- const info = accessory.getService(import_dist.Service.AccessoryInformation);
92926
- if (!info) return;
95734
+ function errMsg$4(err) {
95735
+ return err instanceof Error ? err.message : String(err);
95736
+ }
95737
+ //#endregion
95738
+ //#region src/mappers/builders/generic/lock.ts
95739
+ /**
95740
+ * `lock-control` → `Service.LockMechanism`.
95741
+ *
95742
+ * Not a sensor row: HomeKit models a lock as two characteristics, a CURRENT
95743
+ * state the accessory owns and a TARGET state the controller writes, and the
95744
+ * cap's five states do not map onto either one alone.
95745
+ *
95746
+ * ```
95747
+ * cap state LockCurrentState LockTargetState
95748
+ * locked SECURED SECURED
95749
+ * unlocked UNSECURED UNSECURED
95750
+ * locking UNKNOWN SECURED (in flight — do not claim SECURED)
95751
+ * unlocking UNKNOWN UNSECURED
95752
+ * jammed JAMMED unchanged (the controller's intent stands)
95753
+ * ```
95754
+ *
95755
+ * Reporting SECURED while the bolt is still moving is the failure worth naming:
95756
+ * iOS renders the lock as closed, the operator walks away, and the motor stalls
95757
+ * behind them. `UNKNOWN` is the honest answer for an in-flight transition.
95758
+ *
95759
+ * `open` (the cap's third method, for locks with a latch/buzzer) has no HomeKit
95760
+ * counterpart on this service and is deliberately not wired — a Switch that
95761
+ * silently buzzes a door open would be a second knob nobody asked for.
95762
+ */
95763
+ var SUBTYPE = "lock-control";
95764
+ var readLock = reader(LockControlStatusSchema.pick({ state: true }), (status) => {
95765
+ const current = status.state === "locked" ? import_dist.Characteristic.LockCurrentState.SECURED : status.state === "unlocked" ? import_dist.Characteristic.LockCurrentState.UNSECURED : status.state === "jammed" ? import_dist.Characteristic.LockCurrentState.JAMMED : import_dist.Characteristic.LockCurrentState.UNKNOWN;
95766
+ const target = status.state === "locked" || status.state === "locking" ? import_dist.Characteristic.LockTargetState.SECURED : status.state === "unlocked" || status.state === "unlocking" ? import_dist.Characteristic.LockTargetState.UNSECURED : null;
95767
+ return [{
95768
+ characteristic: import_dist.Characteristic.LockCurrentState,
95769
+ value: current
95770
+ }, ...target === null ? [] : [{
95771
+ characteristic: import_dist.Characteristic.LockTargetState,
95772
+ value: target
95773
+ }]];
95774
+ });
95775
+ async function buildLockMechanism(bctx) {
95776
+ const { ctx, accessory, proxy, numericDeviceId, displayName } = bctx;
95777
+ const log = ctx.logger.withTags({ deviceId: numericDeviceId });
95778
+ const label = hapServiceName([displayName], `Lock ${numericDeviceId}`);
95779
+ const service = accessory.addService(import_dist.Service.LockMechanism, label, SUBTYPE);
95780
+ applyServiceLabel(service, label);
95781
+ const apply = (status, source) => {
95782
+ const updates = readLock(status);
95783
+ if (updates.length === 0) {
95784
+ log.debug("export-hap: lock status did not match the cap schema — no update", { meta: { source } });
95785
+ return;
95786
+ }
95787
+ applyUpdates(service, updates);
95788
+ };
92927
95789
  try {
92928
- const device = await proxy.deviceManager?.getDevice({});
92929
- const metadata = device?.metadata ?? null;
92930
- info.setCharacteristic(import_dist.Characteristic.Name, device?.name ?? displayName);
92931
- info.setCharacteristic(import_dist.Characteristic.Manufacturer, stringOr(metadata?.manufacturer, "CamStack"));
92932
- info.setCharacteristic(import_dist.Characteristic.Model, stringOr(metadata?.model, "Camera"));
92933
- info.setCharacteristic(import_dist.Characteristic.FirmwareRevision, stringOr(metadata?.firmware, "0.0.0"));
92934
- info.setCharacteristic(import_dist.Characteristic.SerialNumber, stringOr(metadata?.sn, `camstack-${proxy.deviceId}`));
92935
- } catch {}
95790
+ const status = await proxy.lockControl?.getStatus({});
95791
+ if (status !== void 0 && status !== null) apply(status, "getStatus");
95792
+ } catch (err) {
95793
+ log.debug("export-hap: lock getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$3(err) } });
95794
+ }
95795
+ service.getCharacteristic(import_dist.Characteristic.LockTargetState).onSet(async (value) => {
95796
+ const secure = value === import_dist.Characteristic.LockTargetState.SECURED;
95797
+ try {
95798
+ if (secure) await proxy.lockControl?.lock({});
95799
+ else await proxy.lockControl?.unlock({});
95800
+ } catch (err) {
95801
+ log.warn("export-hap: lock command failed", { meta: {
95802
+ secure,
95803
+ error: errMsg$3(err)
95804
+ } });
95805
+ }
95806
+ });
95807
+ const unsubscribe = proxy.state.lockControl?.subscribe((value) => {
95808
+ if (value === void 0 || value === null) return;
95809
+ apply(value, "slice");
95810
+ }) ?? null;
95811
+ return { async dispose() {
95812
+ try {
95813
+ unsubscribe?.();
95814
+ } catch {}
95815
+ } };
92936
95816
  }
92937
- function stringOr(value, fallback) {
92938
- return typeof value === "string" && value.length > 0 ? value : fallback;
95817
+ function errMsg$3(err) {
95818
+ return err instanceof Error ? err.message : String(err);
95819
+ }
95820
+ //#endregion
95821
+ //#region src/mappers/builders/generic/sensor-service.ts
95822
+ async function buildSensorService(input) {
95823
+ const { bctx, spec, name, subtype } = input;
95824
+ const { ctx, accessory, proxy, numericDeviceId } = bctx;
95825
+ const log = ctx.logger.withTags({ deviceId: numericDeviceId });
95826
+ const label = hapServiceName([name], spec.label);
95827
+ const service = spec.addService(accessory, label, subtype);
95828
+ applyServiceLabel(service, label);
95829
+ const apply = (status, source) => {
95830
+ const updates = spec.read(status);
95831
+ if (updates.length === 0) {
95832
+ log.debug("export-hap: sensor status did not match the cap schema — no update", { meta: {
95833
+ subtype,
95834
+ source
95835
+ } });
95836
+ return;
95837
+ }
95838
+ applyUpdates(service, updates);
95839
+ };
95840
+ try {
95841
+ const status = await spec.getStatus(proxy);
95842
+ if (status !== void 0 && status !== null) apply(status, "getStatus");
95843
+ } catch (err) {
95844
+ log.debug("export-hap: sensor getStatus hydrate failed (non-fatal)", { meta: {
95845
+ subtype,
95846
+ error: errMsg$2(err)
95847
+ } });
95848
+ }
95849
+ const unsubscribe = spec.subscribe(proxy, (value) => {
95850
+ if (value === void 0 || value === null) return;
95851
+ apply(value, "slice");
95852
+ });
95853
+ return { async dispose() {
95854
+ try {
95855
+ unsubscribe?.();
95856
+ } catch {}
95857
+ } };
95858
+ }
95859
+ function errMsg$2(err) {
95860
+ return err instanceof Error ? err.message : String(err);
95861
+ }
95862
+ //#endregion
95863
+ //#region src/mappers/builders/generic/cap-service-table.ts
95864
+ /**
95865
+ * The capability→HomeKit-service TABLE for non-camera devices.
95866
+ *
95867
+ * This is the whole coverage decision for the generic export path, and it is
95868
+ * deliberately a table rather than a `switch` on `DeviceType`. The doctrine is
95869
+ * the one the Home Assistant exporter already writes down: *coverage is decided
95870
+ * by a device's capabilities, not its type — restricting the picker by type is
95871
+ * what confined the previous exporter to cameras.* A `DeviceType` here is only
95872
+ * ever a UI filter (`HAP_EXPORTABLE_DEVICE_TYPES`) or an icon
95873
+ * (`ACCESSORY_CATEGORY_BY_TYPE`); it never decides whether something exports.
95874
+ *
95875
+ * The shape mirrors `CAP_ENTITY_MAP` in
95876
+ * `packages/addon-provider-homeassistant/src/ha-export/entity-catalog.ts` so
95877
+ * the two can be unified later — one row per capability, keyed by the cap name
95878
+ * exactly as it appears in `proxy.binding.entries[].capName`.
95879
+ *
95880
+ * ## Reading a status
95881
+ *
95882
+ * Every row parses the cap's OWN Zod status schema rather than duck-typing the
95883
+ * payload, and it `.pick()`s only the fields it reads: a provider that omits a
95884
+ * timestamp must not silence a sensor, and a provider that sends the wrong
95885
+ * shape must not write a garbage characteristic. A parse that fails yields no
95886
+ * updates, and the builder that owns the service logs the drop — silence reads
95887
+ * as "the sensor never changed".
95888
+ *
95889
+ * ## Tier
95890
+ *
95891
+ * Tier A only: the caps whose HomeKit service exists today and needs no
95892
+ * feature-dependent shape (`cover` needs `cover-positionable`, `climate-control`
95893
+ * needs the dual-setpoint split, `alarm-panel` must survive a refused `arm`).
95894
+ * Those are a separate task; adding a row here must never mean adding a service
95895
+ * whose semantics this file cannot fully honour.
95896
+ */
95897
+ /** HomeKit's floor for `CurrentAmbientLightLevel`; 0 lux is out of range. */
95898
+ var MIN_LUX = 1e-4;
95899
+ var SENSOR_SPECS = {
95900
+ contact: {
95901
+ label: "Contact",
95902
+ addService: (accessory, name, subtype) => accessory.addService(import_dist.Service.ContactSensor, name, subtype),
95903
+ getStatus: (proxy) => proxy.contact?.getStatus({}),
95904
+ subscribe: (proxy, onValue) => proxy.state.contact?.subscribe(onValue) ?? null,
95905
+ read: reader(ContactStatusSchema.pick({ entryOpen: true }), (status) => [{
95906
+ characteristic: import_dist.Characteristic.ContactSensorState,
95907
+ value: status.entryOpen ? import_dist.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED : import_dist.Characteristic.ContactSensorState.CONTACT_DETECTED
95908
+ }])
95909
+ },
95910
+ motion: {
95911
+ label: "Motion",
95912
+ addService: (accessory, name, subtype) => accessory.addService(import_dist.Service.MotionSensor, name, subtype),
95913
+ getStatus: (proxy) => proxy.motion?.getStatus({}),
95914
+ subscribe: (proxy, onValue) => proxy.state.motion?.subscribe(onValue) ?? null,
95915
+ read: reader(MotionStatusSchema.pick({ detected: true }), (status) => [{
95916
+ characteristic: import_dist.Characteristic.MotionDetected,
95917
+ value: status.detected
95918
+ }])
95919
+ },
95920
+ presence: {
95921
+ label: "Presence",
95922
+ addService: (accessory, name, subtype) => accessory.addService(import_dist.Service.OccupancySensor, name, subtype),
95923
+ getStatus: (proxy) => proxy.presence?.getStatus({}),
95924
+ subscribe: (proxy, onValue) => proxy.state.presence?.subscribe(onValue) ?? null,
95925
+ read: reader(PresenceStatusSchema.pick({ state: true }), (status) => [{
95926
+ characteristic: import_dist.Characteristic.OccupancyDetected,
95927
+ value: status.state === "home" ? import_dist.Characteristic.OccupancyDetected.OCCUPANCY_DETECTED : import_dist.Characteristic.OccupancyDetected.OCCUPANCY_NOT_DETECTED
95928
+ }])
95929
+ },
95930
+ smoke: {
95931
+ label: "Smoke",
95932
+ addService: (accessory, name, subtype) => accessory.addService(import_dist.Service.SmokeSensor, name, subtype),
95933
+ getStatus: (proxy) => proxy.smoke?.getStatus({}),
95934
+ subscribe: (proxy, onValue) => proxy.state.smoke?.subscribe(onValue) ?? null,
95935
+ read: reader(SmokeStatusSchema.pick({ detected: true }), (status) => [{
95936
+ characteristic: import_dist.Characteristic.SmokeDetected,
95937
+ value: status.detected ? import_dist.Characteristic.SmokeDetected.SMOKE_DETECTED : import_dist.Characteristic.SmokeDetected.SMOKE_NOT_DETECTED
95938
+ }])
95939
+ },
95940
+ "carbon-monoxide": {
95941
+ label: "Carbon monoxide",
95942
+ addService: (accessory, name, subtype) => accessory.addService(import_dist.Service.CarbonMonoxideSensor, name, subtype),
95943
+ getStatus: (proxy) => proxy.carbonMonoxide?.getStatus({}),
95944
+ subscribe: (proxy, onValue) => proxy.state.carbonMonoxide?.subscribe(onValue) ?? null,
95945
+ read: reader(CarbonMonoxideStatusSchema.pick({ detected: true }), (status) => [{
95946
+ characteristic: import_dist.Characteristic.CarbonMonoxideDetected,
95947
+ value: status.detected ? import_dist.Characteristic.CarbonMonoxideDetected.CO_LEVELS_ABNORMAL : import_dist.Characteristic.CarbonMonoxideDetected.CO_LEVELS_NORMAL
95948
+ }])
95949
+ },
95950
+ flood: {
95951
+ label: "Leak",
95952
+ addService: (accessory, name, subtype) => accessory.addService(import_dist.Service.LeakSensor, name, subtype),
95953
+ getStatus: (proxy) => proxy.flood?.getStatus({}),
95954
+ subscribe: (proxy, onValue) => proxy.state.flood?.subscribe(onValue) ?? null,
95955
+ read: reader(FloodStatusSchema.pick({ flooded: true }), (status) => [{
95956
+ characteristic: import_dist.Characteristic.LeakDetected,
95957
+ value: status.flooded ? import_dist.Characteristic.LeakDetected.LEAK_DETECTED : import_dist.Characteristic.LeakDetected.LEAK_NOT_DETECTED
95958
+ }])
95959
+ },
95960
+ "temperature-sensor": {
95961
+ label: "Temperature",
95962
+ addService: (accessory, name, subtype) => accessory.addService(import_dist.Service.TemperatureSensor, name, subtype),
95963
+ getStatus: (proxy) => proxy.temperatureSensor?.getStatus({}),
95964
+ subscribe: (proxy, onValue) => proxy.state.temperatureSensor?.subscribe(onValue) ?? null,
95965
+ read: reader(TemperatureSensorStatusSchema.pick({ celsius: true }), (status) => [{
95966
+ characteristic: import_dist.Characteristic.CurrentTemperature,
95967
+ value: status.celsius
95968
+ }])
95969
+ },
95970
+ "humidity-sensor": {
95971
+ label: "Humidity",
95972
+ addService: (accessory, name, subtype) => accessory.addService(import_dist.Service.HumiditySensor, name, subtype),
95973
+ getStatus: (proxy) => proxy.humiditySensor?.getStatus({}),
95974
+ subscribe: (proxy, onValue) => proxy.state.humiditySensor?.subscribe(onValue) ?? null,
95975
+ read: reader(HumiditySensorStatusSchema.pick({ percent: true }), (status) => [{
95976
+ characteristic: import_dist.Characteristic.CurrentRelativeHumidity,
95977
+ value: status.percent
95978
+ }])
95979
+ },
95980
+ "ambient-light-sensor": {
95981
+ label: "Light level",
95982
+ addService: (accessory, name, subtype) => accessory.addService(import_dist.Service.LightSensor, name, subtype),
95983
+ getStatus: (proxy) => proxy.ambientLightSensor?.getStatus({}),
95984
+ subscribe: (proxy, onValue) => proxy.state.ambientLightSensor?.subscribe(onValue) ?? null,
95985
+ read: reader(AmbientLightSensorStatusSchema.pick({ lux: true }), (status) => [{
95986
+ characteristic: import_dist.Characteristic.CurrentAmbientLightLevel,
95987
+ value: Math.max(MIN_LUX, status.lux)
95988
+ }])
95989
+ }
95990
+ };
95991
+ /**
95992
+ * The `battery` row reads like a sensor but writes three characteristics from
95993
+ * one status, and the camera path publishes the SAME service from the same cap.
95994
+ * The derivation therefore lives once, in `battery.ts`, and both callers read
95995
+ * it from there.
95996
+ */
95997
+ var BATTERY_SPEC = {
95998
+ label: "Battery",
95999
+ addService: (accessory, name, subtype) => accessory.addService(import_dist.Service.Battery, name, subtype),
96000
+ getStatus: (proxy) => proxy.battery?.getStatus({}),
96001
+ subscribe: (proxy, onValue) => proxy.state.battery?.subscribe(onValue) ?? null,
96002
+ read: batteryCharacteristicUpdates
96003
+ };
96004
+ function sensorRow(capName, spec) {
96005
+ return {
96006
+ caps: [capName],
96007
+ label: spec.label,
96008
+ build: ({ bctx, name }) => buildSensorService({
96009
+ bctx,
96010
+ spec,
96011
+ name,
96012
+ subtype: capName
96013
+ })
96014
+ };
96015
+ }
96016
+ /**
96017
+ * THE table. Order matters only for one thing: the first row that matches a
96018
+ * device decides the accessory's category when the device's own type does not.
96019
+ */
96020
+ var HAP_CAP_SERVICES = [
96021
+ {
96022
+ caps: ["switch", "brightness"],
96023
+ label: "Power",
96024
+ build: ({ bctx, name, deviceType }) => buildChildSwitch({
96025
+ ...bctx,
96026
+ displayName: name
96027
+ }, "switch", deviceType)
96028
+ },
96029
+ {
96030
+ caps: ["lock-control"],
96031
+ label: "Lock",
96032
+ build: ({ bctx, name }) => buildLockMechanism({
96033
+ ...bctx,
96034
+ displayName: name
96035
+ })
96036
+ },
96037
+ {
96038
+ caps: ["battery"],
96039
+ label: BATTERY_SPEC.label,
96040
+ build: ({ bctx, name }) => buildSensorService({
96041
+ bctx,
96042
+ spec: BATTERY_SPEC,
96043
+ name,
96044
+ subtype: "battery"
96045
+ })
96046
+ },
96047
+ ...Object.entries(SENSOR_SPECS).map(([capName, spec]) => sensorRow(capName, spec))
96048
+ ];
96049
+ /**
96050
+ * The rows a device's bound capabilities select, in table order.
96051
+ *
96052
+ * A row matches when ANY of its caps is bound: a lamp with `switch` but no
96053
+ * `brightness` is still a Lightbulb-shaped row, and the builder degrades on its
96054
+ * own.
96055
+ */
96056
+ function rowsForCaps(capNames) {
96057
+ return HAP_CAP_SERVICES.filter((row) => row.caps.some((cap) => capNames.has(cap)));
96058
+ }
96059
+ /**
96060
+ * The HomeKit accessory category per camstack device type — the icon iOS Home
96061
+ * draws and nothing else. Absent = `OTHER`, which is a valid accessory that
96062
+ * simply gets the generic tile.
96063
+ *
96064
+ * This is NOT a coverage decision. `HAP_EXPORTABLE_DEVICE_TYPES` (in
96065
+ * `mappers/index.ts`) filters the picker; whether a device exports anything is
96066
+ * decided by `rowsForCaps`.
96067
+ */
96068
+ var ACCESSORY_CATEGORY_BY_TYPE = {
96069
+ [DeviceType.Switch]: import_dist.Categories.SWITCH,
96070
+ [DeviceType.Light]: import_dist.Categories.LIGHTBULB,
96071
+ [DeviceType.Siren]: import_dist.Categories.SWITCH,
96072
+ [DeviceType.Lock]: import_dist.Categories.DOOR_LOCK,
96073
+ [DeviceType.Sensor]: import_dist.Categories.SENSOR,
96074
+ [DeviceType.Presence]: import_dist.Categories.SENSOR
96075
+ };
96076
+ function accessoryCategoryFor(deviceType) {
96077
+ return ACCESSORY_CATEGORY_BY_TYPE[deviceType] ?? import_dist.Categories.OTHER;
96078
+ }
96079
+ //#endregion
96080
+ //#region src/mappers/generic-accessory.ts
96081
+ /**
96082
+ * Generic accessory orchestrator — every camstack device that is NOT a camera.
96083
+ *
96084
+ * Same three steps as the camera orchestrator, and deliberately nothing more:
96085
+ * 1. resolve the typed `DeviceProxy`,
96086
+ * 2. select rows from the capability→service table with the device's BOUND
96087
+ * capabilities (never its type — see `builders/generic/cap-service-table.ts`),
96088
+ * 3. let each row add its service to one `Accessory`.
96089
+ *
96090
+ * It publishes standalone, like the camera path: one accessory, one mDNS
96091
+ * advertisement, one pairing, the shared setup code. This addon is not a
96092
+ * bridge — that decision predates this file and is not re-litigated here.
96093
+ *
96094
+ * ## It REFUSES rather than publishing an empty tile
96095
+ *
96096
+ * A device whose capabilities select no row throws. The alternative is an
96097
+ * accessory carrying nothing but `AccessoryInformation`: it pairs, it appears
96098
+ * in the Home app, it does nothing, and the operator has no way to tell that
96099
+ * from a broken integration. The Export tab is gated on the same question
96100
+ * (`hap-export.addon.ts`), so reaching this throw means the device changed
96101
+ * shape between the tab rendering and the toggle landing.
96102
+ */
96103
+ async function buildGenericAccessory(input) {
96104
+ const { ctx, deviceId, displayName, options } = input;
96105
+ const numericId = Number.parseInt(deviceId, 10);
96106
+ if (!Number.isFinite(numericId)) throw new Error(`export-hap: cannot map device '${deviceId}' — id is not numeric`);
96107
+ const log = ctx.logger.withTags({ deviceId: numericId });
96108
+ const proxy = await ctx.fetchDevice(numericId);
96109
+ const capNames = new Set(proxy.binding?.entries.map((e) => e.capName) ?? []);
96110
+ const rows = rowsForCaps(capNames);
96111
+ if (rows.length === 0) throw new Error(`export-hap: device ${numericId} carries no capability HomeKit can export (bound: ${[...capNames].toSorted().join(", ") || "none"})`);
96112
+ const deviceType = await resolveDeviceType(proxy);
96113
+ const accessory = new import_dist.Accessory(displayName, accessoryUuidFor("generic", numericId));
96114
+ accessory.category = accessoryCategoryFor(deviceType);
96115
+ await populateAccessoryInfo(accessory, proxy, displayName, "Accessory");
96116
+ const bctx = {
96117
+ ctx,
96118
+ accessory,
96119
+ proxy,
96120
+ numericDeviceId: numericId,
96121
+ displayName,
96122
+ options
96123
+ };
96124
+ const handles = [];
96125
+ for (const row of rows) {
96126
+ const name = rows.length === 1 ? displayName : row.label;
96127
+ handles.push(await row.build({
96128
+ bctx,
96129
+ name,
96130
+ deviceType
96131
+ }));
96132
+ }
96133
+ log.info("export-hap: built generic accessory", { meta: {
96134
+ deviceType,
96135
+ services: rows.map((row) => row.caps[0]).join(",")
96136
+ } });
96137
+ return {
96138
+ accessory,
96139
+ accessories: [accessory],
96140
+ async dispose() {
96141
+ for (const handle of handles) try {
96142
+ await handle.dispose();
96143
+ } catch (err) {
96144
+ log.debug("export-hap: generic builder dispose failed (continuing)", { meta: { error: errMsg$1(err) } });
96145
+ }
96146
+ }
96147
+ };
96148
+ }
96149
+ /**
96150
+ * The device's own type, or `Generic`.
96151
+ *
96152
+ * Used ONLY where one capability has two HomeKit shapes — a siren's
96153
+ * `brightness` is alarm volume, not luminosity — and for the accessory's icon.
96154
+ * `Generic` is the safe reading: it is the shape `child-switch.ts` already
96155
+ * treats as "a lamp if it dims, a switch otherwise".
96156
+ */
96157
+ async function resolveDeviceType(proxy) {
96158
+ try {
96159
+ const device = await proxy.deviceManager?.getDevice({});
96160
+ const raw = typeof device?.type === "string" ? device.type.toLowerCase() : "";
96161
+ return Object.values(DeviceType).find((value) => value === raw) ?? DeviceType.Generic;
96162
+ } catch {
96163
+ return DeviceType.Generic;
96164
+ }
92939
96165
  }
92940
96166
  function errMsg$1(err) {
92941
96167
  return err instanceof Error ? err.message : String(err);
92942
96168
  }
92943
96169
  //#endregion
92944
96170
  //#region src/mappers/index.ts
92945
- var SUPPORTED_MAPPER_KINDS = ["camera"];
92946
- var REGISTRY = { camera: buildCameraAccessory };
96171
+ var REGISTRY = {
96172
+ camera: buildCameraAccessory,
96173
+ generic: buildGenericAccessory
96174
+ };
92947
96175
  function getMapperFactory(kind) {
92948
96176
  const factory = REGISTRY[kind];
92949
96177
  if (!factory) throw new Error(`export-hap: no mapper registered for kind '${kind}'`);
92950
96178
  return factory;
92951
96179
  }
92952
- /**
92953
- * Resolve the best-fit mapper kind. With Round 2, the operator just
92954
- * picks a camera and the orchestrator does the rest — the single
92955
- * `camera` kind is returned unconditionally. We keep the function
92956
- * signature for backwards-compat with the addon's existing
92957
- * `exposeDevice` flow and to leave room for future device types (NVR,
92958
- * climate sensor, ...).
92959
- */
92960
- function pickMapperKind(_capabilities) {
92961
- return "camera";
92962
- }
92963
96180
  //#endregion
92964
96181
  //#region src/mappers/builders/stream-hwaccel-memo.ts
92965
96182
  /**
@@ -93097,8 +96314,8 @@ function syncStateToJson(map) {
93097
96314
  //#endregion
93098
96315
  //#region src/hap-export.addon.ts
93099
96316
  /**
93100
- * HomeKit (HAP) export addon — publishes a single HAP bridge process
93101
- * that exposes selected camstack devices as HomeKit accessories.
96317
+ * HomeKit (HAP) export addon — publishes selected camstack devices as
96318
+ * standalone HomeKit accessories.
93102
96319
  *
93103
96320
  * Operator flow:
93104
96321
  * 1. Install + enable the addon (hub-only, group `export-hap`).
@@ -93109,10 +96326,10 @@ function syncStateToJson(map) {
93109
96326
  * 3. The setup URI (`X-HM://…`) is logged AND surfaced via the
93110
96327
  * `getStatus` cap method so the wizard UI can render the QR.
93111
96328
  * 4. Operator opens iOS Home → + → scan QR → enter pincode.
93112
- * 5. Operator hits "Expose to HomeKit" on individual camstack
93113
- * devices; the addon attaches a MotionSensor accessory (MVP)
93114
- * to the bridge and persists the choice via the same
93115
- * `updateGlobalSettings` path.
96329
+ * 5. Operator hits "Expose to HomeKit" on individual camstack devices.
96330
+ * Each exposed device is published as its OWN accessory with its own
96331
+ * mDNS advertisement, sharing one setup code cameras cannot be
96332
+ * bridged, so nothing is.
93116
96333
  *
93117
96334
  * Exception — the hap-nodejs library's own `HAPStorage` lives under
93118
96335
  * `ctx.dataDir/hap-store/`. That directory is library-internal: the
@@ -93121,23 +96338,20 @@ function syncStateToJson(map) {
93121
96338
  * I/O for addon-owned data") explicitly scopes itself to OUR own data;
93122
96339
  * library-managed blobs are out of scope.
93123
96340
  *
93124
- * Round 2 scope: full camera bridge. `exposeDevice({deviceId})` builds
93125
- * one HomeKit Accessory per camstack camera with auto-detected feature
93126
- * services driven by the device's capability binding:
93127
- * - `camera-streams` cap CameraRTPStreamManagement via ffmpeg
93128
- * - `intercom` cap → Microphone + Speaker (audio bridge wiring is a
93129
- * Round 3 follow-up services are declared so iOS Home shows the
93130
- * talk-back button, but PCM upload is not yet routed)
93131
- * - `doorbell` cap DoorbellController + Doorbell service
93132
- * - `motion-detection` cap MotionSensor service
93133
- * - `ptz` cap preset switches + 4 directional momentary switches
93134
- * - `ptz-autotrack` cap → stateful "Autotrack" switch
93135
- * Children (siren, floodlight, spotlight, …) become independent
93136
- * accessories under the same Bridge see `mappers/child-accessory.ts`.
93137
- *
93138
- * What's deferred to Round 3+: cam→browser audio Opus transcode,
93139
- * intercom upload bridge, HomeKit Secure Video, recording, native
93140
- * H.264 stream tap (currently uses RTSP + ffmpeg copy).
96341
+ * ## Two accessory shapes, one rule about coverage
96342
+ *
96343
+ * `exposeDevice({deviceId})` resolves the device's TYPE to a mapper kind
96344
+ * (`mappers/kind.ts`) and hands off:
96345
+ *
96346
+ * - a camera `mappers/camera-accessory.ts`: streams, HKSV recording,
96347
+ * doorbell, motion, intercom, PTZ, battery, privacy and every accessory
96348
+ * child, all as services on one accessory;
96349
+ * - anything else → `mappers/generic-accessory.ts`, driven by the
96350
+ * capabilityservice table in `mappers/builders/generic/`.
96351
+ *
96352
+ * The type only picks the SHAPE. What a device publishes is decided by the
96353
+ * capabilities bound to itrestricting coverage by type is precisely what
96354
+ * confined this exporter to cameras for its first three rounds.
93141
96355
  */
93142
96356
  var DEFAULT_DEVICE_SETTINGS = {
93143
96357
  streamPreference: "auto",
@@ -93180,7 +96394,6 @@ var DEFAULT_CONFIG = {
93180
96394
  fixedPin: "",
93181
96395
  interfaceName: "",
93182
96396
  ptzPulseMs: 400,
93183
- hksvPreview: false,
93184
96397
  identity: {
93185
96398
  username: "",
93186
96399
  pincode: "",
@@ -93296,7 +96509,7 @@ var ExportHapAddon = class extends BaseAddon {
93296
96509
  ...setup ? { setup } : {}
93297
96510
  };
93298
96511
  },
93299
- listSupportedDeviceKinds: async () => [...SUPPORTED_MAPPER_KINDS],
96512
+ listSupportedDeviceKinds: async () => [...HAP_EXPORTABLE_DEVICE_TYPES],
93300
96513
  listExposedDevices: async () => Array.from(this.exposed.entries()).map(([deviceId, m]) => {
93301
96514
  const entry = this.config.exposed.find((e) => e.deviceId === deviceId);
93302
96515
  return {
@@ -93381,9 +96594,10 @@ var ExportHapAddon = class extends BaseAddon {
93381
96594
  log.debug("export-hap: device already exposed — refreshing capabilities");
93382
96595
  await this.detachMapper(deviceId);
93383
96596
  }
93384
- const mapperKind = pickMapperKind(capabilities);
93385
- if (!mapperKind) throw new Error(`export-hap: no mapper for capabilities ${JSON.stringify(capabilities ?? [])}`);
93386
- const displayName = await this.resolveDisplayName(deviceId);
96597
+ const summary = await this.fetchDeviceSummary(numericId);
96598
+ const mapperKind = pickMapperKind(summary?.type);
96599
+ if (!mapperKind) throw new Error(`export-hap: device ${numericId} has type '${summary?.type ?? "unknown"}', which HomeKit export does not support`);
96600
+ const displayName = summary?.name ?? `Device ${deviceId}`;
93387
96601
  const previous = this.config.exposed.find((e) => e.deviceId === deviceId);
93388
96602
  const baseEntry = carryForward({
93389
96603
  deviceId,
@@ -93413,10 +96627,11 @@ var ExportHapAddon = class extends BaseAddon {
93413
96627
  async unexposeDevice(deviceId, options = {}) {
93414
96628
  const numericId = Number.parseInt(deviceId, 10);
93415
96629
  const log = this.ctx.logger.withTags({ deviceId: numericId });
96630
+ const mapperKind = this.findEntry(numericId)?.mapperKind ?? "camera";
93416
96631
  await this.detachMapper(deviceId);
93417
96632
  const next = this.config.exposed.filter((e) => e.deviceId !== deviceId);
93418
96633
  if (next.length !== this.config.exposed.length) await this.updateGlobalSettings({ exposed: next });
93419
- if (options.clearPairing !== false) clearPairingFiles(import_dist.uuid.generate(`camstack:camera:${numericId}`), this.ctx.logger);
96634
+ if (options.clearPairing !== false) clearPairingFiles(accessoryUuidFor(mapperKind, numericId), this.ctx.logger);
93420
96635
  await this.forgetFingerprint(numericId);
93421
96636
  log.info("export-hap: unexposed device");
93422
96637
  }
@@ -93466,10 +96681,10 @@ var ExportHapAddon = class extends BaseAddon {
93466
96681
  /** Pending rebuild timers per deviceId — used to debounce. Cleared
93467
96682
  * on detach so stale timers can't republish a removed accessory. */
93468
96683
  pendingRebuildTimers = /* @__PURE__ */ new Map();
93469
- /** Deterministic HAP accessory UUID for a device (matches `buildCameraAccessory`
93470
- * and `unexposeDevice`). */
96684
+ /** Deterministic HAP accessory UUID for a device the same one the
96685
+ * orchestrator built it with (`mappers/kind.ts`). */
93471
96686
  hapAccessoryUuid(deviceId) {
93472
- return import_dist.uuid.generate(`camstack:camera:${deviceId}`);
96687
+ return accessoryUuidFor(this.findEntry(deviceId)?.mapperKind ?? "camera", deviceId);
93473
96688
  }
93474
96689
  /**
93475
96690
  * Export fingerprint of a device from its PERSISTED features + type
@@ -93628,31 +96843,79 @@ var ExportHapAddon = class extends BaseAddon {
93628
96843
  log.warn("export-hap: reconcile rebuild failed", { meta: { error: errMsg(err) } });
93629
96844
  }
93630
96845
  }
93631
- async resolveDisplayName(deviceId) {
93632
- const numeric = Number.parseInt(deviceId, 10);
93633
- if (!Number.isFinite(numeric)) return `Device ${deviceId}`;
96846
+ /**
96847
+ * The device's name and type, or `null` when the registry cannot answer.
96848
+ *
96849
+ * `null` is NOT "no such device" — it also covers a transient API failure,
96850
+ * and every caller treats it as "keep doing what was already being done"
96851
+ * rather than re-shaping an exposed accessory on incomplete information.
96852
+ */
96853
+ async fetchDeviceSummary(deviceId) {
96854
+ if (!Number.isFinite(deviceId)) return null;
96855
+ try {
96856
+ const device = await this.ctx.api.deviceManager?.getDevice.query({ deviceId });
96857
+ if (!device) return null;
96858
+ return {
96859
+ name: device.name,
96860
+ type: device.type
96861
+ };
96862
+ } catch (err) {
96863
+ this.ctx.logger.withTags({ deviceId }).debug("export-hap: deviceManager.getDevice failed", { meta: { error: errMsg(err) } });
96864
+ return null;
96865
+ }
96866
+ }
96867
+ /**
96868
+ * Which accessory shape this device would get, or `null` for "no Export tab".
96869
+ *
96870
+ * Two questions, in this order, because they fail differently:
96871
+ * 1. the TYPE — a type with no orchestrator is refused outright;
96872
+ * 2. for a non-camera, the CAPABILITIES — a device carrying nothing the
96873
+ * table maps would publish an accessory that pairs and does nothing, and
96874
+ * the operator cannot tell that from a broken integration.
96875
+ *
96876
+ * A camera skips (2): the camera orchestrator has always published on type
96877
+ * alone, and adding a cap gate here would be a new way for an existing camera
96878
+ * to lose its Export tab. A registry that cannot answer at all also resolves
96879
+ * to `camera`, which is what every persisted entry predating this method
96880
+ * carries.
96881
+ */
96882
+ async resolveExportKind(deviceId) {
96883
+ const summary = await this.fetchDeviceSummary(deviceId);
96884
+ const kind = pickMapperKind(summary?.type);
96885
+ if (kind === null) return null;
96886
+ if (kind === "camera") return "camera";
93634
96887
  try {
93635
- const device = await this.ctx.api.deviceManager?.getDevice.query({ deviceId: numeric });
93636
- if (device?.name) return device.name;
96888
+ const proxy = await this.ctx.fetchDevice(deviceId);
96889
+ const capNames = new Set(proxy.binding?.entries.map((entry) => entry.capName) ?? []);
96890
+ if (rowsForCaps(capNames).length > 0) return "generic";
96891
+ this.ctx.logger.withTags({ deviceId }).debug("export-hap: no Export tab — no mapped caps", { meta: {
96892
+ type: summary?.type,
96893
+ caps: [...capNames].toSorted().join(",")
96894
+ } });
96895
+ return null;
93637
96896
  } catch (err) {
93638
- this.ctx.logger.withTags({ deviceId: numeric }).debug("export-hap: deviceManager.getDevice failed", { meta: { error: errMsg(err) } });
96897
+ this.ctx.logger.withTags({ deviceId }).debug("export-hap: no Export tab — capability read failed", { meta: {
96898
+ type: summary?.type,
96899
+ error: errMsg(err)
96900
+ } });
96901
+ return null;
93639
96902
  }
93640
- return `Device ${deviceId}`;
93641
96903
  }
93642
96904
  globalSettingsSchema() {
93643
96905
  return this.schema({ sections: [{
93644
96906
  id: "export-hap",
93645
96907
  title: "HomeKit Export",
93646
- description: "Publishes a HomeKit bridge. After the addon boots, scan the pairing QR (or enter the setup code) from the Exported devices panel in the iOS Home app. After pairing, mark individual devices as \"Expose to HomeKit\" on each device's settings page.",
96908
+ description: "Publishes each exposed device as its own HomeKit accessory, sharing one setup code. Mark a device \"Expose to HomeKit\" on its settings page, then add it in the iOS Home app (+ Add Accessory) and enter the setup code shown there.",
93647
96909
  columns: 1,
93648
96910
  fields: [
93649
96911
  this.field({
93650
96912
  type: "text",
93651
96913
  key: "bridgeName",
93652
- label: "Bridge name",
93653
- description: "Name shown in iOS Home and in the Bonjour advertisement.",
96914
+ label: "Installation name",
96915
+ description: "Legacy. Every exposed device is published STANDALONE, under its own camstack device name — HomeKit cameras cannot be bridged, so nothing is bridged. This string only seeds the identity generated on first boot and is not shown in iOS Home.",
93654
96916
  default: DEFAULT_CONFIG.bridgeName,
93655
- requiresRestart: true
96917
+ requiresRestart: true,
96918
+ placement: { tab: "advanced" }
93656
96919
  }),
93657
96920
  this.field({
93658
96921
  type: "number",
@@ -93688,21 +96951,13 @@ var ExportHapAddon = class extends BaseAddon {
93688
96951
  description: "Duration of a single pan/tilt momentary command issued by the PTZ direction switches in Apple Home. Lower = finer steps; higher = bigger sweeps per tap. Defaults to 400ms.",
93689
96952
  default: DEFAULT_CONFIG.ptzPulseMs,
93690
96953
  placement: { tab: "advanced" }
93691
- }),
93692
- this.field({
93693
- type: "boolean",
93694
- key: "hksvPreview",
93695
- label: "HKSV Developer Preview (experimental)",
93696
- description: "Advertise Apple's HomeKit Secure Video Developer Preview services — HEVC streaming and the WebRTC stream-management surface — alongside the classic camera profile. Apple published this specification on 2026-06-03 and no shipping controller is known to negotiate it yet. Leave off unless you are testing against a preview build: advertising unknown services to a paired controller can disturb the classic path that works today.",
93697
- default: DEFAULT_CONFIG.hksvPreview,
93698
- requiresRestart: true,
93699
- placement: { tab: "advanced" }
93700
96954
  })
93701
96955
  ]
93702
96956
  }] });
93703
96957
  }
93704
96958
  async buildDeviceSettingsContribution(deviceId) {
93705
- if (!await this.isCameraDevice(deviceId)) return null;
96959
+ const kind = await this.resolveExportKind(deviceId);
96960
+ if (kind === null) return null;
93706
96961
  const entry = this.findEntry(deviceId);
93707
96962
  const settings = entry?.settings ?? DEFAULT_DEVICE_SETTINGS;
93708
96963
  const enabled = entry !== null;
@@ -93719,6 +96974,32 @@ var ExportHapAddon = class extends BaseAddon {
93719
96974
  } catch (err) {
93720
96975
  this.ctx.logger.withTags({ deviceId }).debug("export-hap: setupURI failed for per-device contribution", { meta: { error: errMsg(err) } });
93721
96976
  }
96977
+ const cameraFields = kind !== "camera" ? [] : [{
96978
+ type: "select",
96979
+ key: streamPreferenceKey,
96980
+ label: "Source stream (HomeKit)",
96981
+ description: "Which camstack profile slot HomeKit pulls. Auto = the broker picks the slot closest to 1080p at session start.",
96982
+ options: HAP_STREAM_PREFERENCE_OPTIONS,
96983
+ required: true,
96984
+ value: settings.streamPreference,
96985
+ showWhen: {
96986
+ field: enabledKey,
96987
+ equals: true
96988
+ },
96989
+ immediate: true
96990
+ }, {
96991
+ type: "boolean",
96992
+ key: hksvKey,
96993
+ label: "HomeKit recording (Secure Video)",
96994
+ description: "Offer “Stream and Allow Recording” in iOS Home. Requires iCloud+ and a home hub. Keeps a continuous 8s prebuffer for this camera (~0.7% of one CPU core, H.264 sources only).",
96995
+ style: "switch",
96996
+ value: resolveHksvRecording(settings),
96997
+ showWhen: {
96998
+ field: enabledKey,
96999
+ equals: true
97000
+ },
97001
+ immediate: true
97002
+ }];
93722
97003
  return {
93723
97004
  tabs: [{
93724
97005
  id: "export",
@@ -93729,7 +97010,7 @@ var ExportHapAddon = class extends BaseAddon {
93729
97010
  sections: [{
93730
97011
  id: "export-hap",
93731
97012
  title: "HomeKit Export",
93732
- description: "Mirror this camera into the HomeKit bridge so iOS Home can pair with it.",
97013
+ description: kind === "camera" ? "Publish this camera as its own HomeKit accessory so iOS Home can pair with it." : "Publish this device as its own HomeKit accessory. Its capabilities decide which controls iOS Home shows.",
93733
97014
  tab: "export",
93734
97015
  columns: 1,
93735
97016
  order: 10,
@@ -93745,7 +97026,7 @@ var ExportHapAddon = class extends BaseAddon {
93745
97026
  type: "qr-code",
93746
97027
  key: "__hap-pair-qr",
93747
97028
  label: paired ? "Pairing QR (already paired)" : "Pairing QR",
93748
- caption: paired ? `Already paired with at least one device. Scan from another iPhone / iPad to add it there too. Setup code: ${this.config.identity.pincode}.` : `Scan with the iOS Camera app to pair this camera in HomeKit. Setup code: ${this.config.identity.pincode}.`,
97029
+ caption: paired ? `Already paired with at least one device. Scan from another iPhone / iPad to add it there too. Setup code: ${this.config.identity.pincode}.` : `Scan with the iOS Camera app to pair this accessory in HomeKit. Setup code: ${this.config.identity.pincode}.`,
93749
97030
  value: qrValue,
93750
97031
  size: 192,
93751
97032
  alt: `HomeKit pairing QR for ${name}`,
@@ -93758,38 +97039,12 @@ var ExportHapAddon = class extends BaseAddon {
93758
97039
  type: "boolean",
93759
97040
  key: enabledKey,
93760
97041
  label: "Expose to HomeKit",
93761
- description: "Toggle to publish this camera onto the HAP bridge.",
97042
+ description: "Toggle to publish this device as a HomeKit accessory.",
93762
97043
  style: "switch",
93763
97044
  value: enabled,
93764
97045
  immediate: true
93765
97046
  },
93766
- {
93767
- type: "select",
93768
- key: streamPreferenceKey,
93769
- label: "Source stream (HomeKit)",
93770
- description: "Which camstack profile slot HomeKit pulls. Auto = the broker picks the slot closest to 1080p at session start.",
93771
- options: HAP_STREAM_PREFERENCE_OPTIONS,
93772
- required: true,
93773
- value: settings.streamPreference,
93774
- showWhen: {
93775
- field: enabledKey,
93776
- equals: true
93777
- },
93778
- immediate: true
93779
- },
93780
- {
93781
- type: "boolean",
93782
- key: hksvKey,
93783
- label: "HomeKit recording (Secure Video)",
93784
- description: "Offer “Stream and Allow Recording” in iOS Home. Requires iCloud+ and a home hub. Keeps a continuous 8s prebuffer for this camera (~0.7% of one CPU core, H.264 sources only).",
93785
- style: "switch",
93786
- value: resolveHksvRecording(settings),
93787
- showWhen: {
93788
- field: enabledKey,
93789
- equals: true
93790
- },
93791
- immediate: true
93792
- }
97047
+ ...cameraFields
93793
97048
  ]
93794
97049
  }]
93795
97050
  };
@@ -93855,23 +97110,6 @@ var ExportHapAddon = class extends BaseAddon {
93855
97110
  }
93856
97111
  return { success: true };
93857
97112
  }
93858
- /**
93859
- * Camera-only gate — HomeKit export only knows how to mirror cameras
93860
- * today. Mirrors the snapshot addon's source-side filter so the
93861
- * device-details page doesn't render an "Export" tab on lights /
93862
- * switches / sensors.
93863
- */
93864
- async isCameraDevice(deviceId) {
93865
- const api = this.ctx.api;
93866
- if (!api.deviceManager) return true;
93867
- try {
93868
- const dev = await api.deviceManager.getDevice.query({ deviceId });
93869
- if (!dev) return true;
93870
- return dev.type === DeviceType.Camera;
93871
- } catch {
93872
- return true;
93873
- }
93874
- }
93875
97113
  findEntry(deviceId) {
93876
97114
  const id = String(deviceId);
93877
97115
  return this.config.exposed.find((e) => e.deviceId === id) ?? null;