Expand description
The line protocol: one JSON object per line, in and out.
This is what makes a bot in any language possible without this crate knowing anything about that language. Every language can spawn a process and write lines to a pipe; none of them need FFI, native modules, or a package we have to release in lockstep.
The framing is the one LSP, esbuild, and MCP all converged on:
- one JSON object per line, no embedded newlines
- stdout carries only protocol messages; stderr is for logs — a client must never read stderr output as failure
- closing stdin is the graceful shutdown; there is no daemon, no PID file, and no lifetime for anyone to manage
- a version handshake on the first exchange, so changing the protocol
later does not break every existing bot (ripgrep’s
--jsonshipped without one, and that is the cautionary tale)
Requests carry an id that responses echo. Only one request is in
flight at a time today — that keeps the implementation free of an
async runtime — but the id means concurrency can arrive later
without a breaking change.
Structs§
Enums§
- Request
Body - What the client wants done.
- Response
Body
Constants§
- PROTOCOL_
VERSION - The protocol version this build speaks. Bumped only for changes a client could notice.
Functions§
- id_in
- Best-effort read of a line’s
id, for correlating an error with the request that caused it. - parse_
request - Parse one line into a request.
- supported_
verbs - Every step name this build understands — the handshake’s answer to “what can you do”.