eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
2 lines • 979 B
JavaScript
const formatSubagentInputByType={runtime(e){return formatSubagentPrompt({descriptionLines:[],message:e.message,name:e.name})},local(e){return formatSubagentPrompt({descriptionLines:formatDescriptionLines(e.description),message:e.message,name:e.name})},remote(e){return formatSubagentPrompt({descriptionLines:formatDescriptionLines(e.description),message:e.message,name:e.name})}};function formatSubagentInput(t){switch(t.type){case`runtime`:return formatSubagentInputByType.runtime(t);case`local`:return formatSubagentInputByType.local(t);case`remote`:return formatSubagentInputByType.remote(t);default:return t}}function formatSubagentPrompt(e){return{message:[`You are the subagent "${e.name}".`,...e.descriptionLines,``,`The caller delegated the following task to you. Complete it and return the final result directly.`,``,`Caller message:`,e.message].join(`
`)}}function formatDescriptionLines(e){return e.trim().length>0?[`Description: ${e}`]:[]}export{formatSubagentInput};