infinicode 2.8.82 → 2.8.83

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.
@@ -4005,7 +4005,7 @@ button.act:disabled{opacity:0.5;cursor:default;}
4005
4005
  var drawerId=null, camRAF=null, meterRAF=null, camAbort=null, drawerTimer=null, pipelineTimer=null, deviceSelectorsReady=false;
4006
4006
  var previewOn=false, previewTimer=null; // on-demand operator camera preview
4007
4007
  var visionOn=false; // RoboVisionAI_PI overlay feed (direct MJPEG, not LiveKit)
4008
- var lkRoom=null, micAnalyser=null, audioCtx=null, lkAudioEls=[], micMonitorConnecting=false, micMonitorState='no active conversation session', micMonitorAudible=false, micMonitorVolume=0.8;
4008
+ var lkRoom=null, micAnalyser=null, micMonitorSource=null, micMonitorGain=null, audioCtx=null, lkAudioEls=[], micMonitorConnecting=false, micMonitorState='no active conversation session', micMonitorAudible=false, micMonitorVolume=0.8;
4009
4009
  var imgs={}; // preloaded robot concept avatars
4010
4010
  var TW=44, TH=22, PARK_W=15, PARK_D=8;
4011
4011
  // Plaza footprint and parking lot (upper-right corner of the plaza)
@@ -6096,6 +6096,7 @@ button.act:disabled{opacity:0.5;cursor:default;}
6096
6096
  if(pipelineTimer){ clearInterval(pipelineTimer); pipelineTimer=null; }
6097
6097
  if(lkRoom){ try{ lkRoom.disconnect(); }catch(e){} lkRoom=null; }
6098
6098
  lkAudioEls.forEach(function(el){try{el.pause();el.remove();}catch(e){}});lkAudioEls=[];
6099
+ if(micMonitorSource)try{micMonitorSource.disconnect();}catch(e){}micMonitorSource=null;micMonitorGain=null;
6099
6100
  micMonitorAudible=false;micMonitorConnecting=false;micMonitorState='no active conversation session';
6100
6101
  micAnalyser=null;
6101
6102
  }
@@ -6735,7 +6736,7 @@ button.act:disabled{opacity:0.5;cursor:default;}
6735
6736
  });
6736
6737
  });
6737
6738
  var micListen=$('pk-mic-listen');if(micListen)micListen.addEventListener('click',function(){setMicMonitorAudible(!micMonitorAudible);});
6738
- var micVolume=$('pk-mic-volume');if(micVolume)micVolume.addEventListener('input',function(){micMonitorVolume=Math.max(0,Math.min(1,Number(micVolume.value||80)/100));lkAudioEls.forEach(function(el){el.volume=micMonitorVolume;});});
6739
+ var micVolume=$('pk-mic-volume');if(micVolume)micVolume.addEventListener('input',function(){micMonitorVolume=Math.max(0,Math.min(1,Number(micVolume.value||80)/100));if(micMonitorGain)micMonitorGain.gain.value=micMonitorAudible?micMonitorVolume:0;});
6739
6740
  startCam(n); startMeters(n); loadEffectiveConfig(schedId(n)); refreshSupervisorPanel(n);
6740
6741
  _bindShellSection(n);
6741
6742
  _spkTestRenderHistory(schedId(n));
@@ -6946,12 +6947,15 @@ button.act:disabled{opacity:0.5;cursor:default;}
6946
6947
  function setMicMonitorAudible(enabled){
6947
6948
  micMonitorAudible=!!enabled;
6948
6949
  var btn=$('pk-mic-listen'),note=$('pk-mic-listen-note');
6950
+ if(micMonitorAudible){
6951
+ var AC=window.AudioContext||window.webkitAudioContext;
6952
+ if(AC) audioCtx=audioCtx||new AC();
6953
+ if(audioCtx&&audioCtx.state==='suspended') audioCtx.resume().catch(function(e){if(note)note.textContent='Browser audio resume failed: '+e.message;});
6954
+ }
6955
+ if(micMonitorGain)micMonitorGain.gain.value=micMonitorAudible?micMonitorVolume:0;
6949
6956
  if(btn){btn.textContent=micMonitorAudible?'Mute browser monitor':'Listen in browser';btn.classList.toggle('primary',micMonitorAudible);}
6950
6957
  if(note)note.textContent=micMonitorAudible?(lkAudioEls.length?'Robot mic is playing in this browser. Use headphones.':'Listening armed — waiting for the robot mic track.'):'Browser monitoring muted.';
6951
- lkAudioEls.forEach(function(el){
6952
- el.muted=!micMonitorAudible;el.volume=micMonitorVolume;
6953
- if(micMonitorAudible)el.play().catch(function(e){if(note)note.textContent='Browser blocked playback: '+e.message+' — press Listen again.';});
6954
- });
6958
+ lkAudioEls.forEach(function(el){el.muted=true;});
6955
6959
  }
6956
6960
  function startMicMonitor(n){
6957
6961
  if(lkRoom||micMonitorConnecting)return;
@@ -7000,12 +7004,11 @@ button.act:disabled{opacity:0.5;cursor:default;}
7000
7004
  // that drowns out the actual conversation. The VU meter above
7001
7005
  // (hookMicAnalyser) taps the raw track directly and works fine
7002
7006
  // muted.
7003
- var audio=track.attach(); audio.autoplay=true; audio.playsInline=true;audio.setAttribute('playsinline','');audio.controls=false; audio.muted=!micMonitorAudible; audio.volume=micMonitorVolume;audio.style.display='none'; document.body.appendChild(audio); lkAudioEls.push(audio);
7007
+ var audio=track.attach(); audio.autoplay=false; audio.playsInline=true;audio.setAttribute('playsinline','');audio.controls=false; audio.muted=true; audio.style.display='none'; document.body.appendChild(audio); lkAudioEls.push(audio);
7004
7008
  var listenNote=$('pk-mic-listen-note');if(listenNote&&micMonitorAudible)listenNote.textContent='Robot mic is playing in this browser. Use headphones.';
7005
- audio.play().catch(function(e){var listenNote=$('pk-mic-listen-note');if(listenNote)listenNote.textContent='Browser blocked robot audio: '+e.message+'. Click Listen in browser.';});
7006
7009
  }
7007
7010
  });
7008
- lkRoom.on(LK.RoomEvent.Disconnected, function(){lkRoom=null;micAnalyser=null;micMonitorConnecting=false;micMonitorState='session ended';var micState=$('pk-micstate');if(micState)micState.textContent='selected '+selectedRobotMic()+' · session ended';if(!audioOnly&&note)note.textContent='session ended';if(!audioOnly&&res)res.textContent='—';});
7011
+ lkRoom.on(LK.RoomEvent.Disconnected, function(){lkRoom=null;micAnalyser=null;if(micMonitorSource)try{micMonitorSource.disconnect();}catch(e){}micMonitorSource=null;micMonitorGain=null;micMonitorConnecting=false;micMonitorState='session ended';var micState=$('pk-micstate');if(micState)micState.textContent='selected '+selectedRobotMic()+' · session ended';if(!audioOnly&&note)note.textContent='session ended';if(!audioOnly&&res)res.textContent='—';});
7009
7012
  var livekitUrl=info.url;
7010
7013
  if((location.hostname==='localhost'||location.hostname==='127.0.0.1') && /^ws:\\/\\/localhost(?::|\\/)/i.test(livekitUrl)) livekitUrl=livekitUrl.replace(/^ws:\\/\\/localhost/i,'ws://127.0.0.1');
7011
7014
  lkRoom.connect(livekitUrl, info.token).then(function(){micMonitorState='connected, waiting for robot mic publication';var micState=$('pk-micstate');if(micState)micState.textContent='selected '+selectedRobotMic()+' · '+micMonitorState;if(!audioOnly&&note)note.textContent='connected · waiting for camera track…';})
@@ -7014,13 +7017,15 @@ button.act:disabled{opacity:0.5;cursor:default;}
7014
7017
  }
7015
7018
  // Real mic level: tap the robot's subscribed 'mic' audio track with a Web
7016
7019
  // Audio analyser and read RMS in startMeters (no invented levels).
7017
- function hookMicAnalyser(track){
7020
+ function hookMicAnalyser(track){
7018
7021
  try{
7019
7022
  var AC=window.AudioContext||window.webkitAudioContext; if(!AC) return;
7020
7023
  audioCtx=audioCtx||new AC(); if(audioCtx.state==='suspended') audioCtx.resume().catch(function(){});
7021
7024
  var ms=track.mediaStreamTrack; if(!ms) return;
7022
- var src=audioCtx.createMediaStreamSource(new MediaStream([ms]));
7023
- var an=audioCtx.createAnalyser(); an.fftSize=256; src.connect(an); micAnalyser=an;
7025
+ if(micMonitorSource)try{micMonitorSource.disconnect();}catch(e){}
7026
+ var src=audioCtx.createMediaStreamSource(new MediaStream([ms]));
7027
+ var an=audioCtx.createAnalyser(); an.fftSize=256; src.connect(an); micAnalyser=an;
7028
+ var gain=audioCtx.createGain();gain.gain.value=micMonitorAudible?micMonitorVolume:0;src.connect(gain);gain.connect(audioCtx.destination);micMonitorSource=src;micMonitorGain=gain;
7024
7029
  }catch(e){}
7025
7030
  }
7026
7031
  function previewCam(n){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "infinicode",
3
- "version": "2.8.82",
3
+ "version": "2.8.83",
4
4
  "description": "OpenKernel — provider-agnostic AI execution kernel. Native coding agent + mission-driven execution runtime.",
5
5
  "type": "module",
6
6
  "main": "./dist/kernel/index.js",