Daemon
daemon
¶
Per-container ACP host-proxy daemon.
Binds a Unix socket on the host that aggregates a container's
in-image ACP agents (terok-{agent}-acp wrappers) behind a single
endpoint. Lifetime is tied to the container: the daemon polls
runtime.container(name).state and exits cleanly once the
container is gone.
Standalone use::
terok-executor acp <container_name> <socket_path>
CONTAINER_POLL_INTERVAL_SEC = 2.0
module-attribute
¶
How often the daemon checks whether the container is still alive.
Tuned to balance acp list freshness against polling overhead.
acp_socket_is_live(path)
¶
Return True when a peer is currently accepting on path.
Distinguishes a live ACP daemon from a stale socket file left
behind by a crash: a successful connect means a peer is
listening, while ECONNREFUSED (and any other OSError)
means the file is safe to unlink.
Source code in src/terok_executor/acp/daemon.py
serve_acp(container_name, socket_path, *, sandbox=None, poll_interval_sec=CONTAINER_POLL_INTERVAL_SEC)
¶
Bind socket_path and run the ACP host-proxy until container_name stops.
Returns the process exit code. When sandbox is None, builds
one from the layered config.yml + env (the same
SandboxConfig() defaults executor uses everywhere).
Source code in src/terok_executor/acp/daemon.py
main(argv=None)
¶
Argv entry — terok-executor acp <container_name> <socket_path>.
Set TEROK_ACP_DEBUG=1 (or any non-empty value) to drop the log
level to DEBUG — the proxy then traces every JSON-RPC frame
in/out of the daemon, which is what you usually want when chasing
a "client X did/didn't send method Y" mystery.