@camstack/addon-provider-tuya 0.1.9 → 0.1.10

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 (3) hide show
  1. package/dist/addon.js +194 -14
  2. package/dist/addon.mjs +194 -14
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -3,7 +3,7 @@ let crypto$1 = require("crypto");
3
3
  let net = require("net");
4
4
  let events = require("events");
5
5
  let dgram = require("dgram");
6
- //#region ../types/dist/event-category-CFZs3jI4.mjs
6
+ //#region ../types/dist/event-category-H4AVePnn.mjs
7
7
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
8
8
  EventCategory["SystemBoot"] = "system.boot";
9
9
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -153,6 +153,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
153
153
  EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
154
154
  EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
155
155
  EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
156
+ /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
157
+ * thumb is a scrub gap the recorder's keyframe backfill covers. */
158
+ EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
156
159
  EventCategory["DetectionEvent"] = "detection.event";
157
160
  EventCategory["SessionTrackNew"] = "session.track.new";
158
161
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -10800,10 +10803,23 @@ var deviceDiscoveryCapability = {
10800
10803
  }
10801
10804
  };
10802
10805
  /**
10803
- * Doorbell button cap. Installed on a `DeviceType.Button` accessory
10804
- * with `role: DeviceRole.Doorbell`. Emits an `onPressed` event every
10805
- * time the firmware pushes a ring; status tracks the last press and
10806
- * a pressCount since start (diagnostic).
10806
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
10807
+ * name (same pattern as `snapshot`):
10808
+ *
10809
+ * - **Native** providers: registered per-device by device-driver
10810
+ * addons via `ctx.registerNativeCap` — either on a
10811
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
10812
+ * or directly on the camera (Reolink registers at camera level).
10813
+ * Emits an `onPressed` event every time the firmware pushes a
10814
+ * ring; status tracks the last press and a pressCount since start
10815
+ * (diagnostic).
10816
+ *
10817
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
10818
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
10819
+ * device (contact / switch / event-emitter …) into a doorbell for
10820
+ * a camera. `defaultActive: false` — the operator explicitly binds
10821
+ * it per camera in the device-bindings UI, then picks the source
10822
+ * device + trigger in the per-device settings.
10807
10823
  *
10808
10824
  * The DeviceEventPropagator re-emits `onPressed` on the camera parent
10809
10825
  * — subscribers listening at the camera level receive ring events
@@ -10824,7 +10840,10 @@ var doorbellCapability = {
10824
10840
  scope: "device",
10825
10841
  deviceNative: true,
10826
10842
  mode: "singleton",
10827
- deviceTypes: [DeviceType.Button],
10843
+ kind: "wrapper",
10844
+ defaultActive: false,
10845
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
10846
+ exposesDeviceSettings: true,
10828
10847
  methods: {},
10829
10848
  events: {
10830
10849
  /**
@@ -17193,6 +17212,14 @@ var ConfigEntrySchema = object({
17193
17212
  value: unknown(),
17194
17213
  description: string().optional()
17195
17214
  });
17215
+ var DeviceLinkModeSchema = _enum(["auto", "manual"]);
17216
+ /** One resolved linked device — the compact projection consumers need. */
17217
+ var LinkedDeviceSchema = object({
17218
+ deviceId: number(),
17219
+ name: string(),
17220
+ location: string().nullable(),
17221
+ features: array(string())
17222
+ });
17196
17223
  var SavedDeviceRowSchema = object({
17197
17224
  /** Numeric id reserved at allocateDeviceId time. */
17198
17225
  id: number(),
@@ -17414,7 +17441,10 @@ method(object({
17414
17441
  }), _void(), {
17415
17442
  kind: "mutation",
17416
17443
  auth: "admin"
17417
- }), method(object({ addonId: string() }), array(SavedDeviceRowSchema)), method(object({ addonId: string().optional() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
17444
+ }), method(object({ addonId: string() }), array(SavedDeviceRowSchema)), method(object({ addonId: string().optional() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
17445
+ mode: DeviceLinkModeSchema,
17446
+ devices: array(LinkedDeviceSchema)
17447
+ })), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
17418
17448
  deviceId: number(),
17419
17449
  values: record(string(), unknown())
17420
17450
  }), object({ success: literal(true) }), {
@@ -18683,6 +18713,61 @@ var EventKindSchema = _enum([
18683
18713
  "object",
18684
18714
  "audio"
18685
18715
  ]);
18716
+ /**
18717
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
18718
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
18719
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
18720
+ */
18721
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
18722
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
18723
+ var EventKindIconSchema = _enum([
18724
+ "motion",
18725
+ "audio",
18726
+ "person",
18727
+ "vehicle",
18728
+ "animal",
18729
+ "door",
18730
+ "pir",
18731
+ "smoke",
18732
+ "water",
18733
+ "button",
18734
+ "generic"
18735
+ ]);
18736
+ var EventKindCategorySchema = _enum([
18737
+ "motion",
18738
+ "audio",
18739
+ "detection",
18740
+ "sensor",
18741
+ "custom"
18742
+ ]);
18743
+ var EventKindDescriptorSchema = object({
18744
+ /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
18745
+ kind: string(),
18746
+ label: string(),
18747
+ /** Hex color for timeline/legend rendering. */
18748
+ color: string(),
18749
+ icon: EventKindIconSchema,
18750
+ category: EventKindCategorySchema,
18751
+ /** Which cap + device contributes this kind. For built-ins the camera
18752
+ * itself; for sensor kinds the LINKED source device. */
18753
+ source: object({
18754
+ capName: string(),
18755
+ deviceId: number()
18756
+ })
18757
+ });
18758
+ var SensorEventSchema = object({
18759
+ id: string(),
18760
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
18761
+ * yields N rows, one per camera). */
18762
+ deviceId: number(),
18763
+ /** The linked sensor device whose state changed. */
18764
+ sourceDeviceId: number(),
18765
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
18766
+ kind: string(),
18767
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
18768
+ value: record(string(), unknown()).nullable(),
18769
+ timestamp: number()
18770
+ });
18686
18771
  var TrackPositionSchema = object({
18687
18772
  x: number(),
18688
18773
  y: number(),
@@ -18696,6 +18781,30 @@ var TrackSnapshotSchema = object({
18696
18781
  mediaKey: string()
18697
18782
  });
18698
18783
  /**
18784
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
18785
+ * divided by the track's detection-frame dims), computed at persist time.
18786
+ * Absent when the frame dims were unknown when the track was persisted
18787
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
18788
+ */
18789
+ var TrackEnvelopeSchema = object({
18790
+ minX: number(),
18791
+ minY: number(),
18792
+ maxX: number(),
18793
+ maxY: number()
18794
+ });
18795
+ /**
18796
+ * Row projection for track list queries. `full` (default) returns the
18797
+ * complete Track including the frame-rate `positions[]` history and the
18798
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
18799
+ * keeps every scalar the list surfaces actually render (ids, class(es),
18800
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
18801
+ * zonesVisited, bestEventId, envelope) and returns `positions` /
18802
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
18803
+ * `getTrack`. Mirrors the event-store `projection` convention
18804
+ * (`getObjectEvents` et al.).
18805
+ */
18806
+ var TrackProjectionSchema = _enum(["full", "slim"]);
18807
+ /**
18699
18808
  * One audio-classification label heard on the track's camera while the
18700
18809
  * track was alive, aggregated per label. An "episode" is one persisted
18701
18810
  * audio event (the confident-classification path: score ≥ the device's
@@ -18746,7 +18855,11 @@ var TrackSchema = object({
18746
18855
  /** Audio-classification labels heard on the camera during the track's
18747
18856
  * life (score ≥ device `classificationMinScore`), aggregated per label.
18748
18857
  * Absent on legacy rows / tracks with no confident audio. */
18749
- audioLabels: array(TrackAudioLabelSchema).readonly().optional()
18858
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
18859
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
18860
+ * Populated from the persisted envelope columns on historical reads;
18861
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
18862
+ envelope: TrackEnvelopeSchema.optional()
18750
18863
  });
18751
18864
  var BaseEventFields = {
18752
18865
  id: string(),
@@ -18856,11 +18969,13 @@ var MediaFileSchema = object({
18856
18969
  sizeBytes: number(),
18857
18970
  timestamp: number()
18858
18971
  });
18972
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
18973
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
18859
18974
  var DeviceEventQueryInput = object({
18860
18975
  deviceId: number(),
18861
18976
  since: number().optional(),
18862
18977
  until: number().optional(),
18863
- limit: number().int().min(1).max(5e3).default(1e3),
18978
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
18864
18979
  /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
18865
18980
  * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
18866
18981
  * exact behaviour. Callers may omit this field — the store defaults to
@@ -18868,6 +18983,27 @@ var DeviceEventQueryInput = object({
18868
18983
  projection: _enum(["full", "slim"]).optional()
18869
18984
  });
18870
18985
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
18986
+ var RecentTracksQueryInput = object({
18987
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
18988
+ deviceIds: array(number()),
18989
+ /** Window lower bound on `lastSeen` (inclusive). */
18990
+ since: number().optional(),
18991
+ /** Window upper bound on `lastSeen` (inclusive). */
18992
+ until: number().optional(),
18993
+ /** Page size. Default 200, max 1000. */
18994
+ limit: number().int().min(1).max(1e3).default(200),
18995
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
18996
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
18997
+ cursor: string().optional(),
18998
+ /** See {@link TrackProjectionSchema}. Default `full`. */
18999
+ projection: TrackProjectionSchema.optional()
19000
+ });
19001
+ var RecentTracksPageSchema = object({
19002
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
19003
+ tracks: array(TrackSchema).readonly(),
19004
+ /** Cursor for the next page, or null when this page is the last. */
19005
+ nextCursor: string().nullable()
19006
+ });
18871
19007
  var KeyEventQueryInput = object({
18872
19008
  deviceId: number(),
18873
19009
  /** Window lower bound (track firstSeen ≥ since). */
@@ -18950,11 +19086,25 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18950
19086
  deviceId: number(),
18951
19087
  since: number().optional(),
18952
19088
  until: number().optional(),
18953
- limit: number().optional()
18954
- }), array(TrackSchema).readonly()), method(object({ deviceId: number() }), _void(), {
19089
+ limit: number().optional(),
19090
+ /** Spatial filter only tracks whose trajectory intersects the zone
19091
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
19092
+ * envelope columns, then precisely tested per position. Tracks with
19093
+ * an unknown envelope (no frame dims at persist time) always match. */
19094
+ zone: TrackZoneFilterSchema.optional(),
19095
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
19096
+ * compatible — omitting the field keeps today's exact behaviour). */
19097
+ projection: TrackProjectionSchema.optional()
19098
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
18955
19099
  kind: "mutation",
18956
19100
  auth: "admin"
18957
- }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19101
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({
19102
+ deviceId: number(),
19103
+ since: number().optional(),
19104
+ until: number().optional(),
19105
+ kinds: array(string()).optional(),
19106
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19107
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
18958
19108
  deviceId: number(),
18959
19109
  since: number(),
18960
19110
  until: number(),
@@ -22155,7 +22305,12 @@ var RecordingStorageUsageSchema = object({
22155
22305
  /**
22156
22306
  * Result of locating footage at a wall-clock instant for one device/profile.
22157
22307
  * `segment` carries the covering segment's window; `gap` reports the forward
22158
- * nearest covered edge (`null` past the end of footage / when none exists).
22308
+ * nearest covered edge (`null` past the end of footage / when none exists)
22309
+ * and the backward covered edge `prevEndMs` (exclusive end of the nearest
22310
+ * footage behind the epoch; `null` when none — optional so older providers
22311
+ * that omit it stay valid). `prevEndMs` lets a backward frame-step hop the
22312
+ * small inter-segment cracks (durMs under-covers the span to the next
22313
+ * startMs by ~11-17 ms) instead of no-opping at a segment head.
22159
22314
  */
22160
22315
  var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22161
22316
  kind: literal("segment"),
@@ -22164,7 +22319,8 @@ var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22164
22319
  bytes: number()
22165
22320
  }), object({
22166
22321
  kind: literal("gap"),
22167
- nearestEdgeMs: number().nullable()
22322
+ nearestEdgeMs: number().nullable(),
22323
+ prevEndMs: number().nullable().optional()
22168
22324
  })]);
22169
22325
  /** Raw bytes of one finalized footage segment (read off disk on the recording node). */
22170
22326
  var ReadSegmentBytesResultSchema = object({ data: _instanceof(Uint8Array) });
@@ -23733,6 +23889,12 @@ Object.freeze({
23733
23889
  addonId: null,
23734
23890
  access: "view"
23735
23891
  },
23892
+ "deviceManager.getLinkedDevices": {
23893
+ capName: "device-manager",
23894
+ capScope: "system",
23895
+ addonId: null,
23896
+ access: "view"
23897
+ },
23736
23898
  "deviceManager.getRoleDisplayDefaults": {
23737
23899
  capName: "device-manager",
23738
23900
  capScope: "system",
@@ -25287,6 +25449,12 @@ Object.freeze({
25287
25449
  addonId: null,
25288
25450
  access: "view"
25289
25451
  },
25452
+ "pipelineAnalytics.getSensorEvents": {
25453
+ capName: "pipeline-analytics",
25454
+ capScope: "device",
25455
+ addonId: null,
25456
+ access: "view"
25457
+ },
25290
25458
  "pipelineAnalytics.getTrack": {
25291
25459
  capName: "pipeline-analytics",
25292
25460
  capScope: "device",
@@ -25299,6 +25467,18 @@ Object.freeze({
25299
25467
  addonId: null,
25300
25468
  access: "view"
25301
25469
  },
25470
+ "pipelineAnalytics.listEventKinds": {
25471
+ capName: "pipeline-analytics",
25472
+ capScope: "device",
25473
+ addonId: null,
25474
+ access: "view"
25475
+ },
25476
+ "pipelineAnalytics.listRecentTracks": {
25477
+ capName: "pipeline-analytics",
25478
+ capScope: "device",
25479
+ addonId: null,
25480
+ access: "view"
25481
+ },
25302
25482
  "pipelineAnalytics.listTracks": {
25303
25483
  capName: "pipeline-analytics",
25304
25484
  capScope: "device",
package/dist/addon.mjs CHANGED
@@ -2,7 +2,7 @@ import { createCipheriv, createDecipheriv, createHash, createHmac } from "crypto
2
2
  import { Socket } from "net";
3
3
  import { EventEmitter } from "events";
4
4
  import { createSocket } from "dgram";
5
- //#region ../types/dist/event-category-CFZs3jI4.mjs
5
+ //#region ../types/dist/event-category-H4AVePnn.mjs
6
6
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
7
7
  EventCategory["SystemBoot"] = "system.boot";
8
8
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -152,6 +152,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
152
152
  EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
153
153
  EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
154
154
  EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
155
+ /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
156
+ * thumb is a scrub gap the recorder's keyframe backfill covers. */
157
+ EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
155
158
  EventCategory["DetectionEvent"] = "detection.event";
156
159
  EventCategory["SessionTrackNew"] = "session.track.new";
157
160
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -10799,10 +10802,23 @@ var deviceDiscoveryCapability = {
10799
10802
  }
10800
10803
  };
10801
10804
  /**
10802
- * Doorbell button cap. Installed on a `DeviceType.Button` accessory
10803
- * with `role: DeviceRole.Doorbell`. Emits an `onPressed` event every
10804
- * time the firmware pushes a ring; status tracks the last press and
10805
- * a pressCount since start (diagnostic).
10805
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
10806
+ * name (same pattern as `snapshot`):
10807
+ *
10808
+ * - **Native** providers: registered per-device by device-driver
10809
+ * addons via `ctx.registerNativeCap` — either on a
10810
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
10811
+ * or directly on the camera (Reolink registers at camera level).
10812
+ * Emits an `onPressed` event every time the firmware pushes a
10813
+ * ring; status tracks the last press and a pressCount since start
10814
+ * (diagnostic).
10815
+ *
10816
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
10817
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
10818
+ * device (contact / switch / event-emitter …) into a doorbell for
10819
+ * a camera. `defaultActive: false` — the operator explicitly binds
10820
+ * it per camera in the device-bindings UI, then picks the source
10821
+ * device + trigger in the per-device settings.
10806
10822
  *
10807
10823
  * The DeviceEventPropagator re-emits `onPressed` on the camera parent
10808
10824
  * — subscribers listening at the camera level receive ring events
@@ -10823,7 +10839,10 @@ var doorbellCapability = {
10823
10839
  scope: "device",
10824
10840
  deviceNative: true,
10825
10841
  mode: "singleton",
10826
- deviceTypes: [DeviceType.Button],
10842
+ kind: "wrapper",
10843
+ defaultActive: false,
10844
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
10845
+ exposesDeviceSettings: true,
10827
10846
  methods: {},
10828
10847
  events: {
10829
10848
  /**
@@ -17192,6 +17211,14 @@ var ConfigEntrySchema = object({
17192
17211
  value: unknown(),
17193
17212
  description: string().optional()
17194
17213
  });
17214
+ var DeviceLinkModeSchema = _enum(["auto", "manual"]);
17215
+ /** One resolved linked device — the compact projection consumers need. */
17216
+ var LinkedDeviceSchema = object({
17217
+ deviceId: number(),
17218
+ name: string(),
17219
+ location: string().nullable(),
17220
+ features: array(string())
17221
+ });
17195
17222
  var SavedDeviceRowSchema = object({
17196
17223
  /** Numeric id reserved at allocateDeviceId time. */
17197
17224
  id: number(),
@@ -17413,7 +17440,10 @@ method(object({
17413
17440
  }), _void(), {
17414
17441
  kind: "mutation",
17415
17442
  auth: "admin"
17416
- }), method(object({ addonId: string() }), array(SavedDeviceRowSchema)), method(object({ addonId: string().optional() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
17443
+ }), method(object({ addonId: string() }), array(SavedDeviceRowSchema)), method(object({ addonId: string().optional() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
17444
+ mode: DeviceLinkModeSchema,
17445
+ devices: array(LinkedDeviceSchema)
17446
+ })), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
17417
17447
  deviceId: number(),
17418
17448
  values: record(string(), unknown())
17419
17449
  }), object({ success: literal(true) }), {
@@ -18682,6 +18712,61 @@ var EventKindSchema = _enum([
18682
18712
  "object",
18683
18713
  "audio"
18684
18714
  ]);
18715
+ /**
18716
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
18717
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
18718
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
18719
+ */
18720
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
18721
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
18722
+ var EventKindIconSchema = _enum([
18723
+ "motion",
18724
+ "audio",
18725
+ "person",
18726
+ "vehicle",
18727
+ "animal",
18728
+ "door",
18729
+ "pir",
18730
+ "smoke",
18731
+ "water",
18732
+ "button",
18733
+ "generic"
18734
+ ]);
18735
+ var EventKindCategorySchema = _enum([
18736
+ "motion",
18737
+ "audio",
18738
+ "detection",
18739
+ "sensor",
18740
+ "custom"
18741
+ ]);
18742
+ var EventKindDescriptorSchema = object({
18743
+ /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
18744
+ kind: string(),
18745
+ label: string(),
18746
+ /** Hex color for timeline/legend rendering. */
18747
+ color: string(),
18748
+ icon: EventKindIconSchema,
18749
+ category: EventKindCategorySchema,
18750
+ /** Which cap + device contributes this kind. For built-ins the camera
18751
+ * itself; for sensor kinds the LINKED source device. */
18752
+ source: object({
18753
+ capName: string(),
18754
+ deviceId: number()
18755
+ })
18756
+ });
18757
+ var SensorEventSchema = object({
18758
+ id: string(),
18759
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
18760
+ * yields N rows, one per camera). */
18761
+ deviceId: number(),
18762
+ /** The linked sensor device whose state changed. */
18763
+ sourceDeviceId: number(),
18764
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
18765
+ kind: string(),
18766
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
18767
+ value: record(string(), unknown()).nullable(),
18768
+ timestamp: number()
18769
+ });
18685
18770
  var TrackPositionSchema = object({
18686
18771
  x: number(),
18687
18772
  y: number(),
@@ -18695,6 +18780,30 @@ var TrackSnapshotSchema = object({
18695
18780
  mediaKey: string()
18696
18781
  });
18697
18782
  /**
18783
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
18784
+ * divided by the track's detection-frame dims), computed at persist time.
18785
+ * Absent when the frame dims were unknown when the track was persisted
18786
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
18787
+ */
18788
+ var TrackEnvelopeSchema = object({
18789
+ minX: number(),
18790
+ minY: number(),
18791
+ maxX: number(),
18792
+ maxY: number()
18793
+ });
18794
+ /**
18795
+ * Row projection for track list queries. `full` (default) returns the
18796
+ * complete Track including the frame-rate `positions[]` history and the
18797
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
18798
+ * keeps every scalar the list surfaces actually render (ids, class(es),
18799
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
18800
+ * zonesVisited, bestEventId, envelope) and returns `positions` /
18801
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
18802
+ * `getTrack`. Mirrors the event-store `projection` convention
18803
+ * (`getObjectEvents` et al.).
18804
+ */
18805
+ var TrackProjectionSchema = _enum(["full", "slim"]);
18806
+ /**
18698
18807
  * One audio-classification label heard on the track's camera while the
18699
18808
  * track was alive, aggregated per label. An "episode" is one persisted
18700
18809
  * audio event (the confident-classification path: score ≥ the device's
@@ -18745,7 +18854,11 @@ var TrackSchema = object({
18745
18854
  /** Audio-classification labels heard on the camera during the track's
18746
18855
  * life (score ≥ device `classificationMinScore`), aggregated per label.
18747
18856
  * Absent on legacy rows / tracks with no confident audio. */
18748
- audioLabels: array(TrackAudioLabelSchema).readonly().optional()
18857
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
18858
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
18859
+ * Populated from the persisted envelope columns on historical reads;
18860
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
18861
+ envelope: TrackEnvelopeSchema.optional()
18749
18862
  });
18750
18863
  var BaseEventFields = {
18751
18864
  id: string(),
@@ -18855,11 +18968,13 @@ var MediaFileSchema = object({
18855
18968
  sizeBytes: number(),
18856
18969
  timestamp: number()
18857
18970
  });
18971
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
18972
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
18858
18973
  var DeviceEventQueryInput = object({
18859
18974
  deviceId: number(),
18860
18975
  since: number().optional(),
18861
18976
  until: number().optional(),
18862
- limit: number().int().min(1).max(5e3).default(1e3),
18977
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
18863
18978
  /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
18864
18979
  * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
18865
18980
  * exact behaviour. Callers may omit this field — the store defaults to
@@ -18867,6 +18982,27 @@ var DeviceEventQueryInput = object({
18867
18982
  projection: _enum(["full", "slim"]).optional()
18868
18983
  });
18869
18984
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
18985
+ var RecentTracksQueryInput = object({
18986
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
18987
+ deviceIds: array(number()),
18988
+ /** Window lower bound on `lastSeen` (inclusive). */
18989
+ since: number().optional(),
18990
+ /** Window upper bound on `lastSeen` (inclusive). */
18991
+ until: number().optional(),
18992
+ /** Page size. Default 200, max 1000. */
18993
+ limit: number().int().min(1).max(1e3).default(200),
18994
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
18995
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
18996
+ cursor: string().optional(),
18997
+ /** See {@link TrackProjectionSchema}. Default `full`. */
18998
+ projection: TrackProjectionSchema.optional()
18999
+ });
19000
+ var RecentTracksPageSchema = object({
19001
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
19002
+ tracks: array(TrackSchema).readonly(),
19003
+ /** Cursor for the next page, or null when this page is the last. */
19004
+ nextCursor: string().nullable()
19005
+ });
18870
19006
  var KeyEventQueryInput = object({
18871
19007
  deviceId: number(),
18872
19008
  /** Window lower bound (track firstSeen ≥ since). */
@@ -18949,11 +19085,25 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18949
19085
  deviceId: number(),
18950
19086
  since: number().optional(),
18951
19087
  until: number().optional(),
18952
- limit: number().optional()
18953
- }), array(TrackSchema).readonly()), method(object({ deviceId: number() }), _void(), {
19088
+ limit: number().optional(),
19089
+ /** Spatial filter only tracks whose trajectory intersects the zone
19090
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
19091
+ * envelope columns, then precisely tested per position. Tracks with
19092
+ * an unknown envelope (no frame dims at persist time) always match. */
19093
+ zone: TrackZoneFilterSchema.optional(),
19094
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
19095
+ * compatible — omitting the field keeps today's exact behaviour). */
19096
+ projection: TrackProjectionSchema.optional()
19097
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
18954
19098
  kind: "mutation",
18955
19099
  auth: "admin"
18956
- }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19100
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({
19101
+ deviceId: number(),
19102
+ since: number().optional(),
19103
+ until: number().optional(),
19104
+ kinds: array(string()).optional(),
19105
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19106
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
18957
19107
  deviceId: number(),
18958
19108
  since: number(),
18959
19109
  until: number(),
@@ -22154,7 +22304,12 @@ var RecordingStorageUsageSchema = object({
22154
22304
  /**
22155
22305
  * Result of locating footage at a wall-clock instant for one device/profile.
22156
22306
  * `segment` carries the covering segment's window; `gap` reports the forward
22157
- * nearest covered edge (`null` past the end of footage / when none exists).
22307
+ * nearest covered edge (`null` past the end of footage / when none exists)
22308
+ * and the backward covered edge `prevEndMs` (exclusive end of the nearest
22309
+ * footage behind the epoch; `null` when none — optional so older providers
22310
+ * that omit it stay valid). `prevEndMs` lets a backward frame-step hop the
22311
+ * small inter-segment cracks (durMs under-covers the span to the next
22312
+ * startMs by ~11-17 ms) instead of no-opping at a segment head.
22158
22313
  */
22159
22314
  var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22160
22315
  kind: literal("segment"),
@@ -22163,7 +22318,8 @@ var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22163
22318
  bytes: number()
22164
22319
  }), object({
22165
22320
  kind: literal("gap"),
22166
- nearestEdgeMs: number().nullable()
22321
+ nearestEdgeMs: number().nullable(),
22322
+ prevEndMs: number().nullable().optional()
22167
22323
  })]);
22168
22324
  /** Raw bytes of one finalized footage segment (read off disk on the recording node). */
22169
22325
  var ReadSegmentBytesResultSchema = object({ data: _instanceof(Uint8Array) });
@@ -23732,6 +23888,12 @@ Object.freeze({
23732
23888
  addonId: null,
23733
23889
  access: "view"
23734
23890
  },
23891
+ "deviceManager.getLinkedDevices": {
23892
+ capName: "device-manager",
23893
+ capScope: "system",
23894
+ addonId: null,
23895
+ access: "view"
23896
+ },
23735
23897
  "deviceManager.getRoleDisplayDefaults": {
23736
23898
  capName: "device-manager",
23737
23899
  capScope: "system",
@@ -25286,6 +25448,12 @@ Object.freeze({
25286
25448
  addonId: null,
25287
25449
  access: "view"
25288
25450
  },
25451
+ "pipelineAnalytics.getSensorEvents": {
25452
+ capName: "pipeline-analytics",
25453
+ capScope: "device",
25454
+ addonId: null,
25455
+ access: "view"
25456
+ },
25289
25457
  "pipelineAnalytics.getTrack": {
25290
25458
  capName: "pipeline-analytics",
25291
25459
  capScope: "device",
@@ -25298,6 +25466,18 @@ Object.freeze({
25298
25466
  addonId: null,
25299
25467
  access: "view"
25300
25468
  },
25469
+ "pipelineAnalytics.listEventKinds": {
25470
+ capName: "pipeline-analytics",
25471
+ capScope: "device",
25472
+ addonId: null,
25473
+ access: "view"
25474
+ },
25475
+ "pipelineAnalytics.listRecentTracks": {
25476
+ capName: "pipeline-analytics",
25477
+ capScope: "device",
25478
+ addonId: null,
25479
+ access: "view"
25480
+ },
25301
25481
  "pipelineAnalytics.listTracks": {
25302
25482
  capName: "pipeline-analytics",
25303
25483
  capScope: "device",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-tuya",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Tuya / Smart Life device-provider addon for CamStack — account-onboarded (Tuya IoT cloud fetch of device localKeys) + LOCAL DP control via the @apocaliss92/nodetuya encrypted-LAN client, exposing switch / water-heater-family kettle entities",
5
5
  "keywords": [
6
6
  "camstack",