import type { AuthProvider, RunCommand } from "./auth-providers.js"; export type AuthChatId = number | string; export interface AuthMessage { userId: number | string; chatType: string; chatId: AuthChatId; messageId?: number | string; text: string; } export interface AuthPty { write(data: string): void; kill(signal?: string): void; onData(handler: (data: string) => void): { dispose?: () => void; } | void; onExit(handler: (event: { exitCode: number; signal?: number; }) => void): { dispose?: () => void; } | void; } export interface AuthSpawnOptions { name: string; cols: number; rows: number; cwd: string; env: NodeJS.ProcessEnv; } export type SpawnPty = (file: string, args: readonly string[], options: AuthSpawnOptions) => AuthPty; export interface AuthClock { now?: () => number; setTimeout(handler: () => void, delayMs: number): unknown; clearTimeout(handle: unknown): void; } export interface AuthLogger { warn?: (message: string) => void; error?: (message: string) => void; } export interface AuthMenuCommand { command: string; description: string; } export declare const AUTH_MENU_COMMANDS: AuthMenuCommand[]; export interface AuthBot { setMyCommands(commands: AuthMenuCommand[], options: { scope: { type: "chat"; chat_id: number; }; }): Promise; } export interface TelegramAuthOptions { bot: AuthBot; ownerUserIds: readonly number[]; allowFrom: ReadonlySet | null; env: NodeJS.ProcessEnv; flowTtlSeconds?: number; send: (chatId: AuthChatId, text: string) => void | Promise; deleteMessage: (chatId: AuthChatId, messageId: number | string) => void | Promise; spawnPty?: SpawnPty; runCommand?: RunCommand; clock?: AuthClock; logger: AuthLogger; } export interface ActiveFlow { key: string; generation: number; ownerId: number; provider: AuthProvider; chatId: AuthChatId; pty: AuthPty; timer?: unknown; discoveryTail: string; discoveredUrl?: string; discoveredCode?: string; urlSent: boolean; codeSent: boolean; invalidated: boolean; dataSubscription?: { dispose?: () => void; }; exitSubscription?: { dispose?: () => void; }; } export type ProviderState = "authenticated" | "not authenticated" | "status unavailable"; export type AuthInputSource = "short-code" | "claude-callback"; export type AuthCommand = { kind: "start"; provider: AuthProvider; } | { kind: "status"; } | { kind: "cancel"; } | { kind: "input"; code: string; source: AuthInputSource; } | { kind: "rejected"; }; export declare const DEFAULT_FLOW_TTL_SECONDS = 600; export declare const MAX_DISCOVERY_TAIL_BYTES = 4096; export declare const AUTH_PAYLOAD_PATTERN: RegExp; export declare const CLOCK: AuthClock; export declare const DEFAULT_SPAWN_PTY: SpawnPty; export declare function isAuthCommandPrefix(text: string): boolean; export declare function parseAuthCommand(text: string): AuthCommand | null; export declare function parseAuthInput(value: string): AuthCommand | null; export declare function isCallbackUrlShape(value: string): boolean; export declare function ownerId(value: number | string): number | null; export declare function resolveOwnerIds(configured: readonly number[], allowFrom: ReadonlySet | null, logger: AuthLogger): number[]; export declare function appendUtf8Tail(current: string, data: string): string; export declare function extractDiscovery(text: string, final?: boolean): { url?: string; code?: string; }; export declare function flowKey(owner: number, provider: AuthProvider): string; //# sourceMappingURL=auth-support.d.ts.map