Skip to main content

Module pair_profile

Module pair_profile 

Source
Expand description

Agent profile + handle parsing (v0.5 — agentic hotline).

Three-layer identity:

  1. DID (did:wire:<hash>) — immutable cryptographic anchor (unchanged).
  2. Handle (nick@domain) — mutable, human-readable, DNS-anchored.
  3. Profile — freeform personality (emoji, motto, vibe, pronouns, now).

Profile fields live inside the existing signed agent-card under a profile key. Editing any field re-signs the card. Card signature thus covers DID, handle, AND personality atomically — peers verifying the card get both identity and vibe in one signed blob.

See SPEC_v0_5.md for the full design.

Structs§

Handle
Parsed handle: nick@domain. domain is lowercased.

Constants§

PROFILE_FIELDS
Editable profile fields. All optional; unset fields stay null in the signed card.
PROFILE_SCHEMA_VERSION
RESERVED_NICKS
Reserved nick set — refuse to mint any of these as the local part of a handle. Length-1 nicks also reserved (impose nick.len() >= 2).

Functions§

is_valid_nick
True iff s is syntactically valid AND not reserved. Use this at CLAIM time (relay’s handle_claim, CLI’s cmd_claim). For resolve/parse, nick_syntax_ok is the right primitive — reserved handles must still be resolvable so clients can pair against pre-claimed org handles.
nick_syntax_ok
True iff s is a syntactically valid nick: 2-32 chars, lowercase [a-z0-9_-]. Does NOT check the reserved list — call is_valid_nick for that (which combines syntax + reservation, intended for claim sites).
parse_handle
Parse nick@domain. Returns Err on malformed inputs or reserved nicks.
read_profile
Read this agent’s profile blob from the agent-card. Returns Value::Null if no profile fields have ever been set (back-compat with v0.4 cards).
render_self_summary
Render the local agent’s profile as a friendly multi-line string for wire whois with no argument (i.e., show self).
resolve_handle
Resolve a nick@domain handle via the remote relay’s .well-known/wire/agent endpoint. Returns the parsed JSON payload {nick, did, card, slot_id, relay_url, claimed_at} on success. Verifies the card signature; on tamper, returns Err.
write_profile_field
Set a single profile field and re-sign the agent-card. value must be a JSON value the caller has already parsed/validated (string for most fields; array for vibe; object for now).