import type { ApplyResult, BundledEntry, Catalog, DeleteMode, ListEnvelope, NotModified, RuleResponse, RuleSource } from './types.js';
export type FetchLike = (input: string | URL, init?: RequestInit) => Promise<Response>;
export interface RuntimeRuleClientOptions {
    /** OAP admin port URL, e.g. `http://oap:17128`. No trailing slash. */
    adminUrl: string;
    /** Optional fetch implementation. Defaults to the global `fetch`. */
    fetch?: FetchLike;
    /** Optional default headers (e.g. for a forward-RPC token). */
    headers?: Record<string, string>;
    /** Default per-call timeout in ms. `0` disables. */
    timeoutMs?: number;
}
export interface AddOrUpdateArgs {
    catalog: Catalog;
    name: string;
    /** Raw YAML. */
    body: string;
    /** Default false. Required when the edit moves storage identity. */
    allowStorageChange?: boolean;
    /** Default false. Re-runs apply on byte-identical content; subsumes
     *  the prior `/fix` route. */
    force?: boolean;
}
export interface GetRuleArgs {
    catalog: Catalog;
    name: string;
    /** Default `runtime` — DAO row first, static fallback. `bundled`
     *  bypasses the DAO and returns only the static twin. */
    source?: RuleSource;
    /** Conditional fetch — if the server's ETag matches, the client
     *  returns a {@link NotModified} sentinel and saves the body. */
    ifNoneMatch?: string;
}
/**
 * Typed wrapper for the eight runtime-rule REST endpoints v1 binds to.
 *
 * Each method speaks the canonical route — the `/runtime/mal/otel/...`,
 * `/runtime/mal/log/...`, `/runtime/lal/...` shortcut variants are
 * sugar for scripted ops and aren't surfaced here.
 */
export declare class RuntimeRuleClient {
    private readonly fetchImpl;
    private readonly base;
    private readonly defaultHeaders;
    private readonly timeoutMs;
    constructor(options: RuntimeRuleClientOptions);
    /** `GET /runtime/rule/list[?catalog=]` */
    list(catalog?: Catalog): Promise<ListEnvelope>;
    /** `GET /runtime/rule/bundled?catalog=[&withContent=]` */
    listBundled(catalog: Catalog, withContent?: boolean): Promise<BundledEntry[]>;
    /** `GET /runtime/rule?catalog=&name=[&source=]`. Returns {@link
     *  NotModified} when the server replies 304 to a conditional fetch. */
    get(args: GetRuleArgs): Promise<RuleResponse | NotModified>;
    /** `POST /runtime/rule/addOrUpdate?catalog=&name=[&allowStorageChange=][&force=]` */
    addOrUpdate(args: AddOrUpdateArgs): Promise<ApplyResult>;
    /** `POST /runtime/rule/inactivate?catalog=&name=` (Design A — see
     *  `reference_runtime_rule_api.md`). */
    inactivate(catalog: Catalog, name: string): Promise<ApplyResult>;
    /** `POST /runtime/rule/delete?catalog=&name=[&mode=revertToBundled]`.
     *  The two-step gate is server-side: a 409 `requires_inactivate_first`
     *  is surfaced via {@link RuntimeRuleApiError}. */
    delete(catalog: Catalog, name: string, mode?: DeleteMode): Promise<ApplyResult>;
    /** `GET /runtime/rule/dump` or `/dump/{catalog}` — streams `tar.gz`. */
    dump(catalog?: Catalog): Promise<Response>;
    private url;
    private send;
    /** Handle the apply-result-or-error response shape that addOrUpdate /
     *  inactivate / delete share. 2xx returns the parsed JSON; everything
     *  else throws a {@link RuntimeRuleApiError} with the parsed body so
     *  callers can switch on `applyStatus` (e.g. the 409
     *  `storage_change_requires_explicit_approval` path). */
    private expectApplyResult;
    private toError;
}
//# sourceMappingURL=runtime-rule.d.ts.map