UNPKG

eve

Version:

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

1 lines 1.39 kB
import{normalizeAgentDefinition}from"#internal/authored-definition/core.js";import{loadResolvedModuleExport}from"#runtime/resolve-helpers.js";import{resolveBootstrapRuntimeModel}from"#runtime/agent/bootstrap-model.js";import{resolveMockAuthoredRuntimeModel,shouldMockAuthoredRuntimeModels}from"#runtime/agent/mock-model-adapter.js";async function resolveRuntimeModelReference(e,t){let i=resolveBootstrapRuntimeModel(e);if(i!==null)return i;let a=resolveMockAuthoredRuntimeModel(e);return a===null?isSourceBackedRuntimeModelReference(e)?await loadSourceBackedRuntimeModelReference(e,t):e.id:a}async function loadSourceBackedRuntimeModelReference(n,r){if(r===void 0)throw Error(`Expected a compiled module-map scope to resolve the authored runtime model "${n.id}".`);let i=normalizeAgentDefinition(await loadResolvedModuleExport({definition:n.source,kindLabel:`runtime model "${n.id}"`,moduleMap:r.moduleMap,nodeId:r.nodeId}),`Expected the authored agent config export "${n.source.exportName??`default`}" from "${n.source.logicalPath}" to match the public eve shape.`).model;if(i===void 0)throw Error(`Expected the authored agent config export "${n.source.exportName??`default`}" from "${n.source.logicalPath}" to provide a runtime model.`);return i}function isSourceBackedRuntimeModelReference(e){return e.source!==void 0}export{resolveRuntimeModelReference,shouldMockAuthoredRuntimeModels};