import type { AuthInteraction } from './login-flow.js'; export type PiCredential = { type: 'api_key'; key?: string; env?: Record; } | { type: 'oauth'; access: string; refresh: string; expires: number; [key: string]: unknown; }; export interface PiApiKeyAuth { login?: (interaction: AuthInteraction) => Promise>; } export interface PiOAuthAuth { login?: (interaction: AuthInteraction) => Promise>; } export interface PiProvider { readonly id: string; readonly name: string; readonly auth: { apiKey?: PiApiKeyAuth; oauth?: PiOAuthAuth; }; } export interface PiProviderAuthStatus { configured: boolean; source?: 'stored' | 'runtime' | 'environment' | 'fallback' | 'models_json_key' | 'models_json_command'; label?: string; } export interface PiModelRuntime { getProviders(): readonly PiProvider[]; getProviderAuthStatus(providerId: string): PiProviderAuthStatus; login(providerId: string, type: 'api_key' | 'oauth', interaction: AuthInteraction): Promise; logout(providerId: string): Promise; } interface PiRuntimeModule { ModelRuntime: { create(options: { authPath: string; allowModelNetwork: false; }): Promise; }; readStoredCredential(providerId: string, authPath?: string): PiCredential | undefined; } export type PiRuntimeLoadResult = { available: true; version: string | null; entry: string; error: null; runtime: PiModelRuntime; readStoredCredential: PiRuntimeModule['readStoredCredential']; } | { available: false; version: string | null; entry: string | null; error: string; runtime: null; readStoredCredential: null; }; export interface LoadPiRuntimeOptions { findPi?: () => string; authPath?: string; importModule?: (url: string) => Promise; } export declare function loadPiRuntime(options?: LoadPiRuntimeOptions): Promise; export {};