mirror of
https://github.com/openai/codex.git
synced 2026-11-08 20:40:33 +00:00
## Summary - Add backend-client types and fetch support for active workspace messages. - Add the app-server v2 `account/workspaceMessages/read` method, generated schemas, and README documentation. - Delegate workspace-message eligibility to the Codex backend feature gate; map a backend 404 to `featureEnabled: false`. ## Testing - `just write-app-server-schema` - `just test -p codex-backend-client` - `just test -p codex-app-server-protocol` - `just test -p codex-app-server workspace_messages` - `just fix -p codex-backend-client -p codex-app-server-protocol -p codex-app-server` - `just fmt` ## Stack - Base PR for #28232, which adds the TUI status-line integration.
30 lines
958 B
Rust
30 lines
958 B
Rust
use codex_app_server_protocol::GetWorkspaceMessagesResponse;
|
|
use codex_app_server_protocol::WorkspaceMessageType;
|
|
use std::time::Duration;
|
|
|
|
pub(crate) const WORKSPACE_HEADLINE_REFRESH_INTERVAL: Duration = Duration::from_secs(5 * 60);
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub(crate) enum WorkspaceHeadlineFetchResult {
|
|
Available(Option<String>),
|
|
FeatureDisabled,
|
|
}
|
|
|
|
pub(crate) fn workspace_headline_from_response(
|
|
response: GetWorkspaceMessagesResponse,
|
|
) -> WorkspaceHeadlineFetchResult {
|
|
if !response.feature_enabled {
|
|
return WorkspaceHeadlineFetchResult::FeatureDisabled;
|
|
}
|
|
|
|
WorkspaceHeadlineFetchResult::Available(response.messages.into_iter().find_map(|message| {
|
|
(message.message_type == WorkspaceMessageType::Headline)
|
|
.then(|| message.message_body.trim().to_string())
|
|
.filter(|headline| !headline.is_empty())
|
|
}))
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "workspace_messages_tests.rs"]
|
|
mod tests;
|