openagents_sdk::schedules
The account's scheduled prompts (/v1/schedules, #11177). The site keeps
one list per account; each computer runs its own entries, so no server
clock starts work. The app host uses this for Foreman's check-ins
(#11965); Coder keeps its own copy of the same records.
| Item | What it does |
|---|---|
Schedule struct | One scheduled prompt, or the record that it was deleted. |
Schedules struct | A client for the scheduled prompts on one account. |
new_id fn | A fresh schedule id. |
MAX_EVERY_SECS const | The longest interval the site keeps. |
MAX_PROMPT_BYTES const | The longest prompt the site keeps. |
MIN_EVERY_SECS const | The shortest and longest interval the site keeps. |
PREFIX const | Every id starts with this (a Coder background rule's id). |
Schedule
pub struct Schedule {
pub id: String,
pub computer: String,
pub prompt: Option<String>,
pub days: Vec<u8>,
pub time: Option<String>,
pub every_secs: Option<u64>,
pub chat: Option<String>,
pub chat_title: Option<String>,
pub workspace: Option<String>,
pub paused: bool,
pub updated: u64,
pub deleted: bool,
}
One scheduled prompt, or the record that it was deleted. Either a time
of day on chosen days or an interval. chat names the conversation it
posts into; unset means a new run.
Schedule::valid
pub fn valid(&self) -> bool
Whether the site would keep this record as sent.
Schedules
pub struct Schedules<'a> {}
A client for the scheduled prompts on one account.
Schedules::list
pub async fn list(&self, cancel: &CancellationToken) -> Result<Vec<Schedule>, Error>
Every live scheduled prompt on the account, newest first.
Schedules::sync
pub async fn sync(
&self,
computer: &str,
changed: &[Schedule],
cancel: &CancellationToken,
) -> Result<Vec<Schedule>, Error>
Send computer's changed records (a newer updated wins, a deletion
wins a tie) and receive that computer's whole list, deletions included.
new_id
pub fn new_id() -> Result<String, Error>
A fresh schedule id.
MAX_EVERY_SECS
pub const MAX_EVERY_SECS: u64 = 30 * 24 * 3600;
The longest interval the site keeps.
MAX_PROMPT_BYTES
pub const MAX_PROMPT_BYTES: usize = 4000;
The longest prompt the site keeps.
MIN_EVERY_SECS
pub const MIN_EVERY_SECS: u64 = 60;
The shortest and longest interval the site keeps.
PREFIX
pub const PREFIX: &str = "prompt-";
Every id starts with this (a Coder background rule's id).