eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 1.35 kB
JavaScript
import{isPromptControlCommand}from"./prompt-commands.js";import{truncate}from"./tool-format.js";const AGENT_HEADER_TIPS=[`Use /channels to add more ways to reach your agent.`,`Use /deploy to see your agent go live.`,`Type /help to see every command.`,`Tip: /connect to seamlessly add MCP Connections to your agent`];function pickAgentHeaderTip(e=Math.random){return AGENT_HEADER_TIPS[Math.min(AGENT_HEADER_TIPS.length-1,Math.floor(e()*AGENT_HEADER_TIPS.length))]}function buildAgentHeader(e){let{theme:n,info:r,name:i,width:a}=e,o=n.colors,s=[],c=o.bold(`eve`);if(s.push(` ${c} ${o.dim(truncate(i,Math.max(8,a-8)))}`),r&&(r.diagnostics.discoveryErrors>0||r.diagnostics.discoveryWarnings>0)){let e=[];r.diagnostics.discoveryErrors>0&&e.push(o.red(`${r.diagnostics.discoveryErrors} error${plural(r.diagnostics.discoveryErrors)}`)),r.diagnostics.discoveryWarnings>0&&e.push(o.yellow(`${r.diagnostics.discoveryWarnings} warning${plural(r.diagnostics.discoveryWarnings)}`)),s.push(` ${o.dim(n.glyph.warning)} ${e.join(o.dim(` · `))}`)}return e.tip!==void 0&&s.push(` ${renderTip(e.tip,Math.max(8,a-2),n)}`),s}function renderTip(n,r,i){return truncate(n,r).split(/(\/[a-z:-]+)/u).map(t=>isPromptControlCommand(t)?i.colors.blue(t):i.colors.dim(t)).join(``)}function plural(e){return e===1?``:`s`}export{AGENT_HEADER_TIPS,buildAgentHeader,pickAgentHeaderTip};