eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 1.44 kB
JavaScript
import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{createDurableSessionState,readDurableSession}from"#execution/durable-session-store.js";import{hydrateDurableSession}from"#execution/session.js";import{deserializeContext}from"#context/serialize.js";import{buildRuntimeActionFromInterrupt}from"#harness/code-mode-runtime-action-state.js";import{getPendingCodeModeInterrupt}from"#harness/code-mode-interrupt-state.js";import{setPendingRuntimeActionBatch}from"#harness/runtime-actions.js";import{dispatchRuntimeActionsStep}from"#execution/dispatch-runtime-actions-step.js";async function dispatchCodeModeRuntimeActionsStep(e){"use step";let t=await readDurableSession(e.sessionState),n=getPendingCodeModeInterrupt(t.state);if(n===void 0)return{results:[],sessionState:e.sessionState};let r=buildRuntimeActionFromInterrupt(n.interrupt),i=(await deserializeContext(e.serializedContext)).require(BundleKey),a=hydrateDurableSession({compactionOverrides:{thresholdPercent:i.resolvedAgent.config.compaction?.thresholdPercent},durable:t,turnAgent:i.turnAgent}),o=createDurableSessionState({session:setPendingRuntimeActionBatch({actions:[r],event:{sequence:0,stepIndex:0,turnId:`code-mode-dispatch`},responseMessages:[],session:a})});return dispatchRuntimeActionsStep({callbackBaseUrl:e.callbackBaseUrl,parentWritable:e.parentWritable,serializedContext:e.serializedContext,sessionState:o})}export{dispatchCodeModeRuntimeActionsStep};