@camera.ui/sdk 0.0.20 → 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;
@@ -2339,7 +2343,13 @@ declare enum PTZCapability {
2339
2343
  /** Camera supports named position presets */
2340
2344
  Presets = "presets",
2341
2345
  /** Camera supports a home position */
2342
- Home = "home"
2346
+ Home = "home",
2347
+ /** Camera executes relative displacement moves */
2348
+ RelativeMove = "relativeMove",
2349
+ /** Camera accepts absolute position writes via `setPosition()` */
2350
+ AbsolutePosition = "absolutePosition",
2351
+ /** Camera accepts continuous-move commands via `setVelocity()` */
2352
+ VelocityControl = "velocityControl"
2343
2353
  }
2344
2354
  /**
2345
2355
  * Properties for PTZ controls
@@ -2356,7 +2366,9 @@ declare enum PTZProperty {
2356
2366
  /** Current movement velocity (continuous move) */
2357
2367
  Velocity = "velocity",
2358
2368
  /** Target preset to move to */
2359
- TargetPreset = "targetPreset"
2369
+ TargetPreset = "targetPreset",
2370
+ /** Relative displacement move command (write-only) */
2371
+ RelativeMove = "relativeMove"
2360
2372
  }
2361
2373
  /** Absolute PTZ position */
2362
2374
  interface PTZPosition {
@@ -2381,6 +2393,20 @@ interface PTZDirection {
2381
2393
  tiltSpeed: number;
2382
2394
  zoomSpeed: number;
2383
2395
  }
2396
+ /**
2397
+ * Relative displacement for a single PTZ move.
2398
+ *
2399
+ * Deltas are normalized to the camera's field of view: `panDelta: 1` moves the
2400
+ * view by one full frame width, `tiltDelta: 1` by one full frame height.
2401
+ * Conventions match {@link PTZDirection}: positive `panDelta` = right,
2402
+ * positive `tiltDelta` = up, positive `zoomDelta` = zoom in. Plugins map the
2403
+ * deltas to hardware-specific translation spaces (e.g. ONVIF RelativeMove).
2404
+ */
2405
+ interface PTZRelativeMove {
2406
+ panDelta: number;
2407
+ tiltDelta: number;
2408
+ zoomDelta: number;
2409
+ }
2384
2410
  /**
2385
2411
  * Property value map for PTZ controls.
2386
2412
  *
@@ -2392,6 +2418,7 @@ interface PTZControlProperties {
2392
2418
  [PTZProperty.Presets]: string[];
2393
2419
  [PTZProperty.Velocity]?: PTZDirection;
2394
2420
  [PTZProperty.TargetPreset]?: string;
2421
+ [PTZProperty.RelativeMove]?: PTZRelativeMove;
2395
2422
  }
2396
2423
  /** Read-only proxy interface for a PTZ control */
2397
2424
  interface PTZControlLike extends SensorLike {
@@ -2403,6 +2430,7 @@ interface PTZControlLike extends SensorLike {
2403
2430
  getValue(property: PTZProperty.Presets): string[] | undefined;
2404
2431
  getValue(property: PTZProperty.Velocity): PTZDirection | undefined;
2405
2432
  getValue(property: PTZProperty.TargetPreset): string | undefined;
2433
+ getValue(property: PTZProperty.RelativeMove): PTZRelativeMove | undefined;
2406
2434
  getValue(property: string): unknown;
2407
2435
  }
2408
2436
  /**
@@ -2440,20 +2468,37 @@ declare class PTZControl<TStorage extends object = Record<string, any>> extends
2440
2468
  * Continuous-move command. Override to drive hardware and call
2441
2469
  * `await super.setVelocity(value)` after success to sync the SDK state.
2442
2470
  *
2443
- * @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.
2444
2473
  *
2445
2474
  * @example
2446
2475
  * ```ts
2447
2476
  * await ptz.setVelocity({ panSpeed: 0.5, tiltSpeed: 0, zoomSpeed: 0 });
2448
- * await ptz.setVelocity(undefined); // stop
2477
+ * await ptz.setVelocity({ panSpeed: 0, tiltSpeed: 0, zoomSpeed: 0 }); // stop
2449
2478
  * ```
2450
2479
  */
2451
2480
  setVelocity(value: PTZDirection | undefined): Promise<void>;
2481
+ /**
2482
+ * Relative displacement move. Override to drive hardware (e.g. ONVIF
2483
+ * RelativeMove in a translation space) and call
2484
+ * `await super.setRelativeMove(value)` after success to sync the SDK state.
2485
+ * Advertise {@link PTZCapability.RelativeMove} when the camera supports it.
2486
+ *
2487
+ * @param value - Per-axis displacement, normalized to the field of view.
2488
+ *
2489
+ * @example
2490
+ * ```ts
2491
+ * // move the view a third of a frame to the right, a tenth down
2492
+ * await ptz.setRelativeMove({ panDelta: 0.33, tiltDelta: -0.1, zoomDelta: 0 });
2493
+ * ```
2494
+ */
2495
+ setRelativeMove(value: PTZRelativeMove): Promise<void>;
2452
2496
  /**
2453
2497
  * Preset-move command. Override to drive hardware and call
2454
2498
  * `await super.setTargetPreset(value)` after success to sync the SDK state.
2455
2499
  *
2456
- * @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.
2457
2502
  *
2458
2503
  * @example
2459
2504
  * ```ts
@@ -2496,7 +2541,7 @@ declare class PTZControl<TStorage extends object = Record<string, any>> extends
2496
2541
  * Cross-process consumer entry point. Dispatches writable properties
2497
2542
  * to semantic methods so plugin overrides (hardware actions) are honored.
2498
2543
  * `moving` and `presets` are observed/discovered state and not externally writable;
2499
- * only `Position`, `Velocity`, and `TargetPreset` may be set.
2544
+ * only `Position`, `Velocity`, `TargetPreset`, and `RelativeMove` may be set.
2500
2545
  *
2501
2546
  * @param property - Property name to write.
2502
2547
  *
@@ -3094,7 +3139,7 @@ declare abstract class Sensor<TProperties extends object, TStorage extends objec
3094
3139
  /**
3095
3140
  * Get a read-only snapshot of all property values.
3096
3141
  *
3097
- * @returns Frozen view of every property currently held by the sensor.
3142
+ * @returns Shallow copy of every property currently held by the sensor.
3098
3143
  *
3099
3144
  * @example
3100
3145
  * ```ts
@@ -3175,8 +3220,9 @@ declare abstract class Sensor<TProperties extends object, TStorage extends objec
3175
3220
  * override can safely access `this.cameraId`, `this.storage`, and publish
3176
3221
  * properties via the semantic helper methods.
3177
3222
  *
3178
- * Errors thrown here are caught and logged they will NOT break assignment
3179
- * 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.
3180
3226
  *
3181
3227
  * Paired 1:1 with `onDeassigned` — for every `onAssigned` call there is
3182
3228
  * exactly one matching `onDeassigned` later (on deassignment or cleanup).
@@ -3317,7 +3363,7 @@ interface DetectionLine {
3317
3363
  }
3318
3364
  /**
3319
3365
  * Detection zone configuration.
3320
- * Defines areas for detection filtering or privacy masking.
3366
+ * Defines areas that restrict or drop detections.
3321
3367
  */
3322
3368
  interface DetectionZone {
3323
3369
  /** Zone display name */
@@ -3330,7 +3376,7 @@ interface DetectionZone {
3330
3376
  filter: ZoneFilter;
3331
3377
  /** Labels to filter (empty = all labels) */
3332
3378
  labels: DetectionLabel[];
3333
- /** Whether this is a privacy mask (blur/block area) */
3379
+ /** Whether this is an ignore zone: detections fully inside it are dropped. */
3334
3380
  isPrivacyMask: boolean;
3335
3381
  /** Zone display color (hex) */
3336
3382
  color: string;
@@ -3348,7 +3394,7 @@ interface MotionDetectionSettings {
3348
3394
  * Object detection settings.
3349
3395
  */
3350
3396
  interface ObjectDetectionSettings {
3351
- /** Minimum confidence threshold (0-1) */
3397
+ /** Minimum confidence threshold (0.3 - 1.0) */
3352
3398
  confidence: number;
3353
3399
  /** Suppress events from objects that stay stationary across events (e.g. parked cars). Defaults to true. */
3354
3400
  suppressStatic?: boolean;
@@ -3383,11 +3429,11 @@ interface PtzAutotrackSettings {
3383
3429
  */
3384
3430
  trackingSpeed: number;
3385
3431
  /**
3386
- * Motion prediction: aim this many detection-frames ahead along the target's
3387
- * measured velocity so a moving target is followed without lag. 0 disables
3388
- * 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.
3389
3435
  */
3390
- leadFrames: number;
3436
+ leadMs: number;
3391
3437
  /**
3392
3438
  * Camera pan-rate calibration — assumed pan travel at full motor speed, in
3393
3439
  * normalized frame-widths per second. Lower it if the camera stops short of
@@ -3880,7 +3926,7 @@ interface CameraInput {
3880
3926
  useForSnapshot: boolean;
3881
3927
  /** Keep connection always active */
3882
3928
  hotMode: boolean;
3883
- /** Preload stream on startup */
3929
+ /** Keep a keyframe cache for this source, so the view opens faster. Use `hotMode` to keep the stream connected. */
3884
3930
  preload: boolean;
3885
3931
  /** Strip the audio track from this source (defaults to false) */
3886
3932
  muted?: boolean;
@@ -4050,7 +4096,6 @@ interface Camera extends BaseCamera {
4050
4096
  * the host) and emits a log entry at the corresponding severity:
4051
4097
  *
4052
4098
  * - log: general informational message (default level).
4053
- * - info: same as log; informational message.
4054
4099
  * - warn: potential problem that does not stop execution.
4055
4100
  * - error: a failure or unexpected condition.
4056
4101
  * - success: confirmation of a completed operation.
@@ -4122,7 +4167,7 @@ interface EventDetection {
4122
4167
  maxCount: number;
4123
4168
  /** Bounding box of the highest-confidence detection (normalized 0–1) */
4124
4169
  box?: BoundingBox;
4125
- /** 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. */
4126
4171
  thumbnail?: Uint8Array;
4127
4172
  /** Object tracker ID (links this detection across frames) */
4128
4173
  trackId?: number;
@@ -4139,7 +4184,7 @@ interface EventAttribute {
4139
4184
  label: string;
4140
4185
  /** Detection confidence (0-1) */
4141
4186
  confidence?: number;
4142
- /** 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. */
4143
4188
  thumbnail?: Uint8Array;
4144
4189
  /** Face embedding vector for unknown face persistence. Only present for face attributes. */
4145
4190
  embedding?: number[];
@@ -4160,7 +4205,7 @@ interface EventSegment {
4160
4205
  firstSeen: number;
4161
4206
  /** Segment end time (Unix ms) */
4162
4207
  lastSeen: number;
4163
- /** 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. */
4164
4209
  thumbnail?: Uint8Array;
4165
4210
  /** Object detections in this segment */
4166
4211
  detections: EventDetection[];
@@ -4416,17 +4461,17 @@ interface CameraDevice {
4416
4461
  * @param sensorId - ID of sensor to remove
4417
4462
  */
4418
4463
  removeSensor(sensorId: string): Promise<void>;
4419
- /** 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. */
4420
4465
  readonly onSensorAdded: Observable<{
4421
4466
  sensorId: string;
4422
4467
  sensorType: SensorType;
4423
4468
  }>;
4424
- /** 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. */
4425
4470
  readonly onSensorRemoved: Observable<{
4426
4471
  sensorId: string;
4427
4472
  sensorType: SensorType;
4428
4473
  }>;
4429
- /** 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'. */
4430
4475
  readonly onDetectionEvent: Observable<{
4431
4476
  type: DetectionEventType;
4432
4477
  event: DetectionEvent;
@@ -4952,9 +4997,10 @@ interface Notification {
4952
4997
  */
4953
4998
  severity?: Severity;
4954
4999
  /**
4955
- * Collapse-key for dedup at both manager and notifier level (e.g.
4956
- * 'motion:cam-1' — multiple events with the same tag inside the throttle
4957
- * 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.
4958
5004
  */
4959
5005
  tag?: string;
4960
5006
  /** Optional inline JPEG attached to the notification. */
@@ -5285,9 +5331,8 @@ type PluginInterfaces = Partial<MotionDetectionInterface & ObjectDetectionInterf
5285
5331
 
5286
5332
  /**
5287
5333
  * Core manager event payload.
5288
- * Emitted when a core system event occurs (e.g. cloud account changes,
5289
- * remote-server availability, plugin lifecycle changes). Subscribe via
5290
- * `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.
5291
5336
  */
5292
5337
  interface CoreManagerEvent {
5293
5338
  /** Event type identifier (e.g. 'cloudAccountChanged'). */
@@ -5299,8 +5344,8 @@ interface CoreManagerEvent {
5299
5344
  * Core manager interface for system-level operations.
5300
5345
  *
5301
5346
  * Provides access to cross-cutting services like the FFmpeg binary path,
5302
- * server addresses, HMAC signing for cloud requests, inter-plugin lookup,
5303
- * 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.
5304
5349
  *
5305
5350
  * Accessed via `api.coreManager` in plugins.
5306
5351
  *
@@ -5347,7 +5392,9 @@ interface CoreManager {
5347
5392
  */
5348
5393
  getCloudServerId(): Promise<string>;
5349
5394
  /**
5350
- * 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.
5351
5398
  *
5352
5399
  * @param interfaceName - Name of the plugin interface (e.g., 'ClipDetection')
5353
5400
  *
@@ -5796,4 +5843,4 @@ interface OAuthClientCredentialsCapable extends OAuthCapable {
5796
5843
  }
5797
5844
 
5798
5845
  export { API_EVENT, AudioDetectorSensor, AudioProperty, AudioSensor, BASE_AUDIO_LABELS, BasePlugin, BatteryCapability, BatteryInfo, BatteryProperty, BehaviorSubject, ChargingState, ClassifierDetectorSensor, ClassifierProperty, ClassifierSensor, ClipDetectorSensor, ContactProperty, ContactSensor, DETECTION_ATTRIBUTES, DETECTION_LABELS, Disposable, DoorbellProperty, DoorbellTrigger, EVENT_TRIGGER_TYPES, FaceDetectorSensor, FaceProperty, FaceSensor, GarageControl, GarageProperty, GarageState, HumidityInfo, HumidityProperty, LeakProperty, LeakSensor, LicensePlateDetectorSensor, LicensePlateProperty, LicensePlateSensor, LightCapability, LightControl, LightProperty, LockControl, LockProperty, LockState, MotionDetectorSensor, MotionProperty, MotionSensor, ObjectDetectorSensor, ObjectProperty, ObjectSensor, Observable, OccupancyProperty, OccupancySensor, PTZCapability, PTZControl, PTZProperty, PluginCapability, PluginInterface, PluginRole, RING_AUTO_RESET_MS, ReplaySubject, RtpPacket, SecuritySystem, SecuritySystemProperty, SecuritySystemState, Sensor, SensorCategory, SensorType, Severity, SirenCapability, SirenControl, SirenProperty, SmokeProperty, SmokeSensor, Subject, SwitchControl, SwitchProperty, TemperatureInfo, TemperatureProperty, canCreateCameras, canProvideSensorsToAnyCameras, distinctUntilChanged, filter, firstValueFrom, getContractValidationErrors, hasCapability, hasInterface, isHub, map, mergeMap, pairwise, share, validateContractConsistency };
5799
- export type { AssignedPlugin, AudioCodec, AudioCodecProperties, AudioDetectionInterface, AudioDetectionPluginResponse, AudioDetectionSettings, AudioFFmpegCodec, AudioFrameData, AudioInputSpec, AudioLabel, AudioMetadata, AudioModelSpec, AudioResult, AudioSensorLike, AudioSensorProperties, AudioStreamInfo, BaseAudioLabel, BaseCamera, BaseCameraConfig, BatteryInfoLike, BatteryInfoProperties, BoundingBox, Camera, CameraAspectRatio, CameraConfig, CameraConfigInputSettings, CameraDetectionSettings, CameraDevice, CameraDeviceSource, CameraFrameWorkerSettings, CameraImplementation, CameraInformation, CameraInput, CameraPluginInfo, CameraRole, CameraSource, CameraType, CameraUiSettings, ClassifierDetection, ClassifierDetectionInterface, ClassifierDetectionPluginResponse, ClassifierResult, ClassifierSensorLike, ClassifierSensorProperties, ClipDetectionInterface, ClipDetectionPluginResponse, ClipEmbedding, ClipResult, ClipTextEmbeddingResult, ContactSensorLike, ContactSensorProperties, CoreManager, CoreManagerEvent, CreateDownloadOptions, CreateStreamDownloadOptions, Detection, DetectionAttribute, DetectionEvent, DetectionEventState, DetectionEventType, DetectionLabel, DetectionLine, DetectionZone, DeviceManager, DeviceStorage, DiscoveredCamera, DiscoveryProvider, DoorbellTriggerLike, DoorbellTriggerProperties, DownloadCleanup, DownloadManager, DownloadToken, EventAttribute, EventDescription, EventDetection, EventSegment, EventTrigger, EventTriggerType, FMTPInfo, FaceDetection, FaceDetectionInterface, FaceDetectionPluginResponse, FaceResult, FaceSensorLike, FaceSensorProperties, Fmp4Session, Fmp4SessionOptions, FormSubmitResponse, FormSubmitSchema, GarageControlLike, GarageControlProperties, Go2RtcRTSPSource, Go2RtcSnapshotSource, Go2RtcWSSource, HardwareAcceleration, HumidityInfoLike, HumidityInfoProperties, ImageMetadata, JsonArraySchema, JsonBaseSchema, JsonBaseSchemaWithoutCallbacks, JsonBooleanSchema, JsonEnumSchema, JsonFactorySchema, JsonNumberSchema, JsonSchema, JsonSchemaArray, JsonSchemaArrayWithoutCallbacks, JsonSchemaBoolean, JsonSchemaBooleanWithoutCallbacks, JsonSchemaButton, JsonSchemaEnum, JsonSchemaEnumWithoutCallbacks, JsonSchemaNumber, JsonSchemaNumberWithoutCallbacks, JsonSchemaString, JsonSchemaStringWithoutCallbacks, JsonSchemaSubmit, JsonSchemaType, JsonSchemaWithoutCallbacks, JsonSchemaWithoutKey, JsonStringSchema, LeakSensorLike, LeakSensorProperties, LicensePlateDetection, LicensePlateDetectionInterface, LicensePlateDetectionPluginResponse, LicensePlateResult, LicensePlateSensorLike, LicensePlateSensorProperties, LightControlLike, LightControlProperties, LineDirection, LockControlLike, LockControlProperties, LoggerService, ModelSpec, MotionDetectionInterface, MotionDetectionPluginResponse, MotionDetectionSettings, MotionResolution, MotionResult, MotionSensorLike, MotionSensorProperties, Notification, NotificationManager, NotifierDevice, NotifierInterface, OAuthAuthCodeFlowCapable, OAuthCapable, OAuthClientCredentialsCapable, OAuthDeviceFlowCapable, OAuthMetadata, OAuthProviderConfig, OAuthProviderDeclaration, OAuthState, OAuthStatus, ObjectDetectionInterface, ObjectDetectionPluginResponse, ObjectDetectionSettings, ObjectModelSpec, ObjectResult, ObjectSensorLike, ObjectSensorProperties, OccupancySensorLike, OccupancySensorProperties, OperatorFn, PTZControlLike, PTZControlProperties, PTZDirection, PTZPosition, PluginAPI, PluginAssignments, PluginConfig, PluginContract, PluginInfo, PluginInterfaces, Point, ProbeAudioCodec, ProbeConfig, ProbeStream, PropertyChangeOf, PtzAutotrackSettings, PythonVersion, RTPInfo, RTSPAudioCodec, RTSPUrlOptions, RtpSession, RtpSessionBackchannelOptions, RtpSessionOptions, SchemaCondition, SchemaConditionOperator, SchemaConfig, SecuritySystemLike, SecuritySystemProperties, SensorCapability, SensorLike, SensorPropertyType, SensorTriggerRef, SensorTriggerSettings, SirenControlLike, SirenControlProperties, SmokeSensorLike, SmokeSensorProperties, SnapshotInterface, SnapshotSettings, SnapshotUrlOptions, StreamDirection, StreamUrls, StreamingInterface, StreamingRole, SwitchControlLike, SwitchControlProperties, TemperatureInfoLike, TemperatureInfoProperties, ToastMessage, TrackedDetection, VideoCodec, VideoCodecProperties, VideoFFmpegCodec, VideoFrameData, VideoInputSpec, VideoStreamInfo, VideoStreamingMode, ZoneFilter, ZoneType };
5846
+ export type { AssignedPlugin, AudioCodec, AudioCodecProperties, AudioDetectionInterface, AudioDetectionPluginResponse, AudioDetectionSettings, AudioFFmpegCodec, AudioFrameData, AudioInputSpec, AudioLabel, AudioMetadata, AudioModelSpec, AudioResult, AudioSensorLike, AudioSensorProperties, AudioStreamInfo, BaseAudioLabel, BaseCamera, BaseCameraConfig, BatteryInfoLike, BatteryInfoProperties, BoundingBox, Camera, CameraAspectRatio, CameraConfig, CameraConfigInputSettings, CameraDetectionSettings, CameraDevice, CameraDeviceSource, CameraFrameWorkerSettings, CameraImplementation, CameraInformation, CameraInput, CameraPluginInfo, CameraRole, CameraSource, CameraType, CameraUiSettings, ClassifierDetection, ClassifierDetectionInterface, ClassifierDetectionPluginResponse, ClassifierResult, ClassifierSensorLike, ClassifierSensorProperties, ClipDetectionInterface, ClipDetectionPluginResponse, ClipEmbedding, ClipResult, ClipTextEmbeddingResult, ContactSensorLike, ContactSensorProperties, CoreManager, CoreManagerEvent, CreateDownloadOptions, CreateStreamDownloadOptions, Detection, DetectionAttribute, DetectionEvent, DetectionEventState, DetectionEventType, DetectionLabel, DetectionLine, DetectionZone, DeviceManager, DeviceStorage, DiscoveredCamera, DiscoveryProvider, DoorbellTriggerLike, DoorbellTriggerProperties, DownloadCleanup, DownloadManager, DownloadToken, EventAttribute, EventDescription, EventDetection, EventSegment, EventTrigger, EventTriggerType, FMTPInfo, FaceDetection, FaceDetectionInterface, FaceDetectionPluginResponse, FaceResult, FaceSensorLike, FaceSensorProperties, Fmp4Session, Fmp4SessionOptions, FormSubmitResponse, FormSubmitSchema, GarageControlLike, GarageControlProperties, Go2RtcRTSPSource, Go2RtcSnapshotSource, Go2RtcWSSource, HardwareAcceleration, HumidityInfoLike, HumidityInfoProperties, ImageMetadata, JsonArraySchema, JsonBaseSchema, JsonBaseSchemaWithoutCallbacks, JsonBooleanSchema, JsonEnumSchema, JsonFactorySchema, JsonNumberSchema, JsonSchema, JsonSchemaArray, JsonSchemaArrayWithoutCallbacks, JsonSchemaBoolean, JsonSchemaBooleanWithoutCallbacks, JsonSchemaButton, JsonSchemaEnum, JsonSchemaEnumWithoutCallbacks, JsonSchemaNumber, JsonSchemaNumberWithoutCallbacks, JsonSchemaString, JsonSchemaStringWithoutCallbacks, JsonSchemaSubmit, JsonSchemaType, JsonSchemaWithoutCallbacks, JsonSchemaWithoutKey, JsonStringSchema, LeakSensorLike, LeakSensorProperties, LicensePlateDetection, LicensePlateDetectionInterface, LicensePlateDetectionPluginResponse, LicensePlateResult, LicensePlateSensorLike, LicensePlateSensorProperties, LightControlLike, LightControlProperties, LineDirection, LockControlLike, LockControlProperties, LoggerService, ModelSpec, MotionDetectionInterface, MotionDetectionPluginResponse, MotionDetectionSettings, MotionResolution, MotionResult, MotionSensorLike, MotionSensorProperties, Notification, NotificationManager, NotifierDevice, NotifierInterface, OAuthAuthCodeFlowCapable, OAuthCapable, OAuthClientCredentialsCapable, OAuthDeviceFlowCapable, OAuthMetadata, OAuthProviderConfig, OAuthProviderDeclaration, OAuthState, OAuthStatus, ObjectDetectionInterface, ObjectDetectionPluginResponse, ObjectDetectionSettings, ObjectModelSpec, ObjectResult, ObjectSensorLike, ObjectSensorProperties, OccupancySensorLike, OccupancySensorProperties, OperatorFn, PTZControlLike, PTZControlProperties, PTZDirection, PTZPosition, PTZRelativeMove, PluginAPI, PluginAssignments, PluginConfig, PluginContract, PluginInfo, PluginInterfaces, Point, ProbeAudioCodec, ProbeConfig, ProbeStream, PropertyChangeOf, PtzAutotrackSettings, PythonVersion, RTPInfo, RTSPAudioCodec, RTSPUrlOptions, RtpSession, RtpSessionBackchannelOptions, RtpSessionOptions, SchemaCondition, SchemaConditionOperator, SchemaConfig, SecuritySystemLike, SecuritySystemProperties, SensorCapability, SensorLike, SensorPropertyType, SensorTriggerRef, SensorTriggerSettings, SirenControlLike, SirenControlProperties, SmokeSensorLike, SmokeSensorProperties, SnapshotInterface, SnapshotSettings, SnapshotUrlOptions, StreamDirection, StreamUrls, StreamingInterface, StreamingRole, SwitchControlLike, SwitchControlProperties, TemperatureInfoLike, TemperatureInfoProperties, ToastMessage, TrackedDetection, VideoCodec, VideoCodecProperties, VideoFFmpegCodec, VideoFrameData, VideoInputSpec, VideoStreamInfo, VideoStreamingMode, ZoneFilter, ZoneType };
@@ -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
 
@@ -236,7 +236,9 @@ declare enum PTZProperty {
236
236
  /** Current movement velocity (continuous move) */
237
237
  Velocity = "velocity",
238
238
  /** Target preset to move to */
239
- TargetPreset = "targetPreset"
239
+ TargetPreset = "targetPreset",
240
+ /** Relative displacement move command (write-only) */
241
+ RelativeMove = "relativeMove"
240
242
  }
241
243
 
242
244
  /**
@@ -606,7 +608,7 @@ interface CameraInputSettings {
606
608
  useForSnapshot: boolean;
607
609
  /** Keep connection always active */
608
610
  hotMode: boolean;
609
- /** Preload stream on startup */
611
+ /** Keep a keyframe cache for this source, so the view opens faster. Use `hotMode` to keep the stream connected. */
610
612
  preload: boolean;
611
613
  /** Strip the audio track from this source (defaults to false) */
612
614
  muted?: boolean;
@@ -730,7 +732,7 @@ interface EventDetection {
730
732
  maxCount: number;
731
733
  /** Bounding box of the highest-confidence detection (normalized 0–1) */
732
734
  box?: BoundingBox;
733
- /** 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. */
734
736
  thumbnail?: Uint8Array;
735
737
  /** Object tracker ID (links this detection across frames) */
736
738
  trackId?: number;
@@ -747,7 +749,7 @@ interface EventAttribute {
747
749
  label: string;
748
750
  /** Detection confidence (0-1) */
749
751
  confidence?: number;
750
- /** 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. */
751
753
  thumbnail?: Uint8Array;
752
754
  /** Face embedding vector for unknown face persistence. Only present for face attributes. */
753
755
  embedding?: number[];
@@ -768,7 +770,7 @@ interface EventSegment {
768
770
  firstSeen: number;
769
771
  /** Segment end time (Unix ms) */
770
772
  lastSeen: number;
771
- /** 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. */
772
774
  thumbnail?: Uint8Array;
773
775
  /** Object detections in this segment */
774
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;
@@ -1,4 +1,4 @@
1
- import { Sensor, SensorType, SensorCategory } from './base.js';
1
+ import { Sensor, SensorCategory, SensorType } from './base.js';
2
2
  /** Optional capabilities for PTZ controls. Add to `capabilities` to enable features. */
3
3
  export var PTZCapability;
4
4
  (function (PTZCapability) {
@@ -9,6 +9,12 @@ export var PTZCapability;
9
9
  PTZCapability["Presets"] = "presets";
10
10
  /** Camera supports a home position */
11
11
  PTZCapability["Home"] = "home";
12
+ /** Camera executes relative displacement moves */
13
+ PTZCapability["RelativeMove"] = "relativeMove";
14
+ /** Camera accepts absolute position writes via `setPosition()` */
15
+ PTZCapability["AbsolutePosition"] = "absolutePosition";
16
+ /** Camera accepts continuous-move commands via `setVelocity()` */
17
+ PTZCapability["VelocityControl"] = "velocityControl";
12
18
  })(PTZCapability || (PTZCapability = {}));
13
19
  /**
14
20
  * Properties for PTZ controls
@@ -27,6 +33,8 @@ export var PTZProperty;
27
33
  PTZProperty["Velocity"] = "velocity";
28
34
  /** Target preset to move to */
29
35
  PTZProperty["TargetPreset"] = "targetPreset";
36
+ /** Relative displacement move command (write-only) */
37
+ PTZProperty["RelativeMove"] = "relativeMove";
30
38
  })(PTZProperty || (PTZProperty = {}));
31
39
  /**
32
40
  * Pan-tilt-zoom camera control. Override `setPosition()` / `setVelocity()` /
@@ -82,22 +90,41 @@ export class PTZControl extends Sensor {
82
90
  * Continuous-move command. Override to drive hardware and call
83
91
  * `await super.setVelocity(value)` after success to sync the SDK state.
84
92
  *
85
- * @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.
86
95
  *
87
96
  * @example
88
97
  * ```ts
89
98
  * await ptz.setVelocity({ panSpeed: 0.5, tiltSpeed: 0, zoomSpeed: 0 });
90
- * await ptz.setVelocity(undefined); // stop
99
+ * await ptz.setVelocity({ panSpeed: 0, tiltSpeed: 0, zoomSpeed: 0 }); // stop
91
100
  * ```
92
101
  */
93
102
  async setVelocity(value) {
94
103
  this._writeState({ [PTZProperty.Velocity]: value });
95
104
  }
105
+ /**
106
+ * Relative displacement move. Override to drive hardware (e.g. ONVIF
107
+ * RelativeMove in a translation space) and call
108
+ * `await super.setRelativeMove(value)` after success to sync the SDK state.
109
+ * Advertise {@link PTZCapability.RelativeMove} when the camera supports it.
110
+ *
111
+ * @param value - Per-axis displacement, normalized to the field of view.
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * // move the view a third of a frame to the right, a tenth down
116
+ * await ptz.setRelativeMove({ panDelta: 0.33, tiltDelta: -0.1, zoomDelta: 0 });
117
+ * ```
118
+ */
119
+ async setRelativeMove(value) {
120
+ this._writeState({ [PTZProperty.RelativeMove]: value });
121
+ }
96
122
  /**
97
123
  * Preset-move command. Override to drive hardware and call
98
124
  * `await super.setTargetPreset(value)` after success to sync the SDK state.
99
125
  *
100
- * @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.
101
128
  *
102
129
  * @example
103
130
  * ```ts
@@ -148,7 +175,7 @@ export class PTZControl extends Sensor {
148
175
  * Cross-process consumer entry point. Dispatches writable properties
149
176
  * to semantic methods so plugin overrides (hardware actions) are honored.
150
177
  * `moving` and `presets` are observed/discovered state and not externally writable;
151
- * only `Position`, `Velocity`, and `TargetPreset` may be set.
178
+ * only `Position`, `Velocity`, `TargetPreset`, and `RelativeMove` may be set.
152
179
  *
153
180
  * @param property - Property name to write.
154
181
  *
@@ -167,6 +194,9 @@ export class PTZControl extends Sensor {
167
194
  case PTZProperty.TargetPreset:
168
195
  await this.setTargetPreset(value);
169
196
  return;
197
+ case PTZProperty.RelativeMove:
198
+ await this.setRelativeMove(value);
199
+ return;
170
200
  }
171
201
  // Unknown / non-writable property (incl. moving, presets) — ignored.
172
202
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/sdk",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "description": "camera.ui sdk",
5
5
  "exports": {
6
6
  ".": {