pub struct AppServer { /* private fields */ }Expand description
Thin, explicit JSON-RPC facade for codex app-server.
request_json/notify_json: validated calls for known methods.request_typed/notify_typed: typed wrappers with contract validation.*_unchecked: bypass contract checks for experimental/custom methods.- server request loop is exposed directly for approval/user-input workflows.
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<P, R>(
&self,
method: &str,
params: P,
) -> Result<R, RpcError>where
P: Serialize,
R: DeserializeOwned,
pub async fn request_typed<P, R>(
&self,
method: &str,
params: P,
) -> Result<R, RpcError>where
P: Serialize,
R: DeserializeOwned,
Typed JSON-RPC request for known methods.
Sourcepub async fn request_typed_with_mode<P, R>(
&self,
method: &str,
params: P,
mode: RpcValidationMode,
) -> Result<R, RpcError>where
P: Serialize,
R: DeserializeOwned,
pub async fn request_typed_with_mode<P, R>(
&self,
method: &str,
params: P,
mode: RpcValidationMode,
) -> Result<R, RpcError>where
P: Serialize,
R: DeserializeOwned,
Typed JSON-RPC request 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 skills_list(
&self,
params: SkillsListParams,
) -> Result<SkillsListResponse, RpcError>
pub async fn skills_list( &self, params: SkillsListParams, ) -> Result<SkillsListResponse, RpcError>
Typed helper for skills/list.
Sourcepub async fn command_exec(
&self,
params: CommandExecParams,
) -> Result<CommandExecResponse, RpcError>
pub async fn command_exec( &self, params: CommandExecParams, ) -> Result<CommandExecResponse, RpcError>
Typed helper for command/exec.
Sourcepub async fn command_exec_write(
&self,
params: CommandExecWriteParams,
) -> Result<CommandExecWriteResponse, RpcError>
pub async fn command_exec_write( &self, params: CommandExecWriteParams, ) -> Result<CommandExecWriteResponse, RpcError>
Typed helper for command/exec/write.
Sourcepub async fn command_exec_resize(
&self,
params: CommandExecResizeParams,
) -> Result<CommandExecResizeResponse, RpcError>
pub async fn command_exec_resize( &self, params: CommandExecResizeParams, ) -> Result<CommandExecResizeResponse, RpcError>
Typed helper for command/exec/resize.
Sourcepub async fn command_exec_terminate(
&self,
params: CommandExecTerminateParams,
) -> Result<CommandExecTerminateResponse, RpcError>
pub async fn command_exec_terminate( &self, params: CommandExecTerminateParams, ) -> Result<CommandExecTerminateResponse, RpcError>
Typed helper for command/exec/terminate.
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<P>(
&self,
method: &str,
params: P,
) -> Result<(), RuntimeError>where
P: Serialize,
pub async fn notify_typed<P>(
&self,
method: &str,
params: P,
) -> Result<(), RuntimeError>where
P: Serialize,
Typed JSON-RPC notification for known methods.
Sourcepub async fn notify_typed_with_mode<P>(
&self,
method: &str,
params: P,
mode: RpcValidationMode,
) -> Result<(), RuntimeError>where
P: Serialize,
pub async fn notify_typed_with_mode<P>(
&self,
method: &str,
params: P,
mode: RpcValidationMode,
) -> Result<(), RuntimeError>where
P: Serialize,
Typed JSON-RPC notification 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.