@camstack/types 1.2.65 → 1.2.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/addon.js +2 -2
  2. package/dist/addon.mjs +2 -2
  3. package/dist/capabilities/air-quality-sensor.cap.d.ts +10 -0
  4. package/dist/capabilities/alarm-panel.cap.d.ts +10 -0
  5. package/dist/capabilities/ambient-light-sensor.cap.d.ts +10 -0
  6. package/dist/capabilities/audio-metrics.cap.d.ts +7 -0
  7. package/dist/capabilities/automation-control.cap.d.ts +7 -0
  8. package/dist/capabilities/battery.cap.d.ts +10 -0
  9. package/dist/capabilities/binary.cap.d.ts +10 -0
  10. package/dist/capabilities/brightness.cap.d.ts +7 -0
  11. package/dist/capabilities/camera-streams.cap.d.ts +7 -0
  12. package/dist/capabilities/capability-definition.d.ts +58 -0
  13. package/dist/capabilities/carbon-monoxide.cap.d.ts +10 -0
  14. package/dist/capabilities/climate-control.cap.d.ts +7 -0
  15. package/dist/capabilities/color.cap.d.ts +7 -0
  16. package/dist/capabilities/connectivity.cap.d.ts +10 -0
  17. package/dist/capabilities/consumables.cap.d.ts +7 -0
  18. package/dist/capabilities/contact.cap.d.ts +10 -0
  19. package/dist/capabilities/control.cap.d.ts +7 -0
  20. package/dist/capabilities/cover.cap.d.ts +10 -0
  21. package/dist/capabilities/day-night.cap.d.ts +10 -0
  22. package/dist/capabilities/device-discovery.cap.d.ts +7 -0
  23. package/dist/capabilities/device-status.cap.d.ts +10 -0
  24. package/dist/capabilities/doorbell.cap.d.ts +7 -0
  25. package/dist/capabilities/enum-sensor.cap.d.ts +10 -0
  26. package/dist/capabilities/event-emitter.cap.d.ts +7 -0
  27. package/dist/capabilities/fan-control.cap.d.ts +7 -0
  28. package/dist/capabilities/feature-probe.cap.d.ts +7 -0
  29. package/dist/capabilities/flood.cap.d.ts +10 -0
  30. package/dist/capabilities/gas.cap.d.ts +10 -0
  31. package/dist/capabilities/humidifier.cap.d.ts +7 -0
  32. package/dist/capabilities/humidity-sensor.cap.d.ts +10 -0
  33. package/dist/capabilities/image-settings.cap.d.ts +10 -0
  34. package/dist/capabilities/image.cap.d.ts +7 -0
  35. package/dist/capabilities/index.d.ts +3 -3
  36. package/dist/capabilities/lawn-mower-control.cap.d.ts +7 -0
  37. package/dist/capabilities/lock-control.cap.d.ts +10 -0
  38. package/dist/capabilities/media-player.cap.d.ts +7 -0
  39. package/dist/capabilities/motion-trigger.cap.d.ts +7 -0
  40. package/dist/capabilities/motion-zones.cap.d.ts +10 -0
  41. package/dist/capabilities/motion.cap.d.ts +7 -0
  42. package/dist/capabilities/native-object-detection.cap.d.ts +10 -0
  43. package/dist/capabilities/notification-output.cap.d.ts +62 -0
  44. package/dist/capabilities/notification-rules.cap.d.ts +134 -6
  45. package/dist/capabilities/notifier.cap.d.ts +7 -0
  46. package/dist/capabilities/numeric-sensor.cap.d.ts +10 -0
  47. package/dist/capabilities/osd-manager.cap.d.ts +14 -0
  48. package/dist/capabilities/pet-feeder.cap.d.ts +7 -0
  49. package/dist/capabilities/power-meter.cap.d.ts +10 -0
  50. package/dist/capabilities/presence.cap.d.ts +10 -0
  51. package/dist/capabilities/pressure-sensor.cap.d.ts +10 -0
  52. package/dist/capabilities/privacy-mask.cap.d.ts +10 -0
  53. package/dist/capabilities/ptz-autotrack.cap.d.ts +7 -0
  54. package/dist/capabilities/scene-monitor.cap.d.ts +7 -0
  55. package/dist/capabilities/script-runner.cap.d.ts +7 -0
  56. package/dist/capabilities/smoke.cap.d.ts +10 -0
  57. package/dist/capabilities/stream-params.cap.d.ts +10 -0
  58. package/dist/capabilities/switch.cap.d.ts +10 -0
  59. package/dist/capabilities/tamper.cap.d.ts +10 -0
  60. package/dist/capabilities/temperature-sensor.cap.d.ts +10 -0
  61. package/dist/capabilities/update.cap.d.ts +7 -0
  62. package/dist/capabilities/vacuum-control.cap.d.ts +7 -0
  63. package/dist/capabilities/valve.cap.d.ts +7 -0
  64. package/dist/capabilities/vibration.cap.d.ts +10 -0
  65. package/dist/capabilities/water-heater.cap.d.ts +7 -0
  66. package/dist/capabilities/weather.cap.d.ts +7 -0
  67. package/dist/capabilities/zone-analytics.cap.d.ts +7 -0
  68. package/dist/capabilities/zone-rules.cap.d.ts +7 -0
  69. package/dist/capabilities/zones.cap.d.ts +7 -0
  70. package/dist/catalogs/coco-classmap.d.ts +21 -0
  71. package/dist/device/system-mirror.d.ts +37 -0
  72. package/dist/generated/runtime-state-durability.d.ts +31 -0
  73. package/dist/index.d.ts +4 -1
  74. package/dist/index.js +1345 -91
  75. package/dist/index.mjs +1322 -92
  76. package/dist/notification/audio-condition.d.ts +118 -0
  77. package/dist/{sleep-BxjBLp3L.mjs → sleep-CSgK0rNX.mjs} +3 -1
  78. package/dist/{sleep-BszXLEvP.js → sleep-Dh1EJSqF.js} +8 -0
  79. package/package.json +1 -1
@@ -181,5 +181,12 @@ export declare const petFeederCapability: {
181
181
  volume: z.ZodNumber;
182
182
  lastFetchedAt: z.ZodNumber;
183
183
  }, z.core.$strip>;
184
+ /**
185
+ * Runtime-state durability: **session** — live appliance state re-published on connect.
186
+ *
187
+ * See `RuntimeStateDurability`. Enforced by
188
+ * `scripts/check-runtime-state-durability.ts`.
189
+ */
190
+ readonly durability: "session";
184
191
  };
185
192
  export type IPetFeederProvider = InferProvider<typeof petFeederCapability>;
@@ -60,5 +60,15 @@ export declare const powerMeterCapability: {
60
60
  unit: z.ZodOptional<z.ZodString>;
61
61
  precision: z.ZodOptional<z.ZodNumber>;
62
62
  }, z.core.$strip>;
63
+ /**
64
+ * Runtime-state durability: **restored** — as `numeric-sensor`; `kwhTotal` is an accumulator whose restored value is the baseline.
65
+ *
66
+ * See `RuntimeStateDurability`. Enforced by
67
+ * `scripts/check-runtime-state-durability.ts`.
68
+ */
69
+ readonly durability: "restored";
70
+ /** Clock fields: written, but excluded from the compare that decides
71
+ * whether persisting is worth a SQLite commit. */
72
+ readonly volatileStateFields: readonly ["lastFetchedAt"];
63
73
  };
64
74
  export type IPowerMeterProvider = InferProvider<typeof powerMeterCapability>;
@@ -73,6 +73,16 @@ export declare const presenceCapability: {
73
73
  batteryPercent: z.ZodNullable<z.ZodNumber>;
74
74
  lastChangedAt: z.ZodNumber;
75
75
  }, z.core.$strip>;
76
+ /**
77
+ * Runtime-state durability: **restored** — occupancy-relevant: the restored state is what an occupancy rule compares the first post-restart observation against.
78
+ *
79
+ * See `RuntimeStateDurability`. Enforced by
80
+ * `scripts/check-runtime-state-durability.ts`.
81
+ */
82
+ readonly durability: "restored";
83
+ /** Clock fields: written, but excluded from the compare that decides
84
+ * whether persisting is worth a SQLite commit. */
85
+ readonly volatileStateFields: readonly ["lastChangedAt"];
76
86
  };
77
87
  export type IPresenceProvider = InferProvider<typeof presenceCapability>;
78
88
  export {};
@@ -38,5 +38,15 @@ export declare const pressureSensorCapability: {
38
38
  unit: z.ZodOptional<z.ZodString>;
39
39
  precision: z.ZodOptional<z.ZodNumber>;
40
40
  }, z.core.$strip>;
41
+ /**
42
+ * Runtime-state durability: **restored** — as `numeric-sensor`.
43
+ *
44
+ * See `RuntimeStateDurability`. Enforced by
45
+ * `scripts/check-runtime-state-durability.ts`.
46
+ */
47
+ readonly durability: "restored";
48
+ /** Clock fields: written, but excluded from the compare that decides
49
+ * whether persisting is worth a SQLite commit. */
50
+ readonly volatileStateFields: readonly ["lastFetchedAt"];
41
51
  };
42
52
  export type IPressureSensorProvider = InferProvider<typeof pressureSensorCapability>;
@@ -243,6 +243,16 @@ export declare const privacyMaskCapability: {
243
243
  audioEnabled: z.ZodNullable<z.ZodBoolean>;
244
244
  lastFetchedAt: z.ZodNumber;
245
245
  }, z.core.$strip>;
246
+ /**
247
+ * Runtime-state durability: **restored** — operator-drawn regions, zero real churn — 22 writes in 25 minutes, every one of them the clock.
248
+ *
249
+ * See `RuntimeStateDurability`. Enforced by
250
+ * `scripts/check-runtime-state-durability.ts`.
251
+ */
252
+ readonly durability: "restored";
253
+ /** Clock fields: written, but excluded from the compare that decides
254
+ * whether persisting is worth a SQLite commit. */
255
+ readonly volatileStateFields: readonly ["lastFetchedAt"];
246
256
  };
247
257
  export type IPrivacyMaskProvider = InferNativeProvider<typeof privacyMaskCapability>;
248
258
  /**
@@ -194,5 +194,12 @@ export declare const ptzAutotrackCapability: {
194
194
  }, z.core.$strip>>;
195
195
  lastFetchedAt: z.ZodNumber;
196
196
  }, z.core.$strip>;
197
+ /**
198
+ * Runtime-state durability: **session** — mirrors the camera's own autotrack config, re-read on connect.
199
+ *
200
+ * See `RuntimeStateDurability`. Enforced by
201
+ * `scripts/check-runtime-state-durability.ts`.
202
+ */
203
+ readonly durability: "session";
197
204
  };
198
205
  export type IPtzAutotrackProvider = InferProvider<typeof ptzAutotrackCapability>;
@@ -479,5 +479,12 @@ export declare const sceneMonitorCapability: {
479
479
  }, z.core.$strip>>;
480
480
  lastFetchedAt: z.ZodNumber;
481
481
  }, z.core.$strip>;
482
+ /**
483
+ * Runtime-state durability: **session** — re-derived from the current scene on the next evaluation.
484
+ *
485
+ * See `RuntimeStateDurability`. Enforced by
486
+ * `scripts/check-runtime-state-durability.ts`.
487
+ */
488
+ readonly durability: "session";
482
489
  };
483
490
  export type ISceneMonitorProvider = InferNativeProvider<typeof sceneMonitorCapability>;
@@ -57,5 +57,12 @@ export declare const scriptRunnerCapability: {
57
57
  lastError: z.ZodNullable<z.ZodString>;
58
58
  lastChangedAt: z.ZodNumber;
59
59
  }, z.core.$strip>;
60
+ /**
61
+ * Runtime-state durability: **session** — a restored `isRunning: true` describes a process that died with the previous hub.
62
+ *
63
+ * See `RuntimeStateDurability`. Enforced by
64
+ * `scripts/check-runtime-state-durability.ts`.
65
+ */
66
+ readonly durability: "session";
60
67
  };
61
68
  export type IScriptRunnerProvider = InferProvider<typeof scriptRunnerCapability>;
@@ -33,5 +33,15 @@ export declare const smokeCapability: {
33
33
  detected: z.ZodBoolean;
34
34
  lastChangedAt: z.ZodNumber;
35
35
  }, z.core.$strip>;
36
+ /**
37
+ * Runtime-state durability: **restored** — a safety sensor must not read "clear" merely because the hub restarted.
38
+ *
39
+ * See `RuntimeStateDurability`. Enforced by
40
+ * `scripts/check-runtime-state-durability.ts`.
41
+ */
42
+ readonly durability: "restored";
43
+ /** Clock fields: written, but excluded from the compare that decides
44
+ * whether persisting is worth a SQLite commit. */
45
+ readonly volatileStateFields: readonly ["lastChangedAt"];
36
46
  };
37
47
  export type ISmokeProvider = InferProvider<typeof smokeCapability>;
@@ -481,6 +481,16 @@ export declare const streamParamsCapability: {
481
481
  }, z.core.$strip>>;
482
482
  lastFetchedAt: z.ZodNumber;
483
483
  }, z.core.$strip>;
484
+ /**
485
+ * Runtime-state durability: **restored** — operator-set encoder profile; mutation-driven.
486
+ *
487
+ * See `RuntimeStateDurability`. Enforced by
488
+ * `scripts/check-runtime-state-durability.ts`.
489
+ */
490
+ readonly durability: "restored";
491
+ /** Clock fields: written, but excluded from the compare that decides
492
+ * whether persisting is worth a SQLite commit. */
493
+ readonly volatileStateFields: readonly ["lastFetchedAt"];
484
494
  };
485
495
  export type IStreamParamsProvider = InferNativeProvider<typeof streamParamsCapability>;
486
496
  export { StreamProfileConfigSchema, StreamProfileOptionsSchema };
@@ -50,6 +50,16 @@ export declare const switchCapability: {
50
50
  on: z.ZodBoolean;
51
51
  lastChangedAt: z.ZodNumber;
52
52
  }, z.core.$strip>;
53
+ /**
54
+ * Runtime-state durability: **restored** — device state an operator reads as authoritative; 55 devices, transition-driven.
55
+ *
56
+ * See `RuntimeStateDurability`. Enforced by
57
+ * `scripts/check-runtime-state-durability.ts`.
58
+ */
59
+ readonly durability: "restored";
60
+ /** Clock fields: written, but excluded from the compare that decides
61
+ * whether persisting is worth a SQLite commit. */
62
+ readonly volatileStateFields: readonly ["lastChangedAt"];
53
63
  readonly settings: {
54
64
  readonly bindings: readonly [{
55
65
  readonly kind: "scalar";
@@ -28,5 +28,15 @@ export declare const tamperCapability: {
28
28
  tampered: z.ZodBoolean;
29
29
  lastChangedAt: z.ZodNumber;
30
30
  }, z.core.$strip>;
31
+ /**
32
+ * Runtime-state durability: **restored** — as `smoke`.
33
+ *
34
+ * See `RuntimeStateDurability`. Enforced by
35
+ * `scripts/check-runtime-state-durability.ts`.
36
+ */
37
+ readonly durability: "restored";
38
+ /** Clock fields: written, but excluded from the compare that decides
39
+ * whether persisting is worth a SQLite commit. */
40
+ readonly volatileStateFields: readonly ["lastChangedAt"];
31
41
  };
32
42
  export type ITamperProvider = InferProvider<typeof tamperCapability>;
@@ -46,5 +46,15 @@ export declare const temperatureSensorCapability: {
46
46
  unit: z.ZodOptional<z.ZodString>;
47
47
  precision: z.ZodOptional<z.ZodNumber>;
48
48
  }, z.core.$strip>;
49
+ /**
50
+ * Runtime-state durability: **restored** — as `numeric-sensor` (69 of 125 writes were the clock alone).
51
+ *
52
+ * See `RuntimeStateDurability`. Enforced by
53
+ * `scripts/check-runtime-state-durability.ts`.
54
+ */
55
+ readonly durability: "restored";
56
+ /** Clock fields: written, but excluded from the compare that decides
57
+ * whether persisting is worth a SQLite commit. */
58
+ readonly volatileStateFields: readonly ["lastFetchedAt"];
49
59
  };
50
60
  export type ITemperatureSensorProvider = InferProvider<typeof temperatureSensorCapability>;
@@ -44,5 +44,12 @@ export declare const updateCapability: {
44
44
  state: z.ZodNullable<z.ZodString>;
45
45
  inProgress: z.ZodBoolean;
46
46
  }, z.core.$strip>;
47
+ /**
48
+ * Runtime-state durability: **session** — a restored `inProgress: true` describes an update that is no longer running; versions are re-probed at boot.
49
+ *
50
+ * See `RuntimeStateDurability`. Enforced by
51
+ * `scripts/check-runtime-state-durability.ts`.
52
+ */
53
+ readonly durability: "session";
47
54
  };
48
55
  export type IUpdateProvider = InferProvider<typeof updateCapability>;
@@ -237,5 +237,12 @@ export declare const vacuumControlCapability: {
237
237
  errorLabel: z.ZodNullable<z.ZodString>;
238
238
  lastChangedAt: z.ZodNumber;
239
239
  }, z.core.$strip>;
240
+ /**
241
+ * Runtime-state durability: **session** — as `media-player` — a restored `state: cleaning` is a robot that is not cleaning.
242
+ *
243
+ * See `RuntimeStateDurability`. Enforced by
244
+ * `scripts/check-runtime-state-durability.ts`.
245
+ */
246
+ readonly durability: "session";
240
247
  };
241
248
  export type IVacuumControlProvider = InferProvider<typeof vacuumControlCapability>;
@@ -88,5 +88,12 @@ export declare const valveCapability: {
88
88
  position: z.ZodNullable<z.ZodNumber>;
89
89
  lastChangedAt: z.ZodNumber;
90
90
  }, z.core.$strip>;
91
+ /**
92
+ * Runtime-state durability: **session** — as `brightness`.
93
+ *
94
+ * See `RuntimeStateDurability`. Enforced by
95
+ * `scripts/check-runtime-state-durability.ts`.
96
+ */
97
+ readonly durability: "session";
91
98
  };
92
99
  export type IValveProvider = InferProvider<typeof valveCapability>;
@@ -28,5 +28,15 @@ export declare const vibrationCapability: {
28
28
  detected: z.ZodBoolean;
29
29
  lastChangedAt: z.ZodNumber;
30
30
  }, z.core.$strip>;
31
+ /**
32
+ * Runtime-state durability: **restored** — as `smoke`.
33
+ *
34
+ * See `RuntimeStateDurability`. Enforced by
35
+ * `scripts/check-runtime-state-durability.ts`.
36
+ */
37
+ readonly durability: "restored";
38
+ /** Clock fields: written, but excluded from the compare that decides
39
+ * whether persisting is worth a SQLite commit. */
40
+ readonly volatileStateFields: readonly ["lastChangedAt"];
31
41
  };
32
42
  export type IVibrationProvider = InferProvider<typeof vibrationCapability>;
@@ -73,5 +73,12 @@ export declare const waterHeaterCapability: {
73
73
  maxTemp: z.ZodNullable<z.ZodNumber>;
74
74
  lastChangedAt: z.ZodNumber;
75
75
  }, z.core.$strip>;
76
+ /**
77
+ * Runtime-state durability: **session** — as `climate-control`.
78
+ *
79
+ * See `RuntimeStateDurability`. Enforced by
80
+ * `scripts/check-runtime-state-durability.ts`.
81
+ */
82
+ readonly durability: "session";
76
83
  };
77
84
  export type IWaterHeaterProvider = InferProvider<typeof waterHeaterCapability>;
@@ -71,5 +71,12 @@ export declare const weatherCapability: {
71
71
  windBearing: z.ZodNullable<z.ZodNumber>;
72
72
  lastFetchedAt: z.ZodNumber;
73
73
  }, z.core.$strip>;
74
+ /**
75
+ * Runtime-state durability: **session** — a forecast is stale the moment the hub is down; the provider re-fetches on connect.
76
+ *
77
+ * See `RuntimeStateDurability`. Enforced by
78
+ * `scripts/check-runtime-state-durability.ts`.
79
+ */
80
+ readonly durability: "session";
74
81
  };
75
82
  export type IWeatherProvider = InferProvider<typeof weatherCapability>;
@@ -284,6 +284,13 @@ export declare const zoneAnalyticsCapability: {
284
284
  keyFrameMediaKey: z.ZodOptional<z.ZodString>;
285
285
  }, z.core.$strip>>>>;
286
286
  }, z.core.$strip>;
287
+ /**
288
+ * Runtime-state durability: **session** — per-frame analytics; with `audio-metrics` it is ~90 % of the offered write rate. Re-derived on the next frame.
289
+ *
290
+ * See `RuntimeStateDurability`. Enforced by
291
+ * `scripts/check-runtime-state-durability.ts`.
292
+ */
293
+ readonly durability: "session";
287
294
  };
288
295
  export type IZoneAnalyticsProvider = InferProvider<typeof zoneAnalyticsCapability>;
289
296
  export { CameraOccupancySnapshotSchema as _CameraOccupancySnapshotSchema, StationaryObjectSchema, HistoryResolutionEnum, HistoryPointSchema, HistoryRangeSchema, ZoneScopeBreakdownSchema, PerScopeBreakdownSchema, };
@@ -149,5 +149,12 @@ export declare const zoneRulesCapability: {
149
149
  enabled: z.ZodDefault<z.ZodBoolean>;
150
150
  }, z.core.$strip>>>;
151
151
  }, z.core.$strip>;
152
+ /**
153
+ * Runtime-state durability: **restored** — operator intent, mutation-only, same argument as `zones`.
154
+ *
155
+ * See `RuntimeStateDurability`. Enforced by
156
+ * `scripts/check-runtime-state-durability.ts`.
157
+ */
158
+ readonly durability: "restored";
152
159
  };
153
160
  export type IZoneRulesProvider = InferProvider<typeof zoneRulesCapability>;
@@ -146,5 +146,12 @@ export declare const zonesCapability: {
146
146
  color: z.ZodDefault<z.ZodString>;
147
147
  }, z.core.$strip>>>;
148
148
  }, z.core.$strip>;
149
+ /**
150
+ * Runtime-state durability: **restored** — written only on operator mutation, so a camera that never had one has nothing to re-derive from. This is the slice `zone-mirror-hydration.ts` exists to paper over.
151
+ *
152
+ * See `RuntimeStateDurability`. Enforced by
153
+ * `scripts/check-runtime-state-durability.ts`.
154
+ */
155
+ readonly durability: "restored";
149
156
  };
150
157
  export type IZonesProvider = InferProvider<typeof zonesCapability>;
@@ -1,4 +1,25 @@
1
1
  import type { LabelDefinition, ClassMapDefinition } from '../types/labels.js';
2
2
  export declare const COCO_80_LABELS: readonly LabelDefinition[];
3
3
  export declare const MACRO_LABELS: readonly LabelDefinition[];
4
+ /**
5
+ * The class names a per-class COUNT can ever be keyed on — the macro ids, and
6
+ * only those.
7
+ *
8
+ * `preserveOriginal: false` below is the whole reason this set exists: the
9
+ * executor maps each raw COCO label onto its macro and DROPS everything else,
10
+ * so a tracked detection's `className` is always one of {@link MACRO_LABELS}.
11
+ * Any surface that indexes counts by class name — the ZoneAnalytics occupancy
12
+ * snapshot's `byClass`, and therefore every occupancy rule — can match nothing
13
+ * else. Derived from the catalog, never hand-listed, so a new macro joins it by
14
+ * being declared once.
15
+ *
16
+ * Cost of not having it, 2026-08-12: the notification rule editor offered the
17
+ * full taxonomy for an occupancy class (occupancy is the one condition that
18
+ * does not go through the engine's macro-expanding `expandClassSelector`), two
19
+ * live rules were authored on `car`, and both counters read 0 forever.
20
+ */
21
+ export declare const DETECTION_MACRO_CLASSES: ReadonlySet<string>;
22
+ /** True when `className` is a macro the detector can actually emit (and hence a
23
+ * class a count can be keyed on) — see {@link DETECTION_MACRO_CLASSES}. */
24
+ export declare function isDetectionMacroClass(className: string): boolean;
4
25
  export declare const COCO_TO_MACRO: ClassMapDefinition;
@@ -54,9 +54,24 @@ import { type SliceHandleApi } from './device-state-handle.js';
54
54
  */
55
55
  export interface SystemMirrorApi extends SliceHandleApi {
56
56
  readonly deviceManager: {
57
+ /**
58
+ * Whole-fleet binding dump. WARM BOOT ONLY — 903 ms and 373 KB on a
59
+ * 524-device hub. Anything on the event path uses `getBindings`.
60
+ */
57
61
  readonly getAllBindings: {
58
62
  query(input: Record<string, never>): Promise<ReadonlyArray<DeviceBinding>>;
59
63
  };
64
+ /**
65
+ * Single-device binding read. Required — `refreshBinding` runs once
66
+ * per `capability.binding-changed` and once per `device.registered`,
67
+ * and a full-fleet fetch there is what turned a 20-device Home
68
+ * Assistant adoption into 166 fleet sweeps (see `refreshBinding`).
69
+ */
70
+ readonly getBindings: {
71
+ query(input: {
72
+ deviceId: number;
73
+ }): Promise<DeviceBinding>;
74
+ };
60
75
  readonly listAll: {
61
76
  query(input: {
62
77
  addonId?: string;
@@ -327,6 +342,28 @@ export declare class SystemMirror {
327
342
  private subscribeBus;
328
343
  private applyStateUpdate;
329
344
  private applyDeviceRemoval;
345
+ /**
346
+ * ONE device's bindings, not the fleet's.
347
+ *
348
+ * This runs on every `capability.binding-changed` AND on every
349
+ * `device.registered`, per mirror. It used to answer that with
350
+ * `getAllBindings` and `.find()` the one row — measured on the live
351
+ * hub (524 devices): 903 ms and 373 KB per call, against 21 ms and
352
+ * 613 bytes for `getBindings({deviceId})`.
353
+ *
354
+ * Adopting 20 Home Assistant devices registers 166 devices (parents +
355
+ * accessories), so an operator with the admin UI open bought 166
356
+ * full-fleet binding sweeps: ~150 s of hub main-thread time inside a
357
+ * 219 s adoption, with every other RPC — including the adoption's own —
358
+ * queued behind them. Same defect, same fix, as `refreshDeviceMetadata`
359
+ * below (`listAll` → `getDevice`).
360
+ *
361
+ * Removal is the destructive direction (every proxy handle a consumer
362
+ * holds goes inert), and an EMPTY binding list is not a claim that the
363
+ * device is gone — a device can legitimately bind nothing. So it needs
364
+ * a second read to agree (D49); `device.unregistered` remains the
365
+ * primary removal path.
366
+ */
330
367
  private refreshBinding;
331
368
  private refreshDeviceMetadata;
332
369
  }
@@ -0,0 +1,31 @@
1
+ import type { RuntimeStateDurability } from '../capabilities/capability-definition.js';
2
+ /** The persistence policy one capability declares for its runtime-state slice. */
3
+ export interface RuntimeStatePolicy {
4
+ /** `'restored'` slices reach disk; `'session'` slices stay in the RAM mirror. */
5
+ readonly durability: RuntimeStateDurability;
6
+ /**
7
+ * Clock fields — persisted, but ignored by the equality test that decides
8
+ * whether a write is worth a SQLite commit. Declared by the cap.
9
+ */
10
+ readonly volatileFields: readonly string[];
11
+ }
12
+ /**
13
+ * Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
14
+ * `runtimeState`. 62 caps: 33 `restored`, 29 `session`.
15
+ *
16
+ * A cap absent from this map has no runtime-state slice at all. A cap PRESENT
17
+ * with `durability: 'session'` has one and has decided not to keep it.
18
+ */
19
+ export declare const RUNTIME_STATE_POLICY: Readonly<Record<string, RuntimeStatePolicy>>;
20
+ /**
21
+ * The policy for `capName`. An UNKNOWN cap resolves to `'session'` — an
22
+ * addon-private slice the codegen has never seen is not persisted until its
23
+ * capability says so, which is the safe direction: the cost of a lost session
24
+ * value is a cold window, the cost of an unasked-for persist is a commit per
25
+ * second on the fleet's busiest write path.
26
+ */
27
+ export declare function runtimeStatePolicyFor(capName: string): RuntimeStatePolicy;
28
+ /** True when this cap's slice is written to disk. */
29
+ export declare function isRestoredCap(capName: string): boolean;
30
+ /** Cap names whose slice survives a restart, sorted. */
31
+ export declare const RESTORED_CAP_NAMES: readonly string[];
package/dist/index.d.ts CHANGED
@@ -119,7 +119,7 @@ export { AutomationActionSchema, AutomationConditionOperatorSchema, AutomationCo
119
119
  export * from './cap-call-context.js';
120
120
  export * from './capabilities/index.js';
121
121
  export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, getAudioMacroClassIds, mapAudioLabelToMacro, YAMNET_TO_MACRO, } from './catalogs/audio-classmap.js';
122
- export { COCO_80_LABELS, COCO_TO_MACRO, MACRO_LABELS, } from './catalogs/coco-classmap.js';
122
+ export { COCO_80_LABELS, COCO_TO_MACRO, DETECTION_MACRO_CLASSES, isDetectionMacroClass, MACRO_LABELS, } from './catalogs/coco-classmap.js';
123
123
  export { DEVICE_STATE_READERS, readDeviceStateFrom, stateVocabularyFor, } from './catalogs/device-state-vocabulary.js';
124
124
  export { colorForKind, DEFAULT_EVENT_COLOR, EVENT_TAXONOMY, type EventTaxonomyCategory, type EventTaxonomyEntry, type EventTaxonomyLevel, getTaxonomyEntry, subKindsOf, TAXONOMY_COLORS, } from './catalogs/event-taxonomy.js';
125
125
  export { buildNcTaxonomy, NC_TAXONOMY, type NcTaxonomy, type NcTaxonomyEntry, NcTaxonomyEntrySchema, NcTaxonomySchema, } from './catalogs/nc-taxonomy.js';
@@ -176,6 +176,8 @@ export { DEVICE_SCOPED_CAPS, isDeviceScopedCap } from './generated/device-scoped
176
176
  export type { MethodAccessRecord } from './generated/method-access-map.js';
177
177
  export { DEVICE_CAP_NAMES, KNOWN_CAP_NAMES, METHOD_ACCESS_MAP, SYSTEM_CAP_NAMES, } from './generated/method-access-map.js';
178
178
  export { CAP_PROVIDER_KIND_MAP, getCapsByProviderKind, PROVIDER_KIND_CAP_NAMES, } from './generated/provider-kind-map.js';
179
+ export type { RuntimeStatePolicy } from './generated/runtime-state-durability.js';
180
+ export { isRestoredCap, RESTORED_CAP_NAMES, RUNTIME_STATE_POLICY, runtimeStatePolicyFor, } from './generated/runtime-state-durability.js';
179
181
  export type { ScopePresetId, ScopePresetSpec } from './generated/scope-presets.js';
180
182
  export { SCOPE_PRESETS } from './generated/scope-presets.js';
181
183
  export type { SystemProxy } from './generated/system-proxy.js';
@@ -184,6 +186,7 @@ export type { AudioCodecInfo, AudioDecodeSessionConfig, AudioEncodedChunk, Audio
184
186
  export type { StreamQuality } from './interfaces/device-capabilities/camera.js';
185
187
  export { STREAM_QUALITY_LABELS, streamQualityLabel, } from './interfaces/device-capabilities/camera.js';
186
188
  export * from './lifecycle/index.js';
189
+ export { audioIsFailClosed, audioLabelChoices, audioOrDefaults, isAudioLabelSelected, NC_AUDIO_DB_MAX, NC_AUDIO_DB_MIN, NC_AUDIO_DB_OFFERED, NC_AUDIO_DB_STEP, NC_AUDIO_DEFAULTS, NC_AUDIO_HIT_PERCENT_MAX, NC_AUDIO_HIT_PERCENT_MIN, NC_AUDIO_SAMPLING_MAX_SEC, NC_AUDIO_SAMPLING_MIN_SEC, type NcAudioLabelChoice, type NcAudioPatch, normalizeAudioLabel, patchAudio, toggleAudioLabel, } from './notification/audio-condition.js';
187
190
  export { isBaseConditionKey, knownValues, NC_BASE_CONDITION_KEYS, type NcBaseConditionKey, pickerForCondition, type TaxonomyGroup, type TaxonomyOption, type TaxonomyPicker, } from './notification/condition-taxonomy.js';
188
191
  export { type PreparedAction, type PreparedAttachment, type PreparedNotification, prepareNotification, type ResolvedLevel, } from './notification/degrade-engine.js';
189
192
  export { htmlToText, markdownToHtmlLite, markdownToText, type NotificationFormat as NotificationBodyFormat, resolveFormat, textToHtml, transcodeBody, } from './notification/format-transcode.js';