import type { Breakpoint, BreakpointAnswer, BreakpointBrowserSession, BreakpointSessionView, Project, ProjectSummary, GitHubRepo, KnownUser, Team } from "../types.js"; import type { User, AuthToken, SSHKeyPair } from "../auth/types.js"; /** * Information about an SSH key stored on the server. */ export interface SSHKeyInfo { id: string; fingerprint: string; algorithm: string; createdAt: string; label?: string; } /** * Options for constructing an AuthClient. */ export interface AuthClientOptions { /** Base URL of the BMUX server (defaults to https://tasks-adapter.a5c.ai/api/v1). */ serverUrl?: string; /** Static access token. */ token?: string; /** Async function that provides a fresh access token on each call. */ tokenProvider?: () => Promise; /** Refresh token used to automatically renew expired access tokens. */ refreshToken?: string; /** Callback invoked when tokens are refreshed (e.g. to persist them). */ onTokenRefresh?: (tokens: { accessToken: string; refreshToken: string; }) => void; } /** * Authenticated client that wraps ServerClient, automatically injecting * Authorization headers and handling token refresh on 401 responses. */ export declare class AuthClient { private serverClient; private token; private refreshTokenValue; private tokenProvider; private onTokenRefresh; constructor(options: AuthClientOptions); /** * Returns true if a token or token provider is available. */ isAuthenticated(): boolean; /** * Fetch the authenticated user's profile. */ getUser(): Promise; /** * Exchange an OAuth authorization code for auth tokens. */ login(code: string, codeVerifier?: string): Promise; /** * Log out, clearing local token state. */ logout(): Promise; /** * List breakpoints with optional filters, authenticated. */ listBreakpoints(filters?: Record): Promise; /** * Get a single breakpoint by ID, authenticated. */ getBreakpoint(id: string): Promise; /** * Submit a new breakpoint, authenticated. */ submitBreakpoint(text: string, context: Breakpoint["context"], routing: Breakpoint["routing"], options: { projectId: string; repoId: string; }): Promise; /** * Submit an answer to a breakpoint, authenticated. */ submitAnswer(breakpointId: string, answer: { responderId: string; responderName: string; text: string; confidence?: number; references?: string[]; followUpQuestions?: string[]; }): Promise; createBrowserSession(breakpointId: string, options?: { mode?: "same-user" | "responder"; responderId?: string; responderName?: string; }): Promise; getBreakpointSession(authToken: string): Promise; submitSessionAnswer(authToken: string, answer: { text: string; confidence?: number; references?: string[]; followUpQuestions?: string[]; }): Promise; /** * Generate a new SSH key pair on the server. */ generateKey(): Promise; /** * List SSH keys associated with the authenticated user. */ listKeys(): Promise; /** * Push an SSH public key to a repository via pull request. */ pushKey(keyId: string, owner: string, repo: string): Promise<{ prUrl: string; }>; /** * List all projects the authenticated user has access to. */ listProjects(): Promise; listTeams(): Promise; getTeam(id: string): Promise; createTeam(name: string, description: string): Promise; listTeamProjects(teamId: string): Promise; inviteTeamMember(teamId: string, login: string): Promise; acceptTeamInvitation(token: string): Promise; /** * Find known users for project membership and sharing flows. */ searchUsers(query?: string, limit?: number): Promise; /** * Get a single project by ID. */ getProject(id: string): Promise; /** * Create a new project. */ createProject(name: string, description: string, options?: { teamId?: string; }): Promise; /** * Update an existing project. */ updateProject(id: string, updates: { name?: string; description?: string; teamId?: string; }): Promise; /** * Delete a project by ID. */ deleteProject(id: string): Promise; /** * Add a GitHub repository to a project. */ addRepoToProject(projectId: string, repo: { owner: string; name: string; fullName?: string; description?: string; url?: string; defaultBranch?: string; language?: string | null; isPrivate?: boolean; repoRoot?: string; configRoot?: string; responderDir?: string; isConfigSource?: boolean; }): Promise; /** * Remove a repository from a project. */ removeRepoFromProject(projectId: string, repoId: string): Promise; /** * List breakpoints associated with a project. */ listProjectBreakpoints(projectId: string): Promise; /** * List GitHub repositories available to the authenticated user. */ listGitHubRepos(): Promise; /** * Build the Authorization header from the current token or provider. */ private getAuthHeaders; /** * Attempt to refresh the access token using the stored refresh token. */ private refreshAccessToken; /** * Perform an authenticated GET request with automatic 401 retry. */ private authenticatedGet; /** * Perform an authenticated POST request with automatic 401 retry. */ private authenticatedPost; /** * Perform an authenticated PUT request with automatic 401 retry. */ private authenticatedPut; /** * Perform an authenticated DELETE request with automatic 401 retry. */ private authenticatedDelete; } //# sourceMappingURL=auth-client.d.ts.map