UNPKG

eve

Version:

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

1 lines 1.72 kB
import{join}from"node:path";import{pathExists}from"#setup/path-exists.js";function modelProviderAccess(e){let t=e.info?.agent.model.endpoint;return t?.kind===`external`?`configured`:t?.kind===`gateway`?t.connected?`configured`:`unconfigured`:e.info?.agent.model.routing?.kind===`external`||e.env.AI_GATEWAY_API_KEY||e.env.VERCEL_OIDC_TOKEN?`configured`:`unknown`}const BOOT_DETECTIONS=[{id:`model-provider`,async detect({appRoot:n,env:r,info:i}){let a=modelProviderAccess({env:r,info:i});if(a===`configured`)return[];let o=await pathExists(join(n,`.vercel`,`project.json`));return a===`unconfigured`?[{kind:`model-provider-unconfigured`,label:o?`AI Gateway credentials missing`:`model provider not linked`,command:`/model`}]:o?[{kind:`attention`,label:`AI Gateway credentials missing`,command:`/model`}]:[{kind:`attention`,label:`model provider not linked`,command:`/model`}]}}],LOGIN_SETUP_ISSUE={kind:`attention`,label:`not logged in`,command:`/login`},CLI_MISSING_SETUP_ISSUE={kind:`attention`,label:`Vercel CLI not found`,command:`/vc`};async function detectSetupIssues(e,t=BOOT_DETECTIONS){return(await Promise.all(t.map(async t=>{try{return await t.detect(e)}catch{return[]}}))).flat()}function orderedSetupIssues(e,t){return t===void 0?[...e]:[t,...e]}function automaticSetupCommand(e){return e.some(e=>e.kind===`model-provider-unconfigured`)?{prompt:`/model`,initialModelStep:`provider`}:void 0}function formatSetupIssuesLine(e){let t=e.length===1?`setup issue`:`setup issues`,n=e.map(e=>`${e.label} · ${e.command}`).join(`, `);return`${e.length} ${t}: ${n}`}export{BOOT_DETECTIONS,CLI_MISSING_SETUP_ISSUE,LOGIN_SETUP_ISSUE,automaticSetupCommand,detectSetupIssues,formatSetupIssuesLine,orderedSetupIssues};