UNPKG

@entro314labs/ai-changelog-generator

Version:

AI-powered changelog generator with MCP server support - works with most providers, online and local models

32 lines (31 loc) 1.78 kB
/** * Classification of AI provider failures into a small, actionable set. * * The value is deciding two things the caller cannot infer from a message * string: whether retrying could plausibly succeed (`retryable`), and whether a * different model/provider should be tried instead (`shouldFallback`). Rule-based * changelog generation is always available as a floor, so a permanent failure * should stop wasting time rather than retry a request that will never succeed. * * Deliberately narrower than a hosted-service taxonomy: this is a local CLI with * no ledger, no tenants and no per-request budgets, so codes exist only where * they change behaviour or the advice shown to the user. */ export type AiErrorCode = 'auth_failed' | 'forbidden' | 'model_missing' | 'quota_exceeded' | 'rate_limited' | 'context_limit_exceeded' | 'content_filtered' | 'timed_out' | 'cancelled' | 'network_error' | 'provider_unavailable' | 'request_invalid' | 'not_configured' | 'output_truncated' | 'no_output' | 'unknown'; export interface ClassifiedAiError { code: AiErrorCode; /** True when the identical request could succeed on a later attempt. */ retryable: boolean; /** True when a different model or provider is the sensible next step. */ shouldFallback: boolean; message: string; suggestions: string[]; } /** * Order matters: the most specific and most actionable signals are checked * first, and HTTP status is preferred over message matching where available * because provider prose changes far more often than status codes. */ export declare function classifyAiError(error: unknown): ClassifiedAiError; /** True when re-issuing the identical request could plausibly succeed. */ export declare function isRetryableAiError(error: unknown): boolean;