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: only 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.

    CompactOutcome

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

    messages_after : Int
    } derive(Eq)

    ContextReadingSource

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

    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::from_metadata

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

    ContextState::to_metadata_json

    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).

    ForkOutcome

    pub(all) struct ForkOutcome {
    parent_session_id : String
    new_session_id : String
    fork_index : Int
    messages_after : Int
    } derive(Eq,
    Debug
    )

    MessageDeliveryKind

    pub(all) enum MessageDeliveryKind {
    Step
    Turn
    } derive(Eq,
    Debug
    )

    Boundary at which a queued user message was (or was not) applied to the transcript. Step folds the message in between model steps of the running turn (mid-turn steering); Turn holds it for the turn boundary so it opens the next turn as fresh input.

    RewindOutcome

    pub(all) struct RewindOutcome {
    session_id : String
    messages_before : Int
    messages_after : Int
    } derive(Eq,
    Debug
    )

    Session

    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).

    messages carries canonical @kernel.Message values directly — the kernel ADT is the single protocol.

    Session::parent_fork_index

    fn Session::parent_fork_index(self : Session) -> Int?

    Read the parent fork index from a session's metadata. Returns None when the key is absent or not a non-negative integer.

    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::with_fork_lineage

    fn Session::with_fork_lineage(self : Session, parent_thread_id : String, fork_index : Int) -> Session

    Construct a Session with both parent thread id and fork index recorded in its metadata.

    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.

    to_completion() -> @kernel.Completion is the terminal read: chat returns a ModelCallResult whose completion field holds it.

    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 .

    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 is a host/telemetry concern, not a transcript fact — but the chunk contract is now the canonical StreamChunk type, not a private JSON shape.

    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

    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.

    ToolCatalogChange

    pub(all) enum ToolCatalogChange {
    Published
    Withdrawn
    Captured
    CleanupFailed
    } derive(Eq,
    Debug
    )

    Which Agent-owned tool-catalog fact ToolCatalogChanged reports. These are composition/publication facts, not reducer-journal facts: the default InMemoryJournal does not persist them.

    ToolCatalogChange::to_string

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

    ToolCatalogChangedPayload

    pub(all) struct ToolCatalogChangedPayload {
    change : ToolCatalogChange
    owner : String
    revision : Int?
    catalog_version : Int?
    tool_count : Int
    operation_id : String?
    detail : String?
    } derive(Eq,
    Debug
    )

    Payload of TurnEvent::ToolCatalogChanged. revision is the owner's contribution revision, while catalog_version is the operation-level catalog version the Agent allocated at capture — the two are deliberately separate numbers. operation_id names the admitting operation for Captured facts. The payload never carries provider objects, credentials, arguments or connection details.

    TurnEvent

    pub(all) enum TurnEvent {
    TurnStarted
    ModelRequestStarted
    ToolChildDeclared(call_id~ :
    CallId
    , effect_id~ :
    EffectId
    , parent_effect_id~ :
    EffectId
    , root_effect_id~ :
    EffectId
    , depth~ : Int)
    ToolCatalogChanged(payload~ : ToolCatalogChangedPayload)
    ToolCallPending(
    ToolCall
    )
    ToolCallApproved(call~ :
    ToolCall
    , consent_scope~ : String?)
    ToolCallStarted(call~ :
    ToolCall
    )
    ToolCallSucceeded(call~ :
    ToolCall
    , content~ : String, structured~ :
    Json
    ?, attachments~ : Array[
    Content
    ])
    ToolCallFailed(call~ :
    ToolCall
    , failure~ :
    ToolFailure
    )
    ToolCallRejected(call~ :
    ToolCall
    , reason~ :
    NotExecutedReason
    )
    ToolCallAbandoned(call~ :
    ToolCall
    , reason~ : String)
    ModelResponseReceived(message~ :
    Message
    , usage~ :
    Usage
    ?)
    SessionRedirect(from~ : String, to~ : String, messages_before~ : Int, messages_after~ : Int)
    SessionRewound(session_id~ : String, messages_before~ : Int, messages_after~ : Int)
    TurnCompleted
    TurnFailed(String)
    TurnCancelled
    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)
    MessageApplied(command_id~ : String, delivery~ : MessageDeliveryKind)
    MessageUndelivered(command_id~ : String, delivery~ : MessageDeliveryKind, reason~ : String)
    } derive(Eq,
    Debug
    )

    Turn lifecycle events observed via Observer::on_event. Payload types are canonical kernel types (ToolCall, ToolOutcome, Message, Usage). Tool events form an explicit per-call state machine — every observable node has its own variant, none doubles as another:

    ToolCallPending (entered the pipeline, awaiting hook chain) ├─ ToolCallApproved (chain finalized executable; consent audit) │ └─ ToolCallStarted (wave launched) │ ├─ ToolCallSucceeded / ToolCallFailed ├─ ToolCallRejected (a decision resolved the call: hook reject, │ validation reject; run continues) └─ ToolCallAbandoned (no outcome exists: cancelled mid-wave, terminal hook failure, run ended)

    Pre-pass validation rejects (unknown tool / schema mismatch) surface as ToolCallRejected directly — the call never entered the pipeline, so no ToolCallPending precedes them.
    impl Show for TurnEvent

    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.

    CONTEXT_STATE_METADATA_KEY

    let CONTEXT_STATE_METADATA_KEY : String

    PARENT_FORK_INDEX_KEY

    let PARENT_FORK_INDEX_KEY : String

    Metadata key under which the 0-based parent message count at fork time is stored when a session is forked from another thread.

    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.