pub struct AppServer { /* private fields */ }Expand description
Thin, explicit JSON-RPC facade for codex app-server.
request_json/notify_json: validated raw calls.request_typed/notify_typed: generated protocol-spec bridges backed bycodexus::protocol.*_unchecked: bypass contract checks for experimental/custom methods.- server request loop is exposed directly for approval/user-input workflows.
Method-specific convenience wrappers are intentionally excluded from this surface.
Implementations§
Source§impl AppServer
impl AppServer
Sourcepub async fn connect(config: ClientConfig) -> Result<Self, ClientError>
pub async fn connect(config: ClientConfig) -> Result<Self, ClientError>
Connect app-server with explicit config.
Sourcepub async fn connect_default() -> Result<Self, ClientError>
pub async fn connect_default() -> Result<Self, ClientError>
Connect app-server with default runtime discovery.
Sourcepub async fn request_json(
&self,
method: &str,
params: Value,
) -> Result<Value, RpcError>
pub async fn request_json( &self, method: &str, params: Value, ) -> Result<Value, RpcError>
Validated JSON-RPC request for known methods.
Sourcepub async fn request_json_with_mode(
&self,
method: &str,
params: Value,
mode: RpcValidationMode,
) -> Result<Value, RpcError>
pub async fn request_json_with_mode( &self, method: &str, params: Value, mode: RpcValidationMode, ) -> Result<Value, RpcError>
JSON-RPC request with explicit validation mode.
Sourcepub async fn request_typed<M>(
&self,
params: impl Into<M::Params>,
) -> Result<M::Response, RpcError>where
M: ClientRequestSpec,
pub async fn request_typed<M>(
&self,
params: impl Into<M::Params>,
) -> Result<M::Response, RpcError>where
M: ClientRequestSpec,
Typed JSON-RPC request backed by a generated protocol spec.
Sourcepub async fn request_typed_with_mode<M>(
&self,
params: impl Into<M::Params>,
mode: RpcValidationMode,
) -> Result<M::Response, RpcError>where
M: ClientRequestSpec,
pub async fn request_typed_with_mode<M>(
&self,
params: impl Into<M::Params>,
mode: RpcValidationMode,
) -> Result<M::Response, RpcError>where
M: ClientRequestSpec,
Typed JSON-RPC request backed by a generated protocol spec with explicit validation mode.
Sourcepub async fn request_json_unchecked(
&self,
method: &str,
params: Value,
) -> Result<Value, RpcError>
pub async fn request_json_unchecked( &self, method: &str, params: Value, ) -> Result<Value, RpcError>
Unchecked JSON-RPC request. Use for experimental/custom methods where strict contracts are not fixed yet.
Sourcepub async fn notify_json(
&self,
method: &str,
params: Value,
) -> Result<(), RuntimeError>
pub async fn notify_json( &self, method: &str, params: Value, ) -> Result<(), RuntimeError>
Validated JSON-RPC notification for known methods.
Sourcepub async fn notify_json_with_mode(
&self,
method: &str,
params: Value,
mode: RpcValidationMode,
) -> Result<(), RuntimeError>
pub async fn notify_json_with_mode( &self, method: &str, params: Value, mode: RpcValidationMode, ) -> Result<(), RuntimeError>
JSON-RPC notification with explicit validation mode.
Sourcepub async fn notify_typed<N>(
&self,
params: impl Into<N::Params>,
) -> Result<(), RuntimeError>where
N: ClientNotificationSpec,
pub async fn notify_typed<N>(
&self,
params: impl Into<N::Params>,
) -> Result<(), RuntimeError>where
N: ClientNotificationSpec,
Typed JSON-RPC notification backed by a generated protocol spec.
Sourcepub async fn notify_typed_with_mode<N>(
&self,
params: impl Into<N::Params>,
mode: RpcValidationMode,
) -> Result<(), RuntimeError>where
N: ClientNotificationSpec,
pub async fn notify_typed_with_mode<N>(
&self,
params: impl Into<N::Params>,
mode: RpcValidationMode,
) -> Result<(), RuntimeError>where
N: ClientNotificationSpec,
Typed JSON-RPC notification backed by a generated protocol spec with explicit validation mode.
Sourcepub async fn notify_json_unchecked(
&self,
method: &str,
params: Value,
) -> Result<(), RuntimeError>
pub async fn notify_json_unchecked( &self, method: &str, params: Value, ) -> Result<(), RuntimeError>
Unchecked JSON-RPC notification.
Sourcepub async fn take_server_requests(
&self,
) -> Result<ServerRequestRx, RuntimeError>
pub async fn take_server_requests( &self, ) -> Result<ServerRequestRx, RuntimeError>
Take exclusive server-request stream receiver.
This enables explicit handling of approval / requestUserInput / tool-call cycles.
Sourcepub async fn respond_server_request_ok(
&self,
approval_id: &str,
result: Value,
) -> Result<(), RuntimeError>
pub async fn respond_server_request_ok( &self, approval_id: &str, result: Value, ) -> Result<(), RuntimeError>
Reply success payload for one server request.
Sourcepub async fn respond_server_request_err(
&self,
approval_id: &str,
err: RpcErrorObject,
) -> Result<(), RuntimeError>
pub async fn respond_server_request_err( &self, approval_id: &str, err: RpcErrorObject, ) -> Result<(), RuntimeError>
Reply error payload for one server request.
Sourcepub async fn shutdown(&self) -> Result<(), RuntimeError>
pub async fn shutdown(&self) -> Result<(), RuntimeError>
Explicit shutdown.