UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

2 lines 1.44 kB
import{parseTwilioWebhookBody}from"#compiled/@chat-adapter/twilio/webhook.js";import{parseTwilioVoiceCall as parseTwilioVoiceCall$1,parseTwilioVoiceTranscription as parseTwilioVoiceTranscription$1}from"#compiled/@chat-adapter/twilio/voice.js";function parseTwilioTextMessage(t){let n=parseTwilioWebhookBody(t);return n.kind===`text`?{accountSid:n.accountSid,body:n.body,from:n.from,media:n.media,messageSid:n.messageSid,raw:n.raw,to:n.to}:null}function parseTwilioVoiceCall(e){let n=parseTwilioVoiceCall$1(e);return n?{accountSid:n.accountSid,callSid:n.callSid,from:n.from,raw:n.raw,to:n.to}:null}function parseTwilioVoiceTranscription(e){let t=parseTwilioVoiceTranscription$1(e);return t?.from?{callSid:t.callSid,confidence:t.confidence,from:t.from,raw:t.raw,text:t.text,to:t.to,transcriptionSid:t.transcriptionSid}:null}function formatTwilioContextBlock(e){return[`<twilio_context>`,`channel: ${e.channel}`,`response_medium: sms`,`response_instructions: Reply for SMS in plain text. Keep the response concise and avoid Markdown formatting, tables, headings, code fences, and long lists. Ask at most one short follow-up question when more information is needed.`,`from: ${e.from}`,...e.to?[`to: ${e.to}`]:[],...e.messageSid?[`message_sid: ${e.messageSid}`]:[],...e.callSid?[`call_sid: ${e.callSid}`]:[],`</twilio_context>`].join(` `)}export{formatTwilioContextBlock,parseTwilioTextMessage,parseTwilioVoiceCall,parseTwilioVoiceTranscription};