JFLib

agent_io#

explicitly enabled stdio and current-user native agent transports -- crate root lib/agent_io/src/lib.rs

Explicitly activated transports for the shared agent_core dispatcher. New library.

agent_io crate root#

/// Maximum bytes in one newline-delimited JSON request, before the newline.
LINE_LIMIT: usize = 1_048_576
  • enum Record One bounded line or a rejected oversized record.

    • Line(Vec<u8>) -- Complete UTF-8 candidate, validated by agent_core's JSON decoder.
    • TooLong -- Input exceeded the limit; the complete record was discarded.
  • struct Framer Incremental newline framer shared by pipes, sockets, streams and bridge clients.

impl Framer

  • fn feed(&mut self, bytes: &[u8], receive: &mut impl FnMut(Record)) Consume chunks without interpreting UTF-8 until a whole record is available.

  • fn finish(&mut self, receive: &mut impl FnMut(Record)) Finish a stream; a final nonempty record need not end in a newline.

  • fn serve_stdio(mut process: impl FnMut(&[u8]) -> Option<String>) -> i32 Run an explicitly selected stdio session. Only protocol responses reach stdout; stream failures are reported on stderr. Application startup must select this path.

agent_io/src/ipc.rs#

Source: lib/agent_io/src/ipc.rs

Nonblocking per-instance local agent sessions. Framing and RPC semantics stay shared.
  • struct Server An explicitly created per-application local endpoint. No listener exists by default.

impl Server

  • fn bind(app: &str, version: &str, protocol: Protocol) -> Result<Self, i32> Bind a current-user endpoint. A bounded ASCII slug is derived from the display name; discovery and protocol metadata retain the original Unicode app name.
  • fn endpoint(&self) -> &str Native endpoint address, empty after disabling/closing.
  • fn connected(&self) -> usize Number of accepted active connections, for a visible app status indicator.
  • fn close(&mut self) Close the endpoint and all connections immediately.
  • fn poll(&mut self, dispatcher: &Dispatcher, host: &mut impl Host) -> bool Process a bounded amount of available work without blocking the native UI loop. Returns true when at least one request was processed. A disabled dispatcher closes the endpoint.

Source: docs/API.md in the JFLib repository.