@camstack/addon-post-analysis 1.1.30 → 1.1.31

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.
@@ -20,7 +20,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
20
20
  enumerable: true
21
21
  }) : target, mod));
22
22
  //#endregion
23
- //#region ../types/dist/event-category-CFZs3jI4.mjs
23
+ //#region ../types/dist/event-category-H4AVePnn.mjs
24
24
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
25
25
  EventCategory["SystemBoot"] = "system.boot";
26
26
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -170,6 +170,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
170
170
  EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
171
171
  EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
172
172
  EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
173
+ /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
174
+ * thumb is a scrub gap the recorder's keyframe backfill covers. */
175
+ EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
173
176
  EventCategory["DetectionEvent"] = "detection.event";
174
177
  EventCategory["SessionTrackNew"] = "session.track.new";
175
178
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -9941,7 +9944,7 @@ object({
9941
9944
  deviceId: number(),
9942
9945
  timestamp: number()
9943
9946
  });
9944
- DeviceType.Button;
9947
+ DeviceType.Button, DeviceType.Camera;
9945
9948
  /**
9946
9949
  * Enum-state sensor — a string value picked from a finite option set.
9947
9950
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -14366,6 +14369,14 @@ var ConfigEntrySchema = object({
14366
14369
  value: unknown(),
14367
14370
  description: string().optional()
14368
14371
  });
14372
+ var DeviceLinkModeSchema = _enum(["auto", "manual"]);
14373
+ /** One resolved linked device — the compact projection consumers need. */
14374
+ var LinkedDeviceSchema = object({
14375
+ deviceId: number(),
14376
+ name: string(),
14377
+ location: string().nullable(),
14378
+ features: array(string())
14379
+ });
14369
14380
  var SavedDeviceRowSchema = object({
14370
14381
  /** Numeric id reserved at allocateDeviceId time. */
14371
14382
  id: number(),
@@ -14587,7 +14598,10 @@ method(object({
14587
14598
  }), _void(), {
14588
14599
  kind: "mutation",
14589
14600
  auth: "admin"
14590
- }), 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({
14601
+ }), 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({
14602
+ mode: DeviceLinkModeSchema,
14603
+ devices: array(LinkedDeviceSchema)
14604
+ })), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
14591
14605
  deviceId: number(),
14592
14606
  values: record(string(), unknown())
14593
14607
  }), object({ success: literal(true) }), {
@@ -15866,6 +15880,61 @@ var EventKindSchema = _enum([
15866
15880
  "object",
15867
15881
  "audio"
15868
15882
  ]);
15883
+ /**
15884
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
15885
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
15886
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
15887
+ */
15888
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
15889
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
15890
+ var EventKindIconSchema = _enum([
15891
+ "motion",
15892
+ "audio",
15893
+ "person",
15894
+ "vehicle",
15895
+ "animal",
15896
+ "door",
15897
+ "pir",
15898
+ "smoke",
15899
+ "water",
15900
+ "button",
15901
+ "generic"
15902
+ ]);
15903
+ var EventKindCategorySchema = _enum([
15904
+ "motion",
15905
+ "audio",
15906
+ "detection",
15907
+ "sensor",
15908
+ "custom"
15909
+ ]);
15910
+ var EventKindDescriptorSchema = object({
15911
+ /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
15912
+ kind: string(),
15913
+ label: string(),
15914
+ /** Hex color for timeline/legend rendering. */
15915
+ color: string(),
15916
+ icon: EventKindIconSchema,
15917
+ category: EventKindCategorySchema,
15918
+ /** Which cap + device contributes this kind. For built-ins the camera
15919
+ * itself; for sensor kinds the LINKED source device. */
15920
+ source: object({
15921
+ capName: string(),
15922
+ deviceId: number()
15923
+ })
15924
+ });
15925
+ var SensorEventSchema = object({
15926
+ id: string(),
15927
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
15928
+ * yields N rows, one per camera). */
15929
+ deviceId: number(),
15930
+ /** The linked sensor device whose state changed. */
15931
+ sourceDeviceId: number(),
15932
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
15933
+ kind: string(),
15934
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
15935
+ value: record(string(), unknown()).nullable(),
15936
+ timestamp: number()
15937
+ });
15869
15938
  var TrackPositionSchema = object({
15870
15939
  x: number(),
15871
15940
  y: number(),
@@ -15879,6 +15948,30 @@ var TrackSnapshotSchema = object({
15879
15948
  mediaKey: string()
15880
15949
  });
15881
15950
  /**
15951
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
15952
+ * divided by the track's detection-frame dims), computed at persist time.
15953
+ * Absent when the frame dims were unknown when the track was persisted
15954
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
15955
+ */
15956
+ var TrackEnvelopeSchema = object({
15957
+ minX: number(),
15958
+ minY: number(),
15959
+ maxX: number(),
15960
+ maxY: number()
15961
+ });
15962
+ /**
15963
+ * Row projection for track list queries. `full` (default) returns the
15964
+ * complete Track including the frame-rate `positions[]` history and the
15965
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
15966
+ * keeps every scalar the list surfaces actually render (ids, class(es),
15967
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
15968
+ * zonesVisited, bestEventId, envelope) and returns `positions` /
15969
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
15970
+ * `getTrack`. Mirrors the event-store `projection` convention
15971
+ * (`getObjectEvents` et al.).
15972
+ */
15973
+ var TrackProjectionSchema = _enum(["full", "slim"]);
15974
+ /**
15882
15975
  * One audio-classification label heard on the track's camera while the
15883
15976
  * track was alive, aggregated per label. An "episode" is one persisted
15884
15977
  * audio event (the confident-classification path: score ≥ the device's
@@ -15929,7 +16022,11 @@ var TrackSchema = object({
15929
16022
  /** Audio-classification labels heard on the camera during the track's
15930
16023
  * life (score ≥ device `classificationMinScore`), aggregated per label.
15931
16024
  * Absent on legacy rows / tracks with no confident audio. */
15932
- audioLabels: array(TrackAudioLabelSchema).readonly().optional()
16025
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
16026
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
16027
+ * Populated from the persisted envelope columns on historical reads;
16028
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
16029
+ envelope: TrackEnvelopeSchema.optional()
15933
16030
  });
15934
16031
  var BaseEventFields = {
15935
16032
  id: string(),
@@ -16039,11 +16136,13 @@ var MediaFileSchema = object({
16039
16136
  sizeBytes: number(),
16040
16137
  timestamp: number()
16041
16138
  });
16139
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
16140
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
16042
16141
  var DeviceEventQueryInput = object({
16043
16142
  deviceId: number(),
16044
16143
  since: number().optional(),
16045
16144
  until: number().optional(),
16046
- limit: number().int().min(1).max(5e3).default(1e3),
16145
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
16047
16146
  /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
16048
16147
  * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
16049
16148
  * exact behaviour. Callers may omit this field — the store defaults to
@@ -16051,6 +16150,27 @@ var DeviceEventQueryInput = object({
16051
16150
  projection: _enum(["full", "slim"]).optional()
16052
16151
  });
16053
16152
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
16153
+ var RecentTracksQueryInput = object({
16154
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
16155
+ deviceIds: array(number()),
16156
+ /** Window lower bound on `lastSeen` (inclusive). */
16157
+ since: number().optional(),
16158
+ /** Window upper bound on `lastSeen` (inclusive). */
16159
+ until: number().optional(),
16160
+ /** Page size. Default 200, max 1000. */
16161
+ limit: number().int().min(1).max(1e3).default(200),
16162
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
16163
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
16164
+ cursor: string().optional(),
16165
+ /** See {@link TrackProjectionSchema}. Default `full`. */
16166
+ projection: TrackProjectionSchema.optional()
16167
+ });
16168
+ var RecentTracksPageSchema = object({
16169
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
16170
+ tracks: array(TrackSchema).readonly(),
16171
+ /** Cursor for the next page, or null when this page is the last. */
16172
+ nextCursor: string().nullable()
16173
+ });
16054
16174
  var KeyEventQueryInput = object({
16055
16175
  deviceId: number(),
16056
16176
  /** Window lower bound (track firstSeen ≥ since). */
@@ -16147,8 +16267,27 @@ var pipelineAnalyticsCapability = {
16147
16267
  deviceId: number(),
16148
16268
  since: number().optional(),
16149
16269
  until: number().optional(),
16150
- limit: number().optional()
16270
+ limit: number().optional(),
16271
+ /** Spatial filter — only tracks whose trajectory intersects the zone
16272
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
16273
+ * envelope columns, then precisely tested per position. Tracks with
16274
+ * an unknown envelope (no frame dims at persist time) always match. */
16275
+ zone: TrackZoneFilterSchema.optional(),
16276
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
16277
+ * compatible — omitting the field keeps today's exact behaviour). */
16278
+ projection: TrackProjectionSchema.optional()
16151
16279
  }), array(TrackSchema).readonly()),
16280
+ /**
16281
+ * Batched cluster-wide track listing — ONE call for the events page /
16282
+ * reel first paint instead of a per-camera `listTracks` fan-out. Merges
16283
+ * the persisted completed tracks of every requested device, sorted by
16284
+ * `lastSeen` DESC with a stable (lastSeen, trackId) cursor. Per-device
16285
+ * indexed pages (`idx_tracks_device_lastSeen`) are k-way merged
16286
+ * provider-side; `projection: 'slim'` drops the heavy `positions[]` /
16287
+ * `snapshots[]` JSON (returned as empty arrays). Active in-RAM tracks
16288
+ * are not included (same contract as `listTracks`).
16289
+ */
16290
+ listRecentTracks: method(RecentTracksQueryInput, RecentTracksPageSchema),
16152
16291
  clearTracks: method(object({ deviceId: number() }), _void(), {
16153
16292
  kind: "mutation",
16154
16293
  auth: "admin"
@@ -16157,6 +16296,26 @@ var pipelineAnalyticsCapability = {
16157
16296
  getObjectEvents: method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()),
16158
16297
  getAudioEvents: method(DeviceEventQueryInput, array(AudioEventSchema).readonly()),
16159
16298
  /**
16299
+ * Every event kind the device can produce: built-ins (motion + audio),
16300
+ * detection classes actually observed for the device (from the track
16301
+ * history), and sensor kinds contributed by LINKED devices (resolved via
16302
+ * `device-manager.getLinkedDevices`, mapped through `EVENT_KIND_BY_CAP`).
16303
+ */
16304
+ listEventKinds: method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()),
16305
+ /**
16306
+ * Sensor-event history for a camera: state changes of LINKED sensor
16307
+ * devices, attributed to the camera at ingest time (one row per linked
16308
+ * camera). Mirrors `getAudioEvents` query semantics; `kinds` narrows to
16309
+ * a kind subset.
16310
+ */
16311
+ getSensorEvents: method(object({
16312
+ deviceId: number(),
16313
+ since: number().optional(),
16314
+ until: number().optional(),
16315
+ kinds: array(string()).optional(),
16316
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
16317
+ }), array(SensorEventSchema).readonly()),
16318
+ /**
16160
16319
  * Importance-ranked highlights for a device+window. Queries completed
16161
16320
  * tracks by (deviceId, firstSeen ∈ [since,until]), scores each (or reuses
16162
16321
  * the persisted score), filters by minImportance/classFilter, orders by
@@ -16301,6 +16460,54 @@ var pipelineAnalyticsCapability = {
16301
16460
  }) }
16302
16461
  }
16303
16462
  };
16463
+ /**
16464
+ * Sensor cap name → static event-kind descriptor. A linked device
16465
+ * contributes one entry per bound cap present in this map.
16466
+ */
16467
+ var EVENT_KIND_BY_CAP = {
16468
+ contact: {
16469
+ kind: "contact",
16470
+ label: "Contact",
16471
+ color: "#f59e0b",
16472
+ icon: "door",
16473
+ category: "sensor"
16474
+ },
16475
+ flood: {
16476
+ kind: "flood",
16477
+ label: "Water leak",
16478
+ color: "#3b82f6",
16479
+ icon: "water",
16480
+ category: "sensor"
16481
+ },
16482
+ gas: {
16483
+ kind: "gas",
16484
+ label: "Gas",
16485
+ color: "#ef4444",
16486
+ icon: "smoke",
16487
+ category: "sensor"
16488
+ },
16489
+ "carbon-monoxide": {
16490
+ kind: "carbon-monoxide",
16491
+ label: "Carbon monoxide",
16492
+ color: "#dc2626",
16493
+ icon: "smoke",
16494
+ category: "sensor"
16495
+ },
16496
+ "enum-sensor": {
16497
+ kind: "enum-sensor",
16498
+ label: "Sensor state",
16499
+ color: "#8b5cf6",
16500
+ icon: "generic",
16501
+ category: "sensor"
16502
+ },
16503
+ "event-emitter": {
16504
+ kind: "device-event",
16505
+ label: "Device event",
16506
+ color: "#10b981",
16507
+ icon: "button",
16508
+ category: "sensor"
16509
+ }
16510
+ };
16304
16511
  var CameraPipelineConfigSchema = object({
16305
16512
  engine: PipelineEngineChoiceSchema.optional(),
16306
16513
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19510,7 +19717,12 @@ var RecordingStorageUsageSchema = object({
19510
19717
  /**
19511
19718
  * Result of locating footage at a wall-clock instant for one device/profile.
19512
19719
  * `segment` carries the covering segment's window; `gap` reports the forward
19513
- * nearest covered edge (`null` past the end of footage / when none exists).
19720
+ * nearest covered edge (`null` past the end of footage / when none exists)
19721
+ * and the backward covered edge `prevEndMs` (exclusive end of the nearest
19722
+ * footage behind the epoch; `null` when none — optional so older providers
19723
+ * that omit it stay valid). `prevEndMs` lets a backward frame-step hop the
19724
+ * small inter-segment cracks (durMs under-covers the span to the next
19725
+ * startMs by ~11-17 ms) instead of no-opping at a segment head.
19514
19726
  */
19515
19727
  var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
19516
19728
  kind: literal("segment"),
@@ -19519,7 +19731,8 @@ var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
19519
19731
  bytes: number()
19520
19732
  }), object({
19521
19733
  kind: literal("gap"),
19522
- nearestEdgeMs: number().nullable()
19734
+ nearestEdgeMs: number().nullable(),
19735
+ prevEndMs: number().nullable().optional()
19523
19736
  })]);
19524
19737
  /** Raw bytes of one finalized footage segment (read off disk on the recording node). */
19525
19738
  var ReadSegmentBytesResultSchema = object({ data: _instanceof(Uint8Array) });
@@ -21088,6 +21301,12 @@ Object.freeze({
21088
21301
  addonId: null,
21089
21302
  access: "view"
21090
21303
  },
21304
+ "deviceManager.getLinkedDevices": {
21305
+ capName: "device-manager",
21306
+ capScope: "system",
21307
+ addonId: null,
21308
+ access: "view"
21309
+ },
21091
21310
  "deviceManager.getRoleDisplayDefaults": {
21092
21311
  capName: "device-manager",
21093
21312
  capScope: "system",
@@ -22642,6 +22861,12 @@ Object.freeze({
22642
22861
  addonId: null,
22643
22862
  access: "view"
22644
22863
  },
22864
+ "pipelineAnalytics.getSensorEvents": {
22865
+ capName: "pipeline-analytics",
22866
+ capScope: "device",
22867
+ addonId: null,
22868
+ access: "view"
22869
+ },
22645
22870
  "pipelineAnalytics.getTrack": {
22646
22871
  capName: "pipeline-analytics",
22647
22872
  capScope: "device",
@@ -22654,6 +22879,18 @@ Object.freeze({
22654
22879
  addonId: null,
22655
22880
  access: "view"
22656
22881
  },
22882
+ "pipelineAnalytics.listEventKinds": {
22883
+ capName: "pipeline-analytics",
22884
+ capScope: "device",
22885
+ addonId: null,
22886
+ access: "view"
22887
+ },
22888
+ "pipelineAnalytics.listRecentTracks": {
22889
+ capName: "pipeline-analytics",
22890
+ capScope: "device",
22891
+ addonId: null,
22892
+ access: "view"
22893
+ },
22657
22894
  "pipelineAnalytics.listTracks": {
22658
22895
  capName: "pipeline-analytics",
22659
22896
  capScope: "device",
@@ -24653,6 +24890,12 @@ Object.defineProperty(exports, "DeviceType", {
24653
24890
  return DeviceType;
24654
24891
  }
24655
24892
  });
24893
+ Object.defineProperty(exports, "EVENT_KIND_BY_CAP", {
24894
+ enumerable: true,
24895
+ get: function() {
24896
+ return EVENT_KIND_BY_CAP;
24897
+ }
24898
+ });
24656
24899
  Object.defineProperty(exports, "EVENT_PAD_MS", {
24657
24900
  enumerable: true,
24658
24901
  get: function() {