session

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootID

func BootID() string

func CopySession

func CopySession(sessionID string, newSessionID string) (string, string)

func DeleteSession

func DeleteSession(sessionID string, yes bool)

func Dir

func Dir() string

func GetSessionID

func GetSessionID(sessionOverride string) string

func HashString

func HashString(s string) string

func IsAllowedNameChar added in v0.0.28

func IsAllowedNameChar(r rune) bool

func IsValidSessionName added in v0.0.28

func IsValidSessionName(name string) bool

func LookupDir added in v0.0.22

func LookupDir() string

func QuitSession

func QuitSession(sessionOverride string)

func RenameSession

func RenameSession(sessionID string, newSessionID string)

func SetSession

func SetSession(sessionId string)

func StoreSession

func StoreSession(state State)

func StoredSessionExists

func StoredSessionExists(sessionID string) bool

func TerminalId

func TerminalId() string

func TerminalSessionID

func TerminalSessionID() string

Types

type Header struct {
	SessionID         string    `json:"session_id"`
	CreatedAt         time.Time `json:"created_at"`
	UpdatedAt         time.Time `json:"updated_at"`
	InputTokens       int       `json:"input_tokens"`
	OutputTokens      int       `json:"output_tokens"`
	InputTokensAccum  int       `json:"input_tokens_accum"`
	OutputTokensAccum int       `json:"output_tokens_accum"`
}

func ListSessions

func ListSessions() []Header

type HistoryEntry

type HistoryEntry struct {
	Type    string         `json:"type"`
	Message domain.Message `json:"message"`
}

type State

type State struct {
	Header
	History []HistoryEntry `json:"history"`
}

func LoadSession

func LoadSession(sessionID string) State

func NewSession

func NewSession(newSessionName string) State

func (*State) AddMessage

func (s *State) AddMessage(message domain.Message)

func (*State) MessageHistory added in v0.0.22

func (s *State) MessageHistory() []domain.Message

Jump to

Keyboard shortcuts

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