import { i as NodmixConfig } from "./types.nodmix-B9QJSty6.js";
import { b as hasConfiguredSecretInput, d as SecretInput, g as SecretRefSource, y as coerceSecretRef } from "./types.secrets-BKPYDrKY.js";
import { c as OAuthCredential, i as AuthProfileCredential, l as OAuthProvider, s as AuthProfileStore } from "./types-BfBqQzNE.js";
import { Fc as CODEX_CLI_PROFILE_ID, Nc as hasUsableOAuthCredential, Pc as CLAUDE_CLI_PROFILE_ID, Tt as ProviderAuthContext, Us as resolveEnvApiKey, fc as updateAuthProfileStoreWithLock, gc as removeProviderAuthProfilesWithLock, jc as DEFAULT_OAUTH_REFRESH_MARGIN_MS, jt as ProviderAuthResult, mc as suggestOAuthProfileIdForLegacyDefault, nc as ensureAuthProfileStoreForLocalUpdate, tc as ensureAuthProfileStore, vc as upsertAuthProfile, xc as listProfilesForProvider, yc as upsertAuthProfileWithLock } from "./types-CLo6hM78.js";
import { i as omitEnvKeysCaseInsensitive, r as listKnownProviderAuthEnvVarNames } from "./provider-env-vars-BapseKw5.js";
import { C as SecretInputMode } from "./types-9pLlV7aO.js";
import { t as resolveNodmixAgentDir } from "./agent-dir-compat-CkVEf4ES.js";
import { _ as resolveOAuthApiKeyMarker, h as resolveNonEnvSecretRefApiKeyMarker, l as isKnownEnvApiKeyMarker, r as MINIMAX_OAUTH_MARKER, t as CUSTOM_LOCAL_AUTH_MARKER, u as isNonSecretApiKeyMarker } from "./model-auth-markers-bp6V6Xxr.js";
import { a as upsertApiKeyProfile, i as buildApiKeyCredential, n as WriteOAuthCredentialsOptions, o as writeOAuthCredentials, r as applyAuthProfileConfig, t as ApiKeyStorageOptions } from "./provider-auth-helpers-DVSohY0M.js";
import { o as resolveRequiredHomeDir } from "./home-dir-BVRAYC3w.js";
import { a as normalizeSecretInputModeInput, c as promptSecretRefForSetup, i as normalizeApiKeyInput, n as ensureApiKeyFromOptionEnvOrPrompt, o as validateApiKeyInput, r as formatApiKeyPreview, s as resolveSecretInputModeForEnvSelection, t as ensureApiKeyFromEnvOrPrompt } from "./provider-auth-input-DwoTfvzZ.js";
import { t as createProviderApiKeyAuthMethod } from "./provider-api-key-auth-DFOCO7TB.js";
import { n as normalizeSecretInput, t as normalizeOptionalSecretInput } from "./normalize-secret-input-Bh-uX6uj.js";
import { buildOauthProviderAuthResult } from "./provider-auth-result.js";
import { execFileSync, execSync } from "node:child_process";

//#region src/agents/cli-credentials.d.ts
type ClaudeCliCredential = {
  type: "oauth";
  provider: "anthropic";
  access: string;
  refresh: string;
  expires: number;
} | {
  type: "token";
  provider: "anthropic";
  token: string;
  expires: number;
};
type CodexCliCredential = {
  type: "oauth";
  provider: OAuthProvider;
  access: string;
  refresh: string;
  expires: number;
  accountId?: string;
  idToken?: string;
};
type ExecSyncFn = typeof execSync;
/** @deprecated Anthropic provider-owned CLI credential helper; do not use from third-party plugins. */
declare function readClaudeCliCredentialsCached(options?: {
  allowKeychainPrompt?: boolean;
  ttlMs?: number;
  platform?: NodeJS.Platform;
  homeDir?: string;
  execSync?: ExecSyncFn;
}): ClaudeCliCredential | null;
declare function readCodexCliCredentialsCached(options?: {
  codexHome?: string;
  allowKeychainPrompt?: boolean;
  ttlMs?: number;
  platform?: NodeJS.Platform;
  execSync?: ExecSyncFn;
}): CodexCliCredential | null;
//#endregion
//#region src/agents/models-config.providers.secret-helpers.d.ts
declare function normalizeApiKeyConfig(value: string): string;
//#endregion
//#region src/plugins/provider-auth-token.d.ts
/** @deprecated Provider-owned setup helper; do not use from third-party plugins. */
declare function buildTokenProfileId(params: {
  provider: string;
  name: string;
}): string;
/** @deprecated Anthropic provider-owned setup helper; do not use from third-party plugins. */
declare function validateAnthropicSetupToken(raw: string): string | undefined;
//#endregion
//#region src/secrets/ref-contract.d.ts
type SecretRefDefaultsCarrier = {
  secrets?: {
    defaults?: {
      env?: string;
      file?: string;
      exec?: string;
    };
    providers?: Record<string, {
      source?: string;
    }>;
  };
};
declare function resolveDefaultSecretProviderAlias(config: SecretRefDefaultsCarrier, source: SecretRefSource, options?: {
  preferFirstProviderForSource?: boolean;
}): string;
//#endregion
//#region src/plugin-sdk/provider-openai-codex-auth.d.ts
type OpenAICodexAuthIdentity = {
  accountId?: string;
  chatgptPlanType?: string;
  email?: string;
  profileName?: string;
};
declare function decodeOpenAICodexJwtPayload(token: string): Record<string, unknown> | undefined;
declare function resolveOpenAICodexAuthIdentity(params: {
  access: string;
  accountId?: string;
}): OpenAICodexAuthIdentity;
declare function resolveOpenAICodexAccessTokenExpiry(access: string): number | undefined;
declare function buildOpenAICodexCredentialExtra(identity: OpenAICodexAuthIdentity & {
  idToken?: string;
}): Record<string, unknown> | undefined;
declare function resolveOpenAICodexImportProfileName(identity: Pick<OpenAICodexAuthIdentity, "accountId" | "profileName">, fallback: string): string;
//#endregion
//#region src/plugin-sdk/oauth-utils.d.ts
/**
 * Encode a flat object as application/x-www-form-urlencoded form data.
 *
 * @deprecated OAuth provider-owned helper; keep this local to provider plugins instead.
 */
declare function toFormUrlEncoded(data: Record<string, string>): string;
/**
 * Generate a PKCE verifier/challenge pair suitable for OAuth authorization flows.
 *
 * @deprecated OAuth provider-owned helper; keep this local to provider plugins instead.
 */
declare function generatePkceVerifierChallenge(): {
  verifier: string;
  challenge: string;
};
/** Generate a PKCE verifier/challenge pair with a 64-character hex verifier. */
declare function generateHexPkceVerifierChallenge(): {
  verifier: string;
  challenge: string;
};
//#endregion
//#region src/agents/copilot-dynamic-headers.d.ts
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
declare const COPILOT_EDITOR_VERSION = "vscode/1.107.0";
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
declare const COPILOT_USER_AGENT = "GitHubCopilotChat/0.35.0";
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
declare const COPILOT_EDITOR_PLUGIN_VERSION = "copilot-chat/0.35.0";
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
declare const COPILOT_GITHUB_API_VERSION = "2025-04-01";
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
declare const COPILOT_INTEGRATION_ID = "vscode-chat";
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
declare function buildCopilotIdeHeaders(params?: {
  includeApiVersion?: boolean;
}): Record<string, string>;
//#endregion
//#region src/plugin-sdk/provider-auth.d.ts
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
declare const DEFAULT_COPILOT_API_BASE_URL = "https://api.individual.githubcopilot.com";
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
type CachedCopilotToken = {
  token: string;
  expiresAt: number;
  updatedAt: number;
  integrationId?: string;
};
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
declare function deriveCopilotApiBaseUrlFromToken(token: string): string | null;
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
declare function resolveCopilotApiToken(params: {
  githubToken: string;
  env?: NodeJS.ProcessEnv;
  fetchImpl?: typeof fetch;
  cachePath?: string;
  loadJsonFileImpl?: (path: string) => unknown;
  saveJsonFileImpl?: (path: string, value: CachedCopilotToken) => void;
}): Promise<{
  token: string;
  expiresAt: number;
  source: string;
  baseUrl: string;
}>;
declare function isProviderApiKeyConfigured(params: {
  provider: string;
  agentDir?: string;
  profileTypes?: readonly AuthProfileCredential["type"][];
}): boolean;
declare function listUsableProviderAuthProfileIds(params: {
  provider: string;
  cfg?: NodmixConfig;
  agentDir?: string;
  allowKeychainPrompt?: boolean;
  includeExternalCliAuth?: boolean;
}): {
  agentDir: string;
  profileIds: string[];
};
declare function isProviderAuthProfileConfigured(params: {
  provider: string;
  cfg?: NodmixConfig;
  agentDir?: string;
  allowKeychainPrompt?: boolean;
  includeExternalCliAuth?: boolean;
}): boolean;
declare function resolveProviderAuthProfileApiKey(params: {
  provider: string;
  cfg?: NodmixConfig;
  agentDir?: string;
  allowKeychainPrompt?: boolean;
  includeExternalCliAuth?: boolean;
}): Promise<string | undefined>;
//#endregion
export { type ApiKeyStorageOptions, type AuthProfileStore, CLAUDE_CLI_PROFILE_ID, CODEX_CLI_PROFILE_ID, COPILOT_EDITOR_PLUGIN_VERSION, COPILOT_EDITOR_VERSION, COPILOT_GITHUB_API_VERSION, COPILOT_INTEGRATION_ID, COPILOT_USER_AGENT, CUSTOM_LOCAL_AUTH_MARKER, CachedCopilotToken, DEFAULT_COPILOT_API_BASE_URL, DEFAULT_OAUTH_REFRESH_MARGIN_MS, MINIMAX_OAUTH_MARKER, type NodmixConfig, type OAuthCredential, type OpenAICodexAuthIdentity, type ProviderAuthContext, type ProviderAuthResult, type SecretInput, type SecretInputMode, type WriteOAuthCredentialsOptions, applyAuthProfileConfig, buildApiKeyCredential, buildCopilotIdeHeaders, buildOauthProviderAuthResult, buildOpenAICodexCredentialExtra, buildTokenProfileId, coerceSecretRef, createProviderApiKeyAuthMethod, decodeOpenAICodexJwtPayload, deriveCopilotApiBaseUrlFromToken, ensureApiKeyFromEnvOrPrompt, ensureApiKeyFromOptionEnvOrPrompt, ensureAuthProfileStore, ensureAuthProfileStoreForLocalUpdate, formatApiKeyPreview, generateHexPkceVerifierChallenge, generatePkceVerifierChallenge, hasConfiguredSecretInput, hasUsableOAuthCredential, isKnownEnvApiKeyMarker, isNonSecretApiKeyMarker, isProviderApiKeyConfigured, isProviderAuthProfileConfigured, listKnownProviderAuthEnvVarNames, listProfilesForProvider, listUsableProviderAuthProfileIds, normalizeApiKeyConfig, normalizeApiKeyInput, normalizeOptionalSecretInput, normalizeSecretInput, normalizeSecretInputModeInput, omitEnvKeysCaseInsensitive, promptSecretRefForSetup, readClaudeCliCredentialsCached, readCodexCliCredentialsCached, removeProviderAuthProfilesWithLock, resolveCopilotApiToken, resolveDefaultSecretProviderAlias, resolveEnvApiKey, resolveNodmixAgentDir, resolveNonEnvSecretRefApiKeyMarker, resolveOAuthApiKeyMarker, resolveOpenAICodexAccessTokenExpiry, resolveOpenAICodexAuthIdentity, resolveOpenAICodexImportProfileName, resolveProviderAuthProfileApiKey, resolveRequiredHomeDir, resolveSecretInputModeForEnvSelection, suggestOAuthProfileIdForLegacyDefault, toFormUrlEncoded, updateAuthProfileStoreWithLock, upsertApiKeyProfile, upsertAuthProfile, upsertAuthProfileWithLock, validateAnthropicSetupToken, validateApiKeyInput, writeOAuthCredentials };