/** * Agent persona identity registry: per-agent durable UUIDs. * * The coord layer has two id concepts that get confused: * - `instance_id`: Claude Code session UUID (fresh per session). Lives at * `.harnery/active/.json` as the heartbeat filename. * - `agent_id` (this module): durable per-AGENT-PERSONA UUID. Stable * across sessions; same UUID for every Maya session, regardless of * how many times she restarts Claude Code. * * Storage: `.harnery/identities/.json`, one file per persona. * The filename IS the id so reverse lookup is O(1) by id; forward lookup * by name is a scan (small directory, ~100 personas tops in practice). * * Used as the canonical identifier in: * - Council manifests (`created_by_id`, `steward_id`, `member_ids[]`) * - Council body filenames (`.md` not `.md`) * - Session events ndjson (new `agent_id` field alongside `agent_name`) * - Heartbeats (new `agent_id` field; existing CC subagent-call id * renamed to `subagent_call_id`) */ export declare const IDENTITY_SCHEMA_VERSION: 1; export interface AgentIdentity { schema_version: 1; /** Persistent persona UUID. v4. */ agent_id: string; /** Current display name (e.g. "Maya", without the "agent-" prefix). */ name: string; /** Prior names this identity has been known by. Updated by renameIdentity(). */ aliases: Array<{ name: string; retired_at: string; }>; /** UTC ISO-8601 timestamp of first mint. */ created_at: string; } /** Strip an "agent-" prefix if present. The registry stores bare names. */ export declare function bareName(raw: string): string; /** Re-add the "agent-" prefix for display contexts. */ export declare function displayName(name: string): string; /** Read one identity by id. Null if missing. */ export declare function lookupById(agentId: string, coordRoot?: string): AgentIdentity | null; /** Read one identity by display name (case-insensitive on bare name). * Scans the directory; O(N) on identity count. */ export declare function lookupByName(name: string, coordRoot?: string): AgentIdentity | null; /** All known identities, sorted by created_at ascending. */ export declare function listIdentities(coordRoot?: string): AgentIdentity[]; /** * Find an identity by name, or mint one. Returns the resolved identity. * Idempotent: calling twice with the same name returns the same record. * * Mint path: generates a fresh uuid v4, writes the file atomically (tmp + * rename), returns the new identity. Race-safe: if two processes mint * simultaneously, both files land (different ids), but lookupByName will * surface whichever happened to be read first; the second is orphaned. * For agent personas (added at human cadence) this race is theoretical. */ export declare function ensureIdentity(name: string, coordRoot?: string): AgentIdentity; /** Persist an identity (tmp + rename). Creates the dir if missing. */ export declare function writeIdentity(id: AgentIdentity, coordRoot?: string): void; /** * Rename an existing identity. The prior name lands in aliases[] so name * lookup still resolves correctly. The agent_id is stable across renames, * which is the whole point of the registry. */ export declare function renameIdentity(agentId: string, newName: string, coordRoot?: string): AgentIdentity; /** * Resolve a string to an agent_id. Accepts: * - A UUID (already an id), verified to exist in registry * - A display name (e.g. "agent-Maya" or "Maya"), resolved via lookupByName * Returns null when the input is neither a known id nor a known name. * * Does NOT mint. Callers that want mint-on-miss should call ensureIdentity() * with a name, then use the returned agent_id. */ export declare function resolveAgentId(input: string, coordRoot?: string): string | null; //# sourceMappingURL=index.d.ts.map