Added
errorKindonClaudeCodeErrorMetadata— the structured SDK assistant error kind (e.g.'account_on_hold','billing_error','overloaded') is now preserved on every mapped error path. Set only when the SDK delivers the kind structurally; heuristic (message/stderr text) classifications never fabricate one. Typed as openstringso future SDK kinds flow through without a type-level break. (#155, #156)- Actionable
account_on_hold/billing_errormapping — account-state failures now map to non-retryableAPICallErrors with Anthropic Console guidance, classified before the auth-substring heuristics so they can never be misrouted to re-authentication (LoadAPIKeyError). (#155, #156) isAccountStateError()helper — detects account-state failures structurally, never from message text; account-state errors never satisfyisAuthenticationError(), even when the metadata carries exit code 401. (#155, #156)SDKAssistantMessageErrortype re-export — the SDK's known-value union of structured assistant error kinds, for consumers narrowingerrorKind. (#156)perTaskStopAffordancesetting — maps the Agent SDK's new capability assertion that the host renders per-task stop controls wired tostopTask(), so an interrupt on a live open-input query spares running background tasks. (#153, #154)- Completed hook type re-exports —
PreModelSwitch/PostModelSwitchhook types (new in SDK 0.3.251) plus the previously missingDirectoryAddedHookInput, restoring the fullHookInputunion guarantee. (#154)
Changed
- Claude Agent SDK pinned at
0.3.251(from0.3.232) — resolves the weekly canary's Options drift guard failure;perTaskStopAffordancewas the only newOptionskey, and typecheck plus the full unit suite pass against the new pin. Inherited runtime behavior changes are noted in the CHANGELOG. (#153, #154)
Full changelog: v4.1.1...v4.2.0