eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 1.26 kB
JavaScript
import{expectObjectRecord,getAuthoredModuleExport,materializeAuthoredModuleExport}from"#internal/authored-module.js";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";var ResolveAgentError=class extends Error{logicalPath;sourceId;constructor(e,t={}){super(e),this.name=`ResolveAgentError`,t.logicalPath!==void 0&&(this.logicalPath=t.logicalPath),t.sourceId!==void 0&&(this.sourceId=t.sourceId)}};function createResolvedModuleSourceRef(e){return{exportName:e.exportName,logicalPath:e.logicalPath,sourceId:e.sourceId,sourceKind:`module`}}async function loadResolvedModuleExport(n){let r=n.nodeId??ROOT_COMPILED_AGENT_NODE_ID,i=n.moduleMap.nodes[r]?.modules[n.definition.sourceId];if(i===void 0)throw new ResolveAgentError(`Missing compiled module namespace for ${n.kindLabel} source "${n.definition.sourceId}" in node "${r}".`,{logicalPath:n.definition.logicalPath,sourceId:n.definition.sourceId});return await materializeAuthoredModuleExport(getAuthoredModuleExport(expectObjectRecord(i,`Missing compiled module namespace for ${n.kindLabel} source "${n.definition.sourceId}" in node "${r}".`),{exportName:n.definition.exportName,logicalPath:n.definition.logicalPath}))}export{ResolveAgentError,createResolvedModuleSourceRef,loadResolvedModuleExport};