Behaviour defining the interface that ACP-compliant clients must implement.
Clients are typically code editors that provide the interface between users and AI agents.
Required callbacks: request_permission/1, session_notification/1.
Optional callbacks have default implementations that return {:error, method_not_found}.
Summary
Callbacks
Create a new terminal and execute a command. Optional.
Handle extension method requests. Optional.
Handle extension notifications. Optional.
Kill terminal command without releasing. Optional.
Read content from a text file. Optional.
Release a terminal. Optional.
Request permission from the user for a tool call operation.
Handle session update notifications from the agent.
Get terminal output and exit status. Optional.
Wait for terminal command to exit. Optional.
Write content to a text file. Optional.
Types
@type result(t) :: {:ok, t} | {:error, ACP.Error.t()}
Callbacks
@callback create_terminal(ACP.CreateTerminalRequest.t()) :: result(ACP.CreateTerminalResponse.t())
Create a new terminal and execute a command. Optional.
@callback ext_method(ACP.ExtRequest.t()) :: result(ACP.ExtResponse.t())
Handle extension method requests. Optional.
@callback ext_notification(ACP.ExtNotification.t()) :: :ok | {:error, ACP.Error.t()}
Handle extension notifications. Optional.
@callback kill_terminal_command(ACP.KillTerminalCommandRequest.t()) :: result(ACP.KillTerminalCommandResponse.t())
Kill terminal command without releasing. Optional.
@callback read_text_file(ACP.ReadTextFileRequest.t()) :: result(ACP.ReadTextFileResponse.t())
Read content from a text file. Optional.
@callback release_terminal(ACP.ReleaseTerminalRequest.t()) :: result(ACP.ReleaseTerminalResponse.t())
Release a terminal. Optional.
@callback request_permission(ACP.RequestPermissionRequest.t()) :: result(ACP.RequestPermissionResponse.t())
Request permission from the user for a tool call operation.
@callback session_notification(ACP.SessionNotification.t()) :: :ok | {:error, ACP.Error.t()}
Handle session update notifications from the agent.
@callback terminal_output(ACP.TerminalOutputRequest.t()) :: result(ACP.TerminalOutputResponse.t())
Get terminal output and exit status. Optional.
@callback wait_for_terminal_exit(ACP.WaitForTerminalExitRequest.t()) :: result(ACP.WaitForTerminalExitResponse.t())
Wait for terminal command to exit. Optional.
@callback write_text_file(ACP.WriteTextFileRequest.t()) :: result(ACP.WriteTextFileResponse.t())
Write content to a text file. Optional.