mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Add workspace messages app-server API (#29001)
## 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.
This commit is contained in:
1 parent
9c3b10e5d4
commit
21d36296f1
34 files changed
+1163
-3
No files matched your search
@@ -0,0 +1,29 @@
|
||||
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;
|
||||
Reference in new issue
Block a user