UNPKG

eve

Version:

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

1 lines 894 B
const TURN_CANCELLED_ERROR_NAME=`TurnCancelledError`;var TurnCancelledError=class extends Error{constructor(e=`The turn was cancelled.`){super(e),this.name=TURN_CANCELLED_ERROR_NAME}},SessionLimitDeclinedError=class extends TurnCancelledError{sessionLimitDeclined=!0;constructor(){super(`The user declined a fresh session token budget.`)}};function isSessionLimitDecline(e){let t=e,n=new Set;for(;typeof t==`object`&&t&&!n.has(t);){if(n.add(t),t.sessionLimitDeclined===!0)return!0;t=t.cause}return!1}function isTurnCancellation(e){let t=e,n=new Set;for(;typeof t==`object`&&t&&!n.has(t);){if(n.add(t),t.name===TURN_CANCELLED_ERROR_NAME)return!0;t=t.cause}return!1}function throwIfTurnAborted(e){if(e?.aborted===!0)throw isTurnCancellation(e.reason)?e.reason:new TurnCancelledError}export{SessionLimitDeclinedError,TurnCancelledError,isSessionLimitDecline,isTurnCancellation,throwIfTurnAborted};