appoiint 4.6.1 → 4.7.0
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/commands/meeting.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const{getFlag:getFlag}=require("../config"),fmt=require("../format"),{MeetingSession:MeetingSession}=require("../meetingSession");async function join(e,t,o,n){const
|
|
1
|
+
const{getFlag:getFlag}=require("../config"),fmt=require("../format"),{MeetingSession:MeetingSession}=require("../meetingSession");async function join(e,t,o,n){const a=t[0];a||(fmt.err('Usage: apo join ROOM_ID [--name N] [--role R] [--say "msg"]'),process.exit(1));const s=getFlag(t,"name")||"Claude Code",i=getFlag(t,"role")||"assistant",r=getFlag(t,"say"),l=getFlag(t,"voice"),c=new MeetingSession({baseUrl:n.baseUrl,roomId:a,agentName:s,agentRole:i,onHearingChange:e=>{o||r||(e.active?console.log(fmt.dim(` 🎙 hearing via ${e.transcriber}`)):console.log(fmt.dim(" 🔇 deaf: no human transcriber in room (agent cannot hear speech; chat still works)")))}});async function g(t){if(c.sendChat(t),l&&e)try{const o=await e.synthesize({text:t,voice:l,agentRole:l});o&&o.audio&&(c.sendAudio({audio:o.audio,format:o.format}),await new Promise(e=>setTimeout(e,800)))}catch(e){o||fmt.err(`Voice synth failed (text sent): ${e.message}`)}}let m;try{m=await c.join()}catch(e){fmt.err(`Join failed: ${e.message}`),process.exit(1)}if(o&&r)return await g(r),c.leave(),console.log(JSON.stringify({...m,sent:{text:r,voice:l||null}},null,2));if(o||(fmt.ok(`Joined ${a} as ${fmt.bold(s)} (${i})`),m.peerCount?console.log(fmt.dim(` ${m.peerCount} participant(s): ${m.peers.map(e=>e.name).join(", ")}`)):m.note&&console.log(fmt.dim(` ${m.note}`))),r)return await g(r),o||fmt.info(`Sent: "${r}"${l?` (voice: ${l})`:""}`),void c.leave();if(o)return c.leave(),console.log(JSON.stringify(m,null,2));console.log(fmt.dim(" Listening for transcript + chat. Press Ctrl-C to leave.\n"));const f=setInterval(()=>{c.getTranscripts().forEach(e=>console.log(`${fmt.bold(e.speaker||"?")}: ${e.text}`)),c.getChats().forEach(e=>console.log(`${fmt.green("💬 "+(e.from||"?"))}: ${e.message}`))},1500),d=()=>{clearInterval(f),c.leave(),fmt.ok(`Left ${a}`),process.exit(0)};process.on("SIGINT",d),process.on("SIGTERM",d),await new Promise(()=>{})}module.exports={join:join};
|
package/dist/meetingSession.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let io;try{io=require("socket.io-client")}catch{io=null}class MeetingSession{constructor(e){this.baseUrl=e.baseUrl,this.roomId=e.roomId,this.agentName=e.agentName||"Claude Code",this.agentRole=e.agentRole||"assistant",this.agentId=e.agentId||`claude-${Date.now()}`,this.socket=null,this.connected=!1,this.transcriptBuffer=[],this.chatBuffer=[],this.peers=[]}async join(){if(!io)throw new Error("socket.io-client not installed. Run: npm install -g appoiint");return new Promise((e,t)=>{this.socket=io(this.baseUrl,{transports:["websocket"],reconnection:!0,reconnectionDelay:2e3,reconnectionAttempts:5}),this.socket.on("connect",()=>{this.socket.emit("join",{channel:this.roomId,peer_name:this.agentName,peer_uuid:this.agentId,peer_type:"agent",peer_agent_id:this.agentId,peer_agent_role:this.agentRole,peer_video:!1,peer_audio:!1,peer_video_status:!1,peer_audio_status:!1,peer_screen_status:!1,peer_hand_status:!1,peer_rec_status:!1,peer_privacy_status:!1,peer_info:{osName:"Node.js",osVersion:process.version,browserName:"appoiint-mcp",browserVersion:require("../package.json").version}})}),this.socket.on("addPeer",t=>{this.connected||(this.connected=!0,this.peers=t.peers?Object.values(t.peers).map(e=>({name:e.peer_name,type:e.peer_type||"human",role:e.peer_agent_role||null})):[],e({roomId:this.roomId,connected:!0,peers:this.peers,peerCount:this.peers.length}))}),this.socket.on("connect",()=>{setTimeout(()=>{this.connected||(this.connected=!0,e({roomId:this.roomId,connected:!0,peers:[],peerCount:0,note:"Joined empty room. Waiting for other participants."}))},2e3)}),this.socket.on("transcript",e=>{this.transcriptBuffer.push({speaker:e.peer_name,text:e.text,timestamp:e.timestamp||Date.now()})}),this.socket.on("agentChat",e=>{this.chatBuffer.push({from:e.peer_name,role:e.peer_agent_role,message:e.msg,timestamp:e.timestamp||Date.now()})}),this.socket.on("removePeer",()=>{}),this.socket.on("disconnect",e=>{this.connected=!1}),this.socket.on("connect_error",e=>{t(new Error(`Connection failed: ${e.message}`))}),this._joinTimer=setTimeout(()=>{!this.connected&&this.socket&&(this.socket.disconnect(),t(new Error("Meeting join timeout (10s)")))},1e4)})}getTranscripts(e=!0){const t=[...this.transcriptBuffer];return e&&(this.transcriptBuffer=[]),t}getChats(e=!0){const t=[...this.chatBuffer];return e&&(this.chatBuffer=[]),t}sendChat(e){if(!this.socket||!this.connected)throw new Error("Not connected to meeting");return this.socket.emit("agentChat",{peer_name:this.agentName,peer_agent_role:this.agentRole,msg:e}),{sent:!0,roomId:this.roomId}}sendAudio({audio:e,format:t}={}){if(!this.socket||!this.connected)throw new Error("Not connected to meeting");if(!e)throw new Error("No audio to send");return this.socket.emit("agentAudio",{peer_name:this.agentName,peer_agent_role:this.agentRole,audio:e,format:t||"audio/wav"}),{sent:!0,roomId:this.roomId,bytes:e.length}}leave(){return this._joinTimer&&(clearTimeout(this._joinTimer),this._joinTimer=null),this.socket&&(this.socket.disconnect(),this.socket=null,this.connected=!1),{roomId:this.roomId,left:!0}}status(){return{roomId:this.roomId,connected:this.connected,agentName:this.agentName,agentRole:this.agentRole,peerCount:this.peers.length,transcriptCount:this.transcriptBuffer.length,chatCount:this.chatBuffer.length}}}module.exports={MeetingSession:MeetingSession};
|
|
1
|
+
let io;try{io=require("socket.io-client")}catch{io=null}class MeetingSession{constructor(e){this.baseUrl=e.baseUrl,this.roomId=e.roomId,this.agentName=e.agentName||"Claude Code",this.agentRole=e.agentRole||"assistant",this.agentId=e.agentId||`claude-${Date.now()}`,this.socket=null,this.connected=!1,this.transcriptBuffer=[],this.chatBuffer=[],this.peers=[],this.hearing=null,this.onHearingChange=e.onHearingChange||null}async join(){if(!io)throw new Error("socket.io-client not installed. Run: npm install -g appoiint");return new Promise((e,t)=>{this.socket=io(this.baseUrl,{transports:["websocket"],reconnection:!0,reconnectionDelay:2e3,reconnectionAttempts:5}),this.socket.on("connect",()=>{this.socket.emit("join",{channel:this.roomId,peer_name:this.agentName,peer_uuid:this.agentId,peer_type:"agent",peer_agent_id:this.agentId,peer_agent_role:this.agentRole,peer_video:!1,peer_audio:!1,peer_video_status:!1,peer_audio_status:!1,peer_screen_status:!1,peer_hand_status:!1,peer_rec_status:!1,peer_privacy_status:!1,peer_info:{osName:"Node.js",osVersion:process.version,browserName:"appoiint-mcp",browserVersion:require("../package.json").version}})}),this.socket.on("addPeer",t=>{this.connected||(this.connected=!0,this.peers=t.peers?Object.values(t.peers).map(e=>({name:e.peer_name,type:e.peer_type||"human",role:e.peer_agent_role||null})):[],e({roomId:this.roomId,connected:!0,peers:this.peers,peerCount:this.peers.length}))}),this.socket.on("connect",()=>{setTimeout(()=>{this.connected||(this.connected=!0,e({roomId:this.roomId,connected:!0,peers:[],peerCount:0,note:"Joined empty room. Waiting for other participants."}))},2e3)}),this.socket.on("transcript",e=>{this.transcriptBuffer.push({speaker:e.peer_name,speakerId:e.speaker_id||null,confidence:"number"==typeof e.confidence?e.confidence:null,text:e.text,timestamp:e.timestamp||Date.now()})}),this.socket.on("transcriberStatus",e=>{const t=this.hearing;if(this.hearing={active:!!e.active,transcriber:e.transcriber||null,timestamp:e.timestamp||Date.now()},this.onHearingChange&&(!t||t.active!==this.hearing.active))try{this.onHearingChange(this.hearing)}catch{}}),this.socket.on("agentChat",e=>{this.chatBuffer.push({from:e.peer_name,role:e.peer_agent_role,message:e.msg,timestamp:e.timestamp||Date.now()})}),this.socket.on("removePeer",()=>{}),this.socket.on("disconnect",e=>{this.connected=!1}),this.socket.on("connect_error",e=>{t(new Error(`Connection failed: ${e.message}`))}),this._joinTimer=setTimeout(()=>{!this.connected&&this.socket&&(this.socket.disconnect(),t(new Error("Meeting join timeout (10s)")))},1e4)})}getTranscripts(e=!0){const t=[...this.transcriptBuffer];return e&&(this.transcriptBuffer=[]),t}getChats(e=!0){const t=[...this.chatBuffer];return e&&(this.chatBuffer=[]),t}sendChat(e){if(!this.socket||!this.connected)throw new Error("Not connected to meeting");return this.socket.emit("agentChat",{peer_name:this.agentName,peer_agent_role:this.agentRole,msg:e}),{sent:!0,roomId:this.roomId}}sendAudio({audio:e,format:t}={}){if(!this.socket||!this.connected)throw new Error("Not connected to meeting");if(!e)throw new Error("No audio to send");return this.socket.emit("agentAudio",{peer_name:this.agentName,peer_agent_role:this.agentRole,audio:e,format:t||"audio/wav"}),{sent:!0,roomId:this.roomId,bytes:e.length}}leave(){return this._joinTimer&&(clearTimeout(this._joinTimer),this._joinTimer=null),this.socket&&(this.socket.disconnect(),this.socket=null,this.connected=!1),{roomId:this.roomId,left:!0}}status(){return{roomId:this.roomId,connected:this.connected,agentName:this.agentName,agentRole:this.agentRole,peerCount:this.peers.length,transcriptCount:this.transcriptBuffer.length,chatCount:this.chatBuffer.length,hearing:this.hearing?this.hearing.active:null,transcriber:this.hearing?this.hearing.transcriber:null}}}module.exports={MeetingSession:MeetingSession};
|