openagents_sdk::history
Saved account history. References carry their account and deployment; readers make one bounded GET per call and never drive an engine or write a chat.
| Item | What it does |
|---|---|
AttachmentRef struct | Only the SDK constructs these references, from saved metadata. |
ChatReader struct | Reads the account's chat list a page at a time. |
ChatRef struct | A saved chat ID in one account. |
ChatSummary struct | One chat in the account's history list. |
HistoryIndex struct | Optional in-memory merge for owned/shared pages in one account. |
HistoryPage struct | One page of a history list. |
HistoryProject struct | A project in the account's history, which may be shared. |
ProjectReader struct | Reads the account's projects a page at a time. |
SavedCapture struct | A capture saved with a chat transcript. |
SavedFile struct | A file attached to a saved message. |
SavedLabCard struct | A saved Lab card and the account-bound document used to read its media. |
SavedMessage struct | One message in a saved chat transcript. |
ToolDetail struct | A tool call in a saved message: its name, status, input, and output. |
TranscriptPage struct | One page of a chat transcript, with the chat's summary and captures. |
TranscriptReader struct | Reads a chat's messages a page at a time. |
AttachmentRef
pub struct AttachmentRef {}
Only the SDK constructs these references, from saved metadata. No URL or bearer is embedded.
AttachmentRef::chat
pub fn chat(&self) -> &ChatRef
The chat the attachment belongs to.
AttachmentRef::id
pub fn id(&self) -> &str
The attachment's ID.
AttachmentRef::size
pub fn size(&self) -> u64
The attachment's size in bytes.
ChatReader
pub struct ChatReader(ListReader);
Reads the account's chat list a page at a time.
ChatReader::with_page_size
pub fn with_page_size(mut self, limit: usize) -> Result<Self, Error>
Sets how many chats each page holds, from 1 to 200.
ChatReader::next_page
pub async fn next_page(
&mut self,
client: &Client,
session: &Session,
cancel: &CancellationToken,
) -> Result<Option<HistoryPage<ChatSummary>>, Error>
Reads the next page of chats. Returns None after the last page.
ChatRef
pub struct ChatRef {}
A saved chat ID in one account. Construct with Client::chat or a summary.
ChatRef::id
pub fn id(&self) -> &str
The chat's ID.
ChatRef::account
pub fn account(&self) -> &str
The account the chat belongs to.
ChatRef::deployment
pub fn deployment(&self) -> &Deployment
The deployment the chat is on.
ChatSummary
pub struct ChatSummary {
pub home: chat_home::Home,
pub links: chat_home::Links,
pub chat: ChatRef,
pub title: String,
pub revision: u64,
pub updated_unix: u64,
pub pinned_unix: Option<u64>,
pub archived_unix: Option<u64>,
pub project: Option<String>,
pub source: ChatSource,
pub messages: usize,
}
One chat in the account's history list.
HistoryIndex
pub struct HistoryIndex {}
Optional in-memory merge for owned/shared pages in one account. Replace it on access refresh; it does not grant authority to read or download cached rows.
HistoryIndex::extend
pub fn extend(
&mut self,
rows: impl IntoIterator<Item = ChatSummary>,
) -> Result<(), Error>
Adds rows to the index, keeping the newest revision of each chat. Refuses rows from another account or deployment.
HistoryIndex::len
pub fn len(&self) -> usize
The number of chats in the index.
HistoryIndex::is_empty
pub fn is_empty(&self) -> bool
Whether the index is empty.
HistoryIndex::clear
pub fn clear(&mut self)
Removes every chat from the index.
HistoryIndex::get
pub fn get(&self, id: &str) -> Option<&ChatSummary>
The chat with this ID, if the index holds it.
HistoryIndex::sorted
pub fn sorted(&self, archived: bool) -> Vec<&ChatSummary>
The archived or unarchived chats, pinned first, then the most recently updated.
HistoryPage
pub struct HistoryPage<T> {
pub data: Vec<T>,
pub has_more: bool,
pub sessions: Vec<crate::sessions::SessionSummary>,
}
One page of a history list.
HistoryProject
pub struct HistoryProject {
pub name: String,
pub shared: bool,
}
A project in the account's history, which may be shared.
HistoryProject::id
pub fn id(&self) -> &str
The project's ID.
HistoryProject::account
pub fn account(&self) -> &str
The account the project belongs to.
HistoryProject::deployment
pub fn deployment(&self) -> &Deployment
The deployment the project is on.
ProjectReader
pub struct ProjectReader(ListReader);
Reads the account's projects a page at a time.
ProjectReader::with_page_size
pub fn with_page_size(mut self, limit: usize) -> Result<Self, Error>
Sets how many projects each page holds, from 1 to 200.
ProjectReader::next_page
pub async fn next_page(
&mut self,
client: &Client,
session: &Session,
cancel: &CancellationToken,
) -> Result<Option<HistoryPage<HistoryProject>>, Error>
Reads the next page of projects. Returns None after the last page.
SavedCapture
pub struct SavedCapture {
pub id: String,
pub name: String,
pub state: CaptureState,
pub size: Option<u64>,
pub media: Option<String>,
}
A capture saved with a chat transcript.
SavedCapture::download_ref
pub fn download_ref(&self) -> Option<&AttachmentRef>
The reference to download the capture with, when it can be downloaded.
SavedFile
pub struct SavedFile {
pub id: String,
pub name: String,
pub kind: FileKind,
pub size: u64,
}
A file attached to a saved message.
SavedFile::download_ref
pub fn download_ref(&self) -> Option<&AttachmentRef>
The reference to download the file with, when it can be downloaded.
SavedLabCard
pub struct SavedLabCard {
pub card: lab_kit::Card,
}
A saved Lab card and the account-bound document used to read its media.
SavedLabCard::document_ref
pub fn document_ref(&self) -> &crate::labs::DocumentRef
The document used to read the card's media.
SavedMessage
pub struct SavedMessage {
pub id: String,
pub role: MessageRole,
pub text: String,
pub files: Vec<SavedFile>,
pub tool: Option<ToolDetail>,
pub cards: Vec<SavedLabCard>,
pub extra: BTreeMap<String, Value>,
}
One message in a saved chat transcript.
ToolDetail
pub struct ToolDetail {
pub name: String,
pub summary: String,
pub status: ToolStatus,
pub input: String,
pub output: String,
}
A tool call in a saved message: its name, status, input, and output.
TranscriptPage
pub struct TranscriptPage {
pub thread: ChatSummary,
pub revision: u64,
pub data: Vec<SavedMessage>,
pub captures: Vec<SavedCapture>,
pub has_more: bool,
}
One page of a chat transcript, with the chat's summary and captures.
TranscriptReader
pub struct TranscriptReader {}
Reads a chat's messages a page at a time.
TranscriptReader::with_page_size
pub fn with_page_size(mut self, limit: usize) -> Result<Self, Error>
Sets how many messages each page holds, from 1 to 200.
TranscriptReader::starting_at
pub fn starting_at(mut self, index: usize, revision: u64) -> Result<Self, Error>
Start at an indexed message in a known revision, for loading recent history first.
TranscriptReader::chat
pub fn chat(&self) -> &ChatRef
The chat being read.
TranscriptReader::next_page
pub async fn next_page(
&mut self,
client: &Client,
session: &Session,
cancel: &CancellationToken,
) -> Result<Option<TranscriptPage>, Error>
Reads the next page of messages. Returns None after the last page.