Skip to content

v1.4.1

Choose a tag to compare

@dalehurley dalehurley released this 05 Feb 21:04
· 9 commits to master since this release

Bug Fix: JSON Object Encoding for Tool Inputs

Fixes an issue where PHP's json_decode($json, true) converts empty JSON objects {} to empty arrays [], which then re-encode as [] instead of {}. This caused the Anthropic API to reject tool_use requests with "Input should be a valid dictionary".

Changes

  • New ToolExecutionTrait — shared trait with normalizeContentBlocks(), executeTools(), and extractTextContent() methods, eliminating code duplication across all loop implementations
  • ReactLoop, ReflectionLoop, PlanExecuteLoop, StreamingLoop — all now use the trait and normalize tool_use.input to stdClass before adding to message history
  • Tool::toDefinition() — casts properties to (object) for correct API serialization
  • Unit tests — added tests for empty and non-empty input normalization
  • .gitignore — added runtime storage directories

Full Changelog

v1.4.0...v1.4.1