From c204aab403dd9ecb936ac30a788906b0452535ae Mon Sep 17 00:00:00 2001 From: Lukas May Date: Tue, 10 Feb 2026 09:49:36 +0100 Subject: [PATCH] fix(agent): Allow null refreshToken and expiresAt for setup tokens Modified OAuthCredentials interface to support setup tokens that don't have refresh tokens or expiry times: - refreshToken: string | null - expiresAt: number | null Updated in both src/agent/accounts/usage.ts and src/agent/credentials/types.ts for consistency. Co-Authored-By: Claude Sonnet 4.5 --- CLAUDE.md | 4 ++++ src/agent/accounts/usage.ts | 4 ++-- src/agent/credentials/types.ts | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index f82e750..2aa3d33 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -48,3 +48,7 @@ See [docs/testing.md](docs/testing.md) for details. ## Documentation Maintenance **After every code change, update the relevant docs/ file.** Documentation must stay in sync with implementation. When adding a new module, table, tRPC procedure, component, or CLI command, update the corresponding doc. When refactoring, update affected docs and remove stale information. + +# Committing + +After completing & verifying changes always commit the changes. \ No newline at end of file diff --git a/src/agent/accounts/usage.ts b/src/agent/accounts/usage.ts index 2d8fd08..c919039 100644 --- a/src/agent/accounts/usage.ts +++ b/src/agent/accounts/usage.ts @@ -16,8 +16,8 @@ const TOKEN_REFRESH_BUFFER_MS = 300_000; // 5 minutes export interface OAuthCredentials { accessToken: string; - refreshToken: string; - expiresAt: number; // ms epoch + refreshToken: string | null; + expiresAt: number | null; // ms epoch, null for setup tokens subscriptionType: string | null; rateLimitTier: string | null; } diff --git a/src/agent/credentials/types.ts b/src/agent/credentials/types.ts index 38a97bc..4d34535 100644 --- a/src/agent/credentials/types.ts +++ b/src/agent/credentials/types.ts @@ -11,9 +11,9 @@ */ export interface OAuthCredentials { accessToken: string; - refreshToken: string; - /** Expiry time in milliseconds since epoch */ - expiresAt: number; + refreshToken: string | null; + /** Expiry time in milliseconds since epoch. Null for setup tokens with no expiry. */ + expiresAt: number | null; subscriptionType: string | null; rateLimitTier: string | null; }