Skip to main content

Shim

Struct Shim 

Source
pub struct Shim<C: BoxCodec> { /* private fields */ }
Expand description

A single-owner, per-conversation bridge between K1 boxes and Codex turns.

Invoke a shim sequentially. Different shims may share cloned Adapters.

Implementations§

Source§

impl<C: BoxCodec> Shim<C>

Source

pub fn new( adapter: Adapter, conversation_key: impl Into<String>, codec: C, launcher: Box<dyn ToolCallLauncher<C::Box>>, ) -> Self

Creates a ready shim for one conversation.

Source

pub fn record_box(&mut self, box_: C::Box)

Appends one externally produced box in canonical history order.

Source

pub fn record_boxes(&mut self, boxes: impl IntoIterator<Item = C::Box>)

Appends externally produced boxes without changing their order.

Source

pub fn pending_box_count(&self) -> usize

Returns the number of boxes waiting for the next fresh native turn.

Source

pub async fn close_conversation(&mut self) -> Result<(), Error>

Closes this shim’s runtime conversation while the shim is ready.

Pending external boxes are retained and can prefix a later fresh thread.

Source

pub async fn infer( &mut self, input: impl Into<String>, ) -> Result<ShimOutput<C::Box>, Error>

Runs one fresh native turn through terminal completion.

Pending boxes clear only after start acceptance. Each immediately buffered call wave is checkpointed before its calls are acknowledged.

Auto Trait Implementations§

§

impl<C> !RefUnwindSafe for Shim<C>

§

impl<C> !Sync for Shim<C>

§

impl<C> !UnwindSafe for Shim<C>

§

impl<C> Freeze for Shim<C>
where C: Freeze, Box<dyn ToolCallLauncher<<C as BoxCodec>::Box>>: Freeze, VecDeque<<C as BoxCodec>::Box>: Freeze,

§

impl<C> Send for Shim<C>
where C: Send, Box<dyn ToolCallLauncher<<C as BoxCodec>::Box>>: Send, VecDeque<<C as BoxCodec>::Box>: Send,

§

impl<C> Unpin for Shim<C>
where C: Unpin, Box<dyn ToolCallLauncher<<C as BoxCodec>::Box>>: Unpin, VecDeque<<C as BoxCodec>::Box>: Unpin,

§

impl<C> UnsafeUnpin for Shim<C>

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 = !

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.