Skip to main content

Module name_keys

Module name_keys 

Source
Expand description

Slugs and the name-keyed rows (KEY_NAMEs) an agent’s names map to: collision-free slugs, tombstoning a renamed agent’s keys, and finding agents by name.

Structs§

AgentNameMatch
One row agents_matching_name found (identity M3).

Functions§

agent_open_fallback_id 🔒
agent.open’s id for a definition with no slug (agent_open.rs).
delete_key_rows 🔒
Delete one name’s rows from the three name-keyed key tables.
former_names 🔒
Every display / instance name id has had before its current ones (db_agent_former_names, recorded by trigger on every rename path).
frontend_fallback_id 🔒
The frontend’s id for a launch with no slug — a template-created agent’s first session. ASCII only, one dash per UTF-16 code unit (agentmux_common::slug::js_ascii_slug, Codex P1 on #3633).
key_name_used_by_another 🔒
Whether another row may sign under folded: holds it as its slug, or its display name or instance_name gives that fallback id (agent.open’s or the frontend’s). Any row, whatever its slug: a template-created agent’s first session signs under the fallback id although its row has a derived slug (review of #3633), so two same-named agents share that key. Such a key is left. Templates count: agent.open of a template and template-based continuations sign under the template’s slug. Folded as the key tables fold (to_lowercase), not SQLite’s ASCII-only lower(): slugs Ä and ä share the key filed under ä (Codex P2 on #3575).
key_names_of 🔒
Every name a key row could be filed under for this agent, folded as the key tables fold (to_lowercase) — identity M4d-1 (spec §6.5.10). The slug exactly as sent (M4a-3); the display name and instance_name, trimmed, as the tombstone records them; and agent.open’s fallback id, the display name lowercased with non-alphanumerics made - (used when a definition has no slug: Zed Bot is keyed zed-bot).
purge_name_keyed_keys 🔒
Delete the signing keys filed under every name id may have signed as — its jekt HMAC key and its LAN and WAN keypairs, which are keyed by name, not UID. M4a-3 (spec §6.5.4) deleted them under the slug; M4d-1 (§6.5.10) also under the display name, instance_name and the fallback ids (key_names_of). Without this a later agent that takes a name is handed the dead agent’s keys by ensure’s INSERT OR IGNORE, and signs as it. Read before the row is deleted; a name another row may sign under (key_name_used_by_another) is that agent’s key and is left alone. Folded as the key tables fold (to_lowercase). A template row is skipped, as in tombstone_key_names. Idempotent.
resolve_slug_collision 🔒
The first of base, base-2, base-3, … that no db_agents row holds.
tombstone_key_names 🔒
Every table keyed to an agent id that a deleted db_agents row leaves behind, purged explicitly (docs/specs/SPEC_AGENT_DELETE_2026_09_16.md §5.1). Called with the caller’s connection lock already held, inside the same critical section as the db_agents DELETE. Returns rows removed.