Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Envelope ¶
type Envelope struct {
ID string `json:"id"`
Source string `json:"source"`
Destination string `json:"destination"`
Protocol protocol.Protocol `json:"protocol"`
MessageType MessageType `json:"message_type"`
ContentType string `json:"content_type"`
Payload []byte `json:"payload"`
Metadata map[string]string `json:"metadata,omitempty"`
Timestamp time.Time `json:"timestamp"`
TTL int `json:"ttl,omitempty"`
TraceID string `json:"trace_id,omitempty"`
Signature string `json:"signature,omitempty"`
Nonce string `json:"nonce,omitempty"`
Encrypted bool `json:"encrypted,omitempty"`
SenderX25519 string `json:"sender_x25519,omitempty"`
}
Envelope is the universal message wrapper that bridges different AI agent protocols. Every message flowing through PeerClaw is wrapped in an Envelope regardless of the originating protocol.
func (*Envelope) WithMessageType ¶
func (e *Envelope) WithMessageType(mt MessageType) *Envelope
WithMessageType sets the message type and returns the envelope for chaining.
func (*Envelope) WithMetadata ¶
WithMetadata adds a metadata key-value pair and returns the envelope for chaining.
type MessageType ¶
type MessageType string
MessageType categorizes the purpose of a message.
const ( MessageTypeRequest MessageType = "request" MessageTypeResponse MessageType = "response" MessageTypeEvent MessageType = "event" MessageTypeError MessageType = "error" )
Click to show internal directories.
Click to hide internal directories.