Skip to main content

Codex

Struct Codex 

Source
pub struct Codex { /* private fields */ }
Expand description

Codex CLI stores one JSONL rollout per session under ~/.codex/sessions/YYYY/MM/DD/rollout-<ts>-<uuid>.jsonl. Lines carry a type plus a payload; the schema has shifted across versions, so both response_item and event_msg shapes are handled.

Codex::default() reads the stock ~/.codex install. An embedder that runs several Codex installs in different homes builds one adapter per install with Codex::in_home.

Implementations§

Source§

impl Codex

Source

pub fn in_home(home: impl Into<PathBuf>) -> Self

An adapter for the Codex install rooted at home (e.g. ~/.codex2). The sessions sub-directory layout is the adapter’s business, not the caller’s.

Trait Implementations§

Source§

impl Adapter for Codex

Source§

fn reconcile_scope(&self) -> Option<String>

An explicit install speaks only for the rows under its own root; the stock adapter speaks for every Codex row, as before.

Source§

fn name(&self) -> &'static str

Source§

fn root(&self) -> Option<PathBuf>

Store root, e.g. ~/.claude/projects. May not exist on this machine.
Source§

fn discover(&self) -> Discovered

All session files under the root, with a partial-walk flag the indexer uses to protect deletion reconciliation (see Discovered).
Source§

fn parse(&self, path: &Path) -> Result<Session>

Parse one session file. Must never panic on malformed input; skip bad lines and return what could be read.
Source§

fn store(&self) -> Option<Store>

A shared store (many sessions in one database) for tools that do not use one file per session. When Some, the indexer uses it instead of discover/parse. Default None = ordinary file-per-session adapter.
Source§

fn parse_key(&self, _key: &str) -> Result<Session>

Parse one session out of a shared store by its key (from store().keys). Only called for adapters that return a Store.
Source§

impl Default for Codex

Source§

fn default() -> Codex

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Codex

§

impl RefUnwindSafe for Codex

§

impl Send for Codex

§

impl Sync for Codex

§

impl Unpin for Codex

§

impl UnsafeUnpin for Codex

§

impl UnwindSafe for Codex

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.