@camstack/addon-provider-vesync 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
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region ../types/dist/event-category-CFZs3jI4.mjs
2
+ //#region ../types/dist/event-category-H4AVePnn.mjs
3
3
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4
4
  EventCategory["SystemBoot"] = "system.boot";
5
5
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -149,6 +149,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
149
149
  EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
150
150
  EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
151
151
  EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
152
+ /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
153
+ * thumb is a scrub gap the recorder's keyframe backfill covers. */
154
+ EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
152
155
  EventCategory["DetectionEvent"] = "detection.event";
153
156
  EventCategory["SessionTrackNew"] = "session.track.new";
154
157
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -10796,10 +10799,23 @@ var deviceDiscoveryCapability = {
10796
10799
  }
10797
10800
  };
10798
10801
  /**
10799
- * Doorbell button cap. Installed on a `DeviceType.Button` accessory
10800
- * with `role: DeviceRole.Doorbell`. Emits an `onPressed` event every
10801
- * time the firmware pushes a ring; status tracks the last press and
10802
- * a pressCount since start (diagnostic).
10802
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
10803
+ * name (same pattern as `snapshot`):
10804
+ *
10805
+ * - **Native** providers: registered per-device by device-driver
10806
+ * addons via `ctx.registerNativeCap` — either on a
10807
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
10808
+ * or directly on the camera (Reolink registers at camera level).
10809
+ * Emits an `onPressed` event every time the firmware pushes a
10810
+ * ring; status tracks the last press and a pressCount since start
10811
+ * (diagnostic).
10812
+ *
10813
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
10814
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
10815
+ * device (contact / switch / event-emitter …) into a doorbell for
10816
+ * a camera. `defaultActive: false` — the operator explicitly binds
10817
+ * it per camera in the device-bindings UI, then picks the source
10818
+ * device + trigger in the per-device settings.
10803
10819
  *
10804
10820
  * The DeviceEventPropagator re-emits `onPressed` on the camera parent
10805
10821
  * — subscribers listening at the camera level receive ring events
@@ -10820,7 +10836,10 @@ var doorbellCapability = {
10820
10836
  scope: "device",
10821
10837
  deviceNative: true,
10822
10838
  mode: "singleton",
10823
- deviceTypes: [DeviceType.Button],
10839
+ kind: "wrapper",
10840
+ defaultActive: false,
10841
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
10842
+ exposesDeviceSettings: true,
10824
10843
  methods: {},
10825
10844
  events: {
10826
10845
  /**
@@ -17172,6 +17191,14 @@ var ConfigEntrySchema = object({
17172
17191
  value: unknown(),
17173
17192
  description: string().optional()
17174
17193
  });
17194
+ var DeviceLinkModeSchema = _enum(["auto", "manual"]);
17195
+ /** One resolved linked device — the compact projection consumers need. */
17196
+ var LinkedDeviceSchema = object({
17197
+ deviceId: number(),
17198
+ name: string(),
17199
+ location: string().nullable(),
17200
+ features: array(string())
17201
+ });
17175
17202
  var SavedDeviceRowSchema = object({
17176
17203
  /** Numeric id reserved at allocateDeviceId time. */
17177
17204
  id: number(),
@@ -17393,7 +17420,10 @@ method(object({
17393
17420
  }), _void(), {
17394
17421
  kind: "mutation",
17395
17422
  auth: "admin"
17396
- }), 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({
17423
+ }), 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({
17424
+ mode: DeviceLinkModeSchema,
17425
+ devices: array(LinkedDeviceSchema)
17426
+ })), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
17397
17427
  deviceId: number(),
17398
17428
  values: record(string(), unknown())
17399
17429
  }), object({ success: literal(true) }), {
@@ -18662,6 +18692,61 @@ var EventKindSchema = _enum([
18662
18692
  "object",
18663
18693
  "audio"
18664
18694
  ]);
18695
+ /**
18696
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
18697
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
18698
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
18699
+ */
18700
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
18701
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
18702
+ var EventKindIconSchema = _enum([
18703
+ "motion",
18704
+ "audio",
18705
+ "person",
18706
+ "vehicle",
18707
+ "animal",
18708
+ "door",
18709
+ "pir",
18710
+ "smoke",
18711
+ "water",
18712
+ "button",
18713
+ "generic"
18714
+ ]);
18715
+ var EventKindCategorySchema = _enum([
18716
+ "motion",
18717
+ "audio",
18718
+ "detection",
18719
+ "sensor",
18720
+ "custom"
18721
+ ]);
18722
+ var EventKindDescriptorSchema = object({
18723
+ /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
18724
+ kind: string(),
18725
+ label: string(),
18726
+ /** Hex color for timeline/legend rendering. */
18727
+ color: string(),
18728
+ icon: EventKindIconSchema,
18729
+ category: EventKindCategorySchema,
18730
+ /** Which cap + device contributes this kind. For built-ins the camera
18731
+ * itself; for sensor kinds the LINKED source device. */
18732
+ source: object({
18733
+ capName: string(),
18734
+ deviceId: number()
18735
+ })
18736
+ });
18737
+ var SensorEventSchema = object({
18738
+ id: string(),
18739
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
18740
+ * yields N rows, one per camera). */
18741
+ deviceId: number(),
18742
+ /** The linked sensor device whose state changed. */
18743
+ sourceDeviceId: number(),
18744
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
18745
+ kind: string(),
18746
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
18747
+ value: record(string(), unknown()).nullable(),
18748
+ timestamp: number()
18749
+ });
18665
18750
  var TrackPositionSchema = object({
18666
18751
  x: number(),
18667
18752
  y: number(),
@@ -18675,6 +18760,30 @@ var TrackSnapshotSchema = object({
18675
18760
  mediaKey: string()
18676
18761
  });
18677
18762
  /**
18763
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
18764
+ * divided by the track's detection-frame dims), computed at persist time.
18765
+ * Absent when the frame dims were unknown when the track was persisted
18766
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
18767
+ */
18768
+ var TrackEnvelopeSchema = object({
18769
+ minX: number(),
18770
+ minY: number(),
18771
+ maxX: number(),
18772
+ maxY: number()
18773
+ });
18774
+ /**
18775
+ * Row projection for track list queries. `full` (default) returns the
18776
+ * complete Track including the frame-rate `positions[]` history and the
18777
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
18778
+ * keeps every scalar the list surfaces actually render (ids, class(es),
18779
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
18780
+ * zonesVisited, bestEventId, envelope) and returns `positions` /
18781
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
18782
+ * `getTrack`. Mirrors the event-store `projection` convention
18783
+ * (`getObjectEvents` et al.).
18784
+ */
18785
+ var TrackProjectionSchema = _enum(["full", "slim"]);
18786
+ /**
18678
18787
  * One audio-classification label heard on the track's camera while the
18679
18788
  * track was alive, aggregated per label. An "episode" is one persisted
18680
18789
  * audio event (the confident-classification path: score ≥ the device's
@@ -18725,7 +18834,11 @@ var TrackSchema = object({
18725
18834
  /** Audio-classification labels heard on the camera during the track's
18726
18835
  * life (score ≥ device `classificationMinScore`), aggregated per label.
18727
18836
  * Absent on legacy rows / tracks with no confident audio. */
18728
- audioLabels: array(TrackAudioLabelSchema).readonly().optional()
18837
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
18838
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
18839
+ * Populated from the persisted envelope columns on historical reads;
18840
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
18841
+ envelope: TrackEnvelopeSchema.optional()
18729
18842
  });
18730
18843
  var BaseEventFields = {
18731
18844
  id: string(),
@@ -18835,11 +18948,13 @@ var MediaFileSchema = object({
18835
18948
  sizeBytes: number(),
18836
18949
  timestamp: number()
18837
18950
  });
18951
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
18952
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
18838
18953
  var DeviceEventQueryInput = object({
18839
18954
  deviceId: number(),
18840
18955
  since: number().optional(),
18841
18956
  until: number().optional(),
18842
- limit: number().int().min(1).max(5e3).default(1e3),
18957
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
18843
18958
  /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
18844
18959
  * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
18845
18960
  * exact behaviour. Callers may omit this field — the store defaults to
@@ -18847,6 +18962,27 @@ var DeviceEventQueryInput = object({
18847
18962
  projection: _enum(["full", "slim"]).optional()
18848
18963
  });
18849
18964
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
18965
+ var RecentTracksQueryInput = object({
18966
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
18967
+ deviceIds: array(number()),
18968
+ /** Window lower bound on `lastSeen` (inclusive). */
18969
+ since: number().optional(),
18970
+ /** Window upper bound on `lastSeen` (inclusive). */
18971
+ until: number().optional(),
18972
+ /** Page size. Default 200, max 1000. */
18973
+ limit: number().int().min(1).max(1e3).default(200),
18974
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
18975
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
18976
+ cursor: string().optional(),
18977
+ /** See {@link TrackProjectionSchema}. Default `full`. */
18978
+ projection: TrackProjectionSchema.optional()
18979
+ });
18980
+ var RecentTracksPageSchema = object({
18981
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
18982
+ tracks: array(TrackSchema).readonly(),
18983
+ /** Cursor for the next page, or null when this page is the last. */
18984
+ nextCursor: string().nullable()
18985
+ });
18850
18986
  var KeyEventQueryInput = object({
18851
18987
  deviceId: number(),
18852
18988
  /** Window lower bound (track firstSeen ≥ since). */
@@ -18929,11 +19065,25 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18929
19065
  deviceId: number(),
18930
19066
  since: number().optional(),
18931
19067
  until: number().optional(),
18932
- limit: number().optional()
18933
- }), array(TrackSchema).readonly()), method(object({ deviceId: number() }), _void(), {
19068
+ limit: number().optional(),
19069
+ /** Spatial filter only tracks whose trajectory intersects the zone
19070
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
19071
+ * envelope columns, then precisely tested per position. Tracks with
19072
+ * an unknown envelope (no frame dims at persist time) always match. */
19073
+ zone: TrackZoneFilterSchema.optional(),
19074
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
19075
+ * compatible — omitting the field keeps today's exact behaviour). */
19076
+ projection: TrackProjectionSchema.optional()
19077
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
18934
19078
  kind: "mutation",
18935
19079
  auth: "admin"
18936
- }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19080
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({
19081
+ deviceId: number(),
19082
+ since: number().optional(),
19083
+ until: number().optional(),
19084
+ kinds: array(string()).optional(),
19085
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19086
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
18937
19087
  deviceId: number(),
18938
19088
  since: number(),
18939
19089
  until: number(),
@@ -22134,7 +22284,12 @@ var RecordingStorageUsageSchema = object({
22134
22284
  /**
22135
22285
  * Result of locating footage at a wall-clock instant for one device/profile.
22136
22286
  * `segment` carries the covering segment's window; `gap` reports the forward
22137
- * nearest covered edge (`null` past the end of footage / when none exists).
22287
+ * nearest covered edge (`null` past the end of footage / when none exists)
22288
+ * and the backward covered edge `prevEndMs` (exclusive end of the nearest
22289
+ * footage behind the epoch; `null` when none — optional so older providers
22290
+ * that omit it stay valid). `prevEndMs` lets a backward frame-step hop the
22291
+ * small inter-segment cracks (durMs under-covers the span to the next
22292
+ * startMs by ~11-17 ms) instead of no-opping at a segment head.
22138
22293
  */
22139
22294
  var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22140
22295
  kind: literal("segment"),
@@ -22143,7 +22298,8 @@ var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22143
22298
  bytes: number()
22144
22299
  }), object({
22145
22300
  kind: literal("gap"),
22146
- nearestEdgeMs: number().nullable()
22301
+ nearestEdgeMs: number().nullable(),
22302
+ prevEndMs: number().nullable().optional()
22147
22303
  })]);
22148
22304
  /** Raw bytes of one finalized footage segment (read off disk on the recording node). */
22149
22305
  var ReadSegmentBytesResultSchema = object({ data: _instanceof(Uint8Array) });
@@ -23712,6 +23868,12 @@ Object.freeze({
23712
23868
  addonId: null,
23713
23869
  access: "view"
23714
23870
  },
23871
+ "deviceManager.getLinkedDevices": {
23872
+ capName: "device-manager",
23873
+ capScope: "system",
23874
+ addonId: null,
23875
+ access: "view"
23876
+ },
23715
23877
  "deviceManager.getRoleDisplayDefaults": {
23716
23878
  capName: "device-manager",
23717
23879
  capScope: "system",
@@ -25266,6 +25428,12 @@ Object.freeze({
25266
25428
  addonId: null,
25267
25429
  access: "view"
25268
25430
  },
25431
+ "pipelineAnalytics.getSensorEvents": {
25432
+ capName: "pipeline-analytics",
25433
+ capScope: "device",
25434
+ addonId: null,
25435
+ access: "view"
25436
+ },
25269
25437
  "pipelineAnalytics.getTrack": {
25270
25438
  capName: "pipeline-analytics",
25271
25439
  capScope: "device",
@@ -25278,6 +25446,18 @@ Object.freeze({
25278
25446
  addonId: null,
25279
25447
  access: "view"
25280
25448
  },
25449
+ "pipelineAnalytics.listEventKinds": {
25450
+ capName: "pipeline-analytics",
25451
+ capScope: "device",
25452
+ addonId: null,
25453
+ access: "view"
25454
+ },
25455
+ "pipelineAnalytics.listRecentTracks": {
25456
+ capName: "pipeline-analytics",
25457
+ capScope: "device",
25458
+ addonId: null,
25459
+ access: "view"
25460
+ },
25281
25461
  "pipelineAnalytics.listTracks": {
25282
25462
  capName: "pipeline-analytics",
25283
25463
  capScope: "device",
package/dist/addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../types/dist/event-category-CFZs3jI4.mjs
1
+ //#region ../types/dist/event-category-H4AVePnn.mjs
2
2
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
3
3
  EventCategory["SystemBoot"] = "system.boot";
4
4
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -148,6 +148,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
148
148
  EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
149
149
  EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
150
150
  EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
151
+ /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
152
+ * thumb is a scrub gap the recorder's keyframe backfill covers. */
153
+ EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
151
154
  EventCategory["DetectionEvent"] = "detection.event";
152
155
  EventCategory["SessionTrackNew"] = "session.track.new";
153
156
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -10795,10 +10798,23 @@ var deviceDiscoveryCapability = {
10795
10798
  }
10796
10799
  };
10797
10800
  /**
10798
- * Doorbell button cap. Installed on a `DeviceType.Button` accessory
10799
- * with `role: DeviceRole.Doorbell`. Emits an `onPressed` event every
10800
- * time the firmware pushes a ring; status tracks the last press and
10801
- * a pressCount since start (diagnostic).
10801
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
10802
+ * name (same pattern as `snapshot`):
10803
+ *
10804
+ * - **Native** providers: registered per-device by device-driver
10805
+ * addons via `ctx.registerNativeCap` — either on a
10806
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
10807
+ * or directly on the camera (Reolink registers at camera level).
10808
+ * Emits an `onPressed` event every time the firmware pushes a
10809
+ * ring; status tracks the last press and a pressCount since start
10810
+ * (diagnostic).
10811
+ *
10812
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
10813
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
10814
+ * device (contact / switch / event-emitter …) into a doorbell for
10815
+ * a camera. `defaultActive: false` — the operator explicitly binds
10816
+ * it per camera in the device-bindings UI, then picks the source
10817
+ * device + trigger in the per-device settings.
10802
10818
  *
10803
10819
  * The DeviceEventPropagator re-emits `onPressed` on the camera parent
10804
10820
  * — subscribers listening at the camera level receive ring events
@@ -10819,7 +10835,10 @@ var doorbellCapability = {
10819
10835
  scope: "device",
10820
10836
  deviceNative: true,
10821
10837
  mode: "singleton",
10822
- deviceTypes: [DeviceType.Button],
10838
+ kind: "wrapper",
10839
+ defaultActive: false,
10840
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
10841
+ exposesDeviceSettings: true,
10823
10842
  methods: {},
10824
10843
  events: {
10825
10844
  /**
@@ -17171,6 +17190,14 @@ var ConfigEntrySchema = object({
17171
17190
  value: unknown(),
17172
17191
  description: string().optional()
17173
17192
  });
17193
+ var DeviceLinkModeSchema = _enum(["auto", "manual"]);
17194
+ /** One resolved linked device — the compact projection consumers need. */
17195
+ var LinkedDeviceSchema = object({
17196
+ deviceId: number(),
17197
+ name: string(),
17198
+ location: string().nullable(),
17199
+ features: array(string())
17200
+ });
17174
17201
  var SavedDeviceRowSchema = object({
17175
17202
  /** Numeric id reserved at allocateDeviceId time. */
17176
17203
  id: number(),
@@ -17392,7 +17419,10 @@ method(object({
17392
17419
  }), _void(), {
17393
17420
  kind: "mutation",
17394
17421
  auth: "admin"
17395
- }), 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({
17422
+ }), 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({
17423
+ mode: DeviceLinkModeSchema,
17424
+ devices: array(LinkedDeviceSchema)
17425
+ })), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
17396
17426
  deviceId: number(),
17397
17427
  values: record(string(), unknown())
17398
17428
  }), object({ success: literal(true) }), {
@@ -18661,6 +18691,61 @@ var EventKindSchema = _enum([
18661
18691
  "object",
18662
18692
  "audio"
18663
18693
  ]);
18694
+ /**
18695
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
18696
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
18697
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
18698
+ */
18699
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
18700
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
18701
+ var EventKindIconSchema = _enum([
18702
+ "motion",
18703
+ "audio",
18704
+ "person",
18705
+ "vehicle",
18706
+ "animal",
18707
+ "door",
18708
+ "pir",
18709
+ "smoke",
18710
+ "water",
18711
+ "button",
18712
+ "generic"
18713
+ ]);
18714
+ var EventKindCategorySchema = _enum([
18715
+ "motion",
18716
+ "audio",
18717
+ "detection",
18718
+ "sensor",
18719
+ "custom"
18720
+ ]);
18721
+ var EventKindDescriptorSchema = object({
18722
+ /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
18723
+ kind: string(),
18724
+ label: string(),
18725
+ /** Hex color for timeline/legend rendering. */
18726
+ color: string(),
18727
+ icon: EventKindIconSchema,
18728
+ category: EventKindCategorySchema,
18729
+ /** Which cap + device contributes this kind. For built-ins the camera
18730
+ * itself; for sensor kinds the LINKED source device. */
18731
+ source: object({
18732
+ capName: string(),
18733
+ deviceId: number()
18734
+ })
18735
+ });
18736
+ var SensorEventSchema = object({
18737
+ id: string(),
18738
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
18739
+ * yields N rows, one per camera). */
18740
+ deviceId: number(),
18741
+ /** The linked sensor device whose state changed. */
18742
+ sourceDeviceId: number(),
18743
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
18744
+ kind: string(),
18745
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
18746
+ value: record(string(), unknown()).nullable(),
18747
+ timestamp: number()
18748
+ });
18664
18749
  var TrackPositionSchema = object({
18665
18750
  x: number(),
18666
18751
  y: number(),
@@ -18674,6 +18759,30 @@ var TrackSnapshotSchema = object({
18674
18759
  mediaKey: string()
18675
18760
  });
18676
18761
  /**
18762
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
18763
+ * divided by the track's detection-frame dims), computed at persist time.
18764
+ * Absent when the frame dims were unknown when the track was persisted
18765
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
18766
+ */
18767
+ var TrackEnvelopeSchema = object({
18768
+ minX: number(),
18769
+ minY: number(),
18770
+ maxX: number(),
18771
+ maxY: number()
18772
+ });
18773
+ /**
18774
+ * Row projection for track list queries. `full` (default) returns the
18775
+ * complete Track including the frame-rate `positions[]` history and the
18776
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
18777
+ * keeps every scalar the list surfaces actually render (ids, class(es),
18778
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
18779
+ * zonesVisited, bestEventId, envelope) and returns `positions` /
18780
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
18781
+ * `getTrack`. Mirrors the event-store `projection` convention
18782
+ * (`getObjectEvents` et al.).
18783
+ */
18784
+ var TrackProjectionSchema = _enum(["full", "slim"]);
18785
+ /**
18677
18786
  * One audio-classification label heard on the track's camera while the
18678
18787
  * track was alive, aggregated per label. An "episode" is one persisted
18679
18788
  * audio event (the confident-classification path: score ≥ the device's
@@ -18724,7 +18833,11 @@ var TrackSchema = object({
18724
18833
  /** Audio-classification labels heard on the camera during the track's
18725
18834
  * life (score ≥ device `classificationMinScore`), aggregated per label.
18726
18835
  * Absent on legacy rows / tracks with no confident audio. */
18727
- audioLabels: array(TrackAudioLabelSchema).readonly().optional()
18836
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
18837
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
18838
+ * Populated from the persisted envelope columns on historical reads;
18839
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
18840
+ envelope: TrackEnvelopeSchema.optional()
18728
18841
  });
18729
18842
  var BaseEventFields = {
18730
18843
  id: string(),
@@ -18834,11 +18947,13 @@ var MediaFileSchema = object({
18834
18947
  sizeBytes: number(),
18835
18948
  timestamp: number()
18836
18949
  });
18950
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
18951
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
18837
18952
  var DeviceEventQueryInput = object({
18838
18953
  deviceId: number(),
18839
18954
  since: number().optional(),
18840
18955
  until: number().optional(),
18841
- limit: number().int().min(1).max(5e3).default(1e3),
18956
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
18842
18957
  /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
18843
18958
  * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
18844
18959
  * exact behaviour. Callers may omit this field — the store defaults to
@@ -18846,6 +18961,27 @@ var DeviceEventQueryInput = object({
18846
18961
  projection: _enum(["full", "slim"]).optional()
18847
18962
  });
18848
18963
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
18964
+ var RecentTracksQueryInput = object({
18965
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
18966
+ deviceIds: array(number()),
18967
+ /** Window lower bound on `lastSeen` (inclusive). */
18968
+ since: number().optional(),
18969
+ /** Window upper bound on `lastSeen` (inclusive). */
18970
+ until: number().optional(),
18971
+ /** Page size. Default 200, max 1000. */
18972
+ limit: number().int().min(1).max(1e3).default(200),
18973
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
18974
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
18975
+ cursor: string().optional(),
18976
+ /** See {@link TrackProjectionSchema}. Default `full`. */
18977
+ projection: TrackProjectionSchema.optional()
18978
+ });
18979
+ var RecentTracksPageSchema = object({
18980
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
18981
+ tracks: array(TrackSchema).readonly(),
18982
+ /** Cursor for the next page, or null when this page is the last. */
18983
+ nextCursor: string().nullable()
18984
+ });
18849
18985
  var KeyEventQueryInput = object({
18850
18986
  deviceId: number(),
18851
18987
  /** Window lower bound (track firstSeen ≥ since). */
@@ -18928,11 +19064,25 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18928
19064
  deviceId: number(),
18929
19065
  since: number().optional(),
18930
19066
  until: number().optional(),
18931
- limit: number().optional()
18932
- }), array(TrackSchema).readonly()), method(object({ deviceId: number() }), _void(), {
19067
+ limit: number().optional(),
19068
+ /** Spatial filter only tracks whose trajectory intersects the zone
19069
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
19070
+ * envelope columns, then precisely tested per position. Tracks with
19071
+ * an unknown envelope (no frame dims at persist time) always match. */
19072
+ zone: TrackZoneFilterSchema.optional(),
19073
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
19074
+ * compatible — omitting the field keeps today's exact behaviour). */
19075
+ projection: TrackProjectionSchema.optional()
19076
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
18933
19077
  kind: "mutation",
18934
19078
  auth: "admin"
18935
- }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19079
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({
19080
+ deviceId: number(),
19081
+ since: number().optional(),
19082
+ until: number().optional(),
19083
+ kinds: array(string()).optional(),
19084
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19085
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
18936
19086
  deviceId: number(),
18937
19087
  since: number(),
18938
19088
  until: number(),
@@ -22133,7 +22283,12 @@ var RecordingStorageUsageSchema = object({
22133
22283
  /**
22134
22284
  * Result of locating footage at a wall-clock instant for one device/profile.
22135
22285
  * `segment` carries the covering segment's window; `gap` reports the forward
22136
- * nearest covered edge (`null` past the end of footage / when none exists).
22286
+ * nearest covered edge (`null` past the end of footage / when none exists)
22287
+ * and the backward covered edge `prevEndMs` (exclusive end of the nearest
22288
+ * footage behind the epoch; `null` when none — optional so older providers
22289
+ * that omit it stay valid). `prevEndMs` lets a backward frame-step hop the
22290
+ * small inter-segment cracks (durMs under-covers the span to the next
22291
+ * startMs by ~11-17 ms) instead of no-opping at a segment head.
22137
22292
  */
22138
22293
  var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22139
22294
  kind: literal("segment"),
@@ -22142,7 +22297,8 @@ var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22142
22297
  bytes: number()
22143
22298
  }), object({
22144
22299
  kind: literal("gap"),
22145
- nearestEdgeMs: number().nullable()
22300
+ nearestEdgeMs: number().nullable(),
22301
+ prevEndMs: number().nullable().optional()
22146
22302
  })]);
22147
22303
  /** Raw bytes of one finalized footage segment (read off disk on the recording node). */
22148
22304
  var ReadSegmentBytesResultSchema = object({ data: _instanceof(Uint8Array) });
@@ -23711,6 +23867,12 @@ Object.freeze({
23711
23867
  addonId: null,
23712
23868
  access: "view"
23713
23869
  },
23870
+ "deviceManager.getLinkedDevices": {
23871
+ capName: "device-manager",
23872
+ capScope: "system",
23873
+ addonId: null,
23874
+ access: "view"
23875
+ },
23714
23876
  "deviceManager.getRoleDisplayDefaults": {
23715
23877
  capName: "device-manager",
23716
23878
  capScope: "system",
@@ -25265,6 +25427,12 @@ Object.freeze({
25265
25427
  addonId: null,
25266
25428
  access: "view"
25267
25429
  },
25430
+ "pipelineAnalytics.getSensorEvents": {
25431
+ capName: "pipeline-analytics",
25432
+ capScope: "device",
25433
+ addonId: null,
25434
+ access: "view"
25435
+ },
25268
25436
  "pipelineAnalytics.getTrack": {
25269
25437
  capName: "pipeline-analytics",
25270
25438
  capScope: "device",
@@ -25277,6 +25445,18 @@ Object.freeze({
25277
25445
  addonId: null,
25278
25446
  access: "view"
25279
25447
  },
25448
+ "pipelineAnalytics.listEventKinds": {
25449
+ capName: "pipeline-analytics",
25450
+ capScope: "device",
25451
+ addonId: null,
25452
+ access: "view"
25453
+ },
25454
+ "pipelineAnalytics.listRecentTracks": {
25455
+ capName: "pipeline-analytics",
25456
+ capScope: "device",
25457
+ addonId: null,
25458
+ access: "view"
25459
+ },
25280
25460
  "pipelineAnalytics.listTracks": {
25281
25461
  capName: "pipeline-analytics",
25282
25462
  capScope: "device",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-vesync",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "VeSync cloud-account device-provider addon for CamStack — Levoit / Cosori air purifiers as Fan devices (power, speed, preset, child-lock, display, air-quality + filter-life sensors)",
5
5
  "keywords": [
6
6
  "camstack",