session

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("session not found")

Functions

func DefaultDir

func DefaultDir() (string, error)

func TitleFromMessages

func TitleFromMessages(messages []llm.Message) string

func TitleFromText

func TitleFromText(text string) string

Types

type Metadata

type Metadata struct {
	ID    string `json:"id"`
	Title string `json:"title,omitempty"`
	CWD   string `json:"cwd"`
	Model string `json:"model"`
	// Provider records which LLM backend produced this transcript. Transcripts
	// can carry provider-specific blocks, so resume logic uses this to decide
	// whether the saved model still applies.
	Provider  string    `json:"provider,omitempty"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type SearchResult

type SearchResult struct {
	Metadata Metadata
	Excerpt  string
}

type SearchWarning

type SearchWarning struct {
	ID  string
	Err error
}

type Session

type Session struct {
	Metadata Metadata      `json:"metadata"`
	Messages []llm.Message `json:"messages"`
	Usage    llm.Usage     `json:"usage"`
}

type Store

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

Store persists sessions as one JSON file each plus an index.json summary. Index mutations are read-modify-write with an atomic rename and no cross-process lock — like the auth store, this assumes a single interactive CLI per sessions directory; concurrent neo processes can lose index updates (session files themselves are never affected).

func DefaultStore

func DefaultStore() (*Store, error)

func NewStore

func NewStore(dir string) *Store

func (*Store) Create

func (s *Store) Create(ctx context.Context, meta Metadata) (*Session, error)

func (*Store) Dir

func (s *Store) Dir() string

func (*Store) List

func (s *Store) List(_ context.Context) ([]Metadata, error)

func (*Store) Load

func (s *Store) Load(_ context.Context, id string) (*Session, error)

func (*Store) Save

func (s *Store) Save(_ context.Context, sess *Session) error

func (*Store) Search

func (s *Store) Search(ctx context.Context, query string) ([]SearchResult, []SearchWarning, error)

Jump to

Keyboard shortcuts

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