We appreciate your patience. The service is temporarily operating in an external runtime environment.
stdio Bus Specificationv0.1.0
Normative specification for Agent Transport OS (stdio Bus), a minimal, deterministic stdio-based kernel in C providing transport-level routing for ACP/MCP-style agent protocols.
1. Introduction
1.1 Purpose
This document defines the normative specification for Agent Transport OS (stdio Bus), a deterministic stdio-based kernel in C providing transport-level routing for ACP/MCP-style agent protocols.
The key words "SHALL", "SHOULD", "MAY", "MUST", "MUST NOT", "REQUIRED", "RECOMMENDED", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
1.4 References
RFC 2119: Key words for use in RFCs to Indicate Requirement Levels
JSON-RPC 2.0 Specification
NDJSON (Newline Delimited JSON) format
2. Terminology and Definitions
2.1 Entity Model
Entity
Definition
stdio_Bus_Daemon
The main cos process that manages workers and routes messages between clients and workers.
Client
An external connection (via stdio, Unix socket, or TCP) that sends messages to stdio_Bus_Daemon.
Worker
A child process spawned by stdio_Bus_Daemon that handles protocol logic. Workers communicate via stdin/stdout pipes.
Session
A logical grouping of messages identified by sessionId with worker affinity.
Request
A JSON-RPC message with an id field expecting a response.
Notification
A JSON-RPC message without an id field (no response expected).
Response
A JSON-RPC message containing result or error field in reply to a Request.
2.2 Message Format
Term
Definition
NDJSON
Newline-delimited JSON format. Each message is a single JSON object followed by a newline character (\n).
Routing Fields
The id, sessionId, and method fields extracted from JSON messages for routing purposes.
2.3 Connection Types
Type
Definition
Client Connection
A connection from an external client to stdio_Bus_Daemon.
Worker Connection
The stdin/stdout pipe pair between stdio_Bus_Daemon and a Worker process.
3. Entity Model
3.1 stdio_Bus_Daemon
The stdio_Bus_Daemon is the central process that:
SHALL read configuration from a JSON file at startup
SHALL spawn and monitor Worker processes according to pool definitions
SHALL accept Client connections via one of three operating modes
SHALL route messages between Clients and Workers based on routing rules
SHALL operate in a single thread using non-blocking I/O
SHALL handle graceful shutdown on SIGTERM or SIGINT
3.2 Client
A Client represents an external connection to stdio_Bus_Daemon:
A Client SHALL connect via one of: stdio, Unix domain socket, or TCP socket
A Client SHALL send NDJSON-formatted messages
A Client MAY have multiple Sessions associated with it
A Client connection SHALL be uniquely identified by its file descriptor
3.3 Worker
A Worker is a child process managed by stdio_Bus_Daemon:
A Worker SHALL be spawned via fork/exec with stdin/stdout pipes
A Worker SHALL read NDJSON messages from stdin
A Worker SHALL write NDJSON responses to stdout
A Worker SHOULD write diagnostic output to stderr (not stdout)
A Worker SHALL handle SIGTERM for graceful shutdown
A Worker SHALL be uniquely identified by a Worker ID (integer)
3.4 Session
A Session provides worker affinity for related messages:
A Session SHALL be identified by a sessionId string
A Session SHALL be bound to exactly one Worker
A Session SHALL be owned by exactly one Client
A Session SHALL be invalidated when its Worker exits
A Session SHALL be invalidated when its owning Client disconnects
3.5 Request
A Request is a message expecting a response:
A Request SHALL contain an id field
A Request SHALL contain a method field
A Request MAY contain a sessionId field
A Request MAY contain a params field
4. Client-to-Daemon Contract
4.1 Connection Semantics
4.1.1 Operating Modes
stdio_Bus_Daemon SHALL support three operating modes:
Mode
Flag
Description
stdio
--stdio
Single Client via stdin/stdout (default)
Unix socket
--unix <path>
Multiple Clients via Unix domain socket
TCP
--tcp <host:port>
Multiple Clients via TCP socket
4.1.2 Connection Lifecycle
In stdio mode, there SHALL be exactly one Client connection
In socket modes, stdio_Bus_Daemon SHALL accept multiple concurrent Client connections
A Client connection SHALL remain open until: the Client closes the connection, stdio_Bus_Daemon closes the connection due to error or resource limits, or stdio_Bus_Daemon initiates graceful shutdown
4.2 Message Format Requirements
4.2.1 Input Format
Clients SHALL send messages in NDJSON format (one JSON object per line)
Each message SHALL be a valid JSON object
Each message SHALL be terminated by a newline character (\n)
Messages SHOULD conform to JSON-RPC 2.0 structure
4.2.2 Routing Fields
stdio_Bus_Daemon SHALL extract the following fields for routing:
Field
Type
Purpose
id
string or number
Request-response correlation
sessionId
string
Session-based worker affinity
method
string
Request identification
Note: stdio_Bus_Daemon performs minimal JSON parsing. It SHALL NOT validate complete JSON-RPC structure beyond extracting routing fields.
4.2.3 Output Format
stdio_Bus_Daemon SHALL forward Worker responses to Clients in NDJSON format
Each response SHALL be terminated by a newline character (\n)
stdio_Bus_Daemon SHALL NOT modify message content (pass-through)
4.3 Malformed Input Handling
If a Client sends data that cannot be parsed as JSON, stdio_Bus_Daemon SHALL close the Client connection
If routing fields cannot be extracted, stdio_Bus_Daemon SHALL log a warning and close the Client connection