{"version":3,"file":"transcription-errors.mjs","names":[],"sources":["../src/transcription-errors.ts"],"sourcesContent":["/**\n * Error codes for transcription HTTP responses.\n * Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.\n * These codes are returned by the runtime and parsed by the client.\n */\nexport enum TranscriptionErrorCode {\n  /** Transcription service not configured in runtime */\n  SERVICE_NOT_CONFIGURED = \"service_not_configured\",\n  /** Audio format not supported */\n  INVALID_AUDIO_FORMAT = \"invalid_audio_format\",\n  /** Audio file is too long */\n  AUDIO_TOO_LONG = \"audio_too_long\",\n  /** Audio file is empty or too short */\n  AUDIO_TOO_SHORT = \"audio_too_short\",\n  /** Rate limited by transcription provider */\n  RATE_LIMITED = \"rate_limited\",\n  /** Authentication failed with transcription provider */\n  AUTH_FAILED = \"auth_failed\",\n  /** Transcription provider returned an error */\n  PROVIDER_ERROR = \"provider_error\",\n  /** Network error during transcription */\n  NETWORK_ERROR = \"network_error\",\n  /** Invalid request format */\n  INVALID_REQUEST = \"invalid_request\",\n}\n\n/**\n * Error response format returned by the transcription endpoint.\n */\nexport interface TranscriptionErrorResponse {\n  error: TranscriptionErrorCode;\n  message: string;\n  retryable?: boolean;\n}\n\n/**\n * Helper functions to create transcription error responses.\n * Used by the runtime to return consistent error responses.\n */\nexport const TranscriptionErrors = {\n  serviceNotConfigured: (): TranscriptionErrorResponse => ({\n    error: TranscriptionErrorCode.SERVICE_NOT_CONFIGURED,\n    message: \"Transcription service is not configured\",\n    retryable: false,\n  }),\n\n  invalidAudioFormat: (\n    format: string,\n    supported: string[],\n  ): TranscriptionErrorResponse => ({\n    error: TranscriptionErrorCode.INVALID_AUDIO_FORMAT,\n    message: `Unsupported audio format: ${format}. Supported: ${supported.join(\", \")}`,\n    retryable: false,\n  }),\n\n  invalidRequest: (details: string): TranscriptionErrorResponse => ({\n    error: TranscriptionErrorCode.INVALID_REQUEST,\n    message: details,\n    retryable: false,\n  }),\n\n  rateLimited: (): TranscriptionErrorResponse => ({\n    error: TranscriptionErrorCode.RATE_LIMITED,\n    message: \"Rate limited. Please try again later.\",\n    retryable: true,\n  }),\n\n  authFailed: (): TranscriptionErrorResponse => ({\n    error: TranscriptionErrorCode.AUTH_FAILED,\n    message: \"Authentication failed with transcription provider\",\n    retryable: false,\n  }),\n\n  providerError: (message: string): TranscriptionErrorResponse => ({\n    error: TranscriptionErrorCode.PROVIDER_ERROR,\n    message,\n    retryable: true,\n  }),\n\n  networkError: (\n    message: string = \"Network error during transcription\",\n  ): TranscriptionErrorResponse => ({\n    error: TranscriptionErrorCode.NETWORK_ERROR,\n    message,\n    retryable: true,\n  }),\n\n  audioTooLong: (): TranscriptionErrorResponse => ({\n    error: TranscriptionErrorCode.AUDIO_TOO_LONG,\n    message: \"Audio file is too long\",\n    retryable: false,\n  }),\n\n  audioTooShort: (): TranscriptionErrorResponse => ({\n    error: TranscriptionErrorCode.AUDIO_TOO_SHORT,\n    message: \"Audio is too short to transcribe\",\n    retryable: false,\n  }),\n};\n"],"mappings":";;;;;;AAKA,IAAY,0EAAL;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;;;;;;AAgBF,MAAa,sBAAsB;CACjC,6BAAyD;EACvD,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,qBACE,QACA,eACgC;EAChC,OAAO,uBAAuB;EAC9B,SAAS,6BAA6B,OAAO,eAAe,UAAU,KAAK,KAAK;EAChF,WAAW;EACZ;CAED,iBAAiB,aAAiD;EAChE,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,oBAAgD;EAC9C,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,mBAA+C;EAC7C,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,gBAAgB,aAAiD;EAC/D,OAAO,uBAAuB;EAC9B;EACA,WAAW;EACZ;CAED,eACE,UAAkB,0CACc;EAChC,OAAO,uBAAuB;EAC9B;EACA,WAAW;EACZ;CAED,qBAAiD;EAC/C,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,sBAAkD;EAChD,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CACF"}