session

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportMarkdown

func ExportMarkdown(s *Session) string

ExportMarkdown serializes a Session into a human-readable markdown document — useful for sharing a working session in a PR description, an issue, or just archiving. We deliberately omit the system message (boilerplate plus injected memory, not interesting to a reader) and fence tool output for clarity.

Living in the session package (rather than internal/tui) lets the non-interactive cobra subcommands call it without dragging the bubbletea/lipgloss dependency tree into the CLI binary's non-interactive paths.

Types

type Session

type Session struct {
	ID       string            `json:"id"`
	Name     string            `json:"name,omitempty"`
	Model    string            `json:"model"`
	Created  time.Time         `json:"created"`
	Cwd      string            `json:"cwd"`
	Messages []adapter.Message `json:"messages"`
	// contains filtered or unexported fields
}

Session is one resumable conversation persisted as JSON in ~/.yottacode/sessions/<id>.json.

Name is an optional human-readable label set via the /sessions picker's Rename action. It's a soft alias: Load will fall back to a Name match if the requested id doesn't resolve to a file.

func Load

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

Load reads a stored session by id (filename match) or name (Name field match). The legacy "last" keyword shortcut was retired alongside the /resume slash command — the /sessions picker (and the `yottacode sessions resume <id|name>` cobra subcommand) is the canonical path for "load the most recent" now, with the picker defaulting the cursor to the newest entry.

func New

func New(model, cwd string) (*Session, error)

New starts a fresh session and reserves its file path.

func (*Session) Save

func (s *Session) Save() error

Save atomically writes the session to disk.

type SessionInfo

type SessionInfo struct {
	ID       string
	Name     string
	Model    string
	Created  time.Time
	Messages int
}

SessionInfo is a metadata-only view returned by List.

func List

func List() ([]SessionInfo, error)

List returns every saved session's metadata, newest first. Doesn't load the full message log to keep this cheap for the /sessions slash command.

Jump to

Keyboard shortcuts

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