UNPKG

eve

Version:

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

1 lines 4.4 kB
import{resolveModelEndpointStatus}from"#internal/resolve-model-endpoint-status.js";import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";import{WORKFLOW_TOOL_NAME}from"#shared/workflow-sandbox.js";import{getAllFrameworkChannelNames,getFrameworkChannelDefinitions}from"#runtime/framework-channels/index.js";import{getAllFrameworkToolNames}from"#runtime/framework-tools/index.js";import{createConnectionSearchResolver}from"#runtime/framework-tools/connection-search-dynamic.js";import{buildFrameworkToolInfo,getRootDelegationToolNames,renderChannel,renderDynamicResolver,renderSchedule,renderSubagent,toSource}from"#internal/nitro/routes/agent-info/build-agent-info-response.js";function buildAgentInfoResponseFromManifest(i,a){let o=i.manifest,s=o.channels.filter(e=>e.kind===`channel`),c=o.channels.filter(e=>e.kind===`disabled`).map(e=>e.name),l=new Set(o.tools.map(e=>e.name)),u=new Set(o.disabledFrameworkTools),d=getAllFrameworkToolNames(),f=getAllFrameworkChannelNames(),p=getFrameworkChannelDefinitions(),m=o.tools.map(e=>({...toSource(e),description:e.description,hasAuth:!1,hasCompactionHook:!1,hasExecute:!0,hasModelOutputProjection:!1,hasOutputSchema:e.outputSchema!==void 0&&e.outputSchema!==null,inputSchema:e.inputSchema,name:e.name,origin:`authored`,outputSchema:e.outputSchema??null,replacesFrameworkTool:d.has(e.name),requiresApproval:!1})),h=new Set(s.map(e=>e.name)),g=new Set(c),_=p.filter(e=>!h.has(e.name)&&!g.has(e.name)),v=buildFrameworkToolInfo({authoredToolNames:l,delegationToolNames:getRootDelegationToolNames(o),disabledFrameworkToolNames:u}),y=s.map(e=>({...toSource(e),adapterKind:e.adapterKind,method:e.method,name:e.name,origin:`authored`,urlPath:e.urlPath}));return{agent:{agentRoot:o.agentRoot,appRoot:o.appRoot,configSource:o.config.source?toSource(o.config.source):void 0,description:o.config.description,model:{contextWindowTokens:o.config.model.contextWindowTokens,id:o.config.model.id,providerOptions:o.config.model.providerOptions,reasoning:o.config.reasoning,source:o.config.model.source?toSource(o.config.model.source):void 0,routing:o.config.model.routing,endpoint:resolveModelEndpointStatus(o.config.model.routing,a.gatewayCredentials)},name:o.config.name,outputSchema:o.config.outputSchema},capabilities:{devRoutes:a.mode===`development`},channels:{authored:y,available:[..._.map(e=>renderChannel(e,{origin:`framework`})),...y],disabledFramework:c,framework:p.filter(e=>f.has(e.name)).map(e=>{let t=h.has(e.name),n=g.has(e.name),r=n?`disabled`:t?`replaced`:`active`;return{...renderChannel(e,{origin:`framework`}),disabledByAuthor:n,replacedByAuthoredChannel:t,status:r}})},connections:o.connections.map(e=>({...toSource(e),connectionName:e.connectionName,description:e.description,hasApproval:!1,hasAuthorization:e.vercelConnect!==void 0,hasHeaders:!1,protocol:e.protocol,url:e.url})),diagnostics:{discoveryErrors:o.diagnosticsSummary.errors,discoveryWarnings:o.diagnosticsSummary.warnings},hooks:o.hooks.map(e=>({...toSource(e),eventNames:[],slug:e.slug})),instructions:{dynamic:o.dynamicInstructions.map(e=>renderDynamicResolver(e,{origin:`authored`})),static:o.instructions===void 0?null:{...toSource(o.instructions),markdown:o.instructions.markdown,name:o.instructions.name}},kind:`eve-agent-info`,mode:a.mode,sandbox:o.sandbox===null?null:{...toSource(o.sandbox),description:o.sandbox.description,hasBootstrap:!1,hasOnSession:!1,revalidationKey:o.sandbox.revalidationKey,sourceHash:o.sandbox.sourceHash},schedules:i.schedules.map(renderSchedule),skills:{static:o.skills.map(e=>({...toSource(e),description:e.description,license:e.license,markdown:e.markdown,metadata:e.metadata,name:e.name})),dynamic:o.dynamicSkills.map(e=>renderDynamicResolver(e,{origin:`authored`}))},subagents:{local:o.subagents.map(renderSubagent),total:o.subagents.length},tools:{available:[...v.available,...m],authored:m,disabledFramework:[...o.disabledFrameworkTools],dynamic:[...o.connections.length>0?[renderDynamicResolver(createConnectionSearchResolver(),{origin:`framework`})]:[],...o.dynamicTools.map(e=>renderDynamicResolver(e,{origin:`authored`}))],framework:v.framework,reserved:[WORKFLOW_TOOL_NAME,LOAD_SKILL_TOOL_NAME]},version:1,workflow:{enabled:o.workflowTool!==void 0,toolName:WORKFLOW_TOOL_NAME},workspace:{resourceRoot:o.workspaceResourceRoot,rootEntries:[...o.workspaceResourceRoot.rootEntries]}}}export{buildAgentInfoResponseFromManifest};