Documentation
¶
Overview ¶
Package session exposes TARS' file-backed chat session and transcript persistence for external agent applications. It is a thin alias layer over internal/session; the on-disk format (sessions/sessions.json index plus one sessions/{id}.jsonl transcript per session) is unchanged. Construct a Store with NewStore(dir); obtain a session's transcript path via (*Store).TranscriptPath(id); then append/read/load messages with the transcript helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrCwdNotEligible = internal.ErrCwdNotEligible
ErrCwdNotEligible is returned by SetCurrentDir when the supplied directory is not under a configured work_dirs entry.
var ErrSessionKindUnsupported = internal.ErrSessionKindUnsupported
ErrSessionKindUnsupported is returned by goal mutations when the session kind does not support goals.
var ErrSessionNotFound = internal.ErrSessionNotFound
ErrSessionNotFound is returned when a session ID does not resolve to an existing session.
Functions ¶
func AppendMessage ¶
AppendMessage appends one message as a JSON line to the transcript at path.
func EstimateMessageTokenCost ¶
EstimateMessageTokenCost returns the token estimate used for history budgeting.
func RewriteMessages ¶
RewriteMessages replaces the transcript contents with msgs.
Types ¶
type HistorySnapshot ¶
type HistorySnapshot = internal.HistorySnapshot
func LoadHistorySnapshot ¶
func LoadHistorySnapshot(path string, maxTokens int) (HistorySnapshot, error)
LoadHistorySnapshot is LoadHistory plus token/compaction metadata.
type Message ¶
func LoadHistory ¶
LoadHistory returns the most recent messages fitting within maxTokens, oldest-first.
func ReadMessages ¶
ReadMessages reads all messages from the transcript at path (empty if absent).