1+ /**
2+ * Shared auth-profile constants.
3+ * Defines store versions, built-in CLI profile ids, lock budgets, refresh
4+ * timing, and logging used by auth profile runtime modules.
5+ */
16import { createSubsystemLogger } from "../../logging/subsystem.js" ;
27export {
38 AUTH_PROFILE_FILENAME ,
49 AUTH_STATE_FILENAME ,
510 LEGACY_AUTH_FILENAME ,
611} from "./path-constants.js" ;
712
13+ /** Current persisted auth profile store schema version. */
814export const AUTH_STORE_VERSION = 1 ;
915
1016/** @deprecated Anthropic provider-owned CLI profile id; do not use from third-party plugins. */
1117export const CLAUDE_CLI_PROFILE_ID = "anthropic:claude-cli" ;
1218/** @deprecated OpenAI provider-owned CLI profile id; do not use from third-party plugins. */
1319export const CODEX_CLI_PROFILE_ID = "openai:codex-cli" ;
20+ /** Default OpenAI/Codex OAuth profile id used for migrated stores. */
1421export const OPENAI_CODEX_DEFAULT_PROFILE_ID = "openai:default" ;
1522/** @deprecated MiniMax provider-owned CLI profile id; do not use from third-party plugins. */
1623export const MINIMAX_CLI_PROFILE_ID = "minimax-portal:minimax-cli" ;
1724
25+ /** File-lock policy for auth profile store reads/writes. */
1826export const AUTH_STORE_LOCK_OPTIONS = {
1927 retries : {
2028 retries : 10 ,
@@ -40,6 +48,7 @@ export const AUTH_STORE_LOCK_OPTIONS = {
4048// Retry budget note: keep the MINIMUM cumulative retry window comfortably
4149// above OAUTH_REFRESH_CALL_TIMEOUT_MS so waiters do not give up while a
4250// legitimate slow refresh is still within its allowed runtime budget.
51+ /** Cross-agent lock policy for shared OAuth refresh operations. */
4352export const OAUTH_REFRESH_LOCK_OPTIONS = {
4453 retries : {
4554 retries : 20 ,
@@ -56,9 +65,13 @@ export const OAUTH_REFRESH_LOCK_OPTIONS = {
5665// surfaced as a refresh failure. Keep strictly below
5766// OAUTH_REFRESH_LOCK_OPTIONS.stale so the lock is never treated as stale
5867// by a waiter while the owner is still doing legitimate work.
68+ /** Maximum duration for one OAuth refresh call inside the refresh lock. */
5969export const OAUTH_REFRESH_CALL_TIMEOUT_MS = 120_000 ;
6070
71+ /** Freshness window for syncing external CLI auth into auth profiles. */
6172export const EXTERNAL_CLI_SYNC_TTL_MS = 15 * 60 * 1000 ;
73+ /** Near-expiry threshold that triggers external CLI credential resync. */
6274export const EXTERNAL_CLI_NEAR_EXPIRY_MS = 10 * 60 * 1000 ;
6375
76+ /** Auth profile subsystem logger. */
6477export const log = createSubsystemLogger ( "agents/auth-profiles" ) ;
0 commit comments