/** * Claude Max OAuth Provider * * Uses OAuth tokens from AuthStorage to authenticate with Claude Max plan. * The OAuth endpoint requires a specific system message to be present. */ import type { MastraModelConfig } from '@mastra/core/llm'; import type { LanguageModelMiddleware } from 'ai'; import { AuthStorage } from '../auth/storage.js'; /** * Get or create the shared AuthStorage instance */ export declare function getAuthStorage(): AuthStorage; /** * Set a custom AuthStorage instance (useful for TUI integration) */ export declare function setAuthStorage(storage: AuthStorage | undefined): void; /** * Middleware that injects the Claude Code identity system message * Required for Claude Max OAuth authentication */ export declare const claudeCodeMiddleware: LanguageModelMiddleware; /** * Prompt caching middleware for Anthropic * * Adds cache breakpoints at strategic locations: * 1. Last system message (end of static instructions + dynamic memory) * 2. Most recent user/assistant message (conversation context) * * This allows Anthropic to cache: * - System prompts and instructions (rarely change) * - Conversation history up to the last message */ export declare const promptCacheMiddleware: LanguageModelMiddleware; /** * Build a fetch function that handles Anthropic OAuth. * Preserves non-auth headers from init (critical for gateway auth header to survive * when used with the gateway). Strips `authorization` and `x-api-key`. */ export declare function buildAnthropicOAuthFetch(opts?: { authStorage?: AuthStorage; }): typeof fetch; /** * Creates an Anthropic model using Claude Max OAuth authentication * Uses OAuth tokens from AuthStorage (auto-refreshes when needed) */ export declare function opencodeClaudeMaxProvider(modelId?: string, options?: { headers?: Record; }): MastraModelConfig; //# sourceMappingURL=claude-max.d.ts.map