UNPKG

eve

Version:

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

1 lines 1.28 kB
import{formatError}from"#internal/logging.js";import{isPlainRecord,isThenable}from"#shared/guards.js";import{parseJsonObject}from"#shared/json.js";const FRAMEWORK_CHANNEL_KINDS=new Set([`http`,`schedule`,`subagent`]);function isInstrumentationChannelKind(e){return e.startsWith(`channel:`)||FRAMEWORK_CHANNEL_KINDS.has(e)}function normalizeInstrumentationChannelKind(e){return e!==void 0&&isInstrumentationChannelKind(e)?e:`unknown`}function resolveInstrumentationProjection(e){let{invoke:t,log:n,source:r}=e,i;try{i=t()}catch(e){n.warn(`ignoring instrumentation projection after projector failure`,{error:formatError(e),source:r});return}if(isThenable(i)){n.warn(`ignoring instrumentation projection because it returned a Promise`,{source:r}),Promise.resolve(i).catch(e=>{n.warn(`ignored instrumentation projection Promise rejected`,{error:formatError(e),source:r})});return}if(i!==void 0){if(!isPlainRecord(i)){n.warn(`ignoring instrumentation projection because it is not a record`,{source:r});return}try{return parseJsonObject(i)}catch(e){n.warn(`ignoring instrumentation projection because it is outside the JSON contract`,{error:formatError(e),source:r});return}}}export{isInstrumentationChannelKind,normalizeInstrumentationChannelKind,resolveInstrumentationProjection};