Skip to content

Release 0.7.0: port JS SDK 0.7.0 (images, box, zstd) and fix new upstream issues - #6

Merged
afurm merged 1 commit into
mainfrom
release/0.7.0
Oct 16, 2026
Merged

afurm merged 1 commit into
mainfrom
release/0.7.0

Conversation

@afurm

@afurm afurm commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Summary

Ports the official JavaScript SDK 0.7.0 (released 2026-10-14, commit b844cd1) to Ruby and bumps the gem to 0.7.0.

New in JS 0.7.0, now in Ruby

  • Images (experimental; opt in with the TypeSafe-Danger-Zone-Images: true header). Create one with Typesafe::SDK.image from a binary String, a Pathname (read when the request is sent), or an IO, or with Image.from_base64. You can use it in three ways:

    • Place it in state, question instructions, or criteria.
    • Join it into text with Typesafe::SDK.with_assets("Compare ", a, " with ", b) or join_assets(list, ", "). These stand in for JS's tagged template and withAssets.join.
    • Reference it by a name you choose in assets:.

    Requests with images are sent as multipart/form-data, with one part per image. The same reference checks as JS run before sending: unreferenced names, and references that no image is attached to.

  • box questions and BoxResponse (box.top/bottom/left/right, nullable confidence). Use them with jev-preview.

  • zstd request compression for bodies of 1 KiB or more (measured in UTF-8 bytes). It needs the optional zstd-ruby gem; Node.js zstd support plays that role in JS. compression: false opts out. The SDK owns Content-Encoding, and retries resend the same bytes.

  • Non-finite floats are sent as "NaN", "Infinity", and "-Infinity". Usage token counts can be nil. Noul criteria must be a Hash.

  • Answer#to_h returns every field, including unmodeled ones.

JS-only changes, recorded as not applicable: the Node 22 requirement, rejected promises instead of throws (Ruby is synchronous), and score lists built at runtime (a TypeScript typing fix).

New upstream issues (#15–#20)

  • #18: Ruby had the same redaction bug. x-api-key is now always fully masked, and authorization headers keep only an alphabetic scheme followed by a credential.
  • #15: a Cloudflare HTML page now produces an error message that names the edge block and the cf-ray ID. The class and body are unchanged.
  • #17: Ruby now matches JS 0.7.0. Before, Ruby raised JSON::GeneratorError.
  • #16 (API/docs question), #19 and #20 (browser and Bun Fetch only): no Ruby change; each is recorded in docs/UPSTREAM_ISSUES.md.

Validation

  • bundle exec rake: 298 examples, 0 failures; RuboCop reports no offenses. Ran on Ruby 3.3.6, 3.2.6, and 3.1.6. CI covers 3.4 and 4.0.
  • Also ran the suite with zstd unavailable: 0 failures, and the zstd-only specs are skipped.
  • Parity: spec/fixtures/js-0.7.0.json was regenerated by running the published @typesafe-ai/[email protected] package on Node 22.22. It covers multipart requests and parts, withAssets.join text, asset error messages, base64 decoding, compression thresholds, box answers, NaN serialization, errors, and retry headers.
  • A real-socket spec checks that a zstd multipart body has the right boundary and that a retry resends identical bytes.
  • ruby script/check_release.rb passes with RELEASE_TAG=v0.7.0 against the upstream v0.7.0 package.json. gem build --strict succeeds, and the gem installs and loads from the package.
  • No live API test was run; no key was available. script/smoke_test.rb gains an opt-in TYPESAFE_LIVE_IMAGES=1 image and box check.

Compatibility and release impact

  • Upstream target: JS 0.7.0. Version is 0.7.0. The changelog is dated 2026-10-16.
  • Intentional differences are listed in docs/COMPATIBILITY.md. The main ones:
    • with_assets takes its parts as arguments, and nil becomes "".
    • An IO is read immediately.
    • A cycle in the request raises TypeSafeError.
    • Ruby still has stricter validation than JS for score levels, choice bounds, and blank Retry-After headers.
  • Behavior change for custom http: adapters: they may now receive multipart bodies, and zstd-compressed bodies when zstd-ruby is loaded. This is noted in the changelog.
  • Releasing: after merge, the owner pushes tag v0.7.0 on main, following docs/RELEASING.md.

Checklist

  • Relevant checks pass, or skipped checks are explained above.
  • Documentation and changelog are updated where needed.
  • Compatibility and release impact are described above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LuEfX6DVxXvvJPJ7rRfAe8


Generated by Claude Code

Mirror the official @typesafe-ai/sdk 0.7.0 release (commit b844cd1):

- Image assets via Typesafe::SDK.image / Image.from_base64, placed in
  content, joined into text with with_assets / join_assets, or named
  in assets:, sent as multipart/form-data
- box questions and BoxResponse answers
- zstd request compression for bodies of 1 KiB or more when the
  optional zstd-ruby gem is available; compression: false opts out
- Non-finite floats sent as strings, nullable usage, noul criteria
  type check, and Answer#to_h with unmodeled fields

Fix Ruby equivalents of new upstream issues: full masking of
x-api-key and spaceless credentials in debug logs (#18), and clear
messages for Cloudflare HTML error pages (#15).

Regenerate parity fixtures from the published 0.7.0 package and bump
the gem to 0.7.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LuEfX6DVxXvvJPJ7rRfAe8
@afurm
afurm merged commit e8f6583 into main Oct 16, 2026
5 checks passed
@afurm
afurm deleted the release/0.7.0 branch October 16, 2026 07:14
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.

2 participants