UNPKG

eve

Version:

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

1 lines • 963 B
import{getHarnessEmissionState}from"#harness/emission.js";import{projectToDurableSession}from"#execution/session.js";import{hasProxyInputRequests}from"#harness/proxy-input-requests.js";const DURABLE_SESSION_VERSION=1;function readDurableSession(e){if(e.version!==1||e.snapshot?.session===void 0)throw Error(`Unsupported session checkpoint. Start a new session on this deployment.`);return e.snapshot.session}function createDurableSessionState(e){return projectDurableSessionState(projectToDurableSession(e.session))}function replaceDurableSessionSnapshot(e){return{...e.state,...projectDurableSessionState(e.session)}}function projectDurableSessionState(e){return{continuationToken:e.continuationToken,emissionState:getHarnessEmissionState(e.state),hasProxyInputRequests:hasProxyInputRequests(e.state),sessionId:e.sessionId,version:1,snapshot:{session:e}}}export{DURABLE_SESSION_VERSION,createDurableSessionState,readDurableSession,replaceDurableSessionSnapshot};