import { type SpawnSyncOptions, type SpawnSyncReturns } from 'child_process'; import type { NativeImportReport } from './fallback.js'; export type { NativeImportReport, NativeImportResult, NativeImportStatus } from './fallback.js'; export declare const SECRETS_ITEM_PREFIX = "agents-cli.secrets."; export declare class KeychainHelperTimeoutError extends Error { readonly bin: string; readonly args: string[]; constructor(bin: string, args: string[]); } export declare function spawnKeychainHelperForTest(bin: string, args: string[], opts: SpawnSyncOptions, timeoutMs: number): SpawnSyncReturns; export type SecretProvider = 'keychain' | 'env' | 'file' | 'exec'; export interface SecretRef { provider: SecretProvider; value: string; } export type BundleValue = string | { value: string; }; export declare function parseBundleValue(raw: BundleValue): { literal: string; } | { ref: SecretRef; }; export declare function serializeRef(ref: SecretRef): string; export declare function assertValueStorable(value: string, platform?: NodeJS.Platform): void; export declare function profileKeychainItem(provider: string): string; export declare function secretsKeychainItem(bundle: string, key: string): string; export interface KeychainBackend { has(item: string): boolean; get(item: string): string; set(item: string, value: string, opts?: { noAcl?: boolean; }): void; delete(item: string): boolean; list(prefix: string): string[]; } export declare function setKeychainBackendForTest(b: KeychainBackend | null): KeychainBackend | null; export declare function isKeychainBackendOverridden(): boolean; export declare const HMAC_KEY_ITEM = "agents-cli.hmackey"; export declare function isOpaqueHashedServiceName(service: string): boolean; export declare function isSilentServiceName(service: string): boolean; interface HmacKeyRecord { v: number; k: string; migrated: boolean; pendingDeletes?: string[]; healedNoAcl?: boolean; } export declare function setKeychainServiceHashingForTest(key: Buffer | null): void; export declare function withRawKeychainServiceNames(fn: () => T): T; export declare function hashedServiceName(item: string, key: Buffer): string; export declare function readHmacKeyRecord(): HmacKeyRecord | null; export declare function healHmacKeyNoAclOnce(rec: HmacKeyRecord): boolean; export declare function keychainServiceAlias(item: string): string; export declare function maybeAutoRekey(): void; export interface RekeyPlanItem { oldService: string; newService: string; noAcl: boolean; payload?: string; } export declare function computeRekeyPlan(services: string[], values: Map, key: Buffer): { items: RekeyPlanItem[]; unreadable: string[]; }; export interface RekeyReport { migrated: string[]; failed: Array<{ item: string; detail: string; }>; activated: boolean; nothingToDo: boolean; } export declare function rekeyServiceNames(opts?: { prefixes?: string[]; announce?: boolean; log?: (line: string) => void; }): RekeyReport; export declare function rekeyStatus(): { migrated: boolean; hasKey: boolean; pendingDeletes: number; cleartext: string[]; enumerationOk: boolean; }; export declare function hasKeychainToken(item: string): boolean; export interface KeychainReadContext { agent?: string; bundle?: string | string[]; sessionId?: string; reason?: string; duration?: string; defaultPolicy?: 'hold' | 'always' | 'never'; forceDuration?: boolean; silentNoAcl?: boolean; interactiveUnlock?: boolean; } export declare function setKeychainHeadlessDetectorForTest(detector: (() => boolean) | null): void; export declare function keychainOperationPrompt(context?: KeychainReadContext): string; export declare function getKeychainToken(item: string, context?: KeychainReadContext): string; export declare const REVEAL_GATE_ITEM = "agents-cli.reveal-gate"; export declare function confirmRevealPresence(context: KeychainReadContext, platform?: NodeJS.Platform): void; export declare function getKeychainTokens(items: string[], context?: KeychainReadContext): Map; export declare function buildAddGenericPasswordArgs(account: string, item: string): string[]; export declare function buildAddGenericPasswordSpawnOptions(value: string): SpawnSyncOptions & { input: string; detached: boolean; }; export declare function setKeychainToken(item: string, value: string, opts?: { noAcl?: boolean; }): void; export declare function deleteKeychainToken(item: string): boolean; export declare function keychainUsesFileFallback(): boolean; export declare function listKeychainItems(prefix: string): string[]; export declare function listLegacyKeychainItems(prefix: string): string[]; export interface SyncedKeychainBackend { list(prefix: string): string[]; getBatch(items: string[]): Map; delete(item: string): boolean; } export declare function setSyncedKeychainBackendForTest(b: SyncedKeychainBackend | null): SyncedKeychainBackend | null; export declare function listSyncedKeychainItems(prefix: string): string[]; export declare function getSyncedKeychainTokens(items: string[]): Map; export declare function deleteSyncedKeychainItem(item: string): boolean; export declare function migrateKeychainItem(item: string): boolean; export declare function listOrphanedKeychainItems(prefix: string): string[]; export interface OrphanMigrationResult { item: string; status: 'ok' | 'warn' | 'fail'; detail?: string; } export declare function parseOrphanMigrationOutput(stdout: string): OrphanMigrationResult[]; export declare function migrateOrphanedKeychainItems(prefix: string): OrphanMigrationResult[]; export declare function importNativeItems(prefix: string, commit: boolean): NativeImportReport; export interface ResolveOptions { keychainItemFor?: (shortId: string) => string; allowExec?: boolean; envAllowlist?: string[]; } export declare function resolveRef(ref: SecretRef, opts?: ResolveOptions): string;