codex

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package codex provides the OpenAI Codex CLI source for agentwatch.

CODEX_HOME resolution

This source does NOT read the CODEX_HOME environment variable. Callers must supply the base directory explicitly via WithRoot. If no WithRoot is provided the source returns no sessions. A caller that wants environment fallback can implement it itself:

root := os.Getenv("CODEX_HOME")
if root == "" {
    home, _ := os.UserHomeDir()
    root = filepath.Join(home, ".codex")
}
src := codex.New(codex.WithRoot(root))

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(r *source.Registry, opts ...Option) error

Register registers this source with a source.Registry using a factory that calls New(opts...).

Types

type Option

type Option func(*Source)

Option configures a Source.

func WithDiscoverWindow

func WithDiscoverWindow(d time.Duration) Option

WithDiscoverWindow limits discovery to rollout files whose modification time is within d of the current time. Zero disables age filtering.

func WithRoot

func WithRoot(path string) Option

WithRoot sets the Codex home directory (the directory containing "sessions/"). Without this option the source discovers no sessions.

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source implements source.Source for OpenAI Codex CLI sessions.

Codex CLI stores sessions at:

<root>/sessions/YYYY/MM/DD/rollout-{timestamp}-{uuid}.jsonl

func New

func New(opts ...Option) *Source

New creates a new Codex source with the given options.

func (*Source) Discover

func (s *Source) Discover(ctx context.Context) ([]source.SessionHandle, error)

Discover implements source.Source. It walks <root>/sessions for recently modified rollout JSONL files and returns a handle for each.

func (*Source) Name

func (s *Source) Name() string

Name implements source.Source.

func (*Source) Parse

Parse implements source.Source. The cursor is the byte offset into the rollout file as a decimal string. An empty cursor means start from zero.

Jump to

Keyboard shortcuts

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