/** * OpenAI's error envelope, shared by every route. * * In one place because it is a contract, not a convenience. A client written against their API reads * `err.error.message`, so an error that answers with a bare string — as the framework's own notFound * and onError handlers did until 2026-08-16 — does not merely return the wrong status: it breaks the * parse. A caller checking `type` sees nothing at all. */ export const openaiError = (message: string, type: string, param?: string) => ({ error: { message, type, param: param ?? null, code: null }, }); /** Ids come back to us from our own responses; anything else never named a job that could exist. */ export const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;