/** * Error Definitions for i18n Notifications * ---------------------------------------- * This file provides a set of standardized error action/type/target constants * and factory functions that enrich error objects with structured metadata. * * ## Purpose * - Attach `cause` data to `Error` objects for vue-i18n. * - Generate consistent i18n keys in the form: * notify.error.{action}.{type}[.{target}] * - Provide contextual data (e.g., beatIndex, fileName, agentName) for use in * translation strings. * * ## Constants * - `type`: describes the error type (e.g., fileNotExist, urlFileNotFound). * - `action`: the operation being performed (e.g., movie, image, audio). * - `target`: the resource involved (e.g., audioFile, imageFile). * * ## Factory Functions * Each factory function (e.g., getAudioInputIdsError, audioCheckerError) returns * a plain object with: * - `type` → error type constant * - `action` → action constant * - `target` → target constant (optional) * - `agentName` → name of the agent/tool that produced the error * - `beatIndex` → index of the beat in the current script * - `fileName` → file name or identifier (if relevant) * * ## i18n Integration * - The UI consumes the generated `{ action, type, target, ... }` to build the i18n key. * - Example: * notify.error.movie.fileNotExist.audioFile * - Interpolation values (beatIndex, fileName, etc.) are passed as `data` for * translations. * * ## Notes * - If `target` is not required, omit it. * - When adding new actions/types/targets, check for consistency with existing ones. * - Use descriptive but concise names to avoid translation conflicts. * * ## Usage in Error Handling * - When throwing manually: * `throw new Error("message", { cause });` * - When using assertions: * `assert(condition, message, false, causeObject);` * (set the 3rd parameter to `false` and pass the `cause` object as the 4th) */ export declare const urlFileNotFoundType = "urlFileNotFound"; export declare const fileNotExistType = "fileNotExist"; export declare const unknownMediaType = "unknownMedia"; export declare const sourceUndefinedType = "undefinedSourceType"; export declare const apiErrorType = "apiError"; export declare const apiKeyInvalidType = "apiKeyInvalid"; export declare const apiRateLimitErrorType = "apiRateLimit"; export declare const apiKeyMissingType = "apiKeyMissing"; export declare const invalidResponseType = "invalidResponse"; export declare const voiceLimitReachedType = "voice_limit_reached"; export declare const movieAction = "movie"; export declare const imageAction = "images"; export declare const audioAction = "audio"; export declare const imageReferenceAction = "imageReference"; export declare const translateAction = "translate"; export declare const audioFileTarget = "audioFile"; export declare const imageFileTarget = "imageFile"; export declare const movieFileTarget = "movieFile"; export declare const videoDurationTarget = "videoDuration"; export declare const unsupportedModelTarget = "unsupportedModel"; export declare const multiLingualFileTarget = "multiLingualFile"; export declare const videoSourceTarget = "videoSource"; export declare const audioSourceTarget = "audioSource"; export declare const codeTextTarget = "codeText"; export declare const agentFileNotExistError: (agentName: string, action: string, target: string, fileName: string, beatIndex?: number) => { beatIndex?: number | undefined; type: string; action: string; target: string; agentName: string; fileName: string; }; export declare const getAudioInputIdsError: (index: number, fileName: string) => { beatIndex?: number | undefined; type: string; action: string; target: string; agentName: string; fileName: string; }; export declare const audioCheckerError: (index: number, fileName: string) => { beatIndex?: number | undefined; type: string; action: string; target: string; agentName: string; fileName: string; }; export declare const createVideoFileError: (index: number, fileName: string) => { beatIndex?: number | undefined; type: string; action: string; target: string; agentName: string; fileName: string; }; export declare const createVideoSourceError: (index: number) => { type: string; action: string; target: string; agentName: string; beatIndex: number; }; export declare const invalidAudioSourceError: (beatIndex: number) => { type: string; action: string; target: string; agentName: string; beatIndex: number; }; export declare const downLoadReferenceImageError: (key: string, url: string) => { type: string; action: string; target: string; agentName: string; key: string; url: string; }; export declare const downloadImagePluginError: (url: string, imageType: string) => { type: string; action: string; target: string; agentName: string; url: string; }; export declare const getTextError: (url: string) => { type: string; action: string; target: string; agentName: string; url: string; }; export declare const imageReferenceUnknownMediaError: (key: string) => { type: string; action: string; key: string; }; export declare const imagePluginUnknownMediaError: (imageType: string) => { type: string; action: string; target: string; }; export declare const mediaSourceToDataUrlError: (url: string) => { type: string; action: string; target: string; agentName: string; url: string; }; export declare const mediaSourceFileNotFoundError: (filePath: string) => { type: string; action: string; target: string; agentName: string; fileName: string; }; export declare const mediaSourceUnknownKindError: () => { type: string; action: string; agentName: string; }; export declare const apiKeyMissingError: (agentName: string, action: string, envVarName: string) => { type: string; action: string; agentName: string; envVarName: string; }; export declare const agentGenerationError: (agentName: string, action: string, target: string, beatIndex?: number) => { beatIndex?: number | undefined; type: string; action: string; target: string; agentName: string; }; export declare const openAIAgentGenerationError: (agentName: string, action: string, errorCode: string, errorType: string, beatIndex?: number) => { beatIndex?: number | undefined; type: string; action: string; agentName: string; errorCode: string; errorType: string; }; export declare const agentIncorrectAPIKeyError: (agentName: string, action: string, target: string, beatIndex?: number) => { beatIndex?: number | undefined; type: string; action: string; target: string; agentName: string; }; export declare const agentVoiceLimitReachedError: (agentName: string, action: string, target: string) => { type: string; action: string; target: string; agentName: string; }; export declare const agentAPIRateLimitError: (agentName: string, action: string, target: string, beatIndex?: number) => { beatIndex?: number | undefined; type: string; action: string; target: string; agentName: string; }; export declare const agentInvalidResponseError: (agentName: string, action: string, target: string, beatIndex?: number) => { beatIndex?: number | undefined; type: string; action: string; target: string; agentName: string; }; export declare const translateApiKeyMissingError: () => { type: string; action: string; agentName: string; envVarName: string; }; export declare const hasCause: (err: unknown) => err is Error & { cause: unknown; }; type Result = { ok: true; value: T; } | { ok: false; error: Error; }; export declare function resultify(fn: () => Promise): Promise>; export declare const getGenAIErrorReason: (error: Error) => any; export {};