Skip to main content

Module in_process

Module in_process 

Source
Expand description

In-process app-server runtime host for local embedders.

This module runs the existing [MessageProcessor] and outbound routing logic on Tokio tasks, but replaces socket/stdio transports with bounded in-memory channels. The intent is to preserve app-server semantics while avoiding a process boundary for CLI surfaces that run in the same process.

§Lifecycle

  1. Construct runtime state with InProcessStartArgs.
  2. Call start, which performs the initialize / initialized handshake internally and returns a ready-to-use InProcessClientHandle.
  3. Send requests via InProcessClientHandle::request, notifications via InProcessClientHandle::notify, and consume events via InProcessClientHandle::next_event.
  4. Terminate with InProcessClientHandle::shutdown.

§Transport model

The runtime is transport-local but not protocol-free. Incoming requests are typed ClientRequest values, yet responses still come back through the same JSON-RPC result envelope that MessageProcessor uses for stdio and websocket transports. This keeps in-process behavior aligned with app-server rather than creating a second execution contract.

§Backpressure

Command submission uses try_send and can return WouldBlock, while event fanout may drop notifications under saturation. Server requests are never silently abandoned: if they cannot be queued they are failed back into MessageProcessor with overload or internal errors so approval flows do not hang indefinitely.

§Relationship to codex-app-server-client

This module provides the low-level runtime handle (InProcessClientHandle). Higher-level callers (TUI, exec) should go through codex-app-server-client, which wraps this module behind a worker task with async request/response helpers, surface-specific startup policy, and bounded shutdown.

Structs§

InProcessClientHandle
Handle used by an in-process client to call app-server and consume events.
InProcessClientSender
InProcessStartArgs
Input needed to start an in-process app-server runtime.
LogDbLayer

Enums§

InProcessServerEvent
Event emitted from the app-server to the in-process client.

Constants§

DEFAULT_IN_PROCESS_CHANNEL_CAPACITY
Default bounded channel capacity for in-process runtime queues.

Functions§

start
Starts an in-process app-server runtime and performs initialize handshake.

Type Aliases§

StateDbHandle
Core-facing handle to the SQLite-backed state runtime.