@camstack/types 1.2.64 → 1.2.66

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 +1 -1
  2. package/dist/addon.mjs +1 -1
  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 +16 -0
  44. package/dist/capabilities/notification-rules.cap.d.ts +35 -3
  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 +2 -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/recording-export.cap.d.ts +17 -6
  55. package/dist/capabilities/scene-monitor.cap.d.ts +7 -0
  56. package/dist/capabilities/script-runner.cap.d.ts +7 -0
  57. package/dist/capabilities/smoke.cap.d.ts +10 -0
  58. package/dist/capabilities/stream-params.cap.d.ts +10 -0
  59. package/dist/capabilities/switch.cap.d.ts +10 -0
  60. package/dist/capabilities/tamper.cap.d.ts +10 -0
  61. package/dist/capabilities/temperature-sensor.cap.d.ts +10 -0
  62. package/dist/capabilities/update.cap.d.ts +7 -0
  63. package/dist/capabilities/vacuum-control.cap.d.ts +7 -0
  64. package/dist/capabilities/valve.cap.d.ts +7 -0
  65. package/dist/capabilities/vibration.cap.d.ts +10 -0
  66. package/dist/capabilities/water-heater.cap.d.ts +7 -0
  67. package/dist/capabilities/weather.cap.d.ts +7 -0
  68. package/dist/capabilities/zone-analytics.cap.d.ts +7 -0
  69. package/dist/capabilities/zone-rules.cap.d.ts +7 -0
  70. package/dist/capabilities/zones.cap.d.ts +7 -0
  71. package/dist/generated/runtime-state-durability.d.ts +31 -0
  72. package/dist/index.d.ts +4 -1
  73. package/dist/index.js +1292 -118
  74. package/dist/index.mjs +1267 -117
  75. package/dist/notification/audio-condition.d.ts +118 -0
  76. package/dist/pipeline/native-lease.d.ts +36 -19
  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
@@ -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>;
@@ -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
@@ -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';
@@ -191,7 +194,7 @@ export { isScheduleActive } from './notification/schedule.js';
191
194
  export type { TimelapseCadencePair, TimelapsePreviewMode, TimelapseRule, TimelapseRuleInput, TimelapseRulePatch, TimelapseTemplate, } from './notification/timelapse-rule.js';
192
195
  export { assertTimelapseCadences, DEFAULT_TIMELAPSE_PREVIEW_TEXT, readTimelapseGeneratedAt, TIMELAPSE_DENSE_FLOOR_SEC, TimelapseRuleInputSchema, TimelapseRulePatchSchema, TimelapseRuleSchema, TimelapseTemplateSchema, } from './notification/timelapse-rule.js';
193
196
  export { DEFAULT_DETAIL_CROP_CONVENTION, DETAIL_CROP_PADDING_FIELD, DETAIL_CROP_PADDING_KEY, DETAIL_CROP_SECTION_ID, DETAIL_CROP_SQUARE_KEY, type DetailCropConvention, DetailCropConventionSchema, type DetailCropRect, deriveDetailCropRect, type HydratedSettingsSection, type HydratedSettingsView, pickDetailCropConvention, readDetailCropConvention, } from './pipeline/detail-crop.js';
194
- export { DEFAULT_NATIVE_LEASE_SETTINGS, NATIVE_LEASE_ACTIVITY_FIELD, NATIVE_LEASE_ACTIVITY_KEY, NATIVE_LEASE_ADMISSION_FIELD, NATIVE_LEASE_ADMISSION_KEY, NATIVE_LEASE_BUDGET_FIELD, NATIVE_LEASE_BUDGET_KEY, NATIVE_LEASE_SECTION_ID, NATIVE_LEASE_TTL_FIELD, NATIVE_LEASE_TTL_KEY, type NativeLeaseAdmission, NativeLeaseAdmissionSchema, type NativeLeaseKnob, type NativeLeaseNumberKnob, type NativeLeaseSettings, type NativeLeaseSettingsOverride, NativeLeaseSettingsSchema, pickNativeLeaseOverride, readNativeLeaseOverride, } from './pipeline/native-lease.js';
197
+ export { DEFAULT_NATIVE_LEASE_SETTINGS, NATIVE_LEASE_ACTIVITY_FIELD, NATIVE_LEASE_ACTIVITY_KEY, NATIVE_LEASE_ADMISSION_FIELD, NATIVE_LEASE_ADMISSION_KEY, NATIVE_LEASE_BUDGET_FIELD, NATIVE_LEASE_BUDGET_KEY, NATIVE_LEASE_HOLD_FIELD, NATIVE_LEASE_HOLD_KEY, NATIVE_LEASE_SECTION_ID, NATIVE_LEASE_TILE_BUDGET_FIELD, NATIVE_LEASE_TILE_BUDGET_KEY, type NativeLeaseAdmission, NativeLeaseAdmissionSchema, type NativeLeaseKnob, type NativeLeaseNumberKnob, type NativeLeaseSettings, type NativeLeaseSettingsOverride, NativeLeaseSettingsSchema, pickNativeLeaseOverride, readNativeLeaseOverride, } from './pipeline/native-lease.js';
195
198
  export { type ApiKeyRecord, ApiKeyRecordSchema, type CapScope, CapScopeSchema, type MethodAccess, MethodAccessSchema, type ScopedToken, ScopedTokenSchema, type TokenScope, TokenScopeSchema, type UserRecord, UserRecordSchema, } from './schemas/auth-records.js';
196
199
  export type { CameraDetectionCapabilities, CameraMotionConfig, CameraNativeDetectionConfig, } from './types/camera-detection.js';
197
200
  export { DEVICE_TYPE_INFO, type DeviceTypeInfo } from './types/device-type.js';