export { getOpencodeConfigPath, getOpencodeDir, getOpencodeGlobalConfigDir, getOpencodeGlobalConfigPath } from './paths.js'; export declare const OPENCODE_CONFIG_SCHEMA = "https://opencode.ai/config.json"; export interface OpencodeConfig { $schema?: string; mcp?: Record; [key: string]: unknown; } /** Read and parse an OpenCode configuration file as an OpencodeConfig object. */ export declare function readOpencodeConfig(configPath: string): Promise; /** Atomically write an OpenCode configuration object to disk after normalization. */ export declare function writeOpencodeConfig(configPath: string, config: OpencodeConfig): Promise; /** Normalize an OpenCode configuration ensuring $schema and a valid mcp record. */ export declare function normalizeOpencodeConfig(config: OpencodeConfig): OpencodeConfig & { $schema: string; mcp: Record; }; /** * Where agents writes OpenCode servers: the legacy `mcp.` map that every * OpenCode version reads, or the V2 `mcp.servers` map that OpenCode 1.x rejects. */ export type OpencodeLayout = 'legacy' | 'servers'; /** Managed server names, grouped by the map they live in. */ export type OpencodeEntryNames = Record; export interface OpencodeOwnership { layout: OpencodeLayout; managedNames: string[]; } /** Whether `mcp` holds a V2 server map, as opposed to a legacy server named "servers". */ export declare function hasOpencodeServersMap(mcp: Record): boolean; /** Whether OpenCode 2 would read a legacy server with this name as a setting. */ export declare function isReservedOpencodeName(name: string): boolean; /** Names of every server configured in `mcp`, in either shape. */ export declare function listOpencodeServerNames(mcp: Record): string[]; /** Which of the given names already exist in each map of `mcp`. */ export declare function locateOpencodeEntries(mcp: Record, names: string[]): OpencodeEntryNames; /** * Read which servers a previous sync wrote and where. A record from 0.9.3 and earlier * has no `layout`; those releases wrote only the legacy shape. * * @returns null when no record exists * @throws when the record cannot be read */ export declare function readOpencodeOwnership(statePath: string): Promise; export declare function writeOpencodeOwnership(statePath: string, ownership: OpencodeOwnership): Promise; export declare function ownedOpencodeEntries(ownership: OpencodeOwnership): OpencodeEntryNames; /** * Find managed entries when no ownership record exists, by matching the config * against a previous preview. Only identical entries count, so a server the user * edited by hand stays theirs. The preview is V2 since 0.9.4 and legacy before. */ export declare function adoptOpencodeEntries(mcp: Record, preview: Record): OpencodeEntryNames; /** Return a copy of `mcp` without the given entries. A V2 map emptied this way is removed. */ export declare function removeOpencodeEntries(mcp: Record, names: OpencodeEntryNames): Record;