UNPKG

eve

Version:

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

1 lines 630 B
import{dispatchTurnStep}from"#execution/workflow-steps.js";import{TurnControlReceiver}from"#execution/turn-control-receiver.js";async function dispatchAndAwaitTurn(t){let n=new TurnControlReceiver({bufferedDeliveries:t.bufferedDeliveries,deliveryHook:t.deliveryHook,token:t.controlToken});try{return await dispatchTurnStep({capabilities:t.capabilities,completionToken:n.token,delivery:t.delivery,mode:t.mode,parentWritable:t.parentWritable,serializedContext:t.serializedContext,sessionState:t.sessionState}),{action:await n.waitForAction(),dispose:()=>n.dispose()}}catch(e){throw await n.dispose(),e}}export{dispatchAndAwaitTurn};