class

Smith::Session::Store

Inherits Reference < Object

Constructors

new(base_dir : String | Nil = nil)
Source

Instance methods

base_dir
Source
create(model : String, provider : String, cwd : String = Dir.current) : Data
Source
delete(reference : String) : IndexEntry | Nil

Removes a session completely: index entry, directory (checkpoints, bash logs, media blobs), and any legacy flat file. Resolved the same way resume resolves, so a name works as well as an id — but against the index rather than the loaded transcript, so a half-written session can still be cleaned up. Returns the index entry when there was one.

Source
fork(reference : String) : Data

A copy under a new id, so one conversation can be taken two ways. The original is untouched — including its checkpoints, which stay with it.

Source
index_path
Source
latest
Source
list
Source
load(id : String) : Data
Source
media_dir(id : String) : String

Where attachment bytes live. Content-addressed, like the checkpoint blobs: the same screenshot mentioned in five turns is stored once.

Source
new_id
Source
prune(older_than : Time::Span, keep_last : Int32 = 0, protect : String | Nil = nil, dry_run : Bool = false) : Array(IndexEntry)

Deletes what prune_candidates selects and returns it; with dry_run nothing is touched and the return value is what would go.

Source
prune_candidates(older_than : Time::Span, keep_last : Int32 = 0, protect : String | Nil = nil) : Array(IndexEntry)

What prune would remove: every entry whose updated_at is older than the cutoff, except — always — the newest session, and additionally the newest keep_last when given. protect shields one more id, which is how a resume keeps the session it asked for from expiring mid-start. Returned oldest first.

Source
rename(reference : String, name : String) : Data
Source
resolve(reference : String) : Data

A reference is whatever the user typed: an id or a name. An id wins, since it is unambiguous by construction.

Source
resolve_entry(reference : String) : IndexEntry | Nil

Resolution that stops at the index entry — what delete and its dry-run share. Raises like resolve does when the reference names nothing.

Source
save(session : Data, derive_name : Bool = true, check_name : Bool = true) : Nil

derive_name and check_name exist so a rename can write a name the normal path would have refused or replaced; everyday saves want both.

Source
session_dir(id : String) : String

A session owns a directory now, so its checkpoints have somewhere to live next to it.

Source
sessions_dir
Source