export type Config = {
    base_url?: string;
    access_token?: string;
    token_type?: string;
    expires_at?: string;
    connection_id?: string;
    /** Last auth mode chosen during `neotoma init`. */
    init_auth_mode?: "dev_local" | "oauth" | "key_derived";
    /** Neotoma project root; set by init so CLI can start servers from any cwd. */
    project_root?: string;
    /** Legacy alias for project_root kept for backward compatibility. */
    repo_root?: string;
    /** Additional ports to probe for running API instances. */
    extra_api_ports?: number[];
    /** Ports learned from prior successful sessions. */
    known_api_ports?: number[];
    /**
     * Sticky preferred environment for the CLI. Written when the user runs
     * `neotoma api start --env prod` or `--env dev`, or when a session starts
     * with an explicit `--env` flag. Read by `resolveLocalTransportEnv` in
     * `src/shared/local_transport.ts` so plain `neotoma store` and similar
     * commands route to the correct SQLite DB file even when no env var is set.
     */
    preferred_env?: "prod" | "dev";
};
export declare const DEFAULT_BASE_URL = "http://localhost:3080";
/** Ports probed for auto-detection when no --base-url or config.base_url is set. */
export declare const CANDIDATE_API_PORTS: number[];
export declare const CONFIG_DIR: string;
export declare const CONFIG_PATH: string;
export declare const USER_ENV_PATH: string;
/** True when NEOTOMA_ENV is "production". Used for API logs dir, PID path, and CLI log default. */
export declare const isProd: boolean;
/** Directory for API server logs when started with `neotoma api start --background`. Env-specific so dev and prod can run in background without overwriting each other. */
export declare const API_LOGS_DIR: string;
/** Log file for API server when started with `neotoma api start --background`. */
export declare const API_LOG_PATH: string;
/** PID file for background API server process. Env-specific so dev and prod can run in background without overwriting each other. */
export declare const API_PID_PATH: string;
/** JSON file storing PIDs and ports for dev+prod servers started with neotoma --background. Used by neotoma stop. */
export declare const BACKGROUND_SERVERS_PATH: string;
/** Default path for CLI stdout/stderr tee when no --log-file is given. Use --no-log-file to disable. */
export declare const CLI_LOG_PATH: string;
export declare function readConfig(): Promise<Config>;
export declare function writeConfig(next: Config): Promise<void>;
export declare function clearConfig(): Promise<void>;
export declare function isTokenExpired(config: Config): boolean;
export declare function baseUrlFromOption(option?: string, config?: Config): string;
/**
 * TCP probe for a listening port (same semantics as MCP signed shim scripts).
 * Used when `NEOTOMA_MCP_USE_LOCAL_PORT_FILE` is set so the CLI targets the
 * API port written under `.dev-serve/local_http_port_<dev|prod>` (see `readLocalHttpPortFromFile`).
 */
export declare function tcpProbePortListening(port: number): Promise<boolean>;
/**
 * Poll /health on a port until it returns ok or timeout. Use after spawning the API server
 * so the REPL only starts when the server is ready.
 */
export declare function waitForHealth(port: number, options?: {
    timeoutMs?: number;
    intervalMs?: number;
}): Promise<boolean>;
/**
 * After health is up, poll /me until it responds (200 or 401) or timeout.
 * Use so we only proceed when the API is actually serving requests, not just /health.
 */
export declare function waitForApiReady(port: number, options?: {
    timeoutMs?: number;
    intervalMs?: number;
}): Promise<boolean>;
export type ApiEnvHint = "dev" | "prod" | "unknown";
export type ApiInstance = {
    port: number;
    url: string;
    envHint: ApiEnvHint;
    source: "session" | "default" | "config" | "env";
    healthy: boolean;
    latencyMs: number;
};
export declare function discoverApiInstances(options?: {
    config?: Config;
    includeUnhealthy?: boolean;
}): Promise<ApiInstance[]>;
export declare function rememberKnownApiPort(port: number): Promise<void>;
/** Probes /health on each candidate port (3180 then 3080); returns ports that respond with ok. */
export declare function detectRunningApiPorts(): Promise<number[]>;
/**
 * Resolves API base URL: --base-url wins; otherwise prefers session server when set.
 * When a session port (NEOTOMA_SESSION_DEV_PORT or NEOTOMA_SESSION_PROD_PORT) is set,
 * uses it exclusively so commands in a session always target the session server.
 * When **`NEOTOMA_MCP_USE_LOCAL_PORT_FILE`** is `1`/`true`/`yes`, reads
 * `<projectRoot>/.dev-serve/local_http_port_<dev|prod>` (or legacy `local_http_port`),
 * matching **`NEOTOMA_MCP_LOCAL_HTTP_PORT_PROFILE`** / **`NEOTOMA_ENV`** (same rules as
 * the MCP signed shim), TCP-probes, and returns `http://localhost:<port>` when
 * listening — after session env and before `config.base_url` / auto-detect.
 * When no session port is set, a session/config preferred env probes the matching
 * default port first. If it is not listening, resolution falls back to multi-instance
 * discovery so commands do not pin themselves to a dead API.
 */
export declare function resolveBaseUrl(option?: string, _config?: Config): Promise<string>;
//# sourceMappingURL=config.d.ts.map