session

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

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

FileStore implements Store backed by a JSON file.

func NewFileStore

func NewFileStore(path string) *FileStore

NewFileStore creates a file-backed session store. If the file exists, sessions are loaded from it.

func (*FileStore) Create

func (s *FileStore) Create(sess *Session) error

func (*FileStore) Delete

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

func (*FileStore) Get

func (s *FileStore) Get(id string) (*Session, error)

func (*FileStore) List

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

func (*FileStore) Update

func (s *FileStore) Update(sess *Session) error

type Manager

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

Manager provides session lifecycle operations on top of a Store.

func NewManager

func NewManager(store Store) *Manager

NewManager creates a Manager backed by the given Store.

func (*Manager) CreateSession

func (m *Manager) CreateSession(provider, env, dir, model, sandboxName string) (*Session, error)

CreateSession creates a new session with a generated UUID and persists it.

func (*Manager) Store

func (m *Manager) Store() Store

Store returns the underlying Store for direct access when needed.

type Session

type Session struct {
	ID           string        `json:"id"`
	AgentConfig  string        `json:"agent_config,omitempty"`
	Environment  string        `json:"environment"`
	SandboxName  string        `json:"sandbox_name,omitempty"`
	Provider     string        `json:"provider"`
	Status       SessionStatus `json:"status"`
	Model        string        `json:"model,omitempty"`
	WorkingDir   string        `json:"working_dir"`
	StartTime    time.Time     `json:"start_time"`
	LastActivity time.Time     `json:"last_activity"`
	TokensIn     int64         `json:"tokens_in"`
	TokensOut    int64         `json:"tokens_out"`
	CostUSD      float64       `json:"cost_usd"`
}

Session tracks a managed agent session across its full lifecycle.

type SessionStatus

type SessionStatus string

SessionStatus represents the lifecycle state of a managed session.

const (
	StatusCreated    SessionStatus = "created"
	StatusRunning    SessionStatus = "running"
	StatusIdle       SessionStatus = "idle"
	StatusTerminated SessionStatus = "terminated"
	StatusError      SessionStatus = "error"
)

type Store

type Store interface {
	Create(s *Session) error
	Get(id string) (*Session, error)
	List() ([]*Session, error)
	Update(s *Session) error
	Delete(id string) error
}

Store defines CRUD operations for session persistence.

Jump to

Keyboard shortcuts

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