Skip to main content

Module role

Module role 

Source
Expand description

The closed set of message roles Codewhale can put on a transcript.

Roles used to be free-form Strings on crate::request::Message, and four wire adapters each decided independently what an unfamiliar role meant: two dropped it silently, one forwarded it verbatim for the provider to reject, one failed closed. Role closes the set so that decision can be made once, in one table, instead of four times by accident.

Two properties are load-bearing and are covered by tests:

  • Byte-identical serialization. A Role serializes as exactly the string it replaced and deserializes from any string. Saved transcripts therefore need no schema bump and no migration ladder, and a session written by a newer build still loads here — an unfamiliar role lands in Role::Unrecognized rather than failing the whole session load.
  • assistant_interrupted stays distinct. The interrupted-assistant sentinel is its own variant, not a flavour of Role::Assistant, so it keeps round-tripping as a separate session item.

Enums§

Role
Who authored a message in a transcript.