Expand description
Native Gate4Agent node server and runtime.
Re-exports§
pub use machine_env::collect as collect_machine_environment;pub use kit::force_link;pub use kit::linked_core_names;pub use kit::start_mailbox;pub use kit::MailboxHandle;pub use gate4agent_node_protocol as protocol;
Modules§
- browser_
capture - Linux dig2browser capture inside the node (feature
d2b). - door
- Local door for agents on this node: mail and task operations without ever touching a key.
- enroll_
client - Node side of enrollment: key generation in the node’s own state directory, the signed request with the operator’s one-time code, and the stored public answer.
- grok_
leader - Per-session grok leader isolation.
- isolation
- Node-side isolation: run provider sessions as an unprivileged user, and apply the egress
kill-switch rendered by
hatchery_enroll::KillSwitch. Linux/Unix only; both are opt-in and fail closed (a requested isolation that cannot be set up stops the node). - keystore_
proxy - Node-side keystore proxy (was
m4a_signer_proxy) (option A,specs/m4a-session-keys-2026-10-16.md). - kit
- Standard node kit cores: dig2browser (
d2b), mail4agent (m4a), the four session-restore crates (session-restore) and kernel WireGuard (wireguard). Each core is compiled only with its own feature; the default build (kit) enables all of them. - local_
infra - Discovery of local infrastructure the node can reuse instead of starting its own copy: a mail4agent courier, another gate4agent node.
- local_
server - Session-local HTTP server pool (tesserax-http static + supervised http children).
- m4a_
accounts - 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(envHATCHERY_M4A_AGENT_BIN, else next to this binary, PATH, or~/.cargo/bin) and an accounts root (envHATCHERY_M4A_ACCOUNTS_ROOT, else<enroll-state>/m4a-accounts). Product URL comes from env or the enrollment reply (m4a_product_url). The node runsm4a-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 ONLYM4A_NICKandM4A_SESSION_CAPinto that session’s child environment. The capability is never logged. - m4a_
adopt - Adoption of a provider session the node did not spawn: the node gives it a per-session m4a
account and puts the node’s own m4a MCP server (
m4a-agent mcp, stdio) in the provider’s config, removing a stale standalone mailbox MCP entry (a loopback HTTP url) with a backup. - m4a_
attach POST /m4a/attach: on-demand m4a account for a provider session the node did not spawn (spec live-session-m4a-attach).- m4a_
signer_ proxy - 0.2.15 name of
keystore_proxy. Unix only, same as the proxy itself. - m4a_
wake - Letter wake for live sessions the node adopted (
/m4a/adopt). - machine_
env - Collect host machine resources + installed provider CLI versions for topology inventory.
- node_
control - Local control channel of this node (
POST /control/{drain,reload,handoff}on the ops HTTP listener). Owner-only: a random bearer token written 0600 (Unix) into the node’s own state directory, a per-user location on Windows./healthpublishes the token file path and the capabilities, never the token. - node_
log - Rotating JSON-lines log for the node. Path comes from the caller or
GATE4AGENT_NODE_LOG— never a hardcoded absolute path. - plugins
- Signed session plugins (node-owned session environment).
- provider_
inventory - Provider inventory: which provider CLIs this node can run and which models each one exposes, read from the CLI itself (or its own config). Nothing is invented: a provider whose CLI does not list models reports only what its help text / config names.
- restream_
g4a_ bridge - Node restream g4a bridge (A2).
- restream_
session - Node end of a live restreamer session (A2 / A3).
- session_
signals - Short session signals the node reads off its own PTY screens: a provider CLI hit a
usage/rate limit, needs a login, or is ready again. Only state changes are sent to
core (
task.session_signalover the node-call channel); screens never leave the node for this. Detection is heuristic text matching on the rendered screen and is kept per provider-agnostic phrase lists so a CLI wording change degrades to “no signal”. - uplink_
calls - Node calls (
mail.*,task.*) over the restreamer uplink. - uplink_
journal - Persistent uplink journal and JournalReq responder for the A2 restreamer.
- wake_
pipeline - The node’s letter pipeline: letter in -> policy -> g4a deliver (or refuse; the letter stays in the inbox).
- wg_
status - Process-wide WireGuard health for
/healthand logs. No secrets. - windows_
process - Windows process-creation helpers for non-PTY children.
Structs§
- Bundle
Catalog - Bounded immutable lookup table for bundles installed before node startup.
- Managed
Worktree Profile - Native
History Config - Native
History Root - Network
Allowlist Catalog - Empty-default station network allowlist catalog.
- Network
Allowlist Entry - One node-local catalog entry. Wire / inventory still use
SpawnNetworkAllowlistId. - Network
Permit Sketch - dig2browser-spirit peer+protocol permit (node-local; non-secret).
- Node
Bundle - Immutable host-local bundle bytes and their public content receipt.
- Node
Bundle File - One immutable, normalized file captured from a validated bundle root.
- Node
Environment Profile - Immutable host-local binding from one public profile revision to native child-environment resolvers. Resolver values remain inside the native profiles and are never serialized or formatted for diagnostics.
- Node
Letter - One letter for a session of this node.
- Node
Secret Reference - Node
Server - Node
Server Config - Node
Session Materialization Profile - Node
Session Path Binding - Node
Shutdown Handle - Node
Wake - Node
WgPeer Config - Provider
Native Network Sketch - Honest, partial provider-native network mapping (node-local).
- Spawn
Profile Registry - WgStatus
- Workspace
Config
Enums§
- Bundle
Catalog Error - History
Source Layout - Network
Allowlist Catalog Error - Network
Permit Protocol - Allowed permit protocols (string form in JSON:
tcp/udp). - Node
Bundle Error - Node
Environment Profile Error - Node
Secret Resolve Error - Node
Secret Value - Node
Secret Value Error - Node
Server Error - Node
Session Environment Mutation - Node
Session File - Node
Session Materialization Profile Error - Node
Session Path Class - Node
WgPeer Error - Spawn
Profile Registry Error - Worktree
Service Mode
Constants§
- CLAUDE_
STATION_ NETWORK_ SETTINGS_ FILE - Sidecar settings filename under ProviderHome (
CLAUDE_CONFIG_DIRhome/). - DEFAULT_
SPAWN_ PROFILE_ ID - MAX_
BUNDLE_ CATALOG_ ENTRIES - MAX_
BUNDLE_ FILES - MAX_
BUNDLE_ FILE_ BYTES - MAX_
BUNDLE_ PATH_ BYTES - MAX_
BUNDLE_ TOTAL_ BYTES - MAX_
NETWORK_ ALLOWLIST_ CATALOG_ ENTRIES - Soft bound on station network allowlist catalog membership (ids only). Soft bound on station network allowlist catalog ids exposed on launch inventory.
- MAX_
NETWORK_ PERMITS_ PER_ ENTRY - Soft bound on permit rows per catalog entry (dig2
MAX_NETWORK_PERMITSspirit). - MAX_
NODE_ ENVIRONMENT_ PROFILES - MAX_
NODE_ SECRET_ REFERENCE_ BYTES - MAX_
NODE_ SECRET_ VALUE_ BYTES - MAX_
SESSION_ ENVIRONMENT_ ENTRIES - MAX_
SESSION_ MATERIALIZATION_ FILES - MAX_
SESSION_ MATERIALIZATION_ FILE_ BYTES - MAX_
SESSION_ MATERIALIZATION_ RELATIVE_ PATH_ BYTES - MAX_
SPAWN_ PROFILES - NETWORK_
ALLOWLIST_ CATALOG_ ENV - Env path to an optional allowlist catalog file (absolute regular file). Unset → empty catalog (deny unknown at resolve). Never a secret store.
- NETWORK_
ALLOWLIST_ CATALOG_ SCHEMA_ VERSION - Structured catalog schema version (JSON v2).
- WG_
ADDRESS_ ENV - WG_
INTERFACE_ ENV - WG_
KEEPALIVE_ ENV - WG_
LISTEN_ PORT_ ENV - WG_
PEER_ ADDRESS_ ENV - WG_
PEER_ ENDPOINT_ ENV - WG_
PEER_ KEY_ ENV - WG_
PRIVATE_ KEY_ ENV - WIREGUARD_
LINK_ TAG - Link tag so the kit binary retains this module.
Traits§
Functions§
- bring_
up_ node_ wireguard - Creates the node↔C2 WireGuard peer.
Allowed IPs and the installed route are only the C2 tunnel host.
Linux:
ip link add type wireguard, and a failedipis an error. Windows, no tun on the machine: one adapter and a host route for the peer. Windows, a tun already owns the default route: no adapter and no route. The WireGuard session runs in this process and its UDP leaves through that tun. - claude_
allowed_ domains_ from_ permits - Deduplicated Claude
allowedDomainsfrom catalog permits (stable order). - claude_
bash_ sandbox_ network_ os_ supported - Vendor Bash sandbox network overlay is macOS / Linux / WSL2 only. Native Windows (and WSL1 host without Linux node) has no vendor sandbox — refuse rather than silent no-op or invented argv.
- claude_
settings_ network_ overlay_ args - Documented Claude CLI argv:
--settings <absolute-path>. - claude_
station_ network_ settings_ json - Settings JSON fragment for Claude Bash sandbox network (vendor documented
sandbox.enabled+sandbox.network.allowedDomains). - codex_
network_ access_ config_ overlay - Codex
-coverlay for legacysandbox_workspace_write.network_access. - default_
node_ endpoint - default_
state_ path - load_
network_ allowlist_ catalog_ file - Load catalog from
path(absolute regular file). Dual format. - node_
wg_ from_ env - Optional service-mode bring-up. Unset
WG_INTERFACE_ENVleaves the tunnel down. The key is a path, never a secret value in the unit file. - orca_
home_ roots - Pinned Orca-compatible roots beneath an explicitly supplied native home.
- parse_
network_ allowlist_ catalog_ text - Parse catalog text: JSON v2 when first non-comment content is
{, else v1 id-list (one id per line). - permit_
peer_ to_ allowed_ domain - Map catalog permit
peer→ Claudesandbox.network.allowedDomainshost. - provider_
native_ mapping_ supported - Whether
provider_nativeon a catalog entry can be honored forproviderat the resolvedApprovalLevel. - resolve_
network_ allowlist_ catalog - Resolve optional catalog from an explicit path, else from
NETWORK_ALLOWLIST_CATALOG_ENV, else empty. - resolve_
provider_ native_ launch_ overlay - Resolve provider-native launch overlay argv for a catalog entry, or refuse.
- spawn_
linux_ wireguard_ retry - Spawn a background retry loop for Linux kernel WireGuard. The node process
stays up while the tunnel is down (
WgStatusreportsdown).