@camstack/addon-provider-petkit 0.1.9 → 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 +220 -15
  2. package/dist/addon.mjs +220 -15
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let crypto$1 = require("crypto");
3
3
  let events = require("events");
4
- //#region ../types/dist/event-category-CFZs3jI4.mjs
4
+ //#region ../types/dist/event-category-H4AVePnn.mjs
5
5
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
6
6
  EventCategory["SystemBoot"] = "system.boot";
7
7
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -151,6 +151,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
151
151
  EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
152
152
  EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
153
153
  EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
154
+ /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
155
+ * thumb is a scrub gap the recorder's keyframe backfill covers. */
156
+ EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
154
157
  EventCategory["DetectionEvent"] = "detection.event";
155
158
  EventCategory["SessionTrackNew"] = "session.track.new";
156
159
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -7250,6 +7253,24 @@ var RecordingRetentionSchema = object({
7250
7253
  maxSizeGb: number().min(0).optional()
7251
7254
  });
7252
7255
  /**
7256
+ * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7257
+ * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7258
+ * previews at. Five graduated steps; absent on a config = `standard` (the
7259
+ * shipped default, matching `sheet-geometry`/`sheet-composer`).
7260
+ *
7261
+ * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7262
+ * Each window's index sidecar carries its own tile dims, so a camera whose
7263
+ * preset changed over time renders every historical window at the dims it was
7264
+ * written with.
7265
+ */
7266
+ var ScrubThumbnailPresetSchema = _enum([
7267
+ "minimal",
7268
+ "low",
7269
+ "standard",
7270
+ "high",
7271
+ "max"
7272
+ ]);
7273
+ /**
7253
7274
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7254
7275
  *
7255
7276
  * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
@@ -7286,7 +7307,14 @@ var RecordingConfigSchema = object({
7286
7307
  * derived into bands once via `migrateConfigToBands`.
7287
7308
  */
7288
7309
  bands: array(RecordingBandSchema).optional(),
7289
- retention: RecordingRetentionSchema.optional()
7310
+ retention: RecordingRetentionSchema.optional(),
7311
+ /**
7312
+ * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7313
+ * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7314
+ * windows only — existing sheets are immutable, and each window's index
7315
+ * carries its own tile dims so mixed-preset history renders correctly.
7316
+ */
7317
+ scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7290
7318
  });
7291
7319
  /**
7292
7320
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -10798,10 +10826,23 @@ var deviceDiscoveryCapability = {
10798
10826
  }
10799
10827
  };
10800
10828
  /**
10801
- * Doorbell button cap. Installed on a `DeviceType.Button` accessory
10802
- * with `role: DeviceRole.Doorbell`. Emits an `onPressed` event every
10803
- * time the firmware pushes a ring; status tracks the last press and
10804
- * a pressCount since start (diagnostic).
10829
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
10830
+ * name (same pattern as `snapshot`):
10831
+ *
10832
+ * - **Native** providers: registered per-device by device-driver
10833
+ * addons via `ctx.registerNativeCap` — either on a
10834
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
10835
+ * or directly on the camera (Reolink registers at camera level).
10836
+ * Emits an `onPressed` event every time the firmware pushes a
10837
+ * ring; status tracks the last press and a pressCount since start
10838
+ * (diagnostic).
10839
+ *
10840
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
10841
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
10842
+ * device (contact / switch / event-emitter …) into a doorbell for
10843
+ * a camera. `defaultActive: false` — the operator explicitly binds
10844
+ * it per camera in the device-bindings UI, then picks the source
10845
+ * device + trigger in the per-device settings.
10805
10846
  *
10806
10847
  * The DeviceEventPropagator re-emits `onPressed` on the camera parent
10807
10848
  * — subscribers listening at the camera level receive ring events
@@ -10822,7 +10863,10 @@ var doorbellCapability = {
10822
10863
  scope: "device",
10823
10864
  deviceNative: true,
10824
10865
  mode: "singleton",
10825
- deviceTypes: [DeviceType.Button],
10866
+ kind: "wrapper",
10867
+ defaultActive: false,
10868
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
10869
+ exposesDeviceSettings: true,
10826
10870
  methods: {},
10827
10871
  events: {
10828
10872
  /**
@@ -17191,6 +17235,14 @@ var ConfigEntrySchema = object({
17191
17235
  value: unknown(),
17192
17236
  description: string().optional()
17193
17237
  });
17238
+ var DeviceLinkModeSchema = _enum(["auto", "manual"]);
17239
+ /** One resolved linked device — the compact projection consumers need. */
17240
+ var LinkedDeviceSchema = object({
17241
+ deviceId: number(),
17242
+ name: string(),
17243
+ location: string().nullable(),
17244
+ features: array(string())
17245
+ });
17194
17246
  var SavedDeviceRowSchema = object({
17195
17247
  /** Numeric id reserved at allocateDeviceId time. */
17196
17248
  id: number(),
@@ -17412,7 +17464,10 @@ method(object({
17412
17464
  }), _void(), {
17413
17465
  kind: "mutation",
17414
17466
  auth: "admin"
17415
- }), 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({
17467
+ }), 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({
17468
+ mode: DeviceLinkModeSchema,
17469
+ devices: array(LinkedDeviceSchema)
17470
+ })), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
17416
17471
  deviceId: number(),
17417
17472
  values: record(string(), unknown())
17418
17473
  }), object({ success: literal(true) }), {
@@ -18681,6 +18736,61 @@ var EventKindSchema = _enum([
18681
18736
  "object",
18682
18737
  "audio"
18683
18738
  ]);
18739
+ /**
18740
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
18741
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
18742
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
18743
+ */
18744
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
18745
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
18746
+ var EventKindIconSchema = _enum([
18747
+ "motion",
18748
+ "audio",
18749
+ "person",
18750
+ "vehicle",
18751
+ "animal",
18752
+ "door",
18753
+ "pir",
18754
+ "smoke",
18755
+ "water",
18756
+ "button",
18757
+ "generic"
18758
+ ]);
18759
+ var EventKindCategorySchema = _enum([
18760
+ "motion",
18761
+ "audio",
18762
+ "detection",
18763
+ "sensor",
18764
+ "custom"
18765
+ ]);
18766
+ var EventKindDescriptorSchema = object({
18767
+ /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
18768
+ kind: string(),
18769
+ label: string(),
18770
+ /** Hex color for timeline/legend rendering. */
18771
+ color: string(),
18772
+ icon: EventKindIconSchema,
18773
+ category: EventKindCategorySchema,
18774
+ /** Which cap + device contributes this kind. For built-ins the camera
18775
+ * itself; for sensor kinds the LINKED source device. */
18776
+ source: object({
18777
+ capName: string(),
18778
+ deviceId: number()
18779
+ })
18780
+ });
18781
+ var SensorEventSchema = object({
18782
+ id: string(),
18783
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
18784
+ * yields N rows, one per camera). */
18785
+ deviceId: number(),
18786
+ /** The linked sensor device whose state changed. */
18787
+ sourceDeviceId: number(),
18788
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
18789
+ kind: string(),
18790
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
18791
+ value: record(string(), unknown()).nullable(),
18792
+ timestamp: number()
18793
+ });
18684
18794
  var TrackPositionSchema = object({
18685
18795
  x: number(),
18686
18796
  y: number(),
@@ -18694,6 +18804,30 @@ var TrackSnapshotSchema = object({
18694
18804
  mediaKey: string()
18695
18805
  });
18696
18806
  /**
18807
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
18808
+ * divided by the track's detection-frame dims), computed at persist time.
18809
+ * Absent when the frame dims were unknown when the track was persisted
18810
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
18811
+ */
18812
+ var TrackEnvelopeSchema = object({
18813
+ minX: number(),
18814
+ minY: number(),
18815
+ maxX: number(),
18816
+ maxY: number()
18817
+ });
18818
+ /**
18819
+ * Row projection for track list queries. `full` (default) returns the
18820
+ * complete Track including the frame-rate `positions[]` history and the
18821
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
18822
+ * keeps every scalar the list surfaces actually render (ids, class(es),
18823
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
18824
+ * zonesVisited, bestEventId, envelope) and returns `positions` /
18825
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
18826
+ * `getTrack`. Mirrors the event-store `projection` convention
18827
+ * (`getObjectEvents` et al.).
18828
+ */
18829
+ var TrackProjectionSchema = _enum(["full", "slim"]);
18830
+ /**
18697
18831
  * One audio-classification label heard on the track's camera while the
18698
18832
  * track was alive, aggregated per label. An "episode" is one persisted
18699
18833
  * audio event (the confident-classification path: score ≥ the device's
@@ -18744,7 +18878,11 @@ var TrackSchema = object({
18744
18878
  /** Audio-classification labels heard on the camera during the track's
18745
18879
  * life (score ≥ device `classificationMinScore`), aggregated per label.
18746
18880
  * Absent on legacy rows / tracks with no confident audio. */
18747
- audioLabels: array(TrackAudioLabelSchema).readonly().optional()
18881
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
18882
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
18883
+ * Populated from the persisted envelope columns on historical reads;
18884
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
18885
+ envelope: TrackEnvelopeSchema.optional()
18748
18886
  });
18749
18887
  var BaseEventFields = {
18750
18888
  id: string(),
@@ -18854,11 +18992,13 @@ var MediaFileSchema = object({
18854
18992
  sizeBytes: number(),
18855
18993
  timestamp: number()
18856
18994
  });
18995
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
18996
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
18857
18997
  var DeviceEventQueryInput = object({
18858
18998
  deviceId: number(),
18859
18999
  since: number().optional(),
18860
19000
  until: number().optional(),
18861
- limit: number().int().min(1).max(5e3).default(1e3),
19001
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
18862
19002
  /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
18863
19003
  * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
18864
19004
  * exact behaviour. Callers may omit this field — the store defaults to
@@ -18866,6 +19006,27 @@ var DeviceEventQueryInput = object({
18866
19006
  projection: _enum(["full", "slim"]).optional()
18867
19007
  });
18868
19008
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
19009
+ var RecentTracksQueryInput = object({
19010
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
19011
+ deviceIds: array(number()),
19012
+ /** Window lower bound on `lastSeen` (inclusive). */
19013
+ since: number().optional(),
19014
+ /** Window upper bound on `lastSeen` (inclusive). */
19015
+ until: number().optional(),
19016
+ /** Page size. Default 200, max 1000. */
19017
+ limit: number().int().min(1).max(1e3).default(200),
19018
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
19019
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
19020
+ cursor: string().optional(),
19021
+ /** See {@link TrackProjectionSchema}. Default `full`. */
19022
+ projection: TrackProjectionSchema.optional()
19023
+ });
19024
+ var RecentTracksPageSchema = object({
19025
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
19026
+ tracks: array(TrackSchema).readonly(),
19027
+ /** Cursor for the next page, or null when this page is the last. */
19028
+ nextCursor: string().nullable()
19029
+ });
18869
19030
  var KeyEventQueryInput = object({
18870
19031
  deviceId: number(),
18871
19032
  /** Window lower bound (track firstSeen ≥ since). */
@@ -18948,11 +19109,25 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18948
19109
  deviceId: number(),
18949
19110
  since: number().optional(),
18950
19111
  until: number().optional(),
18951
- limit: number().optional()
18952
- }), array(TrackSchema).readonly()), method(object({ deviceId: number() }), _void(), {
19112
+ limit: number().optional(),
19113
+ /** Spatial filter only tracks whose trajectory intersects the zone
19114
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
19115
+ * envelope columns, then precisely tested per position. Tracks with
19116
+ * an unknown envelope (no frame dims at persist time) always match. */
19117
+ zone: TrackZoneFilterSchema.optional(),
19118
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
19119
+ * compatible — omitting the field keeps today's exact behaviour). */
19120
+ projection: TrackProjectionSchema.optional()
19121
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
18953
19122
  kind: "mutation",
18954
19123
  auth: "admin"
18955
- }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19124
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({
19125
+ deviceId: number(),
19126
+ since: number().optional(),
19127
+ until: number().optional(),
19128
+ kinds: array(string()).optional(),
19129
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19130
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
18956
19131
  deviceId: number(),
18957
19132
  since: number(),
18958
19133
  until: number(),
@@ -22153,7 +22328,12 @@ var RecordingStorageUsageSchema = object({
22153
22328
  /**
22154
22329
  * Result of locating footage at a wall-clock instant for one device/profile.
22155
22330
  * `segment` carries the covering segment's window; `gap` reports the forward
22156
- * nearest covered edge (`null` past the end of footage / when none exists).
22331
+ * nearest covered edge (`null` past the end of footage / when none exists)
22332
+ * and the backward covered edge `prevEndMs` (exclusive end of the nearest
22333
+ * footage behind the epoch; `null` when none — optional so older providers
22334
+ * that omit it stay valid). `prevEndMs` lets a backward frame-step hop the
22335
+ * small inter-segment cracks (durMs under-covers the span to the next
22336
+ * startMs by ~11-17 ms) instead of no-opping at a segment head.
22157
22337
  */
22158
22338
  var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22159
22339
  kind: literal("segment"),
@@ -22162,7 +22342,8 @@ var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22162
22342
  bytes: number()
22163
22343
  }), object({
22164
22344
  kind: literal("gap"),
22165
- nearestEdgeMs: number().nullable()
22345
+ nearestEdgeMs: number().nullable(),
22346
+ prevEndMs: number().nullable().optional()
22166
22347
  })]);
22167
22348
  /** Raw bytes of one finalized footage segment (read off disk on the recording node). */
22168
22349
  var ReadSegmentBytesResultSchema = object({ data: _instanceof(Uint8Array) });
@@ -23731,6 +23912,12 @@ Object.freeze({
23731
23912
  addonId: null,
23732
23913
  access: "view"
23733
23914
  },
23915
+ "deviceManager.getLinkedDevices": {
23916
+ capName: "device-manager",
23917
+ capScope: "system",
23918
+ addonId: null,
23919
+ access: "view"
23920
+ },
23734
23921
  "deviceManager.getRoleDisplayDefaults": {
23735
23922
  capName: "device-manager",
23736
23923
  capScope: "system",
@@ -25285,6 +25472,12 @@ Object.freeze({
25285
25472
  addonId: null,
25286
25473
  access: "view"
25287
25474
  },
25475
+ "pipelineAnalytics.getSensorEvents": {
25476
+ capName: "pipeline-analytics",
25477
+ capScope: "device",
25478
+ addonId: null,
25479
+ access: "view"
25480
+ },
25288
25481
  "pipelineAnalytics.getTrack": {
25289
25482
  capName: "pipeline-analytics",
25290
25483
  capScope: "device",
@@ -25297,6 +25490,18 @@ Object.freeze({
25297
25490
  addonId: null,
25298
25491
  access: "view"
25299
25492
  },
25493
+ "pipelineAnalytics.listEventKinds": {
25494
+ capName: "pipeline-analytics",
25495
+ capScope: "device",
25496
+ addonId: null,
25497
+ access: "view"
25498
+ },
25499
+ "pipelineAnalytics.listRecentTracks": {
25500
+ capName: "pipeline-analytics",
25501
+ capScope: "device",
25502
+ addonId: null,
25503
+ access: "view"
25504
+ },
25300
25505
  "pipelineAnalytics.listTracks": {
25301
25506
  capName: "pipeline-analytics",
25302
25507
  capScope: "device",
package/dist/addon.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createHash } from "crypto";
2
2
  import { EventEmitter } from "events";
3
- //#region ../types/dist/event-category-CFZs3jI4.mjs
3
+ //#region ../types/dist/event-category-H4AVePnn.mjs
4
4
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
5
5
  EventCategory["SystemBoot"] = "system.boot";
6
6
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -150,6 +150,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
150
150
  EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
151
151
  EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
152
152
  EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
153
+ /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
154
+ * thumb is a scrub gap the recorder's keyframe backfill covers. */
155
+ EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
153
156
  EventCategory["DetectionEvent"] = "detection.event";
154
157
  EventCategory["SessionTrackNew"] = "session.track.new";
155
158
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -7249,6 +7252,24 @@ var RecordingRetentionSchema = object({
7249
7252
  maxSizeGb: number().min(0).optional()
7250
7253
  });
7251
7254
  /**
7255
+ * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7256
+ * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7257
+ * previews at. Five graduated steps; absent on a config = `standard` (the
7258
+ * shipped default, matching `sheet-geometry`/`sheet-composer`).
7259
+ *
7260
+ * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7261
+ * Each window's index sidecar carries its own tile dims, so a camera whose
7262
+ * preset changed over time renders every historical window at the dims it was
7263
+ * written with.
7264
+ */
7265
+ var ScrubThumbnailPresetSchema = _enum([
7266
+ "minimal",
7267
+ "low",
7268
+ "standard",
7269
+ "high",
7270
+ "max"
7271
+ ]);
7272
+ /**
7252
7273
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7253
7274
  *
7254
7275
  * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
@@ -7285,7 +7306,14 @@ var RecordingConfigSchema = object({
7285
7306
  * derived into bands once via `migrateConfigToBands`.
7286
7307
  */
7287
7308
  bands: array(RecordingBandSchema).optional(),
7288
- retention: RecordingRetentionSchema.optional()
7309
+ retention: RecordingRetentionSchema.optional(),
7310
+ /**
7311
+ * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7312
+ * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7313
+ * windows only — existing sheets are immutable, and each window's index
7314
+ * carries its own tile dims so mixed-preset history renders correctly.
7315
+ */
7316
+ scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7289
7317
  });
7290
7318
  /**
7291
7319
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -10797,10 +10825,23 @@ var deviceDiscoveryCapability = {
10797
10825
  }
10798
10826
  };
10799
10827
  /**
10800
- * Doorbell button cap. Installed on a `DeviceType.Button` accessory
10801
- * with `role: DeviceRole.Doorbell`. Emits an `onPressed` event every
10802
- * time the firmware pushes a ring; status tracks the last press and
10803
- * a pressCount since start (diagnostic).
10828
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
10829
+ * name (same pattern as `snapshot`):
10830
+ *
10831
+ * - **Native** providers: registered per-device by device-driver
10832
+ * addons via `ctx.registerNativeCap` — either on a
10833
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
10834
+ * or directly on the camera (Reolink registers at camera level).
10835
+ * Emits an `onPressed` event every time the firmware pushes a
10836
+ * ring; status tracks the last press and a pressCount since start
10837
+ * (diagnostic).
10838
+ *
10839
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
10840
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
10841
+ * device (contact / switch / event-emitter …) into a doorbell for
10842
+ * a camera. `defaultActive: false` — the operator explicitly binds
10843
+ * it per camera in the device-bindings UI, then picks the source
10844
+ * device + trigger in the per-device settings.
10804
10845
  *
10805
10846
  * The DeviceEventPropagator re-emits `onPressed` on the camera parent
10806
10847
  * — subscribers listening at the camera level receive ring events
@@ -10821,7 +10862,10 @@ var doorbellCapability = {
10821
10862
  scope: "device",
10822
10863
  deviceNative: true,
10823
10864
  mode: "singleton",
10824
- deviceTypes: [DeviceType.Button],
10865
+ kind: "wrapper",
10866
+ defaultActive: false,
10867
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
10868
+ exposesDeviceSettings: true,
10825
10869
  methods: {},
10826
10870
  events: {
10827
10871
  /**
@@ -17190,6 +17234,14 @@ var ConfigEntrySchema = object({
17190
17234
  value: unknown(),
17191
17235
  description: string().optional()
17192
17236
  });
17237
+ var DeviceLinkModeSchema = _enum(["auto", "manual"]);
17238
+ /** One resolved linked device — the compact projection consumers need. */
17239
+ var LinkedDeviceSchema = object({
17240
+ deviceId: number(),
17241
+ name: string(),
17242
+ location: string().nullable(),
17243
+ features: array(string())
17244
+ });
17193
17245
  var SavedDeviceRowSchema = object({
17194
17246
  /** Numeric id reserved at allocateDeviceId time. */
17195
17247
  id: number(),
@@ -17411,7 +17463,10 @@ method(object({
17411
17463
  }), _void(), {
17412
17464
  kind: "mutation",
17413
17465
  auth: "admin"
17414
- }), 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({
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() }), object({
17467
+ mode: DeviceLinkModeSchema,
17468
+ devices: array(LinkedDeviceSchema)
17469
+ })), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
17415
17470
  deviceId: number(),
17416
17471
  values: record(string(), unknown())
17417
17472
  }), object({ success: literal(true) }), {
@@ -18680,6 +18735,61 @@ var EventKindSchema = _enum([
18680
18735
  "object",
18681
18736
  "audio"
18682
18737
  ]);
18738
+ /**
18739
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
18740
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
18741
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
18742
+ */
18743
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
18744
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
18745
+ var EventKindIconSchema = _enum([
18746
+ "motion",
18747
+ "audio",
18748
+ "person",
18749
+ "vehicle",
18750
+ "animal",
18751
+ "door",
18752
+ "pir",
18753
+ "smoke",
18754
+ "water",
18755
+ "button",
18756
+ "generic"
18757
+ ]);
18758
+ var EventKindCategorySchema = _enum([
18759
+ "motion",
18760
+ "audio",
18761
+ "detection",
18762
+ "sensor",
18763
+ "custom"
18764
+ ]);
18765
+ var EventKindDescriptorSchema = object({
18766
+ /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
18767
+ kind: string(),
18768
+ label: string(),
18769
+ /** Hex color for timeline/legend rendering. */
18770
+ color: string(),
18771
+ icon: EventKindIconSchema,
18772
+ category: EventKindCategorySchema,
18773
+ /** Which cap + device contributes this kind. For built-ins the camera
18774
+ * itself; for sensor kinds the LINKED source device. */
18775
+ source: object({
18776
+ capName: string(),
18777
+ deviceId: number()
18778
+ })
18779
+ });
18780
+ var SensorEventSchema = object({
18781
+ id: string(),
18782
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
18783
+ * yields N rows, one per camera). */
18784
+ deviceId: number(),
18785
+ /** The linked sensor device whose state changed. */
18786
+ sourceDeviceId: number(),
18787
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
18788
+ kind: string(),
18789
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
18790
+ value: record(string(), unknown()).nullable(),
18791
+ timestamp: number()
18792
+ });
18683
18793
  var TrackPositionSchema = object({
18684
18794
  x: number(),
18685
18795
  y: number(),
@@ -18693,6 +18803,30 @@ var TrackSnapshotSchema = object({
18693
18803
  mediaKey: string()
18694
18804
  });
18695
18805
  /**
18806
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
18807
+ * divided by the track's detection-frame dims), computed at persist time.
18808
+ * Absent when the frame dims were unknown when the track was persisted
18809
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
18810
+ */
18811
+ var TrackEnvelopeSchema = object({
18812
+ minX: number(),
18813
+ minY: number(),
18814
+ maxX: number(),
18815
+ maxY: number()
18816
+ });
18817
+ /**
18818
+ * Row projection for track list queries. `full` (default) returns the
18819
+ * complete Track including the frame-rate `positions[]` history and the
18820
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
18821
+ * keeps every scalar the list surfaces actually render (ids, class(es),
18822
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
18823
+ * zonesVisited, bestEventId, envelope) and returns `positions` /
18824
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
18825
+ * `getTrack`. Mirrors the event-store `projection` convention
18826
+ * (`getObjectEvents` et al.).
18827
+ */
18828
+ var TrackProjectionSchema = _enum(["full", "slim"]);
18829
+ /**
18696
18830
  * One audio-classification label heard on the track's camera while the
18697
18831
  * track was alive, aggregated per label. An "episode" is one persisted
18698
18832
  * audio event (the confident-classification path: score ≥ the device's
@@ -18743,7 +18877,11 @@ var TrackSchema = object({
18743
18877
  /** Audio-classification labels heard on the camera during the track's
18744
18878
  * life (score ≥ device `classificationMinScore`), aggregated per label.
18745
18879
  * Absent on legacy rows / tracks with no confident audio. */
18746
- audioLabels: array(TrackAudioLabelSchema).readonly().optional()
18880
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
18881
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
18882
+ * Populated from the persisted envelope columns on historical reads;
18883
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
18884
+ envelope: TrackEnvelopeSchema.optional()
18747
18885
  });
18748
18886
  var BaseEventFields = {
18749
18887
  id: string(),
@@ -18853,11 +18991,13 @@ var MediaFileSchema = object({
18853
18991
  sizeBytes: number(),
18854
18992
  timestamp: number()
18855
18993
  });
18994
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
18995
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
18856
18996
  var DeviceEventQueryInput = object({
18857
18997
  deviceId: number(),
18858
18998
  since: number().optional(),
18859
18999
  until: number().optional(),
18860
- limit: number().int().min(1).max(5e3).default(1e3),
19000
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
18861
19001
  /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
18862
19002
  * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
18863
19003
  * exact behaviour. Callers may omit this field — the store defaults to
@@ -18865,6 +19005,27 @@ var DeviceEventQueryInput = object({
18865
19005
  projection: _enum(["full", "slim"]).optional()
18866
19006
  });
18867
19007
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
19008
+ var RecentTracksQueryInput = object({
19009
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
19010
+ deviceIds: array(number()),
19011
+ /** Window lower bound on `lastSeen` (inclusive). */
19012
+ since: number().optional(),
19013
+ /** Window upper bound on `lastSeen` (inclusive). */
19014
+ until: number().optional(),
19015
+ /** Page size. Default 200, max 1000. */
19016
+ limit: number().int().min(1).max(1e3).default(200),
19017
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
19018
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
19019
+ cursor: string().optional(),
19020
+ /** See {@link TrackProjectionSchema}. Default `full`. */
19021
+ projection: TrackProjectionSchema.optional()
19022
+ });
19023
+ var RecentTracksPageSchema = object({
19024
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
19025
+ tracks: array(TrackSchema).readonly(),
19026
+ /** Cursor for the next page, or null when this page is the last. */
19027
+ nextCursor: string().nullable()
19028
+ });
18868
19029
  var KeyEventQueryInput = object({
18869
19030
  deviceId: number(),
18870
19031
  /** Window lower bound (track firstSeen ≥ since). */
@@ -18947,11 +19108,25 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18947
19108
  deviceId: number(),
18948
19109
  since: number().optional(),
18949
19110
  until: number().optional(),
18950
- limit: number().optional()
18951
- }), array(TrackSchema).readonly()), method(object({ deviceId: number() }), _void(), {
19111
+ limit: number().optional(),
19112
+ /** Spatial filter only tracks whose trajectory intersects the zone
19113
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
19114
+ * envelope columns, then precisely tested per position. Tracks with
19115
+ * an unknown envelope (no frame dims at persist time) always match. */
19116
+ zone: TrackZoneFilterSchema.optional(),
19117
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
19118
+ * compatible — omitting the field keeps today's exact behaviour). */
19119
+ projection: TrackProjectionSchema.optional()
19120
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
18952
19121
  kind: "mutation",
18953
19122
  auth: "admin"
18954
- }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19123
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({
19124
+ deviceId: number(),
19125
+ since: number().optional(),
19126
+ until: number().optional(),
19127
+ kinds: array(string()).optional(),
19128
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19129
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
18955
19130
  deviceId: number(),
18956
19131
  since: number(),
18957
19132
  until: number(),
@@ -22152,7 +22327,12 @@ var RecordingStorageUsageSchema = object({
22152
22327
  /**
22153
22328
  * Result of locating footage at a wall-clock instant for one device/profile.
22154
22329
  * `segment` carries the covering segment's window; `gap` reports the forward
22155
- * nearest covered edge (`null` past the end of footage / when none exists).
22330
+ * nearest covered edge (`null` past the end of footage / when none exists)
22331
+ * and the backward covered edge `prevEndMs` (exclusive end of the nearest
22332
+ * footage behind the epoch; `null` when none — optional so older providers
22333
+ * that omit it stay valid). `prevEndMs` lets a backward frame-step hop the
22334
+ * small inter-segment cracks (durMs under-covers the span to the next
22335
+ * startMs by ~11-17 ms) instead of no-opping at a segment head.
22156
22336
  */
22157
22337
  var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22158
22338
  kind: literal("segment"),
@@ -22161,7 +22341,8 @@ var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
22161
22341
  bytes: number()
22162
22342
  }), object({
22163
22343
  kind: literal("gap"),
22164
- nearestEdgeMs: number().nullable()
22344
+ nearestEdgeMs: number().nullable(),
22345
+ prevEndMs: number().nullable().optional()
22165
22346
  })]);
22166
22347
  /** Raw bytes of one finalized footage segment (read off disk on the recording node). */
22167
22348
  var ReadSegmentBytesResultSchema = object({ data: _instanceof(Uint8Array) });
@@ -23730,6 +23911,12 @@ Object.freeze({
23730
23911
  addonId: null,
23731
23912
  access: "view"
23732
23913
  },
23914
+ "deviceManager.getLinkedDevices": {
23915
+ capName: "device-manager",
23916
+ capScope: "system",
23917
+ addonId: null,
23918
+ access: "view"
23919
+ },
23733
23920
  "deviceManager.getRoleDisplayDefaults": {
23734
23921
  capName: "device-manager",
23735
23922
  capScope: "system",
@@ -25284,6 +25471,12 @@ Object.freeze({
25284
25471
  addonId: null,
25285
25472
  access: "view"
25286
25473
  },
25474
+ "pipelineAnalytics.getSensorEvents": {
25475
+ capName: "pipeline-analytics",
25476
+ capScope: "device",
25477
+ addonId: null,
25478
+ access: "view"
25479
+ },
25287
25480
  "pipelineAnalytics.getTrack": {
25288
25481
  capName: "pipeline-analytics",
25289
25482
  capScope: "device",
@@ -25296,6 +25489,18 @@ Object.freeze({
25296
25489
  addonId: null,
25297
25490
  access: "view"
25298
25491
  },
25492
+ "pipelineAnalytics.listEventKinds": {
25493
+ capName: "pipeline-analytics",
25494
+ capScope: "device",
25495
+ addonId: null,
25496
+ access: "view"
25497
+ },
25498
+ "pipelineAnalytics.listRecentTracks": {
25499
+ capName: "pipeline-analytics",
25500
+ capScope: "device",
25501
+ addonId: null,
25502
+ access: "view"
25503
+ },
25299
25504
  "pipelineAnalytics.listTracks": {
25300
25505
  capName: "pipeline-analytics",
25301
25506
  capScope: "device",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-petkit",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "PetKit smart-feeder device-provider addon for CamStack — wraps the @apocaliss92/nodepetkit PetKit cloud client",
5
5
  "keywords": [
6
6
  "camstack",