module RubyLLM::AgUI::Canonical

Deterministic serialization and hashing.

Run identity depends on comparing an input with the one a retry sends. JSON object member order is not significant, so a naive hash of the raw bytes treats the same request as two. Canonical.dump sorts object keys recursively (like RubyLLM’s ToolCall#arguments, so a call reloaded from a database hashes the same), producing a stable string to digest.