// Package port defines interfaces (ports) for external dependencies. package port import ( "context" "github.com/orchard9/rdev/internal/domain" ) // SessionRepository manages session persistence. type SessionRepository interface { // Create stores a new session record. Create(ctx context.Context, session *domain.Session) error // Get retrieves a session by ID. Get(ctx context.Context, id domain.SessionID) (*domain.Session, error) // GetActiveByProject retrieves the active session for a project (at most one). GetActiveByProject(ctx context.Context, projectID domain.ProjectID) (*domain.Session, error) // ListByProject returns all sessions for a project, ordered by created_at DESC. ListByProject(ctx context.Context, projectID domain.ProjectID) ([]*domain.Session, error) // SetEnded marks a session as ended with a timestamp. SetEnded(ctx context.Context, id domain.SessionID) error // TouchActivity updates the last_activity_at timestamp for an active session. TouchActivity(ctx context.Context, id domain.SessionID) error // CleanupExpired marks expired sessions and returns them for preview teardown. CleanupExpired(ctx context.Context) ([]*domain.Session, error) // SetClaudeSessionID stores the Claude Code session ID and conversation record ID on a session. // Used after the first successful claude exec to enable --resume for subsequent turns. SetClaudeSessionID(ctx context.Context, id domain.SessionID, claudeSessionID, conversationRecordID string) error }