@camstack/addon-provider-amcrest 0.1.10 → 0.1.12

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 +220 -15
  2. package/dist/addon.mjs +220 -15
  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";
@@ -7227,6 +7230,24 @@ var RecordingRetentionSchema = object({
7227
7230
  maxSizeGb: number().min(0).optional()
7228
7231
  });
7229
7232
  /**
7233
+ * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7234
+ * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7235
+ * previews at. Five graduated steps; absent on a config = `standard` (the
7236
+ * shipped default, matching `sheet-geometry`/`sheet-composer`).
7237
+ *
7238
+ * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7239
+ * Each window's index sidecar carries its own tile dims, so a camera whose
7240
+ * preset changed over time renders every historical window at the dims it was
7241
+ * written with.
7242
+ */
7243
+ var ScrubThumbnailPresetSchema = _enum([
7244
+ "minimal",
7245
+ "low",
7246
+ "standard",
7247
+ "high",
7248
+ "max"
7249
+ ]);
7250
+ /**
7230
7251
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7231
7252
  *
7232
7253
  * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
@@ -7263,7 +7284,14 @@ var RecordingConfigSchema = object({
7263
7284
  * derived into bands once via `migrateConfigToBands`.
7264
7285
  */
7265
7286
  bands: array(RecordingBandSchema).optional(),
7266
- retention: RecordingRetentionSchema.optional()
7287
+ retention: RecordingRetentionSchema.optional(),
7288
+ /**
7289
+ * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7290
+ * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7291
+ * windows only — existing sheets are immutable, and each window's index
7292
+ * carries its own tile dims so mixed-preset history renders correctly.
7293
+ */
7294
+ scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7267
7295
  });
7268
7296
  /**
7269
7297
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -10865,10 +10893,23 @@ var deviceDiscoveryCapability = {
10865
10893
  }
10866
10894
  };
10867
10895
  /**
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).
10896
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
10897
+ * name (same pattern as `snapshot`):
10898
+ *
10899
+ * - **Native** providers: registered per-device by device-driver
10900
+ * addons via `ctx.registerNativeCap` — either on a
10901
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
10902
+ * or directly on the camera (Reolink registers at camera level).
10903
+ * Emits an `onPressed` event every time the firmware pushes a
10904
+ * ring; status tracks the last press and a pressCount since start
10905
+ * (diagnostic).
10906
+ *
10907
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
10908
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
10909
+ * device (contact / switch / event-emitter …) into a doorbell for
10910
+ * a camera. `defaultActive: false` — the operator explicitly binds
10911
+ * it per camera in the device-bindings UI, then picks the source
10912
+ * device + trigger in the per-device settings.
10872
10913
  *
10873
10914
  * The DeviceEventPropagator re-emits `onPressed` on the camera parent
10874
10915
  * — subscribers listening at the camera level receive ring events
@@ -10889,7 +10930,10 @@ var doorbellCapability = {
10889
10930
  scope: "device",
10890
10931
  deviceNative: true,
10891
10932
  mode: "singleton",
10892
- deviceTypes: [DeviceType.Button],
10933
+ kind: "wrapper",
10934
+ defaultActive: false,
10935
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
10936
+ exposesDeviceSettings: true,
10893
10937
  methods: {},
10894
10938
  events: {
10895
10939
  /**
@@ -17241,6 +17285,14 @@ var ConfigEntrySchema = object({
17241
17285
  value: unknown(),
17242
17286
  description: string().optional()
17243
17287
  });
17288
+ var DeviceLinkModeSchema = _enum(["auto", "manual"]);
17289
+ /** One resolved linked device — the compact projection consumers need. */
17290
+ var LinkedDeviceSchema = object({
17291
+ deviceId: number(),
17292
+ name: string(),
17293
+ location: string().nullable(),
17294
+ features: array(string())
17295
+ });
17244
17296
  var SavedDeviceRowSchema = object({
17245
17297
  /** Numeric id reserved at allocateDeviceId time. */
17246
17298
  id: number(),
@@ -17462,7 +17514,10 @@ method(object({
17462
17514
  }), _void(), {
17463
17515
  kind: "mutation",
17464
17516
  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({
17517
+ }), 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({
17518
+ mode: DeviceLinkModeSchema,
17519
+ devices: array(LinkedDeviceSchema)
17520
+ })), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
17466
17521
  deviceId: number(),
17467
17522
  values: record(string(), unknown())
17468
17523
  }), object({ success: literal(true) }), {
@@ -18731,6 +18786,61 @@ var EventKindSchema = _enum([
18731
18786
  "object",
18732
18787
  "audio"
18733
18788
  ]);
18789
+ /**
18790
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
18791
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
18792
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
18793
+ */
18794
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
18795
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
18796
+ var EventKindIconSchema = _enum([
18797
+ "motion",
18798
+ "audio",
18799
+ "person",
18800
+ "vehicle",
18801
+ "animal",
18802
+ "door",
18803
+ "pir",
18804
+ "smoke",
18805
+ "water",
18806
+ "button",
18807
+ "generic"
18808
+ ]);
18809
+ var EventKindCategorySchema = _enum([
18810
+ "motion",
18811
+ "audio",
18812
+ "detection",
18813
+ "sensor",
18814
+ "custom"
18815
+ ]);
18816
+ var EventKindDescriptorSchema = object({
18817
+ /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
18818
+ kind: string(),
18819
+ label: string(),
18820
+ /** Hex color for timeline/legend rendering. */
18821
+ color: string(),
18822
+ icon: EventKindIconSchema,
18823
+ category: EventKindCategorySchema,
18824
+ /** Which cap + device contributes this kind. For built-ins the camera
18825
+ * itself; for sensor kinds the LINKED source device. */
18826
+ source: object({
18827
+ capName: string(),
18828
+ deviceId: number()
18829
+ })
18830
+ });
18831
+ var SensorEventSchema = object({
18832
+ id: string(),
18833
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
18834
+ * yields N rows, one per camera). */
18835
+ deviceId: number(),
18836
+ /** The linked sensor device whose state changed. */
18837
+ sourceDeviceId: number(),
18838
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
18839
+ kind: string(),
18840
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
18841
+ value: record(string(), unknown()).nullable(),
18842
+ timestamp: number()
18843
+ });
18734
18844
  var TrackPositionSchema = object({
18735
18845
  x: number(),
18736
18846
  y: number(),
@@ -18744,6 +18854,30 @@ var TrackSnapshotSchema = object({
18744
18854
  mediaKey: string()
18745
18855
  });
18746
18856
  /**
18857
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
18858
+ * divided by the track's detection-frame dims), computed at persist time.
18859
+ * Absent when the frame dims were unknown when the track was persisted
18860
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
18861
+ */
18862
+ var TrackEnvelopeSchema = object({
18863
+ minX: number(),
18864
+ minY: number(),
18865
+ maxX: number(),
18866
+ maxY: number()
18867
+ });
18868
+ /**
18869
+ * Row projection for track list queries. `full` (default) returns the
18870
+ * complete Track including the frame-rate `positions[]` history and the
18871
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
18872
+ * keeps every scalar the list surfaces actually render (ids, class(es),
18873
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
18874
+ * zonesVisited, bestEventId, envelope) and returns `positions` /
18875
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
18876
+ * `getTrack`. Mirrors the event-store `projection` convention
18877
+ * (`getObjectEvents` et al.).
18878
+ */
18879
+ var TrackProjectionSchema = _enum(["full", "slim"]);
18880
+ /**
18747
18881
  * One audio-classification label heard on the track's camera while the
18748
18882
  * track was alive, aggregated per label. An "episode" is one persisted
18749
18883
  * audio event (the confident-classification path: score ≥ the device's
@@ -18794,7 +18928,11 @@ var TrackSchema = object({
18794
18928
  /** Audio-classification labels heard on the camera during the track's
18795
18929
  * life (score ≥ device `classificationMinScore`), aggregated per label.
18796
18930
  * Absent on legacy rows / tracks with no confident audio. */
18797
- audioLabels: array(TrackAudioLabelSchema).readonly().optional()
18931
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
18932
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
18933
+ * Populated from the persisted envelope columns on historical reads;
18934
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
18935
+ envelope: TrackEnvelopeSchema.optional()
18798
18936
  });
18799
18937
  var BaseEventFields = {
18800
18938
  id: string(),
@@ -18904,11 +19042,13 @@ var MediaFileSchema = object({
18904
19042
  sizeBytes: number(),
18905
19043
  timestamp: number()
18906
19044
  });
19045
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
19046
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
18907
19047
  var DeviceEventQueryInput = object({
18908
19048
  deviceId: number(),
18909
19049
  since: number().optional(),
18910
19050
  until: number().optional(),
18911
- limit: number().int().min(1).max(5e3).default(1e3),
19051
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
18912
19052
  /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
18913
19053
  * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
18914
19054
  * exact behaviour. Callers may omit this field — the store defaults to
@@ -18916,6 +19056,27 @@ var DeviceEventQueryInput = object({
18916
19056
  projection: _enum(["full", "slim"]).optional()
18917
19057
  });
18918
19058
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
19059
+ var RecentTracksQueryInput = object({
19060
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
19061
+ deviceIds: array(number()),
19062
+ /** Window lower bound on `lastSeen` (inclusive). */
19063
+ since: number().optional(),
19064
+ /** Window upper bound on `lastSeen` (inclusive). */
19065
+ until: number().optional(),
19066
+ /** Page size. Default 200, max 1000. */
19067
+ limit: number().int().min(1).max(1e3).default(200),
19068
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
19069
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
19070
+ cursor: string().optional(),
19071
+ /** See {@link TrackProjectionSchema}. Default `full`. */
19072
+ projection: TrackProjectionSchema.optional()
19073
+ });
19074
+ var RecentTracksPageSchema = object({
19075
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
19076
+ tracks: array(TrackSchema).readonly(),
19077
+ /** Cursor for the next page, or null when this page is the last. */
19078
+ nextCursor: string().nullable()
19079
+ });
18919
19080
  var KeyEventQueryInput = object({
18920
19081
  deviceId: number(),
18921
19082
  /** Window lower bound (track firstSeen ≥ since). */
@@ -18998,11 +19159,25 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18998
19159
  deviceId: number(),
18999
19160
  since: number().optional(),
19000
19161
  until: number().optional(),
19001
- limit: number().optional()
19002
- }), array(TrackSchema).readonly()), method(object({ deviceId: number() }), _void(), {
19162
+ limit: number().optional(),
19163
+ /** Spatial filter only tracks whose trajectory intersects the zone
19164
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
19165
+ * envelope columns, then precisely tested per position. Tracks with
19166
+ * an unknown envelope (no frame dims at persist time) always match. */
19167
+ zone: TrackZoneFilterSchema.optional(),
19168
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
19169
+ * compatible — omitting the field keeps today's exact behaviour). */
19170
+ projection: TrackProjectionSchema.optional()
19171
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
19003
19172
  kind: "mutation",
19004
19173
  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({
19174
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({
19175
+ deviceId: number(),
19176
+ since: number().optional(),
19177
+ until: number().optional(),
19178
+ kinds: array(string()).optional(),
19179
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19180
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19006
19181
  deviceId: number(),
19007
19182
  since: number(),
19008
19183
  until: number(),
@@ -22342,7 +22517,12 @@ var RecordingStorageUsageSchema = object({
22342
22517
  /**
22343
22518
  * Result of locating footage at a wall-clock instant for one device/profile.
22344
22519
  * `segment` carries the covering segment's window; `gap` reports the forward
22345
- * nearest covered edge (`null` past the end of footage / when none exists).
22520
+ * nearest covered edge (`null` past the end of footage / when none exists)
22521
+ * and the backward covered edge `prevEndMs` (exclusive end of the nearest
22522
+ * footage behind the epoch; `null` when none — optional so older providers
22523
+ * that omit it stay valid). `prevEndMs` lets a backward frame-step hop the
22524
+ * small inter-segment cracks (durMs under-covers the span to the next
22525
+ * startMs by ~11-17 ms) instead of no-opping at a segment head.
22346
22526
  */
22347
22527
  var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22348
22528
  kind: literal("segment"),
@@ -22351,7 +22531,8 @@ var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22351
22531
  bytes: number()
22352
22532
  }), object({
22353
22533
  kind: literal("gap"),
22354
- nearestEdgeMs: number().nullable()
22534
+ nearestEdgeMs: number().nullable(),
22535
+ prevEndMs: number().nullable().optional()
22355
22536
  })]);
22356
22537
  /** Raw bytes of one finalized footage segment (read off disk on the recording node). */
22357
22538
  var ReadSegmentBytesResultSchema = object({ data: _instanceof(Uint8Array) });
@@ -24131,6 +24312,12 @@ Object.freeze({
24131
24312
  addonId: null,
24132
24313
  access: "view"
24133
24314
  },
24315
+ "deviceManager.getLinkedDevices": {
24316
+ capName: "device-manager",
24317
+ capScope: "system",
24318
+ addonId: null,
24319
+ access: "view"
24320
+ },
24134
24321
  "deviceManager.getRoleDisplayDefaults": {
24135
24322
  capName: "device-manager",
24136
24323
  capScope: "system",
@@ -25685,6 +25872,12 @@ Object.freeze({
25685
25872
  addonId: null,
25686
25873
  access: "view"
25687
25874
  },
25875
+ "pipelineAnalytics.getSensorEvents": {
25876
+ capName: "pipeline-analytics",
25877
+ capScope: "device",
25878
+ addonId: null,
25879
+ access: "view"
25880
+ },
25688
25881
  "pipelineAnalytics.getTrack": {
25689
25882
  capName: "pipeline-analytics",
25690
25883
  capScope: "device",
@@ -25697,6 +25890,18 @@ Object.freeze({
25697
25890
  addonId: null,
25698
25891
  access: "view"
25699
25892
  },
25893
+ "pipelineAnalytics.listEventKinds": {
25894
+ capName: "pipeline-analytics",
25895
+ capScope: "device",
25896
+ addonId: null,
25897
+ access: "view"
25898
+ },
25899
+ "pipelineAnalytics.listRecentTracks": {
25900
+ capName: "pipeline-analytics",
25901
+ capScope: "device",
25902
+ addonId: null,
25903
+ access: "view"
25904
+ },
25700
25905
  "pipelineAnalytics.listTracks": {
25701
25906
  capName: "pipeline-analytics",
25702
25907
  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";
@@ -7228,6 +7231,24 @@ var RecordingRetentionSchema = object({
7228
7231
  maxSizeGb: number().min(0).optional()
7229
7232
  });
7230
7233
  /**
7234
+ * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7235
+ * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7236
+ * previews at. Five graduated steps; absent on a config = `standard` (the
7237
+ * shipped default, matching `sheet-geometry`/`sheet-composer`).
7238
+ *
7239
+ * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7240
+ * Each window's index sidecar carries its own tile dims, so a camera whose
7241
+ * preset changed over time renders every historical window at the dims it was
7242
+ * written with.
7243
+ */
7244
+ var ScrubThumbnailPresetSchema = _enum([
7245
+ "minimal",
7246
+ "low",
7247
+ "standard",
7248
+ "high",
7249
+ "max"
7250
+ ]);
7251
+ /**
7231
7252
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7232
7253
  *
7233
7254
  * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
@@ -7264,7 +7285,14 @@ var RecordingConfigSchema = object({
7264
7285
  * derived into bands once via `migrateConfigToBands`.
7265
7286
  */
7266
7287
  bands: array(RecordingBandSchema).optional(),
7267
- retention: RecordingRetentionSchema.optional()
7288
+ retention: RecordingRetentionSchema.optional(),
7289
+ /**
7290
+ * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7291
+ * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7292
+ * windows only — existing sheets are immutable, and each window's index
7293
+ * carries its own tile dims so mixed-preset history renders correctly.
7294
+ */
7295
+ scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7268
7296
  });
7269
7297
  /**
7270
7298
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -10866,10 +10894,23 @@ var deviceDiscoveryCapability = {
10866
10894
  }
10867
10895
  };
10868
10896
  /**
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).
10897
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
10898
+ * name (same pattern as `snapshot`):
10899
+ *
10900
+ * - **Native** providers: registered per-device by device-driver
10901
+ * addons via `ctx.registerNativeCap` — either on a
10902
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
10903
+ * or directly on the camera (Reolink registers at camera level).
10904
+ * Emits an `onPressed` event every time the firmware pushes a
10905
+ * ring; status tracks the last press and a pressCount since start
10906
+ * (diagnostic).
10907
+ *
10908
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
10909
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
10910
+ * device (contact / switch / event-emitter …) into a doorbell for
10911
+ * a camera. `defaultActive: false` — the operator explicitly binds
10912
+ * it per camera in the device-bindings UI, then picks the source
10913
+ * device + trigger in the per-device settings.
10873
10914
  *
10874
10915
  * The DeviceEventPropagator re-emits `onPressed` on the camera parent
10875
10916
  * — subscribers listening at the camera level receive ring events
@@ -10890,7 +10931,10 @@ var doorbellCapability = {
10890
10931
  scope: "device",
10891
10932
  deviceNative: true,
10892
10933
  mode: "singleton",
10893
- deviceTypes: [DeviceType.Button],
10934
+ kind: "wrapper",
10935
+ defaultActive: false,
10936
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
10937
+ exposesDeviceSettings: true,
10894
10938
  methods: {},
10895
10939
  events: {
10896
10940
  /**
@@ -17242,6 +17286,14 @@ var ConfigEntrySchema = object({
17242
17286
  value: unknown(),
17243
17287
  description: string().optional()
17244
17288
  });
17289
+ var DeviceLinkModeSchema = _enum(["auto", "manual"]);
17290
+ /** One resolved linked device — the compact projection consumers need. */
17291
+ var LinkedDeviceSchema = object({
17292
+ deviceId: number(),
17293
+ name: string(),
17294
+ location: string().nullable(),
17295
+ features: array(string())
17296
+ });
17245
17297
  var SavedDeviceRowSchema = object({
17246
17298
  /** Numeric id reserved at allocateDeviceId time. */
17247
17299
  id: number(),
@@ -17463,7 +17515,10 @@ method(object({
17463
17515
  }), _void(), {
17464
17516
  kind: "mutation",
17465
17517
  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({
17518
+ }), 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({
17519
+ mode: DeviceLinkModeSchema,
17520
+ devices: array(LinkedDeviceSchema)
17521
+ })), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
17467
17522
  deviceId: number(),
17468
17523
  values: record(string(), unknown())
17469
17524
  }), object({ success: literal(true) }), {
@@ -18732,6 +18787,61 @@ var EventKindSchema = _enum([
18732
18787
  "object",
18733
18788
  "audio"
18734
18789
  ]);
18790
+ /**
18791
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
18792
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
18793
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
18794
+ */
18795
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
18796
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
18797
+ var EventKindIconSchema = _enum([
18798
+ "motion",
18799
+ "audio",
18800
+ "person",
18801
+ "vehicle",
18802
+ "animal",
18803
+ "door",
18804
+ "pir",
18805
+ "smoke",
18806
+ "water",
18807
+ "button",
18808
+ "generic"
18809
+ ]);
18810
+ var EventKindCategorySchema = _enum([
18811
+ "motion",
18812
+ "audio",
18813
+ "detection",
18814
+ "sensor",
18815
+ "custom"
18816
+ ]);
18817
+ var EventKindDescriptorSchema = object({
18818
+ /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
18819
+ kind: string(),
18820
+ label: string(),
18821
+ /** Hex color for timeline/legend rendering. */
18822
+ color: string(),
18823
+ icon: EventKindIconSchema,
18824
+ category: EventKindCategorySchema,
18825
+ /** Which cap + device contributes this kind. For built-ins the camera
18826
+ * itself; for sensor kinds the LINKED source device. */
18827
+ source: object({
18828
+ capName: string(),
18829
+ deviceId: number()
18830
+ })
18831
+ });
18832
+ var SensorEventSchema = object({
18833
+ id: string(),
18834
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
18835
+ * yields N rows, one per camera). */
18836
+ deviceId: number(),
18837
+ /** The linked sensor device whose state changed. */
18838
+ sourceDeviceId: number(),
18839
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
18840
+ kind: string(),
18841
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
18842
+ value: record(string(), unknown()).nullable(),
18843
+ timestamp: number()
18844
+ });
18735
18845
  var TrackPositionSchema = object({
18736
18846
  x: number(),
18737
18847
  y: number(),
@@ -18745,6 +18855,30 @@ var TrackSnapshotSchema = object({
18745
18855
  mediaKey: string()
18746
18856
  });
18747
18857
  /**
18858
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
18859
+ * divided by the track's detection-frame dims), computed at persist time.
18860
+ * Absent when the frame dims were unknown when the track was persisted
18861
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
18862
+ */
18863
+ var TrackEnvelopeSchema = object({
18864
+ minX: number(),
18865
+ minY: number(),
18866
+ maxX: number(),
18867
+ maxY: number()
18868
+ });
18869
+ /**
18870
+ * Row projection for track list queries. `full` (default) returns the
18871
+ * complete Track including the frame-rate `positions[]` history and the
18872
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
18873
+ * keeps every scalar the list surfaces actually render (ids, class(es),
18874
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
18875
+ * zonesVisited, bestEventId, envelope) and returns `positions` /
18876
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
18877
+ * `getTrack`. Mirrors the event-store `projection` convention
18878
+ * (`getObjectEvents` et al.).
18879
+ */
18880
+ var TrackProjectionSchema = _enum(["full", "slim"]);
18881
+ /**
18748
18882
  * One audio-classification label heard on the track's camera while the
18749
18883
  * track was alive, aggregated per label. An "episode" is one persisted
18750
18884
  * audio event (the confident-classification path: score ≥ the device's
@@ -18795,7 +18929,11 @@ var TrackSchema = object({
18795
18929
  /** Audio-classification labels heard on the camera during the track's
18796
18930
  * life (score ≥ device `classificationMinScore`), aggregated per label.
18797
18931
  * Absent on legacy rows / tracks with no confident audio. */
18798
- audioLabels: array(TrackAudioLabelSchema).readonly().optional()
18932
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
18933
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
18934
+ * Populated from the persisted envelope columns on historical reads;
18935
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
18936
+ envelope: TrackEnvelopeSchema.optional()
18799
18937
  });
18800
18938
  var BaseEventFields = {
18801
18939
  id: string(),
@@ -18905,11 +19043,13 @@ var MediaFileSchema = object({
18905
19043
  sizeBytes: number(),
18906
19044
  timestamp: number()
18907
19045
  });
19046
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
19047
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
18908
19048
  var DeviceEventQueryInput = object({
18909
19049
  deviceId: number(),
18910
19050
  since: number().optional(),
18911
19051
  until: number().optional(),
18912
- limit: number().int().min(1).max(5e3).default(1e3),
19052
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
18913
19053
  /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
18914
19054
  * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
18915
19055
  * exact behaviour. Callers may omit this field — the store defaults to
@@ -18917,6 +19057,27 @@ var DeviceEventQueryInput = object({
18917
19057
  projection: _enum(["full", "slim"]).optional()
18918
19058
  });
18919
19059
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
19060
+ var RecentTracksQueryInput = object({
19061
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
19062
+ deviceIds: array(number()),
19063
+ /** Window lower bound on `lastSeen` (inclusive). */
19064
+ since: number().optional(),
19065
+ /** Window upper bound on `lastSeen` (inclusive). */
19066
+ until: number().optional(),
19067
+ /** Page size. Default 200, max 1000. */
19068
+ limit: number().int().min(1).max(1e3).default(200),
19069
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
19070
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
19071
+ cursor: string().optional(),
19072
+ /** See {@link TrackProjectionSchema}. Default `full`. */
19073
+ projection: TrackProjectionSchema.optional()
19074
+ });
19075
+ var RecentTracksPageSchema = object({
19076
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
19077
+ tracks: array(TrackSchema).readonly(),
19078
+ /** Cursor for the next page, or null when this page is the last. */
19079
+ nextCursor: string().nullable()
19080
+ });
18920
19081
  var KeyEventQueryInput = object({
18921
19082
  deviceId: number(),
18922
19083
  /** Window lower bound (track firstSeen ≥ since). */
@@ -18999,11 +19160,25 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18999
19160
  deviceId: number(),
19000
19161
  since: number().optional(),
19001
19162
  until: number().optional(),
19002
- limit: number().optional()
19003
- }), array(TrackSchema).readonly()), method(object({ deviceId: number() }), _void(), {
19163
+ limit: number().optional(),
19164
+ /** Spatial filter only tracks whose trajectory intersects the zone
19165
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
19166
+ * envelope columns, then precisely tested per position. Tracks with
19167
+ * an unknown envelope (no frame dims at persist time) always match. */
19168
+ zone: TrackZoneFilterSchema.optional(),
19169
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
19170
+ * compatible — omitting the field keeps today's exact behaviour). */
19171
+ projection: TrackProjectionSchema.optional()
19172
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
19004
19173
  kind: "mutation",
19005
19174
  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({
19175
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({
19176
+ deviceId: number(),
19177
+ since: number().optional(),
19178
+ until: number().optional(),
19179
+ kinds: array(string()).optional(),
19180
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19181
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19007
19182
  deviceId: number(),
19008
19183
  since: number(),
19009
19184
  until: number(),
@@ -22343,7 +22518,12 @@ var RecordingStorageUsageSchema = object({
22343
22518
  /**
22344
22519
  * Result of locating footage at a wall-clock instant for one device/profile.
22345
22520
  * `segment` carries the covering segment's window; `gap` reports the forward
22346
- * nearest covered edge (`null` past the end of footage / when none exists).
22521
+ * nearest covered edge (`null` past the end of footage / when none exists)
22522
+ * and the backward covered edge `prevEndMs` (exclusive end of the nearest
22523
+ * footage behind the epoch; `null` when none — optional so older providers
22524
+ * that omit it stay valid). `prevEndMs` lets a backward frame-step hop the
22525
+ * small inter-segment cracks (durMs under-covers the span to the next
22526
+ * startMs by ~11-17 ms) instead of no-opping at a segment head.
22347
22527
  */
22348
22528
  var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22349
22529
  kind: literal("segment"),
@@ -22352,7 +22532,8 @@ var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22352
22532
  bytes: number()
22353
22533
  }), object({
22354
22534
  kind: literal("gap"),
22355
- nearestEdgeMs: number().nullable()
22535
+ nearestEdgeMs: number().nullable(),
22536
+ prevEndMs: number().nullable().optional()
22356
22537
  })]);
22357
22538
  /** Raw bytes of one finalized footage segment (read off disk on the recording node). */
22358
22539
  var ReadSegmentBytesResultSchema = object({ data: _instanceof(Uint8Array) });
@@ -24132,6 +24313,12 @@ Object.freeze({
24132
24313
  addonId: null,
24133
24314
  access: "view"
24134
24315
  },
24316
+ "deviceManager.getLinkedDevices": {
24317
+ capName: "device-manager",
24318
+ capScope: "system",
24319
+ addonId: null,
24320
+ access: "view"
24321
+ },
24135
24322
  "deviceManager.getRoleDisplayDefaults": {
24136
24323
  capName: "device-manager",
24137
24324
  capScope: "system",
@@ -25686,6 +25873,12 @@ Object.freeze({
25686
25873
  addonId: null,
25687
25874
  access: "view"
25688
25875
  },
25876
+ "pipelineAnalytics.getSensorEvents": {
25877
+ capName: "pipeline-analytics",
25878
+ capScope: "device",
25879
+ addonId: null,
25880
+ access: "view"
25881
+ },
25689
25882
  "pipelineAnalytics.getTrack": {
25690
25883
  capName: "pipeline-analytics",
25691
25884
  capScope: "device",
@@ -25698,6 +25891,18 @@ Object.freeze({
25698
25891
  addonId: null,
25699
25892
  access: "view"
25700
25893
  },
25894
+ "pipelineAnalytics.listEventKinds": {
25895
+ capName: "pipeline-analytics",
25896
+ capScope: "device",
25897
+ addonId: null,
25898
+ access: "view"
25899
+ },
25900
+ "pipelineAnalytics.listRecentTracks": {
25901
+ capName: "pipeline-analytics",
25902
+ capScope: "device",
25903
+ addonId: null,
25904
+ access: "view"
25905
+ },
25701
25906
  "pipelineAnalytics.listTracks": {
25702
25907
  capName: "pipeline-analytics",
25703
25908
  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.12",
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",