Documentation
¶
Overview ¶
Package session defines session domain types and interfaces.
Index ¶
Constants ¶
const ( MetaTmuxSession = "tmux_session" // tmux session name MetaTmuxPane = "tmux_pane" // tmux pane identifier )
Metadata keys for terminal integration.
Variables ¶
var ( ErrNotFound = errors.New("session not found") ErrNoRecyclable = errors.New("no recyclable session found") )
Sentinel errors for session operations.
Functions ¶
Types ¶
type Session ¶
type Session struct {
ID string `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
Path string `json:"path"`
Remote string `json:"remote"`
State State `json:"state"`
Metadata map[string]string `json:"metadata,omitempty"` // integration data (e.g., tmux session name)
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Session represents an isolated git environment for an AI agent.
Terminology:
- Session: The hive-managed git clone + terminal environment
- Agent: The AI tool (Claude, Aider, etc.) running within the session
- Tmux session: The terminal multiplexer session (if tmux integration enabled)
Relationship: Hive Session → spawns → Tmux Session → runs → Agent
Future: Hive will support multiple agents per session, enabling concurrent agents like a primary assistant and a test runner.
func (*Session) CanRecycle ¶
CanRecycle returns true if the session can be marked for recycling.
func (*Session) GetMeta ¶
GetMeta returns the value for the given metadata key, or empty string if not set.
func (*Session) InboxTopic ¶
InboxTopic returns the conventional inbox topic name for this session.
Format: agent.<session-id>.inbox
The "agent" prefix refers to the AI agent running in the session. When multi-agent support is added, named agents will use: agent.<session-id>.<agent-name>.inbox
Example: agent.26kj0c.inbox
func (*Session) MarkCorrupted ¶
MarkCorrupted transitions the session to the corrupted state.
func (*Session) MarkRecycled ¶
MarkRecycled transitions the session to the recycled state.
type Store ¶
type Store interface {
// List returns all sessions.
List(ctx context.Context) ([]Session, error)
// Get returns a session by ID. Returns ErrNotFound if not found.
Get(ctx context.Context, id string) (Session, error)
// Save creates or updates a session.
Save(ctx context.Context, s Session) error
// Delete removes a session by ID. Returns ErrNotFound if not found.
Delete(ctx context.Context, id string) error
// FindRecyclable returns a recyclable session for the given remote.
// Returns ErrNoRecyclable if none available.
FindRecyclable(ctx context.Context, remote string) (Session, error)
}
Store defines persistence operations for sessions.