Skip to main content

Module app_server_protocol

Module app_server_protocol 

Source
Expand description

Codex App Server’s stable thread/turn adapter.

The transport in super::app_server owns framing and request lifecycle. This module owns the first protocol-semantic layer: typed request shapes, thread identity, turn identity, and notification reconciliation. It is intentionally not registered as a production block controller yet.

StructsΒ§

CodexAppServerSession
ItemSnapshot
PendingServerRequest
SessionSnapshot
SessionState πŸ”’
TextUserInput πŸ”’
ThreadForkOptions
ThreadListOptions
ThreadResumeParams πŸ”’
ThreadStartOptions
TurnStartParams πŸ”’

EnumsΒ§

AccountLoginOptions
Login choices accepted by the pinned App Server schema. API keys are kept in this typed request only and are never included in protocol events/logs.
CodexAppServerEvent
CodexAppServerProtocolError
ServerRequestKind
SessionPhase
ThreadListCwdFilter
A thread/list cwd filter: either a single path or a set of paths, per the pinned schema’s ThreadListCwdFilter (string | string[]).

ConstantsΒ§

MAX_PENDING_SERVER_REQUESTS πŸ”’
MAX_RAW_EVENTS πŸ”’

FunctionsΒ§

ensure_active_scopes πŸ”’
See ensure_active_thread_scope β€” fails closed when no turn is active.
ensure_active_thread_scope πŸ”’
Unlike ensure_thread_scope, fails closed when no thread is active β€” a server request claiming a threadId must be scoped to a real, active thread, not merely β€œno conflicting thread claimed yet” the way an incoming notification establishing state is allowed to be.
ensure_active_turn_scope πŸ”’
See ensure_active_thread_scope β€” fails closed when no turn is active. Split out from ensure_active_scopes so a turn can be validated on its own when a request carries a turnId without a threadId (ReAgent P1, PR #3212 4th review).
ensure_scopes πŸ”’
ensure_thread_scope πŸ”’
extract_in_progress_turn_id πŸ”’
The id of whichever turn in thread.turns (a ThreadResumeResponse field, populated on thread/resume) has status: "inProgress", if any. TurnStatus’s only other values (completed/interrupted/failed) are all terminal, so at most one entry can ever match. Malformed/missing shapes intentionally fall through to None rather than erroring β€” this is best-effort derivation of pre-existing state, not a required field.
extract_thread_id πŸ”’
string_field πŸ”’