session

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package session provides SQLite-based session lookup for Codex CLI threads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatabasePath

func DatabasePath(codexHome string) string

DatabasePath returns the full path to the Codex state database.

func DefaultCodexHome

func DefaultCodexHome() (string, error)

DefaultCodexHome returns the default Codex home directory (~/.codex).

Types

type ThreadRow

type ThreadRow struct {
	ID               string
	RolloutPath      string
	CreatedAt        time.Time
	UpdatedAt        time.Time
	Title            string
	Source           string
	ModelProvider    string
	Cwd              string
	SandboxPolicy    string
	ApprovalMode     string
	TokensUsed       int64
	Archived         bool
	ArchivedAt       *time.Time
	GitSHA           *string
	GitBranch        *string
	GitOriginURL     *string
	CLIVersion       string
	FirstUserMessage string
	AgentNickname    *string
	AgentRole        *string
	MemoryMode       string
}

ThreadRow represents a row from the Codex threads table.

func LookupThread

func LookupThread(
	ctx context.Context,
	dbPath string,
	sessionID string,
	projectPath string,
) (*ThreadRow, error)

LookupThread queries the Codex threads table for a session by ID. When projectPath is non-empty, it also filters by the cwd column. Returns ErrSessionNotFound when no matching row exists or the database file is missing.

Jump to

Keyboard shortcuts

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