Module authors
Expand description
Resolving an automerge actor id to the person behind it.
tilo_resource::history::Version hands back an actor_hex — a raw hex string,
unreadable on its own. This module is the join.
Three shapes occur in documents: a raw 32-byte public key (the
only cryptographically meaningful one, joining to a
collab_types::Identity); a self-declared handle
(ActorId::from(app_id.as_bytes()), the same key tilo_ui::presence::user_color
and the per-character author marks already use, but unverified); and
a random id (ActorId::random(), which resolves to nobody).
For an unknown actor, use UNKNOWN_AUTHOR_NAME as the name, the first
eight hex characters as the label, and the same
crate::presence::user_color / crate::presence::PEER_PALETTE slot
presence uses for that identity, so history and presence cannot disagree.
Structs§
- Author
Directory - Maps automerge actor ids to the people the chrome should name.
- Device
Actors - The actors a device writes as, to tell its changes apart: its record
writer, and the
device_actorof any handle on it. - History
Agent - A delegated agent as history names it: its own principal, how it is shown, and the person it acts for.
- Roster
Agent - A delegated agent on a room’s roster, as the session verified it: its own device key, the person whose root signed its delegation for exactly that device, and how it is shown. Only the session produces these, after checking that delegation; history uses them to name who wrote and never to decide what anyone may do.
Constants§
- UNKNOWN_
AUTHOR_ NAME - Display name used for an actor with no registered identity and no self-declared handle. Deliberately not a person’s name.
Functions§
- actor_
handle - Decode an actor id back to the handle the authoring process chose for
itself, when it did.
ActorId::from(&[u8])stores the bytes verbatim, soset_actor(ActorId::from(app_id.as_bytes()))leaves the UTF-8 ofapp_idin the hex. ReturnsNonefor anything not a plausible handle (odd-length /non-hex input, non-UTF-8, control chars, empty, or too long); a 32-byte public key almost never survives this filter. - agent_
display_ label namewith the localized agent kind label, as every agent is shown in history, presence and activity.- agent_
principal_ name - The readable name of an
agent:<id>principal, without the kind label: the id, or the localized unknown-agent name when it is empty.Nonefor any principal that is not an agent. For surfaces that already mark the actor as software, such as an agent badge. - author_
coloured - History row whose colour is already decided (a person’s own colour).
- author_
for_ identity - History row for
identity: the shared palette slot, same RGBcrate::presence::user_color/crate::presence::PresenceCtx::color_forpick when no override is set. - device_
actor - The actor
handlewrites a document as from the device whose record writer isdevice: the handle, whichactor_handlereads back, and a part only that device has. Automerge numbers each actor’s changes, so one person writing from two devices under the bare handle would make two different changes with the same number, which no replica can merge. - local_
identity_ author - Build a
HistoryAuthorfrom the local identity (crate::local_identity), if there is one. Public because the shell wants the same answer for its own chrome without having to own anAuthorDirectory. - participant_
display_ label - Turn a durable collaboration principal into copy suitable for people-facing history and audit UI.
- read_as
- The principal of the person this thread’s app runs for: whose changes every history read on this thread shows as theirs.
- set_
room_ agents - Replace the verified agents of
roomthis thread’s app names in its history (AuthorDirectory::with_room_agents). Only the session’s context stream calls this, with what it verified. - short_
id - First
SHORT_LENhex characters of an actor id, for the dim monospace label next to the name. Short ids are returned whole. - stable_
hue - Deterministic avatar hue for an actor with no registered colour: FNV-1a
over the actor hex, folded into
[0, 360). Same actor, same hue in every process and on every peer.