session

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeTurnID

func ComputeTurnID(parentID string, messages []message.Message) string

func TurnLabel

func TurnLabel(messages []message.Message) string

Types

type Session

type Session struct {
	ID               string    `json:"id"`
	Name             string    `json:"name"`
	Hash             string    `json:"hash"`
	Named            bool      `json:"named"`
	CurrentTurn      string    `json:"currentTurn"`
	CreatedAt        time.Time `json:"createdAt"`
	UpdatedAt        time.Time `json:"updatedAt"`
	TurnCount        int       `json:"turnCount"`
	PromptTokens     int       `json:"promptTokens"`
	CompletionTokens int       `json:"completionTokens"`
	TotalTokens      int       `json:"totalTokens"`
	ContextTokens    int       `json:"contextTokens"`
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(dir string) (*Store, error)

func (*Store) Ancestry

func (s *Store) Ancestry(sessionID, turnID string) ([]Turn, error)

func (*Store) CommitTurn

func (s *Store) CommitTurn(sessionID string, turn *Turn) error

func (*Store) Create

func (s *Store) Create() (*Session, error)

func (*Store) Delete

func (s *Store) Delete(id string) error

func (*Store) Dir

func (s *Store) Dir() string

func (*Store) List

func (s *Store) List() ([]*Session, error)

func (*Store) Load

func (s *Store) Load(id string) (*Session, error)

func (*Store) LoadTurn

func (s *Store) LoadTurn(sessionID, turnID string) (*Turn, error)

func (*Store) SaveMeta

func (s *Store) SaveMeta(sess *Session) error

func (*Store) SetName

func (s *Store) SetName(sess *Session, firstMessage string)

func (*Store) TurnIndex

func (s *Store) TurnIndex(sessionID string) ([]TurnMeta, error)

type Turn

type Turn struct {
	ID         string            `json:"id"`
	ParentID   string            `json:"parentId"`
	Messages   []message.Message `json:"messages"`
	CreatedAt  time.Time         `json:"createdAt"`
	Subagent   string            `json:"subagent,omitempty"`
	ToolCallID string            `json:"toolCallId,omitempty"`
}

type TurnMeta

type TurnMeta struct {
	ID         string    `json:"id"`
	ParentID   string    `json:"parentId"`
	Label      string    `json:"label"`
	CreatedAt  time.Time `json:"createdAt"`
	Subagent   string    `json:"subagent,omitempty"`
	ToolCallID string    `json:"toolCallId,omitempty"`
}

Jump to

Keyboard shortcuts

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