Documentation
¶
Index ¶
- type EmbeddedSessionState
- func (s *EmbeddedSessionState) HideToolResults() bool
- func (s *EmbeddedSessionState) PreviousMessage() *types.Message
- func (s *EmbeddedSessionState) SetPreviousMessage(msg *types.Message)
- func (s *EmbeddedSessionState) SetYoloMode(yoloMode bool)
- func (s *EmbeddedSessionState) ToggleHideToolResults()
- func (s *EmbeddedSessionState) YoloMode() bool
- type PauseState
- type SessionState
- func (s *SessionState) AgentCost(agentName string) (float64, bool)
- func (s *SessionState) AgentUsage(agentName string) (runtime.Usage, bool)
- func (s *SessionState) AvailableAgents() []runtime.AgentDetails
- func (s *SessionState) CurrentAgentName() string
- func (s *SessionState) ExpandThinking() bool
- func (s *SessionState) GetCurrentAgent() runtime.AgentDetails
- func (s *SessionState) HideToolResults() bool
- func (s *SessionState) PauseState() PauseState
- func (s *SessionState) PreviousMessage() *types.Message
- func (s *SessionState) SeedRestoredCosts(sess *session.Session)
- func (s *SessionState) SessionTitle() string
- func (s *SessionState) SetAgentUsage(sessionID, agentName string, usage runtime.Usage)
- func (s *SessionState) SetAvailableAgents(availableAgents []runtime.AgentDetails)
- func (s *SessionState) SetCurrentAgentName(currentAgentName string)
- func (s *SessionState) SetExpandThinking(expandThinking bool)
- func (s *SessionState) SetHideToolResults(hideToolResults bool)
- func (s *SessionState) SetPauseState(state PauseState)
- func (s *SessionState) SetPreviousMessage(previousMessage *types.Message)
- func (s *SessionState) SetSessionTitle(sessionTitle string)
- func (s *SessionState) SetSplitDiffView(enabled bool)
- func (s *SessionState) SetYoloMode(yoloMode bool)
- func (s *SessionState) SplitDiffView() bool
- func (s *SessionState) ToggleHideToolResults()
- func (s *SessionState) ToggleSplitDiffView()
- func (s *SessionState) YoloMode() bool
- type SessionStateReader
- type StaticSessionState
- func (s StaticSessionState) AvailableAgents() []runtime.AgentDetails
- func (s StaticSessionState) CurrentAgentName() string
- func (s StaticSessionState) ExpandThinking() bool
- func (s StaticSessionState) GetCurrentAgent() runtime.AgentDetails
- func (s StaticSessionState) HideToolResults() bool
- func (s StaticSessionState) PauseState() PauseState
- func (s StaticSessionState) PreviousMessage() *types.Message
- func (s StaticSessionState) SessionTitle() string
- func (s StaticSessionState) SplitDiffView() bool
- func (s StaticSessionState) YoloMode() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmbeddedSessionState ¶ added in v1.104.0
type EmbeddedSessionState struct {
StaticSessionState
// contains filtered or unexported fields
}
EmbeddedSessionState extends StaticSessionState with the mutable state the message-list component maintains: the previous message (for grouping consecutive messages from the same sender), the tool-results visibility toggle, and the session-wide tool approval the confirmation dialog flips. Use it to host the message list outside the full TUI application.
func (*EmbeddedSessionState) HideToolResults ¶ added in v1.104.0
func (s *EmbeddedSessionState) HideToolResults() bool
func (*EmbeddedSessionState) PreviousMessage ¶ added in v1.104.0
func (s *EmbeddedSessionState) PreviousMessage() *types.Message
func (*EmbeddedSessionState) SetPreviousMessage ¶ added in v1.104.0
func (s *EmbeddedSessionState) SetPreviousMessage(msg *types.Message)
func (*EmbeddedSessionState) SetYoloMode ¶ added in v1.109.0
func (s *EmbeddedSessionState) SetYoloMode(yoloMode bool)
func (*EmbeddedSessionState) ToggleHideToolResults ¶ added in v1.104.0
func (s *EmbeddedSessionState) ToggleHideToolResults()
func (*EmbeddedSessionState) YoloMode ¶ added in v1.109.0
func (s *EmbeddedSessionState) YoloMode() bool
type PauseState ¶ added in v1.82.0
type PauseState int
PauseState describes how /pause is currently affecting the runtime loop for a session, so the TUI can show whether the system is winding down a roundtrip before pausing or fully paused.
const ( // PauseNone means the runtime is not paused. PauseNone PauseState = iota // PausePausing means /pause was requested but the runtime is still // finishing the in-flight LLM request and its tool calls. PausePausing // PausePaused means the runtime has reached an iteration boundary and is // idle until the user resumes. PausePaused )
type SessionState ¶
type SessionState struct {
// contains filtered or unexported fields
}
SessionState holds shared state across the TUI application. This provides a centralized location for state that needs to be accessible by multiple components.
func NewSessionState ¶
func NewSessionState(s *session.Session) *SessionState
func (*SessionState) AgentCost ¶ added in v1.112.0
func (s *SessionState) AgentCost(agentName string) (float64, bool)
AgentCost returns the cumulative cost currently attributed to the named agent — its restored historical total (see SeedRestoredCosts) plus every live session attributed to it — and whether any cost is attributable to it. A false result means none is (the agent never ran and has no restored spend, or an in-session handoff moved its sessions to another agent) — distinct from a true result with a zero total, which means the agent ran at no cost.
func (*SessionState) AgentUsage ¶ added in v1.99.0
func (s *SessionState) AgentUsage(agentName string) (runtime.Usage, bool)
AgentUsage returns the latest token-usage snapshot recorded for the named agent, and whether one exists (an agent that has not run yet has none).
func (*SessionState) AvailableAgents ¶
func (s *SessionState) AvailableAgents() []runtime.AgentDetails
func (*SessionState) CurrentAgentName ¶
func (s *SessionState) CurrentAgentName() string
func (*SessionState) ExpandThinking ¶ added in v1.60.0
func (s *SessionState) ExpandThinking() bool
func (*SessionState) GetCurrentAgent ¶
func (s *SessionState) GetCurrentAgent() runtime.AgentDetails
func (*SessionState) HideToolResults ¶
func (s *SessionState) HideToolResults() bool
func (*SessionState) PauseState ¶ added in v1.82.0
func (s *SessionState) PauseState() PauseState
func (*SessionState) PreviousMessage ¶
func (s *SessionState) PreviousMessage() *types.Message
func (*SessionState) SeedRestoredCosts ¶ added in v1.112.0
func (s *SessionState) SeedRestoredCosts(sess *session.Session)
SeedRestoredCosts resets the per-agent usage/cost state and installs the per-agent historical cost reconstructed from a restored session's tree: per-message costs summed by AgentName, recursing into embedded sub-sessions. Replace semantics keep repeated loads and session switches honest — nothing recorded for a previously shown session survives. Costs that carry no agent identity (compaction summaries, agent-less messages) are deliberately left unattributed: they stay part of the aggregate baseline but never appear on an agent. Per-agent context snapshots are not fabricated either; every agent reads as unknown until it runs again.
func (*SessionState) SessionTitle ¶
func (s *SessionState) SessionTitle() string
func (*SessionState) SetAgentUsage ¶ added in v1.99.0
func (s *SessionState) SetAgentUsage(sessionID, agentName string, usage runtime.Usage)
SetAgentUsage records the latest token-usage snapshot for the named agent and attributes the session's cumulative cost to it. Each snapshot carries cumulative totals for the session that emitted it, so the last write always reflects that session's current context usage and cost.
Attribution is last-writer-wins per session: when a session's events start carrying a different agent name (an in-session handoff), the whole session's cumulative cost moves to the new agent. The snapshots carry no per-agent split of a shared session, so this keeps the total honest (never double-counted) at the price of crediting the session's earlier spend to the agent that finished it.
func (*SessionState) SetAvailableAgents ¶
func (s *SessionState) SetAvailableAgents(availableAgents []runtime.AgentDetails)
func (*SessionState) SetCurrentAgentName ¶
func (s *SessionState) SetCurrentAgentName(currentAgentName string)
func (*SessionState) SetExpandThinking ¶ added in v1.60.0
func (s *SessionState) SetExpandThinking(expandThinking bool)
func (*SessionState) SetHideToolResults ¶
func (s *SessionState) SetHideToolResults(hideToolResults bool)
func (*SessionState) SetPauseState ¶ added in v1.82.0
func (s *SessionState) SetPauseState(state PauseState)
func (*SessionState) SetPreviousMessage ¶
func (s *SessionState) SetPreviousMessage(previousMessage *types.Message)
func (*SessionState) SetSessionTitle ¶
func (s *SessionState) SetSessionTitle(sessionTitle string)
func (*SessionState) SetSplitDiffView ¶ added in v1.109.0
func (s *SessionState) SetSplitDiffView(enabled bool)
func (*SessionState) SetYoloMode ¶
func (s *SessionState) SetYoloMode(yoloMode bool)
func (*SessionState) SplitDiffView ¶
func (s *SessionState) SplitDiffView() bool
func (*SessionState) ToggleHideToolResults ¶
func (s *SessionState) ToggleHideToolResults()
func (*SessionState) ToggleSplitDiffView ¶
func (s *SessionState) ToggleSplitDiffView()
func (*SessionState) YoloMode ¶
func (s *SessionState) YoloMode() bool
type SessionStateReader ¶
type SessionStateReader interface {
SplitDiffView() bool
ExpandThinking() bool
YoloMode() bool
HideToolResults() bool
CurrentAgentName() string
PreviousMessage() *types.Message
SessionTitle() string
AvailableAgents() []runtime.AgentDetails
GetCurrentAgent() runtime.AgentDetails
PauseState() PauseState
}
SessionStateReader provides read-only access to session state. Components that only need to read state should depend on this interface rather than the full SessionState, following the principle of least privilege.
type StaticSessionState ¶ added in v1.75.0
type StaticSessionState struct {
// AgentName is returned by CurrentAgentName.
AgentName string
// Title is returned by SessionTitle.
Title string
}
StaticSessionState is a SessionStateReader with fixed, conservative values for embedders that render message and tool views outside the full TUI application: unified (non-split) diff view, collapsed thinking, tool results shown, no yolo mode. Embed or use it directly instead of hand-rolling a stub, so views keep working with sensible defaults when the reader interface grows.
func (StaticSessionState) AvailableAgents ¶ added in v1.75.0
func (s StaticSessionState) AvailableAgents() []runtime.AgentDetails
func (StaticSessionState) CurrentAgentName ¶ added in v1.75.0
func (s StaticSessionState) CurrentAgentName() string
func (StaticSessionState) ExpandThinking ¶ added in v1.75.0
func (s StaticSessionState) ExpandThinking() bool
func (StaticSessionState) GetCurrentAgent ¶ added in v1.75.0
func (s StaticSessionState) GetCurrentAgent() runtime.AgentDetails
func (StaticSessionState) HideToolResults ¶ added in v1.75.0
func (s StaticSessionState) HideToolResults() bool
func (StaticSessionState) PauseState ¶ added in v1.82.0
func (s StaticSessionState) PauseState() PauseState
func (StaticSessionState) PreviousMessage ¶ added in v1.75.0
func (s StaticSessionState) PreviousMessage() *types.Message
func (StaticSessionState) SessionTitle ¶ added in v1.75.0
func (s StaticSessionState) SessionTitle() string
func (StaticSessionState) SplitDiffView ¶ added in v1.75.0
func (s StaticSessionState) SplitDiffView() bool
func (StaticSessionState) YoloMode ¶ added in v1.75.0
func (s StaticSessionState) YoloMode() bool
Directories
¶
| Path | Synopsis |
|---|---|
|
Package supervisor manages agent sessions.
|
Package supervisor manages agent sessions. |
|
Package tuistate provides persistent TUI state storage (tabs, recent/favorite directories).
|
Package tuistate provides persistent TUI state storage (tabs, recent/favorite directories). |