robopark 3.3.33 → 3.3.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robopark",
3
- "version": "3.3.33",
3
+ "version": "3.3.34",
4
4
  "description": "RoboPark fleet control CLI — scheduler, control UI, and character voice calls. Standalone: no infinicode runtime.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -55,7 +55,7 @@
55
55
  function refreshHardware(requestPermission){if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){setHardwareStatus(mediaBlockedReason(),'bad');return Promise.reject(new Error('media devices unavailable'))}var permission=Promise.resolve();if(requestPermission){permission=navigator.mediaDevices.getUserMedia({audio:true,video:true}).catch(function(){return navigator.mediaDevices.getUserMedia({audio:true})}).then(function(stream){stream.getTracks().forEach(function(track){track.stop()})})}setHardwareStatus(requestPermission?'Requesting browser media access...':'Scanning browser hardware...','');return permission.then(function(){return navigator.mediaDevices.enumerateDevices()}).then(function(devices){fillHardwareSelect('call-microphone',devices,'audioinput','microphone');fillHardwareSelect('call-camera',devices,'videoinput','camera');fillHardwareSelect('call-speaker',devices,'audiooutput','speaker');var mic=devices.filter(function(device){return device.kind==='audioinput'}).length,cam=devices.filter(function(device){return device.kind==='videoinput'}).length,out=devices.filter(function(device){return device.kind==='audiooutput'}).length;setHardwareStatus('Ready: '+mic+' microphone(s), '+cam+' camera(s), '+out+' speaker output(s).','ok');return devices}).catch(function(error){setHardwareStatus(error&&error.message||String(error),'bad');throw error})}
56
56
  function ensureCameraSdk(){if(window.LivekitClient)return Promise.resolve(window.LivekitClient);if(cameraSdkPromise)return cameraSdkPromise;cameraSdkPromise=new Promise(function(resolve,reject){var script=document.createElement('script');script.src='/vendor/livekit-client.umd.js';script.onload=function(){window.LivekitClient?resolve(window.LivekitClient):reject(new Error('LiveKit camera SDK unavailable'))};script.onerror=function(){reject(new Error('LiveKit camera SDK failed to load'))};document.head.appendChild(script)});return cameraSdkPromise}
57
57
  function scheduleCameraPublishRetry(){if(cameraPublishRetry||ending||!localVideoStream)return;if(cameraRetryCount>=8){event('camera_published','failed','Giving up after 8 attempts - the media server is not reachable.',{attempts:cameraRetryCount});return}var delay=Math.min(30000,3000*Math.pow(1.6,cameraRetryCount));cameraRetryCount++;cameraPublishRetry=setTimeout(function(){cameraPublishRetry=null;publishLocalVideo().catch(function(){})},delay)}
58
- function publishLocalVideo(){if(!localVideoStream||!localVideoStream.getVideoTracks().length)return Promise.resolve();if(cameraRoom)return Promise.resolve();return Promise.all([ensureCameraSdk(),fetch(API_BASE+'/api/camera-token',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({character_id:character,robot_id:robot||null})}).then(function(response){if(!response.ok)throw new Error('camera token '+response.status);return response.json()})]).then(function(parts){var LK=parts[0],info=parts[1],room=new LK.Room();cameraRoom=room;room.on(LK.RoomEvent.Disconnected,function(){if(cameraRoom===room){cameraRoom=null;scheduleCameraPublishRetry()}});return room.connect(info.url,info.token).then(function(){return room.localParticipant.publishTrack(localVideoStream.getVideoTracks()[0],{name:'camera',source:LK.Track.Source.Camera})}).then(function(){cameraRetryCount=0;if(cameraPublishRetry){clearTimeout(cameraPublishRetry);cameraPublishRetry=null}event('camera_published','ok','Camera relay live',{})})}).catch(function(error){try{if(room&&room.disconnect)room.disconnect(true)}catch(_){}cameraRoom=null;event('camera_published','failed',error.message,{});scheduleCameraPublishRetry();throw error})}
58
+ function publishLocalVideo(){var pendingCameraRoom=null;if(!localVideoStream||!localVideoStream.getVideoTracks().length)return Promise.resolve();if(cameraRoom)return Promise.resolve();return Promise.all([ensureCameraSdk(),fetch(API_BASE+'/api/camera-token',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({character_id:character,robot_id:robot||null})}).then(function(response){if(!response.ok)throw new Error('camera token '+response.status);return response.json()})]).then(function(parts){var LK=parts[0],info=parts[1],room=new LK.Room();pendingCameraRoom=room;cameraRoom=room;room.on(LK.RoomEvent.Disconnected,function(){if(cameraRoom===room){cameraRoom=null;scheduleCameraPublishRetry()}});return room.connect(info.url,info.token).then(function(){return room.localParticipant.publishTrack(localVideoStream.getVideoTracks()[0],{name:'camera',source:LK.Track.Source.Camera})}).then(function(){cameraRetryCount=0;if(cameraPublishRetry){clearTimeout(cameraPublishRetry);cameraPublishRetry=null}event('camera_published','ok','Camera relay live',{})})}).catch(function(error){try{if(pendingCameraRoom&&pendingCameraRoom.disconnect)pendingCameraRoom.disconnect(true)}catch(_){}pendingCameraRoom=null;cameraRoom=null;event('camera_published','failed',error.message,{});scheduleCameraPublishRetry();throw error})}
59
59
  function startLocalVideo(){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)return Promise.resolve();if(localVideoStream&&activeCameraDevice===cameraDeviceId)return publishLocalVideo();if(localVideoStream)localVideoStream.getTracks().forEach(function(track){track.stop()});if(cameraRoom){cameraRoom.disconnect();cameraRoom=null}var video=cameraDeviceId?{deviceId:{exact:cameraDeviceId}}:true;return navigator.mediaDevices.getUserMedia({video:video,audio:false}).then(function(stream){localVideoStream=stream;activeCameraDevice=cameraDeviceId;el('robot-video').srcObject=stream;if(!robotStreamActive())el('robot-video').hidden=false;el('vision').hidden=false;return publishLocalVideo().catch(function(){})}).catch(function(error){localVideoStream=null;activeCameraDevice=null;el('robot-video').srcObject=null;if(!robotStreamActive()){el('robot-video').hidden=true;el('vision').hidden=true}throw error})}
60
60
  function robotStreamActive(){var stream=el('robot-stream');return Boolean(stream&&stream.getAttribute('src'))}
61
61
  // Ambient vision. The ElevenLabs contextual_update channel carries text only, so a