@camera.ui/sdk 0.0.21 → 0.0.22

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.
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  type CameraType = 'camera' | 'doorbell';
7
7
  /**
8
8
  * Detection zone intersection type.
9
- * - `intersect`: Trigger when object touches the zone boundary
9
+ * - `intersect`: Trigger when object overlaps the zone at all
10
10
  * - `contain`: Trigger only when object is fully inside the zone
11
11
  */
12
12
  type ZoneType = 'intersect' | 'contain';
@@ -108,7 +108,7 @@ interface CameraInputSettings {
108
108
  useForSnapshot: boolean;
109
109
  /** Keep connection always active */
110
110
  hotMode: boolean;
111
- /** Preload stream on startup */
111
+ /** Keep a keyframe cache for this source, so the view opens faster. Use `hotMode` to keep the stream connected. */
112
112
  preload: boolean;
113
113
  /** Strip the audio track from this source (defaults to false) */
114
114
  muted?: boolean;
@@ -469,7 +469,7 @@ interface JsonBaseSchemaWithoutCallbacks<T extends string | string[] | number |
469
469
  interface JsonBaseSchema<T extends string | string[] | number | number[] | boolean | boolean[] = any> extends JsonBaseSchemaWithoutCallbacks<T> {
470
470
  /** Whether to persist this field to storage */
471
471
  store?: boolean;
472
- /** Callback when value changes */
472
+ /** Callback after a write. `setValue` fires it whether or not the value changed; `setConfig` fires it only for keys that changed. */
473
473
  onSet?: (newValue: any, oldValue: any) => Promise<void>;
474
474
  /** Callback to get computed value */
475
475
  onGet?: () => Promise<any>;
@@ -707,8 +707,9 @@ interface DeviceStorage<T extends Record<string, any> = Record<string, any>> {
707
707
  /**
708
708
  * Get a configuration value.
709
709
  *
710
- * Resolves in order: the schema's `onGet` callback (if any), then the stored
711
- * value, then the schema default, then the provided default.
710
+ * If the schema declares an `onGet` callback, its result is returned as-is,
711
+ * with no fallback. Otherwise resolves in order: the stored value, then the
712
+ * schema default, then the provided default.
712
713
  *
713
714
  * @param key - Configuration key
714
715
  *
@@ -924,7 +925,7 @@ interface ModelSpec {
924
925
  input: VideoInputSpec;
925
926
  /** Labels emitted by an upstream object detector that activate this detector (e.g. `['person']` for face detection). */
926
927
  triggerLabels: DetectionLabel[];
927
- /** Embedding model identifier for face recognition. */
928
+ /** Embedding model identifier. Required for face recognition and for CLIP: embeddings are stored and matched under this id. */
928
929
  embeddingModel?: string;
929
930
  }
930
931
  /**
@@ -1461,8 +1462,9 @@ declare abstract class FaceDetectorSensor<TStorage extends object = Record<strin
1461
1462
  /** Declares the expected input dimensions and trigger labels. The backend scales frames to match. */
1462
1463
  abstract get modelSpec(): ModelSpec;
1463
1464
  /**
1464
- * Detect faces in batch. Each frame is a pre-cropped, pre-scaled person
1465
- * region produced by the upstream object detector. Must return exactly one
1465
+ * Detect faces in batch. Each frame is pre-scaled to `modelSpec.input`:
1466
+ * normally a person region cropped by the upstream object detector, but the
1467
+ * whole scene when no decoded frame is available. Must return exactly one
1466
1468
  * FaceResult per input frame, in the same order.
1467
1469
  */
1468
1470
  abstract detectFaces(frames: VideoFrameData[]): Promise<FaceResult[]>;
@@ -2114,7 +2116,7 @@ declare class MotionSensor<TStorage extends object = Record<string, any>> extend
2114
2116
  }
2115
2117
  /** Return type for {@link MotionDetectorSensor.detectMotion}. */
2116
2118
  interface MotionResult {
2117
- /** Whether motion is detected in this frame. */
2119
+ /** Whether motion is detected in this frame. Ignored by the backend, which re-derives it from the detections. */
2118
2120
  detected: boolean;
2119
2121
  /** Detections emitted for this frame. */
2120
2122
  detections: Detection[];
@@ -2123,7 +2125,9 @@ interface MotionResult {
2123
2125
  * Motion detector that receives video frames from the backend pipeline.
2124
2126
  * Extend this class and implement {@link detectMotion} to analyze frames
2125
2127
  * for motion. The backend calls `detectMotion()` at the configured frame
2126
- * interval and applies the returned result to the sensor.
2128
+ * interval, zone-filters the returned detections and applies them.
2129
+ * `detected` is re-derived from the surviving detections, so a result with
2130
+ * no detections reports no motion.
2127
2131
  */
2128
2132
  declare abstract class MotionDetectorSensor<TStorage extends object = Record<string, any>> extends MotionSensor<TStorage> {
2129
2133
  _requiresFrames: boolean;
@@ -2464,12 +2468,13 @@ declare class PTZControl<TStorage extends object = Record<string, any>> extends
2464
2468
  * Continuous-move command. Override to drive hardware and call
2465
2469
  * `await super.setVelocity(value)` after success to sync the SDK state.
2466
2470
  *
2467
- * @param value - Per-axis speeds in `[-1, 1]`, or `undefined` to stop.
2471
+ * @param value - Per-axis speeds in `[-1, 1]`. Stop is zero on every axis.
2472
+ * `undefined` is ignored and the published `velocity` keeps its last value.
2468
2473
  *
2469
2474
  * @example
2470
2475
  * ```ts
2471
2476
  * await ptz.setVelocity({ panSpeed: 0.5, tiltSpeed: 0, zoomSpeed: 0 });
2472
- * await ptz.setVelocity(undefined); // stop
2477
+ * await ptz.setVelocity({ panSpeed: 0, tiltSpeed: 0, zoomSpeed: 0 }); // stop
2473
2478
  * ```
2474
2479
  */
2475
2480
  setVelocity(value: PTZDirection | undefined): Promise<void>;
@@ -2492,7 +2497,8 @@ declare class PTZControl<TStorage extends object = Record<string, any>> extends
2492
2497
  * Preset-move command. Override to drive hardware and call
2493
2498
  * `await super.setTargetPreset(value)` after success to sync the SDK state.
2494
2499
  *
2495
- * @param value - Preset name to move to, or `undefined` to clear.
2500
+ * @param value - Preset name to move to. `undefined` is ignored and the
2501
+ * published `targetPreset` keeps its last value.
2496
2502
  *
2497
2503
  * @example
2498
2504
  * ```ts
@@ -2535,7 +2541,7 @@ declare class PTZControl<TStorage extends object = Record<string, any>> extends
2535
2541
  * Cross-process consumer entry point. Dispatches writable properties
2536
2542
  * to semantic methods so plugin overrides (hardware actions) are honored.
2537
2543
  * `moving` and `presets` are observed/discovered state and not externally writable;
2538
- * only `Position`, `Velocity`, and `TargetPreset` may be set.
2544
+ * only `Position`, `Velocity`, `TargetPreset`, and `RelativeMove` may be set.
2539
2545
  *
2540
2546
  * @param property - Property name to write.
2541
2547
  *
@@ -3133,7 +3139,7 @@ declare abstract class Sensor<TProperties extends object, TStorage extends objec
3133
3139
  /**
3134
3140
  * Get a read-only snapshot of all property values.
3135
3141
  *
3136
- * @returns Frozen view of every property currently held by the sensor.
3142
+ * @returns Shallow copy of every property currently held by the sensor.
3137
3143
  *
3138
3144
  * @example
3139
3145
  * ```ts
@@ -3214,8 +3220,9 @@ declare abstract class Sensor<TProperties extends object, TStorage extends objec
3214
3220
  * override can safely access `this.cameraId`, `this.storage`, and publish
3215
3221
  * properties via the semantic helper methods.
3216
3222
  *
3217
- * Errors thrown here are caught and logged they will NOT break assignment
3218
- * bookkeeping. If your work can fail, handle it inside the override.
3223
+ * Errors thrown here are caught and swallowed, not logged. They will NOT
3224
+ * break assignment bookkeeping, but nothing surfaces them either. If your
3225
+ * work can fail, handle it inside the override.
3219
3226
  *
3220
3227
  * Paired 1:1 with `onDeassigned` — for every `onAssigned` call there is
3221
3228
  * exactly one matching `onDeassigned` later (on deassignment or cleanup).
@@ -3356,7 +3363,7 @@ interface DetectionLine {
3356
3363
  }
3357
3364
  /**
3358
3365
  * Detection zone configuration.
3359
- * Defines areas for detection filtering or privacy masking.
3366
+ * Defines areas that restrict or drop detections.
3360
3367
  */
3361
3368
  interface DetectionZone {
3362
3369
  /** Zone display name */
@@ -3369,7 +3376,7 @@ interface DetectionZone {
3369
3376
  filter: ZoneFilter;
3370
3377
  /** Labels to filter (empty = all labels) */
3371
3378
  labels: DetectionLabel[];
3372
- /** Whether this is a privacy mask (blur/block area) */
3379
+ /** Whether this is an ignore zone: detections fully inside it are dropped. */
3373
3380
  isPrivacyMask: boolean;
3374
3381
  /** Zone display color (hex) */
3375
3382
  color: string;
@@ -3387,7 +3394,7 @@ interface MotionDetectionSettings {
3387
3394
  * Object detection settings.
3388
3395
  */
3389
3396
  interface ObjectDetectionSettings {
3390
- /** Minimum confidence threshold (0-1) */
3397
+ /** Minimum confidence threshold (0.3 - 1.0) */
3391
3398
  confidence: number;
3392
3399
  /** Suppress events from objects that stay stationary across events (e.g. parked cars). Defaults to true. */
3393
3400
  suppressStatic?: boolean;
@@ -3422,11 +3429,11 @@ interface PtzAutotrackSettings {
3422
3429
  */
3423
3430
  trackingSpeed: number;
3424
3431
  /**
3425
- * Motion prediction: aim this many detection-frames ahead along the target's
3426
- * measured velocity so a moving target is followed without lag. 0 disables
3427
- * prediction. Range 0 - 6.
3432
+ * Motion prediction: aim this many milliseconds ahead along the target's
3433
+ * measured velocity, covering the time the camera needs to move and settle.
3434
+ * 0 disables prediction. Range 0 - 4000.
3428
3435
  */
3429
- leadFrames: number;
3436
+ leadMs: number;
3430
3437
  /**
3431
3438
  * Camera pan-rate calibration — assumed pan travel at full motor speed, in
3432
3439
  * normalized frame-widths per second. Lower it if the camera stops short of
@@ -3919,7 +3926,7 @@ interface CameraInput {
3919
3926
  useForSnapshot: boolean;
3920
3927
  /** Keep connection always active */
3921
3928
  hotMode: boolean;
3922
- /** Preload stream on startup */
3929
+ /** Keep a keyframe cache for this source, so the view opens faster. Use `hotMode` to keep the stream connected. */
3923
3930
  preload: boolean;
3924
3931
  /** Strip the audio track from this source (defaults to false) */
3925
3932
  muted?: boolean;
@@ -4089,7 +4096,6 @@ interface Camera extends BaseCamera {
4089
4096
  * the host) and emits a log entry at the corresponding severity:
4090
4097
  *
4091
4098
  * - log: general informational message (default level).
4092
- * - info: same as log; informational message.
4093
4099
  * - warn: potential problem that does not stop execution.
4094
4100
  * - error: a failure or unexpected condition.
4095
4101
  * - success: confirmation of a completed operation.
@@ -4161,7 +4167,7 @@ interface EventDetection {
4161
4167
  maxCount: number;
4162
4168
  /** Bounding box of the highest-confidence detection (normalized 0–1) */
4163
4169
  box?: BoundingBox;
4164
- /** Best-selected JPEG thumbnail crop. Only present on 'end' events. */
4170
+ /** Best-selected JPEG thumbnail crop. Only present on 'segment-start' and 'segment-end' messages, and omitted when it is the same image as the segment thumbnail. */
4165
4171
  thumbnail?: Uint8Array;
4166
4172
  /** Object tracker ID (links this detection across frames) */
4167
4173
  trackId?: number;
@@ -4178,7 +4184,7 @@ interface EventAttribute {
4178
4184
  label: string;
4179
4185
  /** Detection confidence (0-1) */
4180
4186
  confidence?: number;
4181
- /** Best-selected JPEG thumbnail crop. Only present on 'end' events. */
4187
+ /** Best-selected JPEG thumbnail crop. Present on 'segment-start' and 'segment-end' messages, and on 'segment-update' for unknown faces. */
4182
4188
  thumbnail?: Uint8Array;
4183
4189
  /** Face embedding vector for unknown face persistence. Only present for face attributes. */
4184
4190
  embedding?: number[];
@@ -4199,7 +4205,7 @@ interface EventSegment {
4199
4205
  firstSeen: number;
4200
4206
  /** Segment end time (Unix ms) */
4201
4207
  lastSeen: number;
4202
- /** Best-selected JPEG scene thumbnail for this segment. Only present on 'end' events. */
4208
+ /** Best-selected JPEG scene thumbnail for this segment. Only present on 'segment-start' and 'segment-end' messages, plus once on a 'segment-update' if the start message had none. */
4203
4209
  thumbnail?: Uint8Array;
4204
4210
  /** Object detections in this segment */
4205
4211
  detections: EventDetection[];
@@ -4455,17 +4461,17 @@ interface CameraDevice {
4455
4461
  * @param sensorId - ID of sensor to remove
4456
4462
  */
4457
4463
  removeSensor(sensorId: string): Promise<void>;
4458
- /** Observable for sensor additions. Emits { sensorId, sensorType } when a sensor from another plugin is added. */
4464
+ /** Observable for sensor additions. Emits for this plugin's own sensors and for other plugins' sensors whose type is listed in `contract.consumes`, also when such a sensor is activated for this camera. */
4459
4465
  readonly onSensorAdded: Observable<{
4460
4466
  sensorId: string;
4461
4467
  sensorType: SensorType;
4462
4468
  }>;
4463
- /** Observable for sensor removals. Emits { sensorId, sensorType } when a sensor from another plugin is removed. */
4469
+ /** Observable for sensor removals. Emits for this plugin's own sensors and for other plugins' sensors on this camera, also when a sensor is deactivated for this camera. */
4464
4470
  readonly onSensorRemoved: Observable<{
4465
4471
  sensorId: string;
4466
4472
  sensorType: SensorType;
4467
4473
  }>;
4468
- /** Observable for detection events (start/update/end). Thumbnails in segments are only populated on 'end' events. */
4474
+ /** Observable for detection events (start/update/end/segment-*). Segments are only present on 'segment-*' messages; thumbnails are populated on 'segment-start' and 'segment-end'. */
4469
4475
  readonly onDetectionEvent: Observable<{
4470
4476
  type: DetectionEventType;
4471
4477
  event: DetectionEvent;
@@ -4991,9 +4997,10 @@ interface Notification {
4991
4997
  */
4992
4998
  severity?: Severity;
4993
4999
  /**
4994
- * Collapse-key for dedup at both manager and notifier level (e.g.
4995
- * 'motion:cam-1' — multiple events with the same tag inside the throttle
4996
- * window collapse into one notification on the device).
5000
+ * Collapse-key (e.g. 'motion:cam-1'). The host uses it to replace an older
5001
+ * entry with the same tag in the in-app notification list. Delivery is not
5002
+ * throttled: every publish is sent. Notifiers may map it to a platform
5003
+ * collapse-id.
4997
5004
  */
4998
5005
  tag?: string;
4999
5006
  /** Optional inline JPEG attached to the notification. */
@@ -5324,9 +5331,8 @@ type PluginInterfaces = Partial<MotionDetectionInterface & ObjectDetectionInterf
5324
5331
 
5325
5332
  /**
5326
5333
  * Core manager event payload.
5327
- * Emitted when a core system event occurs (e.g. cloud account changes,
5328
- * remote-server availability, plugin lifecycle changes). Subscribe via
5329
- * `coreManager.onEvent` to react to system-level state changes.
5334
+ * The host currently publishes one event type, 'cloudAccountChanged'.
5335
+ * Subscribe via `coreManager.onEvent` to react to it.
5330
5336
  */
5331
5337
  interface CoreManagerEvent {
5332
5338
  /** Event type identifier (e.g. 'cloudAccountChanged'). */
@@ -5338,8 +5344,8 @@ interface CoreManagerEvent {
5338
5344
  * Core manager interface for system-level operations.
5339
5345
  *
5340
5346
  * Provides access to cross-cutting services like the FFmpeg binary path,
5341
- * server addresses, HMAC signing for cloud requests, inter-plugin lookup,
5342
- * and a stream of core system events.
5347
+ * server addresses, the cloud server id, inter-plugin lookup, and a stream
5348
+ * of core system events.
5343
5349
  *
5344
5350
  * Accessed via `api.coreManager` in plugins.
5345
5351
  *
@@ -5386,7 +5392,9 @@ interface CoreManager {
5386
5392
  */
5387
5393
  getCloudServerId(): Promise<string>;
5388
5394
  /**
5389
- * Get all active plugins that implement a specific interface.
5395
+ * Get all installed, enabled plugins that implement a specific interface.
5396
+ * Plugins the admin disabled are excluded. A returned plugin may still be
5397
+ * starting up or may have crashed, so a call into one can fail.
5390
5398
  *
5391
5399
  * @param interfaceName - Name of the plugin interface (e.g., 'ClipDetection')
5392
5400
  *
@@ -45,7 +45,7 @@ interface ModelSpec {
45
45
  input: VideoInputSpec;
46
46
  /** Labels emitted by an upstream object detector that activate this detector (e.g. `['person']` for face detection). */
47
47
  triggerLabels: DetectionLabel[];
48
- /** Embedding model identifier for face recognition. */
48
+ /** Embedding model identifier. Required for face recognition and for CLIP: embeddings are stored and matched under this id. */
49
49
  embeddingModel?: string;
50
50
  }
51
51
 
@@ -608,7 +608,7 @@ interface CameraInputSettings {
608
608
  useForSnapshot: boolean;
609
609
  /** Keep connection always active */
610
610
  hotMode: boolean;
611
- /** Preload stream on startup */
611
+ /** Keep a keyframe cache for this source, so the view opens faster. Use `hotMode` to keep the stream connected. */
612
612
  preload: boolean;
613
613
  /** Strip the audio track from this source (defaults to false) */
614
614
  muted?: boolean;
@@ -732,7 +732,7 @@ interface EventDetection {
732
732
  maxCount: number;
733
733
  /** Bounding box of the highest-confidence detection (normalized 0–1) */
734
734
  box?: BoundingBox;
735
- /** Best-selected JPEG thumbnail crop. Only present on 'end' events. */
735
+ /** Best-selected JPEG thumbnail crop. Only present on 'segment-start' and 'segment-end' messages, and omitted when it is the same image as the segment thumbnail. */
736
736
  thumbnail?: Uint8Array;
737
737
  /** Object tracker ID (links this detection across frames) */
738
738
  trackId?: number;
@@ -749,7 +749,7 @@ interface EventAttribute {
749
749
  label: string;
750
750
  /** Detection confidence (0-1) */
751
751
  confidence?: number;
752
- /** Best-selected JPEG thumbnail crop. Only present on 'end' events. */
752
+ /** Best-selected JPEG thumbnail crop. Present on 'segment-start' and 'segment-end' messages, and on 'segment-update' for unknown faces. */
753
753
  thumbnail?: Uint8Array;
754
754
  /** Face embedding vector for unknown face persistence. Only present for face attributes. */
755
755
  embedding?: number[];
@@ -770,7 +770,7 @@ interface EventSegment {
770
770
  firstSeen: number;
771
771
  /** Segment end time (Unix ms) */
772
772
  lastSeen: number;
773
- /** Best-selected JPEG scene thumbnail for this segment. Only present on 'end' events. */
773
+ /** Best-selected JPEG scene thumbnail for this segment. Only present on 'segment-start' and 'segment-end' messages, plus once on a 'segment-update' if the start message had none. */
774
774
  thumbnail?: Uint8Array;
775
775
  /** Object detections in this segment */
776
776
  detections: EventDetection[];
@@ -179,7 +179,7 @@ export class Sensor {
179
179
  /**
180
180
  * Get a read-only snapshot of all property values.
181
181
  *
182
- * @returns Frozen view of every property currently held by the sensor.
182
+ * @returns Shallow copy of every property currently held by the sensor.
183
183
  *
184
184
  * @example
185
185
  * ```ts
@@ -305,8 +305,9 @@ export class Sensor {
305
305
  * override can safely access `this.cameraId`, `this.storage`, and publish
306
306
  * properties via the semantic helper methods.
307
307
  *
308
- * Errors thrown here are caught and logged they will NOT break assignment
309
- * bookkeeping. If your work can fail, handle it inside the override.
308
+ * Errors thrown here are caught and swallowed, not logged. They will NOT
309
+ * break assignment bookkeeping, but nothing surfaces them either. If your
310
+ * work can fail, handle it inside the override.
310
311
  *
311
312
  * Paired 1:1 with `onDeassigned` — for every `onAssigned` call there is
312
313
  * exactly one matching `onDeassigned` later (on deassignment or cleanup).
@@ -111,7 +111,9 @@ export class MotionSensor extends Sensor {
111
111
  * Motion detector that receives video frames from the backend pipeline.
112
112
  * Extend this class and implement {@link detectMotion} to analyze frames
113
113
  * for motion. The backend calls `detectMotion()` at the configured frame
114
- * interval and applies the returned result to the sensor.
114
+ * interval, zone-filters the returned detections and applies them.
115
+ * `detected` is re-derived from the surviving detections, so a result with
116
+ * no detections reports no motion.
115
117
  */
116
118
  export class MotionDetectorSensor extends MotionSensor {
117
119
  _requiresFrames = true;
@@ -90,12 +90,13 @@ export class PTZControl extends Sensor {
90
90
  * Continuous-move command. Override to drive hardware and call
91
91
  * `await super.setVelocity(value)` after success to sync the SDK state.
92
92
  *
93
- * @param value - Per-axis speeds in `[-1, 1]`, or `undefined` to stop.
93
+ * @param value - Per-axis speeds in `[-1, 1]`. Stop is zero on every axis.
94
+ * `undefined` is ignored and the published `velocity` keeps its last value.
94
95
  *
95
96
  * @example
96
97
  * ```ts
97
98
  * await ptz.setVelocity({ panSpeed: 0.5, tiltSpeed: 0, zoomSpeed: 0 });
98
- * await ptz.setVelocity(undefined); // stop
99
+ * await ptz.setVelocity({ panSpeed: 0, tiltSpeed: 0, zoomSpeed: 0 }); // stop
99
100
  * ```
100
101
  */
101
102
  async setVelocity(value) {
@@ -122,7 +123,8 @@ export class PTZControl extends Sensor {
122
123
  * Preset-move command. Override to drive hardware and call
123
124
  * `await super.setTargetPreset(value)` after success to sync the SDK state.
124
125
  *
125
- * @param value - Preset name to move to, or `undefined` to clear.
126
+ * @param value - Preset name to move to. `undefined` is ignored and the
127
+ * published `targetPreset` keeps its last value.
126
128
  *
127
129
  * @example
128
130
  * ```ts
@@ -173,7 +175,7 @@ export class PTZControl extends Sensor {
173
175
  * Cross-process consumer entry point. Dispatches writable properties
174
176
  * to semantic methods so plugin overrides (hardware actions) are honored.
175
177
  * `moving` and `presets` are observed/discovered state and not externally writable;
176
- * only `Position`, `Velocity`, and `TargetPreset` may be set.
178
+ * only `Position`, `Velocity`, `TargetPreset`, and `RelativeMove` may be set.
177
179
  *
178
180
  * @param property - Property name to write.
179
181
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/sdk",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "camera.ui sdk",
5
5
  "exports": {
6
6
  ".": {