module ACP::Protocol

Defined in:

acp/protocol/capabilities.cr
acp/protocol/client_methods.cr
acp/protocol/content_block.cr
acp/protocol/enums.cr
acp/protocol/tool_call_content.cr
acp/protocol/types.cr
acp/protocol/updates.cr

Class Method Summary

Class Method Detail

def self.build_error_response(id : RequestId, code : Int32, message : String, data : JSON::Any | Nil = nil) : Hash(String, JSON::Any) #

Builds a JSON-RPC 2.0 error response.


[View source]
def self.build_notification(method : String, params : JSON::Serializable) : Hash(String, JSON::Any) #

Builds a JSON-RPC 2.0 notification (no "id" field).


[View source]
def self.build_request(id : RequestId, method : String, params : JSON::Serializable) : Hash(String, JSON::Any) #

Builds a JSON-RPC 2.0 request object as a Hash for serialization.


[View source]
def self.build_request_raw(id : RequestId, method : String, params : JSON::Any) : Hash(String, JSON::Any) #

Builds a JSON-RPC 2.0 request with raw JSON::Any params.


[View source]
def self.build_response(id : RequestId, result : JSON::Serializable) : Hash(String, JSON::Any) #

Builds a JSON-RPC 2.0 success response.


[View source]
def self.build_response_raw(id : RequestId, result : JSON::Any) : Hash(String, JSON::Any) #

Builds a JSON-RPC 2.0 success response with raw JSON::Any result.


[View source]
def self.classify_message(msg : JSON::Any) : MessageKind #

Utility to classify a raw JSON::Any message into its kind.


[View source]
def self.extract_id(msg : JSON::Any) : RequestId | Nil #

Extract the request ID from a raw JSON message. Returns nil if not present. Handles both integer and string IDs.


[View source]