Skip to main content

BoxCodec

Trait BoxCodec 

Source
pub trait BoxCodec {
    type Box: Clone;

    // Required methods
    fn tool_call_box(&mut self, call: &ToolCall) -> Self::Box;
    fn box_text<'a>(&self, box_: &'a Self::Box) -> &'a str;

    // Provided method
    fn malformed_tool_call_message(
        &self,
        _box_: &Self::Box,
    ) -> Option<&'static str> { ... }
}
Expand description

Converts between K1’s canonical box type and text visible to Codex.

Required Associated Types§

Source

type Box: Clone

Canonical box type owned by K1.

Required Methods§

Source

fn tool_call_box(&mut self, call: &ToolCall) -> Self::Box

Converts one typed Codex dynamic-tool request into a canonical box.

A shim invokes this exactly once for each call it receives.

Source

fn box_text<'a>(&self, box_: &'a Self::Box) -> &'a str

Returns the complete representation of one box for Codex history.

Provided Methods§

Source

fn malformed_tool_call_message(&self, _box_: &Self::Box) -> Option<&'static str>

Returns a safe validation message when a converted call box is malformed.

The message must be fixed, safely displayable text supplied by the codec; it must not be derived from raw arbitrary tool-call values. A malformed box is answered unsuccessfully and is never passed to the launcher. Existing codecs retain their prior behavior through the None default.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§