eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 620 B
JavaScript
import{fetchGatewayModelIds}from"../gateway-models.js";function preflight(t){let n=t.deps??{fetchGatewayModelIds};return{id:`preflight`,async gather({state:e}){return t.headless?{model:e.modelId.length>0?e.modelId:null}:{model:null}},async perform({input:e}){return e.model!==null&&await validateModel(n,e.model,t.cwd),null},apply(e){return e}}}async function validateModel(e,t,n){let r=await e.fetchGatewayModelIds(n);if(!(r===null||r.has(t)))throw Error(`Model "${t}" is not in the AI Gateway catalog. Pass a model id from https://ai-gateway.vercel.sh/v1/models (e.g. anthropic/claude-sonnet-4.6).`)}export{preflight};