pkg/protocol/attachment.go

package protocol

// MaxAttachmentChunkBytes limits decoded bytes, before base64 encoding.
const MaxAttachmentChunkBytes int64 = 96 * 1024

// GetAttachmentChunk selects a stored attachment by its position in meta_files.
// Pointer fields distinguish a required zero value from an omitted or null field.
type GetAttachmentChunk struct {
	Type            string `json:"type"`
	Itr             int64  `json:"itr"`
	RequestID       string `json:"request_id"`
	TurnID          string `json:"turn_id"`
	AttachmentIndex *int   `json:"attachment_index"`
	Offset          *int64 `json:"offset"`
	Length          *int64 `json:"length"`
}

// AttachmentChunk is a requester-only RPC response, never a leaf event.
// Offset, Length and Size count decoded bytes, including for UTF-8 attachments.
type AttachmentChunk struct {
	Type            string `json:"type"`
	Itr             int64  `json:"itr"`
	RequestID       string `json:"request_id"`
	TurnID          string `json:"turn_id"`
	AttachmentIndex int    `json:"attachment_index"`
	Offset          int64  `json:"offset"`
	Length          int64  `json:"length"`
	Size            int64  `json:"size"`
	DataB64         string `json:"data_b64"`
	EOF             bool   `json:"eof"`
}