Documentation
¶
Overview ¶
Package session defines the provider-visible transcript shape and low-level ephemeral transcript store.
Message is the normalized transcript item passed to providers after host and control projections have been applied. Store is a run-scoped transcript cache for low-level engine execution; it is not the recommended durable persistence API for host applications. Durable conversations should use sessiontree.Repo through agentharness.Thread.
Index ¶
- Constants
- func HasRetryEligibleDurableInput(message Message) bool
- func IsReferenceOnlyUserMessage(message Message) bool
- func ValidateMessageAttachments(attachments []MessageAttachment) error
- func ValidateMessageReferences(references []MessageReference) error
- func ValidateStoredMessageAttachments(attachments []MessageAttachment) error
- type ActivityChip
- type ActivityPresentation
- type ActivityTargetRef
- type ControlSignalView
- type MemoryStore
- type Message
- type MessageAttachment
- type MessageAttachmentTextStats
- type MessageKind
- type MessageReference
- type MessageReferenceKind
- type Role
- type ToolResultView
- type TranscriptStore
Constants ¶
const ( MaxMessageAttachmentsPerTurn = 32 MaxMessageAttachmentResourceBytes = 16 * 1024 MaxMessageAttachmentNameRunes = 1024 MaxMessageAttachmentMIMETypeBytes = 512 MaxMessageAttachmentSizeBytes = 64 * 1024 * 1024 MaxMessageAttachmentsTotalBytes = 256 * 1024 * 1024 MaxMessageAttachmentsPayloadBytes = 512 * 1024 )
const ( MaxMessageReferencesPerTurn = 128 MaxMessageReferenceIDBytes = 128 MaxMessageReferenceLabelRunes = 256 MaxMessageReferenceTextRunes = 12_000 MaxMessageReferenceResourceRefBytes = 8_192 MaxMessageReferencesPayloadBytes = 256 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func HasRetryEligibleDurableInput ¶ added in v0.20.0
HasRetryEligibleDurableInput reports whether a canonical user message can be replayed without depending on turn-scoped supplemental context.
func IsReferenceOnlyUserMessage ¶ added in v0.20.0
func ValidateMessageAttachments ¶ added in v0.25.0
func ValidateMessageAttachments(attachments []MessageAttachment) error
func ValidateMessageReferences ¶ added in v0.20.0
func ValidateMessageReferences(references []MessageReference) error
func ValidateStoredMessageAttachments ¶ added in v0.25.0
func ValidateStoredMessageAttachments(attachments []MessageAttachment) error
ValidateStoredMessageAttachments preserves the attachment shape accepted by earlier schema-v16 journals. New admission must use ValidateMessageAttachments.
Types ¶
type ActivityChip ¶ added in v0.3.47
type ActivityPresentation ¶ added in v0.3.47
type ActivityPresentation struct {
Label string `json:"label,omitempty"`
Description string `json:"description,omitempty"`
Renderer string `json:"renderer,omitempty"`
Chips []ActivityChip `json:"chips,omitempty"`
TargetRefs []ActivityTargetRef `json:"target_refs,omitempty"`
Payload map[string]any `json:"payload,omitempty"`
}
func CloneActivityPresentation ¶ added in v0.3.47
func CloneActivityPresentation(in *ActivityPresentation) *ActivityPresentation
type ActivityTargetRef ¶ added in v0.3.47
type ControlSignalView ¶ added in v0.11.0
type ControlSignalView struct {
Name string `json:"name,omitempty"`
CallID string `json:"call_id,omitempty"`
Disposition string `json:"disposition,omitempty"`
OutputText string `json:"output_text,omitempty"`
ArgsHash string `json:"args_hash,omitempty"`
Payload map[string]any `json:"payload,omitempty"`
}
func CloneControlSignalView ¶ added in v0.11.0
func CloneControlSignalView(in *ControlSignalView) *ControlSignalView
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
func (*MemoryStore) AppendTranscript ¶
func (s *MemoryStore) AppendTranscript(runID string, messages ...Message) error
func (*MemoryStore) ReplaceTranscript ¶
func (s *MemoryStore) ReplaceTranscript(runID string, messages []Message) error
func (*MemoryStore) Transcript ¶
func (s *MemoryStore) Transcript(runID string) ([]Message, error)
type Message ¶
type Message struct {
Role Role
Content string
Attachments []MessageAttachment
References []MessageReference `json:"References,omitempty"`
Reasoning string
ToolCallID string
ToolName string
ToolArgs string
EntryID string
ParentEntryID string
Kind MessageKind
ToolResult *ToolResultView
Activity *ActivityPresentation `json:"activity,omitempty"`
ControlSignal *ControlSignalView `json:"control_signal,omitempty"`
CompactionID string
CompactionGeneration int
CompactionWindowID string
}
func CloneMessage ¶
func CloneMessages ¶
func ProjectProviderHistory ¶ added in v0.20.0
func ProjectProviderHistory(history []Message, supplementalAnchorEntryID string) ([]Message, int, error)
ProjectProviderHistory removes durable reference data from the provider view. The returned insertion index is relative to the projected non-system history.
type MessageAttachment ¶ added in v0.12.0
type MessageAttachment struct {
ResourceRef string `json:"resource_ref"`
Name string `json:"name"`
MIMEType string `json:"mime_type"`
SizeBytes int64 `json:"size_bytes,omitempty"`
TextStats *MessageAttachmentTextStats `json:"text_stats,omitempty"`
}
MessageAttachment is one durable host-owned resource reference associated with a user message. Floret persists and projects the opaque reference but never resolves or reads the resource itself.
func CloneMessageAttachment ¶ added in v0.25.0
func CloneMessageAttachment(attachment MessageAttachment) MessageAttachment
func CloneMessageAttachments ¶ added in v0.25.0
func CloneMessageAttachments(attachments []MessageAttachment) []MessageAttachment
func (MessageAttachment) Validate ¶ added in v0.25.0
func (a MessageAttachment) Validate() error
type MessageAttachmentTextStats ¶ added in v0.25.0
type MessageKind ¶
type MessageKind string
const ( MessageKindNormal MessageKind = "" MessageKindCompactionSummary MessageKind = "compaction_summary" MessageKindControlSignal MessageKind = "control_signal" )
type MessageReference ¶ added in v0.20.0
type MessageReference struct {
ReferenceID string `json:"reference_id"`
Kind MessageReferenceKind `json:"kind"`
Label string `json:"label"`
Text string `json:"text,omitempty"`
ResourceRef string `json:"resource_ref,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
MessageReference is one durable, user-visible reference associated with a user message. ResourceRef remains opaque to Floret.
func (MessageReference) Validate ¶ added in v0.20.0
func (r MessageReference) Validate() error
type MessageReferenceKind ¶ added in v0.20.0
type MessageReferenceKind string
const ( MessageReferenceText MessageReferenceKind = "text" MessageReferenceFile MessageReferenceKind = "file" MessageReferenceDirectory MessageReferenceKind = "directory" MessageReferenceTerminal MessageReferenceKind = "terminal" MessageReferenceProcess MessageReferenceKind = "process" )
type ToolResultView ¶
type ToolResultView struct {
Status string `json:"status,omitempty"`
Truncated bool `json:"truncated,omitempty"`
OriginalBytes int `json:"original_bytes,omitempty"`
VisibleBytes int `json:"visible_bytes,omitempty"`
OriginalLines int `json:"original_lines,omitempty"`
VisibleLines int `json:"visible_lines,omitempty"`
Strategy string `json:"strategy,omitempty"`
ContentSHA256 string `json:"content_sha256,omitempty"`
FullOutput *artifact.Ref `json:"full_output,omitempty"`
}