pub struct Shim<C>where
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> Shim<C>where
C: BoxCodec,
impl<C> Shim<C>where
C: BoxCodec,
Sourcepub fn new(
adapter: Adapter,
conversation_key: impl Into<String>,
codec: C,
launcher: Box<dyn ToolCallLauncher<<C as BoxCodec>::Box>>,
) -> Shim<C>
pub fn new( adapter: Adapter, conversation_key: impl Into<String>, codec: C, launcher: Box<dyn ToolCallLauncher<<C as BoxCodec>::Box>>, ) -> Shim<C>
Creates a ready shim for one conversation.
Sourcepub fn record_box(&mut self, box_: <C as BoxCodec>::Box)
pub fn record_box(&mut self, box_: <C as BoxCodec>::Box)
Appends one externally produced box in canonical history order.
Sourcepub fn record_boxes(
&mut self,
boxes: impl IntoIterator<Item = <C as BoxCodec>::Box>,
)
pub fn record_boxes( &mut self, boxes: impl IntoIterator<Item = <C as BoxCodec>::Box>, )
Appends externally produced boxes without changing their order.
Sourcepub fn pending_box_count(&self) -> usize
pub fn pending_box_count(&self) -> usize
Returns the number of boxes waiting for the next fresh native turn.
Sourcepub async fn close_conversation(&mut self) -> Result<(), Error>
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.
Sourcepub async fn infer(
&mut self,
input: impl Into<String>,
) -> Result<ShimOutput<<C as BoxCodec>::Box>, Error>
pub async fn infer( &mut self, input: impl Into<String>, ) -> Result<ShimOutput<<C as BoxCodec>::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>
impl<C> Send for Shim<C>
impl<C> Unpin for Shim<C>
impl<C> UnsafeUnpin for Shim<C>where
C: UnsafeUnpin,
Box<dyn ToolCallLauncher<<C as BoxCodec>::Box>>: UnsafeUnpin,
VecDeque<<C as BoxCodec>::Box>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more