Documentation
¶
Overview ¶
Package session implements scanning, filtering, and deletion for Codex sessions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeleteOptions ¶
type DeleteOptions struct {
DryRun bool
Confirm bool
Yes bool
Hard bool
MaxBatch int
TrashRoot string
SessionsRoot string
}
DeleteOptions controls delete mode and safety gates.
type DeleteResult ¶
type DeleteResult struct {
SessionID string `json:"session_id"`
Path string `json:"path"`
Destination string `json:"destination,omitempty"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
}
DeleteResult is a per-session execution result entry.
type DeleteSummary ¶
type DeleteSummary struct {
Action string `json:"action"`
Simulation bool `json:"simulation"`
MatchedCount int `json:"matched_count"`
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
Skipped int `json:"skipped"`
AffectedBytes int64 `json:"affected_bytes"`
Results []DeleteResult `json:"results"`
ErrorSummary string `json:"error_summary,omitempty"`
}
DeleteSummary aggregates delete execution status and accounting.
func DeleteSessions ¶
func DeleteSessions(candidates []Session, sel Selector, opts DeleteOptions) (DeleteSummary, error)
DeleteSessions executes dry-run, soft-delete, or hard-delete over matched sessions.
type Health ¶
type Health string
Health describes scanner quality classification for a session file.
const ( // HealthOK means the session file is readable and has a valid session_meta line. HealthOK Health = "ok" // HealthCorrupted means the session file cannot be parsed as expected. HealthCorrupted Health = "corrupted" // HealthMissingMeta means the file is readable but does not contain valid session metadata. HealthMissingMeta Health = "missing-meta" )
type Selector ¶
type Selector struct {
ID string `json:"id,omitempty"`
IDPrefix string `json:"id_prefix,omitempty"`
HostContains string `json:"host_contains,omitempty"`
PathContains string `json:"path_contains,omitempty"`
HeadContains string `json:"head_contains,omitempty"`
OlderThan time.Duration `json:"older_than,omitempty"`
HasOlderThan bool `json:"has_older_than,omitempty"`
Health Health `json:"health,omitempty"`
HasHealth bool `json:"has_health,omitempty"`
}
Selector defines user-provided filters used by list and delete operations.
func (Selector) HasAnyFilter ¶
HasAnyFilter reports whether at least one filter is set.
type Session ¶
type Session struct {
SessionID string `json:"session_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
SizeBytes int64 `json:"size_bytes"`
Path string `json:"path"`
HostDir string `json:"host_dir,omitempty"`
Health Health `json:"health"`
Head string `json:"head,omitempty"`
}
Session is the normalized metadata row returned by scanner and list commands.
func FilterSessions ¶
FilterSessions applies selector constraints and returns results ordered by UpdatedAt desc.
func ScanSessions ¶
ScanSessions walks the sessions root and parses each .jsonl file into Session metadata.