pub struct AppServerBuilder<'a> { /* private fields */ }Expand description
Builds and starts an AppServer.
Created by AppServer::builder.
Implementations§
Source§impl<'a> AppServerBuilder<'a>
impl<'a> AppServerBuilder<'a>
Sourcepub fn client_info(
self,
name: impl Into<String>,
version: impl Into<String>,
) -> Self
pub fn client_info( self, name: impl Into<String>, version: impl Into<String>, ) -> Self
Name and version reported to the server in initialize. The server
includes them in its user agent. Defaults to codex-wrapper and this
crate’s version.
Sourcepub fn opt_out_notification(self, method: impl Into<String>) -> Self
pub fn opt_out_notification(self, method: impl Into<String>) -> Self
Ask the server not to send a notification method on this connection,
by exact name. Streaming deltas (item/agentMessage/delta) are the
usual candidate for a caller that only needs completed items.
Sourcepub fn args(&self) -> Vec<String>
pub fn args(&self) -> Vec<String>
The arguments start passes after the client’s global
args: app-server --listen stdio://.
--listen stdio:// is the default transport. It is passed anyway so a
change of default cannot move this client onto a socket.
Sourcepub fn to_command_string(&self) -> String
pub fn to_command_string(&self) -> String
The command start will run, as a copy-pasteable shell
string, including the client’s global args.
Sourcepub async fn start(self) -> Result<AppServer>
pub async fn start(self) -> Result<AppServer>
Spawn codex app-server and complete the handshake.
The command is codex [global args] app-server --listen stdio://. The
client’s binary, environment, working directory, process-group policy,
die_with_parent, and on_spawn observer apply. The handshake is
bounded by the client’s timeout, when set.
§Errors
Error::Io if the process cannot be spawned. If the server exits
before the handshake finishes, the failure is classified from its
stderr as any failed command is, so a rejected -c key is
Error::Config. Otherwise the handshake’s own error.