docs/pkg/ipcsocket.md
pkg/ipcsocket: endpoint plumbing
pkg/ipcsocket validates endpoint descriptions and opens raw network connections or listeners. It does not own daemon lifecycle, runtime paths, JSONL framing, handshakes, or typed RPC.
Wrong page?
- Protocol readiness or hello/ack: ezagentapi
- Wire frames: protocol and the JSONL API catalog
- CLI/TUI readiness, autolaunch, and endpoint resolution: internal/frontend
- Daemon binding, bootstrap readiness, and shutdown: service, ez-agent-service
- Tool/plugin/macro capability IPC:
pkg/service/ipc.go
How do I describe an endpoint?
| Role | Surface | Responsibility |
|---|---|---|
| Endpoint description | Address and Unix(path) | Select a network and supply its Unix Path or TCP Addr |
| Outbound establishment | Dial(ctx, address, timeout) | Validate and return a raw net.Conn |
| Inbound establishment | Listen(address) | Validate and return a raw net.Listener |
What do Dial and Listen guarantee?
Validation precedes establishment. Dial's timeout bounds connection
establishment only, not a later protocol handshake or traffic. Returned
connections and listeners are caller-owned: callers close them and set any
post-dial deadlines, framing, or handshake behavior.
Who owns the socket path and readiness?
This package receives an already-resolved endpoint. Runtime-directory policy and creation belong to service config; client readiness, hello/ack, and retry behavior belong to the shared frontend lifecycle and ezagentapi.
The daemon deliberately does not bind through ipcsocket.Listen: it uses a
raw Unix listener to handle stale paths and carry one listener through bootstrap
to the ready server. A successful Dial therefore only establishes transport;
it cannot establish that the daemon is ready.
Where is the detail authority?
| Need | Source or test |
|---|---|
| Address selection, validation, dial/listen wrapping | ipcsocket.go |
| Unix round trip and validation cases | ipcsocket_test.go |
| Client endpoint resolution and readiness deadlines | internal/frontend/lifecycle.go |
| Daemon probing, stopping, bootstrap binding, and handoff | pkg/service/daemon.go, server.go |
What must remain true when editing?
Keep this package protocol-free. Do not infer listener support for every accepted address family from the validated endpoint form; the focused tests demonstrate ordinary Unix-stream dialing and listening.