Skip to content

v0.18.0 | CC 2.1.37

Choose a tag to compare

@guess guess released this 10 Feb 07:21
· 229 commits to main since this release

Breaking

  • SDK bundles its own CLI binary by default - The SDK now downloads and manages its own Claude CLI in priv/bin/, auto-installing on first use. To use a globally installed CLI instead, set cli_path: :global or pass an explicit path like cli_path: "/usr/local/bin/claude". The bundled version defaults to the latest CLI version tested with the SDK, configurable via cli_version. See ClaudeCode.Options for details.
# config.exs
config :claude_code, cli_path: :global

Added

Control protocol

Runtime control of sessions without restarting. See Sessions — Runtime Control.

  • ClaudeCode.set_model/2 - Change the model mid-conversation ([7ba2007])
  • ClaudeCode.set_permission_mode/2 - Change the permission mode mid-conversation ([7ba2007])
  • ClaudeCode.get_mcp_status/1 - Query MCP server connection status ([7ba2007])
  • ClaudeCode.get_server_info/1 - Get server info cached from handshake ([228c57f])
  • ClaudeCode.rewind_files/2 - Rewind files to a checkpoint. See File Checkpointing. ([7ba2007])
  • Returns {:error, :not_supported} for adapters without control protocol support
  • Initialize handshake - Adapter sends initialize request on startup, transitions through :initializing:ready. Agents are now delivered through the handshake (matching the Python SDK) instead of as a CLI flag. See Subagents. ([228c57f], [2a4473b])

New options

  • :sandbox - Sandbox config for bash isolation (map merged into --settings). See Secure Deployment. ([5f48858])
  • :enable_file_checkpointing - Track file changes for rewinding. See File Checkpointing. ([5f48858])
  • :allow_dangerously_skip_permissions - Required guard for permission_mode: :bypass_permissions. See Permissions. ([c9dc6fa])
  • :file - File resources (repeatable, format: file_id:path) ([d6c1869])
  • :from_pr - Resume session linked to a PR ([d6c1869])
  • :debug / :debug_file - Debug mode with optional filter and log file ([d6c1869])

Adapter system

Swappable backends for different execution environments.

  • ClaudeCode.Adapter behaviour - 4 callbacks: start_link/2, send_query/4, health/1, stop/1 ([1582644])
  • Adapter notification helpers - notify_message/2, notify_done/2, notify_error/2, notify_status/2 ([1704326])
  • ClaudeCode.health/1 - Check adapter health (:healthy | :degraded | {:unhealthy, reason}). See Hosting. ([383dda6])

CLI management

  • mix claude_code.install - Install the bundled CLI binary, auto-updating on version mismatch. ([6e7c837])
  • mix claude_code.path - Print resolved binary path, e.g. $(mix claude_code.path) /login ([94b5143])
  • mix claude_code.uninstall - Remove the bundled CLI binary ([6e7c837])

Changed

  • :cli_path resolution modes - :bundled (default), :global, or explicit path string. See ClaudeCode.Options. ([94b5143])
  • Async adapter provisioning - start_link/1 returns immediately; CLI setup runs in the background. Queries queue until ready. ([f1a0875], [91ee60d], [6a60eb4])
  • Schema alignment with CLI v2.1.37 - New fields across message types ([482c603], [42b6c27])
    • AssistantMessage.error (:authentication_failed, :billing_error, :rate_limit, :invalid_request, :server_error, :unknown)
    • UserMessage.tool_use_result, ResultMessage.stop_reason, AssistantMessage usage inference_geo
    • SystemMessage handles all subtypes (init, hook_started, hook_response); plugins supports object format