Class: ClaudeAgentSDK::TaskUpdatedMessage
- Inherits:
-
SystemMessage
- Object
- Type
- SystemMessage
- ClaudeAgentSDK::TaskUpdatedMessage
- Defined in:
- lib/claude_agent_sdk/types.rb
Overview
Task updated system message (background task lifecycle state change).
The CLI emits system/task_updated events as a task moves through its
lifecycle. patch carries the changed fields (e.g. status, end_time); when
patch is terminal (see TERMINAL_TASK_STATUSES) the task has
finished. A background task's terminal state can arrive only as a
TaskUpdatedMessage with no accompanying TaskNotificationMessage — e.g. a task
stopped via TaskStop reports status "killed" here and the matching
notification is sometimes suppressed. Consumers tracking active task IDs
should clear them on a terminal status from either message.
Parsed defensively in the constructor — a lifecycle event must never raise:
status is derived from patch (not a top-level field); a non-Hash
or absent patch falls back to {}; and task_id defaults to "" (never nil,
matching the Python SDK) so consumers can rely on it always being a String.
The full patch is preserved on #patch for callers that need more than the
status.
Instance Attribute Summary collapse
-
#patch ⇒ Object
Returns the value of attribute patch.
-
#session_id ⇒ Object
Returns the value of attribute session_id.
-
#status ⇒ Object
Returns the value of attribute status.
-
#task_id ⇒ Object
Returns the value of attribute task_id.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Attributes inherited from SystemMessage
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ TaskUpdatedMessage
constructor
A new instance of TaskUpdatedMessage.
Methods inherited from Type
#[], #[]=, from_hash, #to_h, wrap
Constructor Details
#initialize(attributes = {}) ⇒ TaskUpdatedMessage
Returns a new instance of TaskUpdatedMessage.
402 403 404 405 406 407 |
# File 'lib/claude_agent_sdk/types.rb', line 402 def initialize(attributes = {}) super @task_id ||= '' @patch = {} unless @patch.is_a?(Hash) @status = @patch[:status] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ClaudeAgentSDK::Type
Instance Attribute Details
#patch ⇒ Object
Returns the value of attribute patch.
400 401 402 |
# File 'lib/claude_agent_sdk/types.rb', line 400 def patch @patch end |
#session_id ⇒ Object
Returns the value of attribute session_id.
400 401 402 |
# File 'lib/claude_agent_sdk/types.rb', line 400 def session_id @session_id end |
#status ⇒ Object
Returns the value of attribute status.
400 401 402 |
# File 'lib/claude_agent_sdk/types.rb', line 400 def status @status end |
#task_id ⇒ Object
Returns the value of attribute task_id.
400 401 402 |
# File 'lib/claude_agent_sdk/types.rb', line 400 def task_id @task_id end |
#uuid ⇒ Object
Returns the value of attribute uuid.
400 401 402 |
# File 'lib/claude_agent_sdk/types.rb', line 400 def uuid @uuid end |