eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
2 lines • 1.21 kB
JavaScript
import{isJsonObjectValue}from"#shared/json.js";function normalizeRequestedOutputSchema(e){return isJsonObjectValue(e)&&Object.keys(e).length>0?e:void 0}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(e){switch(e.type){case`runtime`:return formatSubagentInputByType.runtime(e);case`local`:return formatSubagentInputByType.local(e);case`remote`:return formatSubagentInputByType.remote(e);default:return e}}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 result directly. The caller may send follow-up messages after you answer.`,``,`Caller message:`,e.message].join(`
`)}}function formatDescriptionLines(e){return e.trim().length>0?[`Description: ${e}`]:[]}export{formatSubagentInput,normalizeRequestedOutputSchema};