state

package
v1.45.12 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages session state

func NewManager

func NewManager() *Manager

NewManager creates a new state manager

func (*Manager) Cleanup

func (m *Manager) Cleanup(maxAge int64) error

Cleanup cleans up old state files (older than maxAge seconds)

func (*Manager) Delete

func (m *Manager) Delete(sessionID string) error

Delete deletes session state

func (*Manager) IsDuplicateMessage

func (m *Manager) IsDuplicateMessage(sessionID string, message string, windowSeconds int) (bool, error)

IsDuplicateMessage checks if the given message is a duplicate of a recent notification within the specified time window (in seconds)

func (*Manager) Load

func (m *Manager) Load(sessionID string) (*SessionState, error)

Load loads session state from disk Returns nil if state file doesn't exist

func (*Manager) Save

func (m *Manager) Save(state *SessionState) error

Save saves session state to disk

func (*Manager) ShouldSuppressQuestion

func (m *Manager) ShouldSuppressQuestion(sessionID string, cooldownSeconds int) (bool, error)

ShouldSuppressQuestion checks if a question notification should be suppressed due to being within the cooldown window after a task completion

func (*Manager) ShouldSuppressQuestionAfterAnyNotification

func (m *Manager) ShouldSuppressQuestionAfterAnyNotification(sessionID string, cooldownSeconds int) (bool, error)

ShouldSuppressQuestionAfterAnyNotification checks if a question notification should be suppressed due to being within the cooldown window after ANY notification

func (*Manager) UpdateGhosttyTerminalID

func (m *Manager) UpdateGhosttyTerminalID(sessionID, terminalID string) error

UpdateGhosttyTerminalID stores the exact Ghostty terminal ID associated with a Claude session so future notification clicks can target the correct tab.

func (*Manager) UpdateInteractiveTool

func (m *Manager) UpdateInteractiveTool(sessionID, toolName, cwd string) error

UpdateInteractiveTool updates the last interactive tool and timestamp

func (*Manager) UpdateLastNotification

func (m *Manager) UpdateLastNotification(sessionID string, status analyzer.Status, message string) error

UpdateLastNotification updates the last notification timestamp, status, and message

func (*Manager) UpdateState

func (m *Manager) UpdateState(sessionID string, status analyzer.Status, toolName, cwd string) error

UpdateState updates state based on the detected status

func (*Manager) UpdateTaskComplete

func (m *Manager) UpdateTaskComplete(sessionID string) error

UpdateTaskComplete updates the last task complete timestamp

type SessionState

type SessionState struct {
	SessionID               string `json:"session_id"`
	LastInteractiveTool     string `json:"last_interactive_tool"`
	LastTimestamp           int64  `json:"last_ts"`
	LastTaskCompleteTime    int64  `json:"last_task_complete_ts,omitempty"`
	LastNotificationTime    int64  `json:"last_notification_ts,omitempty"`
	LastNotificationStatus  string `json:"last_notification_status,omitempty"`
	LastNotificationMessage string `json:"last_notification_message,omitempty"`
	GhosttyTerminalID       string `json:"ghostty_terminal_id,omitempty"`
	CWD                     string `json:"cwd"`
}

SessionState represents per-session state

Jump to

Keyboard shortcuts

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