history

package
v0.167.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HistoryManager

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

HistoryManager manages both in-memory and shell history

func NewHistoryManager

func NewHistoryManager(maxInMemory int) (*HistoryManager, error)

NewHistoryManager creates a new history manager

func NewHistoryManagerWithName added in v0.127.0

func NewHistoryManagerWithName(maxInMemory int, configDir, name string) (*HistoryManager, error)

NewHistoryManagerWithName creates a new history manager with a custom config directory and an optional name. When name is empty, the history file is stored at <configDir>/history/history (the main agent). When name is non-empty, the history file is stored at <configDir>/history/history-<name> (e.g. for subagents).

func NewHistoryManagerWithProvider added in v0.148.0

func NewHistoryManagerWithProvider(maxInMemory int, provider ShellHistoryProvider) *HistoryManager

NewHistoryManagerWithProvider creates a history manager on top of any ShellHistoryProvider (e.g. a storage-backend-backed one).

func NewMemoryOnlyHistoryManager

func NewMemoryOnlyHistoryManager(maxInMemory int) *HistoryManager

NewMemoryOnlyHistoryManager creates a history manager that only uses in-memory storage

func (*HistoryManager) AddToHistory

func (hm *HistoryManager) AddToHistory(command string) error

AddToHistory adds a command to both in-memory and shell history

func (*HistoryManager) GetHistoryCount

func (hm *HistoryManager) GetHistoryCount() int

GetHistoryCount returns the total number of commands in history

func (*HistoryManager) GetShellHistoryFile

func (hm *HistoryManager) GetShellHistoryFile() string

GetShellHistoryFile returns the shell history file path

func (*HistoryManager) IsNavigating added in v0.76.1

func (hm *HistoryManager) IsNavigating() bool

IsNavigating returns true if currently navigating through history

func (*HistoryManager) NavigateDown

func (hm *HistoryManager) NavigateDown(currentText string) string

NavigateDown moves down in history (to newer commands)

func (*HistoryManager) NavigateUp

func (hm *HistoryManager) NavigateUp(currentText string) string

NavigateUp moves up in history (to older commands)

func (*HistoryManager) ResetNavigation

func (hm *HistoryManager) ResetNavigation()

ResetNavigation resets history navigation state

type MemoryOnlyShellHistory

type MemoryOnlyShellHistory struct{}

MemoryOnlyShellHistory provides a no-op shell history provider for testing

func (*MemoryOnlyShellHistory) GetHistoryFile

func (m *MemoryOnlyShellHistory) GetHistoryFile() string

func (*MemoryOnlyShellHistory) LoadHistory

func (m *MemoryOnlyShellHistory) LoadHistory() ([]string, error)

func (*MemoryOnlyShellHistory) SaveToHistory

func (m *MemoryOnlyShellHistory) SaveToHistory(command string) error

type ShellHistory

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

ShellHistory implements project-specific history backed by a plain file.

func NewShellHistory

func NewShellHistory() (*ShellHistory, error)

NewShellHistory creates a new shell history provider

func NewShellHistoryWithName added in v0.127.0

func NewShellHistoryWithName(configDir, name string) (*ShellHistory, error)

NewShellHistoryWithName creates a new shell history provider with a custom config directory and an optional name. When name is empty, the history file is stored at <configDir>/history/history (the main agent). When name is non-empty, the history file is stored at <configDir>/history/history-<name> (e.g. for subagents).

func (*ShellHistory) GetHistoryFile

func (sh *ShellHistory) GetHistoryFile() string

GetHistoryFile returns the current history file path

func (*ShellHistory) LoadHistory

func (sh *ShellHistory) LoadHistory() ([]string, error)

LoadHistory loads commands from the history file

func (*ShellHistory) SaveToHistory

func (sh *ShellHistory) SaveToHistory(command string) error

SaveToHistory appends a command to the history file

type ShellHistoryProvider

type ShellHistoryProvider interface {
	LoadHistory() ([]string, error)
	SaveToHistory(command string) error
	GetHistoryFile() string
}

ShellHistoryProvider interface defines methods for shell history operations

type StoreShellHistory added in v0.148.0

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

StoreShellHistory is a ShellHistoryProvider backed by a storage backend (jsonl/sqlite/postgres/redis/memory/d1) instead of a local file.

func NewStoreShellHistory added in v0.148.0

func NewStoreShellHistory(store storage.ShellHistoryStorage) *StoreShellHistory

NewStoreShellHistory creates a shell history provider backed by the given ShellHistoryStorage.

func (*StoreShellHistory) GetHistoryFile added in v0.148.0

func (sh *StoreShellHistory) GetHistoryFile() string

GetHistoryFile returns "" - the history is not backed by a single local file.

func (*StoreShellHistory) LoadHistory added in v0.148.0

func (sh *StoreShellHistory) LoadHistory() ([]string, error)

LoadHistory loads all commands from the storage backend.

func (*StoreShellHistory) SaveToHistory added in v0.148.0

func (sh *StoreShellHistory) SaveToHistory(command string) error

SaveToHistory appends a command to the storage backend.

Jump to

Keyboard shortcuts

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