@hienlh/ppm 0.8.46 → 0.8.47

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.47] - 2026-03-25
4
+
5
+ ### Fixed
6
+ - **Usage polling**: Use `ensureFreshToken()` in background usage poll — prevents 401 from expired tokens causing auto-fetch to always fail
7
+ - **Temp accounts**: Don't auto-disable temporary accounts (no refresh token) when token expires — they now expire naturally and get cleaned up after 7 days
8
+ - **Account export**: `refreshBeforeExport` no longer disables accounts as a side effect on refresh failure
9
+
3
10
  ## [0.8.46] - 2026-03-25
4
11
 
5
12
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hienlh/ppm",
3
- "version": "0.8.46",
3
+ "version": "0.8.47",
4
4
  "description": "Personal Project Manager — mobile-first web IDE with AI assistance",
5
5
  "author": "hienlh",
6
6
  "license": "MIT",
@@ -628,7 +628,10 @@ export class ClaudeAgentSdkProvider implements AIProvider {
628
628
  }
629
629
  } catch (refreshErr) {
630
630
  console.error(`[sdk] session=${sessionId} OAuth refresh failed:`, refreshErr);
631
- accountSelector.onAuthError(account.id);
631
+ // Don't disable temp accounts (no refresh token) — they just expire naturally
632
+ if (accountService.hasRefreshToken(account.id)) {
633
+ accountSelector.onAuthError(account.id);
634
+ }
632
635
  }
633
636
  }
634
637
 
@@ -702,7 +705,10 @@ export class ClaudeAgentSdkProvider implements AIProvider {
702
705
  await accountService.refreshAccessToken(account.id);
703
706
  console.log(`[sdk] 401 on account ${account.id} — token refreshed`);
704
707
  } catch {
705
- accountSelector.onAuthError(account.id);
708
+ // Don't disable temp accounts (no refresh token) — they just expire naturally
709
+ if (accountService.hasRefreshToken(account.id)) {
710
+ accountSelector.onAuthError(account.id);
711
+ }
706
712
  }
707
713
  } else {
708
714
  accountSelector.onSuccess(account.id);
@@ -571,7 +571,7 @@ class AccountService {
571
571
  if (!acc.accessToken.startsWith("sk-ant-oat")) continue;
572
572
  if (!acc.expiresAt) continue;
573
573
  try {
574
- await this.refreshAccessToken(acc.id);
574
+ await this.refreshAccessToken(acc.id, false);
575
575
  } catch {
576
576
  // Best-effort — skip accounts whose refresh token is already invalid
577
577
  }
@@ -174,7 +174,8 @@ async function fetchAllAccountUsages(): Promise<void> {
174
174
  if (acc.status === "disabled") continue;
175
175
  // Skip expired temporary accounts (no refresh token)
176
176
  if (!accountService.hasRefreshToken(acc.id) && acc.expiresAt && acc.expiresAt < nowS) continue;
177
- const withTokens = accountService.getWithTokens(acc.id);
177
+ // Ensure token is fresh before calling usage API (prevents 401 from expired tokens)
178
+ const withTokens = await accountService.ensureFreshToken(acc.id);
178
179
  if (!withTokens) continue;
179
180
  const token = withTokens.accessToken;
180
181
  // Only OAuth tokens have usage endpoint