appoiint 4.14.1 → 4.16.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/api.js CHANGED
@@ -1 +1 @@
1
- const https=require("https"),http=require("http"),BASE="/saas/api/v1/sdk";function request(e,t,n,a,s){return new Promise((o,i)=>{const r=new URL(a,e),p="https:"===r.protocol,m=p?https:http,u={"Content-Type":"application/json"};t&&(u.Authorization=`Bearer ${t}`);const c=s?JSON.stringify(s):null;c&&(u["Content-Length"]=Buffer.byteLength(c));const d=m.request({hostname:r.hostname,port:r.port||(p?443:80),path:r.pathname+r.search,method:n,headers:u,timeout:3e4},e=>{let t="";e.on("data",e=>t+=e),e.on("end",()=>{try{const n=JSON.parse(t);e.statusCode>=400?i(new Error(n.message||n.error||`HTTP ${e.statusCode}`)):o(n.data||n)}catch{e.statusCode>=400?i(new Error(`HTTP ${e.statusCode}: ${t.slice(0,200)}`)):o(t)}})});d.on("error",i),d.on("timeout",()=>{d.destroy(),i(new Error("Request timeout (30s)"))}),c&&d.write(c),d.end()})}function api(e){const{baseUrl:t,apiKey:n}=e,a=(e,a,s)=>request(t,n,e,a,s);return{signup:e=>request(t,"","POST",`${BASE}/tai/agent/signup`,e),signin:e=>request(t,"","POST",`${BASE}/auth/signin`,e),activate:e=>request(t,"","POST",`${BASE}/tai/agent/activate`,e),createRoom:e=>a("POST",`${BASE}/tai/agent/rooms`,e),listRooms:()=>a("GET",`${BASE}/tai/agent/rooms`),roomStatus:e=>a("GET",`${BASE}/tai/agent/rooms/${e}`),endRoom:e=>a("DELETE",`${BASE}/tai/agent/rooms/${e}`),invite:(e,t)=>a("POST",`${BASE}/tai/agent/rooms/${e}/invite`,t),transcript:(e,t)=>a("GET",`${BASE}/tai/agent/rooms/${e}/transcript?format=${t||"json"}`),joinMeeting:e=>a("POST",`${BASE}/tai/agent/meeting/join`,e),leaveMeeting:e=>a("POST",`${BASE}/tai/agent/meeting/leave`,e),events:()=>a("GET",e.userId?`${BASE}/scheduling/event-types/by-user/${e.userId}`:`${BASE}/scheduling/event-types/public`),slots:(e,t,n)=>a("GET",`${BASE}/availability/slots/publicinverse?email=${e}&date=${t}&timezone=${n||"UTC"}`),book:e=>a("POST",`${BASE}/scheduling/bookings`,e),createEvent:e=>a("POST",`${BASE}/eventtypes`,e),updateEvent:(e,t)=>a("PUT",`${BASE}/eventtypes/${encodeURIComponent(e)}`,t),deleteEvent:(e,t)=>a("DELETE",`${BASE}/eventtypes/${encodeURIComponent(e)}${t?"?softDelete=true":""}`),availabilityGet:e=>a("GET",`${BASE}/availability/${encodeURIComponent(e)}`),availabilityUpdate:(e,t)=>a("PUT",`${BASE}/availability/${encodeURIComponent(e)}`,t),availabilityCreate:(e,t)=>a("POST",`${BASE}/availability/users/${encodeURIComponent(e)}`,t),bookingsByHost:e=>a("GET",`${BASE}/scheduling/bookings/by-host/${e}`),getBooking:e=>a("GET",`${BASE}/scheduling/bookings/${e}`),cancelBooking:(e,t)=>a("POST",`${BASE}/scheduling/bookings/${e}/cancel`,t),rescheduleBooking:(e,t)=>a("POST",`${BASE}/scheduling/bookings/${e}/reschedule`,t),domains:()=>a("GET",`${BASE}/domains${e.userId?`?tenantId=${e.userId}&tenantType=user`:""}`),domainRegister:e=>a("POST",`${BASE}/domains`,e),domainGet:e=>a("GET",`${BASE}/domains/${encodeURIComponent(e)}`),domainDelete:e=>a("DELETE",`${BASE}/domains/${encodeURIComponent(e)}`),domainVerify:e=>a("POST",`${BASE}/domains/${encodeURIComponent(e)}/verify`),domainActivate:e=>a("PUT",`${BASE}/domains/${encodeURIComponent(e)}`,{status:"active"}),domainDnsStatus:e=>a("GET",`${BASE}/domains/${encodeURIComponent(e)}/dns-status`),domainResolve:e=>a("GET",`${BASE}/domains/resolve?hostname=${encodeURIComponent(e)}`),profileGet:()=>a("GET",`${BASE}/auth/user-profile`),profileBySlug:e=>request(t,"","GET",`/card/api/profile/${encodeURIComponent(e)}`),profileUpdate:e=>a("PUT",`${BASE}/auth/user-profile`,e),uploadImage:({userId:a,type:s,buffer:o,filename:i,mime:r})=>uploadProfileImage({baseUrl:t,token:n,userId:a||e.userId,type:s,buffer:o,filename:i,mime:r}),synthesize:e=>a("POST",`${BASE}/tts/synthesize`,e),voices:()=>a("GET",`${BASE}/tts/voices`),status:()=>request(t,"","GET",`${BASE.replace("/sdk","/public")}/tai/status`),sttStatus:()=>a("GET",`${BASE}/stt/status`),adminUsers:()=>a("GET","/superadmin/api/users"),adminUserCreate:e=>a("POST","/superadmin/api/users",e),adminUserReset:(e,t)=>a("POST","/superadmin/api/users/reset-password",{email:e,...t}),adminUserDelete:e=>a("DELETE",`/superadmin/api/users/${encodeURIComponent(e)}`),adminTenants:()=>a("GET","/superadmin/api/tenants"),adminTenantView:e=>a("GET",`/superadmin/api/tenants/${e}`),adminTenantCreate:e=>a("POST","/superadmin/api/tenants",e),adminTenantPlan:(e,t)=>a("POST",`/superadmin/api/tenants/${e}/plan`,{plan:t}),adminTenantVerify:e=>a("POST",`/superadmin/api/tenants/${e}/verify`),adminTenantSuspend:e=>a("POST",`/superadmin/api/tenants/${e}/suspend`),adminTenantActivate:e=>a("POST",`/superadmin/api/tenants/${e}/activate`),adminTenantDelete:e=>a("DELETE",`/superadmin/api/tenants/${e}`),adminBilling:()=>a("GET","/superadmin/api/revenue"),adminDiscount:e=>a("POST","/superadmin/api/discount",e),platformStats:()=>a("GET","/superadmin/api/stats"),funnel:()=>a("GET","/superadmin/api/funnel"),signups:e=>a("GET","/superadmin/api/signups"+(e?"?days="+e:"")),revenue:()=>a("GET","/superadmin/api/revenue"),tickets:e=>a("GET","/superadmin/api/tickets"+(e?"?status="+e:"")),ticketShow:e=>a("GET",`/superadmin/api/tickets/${e}`),ticketReply:(e,t)=>a("POST",`/superadmin/api/tickets/${e}/reply`,{message:t}),ticketClose:e=>a("POST",`/superadmin/api/tickets/${e}/close`),audit:e=>a("GET","/superadmin/api/audit"+(e?"?"+e:"")),auditExport:e=>a("GET",`/superadmin/api/audit/export?format=${e||"json"}`),notifications:e=>a("GET","/superadmin/api/notifications"+(e?"?since="+e:"")),costs:()=>a("GET",`${BASE}/costs`),costsByRoom:e=>a("GET",`${BASE}/costs/${e}`),costsPricing:()=>a("GET",`${BASE}/costs/pricing`),costsModels:()=>a("GET",`${BASE}/costs/models`),costsUsers:()=>a("GET",`${BASE}/costs/users`),costsTimeseries:e=>a("GET",`${BASE}/costs/timeseries${e?"?bucket="+e:""}`),agentCreate:e=>a("POST",`${BASE}/tai/agent/create`,e),agentList:()=>a("GET",`${BASE}/tai/agent/list`),agentRevoke:e=>a("DELETE",`${BASE}/tai/agent/${encodeURIComponent(e)}`),channelSend:e=>a("POST",`${BASE}/channels/send`,e),channelInbox:()=>a("GET",`${BASE}/channels/inbox`),channelHistory:(e,t)=>a("GET",`${BASE}/channels/history/${e}${t?"?limit="+t:""}`),channelAck:e=>a("POST",`${BASE}/channels/ack/${e}`),channelAgents:()=>a("GET",`${BASE}/channels/agents`),wall:()=>a("GET",`${BASE}/channels/wall`),notificationsDigest:()=>a("GET",`${BASE}/channels/notifications`),groupCreate:(e,t)=>a("POST",`${BASE}/channels/channel/create`,{name:e,topic:t}),groupJoin:e=>a("POST",`${BASE}/channels/channel/join`,{name:e}),groupLeave:e=>a("POST",`${BASE}/channels/channel/leave`,{name:e}),groupList:()=>a("GET",`${BASE}/channels/channel/list`),groupSend:(e,t)=>a("POST",`${BASE}/channels/channel/${encodeURIComponent(e)}/send`,t),groupHistory:(e,t)=>a("GET",`${BASE}/channels/channel/${encodeURIComponent(e)}/history${t?"?limit="+t:""}`)}}function streamChannels(e,t){const n=new URL(`${BASE}/channels/stream`,e.baseUrl),a="https:"===n.protocol,s=(a?https:http).request({hostname:n.hostname,port:n.port||(a?443:80),path:n.pathname,method:"GET",headers:{Authorization:`Bearer ${e.apiKey}`,Accept:"text/event-stream"}},e=>{if(e.statusCode>=400)return void t("error",{status:e.statusCode});let n="";e.setEncoding("utf8"),e.on("data",e=>{let a;for(n+=e;-1!==(a=n.indexOf("\n\n"));){const e=n.slice(0,a);n=n.slice(a+2);let s="message",o="";for(const t of e.split("\n"))t.startsWith("event: ")?s=t.slice(7).trim():t.startsWith("data: ")&&(o+=t.slice(6));if(o)try{t(s,JSON.parse(o))}catch{t(s,{raw:o})}}}),e.on("end",()=>t("end",{}))});return s.on("error",e=>t("error",{message:e.message})),s.end(),s}function rawApi(e){return(t,n,a)=>request(e.baseUrl,e.apiKey,t,n,a)}function fetchBytes(e,t=0){return new Promise((n,a)=>{if(t>5)return a(new Error("Too many redirects fetching image"));const s=new URL(e),o=("https:"===s.protocol?https:http).get({hostname:s.hostname,port:s.port||("https:"===s.protocol?443:80),path:s.pathname+s.search,headers:{"User-Agent":"apo-cli/image-fetch"},timeout:3e4},s=>{if(s.statusCode>=300&&s.statusCode<400&&s.headers.location)return s.resume(),n(fetchBytes(new URL(s.headers.location,e).href,t+1));if(s.statusCode>=400)return s.resume(),a(new Error(`HTTP ${s.statusCode} fetching image`));const o=[];s.on("data",e=>o.push(e)),s.on("end",()=>n({buffer:Buffer.concat(o),mime:s.headers["content-type"]||"application/octet-stream"}))});o.on("error",a),o.on("timeout",()=>{o.destroy(),a(new Error("Timeout fetching image"))})})}async function resolveImageSource(e){if(/^https?:\/\//i.test(e)){const{buffer:t,mime:n}=await fetchBytes(e),a=new URL(e).pathname.split("/").pop()||"image";return{buffer:t,mime:n,filename:a.includes(".")?a:`${a}.jpg`}}const t=require("fs"),n=require("path");return{buffer:t.readFileSync(e),mime:{".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".svg":"image/svg+xml"}[n.extname(e).toLowerCase()]||"application/octet-stream",filename:n.basename(e)}}function uploadProfileImage({baseUrl:e,token:t,userId:n,type:a,buffer:s,filename:o,mime:i}){return new Promise((r,p)=>{const m="----apoCLI"+Date.now().toString(16)+Math.random().toString(16).slice(2),u=Buffer.from(`--${m}\r\nContent-Disposition: form-data; name="avatar"; filename="${o}"\r\nContent-Type: ${i}\r\n\r\n`),c=Buffer.from(`\r\n--${m}--\r\n`),d=Buffer.concat([u,s,c]),l=`${BASE}/userProfileAvatar/upload-profile-image?userId=${encodeURIComponent(n)}&type=${encodeURIComponent(a||"cover")}`,E=new URL(l,e),$="https:"===E.protocol,h=($?https:http).request({hostname:E.hostname,port:E.port||($?443:80),path:E.pathname+E.search,method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":`multipart/form-data; boundary=${m}`,"Content-Length":d.length},timeout:6e4},e=>{let t="";e.on("data",e=>t+=e),e.on("end",()=>{let n;try{n=JSON.parse(t)}catch{n={raw:t}}e.statusCode>=400?p(new Error(n.message||n.error||`HTTP ${e.statusCode}: ${t.slice(0,200)}`)):r(n)})});h.on("error",p),h.on("timeout",()=>{h.destroy(),p(new Error("Upload timeout (60s)"))}),h.write(d),h.end()})}function deleteProfileImage({baseUrl:e,token:t,userId:n,type:a}){return request(e,t,"DELETE",`${BASE}/userProfileAvatar/upload-profile-image?userId=${encodeURIComponent(n)}&type=${encodeURIComponent(a||"cover")}`)}module.exports={api:api,request:request,rawApi:rawApi,streamChannels:streamChannels,resolveImageSource:resolveImageSource,uploadProfileImage:uploadProfileImage,deleteProfileImage:deleteProfileImage};
1
+ const https=require("https"),http=require("http"),BASE="/saas/api/v1/sdk";function request(e,t,n,a,s){return new Promise((o,i)=>{const r=new URL(a,e),m="https:"===r.protocol,p=m?https:http,u={"Content-Type":"application/json"};t&&(u.Authorization=`Bearer ${t}`);const c=s?JSON.stringify(s):null;c&&(u["Content-Length"]=Buffer.byteLength(c));const d=p.request({hostname:r.hostname,port:r.port||(m?443:80),path:r.pathname+r.search,method:n,headers:u,timeout:3e4},e=>{let t="";e.on("data",e=>t+=e),e.on("end",()=>{try{const n=JSON.parse(t);e.statusCode>=400?i(new Error(n.message||n.error||`HTTP ${e.statusCode}`)):o(n.data||n)}catch{e.statusCode>=400?i(new Error(`HTTP ${e.statusCode}: ${t.slice(0,200)}`)):o(t)}})});d.on("error",i),d.on("timeout",()=>{d.destroy(),i(new Error("Request timeout (30s)"))}),c&&d.write(c),d.end()})}function api(e){const{baseUrl:t,apiKey:n}=e,a=(e,a,s)=>request(t,n,e,a,s);return{signup:e=>request(t,"","POST",`${BASE}/tai/agent/signup`,e),signin:e=>request(t,"","POST",`${BASE}/auth/signin`,e),activate:e=>request(t,"","POST",`${BASE}/tai/agent/activate`,e),createRoom:e=>a("POST",`${BASE}/tai/agent/rooms`,e),listRooms:()=>a("GET",`${BASE}/tai/agent/rooms`),roomStatus:e=>a("GET",`${BASE}/tai/agent/rooms/${e}`),endRoom:e=>a("DELETE",`${BASE}/tai/agent/rooms/${e}`),invite:(e,t)=>a("POST",`${BASE}/tai/agent/rooms/${e}/invite`,t),transcript:(e,t)=>a("GET",`${BASE}/tai/agent/rooms/${e}/transcript?format=${t||"json"}`),joinMeeting:e=>a("POST",`${BASE}/tai/agent/meeting/join`,e),leaveMeeting:e=>a("POST",`${BASE}/tai/agent/meeting/leave`,e),summaryStatus:()=>a("GET",`${BASE}/notetaker/summary/status`),summarizeNotes:e=>a("POST",`${BASE}/notetaker/summary/generate`,e),summarizeMeeting:(t,n)=>a("POST",`${BASE}/notetaker/summary/${encodeURIComponent(t)}?userId=${encodeURIComponent(e.userId||"")}`,{options:n||{}}),getSummary:t=>a("GET",`${BASE}/notetaker/summary/${encodeURIComponent(t)}?userId=${encodeURIComponent(e.userId||"")}`),deleteSummary:t=>a("DELETE",`${BASE}/notetaker/summary/${encodeURIComponent(t)}?userId=${encodeURIComponent(e.userId||"")}`),askTranscript:e=>a("POST",`${BASE}/notetaker/chat/quick`,e),meetingTranscript:(e,t)=>a("GET",`${BASE}/meetings/${encodeURIComponent(e)}/otter/transcript${t?"?limit="+t:""}`),meetingActionItems:e=>a("GET",`${BASE}/meetings/${encodeURIComponent(e)}/otter/action-items`),meetingHighlights:e=>a("GET",`${BASE}/meetings/${encodeURIComponent(e)}/otter/highlights`),meetingNotesStatus:e=>a("GET",`${BASE}/meetings/${encodeURIComponent(e)}/otter/status`),meetingSearch:(e,t)=>a("GET",`${BASE}/meetings/${encodeURIComponent(e)}/otter/search?q=${encodeURIComponent(t)}`),meetingExport:(e,t)=>a("GET",`${BASE}/meetings/${encodeURIComponent(e)}/otter/export?format=${t||"md"}`),events:()=>a("GET",e.userId?`${BASE}/scheduling/event-types/by-user/${e.userId}`:`${BASE}/scheduling/event-types/public`),slots:(e,t,n)=>a("GET",`${BASE}/availability/slots/publicinverse?email=${e}&date=${t}&timezone=${n||"UTC"}`),book:e=>a("POST",`${BASE}/scheduling/bookings`,e),createEvent:e=>a("POST",`${BASE}/eventtypes`,e),updateEvent:(e,t)=>a("PUT",`${BASE}/eventtypes/${encodeURIComponent(e)}`,t),deleteEvent:(e,t)=>a("DELETE",`${BASE}/eventtypes/${encodeURIComponent(e)}${t?"?softDelete=true":""}`),availabilityGet:e=>a("GET",`${BASE}/availability/${encodeURIComponent(e)}`),availabilityUpdate:(e,t)=>a("PUT",`${BASE}/availability/${encodeURIComponent(e)}`,t),availabilityCreate:(e,t)=>a("POST",`${BASE}/availability/users/${encodeURIComponent(e)}`,t),bookingsByHost:e=>a("GET",`${BASE}/scheduling/bookings/by-host/${e}`),getBooking:e=>a("GET",`${BASE}/scheduling/bookings/${e}`),cancelBooking:(e,t)=>a("POST",`${BASE}/scheduling/bookings/${e}/cancel`,t),rescheduleBooking:(e,t)=>a("POST",`${BASE}/scheduling/bookings/${e}/reschedule`,t),domains:()=>a("GET",`${BASE}/domains${e.userId?`?tenantId=${e.userId}&tenantType=user`:""}`),domainRegister:e=>a("POST",`${BASE}/domains`,e),domainGet:e=>a("GET",`${BASE}/domains/${encodeURIComponent(e)}`),domainDelete:e=>a("DELETE",`${BASE}/domains/${encodeURIComponent(e)}`),domainVerify:e=>a("POST",`${BASE}/domains/${encodeURIComponent(e)}/verify`),domainActivate:e=>a("PUT",`${BASE}/domains/${encodeURIComponent(e)}`,{status:"active"}),domainDnsStatus:e=>a("GET",`${BASE}/domains/${encodeURIComponent(e)}/dns-status`),domainResolve:e=>a("GET",`${BASE}/domains/resolve?hostname=${encodeURIComponent(e)}`),profileGet:()=>a("GET",`${BASE}/auth/user-profile`),profileBySlug:e=>request(t,"","GET",`/card/api/profile/${encodeURIComponent(e)}`),profileUpdate:e=>a("PUT",`${BASE}/auth/user-profile`,e),uploadImage:({userId:a,type:s,buffer:o,filename:i,mime:r})=>uploadProfileImage({baseUrl:t,token:n,userId:a||e.userId,type:s,buffer:o,filename:i,mime:r}),synthesize:e=>a("POST",`${BASE}/tts/synthesize`,e),voices:()=>a("GET",`${BASE}/tts/voices`),status:()=>request(t,"","GET",`${BASE.replace("/sdk","/public")}/tai/status`),sttStatus:()=>a("GET",`${BASE}/stt/status`),adminUsers:()=>a("GET","/superadmin/api/users"),adminUserCreate:e=>a("POST","/superadmin/api/users",e),adminUserReset:(e,t)=>a("POST","/superadmin/api/users/reset-password",{email:e,...t}),adminUserDelete:e=>a("DELETE",`/superadmin/api/users/${encodeURIComponent(e)}`),adminTenants:()=>a("GET","/superadmin/api/tenants"),adminTenantView:e=>a("GET",`/superadmin/api/tenants/${e}`),adminTenantCreate:e=>a("POST","/superadmin/api/tenants",e),adminTenantPlan:(e,t)=>a("POST",`/superadmin/api/tenants/${e}/plan`,{plan:t}),adminTenantVerify:e=>a("POST",`/superadmin/api/tenants/${e}/verify`),adminTenantSuspend:e=>a("POST",`/superadmin/api/tenants/${e}/suspend`),adminTenantActivate:e=>a("POST",`/superadmin/api/tenants/${e}/activate`),adminTenantDelete:e=>a("DELETE",`/superadmin/api/tenants/${e}`),adminBilling:()=>a("GET","/superadmin/api/revenue"),adminDiscount:e=>a("POST","/superadmin/api/discount",e),platformStats:()=>a("GET","/superadmin/api/stats"),funnel:()=>a("GET","/superadmin/api/funnel"),signups:e=>a("GET","/superadmin/api/signups"+(e?"?days="+e:"")),revenue:()=>a("GET","/superadmin/api/revenue"),tickets:e=>a("GET","/superadmin/api/tickets"+(e?"?status="+e:"")),ticketShow:e=>a("GET",`/superadmin/api/tickets/${e}`),ticketReply:(e,t)=>a("POST",`/superadmin/api/tickets/${e}/reply`,{message:t}),ticketClose:e=>a("POST",`/superadmin/api/tickets/${e}/close`),audit:e=>a("GET","/superadmin/api/audit"+(e?"?"+e:"")),auditExport:e=>a("GET",`/superadmin/api/audit/export?format=${e||"json"}`),notifications:e=>a("GET","/superadmin/api/notifications"+(e?"?since="+e:"")),costs:()=>a("GET",`${BASE}/costs`),costsByRoom:e=>a("GET",`${BASE}/costs/${e}`),costsPricing:()=>a("GET",`${BASE}/costs/pricing`),costsModels:()=>a("GET",`${BASE}/costs/models`),costsUsers:()=>a("GET",`${BASE}/costs/users`),costsTimeseries:e=>a("GET",`${BASE}/costs/timeseries${e?"?bucket="+e:""}`),agentCreate:e=>a("POST",`${BASE}/tai/agent/create`,e),agentList:()=>a("GET",`${BASE}/tai/agent/list`),agentRevoke:e=>a("DELETE",`${BASE}/tai/agent/${encodeURIComponent(e)}`),channelSend:e=>a("POST",`${BASE}/channels/send`,e),channelInbox:()=>a("GET",`${BASE}/channels/inbox`),channelHistory:(e,t)=>a("GET",`${BASE}/channels/history/${e}${t?"?limit="+t:""}`),channelAck:e=>a("POST",`${BASE}/channels/ack/${e}`),channelAgents:()=>a("GET",`${BASE}/channels/agents`),wall:()=>a("GET",`${BASE}/channels/wall`),notificationsDigest:()=>a("GET",`${BASE}/channels/notifications`),groupCreate:(e,t)=>a("POST",`${BASE}/channels/channel/create`,{name:e,topic:t}),groupJoin:e=>a("POST",`${BASE}/channels/channel/join`,{name:e}),groupLeave:e=>a("POST",`${BASE}/channels/channel/leave`,{name:e}),groupList:()=>a("GET",`${BASE}/channels/channel/list`),groupSend:(e,t)=>a("POST",`${BASE}/channels/channel/${encodeURIComponent(e)}/send`,t),groupHistory:(e,t)=>a("GET",`${BASE}/channels/channel/${encodeURIComponent(e)}/history${t?"?limit="+t:""}`)}}function streamChannels(e,t){const n=new URL(`${BASE}/channels/stream`,e.baseUrl),a="https:"===n.protocol,s=(a?https:http).request({hostname:n.hostname,port:n.port||(a?443:80),path:n.pathname,method:"GET",headers:{Authorization:`Bearer ${e.apiKey}`,Accept:"text/event-stream"}},e=>{if(e.statusCode>=400)return void t("error",{status:e.statusCode});let n="";e.setEncoding("utf8"),e.on("data",e=>{let a;for(n+=e;-1!==(a=n.indexOf("\n\n"));){const e=n.slice(0,a);n=n.slice(a+2);let s="message",o="";for(const t of e.split("\n"))t.startsWith("event: ")?s=t.slice(7).trim():t.startsWith("data: ")&&(o+=t.slice(6));if(o)try{t(s,JSON.parse(o))}catch{t(s,{raw:o})}}}),e.on("end",()=>t("end",{}))});return s.on("error",e=>t("error",{message:e.message})),s.end(),s}function rawApi(e){return(t,n,a)=>request(e.baseUrl,e.apiKey,t,n,a)}function fetchBytes(e,t=0){return new Promise((n,a)=>{if(t>5)return a(new Error("Too many redirects fetching image"));const s=new URL(e),o=("https:"===s.protocol?https:http).get({hostname:s.hostname,port:s.port||("https:"===s.protocol?443:80),path:s.pathname+s.search,headers:{"User-Agent":"apo-cli/image-fetch"},timeout:3e4},s=>{if(s.statusCode>=300&&s.statusCode<400&&s.headers.location)return s.resume(),n(fetchBytes(new URL(s.headers.location,e).href,t+1));if(s.statusCode>=400)return s.resume(),a(new Error(`HTTP ${s.statusCode} fetching image`));const o=[];s.on("data",e=>o.push(e)),s.on("end",()=>n({buffer:Buffer.concat(o),mime:s.headers["content-type"]||"application/octet-stream"}))});o.on("error",a),o.on("timeout",()=>{o.destroy(),a(new Error("Timeout fetching image"))})})}async function resolveImageSource(e){if(/^https?:\/\//i.test(e)){const{buffer:t,mime:n}=await fetchBytes(e),a=new URL(e).pathname.split("/").pop()||"image";return{buffer:t,mime:n,filename:a.includes(".")?a:`${a}.jpg`}}const t=require("fs"),n=require("path");return{buffer:t.readFileSync(e),mime:{".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".svg":"image/svg+xml"}[n.extname(e).toLowerCase()]||"application/octet-stream",filename:n.basename(e)}}function uploadProfileImage({baseUrl:e,token:t,userId:n,type:a,buffer:s,filename:o,mime:i}){return new Promise((r,m)=>{const p="----apoCLI"+Date.now().toString(16)+Math.random().toString(16).slice(2),u=Buffer.from(`--${p}\r\nContent-Disposition: form-data; name="avatar"; filename="${o}"\r\nContent-Type: ${i}\r\n\r\n`),c=Buffer.from(`\r\n--${p}--\r\n`),d=Buffer.concat([u,s,c]),l=`${BASE}/userProfileAvatar/upload-profile-image?userId=${encodeURIComponent(n)}&type=${encodeURIComponent(a||"cover")}`,E=new URL(l,e),$="https:"===E.protocol,S=($?https:http).request({hostname:E.hostname,port:E.port||($?443:80),path:E.pathname+E.search,method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":`multipart/form-data; boundary=${p}`,"Content-Length":d.length},timeout:6e4},e=>{let t="";e.on("data",e=>t+=e),e.on("end",()=>{let n;try{n=JSON.parse(t)}catch{n={raw:t}}e.statusCode>=400?m(new Error(n.message||n.error||`HTTP ${e.statusCode}: ${t.slice(0,200)}`)):r(n)})});S.on("error",m),S.on("timeout",()=>{S.destroy(),m(new Error("Upload timeout (60s)"))}),S.write(d),S.end()})}function deleteProfileImage({baseUrl:e,token:t,userId:n,type:a}){return request(e,t,"DELETE",`${BASE}/userProfileAvatar/upload-profile-image?userId=${encodeURIComponent(n)}&type=${encodeURIComponent(a||"cover")}`)}module.exports={api:api,request:request,rawApi:rawApi,streamChannels:streamChannels,resolveImageSource:resolveImageSource,uploadProfileImage:uploadProfileImage,deleteProfileImage:deleteProfileImage};
package/dist/mcp-tools.js CHANGED
@@ -1 +1 @@
1
- const TOOLS=[{name:"appoiint_status",description:"Get Appoiint platform status and version.",inputSchema:{type:"object",properties:{}},handler:async e=>e.status(),readOnly:!0},{name:"appoiint_create_room",description:"Create a video meeting room. Returns roomId and join URL.",inputSchema:{type:"object",properties:{title:{type:"string",description:'Meeting title (e.g. "Team Standup")'}},required:["title"]},handler:async(e,t)=>{const i=require("./config").loadConfig([]);return e.createRoom({title:t.title,hostId:i.userId})},readOnly:!1},{name:"appoiint_list_rooms",description:"List active meeting rooms.",inputSchema:{type:"object",properties:{}},handler:async e=>e.listRooms(),readOnly:!0},{name:"appoiint_room_status",description:"Get room status and participants.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"}},required:["roomId"]},handler:async(e,t)=>e.roomStatus(t.roomId),readOnly:!0},{name:"appoiint_end_room",description:"End a meeting room.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"}},required:["roomId"]},handler:async(e,t)=>e.endRoom(t.roomId),readOnly:!1},{name:"appoiint_invite",description:"Invite a human or agent to a meeting room.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"},email:{type:"string",description:"Invitee email"},name:{type:"string",description:"Invitee name"},type:{type:"string",description:"human or agent (default: human)"}},required:["roomId","email"]},handler:async(e,t)=>e.invite(t.roomId,{email:t.email,name:t.name||"Guest",type:t.type||"human"}),readOnly:!1},{name:"appoiint_transcript",description:"Get meeting transcript.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"},format:{type:"string",description:"json, text, or srt (default: json)"}},required:["roomId"]},handler:async(e,t)=>e.transcript(t.roomId,t.format||"json"),readOnly:!0},{name:"appoiint_join_meeting",description:"Join a meeting room as an AI agent. Creates persistent Socket.IO connection. You will hear transcripts and can send chat messages. Call appoiint_get_transcripts to read what was said, appoiint_send_chat to respond.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID to join"},agentName:{type:"string",description:"Your display name in the meeting (default: Claude Code)"},agentRole:{type:"string",description:"Your role badge (default: assistant)"}},required:["roomId"]},handler:async(e,t,i)=>{const{MeetingSession:n}=require("./meetingSession"),a=new n({baseUrl:i.config.baseUrl,roomId:t.roomId,agentName:t.agentName||"Claude Code",agentRole:t.agentRole||"assistant"}),r=await a.join();return i.meetingSessions.set(t.roomId,a),r},readOnly:!1},{name:"appoiint_get_transcripts",description:"Get speech transcripts from the meeting. Returns what participants have said since last read. Buffer is cleared after reading.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"}},required:["roomId"]},handler:async(e,t,i)=>{const n=i.meetingSessions.get(t.roomId);if(!n)return{error:"Not in this meeting. Call appoiint_join_meeting first."};const a=n.getTranscripts();return{roomId:t.roomId,count:a.length,transcripts:a}},readOnly:!0},{name:"appoiint_send_chat",description:"Send a chat message to all meeting participants. Your message appears in the AI chat panel with your role badge.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"},message:{type:"string",description:"Message to send to meeting participants"}},required:["roomId","message"]},handler:async(e,t,i)=>{const n=i.meetingSessions.get(t.roomId);return n?n.sendChat(t.message):{error:"Not in this meeting. Call appoiint_join_meeting first."}},readOnly:!1},{name:"appoiint_meeting_status",description:"Check meeting connection status: connected, peer count, buffered transcript count.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"}},required:["roomId"]},handler:async(e,t,i)=>{const n=i.meetingSessions.get(t.roomId);return n?n.status():{error:"Not in this meeting.",connected:!1}},readOnly:!0},{name:"appoiint_leave_meeting",description:"Leave a meeting room and disconnect.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"}},required:["roomId"]},handler:async(e,t,i)=>{const n=i.meetingSessions.get(t.roomId);if(!n)return{error:"Not in this meeting."};const a=n.leave();return i.meetingSessions.delete(t.roomId),a},readOnly:!1},{name:"appoiint_speak",description:"Speak in a meeting room with an agent voice: synthesizes text via TTS and broadcasts the audio to all participants in one call. Requires an active appoiint_join_meeting session. Text is trimmed to 500 chars server-side; audio over 500KB is dropped by the relay.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID (must have joined via appoiint_join_meeting)"},text:{type:"string",description:"Text to speak (max 500 chars)"},voice:{type:"string",description:"Voice: cfo, cto, cmo, cco, cso, clo, heart, michael, nova, echo (default: heart)"}},required:["roomId","text"]},handler:async(e,t,i)=>{const n=i.meetingSessions.get(t.roomId);if(!n)return{error:"Not in this meeting. Call appoiint_join_meeting first."};const a=await e.synthesize({text:t.text,voice:t.voice||"heart",agentRole:t.voice});if(!a||!a.audio)return{error:"TTS synthesis failed",detail:a};const r=n.sendAudio({audio:a.audio,format:a.format});return{spoken:!0,roomId:t.roomId,voice:a.voice,provider:a.provider,bytes:r.bytes}},readOnly:!1},{name:"appoiint_list_events",description:"List bookable event types.",inputSchema:{type:"object",properties:{}},handler:async e=>e.events(),readOnly:!0},{name:"appoiint_check_availability",description:"Check available time slots for a host on a given date.",inputSchema:{type:"object",properties:{email:{type:"string",description:"Host email address"},date:{type:"string",description:"Date (YYYY-MM-DD)"},timezone:{type:"string",description:"Timezone (default: UTC)"}},required:["email","date"]},handler:async(e,t)=>e.slots(t.email,t.date,t.timezone||"UTC"),readOnly:!0},{name:"appoiint_create_booking",description:"Create a booking on behalf of a customer.",inputSchema:{type:"object",properties:{eventTypeId:{type:"string",description:"Event type ID"},scheduledAt:{type:"string",description:"ISO 8601 date-time (e.g. 2026-06-15T14:00:00Z)"},duration:{type:"number",description:"Duration in minutes (default: 30)"},customerName:{type:"string",description:"Customer name"},customerEmail:{type:"string",description:"Customer email"}},required:["scheduledAt","customerEmail"]},handler:async(e,t)=>e.book({eventTypeId:t.eventTypeId,scheduledAt:t.scheduledAt,duration:t.duration||30,customer:{name:t.customerName||"Guest",email:t.customerEmail},location:{type:"video"}}),readOnly:!1},{name:"appoiint_tts",description:"Synthesize text-to-speech with CxO agent voice.",inputSchema:{type:"object",properties:{text:{type:"string",description:"Text to synthesize"},voice:{type:"string",description:"Voice: cfo, cto, cmo, cco, cso, clo, heart, michael, nova, echo (default: heart)"}},required:["text"]},handler:async(e,t)=>e.synthesize({text:t.text,voice:t.voice||"heart",agentRole:t.voice}),readOnly:!0},{name:"appoiint_voices",description:"List available TTS voices and CxO agent voice mappings.",inputSchema:{type:"object",properties:{}},handler:async e=>e.voices(),readOnly:!0},{name:"appoiint_helpdesk_tickets",description:"List helpdesk tickets. Filter by status.",inputSchema:{type:"object",properties:{status:{type:"string",description:"Filter: open, resolved, closed"}}},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("GET","/saas/api/v1/sdk/helpdeskryClient/tickets"+(t.status?`?status=${t.status}`:""))},readOnly:!0},{name:"appoiint_helpdesk_ticket_show",description:"Get ticket detail with messages.",inputSchema:{type:"object",properties:{ticketId:{type:"string"}},required:["ticketId"]},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("GET",`/saas/api/v1/sdk/helpdeskryClient/tickets/${t.ticketId}`)},readOnly:!0},{name:"appoiint_helpdesk_ticket_create",description:"Create a helpdesk ticket.",inputSchema:{type:"object",properties:{subject:{type:"string"},priority:{type:"string"},category:{type:"string"}},required:["subject"]},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("POST","/saas/api/v1/sdk/helpdeskryClient/tickets",t)},readOnly:!1},{name:"appoiint_helpdesk_ticket_reply",description:"Reply to a helpdesk ticket.",inputSchema:{type:"object",properties:{ticketId:{type:"string"},message:{type:"string"}},required:["ticketId","message"]},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("POST",`/saas/api/v1/sdk/helpdeskryClient/tickets/${t.ticketId}/messages`,{content:t.message})},readOnly:!1},{name:"appoiint_crm_leads",description:"List CRM leads. Filter by status.",inputSchema:{type:"object",properties:{status:{type:"string"}}},handler:async(e,t,i)=>{const{rawApi:n}=require("./api"),a=t.status?`?status=${t.status}`:"";return n(i.config)("GET",`/saas/api/v1/sdk/crm/leads${a}`)},readOnly:!0},{name:"appoiint_crm_lead_show",description:"Get lead detail.",inputSchema:{type:"object",properties:{leadId:{type:"string"}},required:["leadId"]},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("GET",`/saas/api/v1/sdk/crm/leads/${t.leadId}`)},readOnly:!0},{name:"appoiint_crm_lead_create",description:"Create a CRM lead.",inputSchema:{type:"object",properties:{name:{type:"string"},email:{type:"string"},source:{type:"string"}},required:["name"]},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("POST","/saas/api/v1/sdk/crm/leads",t)},readOnly:!1},{name:"appoiint_crm_opportunities",description:"List CRM opportunities. Filter by stage.",inputSchema:{type:"object",properties:{stage:{type:"string"}}},handler:async(e,t,i)=>{const{rawApi:n}=require("./api"),a=t.stage?`?stage=${t.stage}`:"";return n(i.config)("GET",`/saas/api/v1/sdk/crm/opportunities${a}`)},readOnly:!0},{name:"appoiint_crm_pipelines",description:"List CRM pipelines with stages.",inputSchema:{type:"object",properties:{}},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("GET","/saas/api/v1/sdk/crm/pipelines")},readOnly:!0},{name:"appoiint_channel_send",description:"Send a 1:1 message to another agent. Use for ops requests, data queries, or notifications.",inputSchema:{type:"object",properties:{to:{type:"string",description:"Recipient agent ID"},message:{type:"string",description:"Message text"},action:{type:"string",description:"Intent/action (e.g. deploy, query, notify)"},payload:{type:"object",description:"Structured data payload"}},required:["to"]},handler:async(e,t)=>{const i={to:t.to,type:t.action?"request":"notify"};return t.message&&(i.payload={message:t.message}),t.action&&(i.action=t.action,i.requestId=`req_${Date.now()}`),t.payload&&(i.payload={...i.payload,...t.payload}),e.channelSend(i)},readOnly:!1},{name:"appoiint_channel_inbox",description:"Get unread messages from other agents.",inputSchema:{type:"object",properties:{}},handler:async e=>e.channelInbox(),readOnly:!0},{name:"appoiint_channel_history",description:"Get message history with a specific agent.",inputSchema:{type:"object",properties:{agentId:{type:"string",description:"Agent ID to get history with"},limit:{type:"number",description:"Max messages (default 50)"}},required:["agentId"]},handler:async(e,t)=>e.channelHistory(t.agentId,t.limit),readOnly:!0},{name:"appoiint_channel_agents",description:"List agents you have communicated with.",inputSchema:{type:"object",properties:{}},handler:async e=>e.channelAgents(),readOnly:!0},{name:"appoiint_wall",description:"All your message threads (DMs + channels) with unread badges, newest first. Start here to see what needs attention.",inputSchema:{type:"object",properties:{}},handler:async e=>e.wall(),readOnly:!0},{name:"appoiint_notifications",description:"Unread digest across all DM and channel threads. Reading a thread history marks it read.",inputSchema:{type:"object",properties:{}},handler:async e=>e.notificationsDigest(),readOnly:!0},{name:"appoiint_channel_create",description:"Create a named channel for multi-agent group messaging. You auto-join as creator.",inputSchema:{type:"object",properties:{name:{type:"string",description:'Channel name (slugified, e.g. "dev-ops")'},topic:{type:"string",description:"Optional channel topic"}},required:["name"]},handler:async(e,t)=>e.groupCreate(t.name,t.topic),readOnly:!1},{name:"appoiint_channel_join",description:"Join an existing named channel.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Channel name/slug"}},required:["name"]},handler:async(e,t)=>e.groupJoin(t.name),readOnly:!1},{name:"appoiint_channel_leave",description:"Leave a named channel.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Channel name/slug"}},required:["name"]},handler:async(e,t)=>e.groupLeave(t.name),readOnly:!1},{name:"appoiint_channel_list",description:"List named channels with membership and your unread counts.",inputSchema:{type:"object",properties:{}},handler:async e=>e.groupList(),readOnly:!0},{name:"appoiint_channel_post",description:"Post a message to a named channel (must be a member).",inputSchema:{type:"object",properties:{name:{type:"string",description:"Channel name/slug"},message:{type:"string",description:"Message text"},payload:{type:"object",description:"Optional structured payload"}},required:["name","message"]},handler:async(e,t)=>e.groupSend(t.name,{text:t.message,payload:t.payload||{message:t.message}}),readOnly:!1},{name:"appoiint_channel_messages",description:"Read a named channel history (reading marks it read).",inputSchema:{type:"object",properties:{name:{type:"string",description:"Channel name/slug"},limit:{type:"number",description:"Max messages (default 50)"}},required:["name"]},handler:async(e,t)=>e.groupHistory(t.name,t.limit),readOnly:!0},{name:"appoiint_admin_tenants",description:"List all tenants with plan, status, usage. Superadmin only.",inputSchema:{type:"object",properties:{}},handler:async e=>e.adminTenants(),readOnly:!0},{name:"appoiint_admin_tenant_view",description:"Full tenant detail: plan, stats, usage, created date.",inputSchema:{type:"object",properties:{slug:{type:"string",description:"Tenant slug"}},required:["slug"]},handler:async(e,t)=>e.adminTenantView(t.slug),readOnly:!0},{name:"appoiint_platform_stats",description:"Platform overview: tenants, users, rooms, bookings, meetings.",inputSchema:{type:"object",properties:{}},handler:async e=>e.platformStats(),readOnly:!0},{name:"appoiint_funnel",description:"Signup funnel with conversion rates.",inputSchema:{type:"object",properties:{}},handler:async e=>e.funnel(),readOnly:!0},{name:"appoiint_revenue",description:"Revenue breakdown: MRR, ARR, fees, payouts.",inputSchema:{type:"object",properties:{}},handler:async e=>e.revenue(),readOnly:!0},{name:"appoiint_audit",description:"Activity audit trail.",inputSchema:{type:"object",properties:{limit:{type:"number",description:"Max entries"},action:{type:"string",description:"Filter by action type"}}},handler:async(e,t)=>{const i=new URLSearchParams;return t.limit&&i.set("limit",t.limit),t.action&&i.set("action",t.action),e.audit(i.toString())},readOnly:!0}];module.exports={TOOLS:TOOLS};
1
+ const TOOLS=[{name:"appoiint_status",description:"Get Appoiint platform status and version.",inputSchema:{type:"object",properties:{}},handler:async e=>e.status(),readOnly:!0},{name:"appoiint_create_room",description:"Create a video meeting room. Returns roomId and join URL.",inputSchema:{type:"object",properties:{title:{type:"string",description:'Meeting title (e.g. "Team Standup")'}},required:["title"]},handler:async(e,t)=>{const i=require("./config").loadConfig([]);return e.createRoom({title:t.title,hostId:i.userId})},readOnly:!1},{name:"appoiint_list_rooms",description:"List active meeting rooms.",inputSchema:{type:"object",properties:{}},handler:async e=>e.listRooms(),readOnly:!0},{name:"appoiint_room_status",description:"Get room status and participants.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"}},required:["roomId"]},handler:async(e,t)=>e.roomStatus(t.roomId),readOnly:!0},{name:"appoiint_end_room",description:"End a meeting room.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"}},required:["roomId"]},handler:async(e,t)=>e.endRoom(t.roomId),readOnly:!1},{name:"appoiint_invite",description:"Invite a human or agent to a meeting room.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"},email:{type:"string",description:"Invitee email"},name:{type:"string",description:"Invitee name"},type:{type:"string",description:"human or agent (default: human)"}},required:["roomId","email"]},handler:async(e,t)=>e.invite(t.roomId,{email:t.email,name:t.name||"Guest",type:t.type||"human"}),readOnly:!1},{name:"appoiint_transcript",description:"Get meeting transcript.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"},format:{type:"string",description:"json, text, or srt (default: json)"}},required:["roomId"]},handler:async(e,t)=>e.transcript(t.roomId,t.format||"json"),readOnly:!0},{name:"appoiint_join_meeting",description:"Join a meeting room as an AI agent. Creates persistent Socket.IO connection. You will hear transcripts and can send chat messages. Call appoiint_get_transcripts to read what was said, appoiint_send_chat to respond.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID to join"},agentName:{type:"string",description:"Your display name in the meeting (default: Claude Code)"},agentRole:{type:"string",description:"Your role badge (default: assistant)"}},required:["roomId"]},handler:async(e,t,i)=>{const{MeetingSession:n}=require("./meetingSession"),a=new n({baseUrl:i.config.baseUrl,roomId:t.roomId,agentName:t.agentName||"Claude Code",agentRole:t.agentRole||"assistant"}),r=await a.join();return i.meetingSessions.set(t.roomId,a),r},readOnly:!1},{name:"appoiint_get_transcripts",description:"Get speech transcripts from the meeting. Returns what participants have said since last read. Buffer is cleared after reading.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"}},required:["roomId"]},handler:async(e,t,i)=>{const n=i.meetingSessions.get(t.roomId);if(!n)return{error:"Not in this meeting. Call appoiint_join_meeting first."};const a=n.getTranscripts();return{roomId:t.roomId,count:a.length,transcripts:a}},readOnly:!0},{name:"appoiint_send_chat",description:"Send a chat message to all meeting participants. Your message appears in the AI chat panel with your role badge.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"},message:{type:"string",description:"Message to send to meeting participants"}},required:["roomId","message"]},handler:async(e,t,i)=>{const n=i.meetingSessions.get(t.roomId);return n?n.sendChat(t.message):{error:"Not in this meeting. Call appoiint_join_meeting first."}},readOnly:!1},{name:"appoiint_meeting_status",description:"Check meeting connection status: connected, peer count, buffered transcript count.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"}},required:["roomId"]},handler:async(e,t,i)=>{const n=i.meetingSessions.get(t.roomId);return n?n.status():{error:"Not in this meeting.",connected:!1}},readOnly:!0},{name:"appoiint_leave_meeting",description:"Leave a meeting room and disconnect.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID"}},required:["roomId"]},handler:async(e,t,i)=>{const n=i.meetingSessions.get(t.roomId);if(!n)return{error:"Not in this meeting."};const a=n.leave();return i.meetingSessions.delete(t.roomId),a},readOnly:!1},{name:"appoiint_speak",description:"Speak in a meeting room with an agent voice: synthesizes text via TTS and broadcasts the audio to all participants in one call. Requires an active appoiint_join_meeting session. Text is trimmed to 500 chars server-side; audio over 500KB is dropped by the relay.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID (must have joined via appoiint_join_meeting)"},text:{type:"string",description:"Text to speak (max 500 chars)"},voice:{type:"string",description:"Voice: cfo, cto, cmo, cco, cso, clo, heart, michael, nova, echo (default: heart)"}},required:["roomId","text"]},handler:async(e,t,i)=>{const n=i.meetingSessions.get(t.roomId);if(!n)return{error:"Not in this meeting. Call appoiint_join_meeting first."};const a=await e.synthesize({text:t.text,voice:t.voice||"heart",agentRole:t.voice});if(!a||!a.audio)return{error:"TTS synthesis failed",detail:a};const r=n.sendAudio({audio:a.audio,format:a.format});return{spoken:!0,roomId:t.roomId,voice:a.voice,provider:a.provider,bytes:r.bytes}},readOnly:!1},{name:"appoiint_summary_status",description:"Check whether the AI meeting-summary service is available, and which model backs it. Call this before summarizing if you want to fail fast.",inputSchema:{type:"object",properties:{}},handler:async e=>e.summaryStatus(),readOnly:!0},{name:"appoiint_summarize_notes",description:"Summarize a meeting transcript into an overview, key topics and action items. Pass either roomId (uses the live transcript buffer from appoiint_join_meeting, without clearing it) or an explicit notes array. Returns overview, keyTopics[{topic,summary,timestamp,speakers}] and actionItems[{task,assignee,deadline,priority,context}]. Nothing is saved — use appoiint_summarize_meeting to persist against a booking.",inputSchema:{type:"object",properties:{roomId:{type:"string",description:"Room ID of an active appoiint_join_meeting session — its transcripts are summarized"},notes:{type:"array",description:"Transcript entries: [{speaker, text, timestamp}] or plain strings",items:{type:"object"}},metadata:{type:"object",description:"Optional meeting context: {title, participants, duration}"}}},handler:async(e,t,i)=>{const n=_notesFrom(t,i);return n.length?e.summarizeNotes({notes:n,metadata:t.metadata||{}}):{error:"No transcript to summarize. Pass notes[], or a roomId with buffered transcripts."}},readOnly:!0},{name:"appoiint_ask_transcript",description:'Ask a natural-language question about a meeting transcript ("what did we decide about pricing?", "who owns the migration?"). Pass either roomId (live transcript buffer) or an explicit notes array, plus the question.',inputSchema:{type:"object",properties:{question:{type:"string",description:"Question to answer from the transcript"},roomId:{type:"string",description:"Room ID of an active appoiint_join_meeting session"},notes:{type:"array",description:"Transcript entries: [{speaker, text, timestamp}] or plain strings",items:{type:"object"}},metadata:{type:"object",description:"Optional meeting context"}},required:["question"]},handler:async(e,t,i)=>{const n=_notesFrom(t,i);return n.length?e.askTranscript({notes:n,question:t.question,metadata:t.metadata||{}}):{error:"No transcript to ask about. Pass notes[], or a roomId with buffered transcripts."}},readOnly:!0},{name:"appoiint_summarize_meeting",description:"Generate an AI summary from a meeting's stored notes and SAVE it against that meeting. Use the booking/meeting id. Fails if the meeting has no transcript entries yet.",inputSchema:{type:"object",properties:{meetingId:{type:"string",description:"Meeting/booking ID"}},required:["meetingId"]},handler:async(e,t)=>e.summarizeMeeting(t.meetingId),readOnly:!1},{name:"appoiint_get_summary",description:"Get the saved AI summary for a meeting (404 if one has not been generated — call appoiint_summarize_meeting first).",inputSchema:{type:"object",properties:{meetingId:{type:"string",description:"Meeting/booking ID"}},required:["meetingId"]},handler:async(e,t)=>e.getSummary(t.meetingId),readOnly:!0},{name:"appoiint_delete_summary",description:"Delete the saved AI summary for a meeting. The transcript itself is kept.",inputSchema:{type:"object",properties:{meetingId:{type:"string",description:"Meeting/booking ID"}},required:["meetingId"]},handler:async(e,t)=>e.deleteSummary(t.meetingId),readOnly:!1},{name:"appoiint_meeting_transcript",description:"Get the stored transcript for a meeting: timestamped segments plus the speaker list.",inputSchema:{type:"object",properties:{meetingId:{type:"string",description:"Meeting/booking ID"},limit:{type:"number",description:"Max segments to return (default 50)"}},required:["meetingId"]},handler:async(e,t)=>e.meetingTranscript(t.meetingId,t.limit),readOnly:!0},{name:"appoiint_meeting_action_items",description:"List the action items extracted from a meeting.",inputSchema:{type:"object",properties:{meetingId:{type:"string",description:"Meeting/booking ID"}},required:["meetingId"]},handler:async(e,t)=>e.meetingActionItems(t.meetingId),readOnly:!0},{name:"appoiint_meeting_highlights",description:"List highlighted moments in a meeting transcript.",inputSchema:{type:"object",properties:{meetingId:{type:"string",description:"Meeting/booking ID"}},required:["meetingId"]},handler:async(e,t)=>e.meetingHighlights(t.meetingId),readOnly:!0},{name:"appoiint_meeting_notes_status",description:"Meeting-notes overview for a meeting: segment/speaker/highlight/comment counts and duration. Cheap way to check whether a meeting has anything worth summarizing.",inputSchema:{type:"object",properties:{meetingId:{type:"string",description:"Meeting/booking ID"}},required:["meetingId"]},handler:async(e,t)=>e.meetingNotesStatus(t.meetingId),readOnly:!0},{name:"appoiint_search_meeting",description:"Full-text search across a meeting's transcript segments, highlights and comments.",inputSchema:{type:"object",properties:{meetingId:{type:"string",description:"Meeting/booking ID"},query:{type:"string",description:"Search term"}},required:["meetingId","query"]},handler:async(e,t)=>e.meetingSearch(t.meetingId,t.query),readOnly:!0},{name:"appoiint_export_meeting_notes",description:"Export a meeting's notes as md (default), txt or json — ready to paste into a doc or email.",inputSchema:{type:"object",properties:{meetingId:{type:"string",description:"Meeting/booking ID"},format:{type:"string",description:"md | txt | json (default md)"}},required:["meetingId"]},handler:async(e,t)=>{const i=(t.format||"md").toLowerCase();if(!["md","txt","json"].includes(i))throw new Error("format must be one of: md, txt, json");return e.meetingExport(t.meetingId,i)},readOnly:!0},{name:"appoiint_list_events",description:"List bookable event types.",inputSchema:{type:"object",properties:{}},handler:async e=>e.events(),readOnly:!0},{name:"appoiint_create_event",description:"Create a bookable event type for the authenticated host.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Event type name/title"},duration:{type:"number",description:"Duration in minutes (default: 30)"},slug:{type:"string",description:"URL slug (default: derived from name)"},description:{type:"string",description:"Short description"},timezone:{type:"string",description:"Availability timezone (default: Europe/London)"},price:{type:"number",description:"Price (default: 0 = free)"},currency:{type:"string",description:"Currency (default: USD)"}},required:["name"]},handler:async(e,t,i)=>{const n=t.slug||String(t.name).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),a=Number(t.price)||0;return e.createEvent({userId:i.config.userId,name:t.name,slug:n,duration:t.duration||30,description:t.description||"",availability:{type:"inherit",timezone:t.timezone||"Europe/London"},pricing:{enabled:a>0,amount:a,currency:t.currency||"USD"},meetingSettings:{location:{type:"video"},autoCreateMeeting:!0}})},readOnly:!1},{name:"appoiint_delete_event",description:"Delete an event type. SAFETY: refuses to hard-delete when bookings are attached (would orphan meetings) unless force=true; use soft=true to deactivate while preserving bookings.",inputSchema:{type:"object",properties:{eventTypeId:{type:"string",description:"Event type id (from appoiint_list_events)"},soft:{type:"boolean",description:"Deactivate instead of hard delete (preserves bookings)"},force:{type:"boolean",description:"Hard delete even if bookings are attached"}},required:["eventTypeId"]},handler:async(e,t)=>{const i=t.eventTypeId;let n=null;try{const t=await e.events();n=(Array.isArray(t)?t:t.eventTypes||t.data&&(Array.isArray(t.data)?t.data:t.data.eventTypes)||[]).find(e=>e.id===i||e._id===i||e.eventTypeId===i||e.slug===i)}catch{}const a=n&&Number.isFinite(n.bookingCount)?n.bookingCount:null,r=n&&(n.name||n.slug)||i;if(!t.soft&&!t.force&&a>0)throw new Error(`Refusing to delete "${r}" — it has ${a} booking(s) attached and they would be orphaned. Re-run with soft:true (deactivate, keep bookings) or force:true (hard delete anyway).`);const o=await e.deleteEvent(i,!!t.soft);return{deleted:!t.soft,deactivated:!!t.soft,eventType:r,bookingsAffected:a||0,result:o}},readOnly:!1},{name:"appoiint_check_availability",description:"Check available time slots for a host on a given date.",inputSchema:{type:"object",properties:{email:{type:"string",description:"Host email address"},date:{type:"string",description:"Date (YYYY-MM-DD)"},timezone:{type:"string",description:"Timezone (default: UTC)"}},required:["email","date"]},handler:async(e,t)=>e.slots(t.email,t.date,t.timezone||"UTC"),readOnly:!0},{name:"appoiint_create_booking",description:"Create a booking on behalf of a customer.",inputSchema:{type:"object",properties:{eventTypeId:{type:"string",description:"Event type ID"},scheduledAt:{type:"string",description:"ISO 8601 date-time (e.g. 2026-06-15T14:00:00Z)"},duration:{type:"number",description:"Duration in minutes (default: 30)"},customerName:{type:"string",description:"Customer name"},customerEmail:{type:"string",description:"Customer email"}},required:["scheduledAt","customerEmail"]},handler:async(e,t)=>e.book({eventTypeId:t.eventTypeId,scheduledAt:t.scheduledAt,duration:t.duration||30,customer:{name:t.customerName||"Guest",email:t.customerEmail},location:{type:"video"}}),readOnly:!1},{name:"appoiint_tts",description:"Synthesize text-to-speech with CxO agent voice.",inputSchema:{type:"object",properties:{text:{type:"string",description:"Text to synthesize"},voice:{type:"string",description:"Voice: cfo, cto, cmo, cco, cso, clo, heart, michael, nova, echo (default: heart)"}},required:["text"]},handler:async(e,t)=>e.synthesize({text:t.text,voice:t.voice||"heart",agentRole:t.voice}),readOnly:!0},{name:"appoiint_voices",description:"List available TTS voices and CxO agent voice mappings.",inputSchema:{type:"object",properties:{}},handler:async e=>e.voices(),readOnly:!0},{name:"appoiint_helpdesk_tickets",description:"List helpdesk tickets. Filter by status.",inputSchema:{type:"object",properties:{status:{type:"string",description:"Filter: open, resolved, closed"}}},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("GET","/saas/api/v1/sdk/helpdeskryClient/tickets"+(t.status?`?status=${t.status}`:""))},readOnly:!0},{name:"appoiint_helpdesk_ticket_show",description:"Get ticket detail with messages.",inputSchema:{type:"object",properties:{ticketId:{type:"string"}},required:["ticketId"]},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("GET",`/saas/api/v1/sdk/helpdeskryClient/tickets/${t.ticketId}`)},readOnly:!0},{name:"appoiint_helpdesk_ticket_create",description:"Create a helpdesk ticket.",inputSchema:{type:"object",properties:{subject:{type:"string"},priority:{type:"string"},category:{type:"string"}},required:["subject"]},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("POST","/saas/api/v1/sdk/helpdeskryClient/tickets",t)},readOnly:!1},{name:"appoiint_helpdesk_ticket_reply",description:"Reply to a helpdesk ticket.",inputSchema:{type:"object",properties:{ticketId:{type:"string"},message:{type:"string"}},required:["ticketId","message"]},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("POST",`/saas/api/v1/sdk/helpdeskryClient/tickets/${t.ticketId}/messages`,{content:t.message})},readOnly:!1},{name:"appoiint_crm_leads",description:"List CRM leads. Filter by status.",inputSchema:{type:"object",properties:{status:{type:"string"}}},handler:async(e,t,i)=>{const{rawApi:n}=require("./api"),a=t.status?`?status=${t.status}`:"";return n(i.config)("GET",`/saas/api/v1/sdk/crm/leads${a}`)},readOnly:!0},{name:"appoiint_crm_lead_show",description:"Get lead detail.",inputSchema:{type:"object",properties:{leadId:{type:"string"}},required:["leadId"]},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("GET",`/saas/api/v1/sdk/crm/leads/${t.leadId}`)},readOnly:!0},{name:"appoiint_crm_lead_create",description:"Create a CRM lead.",inputSchema:{type:"object",properties:{name:{type:"string"},email:{type:"string"},source:{type:"string"}},required:["name"]},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("POST","/saas/api/v1/sdk/crm/leads",t)},readOnly:!1},{name:"appoiint_crm_opportunities",description:"List CRM opportunities. Filter by stage.",inputSchema:{type:"object",properties:{stage:{type:"string"}}},handler:async(e,t,i)=>{const{rawApi:n}=require("./api"),a=t.stage?`?stage=${t.stage}`:"";return n(i.config)("GET",`/saas/api/v1/sdk/crm/opportunities${a}`)},readOnly:!0},{name:"appoiint_crm_pipelines",description:"List CRM pipelines with stages.",inputSchema:{type:"object",properties:{}},handler:async(e,t,i)=>{const{rawApi:n}=require("./api");return n(i.config)("GET","/saas/api/v1/sdk/crm/pipelines")},readOnly:!0},{name:"appoiint_channel_send",description:"Send a 1:1 message to another agent. Use for ops requests, data queries, or notifications.",inputSchema:{type:"object",properties:{to:{type:"string",description:"Recipient agent ID"},message:{type:"string",description:"Message text"},action:{type:"string",description:"Intent/action (e.g. deploy, query, notify)"},payload:{type:"object",description:"Structured data payload"}},required:["to"]},handler:async(e,t)=>{const i={to:t.to,type:t.action?"request":"notify"};return t.message&&(i.payload={message:t.message}),t.action&&(i.action=t.action,i.requestId=`req_${Date.now()}`),t.payload&&(i.payload={...i.payload,...t.payload}),e.channelSend(i)},readOnly:!1},{name:"appoiint_channel_inbox",description:"Get unread messages from other agents.",inputSchema:{type:"object",properties:{}},handler:async e=>e.channelInbox(),readOnly:!0},{name:"appoiint_channel_history",description:"Get message history with a specific agent.",inputSchema:{type:"object",properties:{agentId:{type:"string",description:"Agent ID to get history with"},limit:{type:"number",description:"Max messages (default 50)"}},required:["agentId"]},handler:async(e,t)=>e.channelHistory(t.agentId,t.limit),readOnly:!0},{name:"appoiint_channel_agents",description:"List agents you have communicated with.",inputSchema:{type:"object",properties:{}},handler:async e=>e.channelAgents(),readOnly:!0},{name:"appoiint_wall",description:"All your message threads (DMs + channels) with unread badges, newest first. Start here to see what needs attention.",inputSchema:{type:"object",properties:{}},handler:async e=>e.wall(),readOnly:!0},{name:"appoiint_notifications",description:"Unread digest across all DM and channel threads. Reading a thread history marks it read.",inputSchema:{type:"object",properties:{}},handler:async e=>e.notificationsDigest(),readOnly:!0},{name:"appoiint_channel_create",description:"Create a named channel for multi-agent group messaging. You auto-join as creator.",inputSchema:{type:"object",properties:{name:{type:"string",description:'Channel name (slugified, e.g. "dev-ops")'},topic:{type:"string",description:"Optional channel topic"}},required:["name"]},handler:async(e,t)=>e.groupCreate(t.name,t.topic),readOnly:!1},{name:"appoiint_channel_join",description:"Join an existing named channel.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Channel name/slug"}},required:["name"]},handler:async(e,t)=>e.groupJoin(t.name),readOnly:!1},{name:"appoiint_channel_leave",description:"Leave a named channel.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Channel name/slug"}},required:["name"]},handler:async(e,t)=>e.groupLeave(t.name),readOnly:!1},{name:"appoiint_channel_list",description:"List named channels with membership and your unread counts.",inputSchema:{type:"object",properties:{}},handler:async e=>e.groupList(),readOnly:!0},{name:"appoiint_channel_post",description:"Post a message to a named channel (must be a member).",inputSchema:{type:"object",properties:{name:{type:"string",description:"Channel name/slug"},message:{type:"string",description:"Message text"},payload:{type:"object",description:"Optional structured payload"}},required:["name","message"]},handler:async(e,t)=>e.groupSend(t.name,{text:t.message,payload:t.payload||{message:t.message}}),readOnly:!1},{name:"appoiint_channel_messages",description:"Read a named channel history (reading marks it read).",inputSchema:{type:"object",properties:{name:{type:"string",description:"Channel name/slug"},limit:{type:"number",description:"Max messages (default 50)"}},required:["name"]},handler:async(e,t)=>e.groupHistory(t.name,t.limit),readOnly:!0},{name:"appoiint_admin_tenants",description:"List all tenants with plan, status, usage. Superadmin only.",inputSchema:{type:"object",properties:{}},handler:async e=>e.adminTenants(),readOnly:!0},{name:"appoiint_admin_tenant_view",description:"Full tenant detail: plan, stats, usage, created date.",inputSchema:{type:"object",properties:{slug:{type:"string",description:"Tenant slug"}},required:["slug"]},handler:async(e,t)=>e.adminTenantView(t.slug),readOnly:!0},{name:"appoiint_platform_stats",description:"Platform overview: tenants, users, rooms, bookings, meetings.",inputSchema:{type:"object",properties:{}},handler:async e=>e.platformStats(),readOnly:!0},{name:"appoiint_funnel",description:"Signup funnel with conversion rates.",inputSchema:{type:"object",properties:{}},handler:async e=>e.funnel(),readOnly:!0},{name:"appoiint_revenue",description:"Revenue breakdown: MRR, ARR, fees, payouts.",inputSchema:{type:"object",properties:{}},handler:async e=>e.revenue(),readOnly:!0},{name:"appoiint_audit",description:"Activity audit trail.",inputSchema:{type:"object",properties:{limit:{type:"number",description:"Max entries"},action:{type:"string",description:"Filter by action type"}}},handler:async(e,t)=>{const i=new URLSearchParams;return t.limit&&i.set("limit",t.limit),t.action&&i.set("action",t.action),e.audit(i.toString())},readOnly:!0},{name:"appoiint_list_bookings",description:"List bookings for a host (defaults to the authenticated user).",inputSchema:{type:"object",properties:{hostId:{type:"string",description:"Host user id (default: authenticated user)"}}},handler:async(e,t,i)=>e.bookingsByHost(t.hostId||i.config.userId),readOnly:!0},{name:"appoiint_get_booking",description:"Get a single booking by id.",inputSchema:{type:"object",properties:{bookingId:{type:"string",description:"Booking id"}},required:["bookingId"]},handler:async(e,t)=>e.getBooking(t.bookingId),readOnly:!0},{name:"appoiint_cancel_booking",description:"Cancel a booking.",inputSchema:{type:"object",properties:{bookingId:{type:"string",description:"Booking id"},reason:{type:"string",description:"Cancellation reason"}},required:["bookingId"]},handler:async(e,t)=>e.cancelBooking(t.bookingId,{reason:t.reason||"Cancelled via MCP"}),readOnly:!1},{name:"appoiint_reschedule_booking",description:"Reschedule a booking to a new date/time.",inputSchema:{type:"object",properties:{bookingId:{type:"string",description:"Booking id"},newDate:{type:"string",description:"ISO 8601 date-time (e.g. 2026-10-01T14:00:00Z)"},reason:{type:"string",description:"Reschedule reason"}},required:["bookingId","newDate"]},handler:async(e,t)=>{const i={newDate:t.newDate,newScheduledAt:t.newDate};return t.reason&&(i.reason=t.reason),e.rescheduleBooking(t.bookingId,i)},readOnly:!1},{name:"appoiint_get_availability",description:"Get weekly availability (working hours) for a user (defaults to the authenticated user).",inputSchema:{type:"object",properties:{userId:{type:"string",description:"User id (default: authenticated user)"}}},handler:async(e,t,i)=>e.availabilityGet(t.userId||i.config.userId),readOnly:!0},{name:"appoiint_set_availability",description:"Set weekly availability: one time window applied to the given days. Mirrors PUT /availability/:userId (body: userId, organizationId, workingHours, timezone).",inputSchema:{type:"object",properties:{from:{type:"string",description:"Start time HH:MM (default 09:00)"},to:{type:"string",description:"End time HH:MM (default 17:00)"},days:{type:"array",items:{type:"number"},description:"Days of week 0=Sun..6=Sat (default Mon-Fri [1,2,3,4,5])"},timezone:{type:"string",description:"IANA timezone (default Europe/London)"},organizationId:{type:"string",description:"Org id (auto-resolved from current availability or event types if omitted)"},userId:{type:"string",description:"Target user (default: authenticated user)"}}},handler:async(e,t,i)=>{const n=t.userId||i.config.userId;if(!n)throw new Error("No userId available — pass userId explicitly.");const a=t.from||"09:00",r=t.to||"17:00";if(!/^\d{2}:\d{2}$/.test(a)||!/^\d{2}:\d{2}$/.test(r))throw new Error("Times must be HH:MM (e.g. 09:00)");const o=Array.isArray(t.days)&&t.days.length?t.days:[1,2,3,4,5],s=[0,1,2,3,4,5,6].map(e=>({dayOfWeek:e,isAvailable:o.includes(e),timeSlots:o.includes(e)?[{startTime:a,endTime:r}]:[]})),p=t.organizationId||await _resolveOrgId(e,n);if(!p)throw new Error("Could not resolve organizationId — pass organizationId explicitly.");const d=t.timezone||"Europe/London";return e.availabilityUpdate(n,{userId:n,organizationId:p,workingHours:s,timezone:d})},readOnly:!1},{name:"appoiint_list_domains",description:"List custom meeting-page domains for this tenant.",inputSchema:{type:"object",properties:{}},handler:async e=>_domainArray(await e.domains()),readOnly:!0},{name:"appoiint_register_domain",description:"Register a custom domain for the tenant meetings page. Returns the CNAME target to publish, then verify with appoiint_verify_domain.",inputSchema:{type:"object",properties:{hostname:{type:"string",description:"e.g. meetings.yourdomain.com"}},required:["hostname"]},handler:async(e,t,i)=>{if(!/^[a-zA-Z0-9][a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(t.hostname))throw new Error("Invalid hostname");if(!i.config.userId)throw new Error("No userId on this API key — cannot register a tenant domain.");const n=_unwrap(await e.domainRegister({hostname:t.hostname,domainType:"custom",tenantId:i.config.userId,tenantType:"user",baseDomain:"appoiint.ai"})),a=n.dnsVerification&&n.dnsVerification.expectedValue;return{registered:!0,hostname:t.hostname,domainId:_idOf(n),cnameTarget:a||null,next:a?`Publish CNAME ${t.hostname} -> ${a}, then call appoiint_verify_domain.`:"SDK returned no CNAME target — inspect with appoiint_domain_status."}},readOnly:!1},{name:"appoiint_verify_domain",description:"Verify DNS for a custom domain and auto-activate it once verified (custom domains ride the wildcard cert, so activation gates on DNS only).",inputSchema:{type:"object",properties:{domain:{type:"string",description:"Hostname or domain id"}},required:["domain"]},handler:async(e,t)=>{const i=await _findDomain(e,t.domain);if(!i)throw new Error(`Domain not found: ${t.domain}`);const n=await e.domainVerify(_idOf(i)),a=_unwrap(n),r=a.verified||a.dnsVerification&&a.dnsVerification.verified||n.success&&"active"===a.status;let o=null;if(r&&"active"!==a.status)try{o=_unwrap(await e.domainActivate(_idOf(i)))}catch(e){o={error:e.message}}return{hostname:i.hostname,verified:!!r,status:o&&o.status||a.status||null,activate:o}},readOnly:!1},{name:"appoiint_domain_status",description:"DNS + SSL status for a custom domain.",inputSchema:{type:"object",properties:{domain:{type:"string",description:"Hostname or domain id"}},required:["domain"]},handler:async(e,t)=>{const i=await _findDomain(e,t.domain);if(!i)throw new Error(`Domain not found: ${t.domain}`);const n=_unwrap(await e.domainDnsStatus(_idOf(i)));return{hostname:i.hostname,domainId:_idOf(i),status:i.status,dns:n}},readOnly:!0},{name:"appoiint_remove_domain",description:"Delete a custom domain. IRREVERSIBLE — requires confirm=true.",inputSchema:{type:"object",properties:{domain:{type:"string",description:"Hostname or domain id"},confirm:{type:"boolean",description:"Must be true to delete"}},required:["domain"]},handler:async(e,t)=>{if(!0!==t.confirm)throw new Error("Refusing to delete without confirm=true (this cannot be undone).");const i=await _findDomain(e,t.domain);if(!i)throw new Error(`Domain not found: ${t.domain}`);const n=await e.domainDelete(_idOf(i));return{removed:!0,hostname:i.hostname,result:n}},readOnly:!1},{name:"appoiint_page",description:"Show the tenant meetings-page profile (name, title, company, website, slug — drives the vCard + OG tags).",inputSchema:{type:"object",properties:{}},handler:async e=>e.profileGet(),readOnly:!0},{name:"appoiint_page_set",description:"Update the tenant meetings-page profile. Verified-writable fields only: firstName, lastName, company, title (stored as position), phone (mobile_no), website (powers the vCard VISIT CTA).",inputSchema:{type:"object",properties:{firstName:{type:"string"},lastName:{type:"string"},company:{type:"string"},title:{type:"string",description:"Job title (stored as position)"},phone:{type:"string"},website:{type:"string",description:"https URL — powers the vCard VISIT CTA"}}},handler:async(e,t)=>{const i={};if(void 0!==t.firstName&&(i.firstName=t.firstName),void 0!==t.lastName&&(i.lastName=t.lastName),void 0!==t.company&&(i.company=t.company),void 0!==t.title&&(i.position=t.title),void 0!==t.phone&&(i.mobile_no=t.phone),void 0!==t.website&&(i.website=t.website),!Object.keys(i).length)throw new Error("No fields to update.");return e.profileUpdate(i)},readOnly:!1},{name:"appoiint_update_event",description:"Update an existing event type (PUT /eventtypes/:id). Pass only the fields to change.",inputSchema:{type:"object",properties:{eventTypeId:{type:"string",description:"Event type id"},updates:{type:"object",description:"Fields to update (name, duration, description, pricing, ...)"}},required:["eventTypeId","updates"]},handler:async(e,t)=>e.updateEvent(t.eventTypeId,t.updates),readOnly:!1},{name:"appoiint_resolve_domain",description:"Resolve which tenant a hostname routes to (GET /domains/resolve).",inputSchema:{type:"object",properties:{hostname:{type:"string"}},required:["hostname"]},handler:async(e,t)=>e.domainResolve(t.hostname),readOnly:!0},{name:"appoiint_stt_status",description:"Speech-to-text provider status.",inputSchema:{type:"object",properties:{}},handler:async e=>e.sttStatus(),readOnly:!0},{name:"appoiint_costs",description:"Usage costs summary for this account.",inputSchema:{type:"object",properties:{}},handler:async e=>e.costs(),readOnly:!0},{name:"appoiint_costs_room",description:"Usage costs for a specific room.",inputSchema:{type:"object",properties:{roomId:{type:"string"}},required:["roomId"]},handler:async(e,t)=>e.costsByRoom(t.roomId),readOnly:!0},{name:"appoiint_costs_pricing",description:"Current usage pricing table.",inputSchema:{type:"object",properties:{}},handler:async e=>e.costsPricing(),readOnly:!0},{name:"appoiint_channel_ack",description:"Acknowledge an agent-channel message by id.",inputSchema:{type:"object",properties:{messageId:{type:"string"}},required:["messageId"]},handler:async(e,t)=>e.channelAck(t.messageId),readOnly:!1},{name:"appoiint_signups",description:"SUPERADMIN: signup counts over the last N days.",inputSchema:{type:"object",properties:{days:{type:"number",description:"Window in days"}}},handler:async(e,t)=>e.signups(t.days),readOnly:!0},{name:"appoiint_audit_export",description:"SUPERADMIN: export the audit trail (json or csv).",inputSchema:{type:"object",properties:{format:{type:"string",description:"json or csv (default json)"}}},handler:async(e,t)=>e.auditExport(t.format||"json"),readOnly:!0},{name:"appoiint_admin_notifications",description:"SUPERADMIN: platform notifications feed.",inputSchema:{type:"object",properties:{since:{type:"string",description:"ISO timestamp — only newer items"}}},handler:async(e,t)=>e.notifications(t.since),readOnly:!0},{name:"appoiint_tickets",description:"SUPERADMIN: list support tickets.",inputSchema:{type:"object",properties:{status:{type:"string",description:"Filter: open, closed, ..."}}},handler:async(e,t)=>e.tickets(t.status),readOnly:!0},{name:"appoiint_ticket_show",description:"SUPERADMIN: show a support ticket.",inputSchema:{type:"object",properties:{ticketId:{type:"string"}},required:["ticketId"]},handler:async(e,t)=>e.ticketShow(t.ticketId),readOnly:!0},{name:"appoiint_ticket_reply",description:"SUPERADMIN: reply to a support ticket.",inputSchema:{type:"object",properties:{ticketId:{type:"string"},message:{type:"string"}},required:["ticketId","message"]},handler:async(e,t)=>e.ticketReply(t.ticketId,t.message),readOnly:!1},{name:"appoiint_ticket_close",description:"SUPERADMIN: close a support ticket.",inputSchema:{type:"object",properties:{ticketId:{type:"string"}},required:["ticketId"]},handler:async(e,t)=>e.ticketClose(t.ticketId),readOnly:!1},{name:"appoiint_admin_users",description:"SUPERADMIN: list platform users.",inputSchema:{type:"object",properties:{}},handler:async e=>e.adminUsers(),readOnly:!0},{name:"appoiint_admin_user_create",description:"SUPERADMIN: create a platform user.",inputSchema:{type:"object",properties:{email:{type:"string"},name:{type:"string"},organizationName:{type:"string"},planId:{type:"string",description:"e.g. appoiint-enterprise"},skipPayment:{type:"boolean"}},required:["email","name"]},handler:async(e,t)=>e.adminUserCreate(t),readOnly:!1},{name:"appoiint_admin_user_reset",description:"SUPERADMIN: reset a user password.",inputSchema:{type:"object",properties:{email:{type:"string"},newPassword:{type:"string",description:"Omit to auto-generate"}},required:["email"]},handler:async(e,t)=>e.adminUserReset(t.email,t.newPassword?{newPassword:t.newPassword}:{}),readOnly:!1},{name:"appoiint_admin_user_delete",description:"SUPERADMIN: delete a platform user. IRREVERSIBLE — requires confirm=true.",inputSchema:{type:"object",properties:{email:{type:"string"},confirm:{type:"boolean",description:"Must be true to delete"}},required:["email"]},handler:async(e,t)=>{if(!0!==t.confirm)throw new Error("Refusing to delete without confirm=true (this cannot be undone).");return e.adminUserDelete(t.email)},readOnly:!1},{name:"appoiint_admin_tenant_create",description:"SUPERADMIN: create a tenant.",inputSchema:{type:"object",properties:{data:{type:"object",description:"Tenant payload (slug, name, plan, ...)"}},required:["data"]},handler:async(e,t)=>e.adminTenantCreate(t.data),readOnly:!1},{name:"appoiint_admin_tenant_set",description:"SUPERADMIN: tenant lifecycle action — plan | verify | suspend | activate.",inputSchema:{type:"object",properties:{slug:{type:"string",description:"Tenant slug"},action:{type:"string",description:"plan | verify | suspend | activate"},plan:{type:"string",description:"Plan id (required when action=plan)"}},required:["slug","action"]},handler:async(e,t)=>{switch(t.action){case"plan":if(!t.plan)throw new Error("action=plan requires the plan parameter");return e.adminTenantPlan(t.slug,t.plan);case"verify":return e.adminTenantVerify(t.slug);case"suspend":return e.adminTenantSuspend(t.slug);case"activate":return e.adminTenantActivate(t.slug);default:throw new Error(`Unknown action: ${t.action} (use plan | verify | suspend | activate)`)}},readOnly:!1},{name:"appoiint_admin_tenant_delete",description:"SUPERADMIN: delete a tenant. IRREVERSIBLE — requires confirm=true.",inputSchema:{type:"object",properties:{slug:{type:"string"},confirm:{type:"boolean",description:"Must be true to delete"}},required:["slug"]},handler:async(e,t)=>{if(!0!==t.confirm)throw new Error("Refusing to delete without confirm=true (this cannot be undone).");return e.adminTenantDelete(t.slug)},readOnly:!1},{name:"appoiint_admin_billing",description:"SUPERADMIN: platform billing/revenue summary.",inputSchema:{type:"object",properties:{}},handler:async e=>e.adminBilling(),readOnly:!0},{name:"appoiint_admin_discount",description:"SUPERADMIN: apply a discount.",inputSchema:{type:"object",properties:{data:{type:"object",description:"Discount payload"}},required:["data"]},handler:async(e,t)=>e.adminDiscount(t.data),readOnly:!1}];function _notesFrom(e,t){let i=Array.isArray(e.notes)?e.notes:null;if(!i&&e.roomId&&t&&t.meetingSessions){const n=t.meetingSessions.get(e.roomId);n&&(i=n.getTranscripts(!1))}return Array.isArray(i)?i.map(e=>"string"==typeof e?{speaker:"Unknown",text:e,timestamp:Date.now()}:{speaker:e.speaker||e.peer_name||"Unknown",text:e.text||"",timestamp:e.timestamp||Date.now()}).filter(e=>e.text):[]}function _unwrap(e){let t=e;for(;t&&"object"==typeof t&&t.data&&!Array.isArray(t);)t=t.data;return t||{}}function _domainArray(e){const t=_unwrap(e);return Array.isArray(t)?t:t.domains||t.tenantDomains||[]}function _idOf(e){return e.tenantDomainId||e._id||e.id||null}async function _findDomain(e,t){return _domainArray(await e.domains()).find(e=>e.hostname===t||_idOf(e)===t)||null}async function _resolveOrgId(e,t){try{const i=_unwrap(await e.availabilityGet(t)),n=i.settings&&i.settings.organizationId||i.organizationId;if(n)return n}catch{}try{const t=await e.events(),i=(Array.isArray(t)?t:t.eventTypes||t.data&&(Array.isArray(t.data)?t.data:t.data.eventTypes)||[]).find(e=>e.organization&&e.organization.id);if(i)return i.organization.id}catch{}return null}module.exports={TOOLS:TOOLS};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appoiint",
3
- "version": "4.14.1",
3
+ "version": "4.16.0",
4
4
  "description": "Appoiint CLI — schedule meetings, create rooms, join video calls. Agent-first meeting platform.",
5
5
  "bin": {
6
6
  "apo": "bin/cli.js"