@blueharford/scrypted-spatial-awareness 0.6.16 → 0.6.17

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
@@ -36481,13 +36481,26 @@ class TopologyDiscoveryEngine {
36481
36481
  for (const formatType of formatsToTry) {
36482
36482
  try {
36483
36483
  this.console.log(`[Discovery] Trying ${formatType} image format for ${cameraName}...`);
36484
+ // Build prompt with camera context (height)
36485
+ const cameraNode = this.topology ? (0, topology_1.findCamera)(this.topology, cameraId) : null;
36486
+ const mountHeight = cameraNode?.context?.mountHeight || 8;
36487
+ const cameraRange = cameraNode?.fov?.range || 80;
36488
+ // Add camera-specific context to the prompt
36489
+ const contextPrefix = `CAMERA INFORMATION:
36490
+ - Camera Name: ${cameraName}
36491
+ - Mount Height: ${mountHeight} feet above ground
36492
+ - Approximate viewing range: ${cameraRange} feet
36493
+
36494
+ Use the mount height to help estimate distances - objects at ground level will appear at different angles depending on distance from a camera mounted at ${mountHeight} feet.
36495
+
36496
+ `;
36484
36497
  // Build multimodal message with provider-specific image format
36485
36498
  const result = await llm.getChatCompletion({
36486
36499
  messages: [
36487
36500
  {
36488
36501
  role: 'user',
36489
36502
  content: [
36490
- { type: 'text', text: SCENE_ANALYSIS_PROMPT },
36503
+ { type: 'text', text: contextPrefix + SCENE_ANALYSIS_PROMPT },
36491
36504
  (0, spatial_reasoning_1.buildImageContent)(imageData, formatType),
36492
36505
  ],
36493
36506
  },
@@ -43719,8 +43732,12 @@ exports.EDITOR_HTML = `<!DOCTYPE html>
43719
43732
  const fov = camera.fov || { mode: 'simple', angle: 90, direction: 0, range: 80 };
43720
43733
  // Convert stored pixel range to feet for display
43721
43734
  const rangeInFeet = Math.round(pixelsToFeet(fov.range || 80));
43735
+ // Get mount height from context or default to 8
43736
+ const mountHeight = camera.context?.mountHeight || 8;
43722
43737
  panel.innerHTML = '<h3>Camera Properties</h3>' +
43723
43738
  '<div class="form-group"><label>Name</label><input type="text" value="' + camera.name + '" onchange="updateCameraName(\\'' + camera.deviceId + '\\', this.value)"></div>' +
43739
+ '<div class="form-group"><label>Mount Height (feet)</label><input type="number" value="' + mountHeight + '" min="1" max="40" step="0.5" onchange="updateCameraMountHeight(\\'' + camera.deviceId + '\\', this.value)"></div>' +
43740
+ '<div style="font-size: 11px; color: #666; margin-top: -10px; margin-bottom: 10px;">Height affects distance estimation in discovery</div>' +
43724
43741
  '<div class="form-group"><label class="checkbox-group"><input type="checkbox" ' + (camera.isEntryPoint ? 'checked' : '') + ' onchange="updateCameraEntry(\\'' + camera.deviceId + '\\', this.checked)">Entry Point</label></div>' +
43725
43742
  '<div class="form-group"><label class="checkbox-group"><input type="checkbox" ' + (camera.isExitPoint ? 'checked' : '') + ' onchange="updateCameraExit(\\'' + camera.deviceId + '\\', this.checked)">Exit Point</label></div>' +
43726
43743
  '<h4 style="margin-top: 15px; margin-bottom: 10px; color: #888;">Field of View</h4>' +
@@ -43739,6 +43756,12 @@ exports.EDITOR_HTML = `<!DOCTYPE html>
43739
43756
  function updateCameraName(id, value) { const camera = topology.cameras.find(c => c.deviceId === id); if (camera) camera.name = value; updateUI(); }
43740
43757
  function updateCameraEntry(id, value) { const camera = topology.cameras.find(c => c.deviceId === id); if (camera) camera.isEntryPoint = value; }
43741
43758
  function updateCameraExit(id, value) { const camera = topology.cameras.find(c => c.deviceId === id); if (camera) camera.isExitPoint = value; }
43759
+ function updateCameraMountHeight(id, value) {
43760
+ const camera = topology.cameras.find(c => c.deviceId === id);
43761
+ if (!camera) return;
43762
+ if (!camera.context) camera.context = {};
43763
+ camera.context.mountHeight = parseFloat(value) || 8;
43764
+ }
43742
43765
  function updateCameraFov(id, field, value) {
43743
43766
  const camera = topology.cameras.find(c => c.deviceId === id);
43744
43767
  if (!camera) return;