feat: align project discovery with opencode-antigravity-auth reference

- Store project IDs in composite refresh token format (refreshToken|projectId|managedProjectId)
- Add parseRefreshParts() and formatRefreshParts() for token handling
- Extract and persist subscription tier during project discovery
- Fetch subscription in blocking mode when missing from cached accounts
- Fix conditional duetProject setting to match reference implementation
- Export parseTierId() for reuse across modules

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Badri Narayanan S
2026-01-19 14:21:30 +05:30
parent 9311c6fdf7
commit 2175118f9f
7 changed files with 227 additions and 52 deletions

View File

@@ -668,10 +668,11 @@ export function mountWebUI(app, dirname, accountManager) {
const accountData = await completeOAuthFlow(code, verifier);
// Add or update the account
// Note: Don't set projectId here - it will be discovered and stored
// in the refresh token via getProjectForAccount() on first use
await addAccount({
email: accountData.email,
refreshToken: accountData.refreshToken,
projectId: accountData.projectId,
source: 'oauth'
});