Repository navigation
v0.19.0
Added
TaskUpdatedMessage— typedsystem/task_updatedlifecycle events (Python SDK 0.2.101 / #1016 parity). A background task's terminal state can arrive only as atask_updatedpatch with no accompanyingTaskNotificationMessage(e.g. aTaskStop-killed task reportsstatus: "killed"here), so consumers tracking active task IDs no longer hang waiting for a notification that never comes.statusis derived frompatch["status"]and parsed defensively — a non-Hash/absent patch falls back to{},task_idis always a String, and parsing never raises on a lifecycle event. NewTASK_UPDATED_STATUSESandTERMINAL_TASK_STATUSESconstants; the latter spans both lifecycle vocabularies (task_notificationreportsstopped,task_updatedreports the rawkilled) so a terminal status from either message clears active-task tracking.
Fixed
- Malformed CLI message content now raises a descriptive
MessageParseErrorinstead of an opaqueTypeError/NoMethodError(Python SDK #1058 parity): a non-Hash content block (e.g. a bare String) and an assistantcontentthat 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
endWhat'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