import type { Context } from '@deepseek-ai/cordis'; /** Masked account facts returned by the optional ChatCode authentication bundle. */ export interface ChatCodeAuthStatus { required?: boolean; validation: 'valid' | 'invalid' | 'unavailable' | 'none'; login?: { sessionId: string; state: 'pending' | 'succeeded' | 'failed' | 'timed-out' | 'cancelled'; expiresAtMs: number; }; configured: boolean; expiresAtMs?: number; userName?: string; emailAddress?: string; expired: boolean; } /** * UI sign-in contract: views stay independent of the separately shipped * ChatCode bundle and receive account facts without credential values. */ export interface ChatCodeAuthHost { status(options?: { force?: boolean; }): Promise; startLogin(): Promise<{ sessionId: string; url: string; }>; waitForLogin(sessionId: string, signal?: AbortSignal): Promise<'pending' | 'succeeded' | 'failed' | 'timed-out' | 'cancelled'>; logout(): Promise; /** New ChatCode bundles expose this host-only launch fact without a value. */ environmentTokenActive?(): boolean; } interface ChatCodeLaunchFailure { ok: false; kind: 'disabled' | 'error'; host: string; disabledReason?: string; reason?: 'auth' | 'timeout' | 'network' | 'server' | 'invalid'; status?: number; } /** Host-owned launch decision; the TUI never reads the CVP credential. */ export interface ChatCodeStartupGateHost { check(): Promise<{ ok: true; host: string; } | ChatCodeLaunchFailure>; message(failure: ChatCodeLaunchFailure): string; } export interface ChatCodeStartupGateOptions { /** Open the one-time login URL in the user's browser. */ openUrl(url: string): void; /** Write pre-Ink progress to the terminal without exposing credentials. */ report(message: string): void; /** Test seam and bounded protection against a configured bundle that failed to mount. */ serviceWaitMs?: number; /** Test seam for service polling. */ servicePollMs?: number; /** Test seam for the pre-Ink retry/exit prompt shown during an outage. */ chooseVerificationUnavailable?: () => Promise<'retry' | 'exit'>; /** Test seam for the CVP launch failure prompt. */ chooseStartupGateFailure?: () => Promise<'retry' | 'exit'>; } export type ChatCodeStartupGateResult = 'ready' | 'exit' | 'blocked'; /** * Whether this launch is owned by the desktop OAuth grant. Prefer the auth * bundle's process-layer snapshot; the environment fallback keeps a mixed * installation fail-closed while old bundles are upgraded. */ export declare function chatCodeEnvironmentTokenActive(ctx: Context, env?: NodeJS.ProcessEnv): boolean; /** * The service is optional for upstream/bare dsh-tui compositions. When the * Loader tree explicitly includes our integration bundle, absence means a * startup race or failed mount and must not silently bypass login. */ export declare function chatCodeAuthExpected(ctx: Context): boolean; /** * Enforce ChatCode sign-in before Agent/session construction. A configured * integration can only return after remote validation succeeds; failures * leave no half-created session behind for Web or later TUI resumes. Each * signed-out launch starts and opens a fresh attempt, replacing any pending * attempt whose browser or owning process may already have closed. */ export declare function requireChatCodeStartupLogin(ctx: Context, options: ChatCodeStartupGateOptions): Promise; export {}; //# sourceMappingURL=chatcode-auth.d.ts.map