@blueharford/scrypted-spatial-awareness 0.6.23 → 0.6.24

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.
package/dist/plugin.zip CHANGED
Binary file
@@ -34496,6 +34496,7 @@ class AlertManager {
34496
34496
  }
34497
34497
  /**
34498
34498
  * Get notification title based on alert type
34499
+ * For movement alerts with LLM descriptions, use the smart description as title
34499
34500
  */
34500
34501
  getNotificationTitle(alert) {
34501
34502
  const prefix = alert.severity === 'critical' ? '🚨 ' :
@@ -34506,11 +34507,27 @@ class AlertManager {
34506
34507
  : 'Object';
34507
34508
  switch (alert.type) {
34508
34509
  case 'property_entry':
34510
+ // Legacy - use simple title
34509
34511
  return `${prefix}${objectType} Arrived`;
34510
34512
  case 'property_exit':
34513
+ // Legacy - use simple title
34511
34514
  return `${prefix}${objectType} Left`;
34512
34515
  case 'movement':
34513
- // Include destination in title
34516
+ // For smart activity alerts, use the LLM description as title if available
34517
+ // This gives us rich context like "Person walking toward front door"
34518
+ if (alert.details.objectLabel && alert.details.usedLlm) {
34519
+ // Truncate to reasonable title length (first sentence or 60 chars)
34520
+ let smartTitle = alert.details.objectLabel;
34521
+ const firstPeriod = smartTitle.indexOf('.');
34522
+ if (firstPeriod > 0 && firstPeriod < 60) {
34523
+ smartTitle = smartTitle.substring(0, firstPeriod);
34524
+ }
34525
+ else if (smartTitle.length > 60) {
34526
+ smartTitle = smartTitle.substring(0, 57) + '...';
34527
+ }
34528
+ return `${prefix}${smartTitle}`;
34529
+ }
34530
+ // Fallback: include destination in title
34514
34531
  const dest = alert.details.toCameraName || 'area';
34515
34532
  return `${prefix}${objectType} → ${dest}`;
34516
34533
  case 'unusual_path':
@@ -37519,33 +37536,19 @@ class TrackingEngine {
37519
37536
  spatialResult = await this.spatialReasoning.generateEntryDescription(tracked, sighting.cameraId, mediaObject);
37520
37537
  this.console.log(`[Entry Alert] Got description: "${spatialResult.description.substring(0, 60)}...", usedLlm=${spatialResult.usedLlm}`);
37521
37538
  }
37522
- if (isEntryPoint) {
37523
- // Entry point - generate property entry alert
37524
- await this.alertManager.checkAndAlert('property_entry', tracked, {
37525
- cameraId: sighting.cameraId,
37526
- cameraName: sighting.cameraName,
37527
- objectClass: sighting.detection.className,
37528
- objectLabel: spatialResult.description,
37529
- detectionId: sighting.detectionId,
37530
- involvedLandmarks: spatialResult.involvedLandmarks?.map(l => l.name),
37531
- usedLlm: spatialResult.usedLlm,
37532
- });
37533
- }
37534
- else {
37535
- // Non-entry point - still alert about activity using movement alert type
37536
- // This notifies about any activity around the property using topology context
37537
- await this.alertManager.checkAndAlert('movement', tracked, {
37538
- cameraId: sighting.cameraId,
37539
- cameraName: sighting.cameraName,
37540
- toCameraId: sighting.cameraId,
37541
- toCameraName: sighting.cameraName,
37542
- objectClass: sighting.detection.className,
37543
- objectLabel: spatialResult.description, // Use spatial reasoning description (topology-based)
37544
- detectionId: sighting.detectionId,
37545
- involvedLandmarks: spatialResult.involvedLandmarks?.map(l => l.name),
37546
- usedLlm: spatialResult.usedLlm,
37547
- });
37548
- }
37539
+ // Always use movement alert type for smart notifications with LLM descriptions
37540
+ // The property_entry/property_exit types are legacy and disabled by default
37541
+ await this.alertManager.checkAndAlert('movement', tracked, {
37542
+ cameraId: sighting.cameraId,
37543
+ cameraName: sighting.cameraName,
37544
+ toCameraId: sighting.cameraId,
37545
+ toCameraName: sighting.cameraName,
37546
+ objectClass: sighting.detection.className,
37547
+ objectLabel: spatialResult.description, // Smart LLM-generated description
37548
+ detectionId: sighting.detectionId,
37549
+ involvedLandmarks: spatialResult.involvedLandmarks?.map(l => l.name),
37550
+ usedLlm: spatialResult.usedLlm,
37551
+ });
37549
37552
  this.recordAlertTime(globalId);
37550
37553
  }, this.config.loiteringThreshold);
37551
37554
  }
@@ -37653,9 +37656,12 @@ class TrackingEngine {
37653
37656
  spatialResult = await this.spatialReasoning.generateExitDescription(current, sighting.cameraId, mediaObject);
37654
37657
  this.console.log(`[Exit Alert] Got description: "${spatialResult.description.substring(0, 60)}...", usedLlm=${spatialResult.usedLlm}`);
37655
37658
  }
37656
- await this.alertManager.checkAndAlert('property_exit', current, {
37659
+ // Use movement alert for exit too - smart notifications with LLM descriptions
37660
+ await this.alertManager.checkAndAlert('movement', current, {
37657
37661
  cameraId: sighting.cameraId,
37658
37662
  cameraName: sighting.cameraName,
37663
+ toCameraId: sighting.cameraId,
37664
+ toCameraName: sighting.cameraName,
37659
37665
  objectClass: current.className,
37660
37666
  objectLabel: spatialResult.description,
37661
37667
  involvedLandmarks: spatialResult.involvedLandmarks?.map(l => l.name),
@@ -41207,8 +41213,8 @@ function createDefaultRules() {
41207
41213
  return [
41208
41214
  {
41209
41215
  id: 'property-entry',
41210
- name: 'Property Entry',
41211
- enabled: true,
41216
+ name: 'Property Entry (Legacy)',
41217
+ enabled: false, // Disabled - use movement alerts with LLM descriptions instead
41212
41218
  type: 'property_entry',
41213
41219
  conditions: [],
41214
41220
  severity: 'info',
@@ -41217,8 +41223,8 @@ function createDefaultRules() {
41217
41223
  },
41218
41224
  {
41219
41225
  id: 'property-exit',
41220
- name: 'Property Exit',
41221
- enabled: true,
41226
+ name: 'Property Exit (Legacy)',
41227
+ enabled: false, // Disabled - use movement alerts with LLM descriptions instead
41222
41228
  type: 'property_exit',
41223
41229
  conditions: [],
41224
41230
  severity: 'info',
@@ -41227,7 +41233,7 @@ function createDefaultRules() {
41227
41233
  },
41228
41234
  {
41229
41235
  id: 'movement',
41230
- name: 'Movement Between Cameras',
41236
+ name: 'Smart Activity Alerts',
41231
41237
  enabled: true,
41232
41238
  type: 'movement',
41233
41239
  conditions: [],