UNPKG

eve

Version:

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

1 lines 1.16 kB
import{stripLogicalPathExtension}from"#discover/filesystem.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{normalizeToolDefinition}from"#internal/authored-definition/schema-backed.js";async function compileToolEntry(e,t,n={}){let r=normalizeToolDefinition(await loadModuleBackedDefinition({agentRoot:e,externalDependencies:n.externalDependencies,kind:`tool`,source:t}),`Expected the tool export "${t.exportName??`default`}" from "${t.logicalPath}" to match the public eve shape.`),i=stripLogicalPathExtension(t.logicalPath).replace(/^tools\//,``).replaceAll(`/`,`-`);return r.kind===`disabled`?{kind:`disabled`,name:i}:r.kind===`enable-workflow`?{kind:`enable-workflow`}:r.kind===`dynamic-tool`?{kind:`dynamic-tool`,definition:{eventNames:[...r.eventNames],exportName:t.exportName,logicalPath:t.logicalPath,slug:i,sourceId:t.sourceId,sourceKind:`module`}}:{kind:`tool`,definition:{description:r.definition.description,exportName:t.exportName,inputSchema:r.definition.inputSchema??null,logicalPath:t.logicalPath,name:i,outputSchema:r.definition.outputSchema,sourceId:t.sourceId,sourceKind:`module`}}}export{compileToolEntry};