Copilot. Types
(Copilot SDK v2.3.0)
Copy Markdown
Type definitions for the Copilot SDK.
All types are represented as structs with typespecs, following the same patterns as the Node.js and Python SDKs.
Summary
Types
Image data returned by the assistant.
Command handler callback.
A content block in an assistant response (text or image).
Elicitation handler callback.
Exit plan mode handler callback.
Options for image generation.
Permission handler callback.
The response format for a message.
A session event from the Copilot CLI server.
All possible session event type strings.
A tool handler function.
Trace context provider callback.
User input handler callback.
Functions
Convert response format atom to JSON string.
Types
@type assistant_image_data() :: %{ format: String.t(), base64: String.t(), url: String.t() | nil, revised_prompt: String.t() | nil, width: integer(), height: integer() }
Image data returned by the assistant.
@type command_handler() :: (CommandContext.t() -> :ok | {:error, any()})
Command handler callback.
@type content_block() :: %{type: :text, text: String.t()} | %{type: :image, image: assistant_image_data()}
A content block in an assistant response (text or image).
@type elicitation_handler() :: (ElicitationContext.t() -> ElicitationResult.t() | {:error, any()})
Elicitation handler callback.
@type exit_plan_mode_handler() :: (Copilot.Types.ExitPlanModeRequest.t() -> Copilot.Types.ExitPlanModeResponse.t())
Exit plan mode handler callback.
@type image_options() :: %{ optional(:size) => String.t(), optional(:quality) => String.t(), optional(:style) => String.t() }
Options for image generation.
@type mcp_server_config() :: Copilot.Types.MCPLocalServerConfig.t() | Copilot.Types.MCPRemoteServerConfig.t()
@type permission_handler() :: (Copilot.Types.PermissionRequest.t(), %{session_id: String.t()} -> Copilot.Types.PermissionRequestResult.t())
Permission handler callback.
@type response_format() :: :text | :image | :json_object
The response format for a message.
@type session_event() :: %{ :type => String.t(), :id => String.t(), :timestamp => String.t(), optional(:parentId) => String.t() | nil, optional(:ephemeral) => boolean(), optional(:agentId) => String.t() | nil, data: map() }
A session event from the Copilot CLI server.
Events are maps with at least type, id, timestamp, and data keys.
The type field discriminates the event kind (e.g. "assistant.message",
"session.idle", "tool.execution_complete", etc.).
@type session_event_type() :: String.t()
All possible session event type strings.
@type system_message_config() :: Copilot.Types.SystemMessageAppendConfig.t() | Copilot.Types.SystemMessageReplaceConfig.t() | Copilot.Types.SystemMessageCustomizeConfig.t()
@type tool_handler() :: (any(), Copilot.Types.ToolInvocation.t() -> any())
A tool handler function.
Receives the parsed arguments and a ToolInvocation struct. Must return
a ToolResult struct, a plain string, or any term that will be
JSON-encoded as a success result.
@type tool_result_type() :: :success | :failure | :rejected | :denied
@type trace_context_provider() :: (-> Copilot.Types.TraceContext.t())
Trace context provider callback.
@type user_input_handler() :: (Copilot.Types.UserInputRequest.t(), %{session_id: String.t()} -> Copilot.Types.UserInputResponse.t())
User input handler callback.