UNPKG

eve

Version:

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

1 lines 929 B
import{RuntimeRegistry}from"#internal/runtime-registry.js";async function createRuntimeToolRegistry(t,n={}){let r=[],i=new RuntimeRegistry(`tool`,n.reservedToolNames??[]);for(let e of t.tools){let t=await createPreparedRuntimeTool(e);i.register(e.name,{definition:e,prepared:t},{location:{logicalPath:e.logicalPath,sourceId:e.sourceId},duplicateMessage:`Found multiple authored tools named "${e.name}". Tool names must be unique at runtime.`,reservedMessage:`Tool "${e.name}" collides with another runtime-visible tool name.`}),r.push(t)}return{preparedTools:r,toolsByName:i.asMap()}}function findRegisteredRuntimeTool(e,t){return e.toolsByName.get(t)??null}async function createPreparedRuntimeTool(e){return{description:e.description,inputSchema:e.inputSchema,kind:`authored-tool`,logicalPath:e.logicalPath,name:e.name,outputSchema:e.outputSchema,sourceId:e.sourceId}}export{createRuntimeToolRegistry,findRegisteredRuntimeTool};