eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 918 B
JavaScript
import{ConversationContextKey}from"#shared/conversation-context.js";import{getAdapterKind}from"#channel/adapter.js";import{AuthKey,ChannelInstrumentationKey,ContinuationTokenKey,InitiatorAuthKey,SessionIdKey}from"#context/keys.js";import{ChannelKey}from"#runtime/sessions/runtime-context-keys.js";import{getEffectiveModelSelection}from"#context/effective-model.js";function buildResolveContext(e,t){let n=e.get(SessionIdKey)??``,r=e.get(AuthKey)??null,i=e.get(InitiatorAuthKey)??null,a=e.get(ChannelKey),o=e.get(ContinuationTokenKey),s=e.get(ChannelInstrumentationKey),c=getEffectiveModelSelection(e);return{model:c===null?null:{id:c.reference.id},session:{id:n,auth:{current:r,initiator:i}},channel:{kind:a===void 0?void 0:getAdapterKind(a),continuationToken:o,metadata:s?.metadata},...e.get(ConversationContextKey)===void 0?void 0:{conversation:e.get(ConversationContextKey)},messages:t}}export{buildResolveContext};