Skip to content

feat(sdk): export item unmarshalers, attribute client errors to upstream host#364

Merged
aaliboyev merged 1 commit into
mainfrom
sdk-item-unmarshal-error-host
Jul 2, 2026
Merged

feat(sdk): export item unmarshalers, attribute client errors to upstream host#364
aaliboyev merged 1 commit into
mainfrom
sdk-item-unmarshal-error-host

Conversation

@aaliboyev

Copy link
Copy Markdown
Member

SDK consumer feedback fixes, all in the sdk/ module:

  • Export v1.UnmarshalItem / v1.UnmarshalItems. Consumers persisting or re-parsing canonical items had to hand-mirror the type-tag dispatch; with the exported unmarshaler a new item type fails loudly instead of being silently dropped by a stale mirror.
  • ItemCompletedEvent gets an UnmarshalJSON. Its Item field is an interface, so the event was undecodable with plain encoding/json even though client.Event docs say to decode into the matching v1 struct.
  • APIError now carries Host and renders it in Error() (api.anthropic.com: 401 ...) instead of the fixed relay client: prefix — a 4xx from a directly-dialed vendor host (For(ref) mode) no longer reads as a relay failure. Applies to both HTTP and WS paths (shared parseAPIError).
  • Doc: catalog.Binding.Name is guaranteed non-empty (generator falls back to the snapshot slug), so consumers don't need their own fallback.

…eam host

- Export v1.UnmarshalItem/UnmarshalItems so consumers can decode items
  without hand-mirroring the type-tag dispatch (new item types now fail
  loudly instead of being silently dropped downstream).
- Give ItemCompletedEvent an UnmarshalJSON: its Item field is an
  interface, so the event was previously undecodable with plain
  encoding/json despite client.Event docs saying to decode into it.
- APIError carries the upstream Host and renders it in Error() instead
  of the fixed "relay client:" prefix — a 401 from a directly-dialed
  vendor host no longer reads as a relay failure.
- Document catalog.Binding.Name's non-empty guarantee.
@aaliboyev aaliboyev merged commit 4d1e98c into main Jul 2, 2026
2 checks passed
@aaliboyev aaliboyev deleted the sdk-item-unmarshal-error-host branch July 2, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant