mirror of
https://github.com/openai/codex.git
synced 2026-11-18 23:02:23 +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
@@ -31,6 +31,8 @@ const TOKEN_ACTIVITY_FETCH_TIMEOUT: std::time::Duration =
|
||||
std::time::Duration::from_secs(/*secs*/ 15);
|
||||
const RATE_LIMIT_RESET_REQUEST_TIMEOUT: std::time::Duration =
|
||||
std::time::Duration::from_secs(/*secs*/ 15);
|
||||
const WORKSPACE_HEADLINE_FETCH_TIMEOUT: std::time::Duration =
|
||||
std::time::Duration::from_millis(/*millis*/ 2000);
|
||||
|
||||
impl App {
|
||||
pub(super) fn fetch_mcp_inventory(
|
||||
@@ -158,6 +160,29 @@ impl App {
|
||||
});
|
||||
}
|
||||
|
||||
pub(super) fn refresh_status_line_workspace_headline(
|
||||
&mut self,
|
||||
app_server: &AppServerSession,
|
||||
request_id: u64,
|
||||
) {
|
||||
let request_handle = app_server.request_handle();
|
||||
let app_event_tx = self.app_event_tx.clone();
|
||||
tokio::spawn(async move {
|
||||
let result = tokio::time::timeout(
|
||||
WORKSPACE_HEADLINE_FETCH_TIMEOUT,
|
||||
fetch_workspace_messages(request_handle),
|
||||
)
|
||||
.await
|
||||
.map_err(|_| "account/workspaceMessages/read timed out in TUI".to_string())
|
||||
.and_then(|result| {
|
||||
result
|
||||
.map(crate::workspace_messages::workspace_headline_from_response)
|
||||
.map_err(|err| err.to_string())
|
||||
});
|
||||
app_event_tx.send(AppEvent::StatusLineWorkspaceHeadlineUpdated { request_id, result });
|
||||
});
|
||||
}
|
||||
|
||||
pub(super) fn send_add_credits_nudge_email(
|
||||
&mut self,
|
||||
app_server: &AppServerSession,
|
||||
@@ -796,6 +821,19 @@ pub(super) async fn consume_rate_limit_reset_credit_request(
|
||||
.wrap_err("account/rateLimitResetCredit/consume failed in TUI")
|
||||
}
|
||||
|
||||
pub(super) async fn fetch_workspace_messages(
|
||||
request_handle: AppServerRequestHandle,
|
||||
) -> Result<codex_app_server_protocol::GetWorkspaceMessagesResponse> {
|
||||
let request_id = RequestId::String(format!("workspace-messages-{}", Uuid::new_v4()));
|
||||
request_handle
|
||||
.request_typed(ClientRequest::GetWorkspaceMessages {
|
||||
request_id,
|
||||
params: None,
|
||||
})
|
||||
.await
|
||||
.wrap_err("account/workspaceMessages/read failed in TUI")
|
||||
}
|
||||
|
||||
pub(super) async fn send_add_credits_nudge_email(
|
||||
request_handle: AppServerRequestHandle,
|
||||
credit_type: AddCreditsNudgeCreditType,
|
||||
|
||||
Reference in new issue
Block a user