appoiint 4.4.0 → 4.4.1
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/meetingSession.js +1 -1
- package/package.json +1 -1
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}`))}),setTimeout(()=>{this.connected
|
|
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};
|