# `ACPex.Transport.Ndjson`
[🔗](https://github.com/lostbean/acpex/blob/v0.1.1/lib/acpex/transport/ndjson.ex#L1)

Newline-delimited JSON (ndjson) transport for ACP using Erlang Ports.

The Agent Client Protocol uses newline-delimited JSON for message framing.
Each JSON-RPC message is encoded as a single line terminated by `\n`.

This transport uses native Erlang Ports for robust external process management with:
- Line-buffered I/O for automatic message framing
- Non-blocking asynchronous message passing
- Automatic process cleanup on termination
- Bidirectional communication over stdin/stdout

## Message Format

Messages are sent as complete JSON objects, one per line:

    {"jsonrpc":"2.0","id":1,"method":"initialize","params":{...}}\n
    {"jsonrpc":"2.0","id":1,"result":{...}}\n

## References

- ACP Specification: https://agentclientprotocol.com
- NDJSON Specification: https://github.com/ndjson/ndjson-spec
- Erlang Ports: https://www.erlang.org/doc/tutorial/c_port.html

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `start_link`

Starts a new ndjson transport process.

## Parameters

  * `parent` - The parent process (typically ACPex.Protocol.Connection)
  * `opts` - Transport options (see below)

## Options

  * `:port_opts` - Port command specification (e.g., `{:spawn_executable, path}`)
  * `:port_args` - Command-line arguments to pass to the executable

---

*Consult [api-reference.md](api-reference.md) for complete listing*
