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 AttachmentLabel(a MessageAttachment) string
- func CurrentGoalContext(history []Message) string
- func EqualModelContext(a, b *ModelContextSnapshot) bool
- func HasRetryEligibleDurableInput(message Message) bool
- func ModelContextChanges(previous, next *ModelContextSnapshot) ([]string, []string)
- func ProviderContent(message Message) string
- func RenderModelContext(previous, next *ModelContextSnapshot) string
- func ValidateMessageAttachments(attachments []MessageAttachment) error
- func ValidateMessageContext(items []MessageContextItem) error
- func ValidateMessageReferences(references []MessageReference) error
- func ValidateStoredMessageAttachments(attachments []MessageAttachment) error
- func ValidateToolHistory(messages []Message) error
- type ActivityChip
- type ActivityPresentation
- type ActivityTargetRef
- type ControlSignalView
- type GoalState
- type MemoryStore
- type Message
- type MessageAttachment
- type MessageAttachmentTextStats
- type MessageContextItem
- type MessageKind
- type MessageReference
- type MessageReferenceKind
- type ModelContextPart
- type ModelContextSection
- type ModelContextSnapshot
- 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 )
const ControlSignalErrorCodeControlError = "control_error"
Variables ¶
This section is empty.
Functions ¶
func AttachmentLabel ¶ added in v7.51.0
func AttachmentLabel(a MessageAttachment) string
AttachmentLabel renders an admitted descriptor without its opaque resource.
func CurrentGoalContext ¶ added in v7.59.0
func EqualModelContext ¶ added in v7.40.0
func EqualModelContext(a, b *ModelContextSnapshot) bool
func HasRetryEligibleDurableInput ¶
HasRetryEligibleDurableInput reports whether a canonical user message can be replayed without depending on turn-scoped supplemental context.
func ModelContextChanges ¶ added in v7.40.0
func ModelContextChanges(previous, next *ModelContextSnapshot) ([]string, []string)
func ProviderContent ¶ added in v7.8.0
ProviderContent renders submitted facts in order without opaque locators. JSON strings delimit host/user data without granting it instruction authority.
func RenderModelContext ¶ added in v7.40.0
func RenderModelContext(previous, next *ModelContextSnapshot) string
RenderModelContext derives a deterministic change message, never a second fact store.
func ValidateMessageAttachments ¶
func ValidateMessageAttachments(attachments []MessageAttachment) error
func ValidateMessageContext ¶ added in v7.8.0
func ValidateMessageContext(items []MessageContextItem) error
func ValidateMessageReferences ¶
func ValidateMessageReferences(references []MessageReference) error
func ValidateStoredMessageAttachments ¶
func ValidateStoredMessageAttachments(attachments []MessageAttachment) error
ValidateStoredMessageAttachments preserves the attachment shape accepted by earlier schema-v16 journals. New admission must use ValidateMessageAttachments.
func ValidateToolHistory ¶ added in v7.1.5
ValidateToolHistory checks complete local tool exchanges before rendering or provider-native continuation selection. Call IDs may recur in later exchanges.
Types ¶
type ActivityChip ¶
type ActivityChip = tools.ActivityChip
type ActivityPresentation ¶
type ActivityPresentation = tools.ActivityPresentation
func CloneActivityPresentation ¶
func CloneActivityPresentation(in *ActivityPresentation) *ActivityPresentation
type ActivityTargetRef ¶
type ActivityTargetRef = tools.ActivityTargetRef
type ControlSignalView ¶
type ControlSignalView struct {
Name string `json:"name,omitempty"`
CallID string `json:"call_id,omitempty"`
Disposition string `json:"disposition,omitempty"`
ErrorCode string `json:"error_code,omitempty"`
OutputText string `json:"output_text,omitempty"`
ArgsHash string `json:"args_hash,omitempty"`
Payload map[string]any `json:"payload,omitempty"`
}
func CloneControlSignalView ¶
func CloneControlSignalView(in *ControlSignalView) *ControlSignalView
type GoalState ¶ added in v7.59.0
type GoalState struct {
Version int64 `json:"version"`
Text string `json:"text,omitempty"`
Status string `json:"status"`
Actor string `json:"actor"`
SuppressedAtInput string `json:"suppressed_at_input,omitempty"`
}
GoalState is an exact runtime fact. Text is never summarized or truncated.
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) Transcript ¶
func (s *MemoryStore) Transcript(runID string) ([]Message, error)
type Message ¶
type Message struct {
GoalContextBaseline string `json:"goal_context_baseline,omitempty"`
ModelContextParts []ModelContextPart `json:"-"`
Sources []citation.Source `json:"sources,omitempty"`
Role Role
Content string
Attachments []MessageAttachment
References []MessageReference `json:"References,omitempty"`
Context []MessageContextItem `json:"Context,omitempty"`
ModelContextSnapshot *ModelContextSnapshot `json:"model_context_snapshot,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 ¶
type MessageAttachment ¶
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 or confirmed tool result. Floret projects the opaque reference but never resolves or reads the resource itself.
func CloneMessageAttachment ¶
func CloneMessageAttachment(attachment MessageAttachment) MessageAttachment
func CloneMessageAttachments ¶
func CloneMessageAttachments(attachments []MessageAttachment) []MessageAttachment
func (MessageAttachment) Locator ¶ added in v7.51.0
func (a MessageAttachment) Locator() (string, error)
Locator identifies the complete canonical descriptor and conveys no authority.
func (MessageAttachment) Validate ¶
func (a MessageAttachment) Validate() error
type MessageContextItem ¶ added in v7.8.0
type MessageContextItem struct {
Kind string `json:"kind"`
Title string `json:"title"`
Text string `json:"text"`
}
MessageContextItem is an admitted host snapshot, effective from its user message onward. It is model context, never resource authorization evidence.
func (MessageContextItem) Validate ¶ added in v7.8.0
func (item MessageContextItem) Validate() error
type MessageKind ¶
type MessageKind string
const ( MessageKindNormal MessageKind = "" MessageKindParentEvents MessageKind = "parent_events" MessageKindModelContext MessageKind = "model_context" MessageKindToolValidationError MessageKind = "tool_validation_error" MessageKindCompactionSummary MessageKind = "compaction_summary" MessageKindControlSignal MessageKind = "control_signal" )
const MessageKindGoalContext MessageKind = "goal_context"
const MessageKindGoalReview MessageKind = "goal_review"
type MessageReference ¶
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"`
// ReferencedThreadID identifies the referenced conversation, never the owning thread.
ReferencedThreadID string `json:"referenced_thread_id,omitempty"`
}
MessageReference is one durable, user-visible reference associated with a user message. ResourceRef remains opaque to Floret.
func (MessageReference) Validate ¶
func (r MessageReference) Validate() error
type MessageReferenceKind ¶
type MessageReferenceKind string
const ( MessageReferenceText MessageReferenceKind = "text" MessageReferenceFile MessageReferenceKind = "file" MessageReferenceDirectory MessageReferenceKind = "directory" MessageReferenceTerminal MessageReferenceKind = "terminal" MessageReferenceProcess MessageReferenceKind = "process" MessageReferenceThread MessageReferenceKind = "thread" )
type ModelContextPart ¶ added in v7.45.0
ModelContextPart is emitted only by the canonical renderer, in memory.
type ModelContextSection ¶ added in v7.40.0
type ModelContextSection struct {
Key string `json:"key"`
Title string `json:"title"`
Text string `json:"text"`
}
ModelContextSection is one complete, replaceable runtime fact partition.
type ModelContextSnapshot ¶ added in v7.40.0
type ModelContextSnapshot struct {
Sections []ModelContextSection `json:"sections"`
}
ModelContextSnapshot is a complete replacement. Nil means no supplied update.
func CloneModelContext ¶ added in v7.40.0
func CloneModelContext(in *ModelContextSnapshot) *ModelContextSnapshot
func CurrentModelContext ¶ added in v7.40.0
func CurrentModelContext(history []Message) *ModelContextSnapshot
CurrentModelContext reduces canonical facts in chronological order.
func NormalizeModelContext ¶ added in v7.40.0
func NormalizeModelContext(in *ModelContextSnapshot) (*ModelContextSnapshot, error)
type ToolResultView ¶
type ToolResultView struct {
EffectOutcome tools.EffectOutcome `json:"effect_outcome,omitempty"`
InputRequired *tools.InputRequest `json:"input_required,omitempty"`
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"`
Attachments []MessageAttachment `json:"attachments,omitempty"`
}