v0.0.2
Breaking
- POST methods (
humanize,detect) no longer retry on 5xx or network errors by default. SetretryOnPost: trueto opt in.429still retries on every method. - Empty or whitespace
HUMANTONE_API_KEYis now treated as unset (errorCode: 'missing_api_key') instead of malformed ('invalid_api_key_format'). Same forHUMANTONE_BASE_URL. err.detailson JSON parse failures is now an object{ rawBody, parseError }instead of a string.
Fixed
- Error parser now falls back to HTTP status when verbatim message does not match the catalog. Unknown
401/403/404messages map correctly toAuthenticationError/PermissionError/NotFoundError. - Response shape validation: malformed
ai_score,content,credits_used,output_formatnow raiseerrorCode: 'invalid_response_shape'instead of crashing. request_idresolution: bodyrequest_idfirst, thenX-Request-Idheader, elsenull.Retry-Afterparses both numeric seconds and HTTP-date format.- Constructor errors now use distinct
errorCodevalues:missing_api_keyandinvalid_api_key_format. - Custom
userAgentconfig is appended to default with a single space; whitespace-only is ignored. output_formatdefaults to'text'(SDK override of API default'html').
Added
- 49-test unit suite via
node --test, zero external dev dependencies. - README sections: Retries, error code groups, API-key safety note.
Compatibility
Node.js 18, 20, 22. Bun. AWS Lambda Node runtime.