codexuse-cli 5.0.9 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4862,7 +4862,7 @@ function parseRateLimitSnapshotFromOAuthUsage(value) {
4862
4862
  }
4863
4863
  return {
4864
4864
  lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
4865
- source: "codex-oauth",
4865
+ source: "codex-oauth-estimate",
4866
4866
  ...primary ? { primary } : {},
4867
4867
  ...secondary ? { secondary } : {},
4868
4868
  ...extraWindows.length > 0 ? { extraWindows } : {}
@@ -7048,6 +7048,25 @@ var ProfileManager = class {
7048
7048
  });
7049
7049
  }
7050
7050
  }
7051
+ async readConfirmedRateLimits(name, options = {}) {
7052
+ const profileName = this.normalizeProfileName(name);
7053
+ try {
7054
+ return await this.enqueueProfileOperation(
7055
+ profileName,
7056
+ () => this.runWithPreparedProfileHome(
7057
+ profileName,
7058
+ (env) => fetchRateLimitsViaRpc(env, { codexPath: options.codexPath }),
7059
+ { syncFromActiveAuthBeforeAction: false }
7060
+ )
7061
+ );
7062
+ } finally {
7063
+ await this.enqueueAuthSwap(async () => {
7064
+ await this.syncActiveAuthFromProfileIfCurrent(profileName);
7065
+ }).catch((error) => {
7066
+ logWarn(`Failed to sync active auth after rate-limit confirmation for '${profileName}':`, error);
7067
+ });
7068
+ }
7069
+ }
7051
7070
  async activateResetWindow(name, options = {}) {
7052
7071
  const profileName = this.normalizeProfileName(name);
7053
7072
  try {
@@ -8414,8 +8433,7 @@ function maxUsedPercent(snapshot) {
8414
8433
  }
8415
8434
  const candidates = [
8416
8435
  snapshot.primary?.usedPercent,
8417
- snapshot.secondary?.usedPercent,
8418
- ...(snapshot.extraWindows ?? []).map((window) => window.usedPercent)
8436
+ snapshot.secondary?.usedPercent
8419
8437
  ].filter((value) => typeof value === "number" && Number.isFinite(value));
8420
8438
  if (candidates.length === 0) {
8421
8439
  return null;
@@ -8544,8 +8562,7 @@ function formatUsagePercent(value) {
8544
8562
  function snapshotResetSeconds(snapshot) {
8545
8563
  const values = [
8546
8564
  snapshot?.primary?.resetsInSeconds,
8547
- snapshot?.secondary?.resetsInSeconds,
8548
- ...(snapshot?.extraWindows ?? []).map((window) => window.resetsInSeconds)
8565
+ snapshot?.secondary?.resetsInSeconds
8549
8566
  ].filter((value) => typeof value === "number" && Number.isFinite(value));
8550
8567
  return values.length > 0 ? Math.min(...values) : null;
8551
8568
  }
@@ -17235,7 +17252,7 @@ async function ensureCliStorageReady() {
17235
17252
  }
17236
17253
 
17237
17254
  // src/app/main.ts
17238
- var VERSION = true ? "5.0.9" : "0.0.0";
17255
+ var VERSION = true ? "5.1.0" : "0.0.0";
17239
17256
  async function runCli() {
17240
17257
  const args = process.argv.slice(2);
17241
17258
  if (args.length === 0) {