@camstack/addon-provider-petkit 0.1.9 → 0.1.10

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