eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
2 lines • 1.44 kB
JavaScript
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(e){let t=parseTwilioWebhookBody(e);return t.kind===`text`?{accountSid:t.accountSid,body:t.body,from:t.from,media:t.media,messageSid:t.messageSid,raw:t.raw,to:t.to}:null}function parseTwilioVoiceCall(e){let t=parseTwilioVoiceCall$1(e);return t?{accountSid:t.accountSid,callSid:t.callSid,from:t.from,raw:t.raw,to:t.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};