messagehistory

package
v0.4.46-beta Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package messagehistory persists raw user-submitted chat messages for local composer recall.

Index

Constants

View Source
const (
	// MaxEntriesPerScope is the hard cap for persisted messages in one CWD scope.
	MaxEntriesPerScope = 1000
)

Variables

This section is empty.

Functions

func ResolveScopeCWD

func ResolveScopeCWD(cwd string) (string, error)

ResolveScopeCWD normalizes cwd and, when cwd is inside a Git worktree, returns the worktree root so history is shared across subdirectories of one project.

Types

type Entry

type Entry struct {
	Version        int       `json:"v"`
	CreatedAt      time.Time `json:"ts"`
	ScopeCWD       string    `json:"scope_cwd"`
	ConversationID string    `json:"conversation_id,omitempty"`
	Profile        string    `json:"profile,omitempty"`
	Source         string    `json:"source"`
	Text           string    `json:"text"`
}

Entry is one raw user-submitted composer message.

type Store

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

Store writes JSONL history files under the Kodelet base directory.

func NewStore

func NewStore() (*Store, error)

NewStore returns a store rooted in Kodelet's private base directory. It does not create directories until a message is appended.

func NewStoreWithBasePath

func NewStoreWithBasePath(basePath string) *Store

NewStoreWithBasePath returns a store rooted at basePath.

func (*Store) Append

func (s *Store) Append(ctx context.Context, entry Entry) error

Append records entry and keeps only MaxEntriesPerScope newest valid entries for the entry's CWD scope. Adjacent duplicate text is ignored.

func (*Store) List

func (s *Store) List(ctx context.Context, scopeCWD string, limit int) ([]Entry, error)

List returns up to limit newest entries for scopeCWD, in chronological order.

Jump to

Keyboard shortcuts

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