eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 1.82 kB
JavaScript
var InterruptedError=class extends Error{constructor(){super(`Interrupted`),this.name=`InterruptedError`}};function interruptedError(){return new InterruptedError}function isInterruptedError(e){return e instanceof InterruptedError}function isAbortLikeError(e){return e instanceof Error?e.name===`AbortError`||/\babort(?:ed)?\b/iu.test(e.message):!1}function failureKey(e){return`${e.data.code}:${e.data.message}`}function formatFailureMessage(e){let{code:t,message:n}=e.data;return!t||n===t||n.startsWith(`${t}:`)||n.startsWith(`${t} `)?n:`${t}: ${n}`}function failureDetails(e){let t=e.data.details;if(typeof t!=`object`||!t)return{};let n=t,r={};return typeof n.semanticErrorId==`string`&&(r.semanticErrorId=n.semanticErrorId),typeof n.hint==`string`&&n.hint.trim().length>0&&(r.hint=n.hint.trim()),typeof n.detail==`string`&&(r.detail=n.detail),r}function formatFailureHint(e){return failureDetails(e).hint}function formatFailureDetail(e){let t=failureDetails(e).detail;if(t===void 0)return;let n=t.trim();if(!(n.length===0||n===e.data.message.trim()))return n}const LOCAL_HINT_OVERRIDES={"gateway-auth-invalid-api-key":`Run /model to refresh credentials, or update AI_GATEWAY_API_KEY in .env.local (a stale shell export can shadow it).`,"gateway-auth-invalid-oidc-token":`Run /model to refresh the OIDC token, or set AI_GATEWAY_API_KEY in .env.local.`,"gateway-auth-missing-credentials":`Run /model to connect this to a project and refresh AI Gateway credentials, or set AI_GATEWAY_API_KEY manually in .env.local.`};function localFailureHint(t){let n=failureDetails(t).semanticErrorId;return n===void 0?void 0:LOCAL_HINT_OVERRIDES[n]}export{InterruptedError,failureDetails,failureKey,formatFailureDetail,formatFailureHint,formatFailureMessage,interruptedError,isAbortLikeError,isInterruptedError,localFailureHint};