UNPKG

eve

Version:

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

1 lines 2.57 kB
import{allOf,anyOf,messageMatches,nameIs,typeIs}from"../rule.js";const GATEWAY_AUTH_FAILURE_SUMMARY_NAME=`AI Gateway authentication failed`,gatewayAuthenticationFailure=anyOf(nameIs(`GatewayAuthenticationError`),typeIs(`authentication_error`),messageMatches(/AI Gateway authentication/i)),GATEWAY_RULES=[{id:`gateway-auth-invalid-api-key`,name:GATEWAY_AUTH_FAILURE_SUMMARY_NAME,tags:[`gateway`,`config`],when:allOf(gatewayAuthenticationFailure,messageMatches(/Invalid API key/i)),message:`AI Gateway rejected the provided API key.`,hint:"Update or unset `AI_GATEWAY_API_KEY` (check your shell profile if you did not set it for this project) — manage keys at https://vercel.com/dashboard/ai/api-keys. Unsetting it falls back to OIDC via `eve link`."},{id:`gateway-auth-invalid-oidc-token`,name:GATEWAY_AUTH_FAILURE_SUMMARY_NAME,tags:[`gateway`,`config`],when:allOf(gatewayAuthenticationFailure,messageMatches(/Invalid OIDC token/i)),message:`AI Gateway rejected the OIDC token.`,hint:"Run `eve link` to refresh `VERCEL_OIDC_TOKEN` in `.env.local`, or set `AI_GATEWAY_API_KEY` — create a key at https://vercel.com/dashboard/ai/api-keys."},{id:`gateway-auth-missing-credentials`,name:GATEWAY_AUTH_FAILURE_SUMMARY_NAME,tags:[`gateway`,`config`],when:gatewayAuthenticationFailure,message:`AI Gateway received no credentials.`,hint:"Run `eve link` to populate `VERCEL_OIDC_TOKEN`, or set `AI_GATEWAY_API_KEY` — create a key at https://vercel.com/dashboard/ai/api-keys."},{id:`model-not-found`,name:`Model not found`,tags:[`gateway`,`config`],when:anyOf(nameIs(`GatewayModelNotFoundError`,`AI_NoSuchModelError`),typeIs(`model_not_found`)),message:`The requested model is not available.`,hint:"Check the model id in `agent.ts` (`model:`) or switch models with `/model` in `eve dev` — browse available models at https://vercel.com/ai-gateway/models."},{id:`gateway-rate-limited`,name:`AI Gateway rate limit exceeded`,tags:[`gateway`,`transient`],when:anyOf(nameIs(`GatewayRateLimitError`),typeIs(`rate_limit_exceeded`)),message:`AI Gateway rate-limited the request.`,hint:`Retries are automatic; if it persists, reduce request volume or review your plan limits at https://vercel.com/ai-gateway.`},{id:`gateway-upstream-unavailable`,name:`Model provider unavailable`,tags:[`gateway`,`transient`],when:anyOf(nameIs(`GatewayTimeoutError`),typeIs(`timeout_error`,`overloaded_error`)),message:`The model provider is overloaded or timing out upstream of AI Gateway.`,hint:"This is transient — retry shortly, or switch models with `/model` in `eve dev`."}];export{GATEWAY_RULES};