import { type OpenRouterAgentRunOptions, type SdkMcpServer, type SettingSource } from "@wolpertingerlabs/openrouter-agent-harness";
import type { EffortLevel } from "shared/types/index.js";
export type { EffortLevel };
/**
 * Sub-object on the options Record carrying OR-specific configuration. Set
 * by claude.ts when routing a call to the OR adapter.
 */
export interface OpenRouterOptionsExtras {
    apiKey: string;
    baseUrl?: string;
    model?: string;
    logsRoot?: string;
    appTitle?: string;
    /**
     * Reasoning-effort level for the OR `reasoning.effort` field. OR translates
     * this to each provider's native parameter (Anthropic
     * `thinking.budget_tokens`, OpenAI `reasoning_effort`, etc.). Per-chat
     * setting — populated from chat metadata at the claude.ts call site.
     * Omit (undefined) to skip the `reasoning` payload entirely.
     */
    effort?: EffortLevel;
    /**
     * Per-session USD spend cap. Omit to inherit the OR library's own default
     * ($1.00 at the time of writing — see DEFAULT_MAX_BUDGET_USD in
     * openrouter-agent-harness/src/agent.ts). The cap is cumulative across every
     * turn for the lifetime of the streaming-input run, not per-message.
     */
    maxBudgetUsd?: number;
}
/**
 * Library-side default for `maxBudgetUsd` when no override is supplied.
 * Mirrors `DEFAULT_MAX_BUDGET_USD` in openrouter-agent-harness/src/agent.ts so
 * the backend can advertise the effective cap on /system-info without having
 * to import the constant (which the OR package doesn't re-export). If the OR
 * library bumps its own default, update this value to match.
 */
export declare const OR_LIBRARY_DEFAULT_MAX_BUDGET_USD = 1;
/**
 * Loose typing of the Claude-SDK-shaped options blob — narrows the fields
 * the OR adapter actually reads. Unknown keys are tolerated and ignored.
 */
interface ClaudeShapedOptions {
    cwd?: string;
    maxTurns?: number;
    resume?: string;
    systemPrompt?: string | {
        type: "preset";
        preset?: string;
        append?: string;
    };
    allowedTools?: readonly string[];
    disallowedTools?: readonly string[];
    canUseTool?: OpenRouterAgentRunOptions["canUseTool"];
    abortController?: AbortController;
    persistSession?: boolean;
    settingSources?: readonly SettingSource[];
    onHook?: OpenRouterAgentRunOptions["onHook"];
    onAskUserQuestion?: OpenRouterAgentRunOptions["onAskUserQuestion"];
    /**
     * Shared mutable cell claude.ts also closes `buildCanUseTool` over. Not
     * consumed by translateOptions — OpenRouterAdapter threads it into the
     * plugin hook dispatcher so a PreToolUse `ask` decision can stash its
     * reason where the forwarded canUseTool will see it (and prompt the user
     * instead of auto-approving). Declared here so the claude.ts ↔ OR-adapter
     * options contract is visible in one place.
     */
    hookAskOverride?: {
        reason: string;
    };
    stderr?: (data: string) => void;
    /**
     * MCP servers, two distinct shapes under one record:
     *
     * - In-process bundles built via {@link OpenRouterAdapter.buildToolServer}
     *   — OR-shaped {@link SdkMcpServer}s whose `.tools` arrays we splice into
     *   `orOpts.tools` directly (no bridge round-trip needed).
     * - External server configs from `.mcp.json` / plugin manifests — Claude's
     *   stdio shape (`{ command, args?, env? }`) or http/sse shape
     *   (`{ type: "http" | "sse", url, headers? }`). These translate to the
     *   harness's `mcpServers` bridge configs (see {@link collectMcpTools}).
     */
    mcpServers?: Record<string, SdkMcpServer | ClaudeExternalMcpServer | {
        tools?: readonly unknown[];
    }>;
    /**
     * Subprocess environment the Claude path hands to the SDK CLI. The harness
     * runs in-process, so there is no subprocess to populate — this field is
     * accepted for shape compatibility and deliberately NOT forwarded (see the
     * secret-leak note in {@link translateOptions}).
     */
    env?: Record<string, string | undefined>;
    /**
     * Claude-SDK-shaped plugin descriptors built by claude.ts#buildPluginOptions
     * (`{ type: "local", path, name }`). The Claude path forwards these to the SDK
     * directly; the OR adapter reads only `.path` (the plugin's root directory) and
     * feeds it to the OR library's `loadPlugins({ pluginDirs })`. Resolution is
     * async, so it happens in OpenRouterAdapter's lazy run construction rather than
     * here. See {@link extractPluginDirs}.
     */
    plugins?: ReadonlyArray<{
        type?: string;
        path?: string;
        name?: string;
    }>;
    openRouter?: OpenRouterOptionsExtras;
}
/**
 * Pull the absolute plugin-root directories out of the Claude-shaped `plugins`
 * descriptor array. Entries without a usable `path` (or non-`local` types the OR
 * library can't resolve from a directory) are skipped. Exported for the OR
 * adapter's plugin-loading step and for unit tests.
 */
export declare function extractPluginDirs(options: Record<string, unknown>): string[];
export interface TranslateOptionsResult {
    orOpts: OpenRouterAgentRunOptions;
    /** The resolved cwd — needed by the message adapter for slash-command discovery. */
    cwd: string;
}
/**
 * Translate a Claude-SDK-shaped options Record and a prompt into a fully
 * formed {@link OpenRouterAgentRunOptions}. Throws when OR-specific config
 * (`openRouter.apiKey`) is missing — the OR adapter is unusable without it.
 */
export declare function translateOptions(options: Record<string, unknown>, prompt: string | AsyncIterable<unknown>): TranslateOptionsResult;
export type OrTool = NonNullable<OpenRouterAgentRunOptions["tools"]>[number];
/**
 * Claude-SDK-shaped EXTERNAL MCP server config, as claude.ts's
 * buildMcpServerOptions emits them: stdio servers are `{ command, args?,
 * env? }` (no `type` field — the SDK infers stdio from `command`), remote
 * servers are `{ type: "http" | "sse", url, headers? }`. Extra fields (e.g.
 * the `env` claude.ts attaches to remote entries for the CLI's `${VAR}`
 * resolution) are tolerated and ignored where the harness has no slot for
 * them.
 */
interface ClaudeExternalMcpServer {
    type?: string;
    command?: string;
    args?: readonly string[];
    env?: Record<string, string>;
    url?: string;
    headers?: Record<string, string>;
}
/**
 * Materialize OR's built-in client tool set (read_file, bash, …) bound
 * to the run's cwd / abort signal, with the host `ask_user_question` handler
 * forwarded.
 *
 * `allTools`' signature is `(ctx, opts)` — the handler MUST go in the second
 * arg; passing it inside the ctx object silently no-ops and the tool errors with
 * "no host handler registered".
 *
 * Why this exists as a standalone export: callboard always supplies a custom
 * `tools` array, and the OR library appends its `skill` built-in (and binds the
 * ask_user_question handler) ONLY when constructing its OWN default bundle —
 * which a custom `tools` array bypasses entirely (see agent.ts `hasCustomTools`).
 * So whenever callboard needs to add a tool the library would normally bundle
 * (the `skill` tool, here), it must first reconstruct this default set itself and
 * append to it, rather than relying on the library. Both the MCP-tools branch in
 * {@link translateOptions} and the skill-wiring path in OpenRouterAdapter call
 * through here so the base set is built identically in both places.
 */
export declare function buildDefaultOrTools(cwd: string, signal: AbortSignal | undefined, onAskUserQuestion: ClaudeShapedOptions["onAskUserQuestion"]): readonly OrTool[];
//# sourceMappingURL=optionsAdapter.d.ts.map