Repository: block/goose
File: crates/goose-acp/src/server.rs (Rust)

Code before:

impl GooseAcpAgent {
    async fn on_initialize(
        &self,
        args: InitializeRequest,
    ) -> Result<InitializeResponse, sacp::Error> {
        debug!(?args, "initialize request");

        let capabilities = AgentCapabilities::new()
            .load_session(true)
            .prompt_capabilities(
                PromptCapabilities::new()
                    .image(true)
                    .audio(false)
                    .embedded_context(true),
            )
            .mcp_capabilities(McpCapabilities::new().http(true));
        Ok(InitializeResponse::new(args.protocol_version)
            .agent_capabilities(capabilities)
            .auth_methods(vec![AuthMethod::new(
                "goose-provider",
                "Configure Provider",
            )
            .description(
                "Run `goose configure` to set up your AI provider and API key",
            )]))
    }

    async fn on_new_session(
        &self,
        args: NewSessionRequest,
    ) -> Result<NewSessionResponse, sacp::Error> {
        debug!(?args, "new session request");

        let manager = self.agent.config.session_manager.clone();
        let goose_session = manager
            .create_session(
                args.cwd.clone(),
                "ACP Session".to_string(),
                SessionType::User,
            )
            .await
            .map_err(|e| {
                sacp::Error::internal_error().data(format!("Failed to create session: {}", e))
            })?;
        self.ensure_provider(&goose_session).await.map_err(|e| {
            sacp::Error::internal_error().data(format!("Failed to set provider: {}", e))
        })?;

        for mcp_server in args.mcp_servers {
            let config = match mcp_server_to_extension_config(mcp_server) {

Review comment (security):
FYI The pattern: id is a slug identifying the auth method, name is a short action label, description tells the user what to do.

```  ┌─────────────────┬────────────────┬──────────────────────────┬───────────────────────────────────────────┐
  │      Agent      │       id       │           name           │                description                │                                                     
  ├─────────────────┼────────────────┼──────────────────────────┼───────────────────────────────────────────┤      
  │ claude-code-acp │ claude-login   │ Log in with Claude Code  │ Run `claude /login` in the terminal       │                                                     
  ├─────────────────┼────────────────┼──────────────────────────┼───────────────────────────────────────────┤      
  │ codex-acp       │ chatgpt        │ Login with ChatGPT       │ Use your ChatGPT login...                 │
  ├─────────────────┼────────────────┼──────────────────────────┼───────────────────────────────────────────┤
  │ codex-acp       │ codex-api-key  │ Use CODEX_API_KEY        │ Requires setting the env var              │
  ├─────────────────┼────────────────┼──────────────────────────┼───────────────────────────────────────────┤
  │ codex-acp       │ openai-api-key │ Use OPENAI_API_KEY       │ Requires setting the env var              │
  ├─────────────────┼────────────────┼──────────────────────────┼───────────────────────────────────────────┤
  │ cursor-acp      │ cursor-login   │ Log in with Cursor Agent │ Run `cursor-agent login` in your terminal │
  ├─────────────────┼────────────────┼──────────────────────────┼───────────────────────────────────────────┤
  │ qwen-code       │ USE_OPENAI     │ Use OpenAI API key       │ Requires setting OPENAI_API_KEY           │
  ├─────────────────┼────────────────┼──────────────────────────┼───────────────────────────────────────────┤
  │ qwen-code       │ QWEN_OAUTH     │ Qwen OAuth               │ OAuth authentication for Qwen models      │
  ├─────────────────┼────────────────┼──────────────────────────┼───────────────────────────────────────────┤
  │ mistral-vibe    │ vibe-setup     │ Register your API Key    │ Register your API Key inside Mistral Vibe │
  └─────────────────┴────────────────┴──────────────────────────┴───────────────────────────────────────────┘
```



Code after:
}

impl GooseAcpAgent {
    async fn on_initialize(
        &self,
        args: InitializeRequest,
    ) -> Result<InitializeResponse, sacp::Error> {
        debug!(?args, "initialize request");

        let capabilities = AgentCapabilities::new()
            .load_session(true)
            .prompt_capabilities(
                PromptCapabilities::new()
                    .image(true)
                    .audio(false)
                    .embedded_context(true),
            )
            .mcp_capabilities(McpCapabilities::new().http(true));
        Ok(InitializeResponse::new(args.protocol_version)
            .agent_capabilities(capabilities)
            .auth_methods(vec![AuthMethod::new(
                "goose-provider",
                "Configure Provider",
            )
            .description(
                "Run `goose configure` to set up your AI provider and API key",
            )]))
    }

    async fn on_new_session(
        &self,
        args: NewSessionRequest,
    ) -> Result<NewSessionResponse, sacp::Error> {
        debug!(?args, "new session request");

        let manager = self.agent.config.session_manager.clone();
        let goose_session = manager
            .create_session(
                args.cwd.clone(),
                "ACP Session".to_string(),
                SessionType::User,
            )
            .await
            .map_err(|e| {
                sacp::Error::internal_error().data(format!("Failed to create session: {}", e))
            })?;
        self.ensure_provider(&goose_session).await.map_err(|e| {
            sacp::Error::internal_error().data(format!("Failed to set provider: {}", e))
        })?;

        for mcp_server in args.mcp_servers {