From a88930ec4a04d0b4930709866a18076e48e5544c Mon Sep 17 00:00:00 2001 From: teahubxyz Date: Thu, 22 Oct 2026 20:00:44 +0000 Subject: [PATCH] mcp station: keep listener requests in the model context alongside the play log Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014mBuCaQSgWwqhtzsmTBQuM --- mcp/worker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mcp/worker.js b/mcp/worker.js index 715a320..7af10b7 100644 --- a/mcp/worker.js +++ b/mcp/worker.js @@ -317,7 +317,7 @@ const notes=[]; async function cookNext(){const s=await tool('dj_next',{station,history:hist,requests:notes},60000);s.voice=s.voice||(cur&&cur.s.voice);$('q').textContent='up next: '+s.title;fit();return cook(s)} function pauseAll(){if(cur){cur.song.pause();cur.voice&&cur.voice.pause()}$('pp').textContent='Play'} async function context(){const lines=hist.map((h,i)=>(i+1)+'. "'+h.title+'" ('+h.bpm+' bpm, '+h.key+'): '+(h.reaction||'played')); -try{await rpc('ui/update-model-context',{content:[{type:'text',text:'[gandora] station "'+station+'" play log, oldest first:\\n'+lines.join('\\n')}],structuredContent:{station,history:hist}})}catch(e){log('context: '+e.message)}} +try{await rpc('ui/update-model-context',{content:[{type:'text',text:'[gandora] station "'+station+'" play log, oldest first:\\n'+lines.join('\\n')+(notes.length?'\\nlistener requests to the DJ: '+notes.join(' | '):'')}],structuredContent:{station,history:hist,requests:notes}})}catch(e){log('context: '+e.message)}} function mark(r){const h=hist[hist.length-1];if(h){h.reaction=r;context()}} async function air(t){pauseAll();cur=t;show(t.s);hist.push({title:t.s.title,tags:t.s.tags,bpm:t.s.bpm,key:t.s.key});count++;context(); t.song.ontimeupdate=()=>{$('pos').style.width=(100*t.song.currentTime/(t.song.duration||1))+'%'}; @@ -332,7 +332,7 @@ if(!live.paused){live.pause();$('pp').textContent='Play'}else{live.play();$('pp' ['🔥','💜','🕺','🌙','😴','🥱'].forEach(e=>{const b=document.createElement('button');b.textContent=e;b.title='react';b.onclick=()=>{const h=hist[hist.length-1];if(!h)return;h.reaction=((h.reaction&&h.reaction!=='played through')?h.reaction+' ':'')+e;context();b.classList.add('on');status('reacted '+e)};$('emo').appendChild(b)}); $('djf').onsubmit=ev=>{ev.preventDefault();const v=$('dji').value.trim();if(!v)return;notes.push(v);$('dji').value='';status('DJ heard: '+v); if(count{log('next: '+e.message);nextP=null})} -try{rpc('ui/update-model-context',{content:[{type:'text',text:'[gandora] station "'+station+'" listener requests to the DJ, oldest first:\\n- '+notes.join('\\n- ')}]})}catch(e){}}; +context()}; $('up').onclick=()=>{mark('liked');$('up').textContent='Liked';$('up').classList.add('on')}; $('down').onclick=()=>{mark('disliked, skipped');pauseAll();advance()}; $('next').onclick=()=>{mark('skipped');pauseAll();advance()};