Skip to main content

Module m4a_accounts

Module m4a_accounts 

Source
Expand description

Per-session m4a accounts assigned by the node at spawn (owner model: session = nick = one key = one role). Every PTY spawn gets its own account when the node can find m4a-agent (env HATCHERY_M4A_AGENT_BIN, else next to this binary, PATH, or ~/.cargo/bin) and an accounts root (env HATCHERY_M4A_ACCOUNTS_ROOT, else <enroll-state>/m4a-accounts). Product URL comes from env or the enrollment reply (m4a_product_url). The node runs m4a-agent account provision (registry and vaults stay under the node’s accounts root, outside the session sandbox), reads the fresh capability from a one-shot 0600 file it removes at once, and injects ONLY M4A_NICK and M4A_SESSION_CAP into that session’s child environment. The capability is never logged.

Structs§

M4aSessionAccounts
SessionAccount
One session’s account as handed to its child: nick and capability only.

Constants§

ACCOUNTS_ROOT_ENV
AGENT_BIN_ENV
PRODUCT_AUDIENCE_ENV
The product’s audience name the node signs for (default m4a-product).
PRODUCT_URL_ENV
Messenger product base URL; with it (and an enrolled node) the node registers its sessions’ accounts on the messenger itself, signed with the node key.

Functions§

c2_product_url
m4a_provider
g4a provider id -> the provider name m4a-agent accepts. g4a’s built-in catalog is claude, codex, grok, kimi; anything else (custom agents) gets no account.
mcp_server_name
Name of the node’s m4a MCP server entry for a provider. A session’s project entry under the same name as the user’s own entry replaces it (kimi-code, grok and codex merge by name), so no duplicate m4a server runs. HATCHERY_M4A_MCP_NAME_<PROVIDER> (e.g. ..._KIMI) or HATCHERY_M4A_MCP_NAME; default m4a.
node_account_message
Exact bytes the messenger product verifies (m4a-node-account-v1).
provider_session_env
Provider-specific process environment the node adds to its own sessions so the node’s project-level m4a MCP entry is honoured without an interactive prompt.
set_c2_product_url
What C2 answered for m4a_product_url on the latest connect (None clears).
set_mcp_name_arg
--m4a-mcp-name [provider=]name (repeatable): the node’s m4a MCP entry name, taking precedence over the env. Returns false for a malformed value.
set_node_signer
Installs this node’s identity (enrolled, trusted) as the signer of account registrations. An unenrolled node never has one, so it registers nothing.