internal/infra/pg/messagewindow.go
internal/infra/pg · 115 lines · 9 declarations · source
Declarations
const MaxMessageWindowBytes
const MaxMessageWindowBytes = 4096
var ErrInvalidMessageWindow
var ErrInvalidMessageWindow = errors.New("invalid source message window")
var ErrMessageNotFound
var ErrMessageNotFound = errors.New("source message not found")
var ErrMessageChanged
var ErrMessageChanged = errors.New("source message content changed")
var ErrMessageUnavailable
var ErrMessageUnavailable = errors.New("source message is outside its storage contract")
type MessageWindowQuery
type MessageWindowQuery struct {
ChunkID string
ByteStart, Limit int
ExpectedDigest string
}
method MessageWindowQuery.Validate
func (q MessageWindowQuery) Validate() error
type SourceMessageWindow
type SourceMessageWindow struct {
ChunkID string `json:"chunk_id"`
SourceID string `json:"source_id"`
Ordinal int `json:"ordinal"`
Role string `json:"role"`
OccurredAt time.Time `json:"occurred_at"`
ContentDigest string `json:"content_digest"`
MessageBytes int `json:"message_bytes"`
ByteStart int `json:"byte_start"`
ByteEnd int `json:"byte_end"`
Text string `json:"text"`
Complete bool `json:"complete"`
NextByteStart *int `json:"next_byte_start,omitempty"`
}
method CitationStore.Message
func (s *CitationStore) Message(ctx context.Context, scope string, q MessageWindowQuery) (SourceMessageWindow, error)
Message reads an authoritative message reference independently of any extracted fact or vector generation. SQL bounds the returned bytes before allocation; Go retains whole UTF-8 code points. The digest check and content read share one statement snapshot, so they cannot see different text.