Skip to content

Commit 8dcaa33

Browse files
committed
feat(account): show reset credit expirations
1 parent 6102ef2 commit 8dcaa33

20 files changed

Lines changed: 815 additions & 54 deletions

File tree

src-tauri/src/bin/codex_monitor_daemon.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -718,11 +718,7 @@ impl DaemonState {
718718
codex_core::resume_thread_core(&self.sessions, workspace_id, thread_id).await
719719
}
720720

721-
async fn read_thread(
722-
&self,
723-
workspace_id: String,
724-
thread_id: String,
725-
) -> Result<Value, String> {
721+
async fn read_thread(&self, workspace_id: String, thread_id: String) -> Result<Value, String> {
726722
codex_core::read_thread_core(&self.sessions, workspace_id, thread_id).await
727723
}
728724

@@ -791,8 +787,7 @@ impl DaemonState {
791787
limit: Option<u32>,
792788
sort_key: Option<String>,
793789
) -> Result<Value, String> {
794-
codex_core::list_threads_core(&self.sessions, workspace_id, cursor, limit, sort_key)
795-
.await
790+
codex_core::list_threads_core(&self.sessions, workspace_id, cursor, limit, sort_key).await
796791
}
797792

798793
async fn list_mcp_server_status(
@@ -935,6 +930,13 @@ impl DaemonState {
935930
.await
936931
}
937932

933+
async fn account_rate_limit_reset_credits(
934+
&self,
935+
workspace_id: String,
936+
) -> Result<Value, String> {
937+
codex_core::account_rate_limit_reset_credits_core(&self.workspaces, workspace_id).await
938+
}
939+
938940
async fn account_read(&self, workspace_id: String) -> Result<Value, String> {
939941
codex_core::account_read_core(&self.sessions, &self.workspaces, workspace_id).await
940942
}

src-tauri/src/bin/codex_monitor_daemon/rpc/codex.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,13 @@ pub(super) async fn try_handle(
407407
.await,
408408
)
409409
}
410+
"account_rate_limit_reset_credits" => {
411+
let workspace_id = match parse_string(params, "workspaceId") {
412+
Ok(value) => value,
413+
Err(err) => return Some(Err(err)),
414+
};
415+
Some(state.account_rate_limit_reset_credits(workspace_id).await)
416+
}
410417
"account_read" => {
411418
let workspace_id = match parse_string(params, "workspaceId") {
412419
Ok(value) => value,

src-tauri/src/codex/mod.rs

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -508,14 +508,7 @@ pub(crate) async fn start_review(
508508
.await;
509509
}
510510

511-
codex_core::start_review_core(
512-
&state.sessions,
513-
workspace_id,
514-
thread_id,
515-
target,
516-
delivery,
517-
)
518-
.await
511+
codex_core::start_review_core(&state.sessions, workspace_id, thread_id, target, delivery).await
519512
}
520513

521514
#[tauri::command]
@@ -751,12 +744,27 @@ pub(crate) async fn consume_rate_limit_reset_credit(
751744
.await;
752745
}
753746

754-
codex_core::consume_rate_limit_reset_credit_core(
755-
&state.sessions,
756-
workspace_id,
757-
idempotency_key,
758-
)
759-
.await
747+
codex_core::consume_rate_limit_reset_credit_core(&state.sessions, workspace_id, idempotency_key)
748+
.await
749+
}
750+
751+
#[tauri::command]
752+
pub(crate) async fn account_rate_limit_reset_credits(
753+
workspace_id: String,
754+
state: State<'_, AppState>,
755+
app: AppHandle,
756+
) -> Result<Value, String> {
757+
if remote_backend::is_remote_mode(&*state).await {
758+
return remote_backend::call_remote(
759+
&*state,
760+
app,
761+
"account_rate_limit_reset_credits",
762+
json!({ "workspaceId": workspace_id }),
763+
)
764+
.await;
765+
}
766+
767+
codex_core::account_rate_limit_reset_credits_core(&state.workspaces, workspace_id).await
760768
}
761769

762770
#[tauri::command]
@@ -823,8 +831,7 @@ pub(crate) async fn saved_auth_profile_activate(
823831
return Err("Saved auth profiles are not supported in remote mode".to_string());
824832
}
825833

826-
codex_core::saved_auth_profile_activate_core(&state.workspaces, workspace_id, profile_id)
827-
.await
834+
codex_core::saved_auth_profile_activate_core(&state.workspaces, workspace_id, profile_id).await
828835
}
829836

830837
#[tauri::command]

src-tauri/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ pub fn run() {
275275
codex::write_agent_config_toml,
276276
codex::account_rate_limits,
277277
codex::consume_rate_limit_reset_credit,
278+
codex::account_rate_limit_reset_credits,
278279
codex::account_read,
279280
codex::saved_auth_profiles_list,
280281
codex::saved_auth_profile_sync_current,

src-tauri/src/remote_backend/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ fn can_retry_after_disconnect(method: &str) -> bool {
147147
method,
148148
"account_rate_limits"
149149
| "consume_rate_limit_reset_credit"
150+
| "account_rate_limit_reset_credits"
150151
| "account_read"
151152
| "apps_list"
152153
| "collaboration_mode_list"

0 commit comments

Comments
 (0)