import type { SdapiBreakpoint, SdapiEvalResult, SdapiFault, SdapiObjectMembers, SdapiScriptThread, BreakpointInput } from './types.js';
/**
 * Error thrown when the SDAPI returns a fault response.
 */
export declare class SdapiError extends Error {
    readonly fault: SdapiFault;
    readonly status: number;
    constructor(fault: SdapiFault, status: number);
}
export interface SdapiClientConfig {
    hostname: string;
    username: string;
    password: string;
    clientId?: string;
}
/**
 * Creates a new SDAPI client.
 */
export declare function createSdapiClient(config: SdapiClientConfig): SdapiClient;
export declare class SdapiClient {
    private readonly baseUrl;
    private readonly headers;
    private readonly logger;
    /**
     * Cookies (name -> value) returned by the SDAPI via Set-Cookie, replayed on
     * subsequent requests. The debugger establishes a session (e.g. `dwsid`) on
     * the first request that must be honored for the lifetime of this client.
     *
     * Replaying these cookies is required for server affinity: in multi-app
     * server instances/environments the `dwsid` pins the session to the app
     * server that holds the debugger state, so without it subsequent requests may
     * be routed to a different app server with no knowledge of the session.
     */
    private readonly cookies;
    constructor(config: SdapiClientConfig);
    createClient(): Promise<void>;
    deleteClient(): Promise<void>;
    /**
     * Retrieves all currently set breakpoints for the debugger session.
     * @returns Promise resolving to array of breakpoints, or empty array if none are set.
     */
    getBreakpoints(): Promise<SdapiBreakpoint[]>;
    /**
     * Sets or replaces breakpoints for the debugger.
     * @param breakpoints Array of breakpoint definitions to set.
     * @returns Promise resolving to array of confirmed breakpoints from the server.
     */
    setBreakpoints(breakpoints: BreakpointInput[]): Promise<SdapiBreakpoint[]>;
    deleteBreakpoints(): Promise<void>;
    deleteBreakpoint(id: number): Promise<void>;
    /**
     * Gets all active script threads.
     * @returns Promise resolving to array of script threads, or empty array if none are active.
     */
    getThreads(): Promise<SdapiScriptThread[]>;
    /**
     * Retrieves a specific thread by ID.
     * @param threadId The thread identifier.
     * @returns Promise resolving to the thread object with its current state.
     */
    getThread(threadId: number): Promise<SdapiScriptThread>;
    resetThreads(): Promise<void>;
    resume(threadId: number): Promise<SdapiScriptThread>;
    stepOver(threadId: number): Promise<SdapiScriptThread>;
    stepInto(threadId: number): Promise<SdapiScriptThread>;
    stepOut(threadId: number): Promise<SdapiScriptThread>;
    stopThread(threadId: number): Promise<void>;
    getVariables(threadId: number, frameIndex: number): Promise<SdapiObjectMembers>;
    getMembers(threadId: number, frameIndex: number, objectPath?: string, start?: number, count?: number): Promise<SdapiObjectMembers>;
    /**
     * Evaluates a JavaScript expression in a frame context.
     * @param threadId The thread ID of the halted thread.
     * @param frameIndex The stack frame index (0 = topmost frame).
     * @param expr The JavaScript expression to evaluate.
     * @returns Promise resolving to the evaluation result.
     */
    evaluate(threadId: number, frameIndex: number, expr: string): Promise<SdapiEvalResult>;
    private request;
    private throwSdapiError;
    /**
     * Returns the value of a stored session cookie, or `undefined` if it has not
     * been set yet. The session cookie (`dwsid`) pins requests to the app server
     * holding the debugger session — callers may need it to route external
     * requests (e.g. a storefront browser) to the same app server.
     */
    getCookie(name: string): string | undefined;
    /**
     * Builds the `Cookie` request header from stored session cookies, or an empty
     * object if none have been set yet.
     */
    private cookieHeader;
    /**
     * Parses `Set-Cookie` headers from a response and stores them for replay on
     * subsequent requests (only the name=value pair is retained, attributes are
     * ignored). Uses `Headers.getSetCookie()` so multiple cookies are not
     * collapsed into a single comma-joined value.
     */
    private storeCookies;
}
