Skip to content

v0.19.0

Choose a tag to compare

@ya-luotao ya-luotao released this 29 Jun 07:38
· 613 commits to main since this release

Added

  • TaskUpdatedMessage — typed system/task_updated lifecycle events (Python SDK 0.2.101 / #1016 parity). A background task's terminal state can arrive only as a task_updated patch with no accompanying TaskNotificationMessage (e.g. a TaskStop-killed task reports status: "killed" here), so consumers tracking active task IDs no longer hang waiting for a notification that never comes. status is derived from patch["status"] and parsed defensively — a non-Hash/absent patch falls back to {}, task_id is always a String, and parsing never raises on a lifecycle event. New TASK_UPDATED_STATUSES and TERMINAL_TASK_STATUSES constants; the latter spans both lifecycle vocabularies (task_notification reports stopped, task_updated reports the raw killed) so a terminal status from either message clears active-task tracking.

Fixed

  • Malformed CLI message content now raises a descriptive MessageParseError instead of an opaque TypeError/NoMethodError (Python SDK #1058 parity): a non-Hash content block (e.g. a bare String) and an assistant content that is not an Array are both caught with a clear message carrying the full payload, rather than crashing deep inside block parsing.

Usage

ClaudeAgentSDK.query(prompt: "Run a long background task", options: options) do |msg|
  case msg
  when ClaudeAgentSDK::TaskUpdatedMessage
    # status comes from the patch; clear tracking on a terminal status
    if ClaudeAgentSDK::TERMINAL_TASK_STATUSES.include?(msg.status)
      puts "task #{msg.task_id} finished: #{msg.status}"
    end
  end
end

What's changed

  • #40 Port Python SDK 0.2.99→0.2.110 parity: TaskUpdatedMessage + content guards — @ya-luotao

Full Changelog: v0.18.0...v0.19.0


gem install claude-agent-sdk -v 0.19.0