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(t=`The turn was cancelled.`){super(t),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(t){let n=t,r=new Set;for(;typeof n==`object`&&n&&!r.has(n);){if(r.add(n),n.name===TURN_CANCELLED_ERROR_NAME)return!0;n=n.cause}return!1}function throwIfTurnAborted(e){if(e?.aborted===!0)throw isTurnCancellation(e.reason)?e.reason:new TurnCancelledError}export{SessionLimitDeclinedError,TurnCancelledError,isSessionLimitDecline,isTurnCancellation,throwIfTurnAborted};