openagents_sdk::sessions
Computer sessions in the account's chat list (#11897).
A desktop or phone host publishes one summary row per session it runs:
title, computer, project, status, last activity, and a short recap. The
web and every app list them with the account's chats, marked
source: "session" with their computer home. A row holds no transcript.
The transcript is opt-in per chat or per project, off by default; while
it is on, the host uploads a read-only copy.
| Item | What it does |
|---|---|
CopiedMessage struct | One message of a session's read-only transcript copy. |
CopiedRole enum | Who wrote a message in a transcript copy. |
PublishedSession struct | One session a host publishes. |
SessionDetail struct | One session, and its transcript copy when it is shared with the caller. |
SessionStatus enum | What a session is doing. |
SessionSummary struct | One session row as the account lists it. |
forget_computer fn | Remove this computer's rows and transcript copies, as when it signs out. |
get fn | One session, with its transcript copy when it is shared with the caller. |
list fn | The account's session rows, newest first, or a shared project's rows. |
pending_moves fn | Requests from the web wait for this computer's normal handoff path. |
publish fn | Publish this computer's current sessions, replacing what it published before. |
set_project_transcripts fn | Turn the transcripts of every session in a project on or off. |
set_transcript fn | Turn one chat's transcript on or off on the web. |
upload_transcript fn | Upload a session's read-only transcript copy, replacing the last one. |
MAX_PER_COMPUTER const | The most sessions one publish may carry. |
CopiedMessage
pub struct CopiedMessage {
pub role: CopiedRole,
pub text: String,
}
One message of a session's read-only transcript copy.
CopiedRole
pub enum CopiedRole {
User,
Assistant,
Tool,
}
Who wrote a message in a transcript copy.
PublishedSession
pub struct PublishedSession {
pub id: String,
pub home_transfer: bool,
pub continues: Option<PartRef>,
pub title: String,
pub project: Option<String>,
pub folder: Option<String>,
pub status: SessionStatus,
pub last_activity_unix: u64,
pub recap: String,
pub workspace: Option<String>,
pub agent: Option<String>,
}
One session a host publishes. Text is bounded and screened by the
service; never put transcript content in recap.
SessionDetail
pub struct SessionDetail {
pub session: SessionSummary,
pub messages: Option<Vec<CopiedMessage>>,
}
One session, and its transcript copy when it is shared with the caller.
SessionStatus
pub enum SessionStatus {
Idle,
Working,
AwaitingInput,
Errored,
Other(String),
}
What a session is doing.
SessionStatus::as_str
pub fn as_str(&self) -> &str
The status as the service writes it.
SessionSummary
pub struct SessionSummary {
pub id: String,
pub home: Home,
pub title: String,
pub computer: String,
pub project: Option<String>,
pub folder: Option<String>,
pub status: SessionStatus,
pub last_activity_unix: u64,
pub recap: String,
pub online: bool,
pub transcript: bool,
pub app_link: Option<String>,
pub continues: Option<PartRef>,
pub continued_by: Option<PartRef>,
pub home_transfer: bool,
pub agent: Option<String>,
}
One session row as the account lists it.
forget_computer
pub async fn forget_computer(
client: &Client,
session: &Session,
device: &str,
cancel: &CancellationToken,
) -> Result<bool, Error>
Remove this computer's rows and transcript copies, as when it signs out.
get
pub async fn get(
client: &Client,
session: &Session,
id: &str,
cancel: &CancellationToken,
) -> Result<SessionDetail, Error>
One session, with its transcript copy when it is shared with the caller.
list
pub async fn list(
client: &Client,
session: &Session,
project: Option<&str>,
cancel: &CancellationToken,
) -> Result<Vec<SessionSummary>, Error>
The account's session rows, newest first, or a shared project's rows.
pending_moves
pub async fn pending_moves(
client: &Client,
session: &Session,
device: &str,
cancel: &CancellationToken,
) -> Result<Vec<MoveRequest>, Error>
Requests from the web wait for this computer's normal handoff path.
publish
pub async fn publish(
client: &Client,
session: &Session,
device: &str,
name: &str,
sessions: &[PublishedSession],
cancel: &CancellationToken,
) -> Result<Vec<String>, Error>
Publish this computer's current sessions, replacing what it published
before. Returns the ids whose transcript is on, which the host may
upload with [upload_transcript]. Publishing also says the computer is
online, so a host republishes about every 30 seconds.
set_project_transcripts
pub async fn set_project_transcripts(
client: &Client,
session: &Session,
project: &str,
on: bool,
cancel: &CancellationToken,
) -> Result<(), Error>
Turn the transcripts of every session in a project on or off.
set_transcript
pub async fn set_transcript(
client: &Client,
session: &Session,
id: &str,
on: bool,
cancel: &CancellationToken,
) -> Result<bool, Error>
Turn one chat's transcript on or off on the web. Returns whether it is now on, counting its project's choice. Off deletes the copy.
upload_transcript
pub async fn upload_transcript(
client: &Client,
session: &Session,
id: &str,
messages: &[CopiedMessage],
cancel: &CancellationToken,
) -> Result<usize, Error>
Upload a session's read-only transcript copy, replacing the last one.
Refused with transcript_off while its transcript is off.
MAX_PER_COMPUTER
pub const MAX_PER_COMPUTER: usize = 200;
The most sessions one publish may carry.
Re-exported from other crates
Homefromchat_homeMoveRequestfromchat_homePartReffromchat_home