Skip to content

v0.4.0 - API Stability Improvements

Choose a tag to compare

@slb350 slb350 released this 09 Nov 04:15
· 253 commits to main since this release

Major Breaking Changes

This release introduces significant API improvements for long-term stability:

Private Fields with Getters

All public struct fields are now private with getter methods following Rust API Guidelines (C-STRUCT-PRIVATE):

  • AgentOptions: Use .model(), .temperature(), etc. instead of direct field access
  • Tool: Use .name(), .description(), .input_schema()
  • HookDecision: Use .continue_execution(), .modified_input(), etc.

Error Handling Improvements

  • Client::new() now returns Result<Self> instead of panicking
  • add_tool_result() now returns Result<()> for proper error propagation

New Features

  • Client::interrupt_handle(): Thread-safe cancellation handle
  • Input Validation: Temperature range, URL format, model name validation
  • Newtype Wrappers: Optional ModelName, BaseUrl, Temperature types for compile-time safety

Bug Fixes

  • Fixed HTTP client panics on invalid configuration
  • Fixed silent error suppressions in error responses
  • Fixed SSE parsing for empty chunks/heartbeats
  • Improved schema validation with defensive assertions

Documentation

  • Added comprehensive migration guide in CHANGELOG.md
  • Updated 150+ doctests for new APIs
  • Added SAFETY comments to unsafe blocks
  • 97% doctest success rate (135/139 passing)

Migration Guide

See CHANGELOG.md for detailed migration instructions.

Stats

  • 66 unit tests passing
  • 138 doctests passing
  • Zero clippy warnings
  • Rust 1.85+ required (Edition 2024)

Full Changelog: v0.3.0...v0.4.0