Skip to content

openagents_sdk::terminal_chats

Saved terminal chats use the same account history and continuation IDs.

ItemWhat it does
Message structOne message of a terminal chat.
Role enumWho wrote a terminal chat message.
Saved structThe saved chat, and whether this save changed it.
Snapshot structA terminal chat to save: its computer, title, and messages.
save fnPublish an already screened transcript.

Message

pub struct Message {
    pub role: Role,
    pub text: String,
    pub step: Option<Value>,
}

One message of a terminal chat.

Role

pub enum Role {
    User,
    Assistant,
    Thinking,
    Tool,
}

Who wrote a terminal chat message.

Saved

pub struct Saved {
    pub chat: ChatRef,
    pub changed: bool,
}

The saved chat, and whether this save changed it.

Snapshot

pub struct Snapshot {
    pub computer: String,
    pub title: String,
    pub messages: Vec<Message>,
    pub repository: Option<String>,
    pub active_unix: Option<u64>,
}

A terminal chat to save: its computer, title, and messages.

save

pub async fn save(
    client: &Client,
    session: &Session,
    local_id: &str,
    snapshot: &Snapshot,
    cancel: &CancellationToken,
) -> Result<Saved, Error>

Publish an already screened transcript. The returned ID is also its Loro room ID; callers must not derive a separate ID from the terminal's local filename.