CodexSessionScanner

Struct CodexSessionScanner 

Source
pub struct CodexSessionScanner<'a, S: Storage> { /* private fields */ }
Expand description

Orchestrates Codex session file scanning with storage integration.

CodexSessionScanner provides a high-level API for scanning Codex CLI session files and inserting events into storage. It handles:

  • Incremental parsing (only reads new content since last scan)
  • Deduplication by timestamp+type key
  • Position tracking for future scans

Implementations§

Source§

impl<'a, S: Storage> CodexSessionScanner<'a, S>

Source

pub fn new(storage: &'a S, machine_id: impl Into<String>) -> Self

Create a new scanner with the given storage and machine ID.

Source

pub fn scan_file(&self, path: &Path) -> Result<ScanResult, ScanError>

Scan a Codex session file and insert events into storage.

This method:

  1. Extracts session ID from filename
  2. Loads the last scanned position for the file
  3. Parses new entries since that position
  4. Inserts new events
  5. Updates the position for future incremental scans
Source

pub fn scan_session(&self, session_id: &str) -> Result<ScanResult, ScanError>

Scan a session file by session ID.

Looks up the session file path in the standard Codex sessions directory. After scanning, also updates the transcript_path for the provided session_id, which may differ from the UUID extracted from the filename. This ensures sessions created by hooks (using thread-id) get their transcript_path set.

Auto Trait Implementations§

§

impl<'a, S> Freeze for CodexSessionScanner<'a, S>

§

impl<'a, S> RefUnwindSafe for CodexSessionScanner<'a, S>
where S: RefUnwindSafe,

§

impl<'a, S> Send for CodexSessionScanner<'a, S>
where S: Sync,

§

impl<'a, S> Sync for CodexSessionScanner<'a, S>
where S: Sync,

§

impl<'a, S> Unpin for CodexSessionScanner<'a, S>

§

impl<'a, S> UnwindSafe for CodexSessionScanner<'a, S>
where S: RefUnwindSafe,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.