@mastra/code-sdk 1.7.3-alpha.0 → 1.8.0-alpha.10
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/agent-connections/tools.d.ts.map +1 -1
- package/dist/agent-connections/tools.js +26 -8
- package/dist/agent-connections/tools.js.map +1 -1
- package/dist/agents/background-completion-events.d.ts +16 -0
- package/dist/agents/background-completion-events.d.ts.map +1 -0
- package/dist/agents/background-completion-events.js +19 -0
- package/dist/agents/background-completion-events.js.map +1 -0
- package/dist/agents/background-completion.d.ts +9 -0
- package/dist/agents/background-completion.d.ts.map +1 -0
- package/dist/agents/background-completion.js +59 -0
- package/dist/agents/background-completion.js.map +1 -0
- package/dist/agents/mastracode-gateway.d.ts +2 -0
- package/dist/agents/mastracode-gateway.d.ts.map +1 -1
- package/dist/agents/mastracode-gateway.js +29 -10
- package/dist/agents/mastracode-gateway.js.map +1 -1
- package/dist/agents/memory.d.ts +1 -1
- package/dist/agents/memory.d.ts.map +1 -1
- package/dist/agents/memory.js +32 -25
- package/dist/agents/memory.js.map +1 -1
- package/dist/agents/model.d.ts +41 -1
- package/dist/agents/model.d.ts.map +1 -1
- package/dist/agents/model.js +141 -7
- package/dist/agents/model.js.map +1 -1
- package/dist/agents/tool-availability.d.ts +2 -0
- package/dist/agents/tool-availability.d.ts.map +1 -1
- package/dist/agents/tool-availability.js +33 -4
- package/dist/agents/tool-availability.js.map +1 -1
- package/dist/agents/tools.d.ts +1 -1
- package/dist/agents/tools.d.ts.map +1 -1
- package/dist/agents/tools.js +30 -2
- package/dist/agents/tools.js.map +1 -1
- package/dist/agents/workspace.d.ts +2 -1
- package/dist/agents/workspace.d.ts.map +1 -1
- package/dist/agents/workspace.js +3 -3
- package/dist/agents/workspace.js.map +1 -1
- package/dist/auth/account-rotation-processor.d.ts +207 -0
- package/dist/auth/account-rotation-processor.d.ts.map +1 -0
- package/dist/auth/account-rotation-processor.js +669 -0
- package/dist/auth/account-rotation-processor.js.map +1 -0
- package/dist/auth/account-routing-context.d.ts +13 -0
- package/dist/auth/account-routing-context.d.ts.map +1 -0
- package/dist/auth/account-routing-context.js +41 -0
- package/dist/auth/account-routing-context.js.map +1 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +2 -1
- package/dist/auth/providers/anthropic.d.ts.map +1 -1
- package/dist/auth/providers/anthropic.js +2 -8
- package/dist/auth/providers/anthropic.js.map +1 -1
- package/dist/auth/providers/github-copilot.d.ts.map +1 -1
- package/dist/auth/providers/github-copilot.js +34 -12
- package/dist/auth/providers/github-copilot.js.map +1 -1
- package/dist/auth/providers/kimi-coding.d.ts.map +1 -1
- package/dist/auth/providers/kimi-coding.js +2 -6
- package/dist/auth/providers/kimi-coding.js.map +1 -1
- package/dist/auth/providers/openai-codex.d.ts +3 -1
- package/dist/auth/providers/openai-codex.d.ts.map +1 -1
- package/dist/auth/providers/openai-codex.js +50 -24
- package/dist/auth/providers/openai-codex.js.map +1 -1
- package/dist/auth/providers/xai.d.ts +1 -1
- package/dist/auth/providers/xai.d.ts.map +1 -1
- package/dist/auth/providers/xai.js +36 -16
- package/dist/auth/providers/xai.js.map +1 -1
- package/dist/auth/storage.d.ts +130 -8
- package/dist/auth/storage.d.ts.map +1 -1
- package/dist/auth/storage.js +602 -39
- package/dist/auth/storage.js.map +1 -1
- package/dist/auth/types.d.ts +69 -2
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/goal-signal.d.ts +1 -1
- package/dist/goal-signal.d.ts.map +1 -1
- package/dist/goal-signal.js +1 -1
- package/dist/goal-signal.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -38
- package/dist/index.js.map +1 -1
- package/dist/mcp/config.d.ts +17 -2
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +18 -3
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/manager.d.ts +2 -1
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +13 -8
- package/dist/mcp/manager.js.map +1 -1
- package/dist/mcp/types.d.ts +15 -3
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/onboarding/custom-packs.d.ts.map +1 -1
- package/dist/onboarding/custom-packs.js +3 -0
- package/dist/onboarding/custom-packs.js.map +1 -1
- package/dist/onboarding/index.js +1 -1
- package/dist/onboarding/packs.d.ts +44 -0
- package/dist/onboarding/packs.d.ts.map +1 -1
- package/dist/onboarding/packs.js +80 -2
- package/dist/onboarding/packs.js.map +1 -1
- package/dist/onboarding/settings.d.ts +33 -0
- package/dist/onboarding/settings.d.ts.map +1 -1
- package/dist/onboarding/settings.js +88 -8
- package/dist/onboarding/settings.js.map +1 -1
- package/dist/plugin.d.ts +12 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/plugins/loader.d.ts.map +1 -1
- package/dist/plugins/loader.js +2 -1
- package/dist/plugins/loader.js.map +1 -1
- package/dist/providers/claude-max.d.ts.map +1 -1
- package/dist/providers/claude-max.js +4 -5
- package/dist/providers/claude-max.js.map +1 -1
- package/dist/providers/github-copilot.d.ts +1 -1
- package/dist/providers/github-copilot.d.ts.map +1 -1
- package/dist/providers/github-copilot.js +89 -37
- package/dist/providers/github-copilot.js.map +1 -1
- package/dist/providers/kimi-coding.d.ts.map +1 -1
- package/dist/providers/kimi-coding.js +16 -2
- package/dist/providers/kimi-coding.js.map +1 -1
- package/dist/providers/openai-codex.d.ts.map +1 -1
- package/dist/providers/openai-codex.js +42 -27
- package/dist/providers/openai-codex.js.map +1 -1
- package/dist/schema.d.ts +28 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +9 -0
- package/dist/schema.js.map +1 -1
- package/dist/tools/workflows/save-workflow.d.ts +1 -1
- package/dist/tools/workflows/save-workflow.d.ts.map +1 -1
- package/dist/workflows/register-primitives.js +2 -2
- package/dist/workflows/register-primitives.js.map +1 -1
- package/package.json +17 -17
package/dist/auth/storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","names":[],"sources":["../../src/auth/storage.ts"],"sourcesContent":["/**\n * Credential storage for API keys and OAuth tokens.\n * Handles loading, saving, and refreshing credentials from auth.json.\n */\n\nimport { existsSync, mkdirSync, readFileSync, writeFileSync, chmodSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { getAppDataDir } from '../utils/project.js';\nimport { anthropicOAuthProvider } from './providers/anthropic.js';\nimport { githubCopilotOAuthProvider } from './providers/github-copilot.js';\nimport { kimiCodingOAuthProvider } from './providers/kimi-coding.js';\nimport { openaiCodexOAuthProvider } from './providers/openai-codex.js';\nimport { xaiOAuthProvider } from './providers/xai.js';\nimport type {\n AuthCredential,\n AuthStorageData,\n OAuthLoginCallbacks,\n OAuthProviderId,\n OAuthProviderInterface,\n} from './types.js';\n\n/**\n * Best/default models for each OAuth provider.\n * Used when auto-selecting a model after login.\n */\nexport const PROVIDER_DEFAULT_MODELS: Record<OAuthProviderId, string> = {\n anthropic: 'anthropic/claude-fable-5',\n 'openai-codex': 'openai/gpt-5.6-sol',\n // gpt-4.1 routes through `/chat/completions` (which our OpenAI-compatible\n // adapter handles); Anthropic-shaped Copilot models (Claude on `/v1/messages`)\n // are not yet wired up, so picking one as the post-login default would error.\n 'github-copilot': 'github-copilot/gpt-4.1',\n 'kimi-for-coding': 'kimi-for-coding/kimi-for-coding',\n xai: 'xai/grok-4.5',\n};\n\n// Provider registry\nconst oauthProviderRegistry = new Map<string, OAuthProviderInterface>([\n [anthropicOAuthProvider.id, anthropicOAuthProvider],\n [openaiCodexOAuthProvider.id, openaiCodexOAuthProvider],\n [githubCopilotOAuthProvider.id, githubCopilotOAuthProvider],\n [kimiCodingOAuthProvider.id, kimiCodingOAuthProvider],\n [xaiOAuthProvider.id, xaiOAuthProvider],\n]);\n\n/**\n * Get an OAuth provider by ID\n */\nexport function getOAuthProvider(id: OAuthProviderId): OAuthProviderInterface | undefined {\n return oauthProviderRegistry.get(id);\n}\n\n/**\n * Get all registered OAuth providers\n */\nexport function getOAuthProviders(): OAuthProviderInterface[] {\n return Array.from(oauthProviderRegistry.values());\n}\n\n/**\n * Credential storage backed by a JSON file.\n */\nexport class AuthStorage {\n private data: AuthStorageData = {};\n private refreshPromises = new Map<string, Promise<string | undefined>>();\n\n constructor(private authPath: string = join(getAppDataDir(), 'auth.json')) {\n this.reload();\n }\n\n /**\n * Reload credentials from disk.\n */\n reload(): void {\n if (!existsSync(this.authPath)) {\n this.data = {};\n return;\n }\n try {\n this.data = JSON.parse(readFileSync(this.authPath, 'utf-8'));\n } catch {\n this.data = {};\n }\n }\n\n /**\n * Save credentials to disk.\n */\n private save(): void {\n const dir = dirname(this.authPath);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true, mode: 0o700 });\n }\n writeFileSync(this.authPath, JSON.stringify(this.data, null, 2), 'utf-8');\n chmodSync(this.authPath, 0o600);\n }\n\n /**\n * Get credential for a provider.\n */\n get(provider: string): AuthCredential | undefined {\n return this.data[provider] ?? undefined;\n }\n\n /**\n * Set credential for a provider.\n */\n set(provider: string, credential: AuthCredential): void {\n this.data[provider] = credential;\n this.save();\n }\n\n /**\n * Remove credential for a provider.\n */\n remove(provider: string): void {\n delete this.data[provider];\n this.save();\n }\n\n /**\n * List all providers with credentials.\n */\n list(): string[] {\n return Object.keys(this.data);\n }\n\n /**\n * Check if credentials exist for a provider.\n */\n has(provider: string): boolean {\n return provider in this.data;\n }\n\n /**\n * Check if logged in via OAuth for a provider.\n */\n isLoggedIn(provider: string): boolean {\n const cred = this.data[provider];\n return cred?.type === 'oauth';\n }\n\n /**\n * Check if a stored API key exists for a provider.\n * Keys are stored under `apikey:<provider>` in auth.json.\n */\n hasStoredApiKey(provider: string): boolean {\n const cred = this.data[`apikey:${provider}`];\n return cred?.type === 'api_key' && cred.key.length > 0;\n }\n\n /**\n * Get a stored API key for a provider, if any.\n */\n getStoredApiKey(provider: string): string | undefined {\n const cred = this.data[`apikey:${provider}`];\n return cred?.type === 'api_key' && cred.key.length > 0 ? cred.key : undefined;\n }\n\n /**\n * Store an API key for a provider.\n * Also sets the corresponding environment variable so model resolution can find it.\n */\n setStoredApiKey(provider: string, key: string, envVar?: string): void {\n this.set(`apikey:${provider}`, { type: 'api_key', key });\n if (envVar) {\n process.env[envVar] = key;\n }\n }\n\n /**\n * Load all stored API keys into process.env.\n * Called at startup so model resolution can find stored keys.\n * Only sets env vars that aren't already set (env vars take precedence).\n */\n loadStoredApiKeysIntoEnv(providerEnvVars: Record<string, string | undefined>): void {\n for (const [key, cred] of Object.entries(this.data)) {\n if (!key.startsWith('apikey:') || cred.type !== 'api_key' || !cred.key) continue;\n const provider = key.substring('apikey:'.length);\n const envVar = providerEnvVars[provider];\n if (envVar && !process.env[envVar]) {\n process.env[envVar] = cred.key;\n }\n }\n }\n\n /**\n * Login to an OAuth provider.\n */\n async login(providerId: OAuthProviderId, callbacks: OAuthLoginCallbacks): Promise<void> {\n const provider = getOAuthProvider(providerId);\n if (!provider) {\n throw new Error(`Unknown OAuth provider: ${providerId}`);\n }\n\n const credentials = await provider.login(callbacks);\n this.set(providerId, { type: 'oauth', ...credentials });\n }\n\n /**\n * Logout from a provider.\n */\n logout(provider: string): void {\n this.remove(provider);\n }\n\n /**\n * Get API key for a provider, auto-refreshing OAuth tokens if needed.\n */\n async getApiKey(providerId: string): Promise<string | undefined> {\n const cred = this.data[providerId];\n\n if (cred?.type === 'api_key') {\n return cred.key;\n }\n\n if (cred?.type === 'oauth') {\n const provider = getOAuthProvider(providerId);\n if (!provider) {\n return undefined;\n }\n\n // Share one refresh when concurrent requests observe the same expired token.\n if (Date.now() >= cred.expires) {\n const pendingRefresh = this.refreshPromises.get(providerId);\n if (pendingRefresh) return pendingRefresh;\n\n const refresh = (async () => {\n try {\n const newCreds = await provider.refreshToken(cred);\n this.set(providerId, { type: 'oauth', ...newCreds });\n return provider.getApiKey(newCreds);\n } catch {\n // Refresh failed - user needs to re-login\n return undefined;\n } finally {\n this.refreshPromises.delete(providerId);\n }\n })();\n this.refreshPromises.set(providerId, refresh);\n return refresh;\n }\n\n return provider.getApiKey(cred);\n }\n\n return undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,MAAa,0BAA2D;CACtE,WAAW;CACX,gBAAgB;CAIhB,kBAAkB;CAClB,mBAAmB;CACnB,KAAK;AACP;AAGA,MAAM,wCAAwB,IAAI,IAAoC;CACpE,CAAC,uBAAuB,IAAI,sBAAsB;CAClD,CAAC,yBAAyB,IAAI,wBAAwB;CACtD,CAAC,2BAA2B,IAAI,0BAA0B;CAC1D,CAAC,wBAAwB,IAAI,uBAAuB;CACpD,CAAC,iBAAiB,IAAI,gBAAgB;AACxC,CAAC;;;;AAKD,SAAgB,iBAAiB,IAAyD;CACxF,OAAO,sBAAsB,IAAI,EAAE;AACrC;;;;AAKA,SAAgB,oBAA8C;CAC5D,OAAO,MAAM,KAAK,sBAAsB,OAAO,CAAC;AAClD;;;;AAKA,IAAa,cAAb,MAAyB;CAIH;CAHpB,OAAgC,CAAC;CACjC,kCAA0B,IAAI,IAAyC;CAEvE,YAAY,WAA2B,KAAK,cAAc,GAAG,WAAW,GAAG;EAAvD,KAAA,WAAA;EAClB,KAAK,OAAO;CACd;;;;CAKA,SAAe;EACb,IAAI,CAAC,WAAW,KAAK,QAAQ,GAAG;GAC9B,KAAK,OAAO,CAAC;GACb;EACF;EACA,IAAI;GACF,KAAK,OAAO,KAAK,MAAM,aAAa,KAAK,UAAU,OAAO,CAAC;EAC7D,QAAQ;GACN,KAAK,OAAO,CAAC;EACf;CACF;;;;CAKA,OAAqB;EACnB,MAAM,MAAM,QAAQ,KAAK,QAAQ;EACjC,IAAI,CAAC,WAAW,GAAG,GACjB,UAAU,KAAK;GAAE,WAAW;GAAM,MAAM;EAAM,CAAC;EAEjD,cAAc,KAAK,UAAU,KAAK,UAAU,KAAK,MAAM,MAAM,CAA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C,UACH,MAAM,IAAI,MAAM,2BAA2B,YAAY;EAGzD,MAAM,cAAc,MAAM,SAAS,MAAM,SAAS;EAClD,KAAK,IAAI,YAAY;GAAE,MAAM;GAAS,GAAG;EAAY,CAAC;CACxD;;;;CAKA,OAAO,UAAwB;EAC7B,KAAK,OAAO,QAAQ;CACtB;;;;CAKA,MAAM,UAAU,YAAiD;EAC/D,MAAM,OAAO,KAAK,KAAK;EAEvB,IAAI,MAAM,SAAS,WACjB,OAAO,KAAK;EAGd,IAAI,MAAM,SAAS,SAAS;GAC1B,MAAM,WAAW,iBAAiB,UAAU;GAC5C,IAAI,CAAC,UACH;GAIF,IAAI,KAAK,IAAI,KAAK,KAAK,SAAS;IAC9B,MAAM,iBAAiB,KAAK,gBAAgB,IAAI,UAAU;IAC1D,IAAI,gBAAgB,OAAO;IAE3B,MAAM,WAAW,YAAY;KAC3B,IAAI;MACF,MAAM,WAAW,MAAM,SAAS,aAAa,IAAI;MACjD,KAAK,IAAI,YAAY;OAAE,MAAM;OAAS,GAAG;MAAS,CAAC;MACnD,OAAO,SAAS,UAAU,QAAQ;KACpC,QAAQ;MAEN;KACF,UAAU;MACR,KAAK,gBAAgB,OAAO,UAAU;KACxC;IACF,EAAA,CAAG;IACH,KAAK,gBAAgB,IAAI,YAAY,OAAO;IAC5C,OAAO;GACT;GAEA,OAAO,SAAS,UAAU,IAAI;EAChC;CAGF;AACF"}
|
|
1
|
+
{"version":3,"file":"storage.js","names":[],"sources":["../../src/auth/storage.ts"],"sourcesContent":["/**\n * Credential storage for API keys and OAuth tokens.\n * Handles loading, saving, and refreshing credentials from auth.json.\n */\n\nimport { createHash, randomUUID } from 'node:crypto';\nimport { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { getAppDataDir } from '../utils/project.js';\nimport { anthropicOAuthProvider } from './providers/anthropic.js';\nimport { githubCopilotOAuthProvider } from './providers/github-copilot.js';\nimport { kimiCodingOAuthProvider } from './providers/kimi-coding.js';\nimport { openaiCodexOAuthProvider } from './providers/openai-codex.js';\nimport { xaiOAuthProvider } from './providers/xai.js';\nimport type {\n AuthCredential,\n AuthStorageData,\n OAuthAccountRecord,\n OAuthCredential,\n OAuthCredentialSnapshot,\n OAuthCredentials,\n OAuthLoginCallbacks,\n OAuthProviderId,\n OAuthProviderInterface,\n} from './types.js';\n\n/**\n * Best/default models for each OAuth provider.\n * Used when auto-selecting a model after login.\n */\nexport const PROVIDER_DEFAULT_MODELS: Record<OAuthProviderId, string> = {\n anthropic: 'anthropic/claude-fable-5',\n 'openai-codex': 'openai/gpt-5.6-sol',\n // gpt-4.1 routes through `/chat/completions` (which our OpenAI-compatible\n // adapter handles); Anthropic-shaped Copilot models (Claude on `/v1/messages`)\n // are not yet wired up, so picking one as the post-login default would error.\n 'github-copilot': 'github-copilot/gpt-4.1',\n 'kimi-for-coding': 'kimi-for-coding/kimi-for-coding',\n xai: 'xai/grok-4.5',\n};\n\n// Provider registry\nconst oauthProviderRegistry = new Map<string, OAuthProviderInterface>([\n [anthropicOAuthProvider.id, anthropicOAuthProvider],\n [openaiCodexOAuthProvider.id, openaiCodexOAuthProvider],\n [githubCopilotOAuthProvider.id, githubCopilotOAuthProvider],\n [kimiCodingOAuthProvider.id, kimiCodingOAuthProvider],\n [xaiOAuthProvider.id, xaiOAuthProvider],\n]);\n\n/**\n * Get an OAuth provider by ID\n */\nexport function getOAuthProvider(id: OAuthProviderId): OAuthProviderInterface | undefined {\n return oauthProviderRegistry.get(id);\n}\n\n/**\n * Get all registered OAuth providers\n */\nexport function getOAuthProviders(): OAuthProviderInterface[] {\n return Array.from(oauthProviderRegistry.values());\n}\n\n/**\n * Mint an account instance id: `${providerId}:${randomUUID()}`.\n *\n * Assigned once, when the account is created, and never derived from\n * credentials. Deriving it from the refresh token (the pre-A13 scheme) looked\n * stable but was not: `persistRefreshedCredential` keeps an entry's key while\n * writing rotated tokens onto it, so every refresh left the id describing a\n * credential the account no longer had — and re-adding that same subscription\n * then failed to match its own entry and registered a second one for it.\n */\nfunction mintAccountId(providerId: string): string {\n return `${providerId}:${randomUUID()}`;\n}\n\n/**\n * The pre-A13 id scheme: `${providerId}:${sha256(refresh).slice(0,8)}`.\n *\n * No longer used to assign ids, but still needed to recognize registries\n * written before A13 — both to match a re-authorized account onto its existing\n * entry, and to recognize entries whose fields the A13 migration must backfill.\n */\nfunction legacyAccountIdFor(providerId: string, refreshToken: string): string {\n return `${providerId}:${createHash('sha256').update(refreshToken).digest('hex').slice(0, 8)}`;\n}\n\n/**\n * Stable identity for the *subscription* behind an account, when the provider\n * exposes one (an account id, an email — anything that survives a refresh and\n * a re-authorization). Used to decide whether an added account is one we\n * already have. Providers whose credentials carry no such identifier return\n * undefined; for those, a re-authorization is indistinguishable from a new\n * account without spending a request.\n */\nfunction providerIdentity(provider: OAuthProviderInterface | undefined, creds: OAuthCredentials): string | undefined {\n try {\n const identity = provider?.getAccountIdentity?.(creds);\n return typeof identity === 'string' && identity.length > 0 ? identity : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction isOAuthAccountRecord(value: unknown): value is OAuthAccountRecord {\n if (!value || typeof value !== 'object') return false;\n const v = value as Partial<OAuthAccountRecord>;\n return (\n v.type === 'oauth-account' &&\n typeof v.id === 'string' &&\n typeof v.label === 'string' &&\n typeof v.addedAt === 'string' &&\n typeof v.active === 'boolean' &&\n typeof v.refresh === 'string' &&\n typeof v.access === 'string' &&\n typeof v.expires === 'number'\n );\n}\n\n/** The credential fields of an account record — everything but registry identity. */\nfunction credentialFieldsOf(record: OAuthAccountRecord): OAuthCredentials {\n const {\n type: _type,\n id: _id,\n label: _label,\n addedAt: _addedAt,\n active: _active,\n identity: _identity,\n ...creds\n } = record;\n return creds;\n}\n\n/**\n * Credential storage backed by a JSON file.\n */\nexport class AuthStorage {\n private data: AuthStorageData = {};\n private refreshPromises = new Map<string, Promise<OAuthCredentials | undefined>>();\n\n constructor(private authPath: string = join(getAppDataDir(), 'auth.json')) {\n this.reload();\n }\n\n /**\n * Reload credentials from disk.\n */\n reload(): void {\n if (!existsSync(this.authPath)) {\n this.data = {};\n return;\n }\n try {\n this.data = JSON.parse(readFileSync(this.authPath, 'utf-8'));\n } catch {\n this.data = {};\n }\n this.migrate();\n }\n\n /**\n * Bring auth.json up to the multi-account registry format. Runs on every\n * load; saves only when something actually changed.\n *\n * 1. A legacy OAuth slot with no registry gets one adopted active entry\n * (the slot's tokens stay put — the entry mirrors them).\n * 2. When the slot's refresh token differs from the active entry's, an\n * external writer (older build, another worktree) owns the slot — the\n * slot wins and its tokens are adopted onto the active entry.\n * 3. A registry with no active entry (hand-edited) self-heals to its first\n * entry; malformed `accounts:` values are skipped, never fatal.\n * 4. A registry whose legacy slot disappeared (partial write, an external\n * hand-edit) self-heals by mirroring the active entry's tokens back into\n * the slot, so `isLoggedIn()`/`getOAuthCredential()` keep agreeing with\n * `listAccounts()`. `remove()`/`logout()` clear the registry with the\n * slot, so they never leave the shape this heals.\n */\n private migrate(): void {\n let changed = false;\n for (const key of Object.keys(this.data)) {\n const slot = this.data[key];\n if (!slot || slot.type !== 'oauth') continue;\n const providerId = key;\n const entries = this.accountEntries(providerId);\n if (entries.length === 0) {\n this.adoptSlot(providerId, slot);\n changed = true;\n continue;\n }\n const active = entries.find(entry => entry.active);\n if (!active) {\n this.data[this.accountKeyFor(entries[0]!.id)] = { ...entries[0]!, active: true };\n changed = true;\n continue;\n }\n if (active.refresh !== slot.refresh) {\n // An external writer (older build, another worktree) owns the slot.\n // If its tokens belong to a different registered account, that\n // account is now the active one — re-point activation to it instead\n // of cloning the refresh token onto the current active entry.\n const matching = entries.find(entry => entry.id !== active.id && entry.refresh === slot.refresh);\n if (matching) {\n const { type: _t, ...slotCreds } = slot;\n this.data[this.accountKeyFor(matching.id)] = {\n ...matching,\n ...slotCreds,\n type: 'oauth-account',\n active: true,\n };\n this.data[this.accountKeyFor(active.id)] = { ...active, active: false };\n changed = true;\n } else {\n const { type: _type, ...slotCreds } = slot;\n this.data[this.accountKeyFor(active.id)] = { ...active, ...slotCreds, type: 'oauth-account' };\n changed = true;\n }\n }\n }\n\n // Case 4: registry entries without a legacy slot (the slot loop above\n // only ever sees providers that still have one).\n const registeredProviders = new Set<string>();\n for (const key of Object.keys(this.data)) {\n if (!key.startsWith('accounts:')) continue;\n const providerId = key.slice('accounts:'.length).split(':')[0];\n if (providerId) registeredProviders.add(providerId);\n }\n for (const providerId of registeredProviders) {\n if (this.data[providerId]?.type === 'oauth') continue;\n const entries = this.accountEntries(providerId);\n if (entries.length === 0) continue;\n let active = entries.find(entry => entry.active);\n if (!active) {\n active = entries[0]!;\n this.data[this.accountKeyFor(active.id)] = { ...active, active: true };\n }\n this.data[providerId] = { type: 'oauth', ...credentialFieldsOf(active) };\n changed = true;\n }\n\n // Case 5 (A13): backfill the stable account identity on entries that\n // predate it, so adding a subscription we already hold updates its entry\n // instead of registering a second one for it.\n //\n // Ids are deliberately left exactly as they are. Ids are minted once and\n // derive from nothing (A13), so there is nothing to repair — and re-keying\n // a live registry would invalidate every id persisted outside this file\n // (settings routing preferences, per-thread routing state) for no gain.\n for (const providerId of registeredProviders) {\n const provider = getOAuthProvider(providerId as OAuthProviderId);\n if (!provider?.getAccountIdentity) continue;\n for (const entry of this.accountEntries(providerId)) {\n if (entry.identity) continue;\n const identity = providerIdentity(provider, entry);\n if (!identity) continue;\n this.data[this.accountKeyFor(entry.id)] = { ...entry, identity };\n changed = true;\n }\n }\n\n if (changed) this.save();\n }\n\n /**\n * Save credentials to disk.\n */\n private save(): void {\n const dir = dirname(this.authPath);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true, mode: 0o700 });\n }\n // Write to a sibling file, then atomically replace auth.json. Provider\n // fetch wrappers reload this file on every request, including in older\n // Mastra Code processes; writing in place lets them observe truncated JSON\n // and temporarily treat every provider as logged out.\n const tempPath = `${this.authPath}.${process.pid}.${randomUUID()}.tmp`;\n try {\n writeFileSync(tempPath, JSON.stringify(this.data, null, 2), { encoding: 'utf-8', mode: 0o600 });\n chmodSync(tempPath, 0o600);\n renameSync(tempPath, this.authPath);\n } finally {\n rmSync(tempPath, { force: true });\n }\n }\n\n /**\n * Get credential for a provider. Registry entries (type 'oauth-account')\n * live under `accounts:` keys and never surface here.\n */\n get(provider: string): AuthCredential | undefined {\n const cred = this.data[provider];\n return cred !== undefined && cred.type !== 'oauth-account' ? cred : undefined;\n }\n\n /**\n * Set credential for a provider.\n */\n set(provider: string, credential: AuthCredential): void {\n this.reload();\n this.data[provider] = credential;\n this.save();\n }\n\n /**\n * Remove credential for a provider, including its account registry.\n * Clearing only the slot would leave the registry behind, and the next\n * load's migration would heal the slot back from it — resurrecting the\n * provider the caller just signed out.\n */\n remove(provider: string): void {\n this.reload();\n delete this.data[provider];\n const prefix = this.accountPrefixFor(provider);\n for (const key of Object.keys(this.data)) {\n if (key.startsWith(prefix)) delete this.data[key];\n }\n this.save();\n }\n\n /**\n * List all providers with credentials.\n */\n list(): string[] {\n return Object.keys(this.data);\n }\n\n /**\n * Check if credentials exist for a provider.\n */\n has(provider: string): boolean {\n return provider in this.data;\n }\n\n /**\n * Check if logged in via OAuth for a provider.\n */\n isLoggedIn(provider: string): boolean {\n const cred = this.data[provider];\n return cred?.type === 'oauth';\n }\n\n /**\n * Check if a stored API key exists for a provider.\n * Keys are stored under `apikey:<provider>` in auth.json.\n */\n hasStoredApiKey(provider: string): boolean {\n const cred = this.data[`apikey:${provider}`];\n return cred?.type === 'api_key' && cred.key.length > 0;\n }\n\n /**\n * Get a stored API key for a provider, if any.\n */\n getStoredApiKey(provider: string): string | undefined {\n const cred = this.data[`apikey:${provider}`];\n return cred?.type === 'api_key' && cred.key.length > 0 ? cred.key : undefined;\n }\n\n /**\n * Store an API key for a provider.\n * Also sets the corresponding environment variable so model resolution can find it.\n */\n setStoredApiKey(provider: string, key: string, envVar?: string): void {\n this.set(`apikey:${provider}`, { type: 'api_key', key });\n if (envVar) {\n process.env[envVar] = key;\n }\n }\n\n /**\n * Load all stored API keys into process.env.\n * Called at startup so model resolution can find stored keys.\n * Only sets env vars that aren't already set (env vars take precedence).\n */\n loadStoredApiKeysIntoEnv(providerEnvVars: Record<string, string | undefined>): void {\n for (const [key, cred] of Object.entries(this.data)) {\n if (!key.startsWith('apikey:') || cred.type !== 'api_key' || !cred.key) continue;\n const provider = key.substring('apikey:'.length);\n const envVar = providerEnvVars[provider];\n if (envVar && !process.env[envVar]) {\n process.env[envVar] = cred.key;\n }\n }\n }\n\n /**\n * Login to an OAuth provider. Resolves to the registered account record.\n * Pass `activate: false` to add the account without making it active (the\n * first account for a provider is always activated — a provider with\n * accounts must have an active one).\n */\n async login(\n providerId: OAuthProviderId,\n callbacks: OAuthLoginCallbacks,\n opts?: { replaceAccountId?: string; activate?: boolean },\n ): Promise<OAuthAccountRecord> {\n const provider = getOAuthProvider(providerId);\n if (!provider) {\n throw new Error(`Unknown OAuth provider: ${providerId}`);\n }\n\n const credentials = await provider.login(callbacks);\n // Route through the account registry: the new account is appended (or\n // updated in place — by id collision or an explicit replaceAccountId for\n // re-authentication) and becomes the active account unless activate:false.\n return this.addAccount(providerId, credentials, opts);\n }\n\n /**\n * Logout from a provider: remove the legacy slot and every registered account.\n */\n logout(provider: string): void {\n this.remove(provider);\n }\n\n // ---------------------------------------------------------------------------\n // Multi-account registry\n // ---------------------------------------------------------------------------\n\n private accountPrefixFor(providerId: string): string {\n return `accounts:${providerId}:`;\n }\n\n private accountKeyFor(id: string): string {\n return `accounts:${id}`;\n }\n\n /** Registry entries for a provider in JSON insertion order (malformed values skipped). */\n private accountEntries(providerId: string): OAuthAccountRecord[] {\n const prefix = this.accountPrefixFor(providerId);\n const out: OAuthAccountRecord[] = [];\n for (const [key, value] of Object.entries(this.data)) {\n if (key.startsWith(prefix) && isOAuthAccountRecord(value)) out.push(value);\n }\n return out;\n }\n\n /** Adopt a legacy slot credential as the registry's first active entry. */\n private adoptSlot(providerId: string, slot: OAuthCredential): OAuthAccountRecord {\n const id = mintAccountId(providerId);\n const provider = getOAuthProvider(providerId);\n const identity = providerIdentity(provider, slot);\n const record: OAuthAccountRecord = {\n ...slot,\n type: 'oauth-account',\n id,\n ...(identity ? { identity } : {}),\n label: `${provider?.name ?? providerId} account 1`,\n addedAt: new Date().toISOString(),\n active: true,\n };\n this.data[this.accountKeyFor(id)] = record;\n return record;\n }\n\n /**\n * Registered OAuth accounts for a provider, in insertion order. Copies —\n * callers cannot corrupt unsaved storage state by mutating a record.\n */\n listAccounts(providerId: string): OAuthAccountRecord[] {\n return this.accountEntries(providerId).map(entry => ({ ...entry }));\n }\n\n /**\n * The provider's active registry entry, if a registry exists. A copy.\n */\n getActiveAccount(providerId: string): OAuthAccountRecord | undefined {\n const active = this.accountEntries(providerId).find(entry => entry.active);\n return active ? { ...active } : undefined;\n }\n\n /**\n * Register OAuth credentials as an account for a provider, making it active\n * unless `activate: false` is passed.\n *\n * With `replaceAccountId` (re-authentication of a picked account), the\n * target entry's tokens are replaced in place — id re-keyed to the new\n * refresh-token hash, label/position/addedAt preserved — because providers\n * rotate refresh tokens per authorization, so the picked account's old id\n * never matches the new token hash. Re-authentication keeps the target's\n * active state: an inactive account stays inactive and the currently active\n * account keeps the legacy slot. Otherwise, when the new credentials\n * hash to an existing entry's id (same refresh token), that entry is\n * updated in place; a genuinely new account is appended and activated.\n *\n * `activate: false` only applies to the plain add path: the new/updated entry\n * keeps the active state it had, and the previously active account stays\n * active. The first account of a provider is activated regardless.\n */\n async addAccount(\n providerId: string,\n creds: OAuthCredentials,\n opts?: { label?: string; replaceAccountId?: string; activate?: boolean },\n ): Promise<OAuthAccountRecord> {\n this.reload();\n const entries = this.accountEntries(providerId);\n\n if (opts?.replaceAccountId) {\n const target = entries.find(entry => entry.id === opts.replaceAccountId);\n if (!target) {\n throw new Error(`No account ${opts.replaceAccountId} for provider ${providerId}`);\n }\n const provider = getOAuthProvider(providerId);\n const identity = providerIdentity(provider, creds) ?? target.identity;\n // Re-authentication updates the account in place and **keeps its id**:\n // ids are minted once and never derived from credentials (A13), so the\n // entry's insertion position, the settings routing preference and any\n // thread routing state that name this id all stay valid.\n //\n // A stale entry for the *same* subscription is dropped in favor of the\n // picked account. Same-subscription is a matching stable identity, or —\n // for a registry written before A13, whose ids were the refresh-token\n // hash — the credentials' own legacy id, or an entry already holding\n // exactly these credentials (a re-authorization that returns the same\n // tokens, the only signal an identity-less provider gives). The survivor\n // inherits the collided entry's active state, so re-authenticating an\n // inactive account onto the active account's credentials cannot leave the\n // registry with no active entry.\n const legacyId = legacyAccountIdFor(providerId, creds.refresh);\n const collided = entries.find(\n entry =>\n entry.id !== target.id &&\n ((identity !== undefined && entry.identity === identity) ||\n entry.id === legacyId ||\n entry.refresh === creds.refresh),\n );\n // Credential metadata (device id, enterprise URL, …) follows the tokens:\n // when the fresh response omits a field, the collided entry's value is the\n // coherent fallback, not the target's — pairing fresh tokens with another\n // subscription's stale endpoint would misroute requests. Fresh `creds`\n // win last; only the target's registry metadata (id, label, addedAt)\n // carries over.\n const replacement: OAuthAccountRecord = {\n ...target,\n ...(collided ? credentialFieldsOf(collided) : {}),\n ...creds,\n type: 'oauth-account',\n ...(identity ? { identity } : {}),\n label: opts.label ?? target.label,\n };\n const rebuilt: AuthStorageData = {};\n for (const [key, value] of Object.entries(this.data)) {\n if (key === this.accountKeyFor(target.id)) {\n rebuilt[key] = collided?.active ? { ...replacement, active: true } : replacement;\n } else if (collided && key === this.accountKeyFor(collided.id)) {\n continue;\n } else {\n rebuilt[key] = value;\n }\n }\n this.data = rebuilt;\n // Re-authentication preserves the account's active state: fixing a\n // secondary account's tokens must not hijack the active slot. The target\n // is activated when it was already active, when the entry it collided\n // with was active, or when the provider has no active account at all\n // (first account, or a self-healed gap).\n const wasActive =\n target.active === true ||\n collided?.active === true ||\n entries.some(entry => entry.active && entry.id !== target.id) === false;\n if (wasActive) {\n const activated = this.activateInMemory(providerId, target.id);\n if (!activated) {\n throw new Error(`Failed to activate account ${target.id} for provider ${providerId}`);\n }\n this.save();\n return activated;\n }\n // Inactive target: tokens stay on the registry entry, the legacy slot\n // keeps the currently active account's credential untouched.\n const replacementEntry = this.accountEntries(providerId).find(entry => entry.id === target.id);\n if (!replacementEntry) {\n throw new Error(`Failed to store account ${target.id} for provider ${providerId}`);\n }\n this.save();\n return replacementEntry;\n }\n\n // Resolve the label before the final reload+save: the provider hook may\n // hit the network, and a concurrent write during that await must not be\n // clobbered by a stale snapshot.\n const provider = getOAuthProvider(providerId);\n const identity = providerIdentity(provider, creds);\n const label = opts?.label ?? (await provider?.getAccountLabel?.(creds)) ?? null;\n this.reload();\n const freshEntries = this.accountEntries(providerId);\n\n // Is this a subscription we already hold? Match the provider's stable\n // account identity where it exposes one, then the pre-A13 id (the\n // refresh-token hash) so a pre-A13 registry still updates its entry rather\n // than gaining a second one for the same subscription, and finally an\n // entry already holding these exact credentials (a re-add of the same\n // account as returned, which is the only signal an identity-less provider\n // such as Anthropic gives us — a provider that cannot name its accounts\n // cannot say \"this is the same subscription, re-authorized\").\n //\n // Crucially this must not re-derive the id of a *minted* entry: after a\n // refresh such an entry's id no longer hashes its current token, and\n // treating that miss as \"new account\" is exactly how re-adding a\n // subscription used to create a duplicate entry for it.\n const legacyId = legacyAccountIdFor(providerId, creds.refresh);\n const existing =\n (identity ? freshEntries.find(entry => entry.identity === identity) : undefined) ??\n freshEntries.find(entry => entry.id === legacyId) ??\n freshEntries.find(entry => entry.refresh === creds.refresh);\n const id = existing?.id ?? mintAccountId(providerId);\n if (existing) {\n this.data[this.accountKeyFor(id)] = {\n ...existing,\n ...creds,\n type: 'oauth-account',\n id,\n ...(identity ? { identity } : {}),\n active: existing.active,\n };\n } else {\n const resolvedLabel = label ?? `${provider?.name ?? providerId} account ${freshEntries.length + 1}`;\n this.data[this.accountKeyFor(id)] = {\n type: 'oauth-account',\n id,\n ...(identity ? { identity } : {}),\n label: resolvedLabel,\n addedAt: new Date().toISOString(),\n active: false,\n ...creds,\n };\n }\n\n // activate:false (add-another): keep the current active account. The\n // first account of a provider always activates — a non-empty registry\n // must have an active entry. An id collision with the already-active\n // entry also falls through to activateInMemory so its fresh tokens move\n // into the legacy slot (tokens are single-homed).\n if (opts?.activate === false && freshEntries.length > 0 && !existing?.active) {\n this.save();\n return { ...(this.data[this.accountKeyFor(id)] as OAuthAccountRecord) };\n }\n\n const activated = this.activateInMemory(providerId, id);\n if (!activated) {\n throw new Error(`Failed to activate account ${id} for provider ${providerId}`);\n }\n this.save();\n return activated;\n }\n\n /**\n * Activate an account: move the active tokens out of the legacy slot back\n * into the previously active entry, and the target's tokens into the slot\n * (never copy — one home per token set). With no `instanceId`, rotate to\n * the next entry in insertion order, wrapping once to the front; returns\n * undefined when there is no other entry to rotate to.\n */\n activateAccount(providerId: string, instanceId?: string): OAuthAccountRecord | undefined {\n this.reload();\n const activated = this.activateInMemory(providerId, instanceId);\n if (activated) this.save();\n return activated;\n }\n\n /**\n * Activate an account in memory only — the caller owns reload/save. Move the\n * active tokens out of the legacy slot back into the previously active\n * entry, and the target's tokens into the slot (never copy — one home per\n * token set). With no `instanceId`, rotate to the next entry in insertion\n * order, wrapping once to the front; returns undefined when there is no\n * other entry to rotate to.\n */\n private activateInMemory(providerId: string, instanceId?: string): OAuthAccountRecord | undefined {\n const entries = this.accountEntries(providerId);\n if (entries.length === 0) return undefined;\n\n let target: OAuthAccountRecord | undefined;\n if (instanceId !== undefined) {\n target = entries.find(entry => entry.id === instanceId);\n if (!target) return undefined;\n } else {\n if (entries.length <= 1) return undefined;\n const currentIdx = entries.findIndex(entry => entry.active);\n const candidates =\n currentIdx >= 0 ? [...entries.slice(currentIdx + 1), ...entries.slice(0, currentIdx)] : [...entries];\n target = candidates[0]!;\n }\n if (!target) return undefined;\n\n const slot = this.data[providerId];\n const current = entries.find(entry => entry.active && entry.id !== target.id);\n\n // Move the slot's tokens back onto the previously active entry. Skipped\n // when the target is already active — its (possibly re-authenticated)\n // entry already holds the freshest tokens.\n if (current && slot?.type === 'oauth') {\n const { type: _type, ...slotCreds } = slot;\n this.data[this.accountKeyFor(current.id)] = { ...current, ...slotCreds, type: 'oauth-account', active: false };\n }\n\n // Move the target's tokens into the legacy slot. The slot is rebuilt from\n // the target's own credentials only: carrying fields over from the\n // previously active account would pair this account's tokens with that\n // account's metadata (`deviceId`, `enterpriseUrl`, account id), and the\n // providers read those fields off the slot.\n this.data[providerId] = { ...credentialFieldsOf(target), type: 'oauth' };\n\n // Exactly the target stays active (self-heals multi-active states).\n this.data[this.accountKeyFor(target.id)] = { ...target, active: true };\n for (const entry of entries) {\n if (entry.id === target.id || entry.id === current?.id) continue;\n if (entry.active) {\n this.data[this.accountKeyFor(entry.id)] = { ...entry, active: false };\n }\n }\n\n return { ...target, active: true };\n }\n\n /**\n * Remove an account from the registry. If it was active, the next entry in\n * insertion order is activated; when it was the last one, the legacy slot\n * is removed too (full sign-out for that provider).\n */\n removeAccount(providerId: string, instanceId: string): void {\n this.reload();\n const entries = this.accountEntries(providerId);\n const target = entries.find(entry => entry.id === instanceId);\n if (!target) return;\n\n const wasActive = target.active;\n delete this.data[this.accountKeyFor(instanceId)];\n\n if (wasActive) {\n const idx = entries.indexOf(target);\n const next = entries[idx + 1] ?? entries.find(entry => entry.id !== instanceId);\n if (next) {\n // The removed account's tokens die with it — only move tokens in.\n this.data[providerId] = { type: 'oauth', ...credentialFieldsOf(next) };\n this.data[this.accountKeyFor(next.id)] = { ...next, active: true };\n for (const entry of entries) {\n if (entry.id === next.id || entry.id === instanceId) continue;\n if (entry.active) {\n this.data[this.accountKeyFor(entry.id)] = { ...entry, active: false };\n }\n }\n } else {\n delete this.data[providerId];\n }\n }\n\n this.save();\n }\n\n /**\n * Rename an account's label.\n */\n renameAccount(providerId: string, instanceId: string, label: string): void {\n this.reload();\n const key = this.accountKeyFor(instanceId);\n const entry = this.data[key];\n if (!isOAuthAccountRecord(entry)) return;\n this.data[key] = { ...entry, label };\n this.save();\n }\n\n /**\n * Persist refreshed credentials for the account that initiated the refresh.\n * The legacy slot is updated only if that account is still active when the\n * refresh completes; otherwise a delayed refresh could overwrite a newer\n * activation.\n */\n private persistRefreshedCredential(\n providerId: string,\n instanceId: string | undefined,\n creds: OAuthCredentials,\n ): void {\n this.reload();\n if (instanceId) {\n const key = this.accountKeyFor(instanceId);\n const entry = this.data[key];\n if (!isOAuthAccountRecord(entry)) return;\n this.data[key] = { ...entry, ...creds, type: 'oauth-account' };\n if (entry.active) {\n const slot = this.data[providerId];\n this.data[providerId] =\n slot?.type === 'oauth' ? { ...slot, ...creds, type: 'oauth' } : { type: 'oauth', ...creds };\n }\n } else {\n const slot = this.data[providerId];\n this.data[providerId] =\n slot?.type === 'oauth' ? { ...slot, ...creds, type: 'oauth' } : { type: 'oauth', ...creds };\n }\n this.save();\n }\n\n /**\n * Refresh one account instance through the per-instance dedupe map. Used\n * for sibling refreshes during the rotation walk, so a concurrent\n * `getApiKey` that reloads storage mid-walk (after the candidate was\n * activated but before its refresh resolves) joins the same refresh\n * instead of double-spending a single-use refresh token.\n */\n private async refreshInstance(\n providerId: string,\n instanceId: string,\n creds: OAuthCredentials,\n ): Promise<OAuthCredentials | undefined> {\n const provider = getOAuthProvider(providerId);\n if (!provider) return undefined;\n const refreshKey = `${providerId}:${instanceId}`;\n const pending = this.refreshPromises.get(refreshKey);\n if (pending) return pending;\n const refresh = (async () => {\n try {\n const fresh = await provider.refreshToken(creds);\n this.persistRefreshedCredential(providerId, instanceId, fresh);\n return fresh;\n } catch {\n return undefined;\n }\n })();\n this.refreshPromises.set(refreshKey, refresh);\n try {\n return await refresh;\n } finally {\n this.refreshPromises.delete(refreshKey);\n }\n }\n\n /**\n * Get a ready-to-use OAuth credential snapshot, auto-refreshing if needed.\n * A failed refresh leaves the active account unchanged and returns undefined;\n * the account-rotation processor owns switching so it can persist a visible\n * account-switch notice with the request that triggered the change.\n */\n async getOAuthCredential(\n providerId: string,\n accountInstanceId?: string,\n ): Promise<OAuthCredentialSnapshot | undefined> {\n this.reload();\n const activeEntry = this.getActiveAccount(providerId);\n const selectedEntry = accountInstanceId\n ? this.accountEntries(providerId).find(entry => entry.id === accountInstanceId)\n : activeEntry;\n const slot = this.data[providerId];\n let credential: OAuthCredentials | undefined;\n if (selectedEntry) {\n const {\n type: _type,\n id: _id,\n label: _label,\n addedAt: _addedAt,\n active: _active,\n ...accountCredential\n } = selectedEntry;\n credential = accountCredential;\n // The active account's credentials live in both the legacy slot and its\n // registry entry, and a legacy writer (older build, another worktree) can\n // refresh the slot without rotating the refresh token. `migrate()` only\n // reconciles those when the refresh token changes, so the registry entry\n // can hold stale access/expiry. Prefer the slot for the active account\n // and keep the registry entry as the account identity.\n if (selectedEntry.active && slot?.type === 'oauth' && slot.refresh === selectedEntry.refresh) {\n const { type: _slotType, ...slotCredential } = slot;\n credential = { ...credential, ...slotCredential };\n }\n } else if (!accountInstanceId && slot?.type === 'oauth') {\n credential = slot;\n }\n if (!credential) return undefined;\n\n const provider = getOAuthProvider(providerId);\n if (!provider) return undefined;\n const selectedInstanceId = selectedEntry?.id;\n const toSnapshot = (credentials: OAuthCredentials): OAuthCredentialSnapshot => ({\n type: 'oauth',\n ...credentials,\n accountInstanceId: selectedInstanceId,\n });\n\n if (Date.now() < credential.expires) return toSnapshot(credential);\n\n if (selectedInstanceId) {\n const refreshed = await this.refreshInstance(providerId, selectedInstanceId, credential);\n return refreshed ? toSnapshot(refreshed) : undefined;\n }\n\n const pendingRefresh = this.refreshPromises.get(providerId);\n const refresh =\n pendingRefresh ??\n (async (): Promise<OAuthCredentials | undefined> => {\n try {\n const fresh = await provider.refreshToken(credential);\n this.persistRefreshedCredential(providerId, undefined, fresh);\n return fresh;\n } catch {\n return undefined;\n }\n })();\n if (!pendingRefresh) this.refreshPromises.set(providerId, refresh);\n try {\n const refreshed = await refresh;\n return refreshed ? toSnapshot(refreshed) : undefined;\n } finally {\n if (!pendingRefresh) this.refreshPromises.delete(providerId);\n }\n }\n\n /** Get API key for a provider, refreshing OAuth tokens if needed. */\n async getApiKey(providerId: string, accountInstanceId?: string): Promise<string | undefined> {\n this.reload();\n const cred = this.data[providerId];\n // A provider slot holding an API key belongs to the provider, not to any one\n // subscription, so it is only the right credential for a request that did\n // not select an account. A routed request must resolve the account it asked\n // for — or nothing — rather than be served this key.\n if (accountInstanceId === undefined && cred?.type === 'api_key') return cred.key;\n\n const oauth = await this.getOAuthCredential(providerId, accountInstanceId);\n const provider = oauth ? getOAuthProvider(providerId) : undefined;\n return oauth && provider ? provider.getApiKey(oauth) : undefined;\n }\n\n /**\n * Force one refresh of the active OAuth account's tokens, regardless of\n * expiry. The account-rotation error processor calls this when a provider\n * rejects a not-yet-expired token (401/403) — server-side clock skew and\n * refresh-token races surface that way. Returns the fresh access token, or\n * undefined when the refresh fails or there is no OAuth credential.\n * Shares the per-instance refresh dedupe with `getApiKey`.\n */\n async forceRefreshActiveAccount(providerId: string, accountInstanceId?: string): Promise<string | undefined> {\n this.reload();\n const activeEntry = this.getActiveAccount(providerId);\n const selectedEntry = accountInstanceId\n ? this.accountEntries(providerId).find(entry => entry.id === accountInstanceId)\n : activeEntry;\n const slot = this.get(providerId);\n let cred: OAuthCredentials | undefined;\n if (selectedEntry) {\n const {\n type: _type,\n id: _id,\n label: _label,\n addedAt: _addedAt,\n active: _active,\n ...accountCredential\n } = selectedEntry;\n cred = accountCredential;\n } else if (!accountInstanceId && slot?.type === 'oauth') {\n cred = slot;\n }\n if (!cred) return undefined;\n const provider = getOAuthProvider(providerId);\n if (!provider) return undefined;\n\n const refreshKey = selectedEntry ? `${providerId}:${selectedEntry.id}` : providerId;\n const pending = this.refreshPromises.get(refreshKey);\n const refresh =\n pending ??\n (async (): Promise<OAuthCredentials | undefined> => {\n try {\n const fresh = await provider.refreshToken(cred);\n this.persistRefreshedCredential(providerId, selectedEntry?.id, fresh);\n return fresh;\n } catch {\n return undefined;\n }\n })();\n if (!pending) this.refreshPromises.set(refreshKey, refresh);\n try {\n const creds = await refresh;\n return creds ? provider.getApiKey(creds) : undefined;\n } finally {\n if (!pending) this.refreshPromises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;;;;;CAUA,MAAM,0BAA0B,YAAoB,mBAAyD;EAC3G,KAAK,OAAO;EACZ,MAAM,cAAc,KAAK,iBAAiB,UAAU;EACpD,MAAM,gBAAgB,oBAClB,KAAK,eAAe,UAAU,CAAC,CAAC,MAAK,UAAS,MAAM,OAAO,iBAAiB,IAC5E;EACJ,MAAM,OAAO,KAAK,IAAI,UAAU;EAChC,IAAI;EACJ,IAAI,eAAe;GACjB,MAAM,EACJ,MAAM,OACN,IAAI,KACJ,OAAO,QACP,SAAS,UACT,QAAQ,SACR,GAAG,sBACD;GACJ,OAAO;EACT,OAAO,IAAI,CAAC,qBAAqB,MAAM,SAAS,SAC9C,OAAO;EAET,IAAI,CAAC,MAAM,OAAO,KAAA;EAClB,MAAM,WAAW,iBAAiB,UAAU;EAC5C,IAAI,CAAC,UAAU,OAAO,KAAA;EAEtB,MAAM,aAAa,gBAAgB,GAAG,WAAW,GAAG,cAAc,OAAO;EACzE,MAAM,UAAU,KAAK,gBAAgB,IAAI,UAAU;EACnD,MAAM,UACJ,YACC,YAAmD;GAClD,IAAI;IACF,MAAM,QAAQ,MAAM,SAAS,aAAa,IAAI;IAC9C,KAAK,2BAA2B,YAAY,eAAe,IAAI,KAAK;IACpE,OAAO;GACT,QAAQ;IACN;GACF;EACF,EAAA,CAAG;EACL,IAAI,CAAC,SAAS,KAAK,gBAAgB,IAAI,YAAY,OAAO;EAC1D,IAAI;GACF,MAAM,QAAQ,MAAM;GACpB,OAAO,QAAQ,SAAS,UAAU,KAAK,IAAI,KAAA;EAC7C,UAAU;GACR,IAAI,CAAC,SAAS,KAAK,gBAAgB,OAAO,UAAU;EACtD;CACF;AACF"}
|
package/dist/auth/types.d.ts
CHANGED
|
@@ -55,6 +55,22 @@ export interface OAuthProviderInterface {
|
|
|
55
55
|
refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;
|
|
56
56
|
/** Convert credentials to API key string for the provider */
|
|
57
57
|
getApiKey(credentials: OAuthCredentials): string;
|
|
58
|
+
/**
|
|
59
|
+
* Optional human-readable label for an account (e.g. the user's email),
|
|
60
|
+
* captured when the account is registered in the multi-account registry.
|
|
61
|
+
*/
|
|
62
|
+
getAccountLabel?(credentials: OAuthCredentials): Promise<string | undefined>;
|
|
63
|
+
/**
|
|
64
|
+
* Optional stable identity for the *subscription* behind a set of
|
|
65
|
+
* credentials (e.g. a provider account id or an email), read from the
|
|
66
|
+
* credentials themselves — synchronous and local, so it can be used while
|
|
67
|
+
* deciding whether an added account is one we already hold. Must be the same
|
|
68
|
+
* value across refreshes and re-authorizations of one subscription, and
|
|
69
|
+
* different for two subscriptions of the same provider. Providers whose
|
|
70
|
+
* credentials carry no such identifier omit this; a re-authorization of an
|
|
71
|
+
* existing subscription is then indistinguishable from a new account.
|
|
72
|
+
*/
|
|
73
|
+
getAccountIdentity?(credentials: OAuthCredentials): string | undefined;
|
|
58
74
|
}
|
|
59
75
|
export type ApiKeyCredential = {
|
|
60
76
|
type: 'api_key';
|
|
@@ -63,8 +79,36 @@ export type ApiKeyCredential = {
|
|
|
63
79
|
export type OAuthCredential = {
|
|
64
80
|
type: 'oauth';
|
|
65
81
|
} & OAuthCredentials;
|
|
82
|
+
export type OAuthCredentialSnapshot = OAuthCredential & {
|
|
83
|
+
/** Non-secret registry identity for credential-scoped in-process caches. */
|
|
84
|
+
accountInstanceId?: string;
|
|
85
|
+
};
|
|
66
86
|
export type AuthCredential = ApiKeyCredential | OAuthCredential;
|
|
67
|
-
|
|
87
|
+
/**
|
|
88
|
+
* A registered OAuth account in a provider's multi-account registry.
|
|
89
|
+
*
|
|
90
|
+
* Registry entries live in auth.json under `accounts:<id>` keys (where `id` is
|
|
91
|
+
* `${providerId}:${sha256(refresh).slice(0,8)}`), separate from the provider's
|
|
92
|
+
* legacy slot. Exactly one entry per provider is `active`; its tokens are
|
|
93
|
+
* single-homed in the legacy slot, with this record mirroring them so a later
|
|
94
|
+
* activation moves fresh tokens back in.
|
|
95
|
+
*/
|
|
96
|
+
export interface OAuthAccountRecord extends OAuthCredentials {
|
|
97
|
+
type: 'oauth-account';
|
|
98
|
+
id: string;
|
|
99
|
+
label: string;
|
|
100
|
+
/** ISO timestamp of when the account was added. */
|
|
101
|
+
addedAt: string;
|
|
102
|
+
active: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Stable provider-supplied identity for the subscription behind this account
|
|
105
|
+
* (an account id, an email) when the provider exposes one. Used to recognize
|
|
106
|
+
* that an added account is one we already hold; absent for providers whose
|
|
107
|
+
* credentials carry no such identifier.
|
|
108
|
+
*/
|
|
109
|
+
identity?: string;
|
|
110
|
+
}
|
|
111
|
+
export type AuthStorageData = Record<string, AuthCredential | OAuthAccountRecord>;
|
|
68
112
|
/**
|
|
69
113
|
* The read surface model resolution and the OAuth fetch wrappers need from a
|
|
70
114
|
* credential source. `AuthStorage` satisfies it structurally (file-backed,
|
|
@@ -84,6 +128,29 @@ export interface CredentialStore {
|
|
|
84
128
|
* Ready-to-use key/token for a provider, refreshing expired OAuth
|
|
85
129
|
* credentials first. Implementations own refresh serialization.
|
|
86
130
|
*/
|
|
87
|
-
getApiKey(provider: string): Promise<string | undefined>;
|
|
131
|
+
getApiKey(provider: string, accountInstanceId?: string): Promise<string | undefined>;
|
|
132
|
+
/**
|
|
133
|
+
* Ready-to-use OAuth credential snapshot. Optional because deployed stores
|
|
134
|
+
* have no local account registry. Local wrappers use this to keep the access
|
|
135
|
+
* token and account-specific metadata from the same account.
|
|
136
|
+
*/
|
|
137
|
+
getOAuthCredential?(provider: string, accountInstanceId?: string): Promise<OAuthCredentialSnapshot | undefined>;
|
|
138
|
+
/**
|
|
139
|
+
* Registered OAuth accounts for a provider, in insertion order. Optional so
|
|
140
|
+
* deployed per-tenant stores need no change.
|
|
141
|
+
*/
|
|
142
|
+
listAccounts?(providerId: string): OAuthAccountRecord[];
|
|
143
|
+
/** The provider's active registry entry, if a registry exists. */
|
|
144
|
+
getActiveAccount?(providerId: string): OAuthAccountRecord | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Activate an account: rotate to the next instance (insertion order,
|
|
147
|
+
* wrapping once), or to `instanceId` when given. Moves the active tokens
|
|
148
|
+
* between the legacy slot and the registry entries. Returns the newly
|
|
149
|
+
* active record, or undefined when there is no other instance to rotate to
|
|
150
|
+
* (or `instanceId` is unknown).
|
|
151
|
+
*/
|
|
152
|
+
activateAccount?(providerId: string, instanceId?: string): OAuthAccountRecord | undefined;
|
|
153
|
+
/** Remove one account from the registry (activating the next if it was active). */
|
|
154
|
+
removeAccount?(providerId: string, instanceId: string): void;
|
|
88
155
|
}
|
|
89
156
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/auth/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE,CAAC,MAAM,EAAE,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B,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACrF;;;;OAIG;IACH,kBAAkB,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAAC;IAEhH;;;OAGG;IACH,YAAY,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAAC;IAExD,kEAAkE;IAClE,gBAAgB,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAAC;IAEtE;;;;;;OAMG;IACH,eAAe,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAAC;IAE1F,mFAAmF;IACnF,aAAa,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9D"}
|
package/dist/goal-signal.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goal-signal.d.ts","sourceRoot":"","sources":["../src/goal-signal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,SAAS;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"goal-signal.d.ts","sourceRoot":"","sources":["../src/goal-signal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,SAAS;;;;;;;;;;;EAavD"}
|
package/dist/goal-signal.js
CHANGED
package/dist/goal-signal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goal-signal.js","names":[],"sources":["../src/goal-signal.ts"],"sourcesContent":["import type { GoalState } from './goal-manager.js';\n\nexport function createGoalReminderSignal(goal: GoalState) {\n return {\n type: 'system-reminder' as const,\n contents: goal.objective,\n attributes: { type: 'goal' },\n metadata: {\n goalId: goal.id,\n maxTurns: goal.maxTurns,\n judgeModelId: goal.judgeModelId,\n },\n };\n}\n"],"mappings":";AAEA,SAAgB,yBAAyB,MAAiB;CACxD,OAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf,YAAY,EAAE,MAAM,OAAO;EAC3B,UAAU;GACR,QAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"goal-signal.js","names":[],"sources":["../src/goal-signal.ts"],"sourcesContent":["import type { GoalState } from './goal-manager.js';\n\nexport function createGoalReminderSignal(goal: GoalState) {\n return {\n type: 'system-reminder' as const,\n contents: goal.objective,\n attributes: { type: 'goal' },\n metadata: {\n goalId: goal.id,\n // Must match the key the TUI reads (`goalMaxTurns`). It previously used\n // `maxTurns`, so the reminder rendered without its attempt budget.\n goalMaxTurns: goal.maxTurns,\n judgeModelId: goal.judgeModelId,\n },\n };\n}\n"],"mappings":";AAEA,SAAgB,yBAAyB,MAAiB;CACxD,OAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf,YAAY,EAAE,MAAM,OAAO;EAC3B,UAAU;GACR,QAAQ,KAAK;GAGb,cAAc,KAAK;GACnB,cAAc,KAAK;EACrB;CACF;AACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -147,6 +147,8 @@ export declare function createMastraCodeAgentController(config?: MastraCodeConfi
|
|
|
147
147
|
builtinOmPacks: import("./onboarding/packs.js").OMPack[];
|
|
148
148
|
effectiveDefaults: Record<string, string>;
|
|
149
149
|
githubSignals: GithubSignals | undefined;
|
|
150
|
+
backgroundToolsEnabled: boolean;
|
|
151
|
+
backgroundCompletionEvents: import("./agents/background-completion-events.js").BackgroundCompletionEvents | undefined;
|
|
150
152
|
sessionId: string;
|
|
151
153
|
ownerId: string;
|
|
152
154
|
projectPath: string;
|
|
@@ -233,6 +235,8 @@ export declare function bootLocalAgentController(config?: MastraCodeConfig): Pro
|
|
|
233
235
|
builtinOmPacks: import("./onboarding/packs.js").OMPack[];
|
|
234
236
|
effectiveDefaults: Record<string, string>;
|
|
235
237
|
githubSignals: GithubSignals | undefined;
|
|
238
|
+
backgroundToolsEnabled: boolean;
|
|
239
|
+
backgroundCompletionEvents: import("./agents/background-completion-events.js").BackgroundCompletionEvents | undefined;
|
|
236
240
|
sessionId: string;
|
|
237
241
|
ownerId: string;
|
|
238
242
|
projectPath: string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EAErB,mBAAmB,EACnB,uBAAuB,EAEvB,OAAO,EACR,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EAErB,mBAAmB,EACnB,uBAAuB,EAEvB,OAAO,EACR,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAU7C,OAAO,KAAK,EAAE,cAAc,EAAa,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,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