Expand description
POST /m4a/attach: on-demand m4a account for a provider session the node did not spawn
(spec live-session-m4a-attach).
Caller: m4a-agent mcp running inside that provider session. Checks, all required:
- owner: the ops listener’s owner-only control token (a file only the node’s OS user can read) – checked by the router before this module runs;
- policy:
HATCHERY_M4A_ATTACH(defaultauto; setoffto refuse) and the provider inHATCHERY_M4A_ATTACH_PROVIDERS(default: all built-in providers); - process: the given pid is alive and descends (within a few generations) from a live process of that provider. Then the node provisions a per-session account (own registry entry, own store root and key) keyed by the provider session id (or the provider’s pid when none is known) and returns nick, session id and a fresh capability. The capability is returned once, never logged.
Structs§
Constants§
Functions§
- attach_
policy_ is_ auto - Adoption policy: unset or
auto→ allow;off/0/false→ refuse. - handle
- Handles the request;
tableis the current process table (injected for tests). - pick_
adopted - The adopted session an attach belongs to: the session it names, else the one on the provider’s command line when that one is adopted, else the only adopted session. Several adopted sessions and nothing to tell them apart is an error, never a new account.
- policy_
allows - process_
table - The live process table.
- provider_
ancestor - Walks from
pidup the parent chain; returns the nearest process whose image is the provider. - provider_
images - Process image base names that count as
provider. - query_
get - valid_
session