Module: AgentClientProtocol::Helpers
- Defined in:
- lib/agent_client_protocol/helpers.rb
Instance Method Summary collapse
- #audio_block(data, mime_type) ⇒ Object
- #embedded_blob_resource(uri:, blob:, mime_type: nil) ⇒ Object
- #embedded_text_resource(uri:, text:, mime_type: nil) ⇒ Object
- #image_block(data, mime_type, uri: nil) ⇒ Object
-
#plan_entry(content, priority: Schema::PlanEntryPriority::MEDIUM, status: Schema::PlanEntryStatus::PENDING) ⇒ Object
--- Plans ---.
- #resource_block(resource) ⇒ Object
- #resource_link_block(name:, uri:, mime_type: nil, size: nil, description: nil, title: nil) ⇒ Object
-
#session_notification(session_id, update) ⇒ Object
--- Notification wrapper ---.
-
#start_tool_call(tool_call_id, title, kind: nil, status: nil, content: nil, locations: nil, raw_input: nil, raw_output: nil) ⇒ Object
--- Tool calls ---.
-
#text_block(text) ⇒ Object
--- Content blocks ---.
-
#tool_content(block) ⇒ Object
--- Tool call content ---.
- #tool_diff_content(path, new_text, old_text: nil) ⇒ Object
- #tool_terminal_ref(terminal_id) ⇒ Object
-
#update_agent_message(content) ⇒ Object
--- Session updates --- These return TaggedUpdate objects that include the sessionUpdate discriminator when serialized, matching the wire format.
- #update_agent_message_text(text) ⇒ Object
- #update_agent_thought(content) ⇒ Object
- #update_agent_thought_text(text) ⇒ Object
- #update_available_commands(commands) ⇒ Object
- #update_config_options(config_options) ⇒ Object
- #update_current_mode(current_mode_id) ⇒ Object
- #update_plan(entries) ⇒ Object
- #update_tool_call(tool_call_id, title: nil, kind: nil, status: nil, content: nil, locations: nil, raw_input: nil, raw_output: nil) ⇒ Object
- #update_user_message(content) ⇒ Object
- #update_user_message_text(text) ⇒ Object
Instance Method Details
#audio_block(data, mime_type) ⇒ Object
15 16 17 |
# File 'lib/agent_client_protocol/helpers.rb', line 15 def audio_block(data, mime_type) Schema::AudioContent.new(data: data, mime_type: mime_type) end |
#embedded_blob_resource(uri:, blob:, mime_type: nil) ⇒ Object
30 31 32 |
# File 'lib/agent_client_protocol/helpers.rb', line 30 def (uri:, blob:, mime_type: nil) Schema::BlobResourceContents.new(uri: uri, blob: blob, mime_type: mime_type) end |
#embedded_text_resource(uri:, text:, mime_type: nil) ⇒ Object
26 27 28 |
# File 'lib/agent_client_protocol/helpers.rb', line 26 def (uri:, text:, mime_type: nil) Schema::TextResourceContents.new(uri: uri, text: text, mime_type: mime_type) end |
#image_block(data, mime_type, uri: nil) ⇒ Object
11 12 13 |
# File 'lib/agent_client_protocol/helpers.rb', line 11 def image_block(data, mime_type, uri: nil) Schema::ImageContent.new(data: data, mime_type: mime_type, uri: uri) end |
#plan_entry(content, priority: Schema::PlanEntryPriority::MEDIUM, status: Schema::PlanEntryStatus::PENDING) ⇒ Object
--- Plans ---
97 98 99 |
# File 'lib/agent_client_protocol/helpers.rb', line 97 def plan_entry(content, priority: Schema::PlanEntryPriority::MEDIUM, status: Schema::PlanEntryStatus::PENDING) Schema::PlanEntry.new(content: content, priority: priority, status: status) end |
#resource_block(resource) ⇒ Object
34 35 36 |
# File 'lib/agent_client_protocol/helpers.rb', line 34 def resource_block(resource) Schema::EmbeddedResource.new(resource: resource) end |
#resource_link_block(name:, uri:, mime_type: nil, size: nil, description: nil, title: nil) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/agent_client_protocol/helpers.rb', line 19 def resource_link_block(name:, uri:, mime_type: nil, size: nil, description: nil, title: nil) Schema::ResourceLink.new( name: name, uri: uri, mime_type: mime_type, size: size, description: description, title: title ) end |
#session_notification(session_id, update) ⇒ Object
--- Notification wrapper ---
135 136 137 |
# File 'lib/agent_client_protocol/helpers.rb', line 135 def session_notification(session_id, update) Schema::SessionNotification.new(session_id: session_id, update: update) end |
#start_tool_call(tool_call_id, title, kind: nil, status: nil, content: nil, locations: nil, raw_input: nil, raw_output: nil) ⇒ Object
--- Tool calls ---
107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/agent_client_protocol/helpers.rb', line 107 def start_tool_call(tool_call_id, title, kind: nil, status: nil, content: nil, locations: nil, raw_input: nil, raw_output: nil) TaggedUpdate.new("tool_call", Schema::ToolCall.new( tool_call_id: tool_call_id, title: title, kind: kind, status: status, content: content, locations: locations, raw_input: raw_input, raw_output: raw_output )) end |
#text_block(text) ⇒ Object
--- Content blocks ---
7 8 9 |
# File 'lib/agent_client_protocol/helpers.rb', line 7 def text_block(text) Schema::TextContent.new(text: text) end |
#tool_content(block) ⇒ Object
--- Tool call content ---
40 41 42 |
# File 'lib/agent_client_protocol/helpers.rb', line 40 def tool_content(block) Schema::Content.new(content: block) end |
#tool_diff_content(path, new_text, old_text: nil) ⇒ Object
44 45 46 |
# File 'lib/agent_client_protocol/helpers.rb', line 44 def tool_diff_content(path, new_text, old_text: nil) Schema::Diff.new(path: path, new_text: new_text, old_text: old_text) end |
#tool_terminal_ref(terminal_id) ⇒ Object
48 49 50 |
# File 'lib/agent_client_protocol/helpers.rb', line 48 def tool_terminal_ref(terminal_id) Schema::Terminal.new(terminal_id: terminal_id) end |
#update_agent_message(content) ⇒ Object
--- Session updates --- These return TaggedUpdate objects that include the sessionUpdate discriminator when serialized, matching the wire format.
56 57 58 |
# File 'lib/agent_client_protocol/helpers.rb', line 56 def (content) TaggedUpdate.new("agent_message_chunk", Schema::ContentChunk.new(content: content)) end |
#update_agent_message_text(text) ⇒ Object
60 61 62 |
# File 'lib/agent_client_protocol/helpers.rb', line 60 def (text) (text_block(text)) end |
#update_agent_thought(content) ⇒ Object
72 73 74 |
# File 'lib/agent_client_protocol/helpers.rb', line 72 def update_agent_thought(content) TaggedUpdate.new("agent_thought_chunk", Schema::ContentChunk.new(content: content)) end |
#update_agent_thought_text(text) ⇒ Object
76 77 78 |
# File 'lib/agent_client_protocol/helpers.rb', line 76 def update_agent_thought_text(text) update_agent_thought(text_block(text)) end |
#update_available_commands(commands) ⇒ Object
80 81 82 83 |
# File 'lib/agent_client_protocol/helpers.rb', line 80 def update_available_commands(commands) TaggedUpdate.new("available_commands_update", Schema::AvailableCommandsUpdate.new(available_commands: commands)) end |
#update_config_options(config_options) ⇒ Object
90 91 92 93 |
# File 'lib/agent_client_protocol/helpers.rb', line 90 def () TaggedUpdate.new("config_option_update", Schema::ConfigOptionUpdate.new(config_options: )) end |
#update_current_mode(current_mode_id) ⇒ Object
85 86 87 88 |
# File 'lib/agent_client_protocol/helpers.rb', line 85 def update_current_mode(current_mode_id) TaggedUpdate.new("current_mode_update", Schema::CurrentModeUpdate.new(current_mode_id: current_mode_id)) end |
#update_plan(entries) ⇒ Object
101 102 103 |
# File 'lib/agent_client_protocol/helpers.rb', line 101 def update_plan(entries) TaggedUpdate.new("plan", Schema::Plan.new(entries: entries)) end |
#update_tool_call(tool_call_id, title: nil, kind: nil, status: nil, content: nil, locations: nil, raw_input: nil, raw_output: nil) ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/agent_client_protocol/helpers.rb', line 120 def update_tool_call(tool_call_id, title: nil, kind: nil, status: nil, content: nil, locations: nil, raw_input: nil, raw_output: nil) TaggedUpdate.new("tool_call_update", Schema::ToolCallUpdate.new( tool_call_id: tool_call_id, title: title, kind: kind, status: status, content: content, locations: locations, raw_input: raw_input, raw_output: raw_output )) end |
#update_user_message(content) ⇒ Object
64 65 66 |
# File 'lib/agent_client_protocol/helpers.rb', line 64 def (content) TaggedUpdate.new("user_message_chunk", Schema::ContentChunk.new(content: content)) end |
#update_user_message_text(text) ⇒ Object
68 69 70 |
# File 'lib/agent_client_protocol/helpers.rb', line 68 def (text) (text_block(text)) end |