@camstack/addon-provider-amcrest 0.1.10 → 0.1.11

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
@@ -4,7 +4,7 @@ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).expor
4
4
  //#endregion
5
5
  let node_crypto = require("node:crypto");
6
6
  let node_os = require("node:os");
7
- //#region ../types/dist/event-category-CFZs3jI4.mjs
7
+ //#region ../types/dist/event-category-H4AVePnn.mjs
8
8
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
9
9
  EventCategory["SystemBoot"] = "system.boot";
10
10
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -154,6 +154,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
154
154
  EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
155
155
  EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
156
156
  EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
157
+ /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
158
+ * thumb is a scrub gap the recorder's keyframe backfill covers. */
159
+ EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
157
160
  EventCategory["DetectionEvent"] = "detection.event";
158
161
  EventCategory["SessionTrackNew"] = "session.track.new";
159
162
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -10865,10 +10868,23 @@ var deviceDiscoveryCapability = {
10865
10868
  }
10866
10869
  };
10867
10870
  /**
10868
- * Doorbell button cap. Installed on a `DeviceType.Button` accessory
10869
- * with `role: DeviceRole.Doorbell`. Emits an `onPressed` event every
10870
- * time the firmware pushes a ring; status tracks the last press and
10871
- * a pressCount since start (diagnostic).
10871
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
10872
+ * name (same pattern as `snapshot`):
10873
+ *
10874
+ * - **Native** providers: registered per-device by device-driver
10875
+ * addons via `ctx.registerNativeCap` — either on a
10876
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
10877
+ * or directly on the camera (Reolink registers at camera level).
10878
+ * Emits an `onPressed` event every time the firmware pushes a
10879
+ * ring; status tracks the last press and a pressCount since start
10880
+ * (diagnostic).
10881
+ *
10882
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
10883
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
10884
+ * device (contact / switch / event-emitter …) into a doorbell for
10885
+ * a camera. `defaultActive: false` — the operator explicitly binds
10886
+ * it per camera in the device-bindings UI, then picks the source
10887
+ * device + trigger in the per-device settings.
10872
10888
  *
10873
10889
  * The DeviceEventPropagator re-emits `onPressed` on the camera parent
10874
10890
  * — subscribers listening at the camera level receive ring events
@@ -10889,7 +10905,10 @@ var doorbellCapability = {
10889
10905
  scope: "device",
10890
10906
  deviceNative: true,
10891
10907
  mode: "singleton",
10892
- deviceTypes: [DeviceType.Button],
10908
+ kind: "wrapper",
10909
+ defaultActive: false,
10910
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
10911
+ exposesDeviceSettings: true,
10893
10912
  methods: {},
10894
10913
  events: {
10895
10914
  /**
@@ -17241,6 +17260,14 @@ var ConfigEntrySchema = object({
17241
17260
  value: unknown(),
17242
17261
  description: string().optional()
17243
17262
  });
17263
+ var DeviceLinkModeSchema = _enum(["auto", "manual"]);
17264
+ /** One resolved linked device — the compact projection consumers need. */
17265
+ var LinkedDeviceSchema = object({
17266
+ deviceId: number(),
17267
+ name: string(),
17268
+ location: string().nullable(),
17269
+ features: array(string())
17270
+ });
17244
17271
  var SavedDeviceRowSchema = object({
17245
17272
  /** Numeric id reserved at allocateDeviceId time. */
17246
17273
  id: number(),
@@ -17462,7 +17489,10 @@ method(object({
17462
17489
  }), _void(), {
17463
17490
  kind: "mutation",
17464
17491
  auth: "admin"
17465
- }), 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({
17492
+ }), 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({
17493
+ mode: DeviceLinkModeSchema,
17494
+ devices: array(LinkedDeviceSchema)
17495
+ })), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
17466
17496
  deviceId: number(),
17467
17497
  values: record(string(), unknown())
17468
17498
  }), object({ success: literal(true) }), {
@@ -18731,6 +18761,61 @@ var EventKindSchema = _enum([
18731
18761
  "object",
18732
18762
  "audio"
18733
18763
  ]);
18764
+ /**
18765
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
18766
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
18767
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
18768
+ */
18769
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
18770
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
18771
+ var EventKindIconSchema = _enum([
18772
+ "motion",
18773
+ "audio",
18774
+ "person",
18775
+ "vehicle",
18776
+ "animal",
18777
+ "door",
18778
+ "pir",
18779
+ "smoke",
18780
+ "water",
18781
+ "button",
18782
+ "generic"
18783
+ ]);
18784
+ var EventKindCategorySchema = _enum([
18785
+ "motion",
18786
+ "audio",
18787
+ "detection",
18788
+ "sensor",
18789
+ "custom"
18790
+ ]);
18791
+ var EventKindDescriptorSchema = object({
18792
+ /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
18793
+ kind: string(),
18794
+ label: string(),
18795
+ /** Hex color for timeline/legend rendering. */
18796
+ color: string(),
18797
+ icon: EventKindIconSchema,
18798
+ category: EventKindCategorySchema,
18799
+ /** Which cap + device contributes this kind. For built-ins the camera
18800
+ * itself; for sensor kinds the LINKED source device. */
18801
+ source: object({
18802
+ capName: string(),
18803
+ deviceId: number()
18804
+ })
18805
+ });
18806
+ var SensorEventSchema = object({
18807
+ id: string(),
18808
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
18809
+ * yields N rows, one per camera). */
18810
+ deviceId: number(),
18811
+ /** The linked sensor device whose state changed. */
18812
+ sourceDeviceId: number(),
18813
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
18814
+ kind: string(),
18815
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
18816
+ value: record(string(), unknown()).nullable(),
18817
+ timestamp: number()
18818
+ });
18734
18819
  var TrackPositionSchema = object({
18735
18820
  x: number(),
18736
18821
  y: number(),
@@ -18744,6 +18829,30 @@ var TrackSnapshotSchema = object({
18744
18829
  mediaKey: string()
18745
18830
  });
18746
18831
  /**
18832
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
18833
+ * divided by the track's detection-frame dims), computed at persist time.
18834
+ * Absent when the frame dims were unknown when the track was persisted
18835
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
18836
+ */
18837
+ var TrackEnvelopeSchema = object({
18838
+ minX: number(),
18839
+ minY: number(),
18840
+ maxX: number(),
18841
+ maxY: number()
18842
+ });
18843
+ /**
18844
+ * Row projection for track list queries. `full` (default) returns the
18845
+ * complete Track including the frame-rate `positions[]` history and the
18846
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
18847
+ * keeps every scalar the list surfaces actually render (ids, class(es),
18848
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
18849
+ * zonesVisited, bestEventId, envelope) and returns `positions` /
18850
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
18851
+ * `getTrack`. Mirrors the event-store `projection` convention
18852
+ * (`getObjectEvents` et al.).
18853
+ */
18854
+ var TrackProjectionSchema = _enum(["full", "slim"]);
18855
+ /**
18747
18856
  * One audio-classification label heard on the track's camera while the
18748
18857
  * track was alive, aggregated per label. An "episode" is one persisted
18749
18858
  * audio event (the confident-classification path: score ≥ the device's
@@ -18794,7 +18903,11 @@ var TrackSchema = object({
18794
18903
  /** Audio-classification labels heard on the camera during the track's
18795
18904
  * life (score ≥ device `classificationMinScore`), aggregated per label.
18796
18905
  * Absent on legacy rows / tracks with no confident audio. */
18797
- audioLabels: array(TrackAudioLabelSchema).readonly().optional()
18906
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
18907
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
18908
+ * Populated from the persisted envelope columns on historical reads;
18909
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
18910
+ envelope: TrackEnvelopeSchema.optional()
18798
18911
  });
18799
18912
  var BaseEventFields = {
18800
18913
  id: string(),
@@ -18904,11 +19017,13 @@ var MediaFileSchema = object({
18904
19017
  sizeBytes: number(),
18905
19018
  timestamp: number()
18906
19019
  });
19020
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
19021
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
18907
19022
  var DeviceEventQueryInput = object({
18908
19023
  deviceId: number(),
18909
19024
  since: number().optional(),
18910
19025
  until: number().optional(),
18911
- limit: number().int().min(1).max(5e3).default(1e3),
19026
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
18912
19027
  /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
18913
19028
  * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
18914
19029
  * exact behaviour. Callers may omit this field — the store defaults to
@@ -18916,6 +19031,27 @@ var DeviceEventQueryInput = object({
18916
19031
  projection: _enum(["full", "slim"]).optional()
18917
19032
  });
18918
19033
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
19034
+ var RecentTracksQueryInput = object({
19035
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
19036
+ deviceIds: array(number()),
19037
+ /** Window lower bound on `lastSeen` (inclusive). */
19038
+ since: number().optional(),
19039
+ /** Window upper bound on `lastSeen` (inclusive). */
19040
+ until: number().optional(),
19041
+ /** Page size. Default 200, max 1000. */
19042
+ limit: number().int().min(1).max(1e3).default(200),
19043
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
19044
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
19045
+ cursor: string().optional(),
19046
+ /** See {@link TrackProjectionSchema}. Default `full`. */
19047
+ projection: TrackProjectionSchema.optional()
19048
+ });
19049
+ var RecentTracksPageSchema = object({
19050
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
19051
+ tracks: array(TrackSchema).readonly(),
19052
+ /** Cursor for the next page, or null when this page is the last. */
19053
+ nextCursor: string().nullable()
19054
+ });
18919
19055
  var KeyEventQueryInput = object({
18920
19056
  deviceId: number(),
18921
19057
  /** Window lower bound (track firstSeen ≥ since). */
@@ -18998,11 +19134,25 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18998
19134
  deviceId: number(),
18999
19135
  since: number().optional(),
19000
19136
  until: number().optional(),
19001
- limit: number().optional()
19002
- }), array(TrackSchema).readonly()), method(object({ deviceId: number() }), _void(), {
19137
+ limit: number().optional(),
19138
+ /** Spatial filter only tracks whose trajectory intersects the zone
19139
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
19140
+ * envelope columns, then precisely tested per position. Tracks with
19141
+ * an unknown envelope (no frame dims at persist time) always match. */
19142
+ zone: TrackZoneFilterSchema.optional(),
19143
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
19144
+ * compatible — omitting the field keeps today's exact behaviour). */
19145
+ projection: TrackProjectionSchema.optional()
19146
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
19003
19147
  kind: "mutation",
19004
19148
  auth: "admin"
19005
- }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19149
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({
19150
+ deviceId: number(),
19151
+ since: number().optional(),
19152
+ until: number().optional(),
19153
+ kinds: array(string()).optional(),
19154
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19155
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19006
19156
  deviceId: number(),
19007
19157
  since: number(),
19008
19158
  until: number(),
@@ -22342,7 +22492,12 @@ var RecordingStorageUsageSchema = object({
22342
22492
  /**
22343
22493
  * Result of locating footage at a wall-clock instant for one device/profile.
22344
22494
  * `segment` carries the covering segment's window; `gap` reports the forward
22345
- * nearest covered edge (`null` past the end of footage / when none exists).
22495
+ * nearest covered edge (`null` past the end of footage / when none exists)
22496
+ * and the backward covered edge `prevEndMs` (exclusive end of the nearest
22497
+ * footage behind the epoch; `null` when none — optional so older providers
22498
+ * that omit it stay valid). `prevEndMs` lets a backward frame-step hop the
22499
+ * small inter-segment cracks (durMs under-covers the span to the next
22500
+ * startMs by ~11-17 ms) instead of no-opping at a segment head.
22346
22501
  */
22347
22502
  var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22348
22503
  kind: literal("segment"),
@@ -22351,7 +22506,8 @@ var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22351
22506
  bytes: number()
22352
22507
  }), object({
22353
22508
  kind: literal("gap"),
22354
- nearestEdgeMs: number().nullable()
22509
+ nearestEdgeMs: number().nullable(),
22510
+ prevEndMs: number().nullable().optional()
22355
22511
  })]);
22356
22512
  /** Raw bytes of one finalized footage segment (read off disk on the recording node). */
22357
22513
  var ReadSegmentBytesResultSchema = object({ data: _instanceof(Uint8Array) });
@@ -24131,6 +24287,12 @@ Object.freeze({
24131
24287
  addonId: null,
24132
24288
  access: "view"
24133
24289
  },
24290
+ "deviceManager.getLinkedDevices": {
24291
+ capName: "device-manager",
24292
+ capScope: "system",
24293
+ addonId: null,
24294
+ access: "view"
24295
+ },
24134
24296
  "deviceManager.getRoleDisplayDefaults": {
24135
24297
  capName: "device-manager",
24136
24298
  capScope: "system",
@@ -25685,6 +25847,12 @@ Object.freeze({
25685
25847
  addonId: null,
25686
25848
  access: "view"
25687
25849
  },
25850
+ "pipelineAnalytics.getSensorEvents": {
25851
+ capName: "pipeline-analytics",
25852
+ capScope: "device",
25853
+ addonId: null,
25854
+ access: "view"
25855
+ },
25688
25856
  "pipelineAnalytics.getTrack": {
25689
25857
  capName: "pipeline-analytics",
25690
25858
  capScope: "device",
@@ -25697,6 +25865,18 @@ Object.freeze({
25697
25865
  addonId: null,
25698
25866
  access: "view"
25699
25867
  },
25868
+ "pipelineAnalytics.listEventKinds": {
25869
+ capName: "pipeline-analytics",
25870
+ capScope: "device",
25871
+ addonId: null,
25872
+ access: "view"
25873
+ },
25874
+ "pipelineAnalytics.listRecentTracks": {
25875
+ capName: "pipeline-analytics",
25876
+ capScope: "device",
25877
+ addonId: null,
25878
+ access: "view"
25879
+ },
25700
25880
  "pipelineAnalytics.listTracks": {
25701
25881
  capName: "pipeline-analytics",
25702
25882
  capScope: "device",
package/dist/addon.mjs CHANGED
@@ -5,7 +5,7 @@ import { networkInterfaces } from "node:os";
5
5
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
6
6
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
7
7
  //#endregion
8
- //#region ../types/dist/event-category-CFZs3jI4.mjs
8
+ //#region ../types/dist/event-category-H4AVePnn.mjs
9
9
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
10
10
  EventCategory["SystemBoot"] = "system.boot";
11
11
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -155,6 +155,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
155
155
  EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
156
156
  EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
157
157
  EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
158
+ /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
159
+ * thumb is a scrub gap the recorder's keyframe backfill covers. */
160
+ EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
158
161
  EventCategory["DetectionEvent"] = "detection.event";
159
162
  EventCategory["SessionTrackNew"] = "session.track.new";
160
163
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -10866,10 +10869,23 @@ var deviceDiscoveryCapability = {
10866
10869
  }
10867
10870
  };
10868
10871
  /**
10869
- * Doorbell button cap. Installed on a `DeviceType.Button` accessory
10870
- * with `role: DeviceRole.Doorbell`. Emits an `onPressed` event every
10871
- * time the firmware pushes a ring; status tracks the last press and
10872
- * a pressCount since start (diagnostic).
10872
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
10873
+ * name (same pattern as `snapshot`):
10874
+ *
10875
+ * - **Native** providers: registered per-device by device-driver
10876
+ * addons via `ctx.registerNativeCap` — either on a
10877
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
10878
+ * or directly on the camera (Reolink registers at camera level).
10879
+ * Emits an `onPressed` event every time the firmware pushes a
10880
+ * ring; status tracks the last press and a pressCount since start
10881
+ * (diagnostic).
10882
+ *
10883
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
10884
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
10885
+ * device (contact / switch / event-emitter …) into a doorbell for
10886
+ * a camera. `defaultActive: false` — the operator explicitly binds
10887
+ * it per camera in the device-bindings UI, then picks the source
10888
+ * device + trigger in the per-device settings.
10873
10889
  *
10874
10890
  * The DeviceEventPropagator re-emits `onPressed` on the camera parent
10875
10891
  * — subscribers listening at the camera level receive ring events
@@ -10890,7 +10906,10 @@ var doorbellCapability = {
10890
10906
  scope: "device",
10891
10907
  deviceNative: true,
10892
10908
  mode: "singleton",
10893
- deviceTypes: [DeviceType.Button],
10909
+ kind: "wrapper",
10910
+ defaultActive: false,
10911
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
10912
+ exposesDeviceSettings: true,
10894
10913
  methods: {},
10895
10914
  events: {
10896
10915
  /**
@@ -17242,6 +17261,14 @@ var ConfigEntrySchema = object({
17242
17261
  value: unknown(),
17243
17262
  description: string().optional()
17244
17263
  });
17264
+ var DeviceLinkModeSchema = _enum(["auto", "manual"]);
17265
+ /** One resolved linked device — the compact projection consumers need. */
17266
+ var LinkedDeviceSchema = object({
17267
+ deviceId: number(),
17268
+ name: string(),
17269
+ location: string().nullable(),
17270
+ features: array(string())
17271
+ });
17245
17272
  var SavedDeviceRowSchema = object({
17246
17273
  /** Numeric id reserved at allocateDeviceId time. */
17247
17274
  id: number(),
@@ -17463,7 +17490,10 @@ method(object({
17463
17490
  }), _void(), {
17464
17491
  kind: "mutation",
17465
17492
  auth: "admin"
17466
- }), 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({
17493
+ }), 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({
17494
+ mode: DeviceLinkModeSchema,
17495
+ devices: array(LinkedDeviceSchema)
17496
+ })), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
17467
17497
  deviceId: number(),
17468
17498
  values: record(string(), unknown())
17469
17499
  }), object({ success: literal(true) }), {
@@ -18732,6 +18762,61 @@ var EventKindSchema = _enum([
18732
18762
  "object",
18733
18763
  "audio"
18734
18764
  ]);
18765
+ /**
18766
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
18767
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
18768
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
18769
+ */
18770
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
18771
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
18772
+ var EventKindIconSchema = _enum([
18773
+ "motion",
18774
+ "audio",
18775
+ "person",
18776
+ "vehicle",
18777
+ "animal",
18778
+ "door",
18779
+ "pir",
18780
+ "smoke",
18781
+ "water",
18782
+ "button",
18783
+ "generic"
18784
+ ]);
18785
+ var EventKindCategorySchema = _enum([
18786
+ "motion",
18787
+ "audio",
18788
+ "detection",
18789
+ "sensor",
18790
+ "custom"
18791
+ ]);
18792
+ var EventKindDescriptorSchema = object({
18793
+ /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
18794
+ kind: string(),
18795
+ label: string(),
18796
+ /** Hex color for timeline/legend rendering. */
18797
+ color: string(),
18798
+ icon: EventKindIconSchema,
18799
+ category: EventKindCategorySchema,
18800
+ /** Which cap + device contributes this kind. For built-ins the camera
18801
+ * itself; for sensor kinds the LINKED source device. */
18802
+ source: object({
18803
+ capName: string(),
18804
+ deviceId: number()
18805
+ })
18806
+ });
18807
+ var SensorEventSchema = object({
18808
+ id: string(),
18809
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
18810
+ * yields N rows, one per camera). */
18811
+ deviceId: number(),
18812
+ /** The linked sensor device whose state changed. */
18813
+ sourceDeviceId: number(),
18814
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
18815
+ kind: string(),
18816
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
18817
+ value: record(string(), unknown()).nullable(),
18818
+ timestamp: number()
18819
+ });
18735
18820
  var TrackPositionSchema = object({
18736
18821
  x: number(),
18737
18822
  y: number(),
@@ -18745,6 +18830,30 @@ var TrackSnapshotSchema = object({
18745
18830
  mediaKey: string()
18746
18831
  });
18747
18832
  /**
18833
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
18834
+ * divided by the track's detection-frame dims), computed at persist time.
18835
+ * Absent when the frame dims were unknown when the track was persisted
18836
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
18837
+ */
18838
+ var TrackEnvelopeSchema = object({
18839
+ minX: number(),
18840
+ minY: number(),
18841
+ maxX: number(),
18842
+ maxY: number()
18843
+ });
18844
+ /**
18845
+ * Row projection for track list queries. `full` (default) returns the
18846
+ * complete Track including the frame-rate `positions[]` history and the
18847
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
18848
+ * keeps every scalar the list surfaces actually render (ids, class(es),
18849
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
18850
+ * zonesVisited, bestEventId, envelope) and returns `positions` /
18851
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
18852
+ * `getTrack`. Mirrors the event-store `projection` convention
18853
+ * (`getObjectEvents` et al.).
18854
+ */
18855
+ var TrackProjectionSchema = _enum(["full", "slim"]);
18856
+ /**
18748
18857
  * One audio-classification label heard on the track's camera while the
18749
18858
  * track was alive, aggregated per label. An "episode" is one persisted
18750
18859
  * audio event (the confident-classification path: score ≥ the device's
@@ -18795,7 +18904,11 @@ var TrackSchema = object({
18795
18904
  /** Audio-classification labels heard on the camera during the track's
18796
18905
  * life (score ≥ device `classificationMinScore`), aggregated per label.
18797
18906
  * Absent on legacy rows / tracks with no confident audio. */
18798
- audioLabels: array(TrackAudioLabelSchema).readonly().optional()
18907
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
18908
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
18909
+ * Populated from the persisted envelope columns on historical reads;
18910
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
18911
+ envelope: TrackEnvelopeSchema.optional()
18799
18912
  });
18800
18913
  var BaseEventFields = {
18801
18914
  id: string(),
@@ -18905,11 +19018,13 @@ var MediaFileSchema = object({
18905
19018
  sizeBytes: number(),
18906
19019
  timestamp: number()
18907
19020
  });
19021
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
19022
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
18908
19023
  var DeviceEventQueryInput = object({
18909
19024
  deviceId: number(),
18910
19025
  since: number().optional(),
18911
19026
  until: number().optional(),
18912
- limit: number().int().min(1).max(5e3).default(1e3),
19027
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
18913
19028
  /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
18914
19029
  * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
18915
19030
  * exact behaviour. Callers may omit this field — the store defaults to
@@ -18917,6 +19032,27 @@ var DeviceEventQueryInput = object({
18917
19032
  projection: _enum(["full", "slim"]).optional()
18918
19033
  });
18919
19034
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
19035
+ var RecentTracksQueryInput = object({
19036
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
19037
+ deviceIds: array(number()),
19038
+ /** Window lower bound on `lastSeen` (inclusive). */
19039
+ since: number().optional(),
19040
+ /** Window upper bound on `lastSeen` (inclusive). */
19041
+ until: number().optional(),
19042
+ /** Page size. Default 200, max 1000. */
19043
+ limit: number().int().min(1).max(1e3).default(200),
19044
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
19045
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
19046
+ cursor: string().optional(),
19047
+ /** See {@link TrackProjectionSchema}. Default `full`. */
19048
+ projection: TrackProjectionSchema.optional()
19049
+ });
19050
+ var RecentTracksPageSchema = object({
19051
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
19052
+ tracks: array(TrackSchema).readonly(),
19053
+ /** Cursor for the next page, or null when this page is the last. */
19054
+ nextCursor: string().nullable()
19055
+ });
18920
19056
  var KeyEventQueryInput = object({
18921
19057
  deviceId: number(),
18922
19058
  /** Window lower bound (track firstSeen ≥ since). */
@@ -18999,11 +19135,25 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18999
19135
  deviceId: number(),
19000
19136
  since: number().optional(),
19001
19137
  until: number().optional(),
19002
- limit: number().optional()
19003
- }), array(TrackSchema).readonly()), method(object({ deviceId: number() }), _void(), {
19138
+ limit: number().optional(),
19139
+ /** Spatial filter only tracks whose trajectory intersects the zone
19140
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
19141
+ * envelope columns, then precisely tested per position. Tracks with
19142
+ * an unknown envelope (no frame dims at persist time) always match. */
19143
+ zone: TrackZoneFilterSchema.optional(),
19144
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
19145
+ * compatible — omitting the field keeps today's exact behaviour). */
19146
+ projection: TrackProjectionSchema.optional()
19147
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
19004
19148
  kind: "mutation",
19005
19149
  auth: "admin"
19006
- }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19150
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({
19151
+ deviceId: number(),
19152
+ since: number().optional(),
19153
+ until: number().optional(),
19154
+ kinds: array(string()).optional(),
19155
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19156
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19007
19157
  deviceId: number(),
19008
19158
  since: number(),
19009
19159
  until: number(),
@@ -22343,7 +22493,12 @@ var RecordingStorageUsageSchema = object({
22343
22493
  /**
22344
22494
  * Result of locating footage at a wall-clock instant for one device/profile.
22345
22495
  * `segment` carries the covering segment's window; `gap` reports the forward
22346
- * nearest covered edge (`null` past the end of footage / when none exists).
22496
+ * nearest covered edge (`null` past the end of footage / when none exists)
22497
+ * and the backward covered edge `prevEndMs` (exclusive end of the nearest
22498
+ * footage behind the epoch; `null` when none — optional so older providers
22499
+ * that omit it stay valid). `prevEndMs` lets a backward frame-step hop the
22500
+ * small inter-segment cracks (durMs under-covers the span to the next
22501
+ * startMs by ~11-17 ms) instead of no-opping at a segment head.
22347
22502
  */
22348
22503
  var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22349
22504
  kind: literal("segment"),
@@ -22352,7 +22507,8 @@ var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22352
22507
  bytes: number()
22353
22508
  }), object({
22354
22509
  kind: literal("gap"),
22355
- nearestEdgeMs: number().nullable()
22510
+ nearestEdgeMs: number().nullable(),
22511
+ prevEndMs: number().nullable().optional()
22356
22512
  })]);
22357
22513
  /** Raw bytes of one finalized footage segment (read off disk on the recording node). */
22358
22514
  var ReadSegmentBytesResultSchema = object({ data: _instanceof(Uint8Array) });
@@ -24132,6 +24288,12 @@ Object.freeze({
24132
24288
  addonId: null,
24133
24289
  access: "view"
24134
24290
  },
24291
+ "deviceManager.getLinkedDevices": {
24292
+ capName: "device-manager",
24293
+ capScope: "system",
24294
+ addonId: null,
24295
+ access: "view"
24296
+ },
24135
24297
  "deviceManager.getRoleDisplayDefaults": {
24136
24298
  capName: "device-manager",
24137
24299
  capScope: "system",
@@ -25686,6 +25848,12 @@ Object.freeze({
25686
25848
  addonId: null,
25687
25849
  access: "view"
25688
25850
  },
25851
+ "pipelineAnalytics.getSensorEvents": {
25852
+ capName: "pipeline-analytics",
25853
+ capScope: "device",
25854
+ addonId: null,
25855
+ access: "view"
25856
+ },
25689
25857
  "pipelineAnalytics.getTrack": {
25690
25858
  capName: "pipeline-analytics",
25691
25859
  capScope: "device",
@@ -25698,6 +25866,18 @@ Object.freeze({
25698
25866
  addonId: null,
25699
25867
  access: "view"
25700
25868
  },
25869
+ "pipelineAnalytics.listEventKinds": {
25870
+ capName: "pipeline-analytics",
25871
+ capScope: "device",
25872
+ addonId: null,
25873
+ access: "view"
25874
+ },
25875
+ "pipelineAnalytics.listRecentTracks": {
25876
+ capName: "pipeline-analytics",
25877
+ capScope: "device",
25878
+ addonId: null,
25879
+ access: "view"
25880
+ },
25701
25881
  "pipelineAnalytics.listTracks": {
25702
25882
  capName: "pipeline-analytics",
25703
25883
  capScope: "device",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-amcrest",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Amcrest/Dahua camera device provider addon for CamStack — Dahua CGI over HTTP(S) with digest auth (snapshot, RTSP catalog, PTZ, image/day-night config)",
5
5
  "keywords": [
6
6
  "camstack",