🤖 [Experimental] SDK Quality Improvements - Error Types, Docs & Timeout Support#114
Open
🤖 [Experimental] SDK Quality Improvements - Error Types, Docs & Timeout Support#114
Conversation
This PR includes several improvements identified in an SDK quality audit: ## Changes ### Error Handling - Add specialized error subclasses: RateLimitError, AuthenticationError, ValidationError, TimeoutError, NotFoundError, ServerError - Each error type includes relevant metadata (retryAfter, field, timeoutMs, etc.) ### Documentation - Complete JSDoc documentation for ResearchClient (was 0% documented) - Add @throws annotations to key methods - Comprehensive README rewrite with modern API patterns - Remove deprecated method examples (searchAndContents, findSimilarAndContents) ### Streaming - Add configurable timeout support to streamAnswer() via timeoutMs option - Implement AbortController for proper stream cancellation - Add per-read timeout protection to prevent hung connections ### Package - Add engines field requiring Node.js >= 18.0.0 ## Testing - All 65 unit tests passing - Build successful (CJS, ESM, DTS) 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Use type erasure via Function to avoid excessively deep type instantiation when zod-to-json-schema's complex recursive types interact with TypeScript - Use repo-local TypeScript (npx tsc) instead of globally installed version in CI workflow for consistent compilation behavior Co-Authored-By: conrad@exa.ai <conradsoon@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was autonomously generated by Claude Code at @jwang's request. It's an experimental effort to improve SDK quality based on a comprehensive audit. Please review carefully!
Summary
This PR addresses several quality improvements identified in an SDK audit:
RateLimitError,AuthenticationError,ValidationError,TimeoutError,NotFoundError,ServerErrorwith relevant metadatastreamAnswer()now supportstimeoutMsoption with proper AbortController handlingengines.node >= 18.0.0Changes by File
src/errors.tssrc/research/client.tssrc/index.tsREADME.mdpackage.jsonError Types Added
New Streaming Timeout
Test plan
🤖 Generated with Claude Code