import type { AgentRunner, AgentRunInput, AgentResult, AgentActivity, PlanUsage } from "./runner.js"; /** Minimal shape of Options accepted by the real query() — fields used by this runner. */ type QueryOptions = { model?: string; effort?: "low" | "medium" | "high" | "xhigh" | "max"; mcpServers?: Record; systemPrompt?: string | { type: "preset"; preset: "claude_code"; }; settingSources?: Array<"user" | "project" | "local">; skills?: string[] | "all"; plugins?: Array<{ type: "local"; path: string; }>; allowedTools?: string[]; cwd?: string; canUseTool?: (toolName: string, input: Record) => Promise<{ behavior: "allow"; updatedInput: Record; } | { behavior: "deny"; message: string; }>; }; type McpServerConfigLike = { command: string; args?: string[]; env?: Record; type?: "stdio"; } | { type: "http"; url: string; headers?: Record; } | { type: "sse"; url: string; headers?: Record; }; type QueryFn = (args: { prompt: string; options?: QueryOptions; }) => AsyncIterable; /** Minimal subset of SDKMessage shapes this runner cares about. */ type SdkBlock = { type: string; text?: string; thinking?: string; name?: string; input?: unknown; content?: unknown; }; type SdkUsage = { input_tokens?: number; output_tokens?: number; cache_read_input_tokens?: number; cache_creation_input_tokens?: number; }; type SdkMessageLike = { type: string; message?: { content?: SdkBlock[]; }; subtype?: string; result?: string; usage?: SdkUsage; total_cost_usd?: number; }; export declare class ClaudeAgentRunner implements AgentRunner { private model; private query; constructor(opts?: { model?: string; query?: QueryFn; }); run(input: AgentRunInput): Promise; /** * Best-effort claude.ai plan usage (5-hour + 7-day rate-limit windows + session cost), via the * SDK's experimental `usage_…` control method. Fully defensive: returns null on API-key sessions, * if the method is absent, or on any error/timeout — the dashboard degrades to cost/hr only. */ getPlanUsage(): Promise; /** * Run one query and return the agent's answer. For a tool-using (surface/full) agent the final * answer arrives in the `result` message; for a plain agent it's the concatenated assistant text. * Prefer the result when present, else fall back to the assistant text. Streams each step * (reasoning, tool/MCP calls, results) to `onActivity` so the dashboard can show what it's doing. */ private collect; } /** * Add a `reason` string field to an object decision schema so a decision agent explains its * choice. Free-form schemas (no `properties`) are left untouched. */ export declare function withReason(schema: Record): Record; /** * Surface a decision agent's rationale + choice on the activity feed — its `reason` as a * `thinking` step and the chosen command/fields as the answer — so the operator can see WHY a * router chose what it chose, mirroring how a capable agent's reasoning + answer appear. */ export declare function emitDecision(onActivity: ((a: AgentActivity) => void) | undefined, data: unknown): void; /** The allowed values of a `{ command: { enum: [...] } }` decision schema (a decision agent), if present. */ export declare function decisionEnum(schema: Record | undefined): string[] | undefined; /** * Best-effort parse of a decision agent's reply into its object. Tries JSON first; if that fails * and the schema is a command-enum, recovers the case where the agent answered with the bare * command word (e.g. "refine"). Returns undefined when nothing usable is found — the caller then * falls back rather than crashing. */ export declare function parseDecision(text: string, enumValues?: string[]): unknown; /** Pull a JSON object out of an agent reply (tolerates code fences / surrounding prose). */ export declare function extractJson(text: string): unknown; export {};