Documentation
¶
Index ¶
- type AutoModelSelection
- type Manager
- func (sm *Manager) ClearAutoModelSelection(routeSessionKey string) error
- func (sm *Manager) ClearSessionGoal(routeSessionKey string) error
- func (sm *Manager) ClearSessionModelOverride(routeSessionKey string) error
- func (sm *Manager) ClearSessionOverride(routeSessionKey string) error
- func (sm *Manager) ClearToolFeedbackOverride(routeSessionKey string) error
- func (sm *Manager) CreateSessionGoal(routeSessionKey, objective string) (SessionGoal, error)
- func (sm *Manager) EditSessionGoal(routeSessionKey, objective string) (SessionGoal, error)
- func (sm *Manager) GetAutoModelSelection(routeSessionKey string) (AutoModelSelection, bool)
- func (sm *Manager) GetLastChannel() string
- func (sm *Manager) GetLastChatID() string
- func (sm *Manager) GetSessionGoal(routeSessionKey string) (SessionGoal, bool)
- func (sm *Manager) GetSessionModelOverride(routeSessionKey string) (SessionModelOverride, bool)
- func (sm *Manager) GetSessionOverride(routeSessionKey string) string
- func (sm *Manager) GetTimestamp() time.Time
- func (sm *Manager) GetToolFeedbackOverride(routeSessionKey string) (bool, bool)
- func (sm *Manager) ResolveSessionEpoch(routeScopeKey string, policy session.LifecyclePolicy, now time.Time) (*session.SessionEpoch, error)
- func (sm *Manager) SetAutoModelSelection(routeSessionKey string, selection AutoModelSelection) error
- func (sm *Manager) SetLastChannel(channel string) error
- func (sm *Manager) SetLastChatID(chatID string) error
- func (sm *Manager) SetSessionGoalStatus(routeSessionKey string, status SessionGoalStatus, note string) (SessionGoal, error)
- func (sm *Manager) SetSessionModelOverride(routeSessionKey, model string) error
- func (sm *Manager) SetSessionOverride(routeSessionKey, sessionKey string) error
- func (sm *Manager) SetToolFeedbackOverride(routeSessionKey string, enabled bool) error
- func (sm *Manager) TouchSessionEpoch(routeScopeKey, epochID string, now time.Time) error
- type SessionEpochState
- type SessionGoal
- type SessionGoalStatus
- type SessionModelOverride
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoModelSelection ¶
type AutoModelSelection struct {
SelectedProvider string `json:"selected_provider,omitempty"`
SelectedModel string `json:"selected_model,omitempty"`
ActiveProvider string `json:"active_provider,omitempty"`
ActiveModel string `json:"active_model,omitempty"`
Reason string `json:"reason,omitempty"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages persistent state with atomic saves.
func NewManager ¶
NewManager creates a new state manager for the given workspace.
func NewManagerAt ¶
NewManagerAt creates a manager for an exact runtime-owned state file. It intentionally performs no legacy workspace migration.
func NewManagerAtChecked ¶
NewManagerAtChecked creates a strict manager and reports existing state that cannot be read or decoded.
func (*Manager) ClearAutoModelSelection ¶
ClearAutoModelSelection removes a persisted auto-fallback model selection.
func (*Manager) ClearSessionGoal ¶
ClearSessionGoal removes the goal for a routed session. Missing goals are a no-op so reset/new callers can clear defensively.
func (*Manager) ClearSessionModelOverride ¶
ClearSessionModelOverride removes a previously persisted manual model selection for a routed session.
func (*Manager) ClearSessionOverride ¶
ClearSessionOverride removes a previously persisted replacement session key.
func (*Manager) ClearToolFeedbackOverride ¶
ClearToolFeedbackOverride removes a persisted tool feedback override for a routed session, causing config defaults to apply again.
func (*Manager) CreateSessionGoal ¶
func (sm *Manager) CreateSessionGoal(routeSessionKey, objective string) (SessionGoal, error)
CreateSessionGoal creates one durable goal for a routed session. It fails when a goal already exists so command/tool callers cannot silently replace an operator objective.
func (*Manager) EditSessionGoal ¶
func (sm *Manager) EditSessionGoal(routeSessionKey, objective string) (SessionGoal, error)
EditSessionGoal updates the current objective while preserving status and creation metadata.
func (*Manager) GetAutoModelSelection ¶
func (sm *Manager) GetAutoModelSelection(routeSessionKey string) (AutoModelSelection, bool)
GetAutoModelSelection returns the persisted auto-fallback model selection for a routed session and whether one is present.
func (*Manager) GetLastChannel ¶
GetLastChannel returns the last channel from the state.
func (*Manager) GetLastChatID ¶
GetLastChatID returns the last chat ID from the state.
func (*Manager) GetSessionGoal ¶
func (sm *Manager) GetSessionGoal(routeSessionKey string) (SessionGoal, bool)
GetSessionGoal returns the durable goal for a routed session.
func (*Manager) GetSessionModelOverride ¶
func (sm *Manager) GetSessionModelOverride(routeSessionKey string) (SessionModelOverride, bool)
GetSessionModelOverride returns a persisted manual model selection for a routed session.
func (*Manager) GetSessionOverride ¶
GetSessionOverride returns the replacement session key for a routed session.
func (*Manager) GetTimestamp ¶
GetTimestamp returns the timestamp of the last state update.
func (*Manager) GetToolFeedbackOverride ¶
GetToolFeedbackOverride returns the persisted tool feedback override for a routed session and whether an override is present.
func (*Manager) ResolveSessionEpoch ¶
func (sm *Manager) ResolveSessionEpoch( routeScopeKey string, policy session.LifecyclePolicy, now time.Time, ) (*session.SessionEpoch, error)
func (*Manager) SetAutoModelSelection ¶
func (sm *Manager) SetAutoModelSelection(routeSessionKey string, selection AutoModelSelection) error
SetAutoModelSelection persists a temporary auto-fallback model selection for a routed session.
func (*Manager) SetLastChannel ¶
SetLastChannel atomically updates the last channel and saves the state. This method uses a temp file + rename pattern for atomic writes, ensuring that the state file is never corrupted even if the process crashes.
func (*Manager) SetLastChatID ¶
SetLastChatID atomically updates the last chat ID and saves the state.
func (*Manager) SetSessionGoalStatus ¶
func (sm *Manager) SetSessionGoalStatus( routeSessionKey string, status SessionGoalStatus, note string, ) (SessionGoal, error)
SetSessionGoalStatus changes goal state without changing the objective.
func (*Manager) SetSessionModelOverride ¶
SetSessionModelOverride persists a conversation-scoped manual model selection for a routed session.
func (*Manager) SetSessionOverride ¶
SetSessionOverride persists a replacement session key for a routed session.
func (*Manager) SetToolFeedbackOverride ¶
SetToolFeedbackOverride persists a tool feedback enable/disable override for a routed session.
type SessionEpochState ¶
type SessionGoal ¶
type SessionGoal struct {
Objective string `json:"objective"`
Status SessionGoalStatus `json:"status"`
Note string `json:"note,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
BlockedAt *time.Time `json:"blocked_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
type SessionGoalStatus ¶
type SessionGoalStatus string
const ( SessionGoalActive SessionGoalStatus = "active" SessionGoalPaused SessionGoalStatus = "paused" SessionGoalBlocked SessionGoalStatus = "blocked" SessionGoalComplete SessionGoalStatus = "complete" )
type SessionModelOverride ¶
type State ¶
type State struct {
// LastChannel is the last channel used for communication
LastChannel string `json:"last_channel,omitempty"`
// LastChatID is the last chat ID used for communication
LastChatID string `json:"last_chat_id,omitempty"`
// SessionOverrides maps the default routed session key for a conversation
// onto an explicit replacement session key created by a soft reset.
SessionOverrides map[string]string `json:"session_overrides,omitempty"`
// ToolFeedbackOverrides stores per-routed-session enable/disable overrides
// for inline tool feedback such as working_summary.
ToolFeedbackOverrides map[string]bool `json:"tool_feedback_overrides,omitempty"`
// SessionModelOverrides stores manual model selections scoped to a routed
// conversation. The stored value is the canonical configured model alias.
SessionModelOverrides map[string]SessionModelOverride `json:"session_model_overrides,omitempty"`
// AutoModelSelections stores temporary session-scoped auto-fallback routing
// state. SelectedModel identifies the user's intended model; ActiveModel is
// the temporary fallback model currently pinned for the conversation.
AutoModelSelections map[string]AutoModelSelection `json:"auto_model_selections,omitempty"`
// SessionGoals stores one durable operator objective per routed session.
SessionGoals map[string]SessionGoal `json:"session_goals,omitempty"`
// SessionEpochs stores lifecycle checkpoints for stateful idle and max-age
// rotation. Keys are stable trusted route-scope keys.
SessionEpochs map[string]SessionEpochState `json:"session_epochs,omitempty"`
// Timestamp is the last time this state was updated
Timestamp time.Time `json:"timestamp"`
}
State represents the persistent state for a workspace. It includes information about the last active channel/chat.