colmugx/posoco/types does not have a README file

    ChatOptions

    pub(all) struct ChatOptions {
    temperature : Double?
    max_output_tokens : Int?
    } derive(Eq,
    Debug
    )

    Provider-agnostic chat options. Trimmed in R3 M3.7 to just the two fields every provider accepts. Provider-specific tuning (tool_choice, reasoning effort, top_p, frequency_penalty, ...) belongs on the modelport's own config struct, not on this shared bag — that way adding a new provider never bloats the common type.

    ChatOptions::equal

    fn ChatOptions::equal(ChatOptions, ChatOptions) -> Bool

    ChatOptions::not_equal

    fn ChatOptions::not_equal(x : ChatOptions, y : ChatOptions) -> Bool

    CompactOutcome

    pub(all) struct CompactOutcome {
    final_session_id : String
    mode :
    CompactMode

    messages_after : Int
    } derive(Eq)

    CompactOutcome::equal

    CompactOutcome::not_equal

    fn CompactOutcome::not_equal(x : CompactOutcome, y : CompactOutcome) -> Bool

    ContextReadingSource

    pub(all) enum ContextReadingSource {
    Measured
    Estimated
    Unknown
    } derive(Eq,
    Debug
    )

    ContextReadingSource::equal

    ContextReadingSource::not_equal

    ContextReadingSource::output

    fn ContextReadingSource::output(self : ContextReadingSource, logger : &Logger) -> Unit

    ContextReadingSource::to_string

    fn ContextReadingSource::to_string(self : ContextReadingSource) -> String

    ContextState

    pub(all) struct ContextState {
    session_id : String
    model_id : String
    context_version : Int
    last_measured_tokens : Int?
    estimated_added_tokens : Int
    window_tokens : Int?
    compact_threshold : Double
    source : ContextReadingSource
    reading_message_count : Int
    } derive(Eq,
    Debug
    )

    ContextState::equal

    ContextState::from_metadata

    fn ContextState::from_metadata(metadata : Map[String, Json]) -> ContextState?

    ContextState::not_equal

    fn ContextState::not_equal(x : ContextState, y : ContextState) -> Bool

    ContextState::output

    fn ContextState::output(self : ContextState, logger : &Logger) -> Unit

    ContextState::to_metadata_json

    fn ContextState::to_metadata_json(self : ContextState) -> Json

    ContextState::to_string

    fn ContextState::to_string(self : ContextState) -> String

    EventScope

    Attribution identity of one emitted TurnEvent / HookStage: which session and run the event belongs to. Projected from the committed event envelope at the Agent boundary — never reconstructed by scanning a transcript. Scope answers "which run does this belong to"; it does not carry effect identity (ToolCall.call_id already correlates tool events).

    EventScope::equal

    fn EventScope::equal(EventScope, EventScope) -> Bool

    EventScope::not_equal

    fn EventScope::not_equal(x : EventScope, y : EventScope) -> Bool

    Session

    pub(all) struct Session {
    messages : Array[
    Message
    ]
    metadata : Map[String, Json]
    } derive(Eq,
    Debug
    )

    A conversation session. messages is the linear transcript this thread owns; metadata is a free-form product-owned bag (used for lineage via parent_thread_id, product-specific flags, anything posoco does not interpret).

    R3 M3.7: messages carries canonical @kernel.Message values directly. There is no longer a legacy @types.Message form — the kernel ADT is the single protocol.

    Session::equal

    fn Session::equal(Session, Session) -> Bool

    Session::not_equal

    fn Session::not_equal(x : Session, y : Session) -> Bool

    Session::parent_thread_id

    fn Session::parent_thread_id(self : Session) -> String?

    Read the parent thread id from a session's metadata. Returns None when the key is absent or not a string.

    Session::to_repr

    Session::with_parent_thread_id

    fn Session::with_parent_thread_id(self : Session, parent_thread_id : String) -> Session

    Construct a Session with the given parent thread id recorded in its metadata. Used by fork/compact handlers.

    StreamAccumulator

    pub struct StreamAccumulator {
    // private fields
    } derive(
    Debug
    )

    Accumulates StreamChunk events during a streaming chat call. Modelports that want a standard "double-write" implementation (one chunk to the Stream(cb) callback for telemetry, one chunk to the accumulator for the final completion) can use this helper. Modelports with more sophisticated needs (e.g. DeepSeek's dynamic tool-result removal during streaming) are free to ignore this and maintain their own state.

    R3 M3.7: the previous to_response() -> ModelResponse has been replaced by to_completion() -> @kernel.Completion. The old ModelResponse type is deleted — chat now returns ModelCallResult whose completion field is the canonical Completion.

    StreamAccumulator::StreamAccumulator

    fn StreamAccumulator::StreamAccumulator() -> StreamAccumulator

    StreamAccumulator::push

    StreamAccumulator::reasoning

    fn StreamAccumulator::reasoning(self : StreamAccumulator) -> String

    StreamAccumulator::text

    fn StreamAccumulator::text(self : StreamAccumulator) -> String

    StreamAccumulator::to_completion

    Assemble accumulated stream chunks into a canonical @kernel.Completion.

    T07 error-transparency: malformed tool-call argument JSON raises ModelError::ResponseParse instead of silently becoming {}. This prevents a corrupted stream from masquerading as a valid empty-args call.

    StreamAccumulator::tool_calls

    Read-only snapshots of the accumulated streamed tool calls, in index order. Returns a fresh array per call; a later push never alters a previously returned snapshot, and no snapshot path leads back into accumulator state.

    StreamChunk

    pub(all) enum StreamChunk {
    TextDelta(token~ : String)
    ReasoningDelta(token~ : String)
    ToolCallDelta(index~ : Int, id~ : String?, name~ : String?, arguments_delta~ : String?)
    Usage(input_tokens~ : Int, output_tokens~ : Int, total_tokens~ : Int, cached_input_tokens~ : Int?, uncached_input_tokens~ : Int?)
    Finish(reason~ : String)
    } derive(Eq,
    Debug
    )

    Canonical streaming chunk shape emitted by modelports through the Stream(cb) callback of ModelPort::chat. HostChunkCallback receives this type directly; there is no separate JSON wire contract.

    Streaming remains a host/telemetry concern, not a transcript fact (ADR §2.11).

    StreamChunk::equal

    fn StreamChunk::equal(StreamChunk, StreamChunk) -> Bool

    StreamChunk::not_equal

    fn StreamChunk::not_equal(x : StreamChunk, y : StreamChunk) -> Bool

    StreamChunk::validate

    fn StreamChunk::validate(self : StreamChunk) -> Result[Unit, String]

    Validate the scalar part of one provider stream chunk before it reaches a live sink or the mutable accumulator. Tool-call sparsity is stateful and is checked by StreamAccumulator::push (and by the executor's callback guard); this method enforces the stateless part of that same protocol.

    StreamMode

    pub(all) enum StreamMode {
    NoStream
    Stream((StreamChunk) -> Unit)
    } derive(
    Debug
    )

    Streaming mode for ModelPort::chat. See trait doc.

    NoStream lets the modelport skip chunk wire-format work entirely (no SSE parsing, no callback construction). Stream(cb) asks it to emit each chunk to cb as a StreamChunk. The ADR §2.11 rationale still holds — streaming is a host/telemetry concern, not a transcript fact — but the chunk contract is now the canonical StreamChunk type, not a private JSON shape.
    impl Show for StreamMode

    StreamMode::output

    fn StreamMode::output(self : StreamMode, logger : &Logger) -> Unit

    StreamMode::to_string

    fn StreamMode::to_string(self : StreamMode) -> String

    ToolCallBuilder

    pub(all) struct ToolCallBuilder {
    id : String
    name : String
    arguments_buf : StringBuilder
    } derive(
    Debug
    )

    Mutable per-index accumulator used by StreamAccumulator while assembling streamed tool calls. Each streamed ToolCallDelta targets an index; the builder records the first non-empty id / name / arguments_json() it sees for that index.

    ToolCallBuilder::ToolCallBuilder

    fn ToolCallBuilder::ToolCallBuilder() -> ToolCallBuilder

    ToolCallBuilder::arguments_json

    fn ToolCallBuilder::arguments_json(self : ToolCallBuilder) -> String

    ToolCallSnapshot

    pub struct ToolCallSnapshot {
    id : String
    name : String
    arguments_json : String
    } derive(Eq,
    Debug
    )

    Immutable point-in-time snapshot of one accumulated streamed tool call.

    ToolCallSnapshot::equal

    ToolCallSnapshot::not_equal

    fn ToolCallSnapshot::not_equal(x : ToolCallSnapshot, y : ToolCallSnapshot) -> Bool

    TurnEvent

    pub(all) enum TurnEvent {
    TurnStarted
    ToolCallPending(
    ToolCall
    )
    ToolCallResult(call~ :
    ToolCall
    , result~ :
    ToolOutcome
    , is_error~ : Bool)
    ModelResponseReceived(message~ :
    Message
    , usage~ :
    Usage
    ?)
    SessionRedirect(from~ : String, to~ : String, messages_before~ : Int, messages_after~ : Int)
    TurnCompleted
    TurnFailed(String)
    ToolCallDeferred(call~ :
    ToolCall
    , reason~ : String)
    StreamChunkReceived(chunk~ : StreamChunk)
    StreamChunksDropped(count~ : Int)
    ConfigWarning(field~ : String, value~ : String, reason~ : String)
    ConfigChanged(field~ : String, old_value~ : String, new_value~ : String)
    ContextStateUpdated(state~ : ContextState)
    CompactStarted(trigger~ : String)
    CompactFinished(trigger~ : String, mode~ : String, final_session_id~ : String, messages_after~ : Int)
    OperationFinalized(operation~ : String, outcome~ : String, detail~ : String)
    Custom(source~ : String, label~ : String, data~ : Json)
    UserRequestStarted(kind~ : String, prompt~ : String)
    UserRequestFinished(kind~ : String, outcome~ : String)
    } derive(Eq,
    Debug
    )

    Turn lifecycle events observed via Observer::on_event. R3 M3.7: payload types are now canonical kernel types (ToolCall, ToolOutcome, Message, Usage). is_error on ToolCallResult is preserved for legacy observer compatibility — it is derived from the ToolOutcome variant (is_failure).
    impl Show for TurnEvent

    TurnEvent::equal

    fn TurnEvent::equal(TurnEvent, TurnEvent) -> Bool

    TurnEvent::not_equal

    fn TurnEvent::not_equal(x : TurnEvent, y : TurnEvent) -> Bool

    TurnEvent::output

    fn TurnEvent::output(self : TurnEvent, logger : &Logger) -> Unit

    TurnEvent::to_string

    fn TurnEvent::to_string(self : TurnEvent) -> String

    TurnResult

    pub(all) struct TurnResult {
    message :
    Message

    tool_results : Array[
    ToolOutcome
    ]
    final_session_id : String
    } derive(Eq,
    Debug
    )

    Return value of Agent::run_turn. R3 M3.7: payload types are canonical.

    TurnResult::equal

    fn TurnResult::equal(TurnResult, TurnResult) -> Bool

    TurnResult::not_equal

    fn TurnResult::not_equal(x : TurnResult, y : TurnResult) -> Bool

    CONTEXT_STATE_METADATA_KEY

    let CONTEXT_STATE_METADATA_KEY : String

    PARENT_THREAD_ID_KEY

    let PARENT_THREAD_ID_KEY : String

    Metadata key under which a session's parent thread id is stored. Absent for threads created via the new command (fresh, no parent). Present when this session was forked from another thread (user-initiated /fork-here) or compacted from another thread (modelport-driven compact via ModelPort::compact returning CompactMode::NewThread).

    Stored in metadata rather than a dedicated field so existing Session construction sites continue to compile unchanged. Product code reads it via Session::parent_thread_id(session).

    SESSION_TITLE_METADATA_KEY

    let SESSION_TITLE_METADATA_KEY : String

    Stable automatic display title derived by Agent from the first admitted human input, before memory/hooks can inject model-facing UserMessages. Explicit product/user naming remains a separate concern; consumers can prefer their explicit name key and fall back to this title.