Demonstrates the §4.2 / §22 stdio transport. Unlike the other examples, there is no TCP/WebSocket server: the parent process spawns the runtime as a child subprocess, and the two communicate over the child's stdin/stdout using newline-delimited JSON envelopes (one envelope per line).
This is the same wire format the spec mandates for stdio deployments (useful for tools like editor plugins or sandboxed runtimes where you want the lifetime of the runtime tied to the client process).
A single command — the client spawns its own runtime:
pnpm tsx examples/stdio/client.tsclient.ts(parent) spawnsserver.tsas a child viapnpm tsx <server.ts>withstdio: ["pipe", "pipe", "inherit"]. The child's stdout becomes the runtime's outbound frames; the child's stderr is piped to the parent's terminal for diagnostic visibility.server.ts(child) constructsStdioTransport.fromProcess()— binding the transport to its ownprocess.stdin/process.stdout— andserver.accepts it.- The client builds
StdioTransport.fromChild(child)and runs the normal handshake / submit / await flow on top.
Logs from the server go to stderr because stdout is the wire.
- §4.2 / §22 stdio as an MTI transport equivalent to WebSocket.
- Each ARCP envelope is a single line of JSON terminated by
\n. - The same
ARCPServerandARCPClientcode works unchanged across transports — only theTransportinstance differs.
| Env var | Default | Used by |
|---|---|---|
ARCP_DEMO_TOKEN |
demo-token |
both |