Skip to main content

CodexProjector

Struct CodexProjector 

Source
pub struct CodexProjector {
    pub cwd: Option<String>,
    pub model: Option<String>,
    pub originator: Option<String>,
    pub cli_version: Option<String>,
}
Expand description

Project a ConversationView into a Codex crate::types::Session.

Config fields are optional. Defaults match what Codex itself would write for a fresh CLI invocation.

§Example

use toolpath_codex::project::CodexProjector;
use toolpath_convo::{ConversationProjector, ConversationView};

let view = ConversationView {
    id: "session-uuid".into(),
    provider_id: Some("codex".into()),
    ..Default::default()
};

let session = CodexProjector::default().project(&view).unwrap();
assert_eq!(session.id, "session-uuid");
// Always at least the session_meta line.
assert!(!session.lines.is_empty());

Fields§

§cwd: Option<String>

Session cwd. Falls back to the first turn’s environment, then /.

§model: Option<String>

Default model for the turn_context line. Falls back to the first assistant turn’s Turn.model, then "unknown".

§originator: Option<String>

originator field on the session_meta line. Defaults to "codex-toolpath" so Codex-side tooling can tell projected sessions from real ones at a glance.

§cli_version: Option<String>

CLI version string for session_meta.cli_version.

Implementations§

Source§

impl CodexProjector

Source

pub fn new() -> Self

Source

pub fn with_cwd(self, cwd: impl Into<String>) -> Self

Source

pub fn with_model(self, model: impl Into<String>) -> Self

Source

pub fn with_originator(self, originator: impl Into<String>) -> Self

Trait Implementations§

Source§

impl Clone for CodexProjector

Source§

fn clone(&self) -> CodexProjector

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ConversationProjector for CodexProjector

Source§

type Output = Session

The type produced by projecting a ConversationView.
Source§

fn project(&self, view: &ConversationView) -> Result<Session>

Project view into Self::Output.
Source§

impl Debug for CodexProjector

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodexProjector

Source§

fn default() -> CodexProjector

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

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.