session

package
v0.3.86 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 2 Imported by: 0

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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityChip added in v0.3.47

type ActivityChip struct {
	Kind  string `json:"kind"`
	Label string `json:"label"`
	Value string `json:"value,omitempty"`
	Tone  string `json:"tone,omitempty"`
}

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 ActivityTargetRef struct {
	Kind  string `json:"kind"`
	Label string `json:"label"`
	URI   string `json:"uri,omitempty"`
	Path  string `json:"path,omitempty"`
	Line  int    `json:"line,omitempty"`
}

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
	Reasoning            string
	ToolCallID           string
	ToolName             string
	ToolArgs             string
	EntryID              string
	ParentEntryID        string
	Kind                 MessageKind
	ToolResult           *ToolResultView
	Activity             *ActivityPresentation `json:"activity,omitempty"`
	CompactionID         string
	CompactionGeneration int
	CompactionWindowID   string
}

func CloneMessage

func CloneMessage(msg Message) Message

func CloneMessages

func CloneMessages(messages []Message) []Message

type MessageKind

type MessageKind string
const (
	MessageKindNormal            MessageKind = ""
	MessageKindCompactionSummary MessageKind = "compaction_summary"
	MessageKindControlSignal     MessageKind = "control_signal"
)

type Role

type Role string
const (
	System    Role = "system"
	User      Role = "user"
	Assistant Role = "assistant"
	Tool      Role = "tool"
)

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"`
}

type TranscriptStore

type TranscriptStore interface {
	AppendTranscript(runID string, messages ...Message) error
	Transcript(runID string) ([]Message, error)
	ReplaceTranscript(runID string, messages []Message) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL