Identity & digests

SessionId

SessionId=NewType("SessionId", str)

EventUuid

EventUuid=NewType("EventUuid", str)

ToolUseId

ToolUseId=NewType("ToolUseId", str)

ToolDigest

ToolDigest=NewType("ToolDigest", str)

EventRef

A resolvable reference to a transcript event.

Usage

Source

EventRef(
    session_id,
    event_uuid,
    tool_use_id=None,
)

The universal handle for pointing back at full content: every anchor parameter across the platform takes an EventRef. Paths are never part of a reference — transcripts are located by session UUID.

Attributes

session_id: SessionId

The Claude session UUID the event belongs to.

event_uuid: EventUuid

The transcript entry’s unique identifier.

tool_use_id: ToolUseId | None
The tool-use block id, when the reference names a tool call rather than a whole entry.

canonical_json()

Serialize value per RFC 8785 (JSON Canonicalization Scheme).

Usage

Source

canonical_json(value)

Object keys sort by UTF-16 code units, numbers serialize per ECMAScript Number::toString, and strings escape exactly as JSON.stringify. Raises ValueError for NaN, infinities, and integers beyond IEEE-754 double precision — inputs that cannot canonicalize identically across languages.

tool_digest()

Digest a tool call’s content into the cross-language join key.

Usage

Source

tool_digest(tool_name, tool_input)

Computed over the raw input mapping only — never the tool-use id, which hook stdin does not carry — so a hook, the parser, and cc-review’s Go port produce identical digests for the same call.