import { LaminaClient, type LaminaClientOptions, type StoredLaminaCredentials, type StoredWebhookConfig } from '@uselamina/sdk'; export type AuthSource = 'explicit' | 'env' | 'stored'; export interface ResolvedAuthContext { apiKey: string; baseUrl: string; source: AuthSource; storedCredentials: StoredLaminaCredentials | null; } /** * Strict resolver: returns the saved-default URL, or throws. * * Used by older callsites that explicitly asked for `--webhook default` * (or `local`). For dispatch commands prefer `resolveWebhookForDispatch`, * which implements the full implicit-default + override + opt-out matrix. */ export declare function resolveStoredWebhookUrl(override?: string | null): Promise<{ webhookUrl: string; config: StoredWebhookConfig | null; }>; export type WebhookResolution = { webhookUrl: string; source: 'explicit' | 'stored'; } | { webhookUrl: null; source: 'opt_out' | 'none'; }; /** * Mature webhook resolver for dispatch commands (`lamina run`). * * Precedence (most specific wins): * 1. `--no-webhook` → opt out for this call (returns null) * 2. `--webhook none` → same as --no-webhook * 3. `--webhook ` → use this URL exactly (overrides stored) * 4. `--webhook default|local` → use stored default; throw if not saved * 5. No flag, but stored default → use stored implicitly (transparent) * 6. No flag, no stored → no webhook (null), no error * * Rule (5) is the convenience: save once with `lamina webhook listen * --public-url --save-default`, then every `lamina run` auto-attaches * the webhook. Users override per-call with --webhook or opt out with * --no-webhook. The dispatch path surfaces which source resolved so the * CLI can tell the human "webhook (default): https://…". */ export declare function resolveWebhookForDispatch(opts: { explicit?: string | null; optOut?: boolean; }): Promise; export declare function resolveAuthContext(options?: { apiKey?: string; baseUrl?: string; env?: NodeJS.ProcessEnv; storedCredentials?: StoredLaminaCredentials | null; }): Promise; export declare function createClientFromAuthContext(options?: { apiKey?: string; baseUrl?: string; env?: NodeJS.ProcessEnv; storedCredentials?: StoredLaminaCredentials | null; fetch?: LaminaClientOptions['fetch']; }): Promise<{ client: LaminaClient; context: ResolvedAuthContext; }>;