Skip to content
ochat
Search documentation

Use quotes for an exact phrase.

Search by topic, command, or code identifier.

    GitHub ↗

    TUI display types

    Shared terminal types contracts with explicit client projections versus legacy runtime ownership.

    View Markdown source ↗

    Keep small shared types independent of the UI model and runtime. These are rendering/adapter types, not the canonical session history or protocol schema. The complete interface defines exact fields.

    Shell Security, Agent and Chat page state belongs to Model. Approval, revocation, management and moderator-input reactions belong to Controller_types, not to this module’s cmd.

    role = string and message = role * string hold displayed role/text. Roles are not validated by this alias; rendering also uses developer, reasoning and tool labels. They do not replace identity-bearing History_entry.t or Projected_message.t.

    let seed : Chat_tui.Types.message list =
    [ "developer", "You are a helpful assistant."; "user", "Hello!" ]

    Streaming buffers belong to Model, not a public Types.msg_buffer record. Deltas update the display incrementally before the connection closes. Stable projected IDs identify rows; current array indexes are layout positions, not durable identities.

    Persist_session, Start_streaming, and Cancel_streaming each carry a unit -> unit thunk. Cmd executes these with host-owned lifetime and error handling. This compatibility abstraction is distinct from Agent_protocol.Command and Controller_types.reaction.

    Model.apply_patch applies these in-place on the UI owner:

    PatchEffect
    Ensure_bufferEnsure an ID-keyed streaming display buffer
    Append_textAppend delta text and reflect it in the displayed row
    Set_function_nameAssociate tool name with buffer ID
    Associate_tool_callCorrelate streaming item ID with tool call ID
    Set_function_outputRecord tool output text
    Update_reasoning_idxRecord reasoning-summary correlation
    Add_user_messageAdd a display row only; does not append canonical history
    Add_placeholder_messageAdd a transient UI-only notice

    Callers maintaining canonical state must append an allocated history entry separately; native clients instead receive authoritative server projections. Do not persist a placeholder or send display-only live tool activity to a model.

    Apply_patch, Read_file { path }, Read_directory { path }, and Other { name } select specialized display/highlighting. This metadata is derived in the TUI and is not itself durable conversation state.

    settings contains parallel_tool_calls : bool, default true through default_settings (). It is a legacy local execution setting; CLI flags do not override native/daemon runtime policy.

    The UI model is mutable; these patches are not immutable-state transformations. String roles and thunk commands do not enforce semantic authority, durability, or cancellation. Keep those responsibilities in the host.