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.
Call boxes returned by Shim::infer are not queued automatically.
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. Calls are converted once, launched, acknowledged, and retained in provider event order. Active-turn failure or cancellation returns no partial output and makes this shim unusable.