/**
 * sdk-loop — Claude-native agent loop over `@anthropic-ai/sdk`.
 *
 * Parallel to minimal-loop (which runs over provider-router and supports
 * Anthropic + Groq + fallbacks). sdk-loop takes the Anthropic-direct path:
 * single provider, adaptive thinking, typed tool-use.
 *
 * Permissions are pinned at construction and enforced at tool-dispatch.
 * Tools declare a `capability` via the AgentToolCapabilityMarker; missing
 * markers default to `mcp` (safest).
 *
 * HITL gate: tools tagged `dangerous: true` route through an optional
 * ApprovalChannel before execution.
 *
 * @experimental — surface may move before 1.0.0.
 */
import type Anthropic from "@anthropic-ai/sdk";
import { type Tracer } from "@opentelemetry/api";
import type { ApprovalChannel } from "../hitl/approval-channel.js";
import { type SdkCapability, type SdkPermissions } from "../permissions/sdk-permissions.js";
import type { CapabilityGate } from "../permissions/capability-gate.js";
import type { RenewalManager } from "../permissions/renewal-manager.js";
import type { ToolRegistry } from "../tools/types.js";
export type SdkToolRegistry = ToolRegistry;
export interface AgentToolCapabilityMarker {
    /** Capability surface this tool requires. Defaults to "mcp". */
    capability?: SdkCapability;
    /** Required MCP sub-scopes (e.g. ["brain:write"]). Only honoured when capability === "mcp". */
    mcpScopes?: readonly string[];
    /** If true, HITL approval required before each call. */
    dangerous?: boolean;
}
export interface SdkAgentLoopConfig {
    /** Stable agent identifier (e.g. "tester"). */
    agentId: string;
    /** Semver or git-sha tag for provenance. */
    agentVersion: string;
    /** System prompt; kept stable across turns for prompt-cache reuse. */
    systemPrompt: string;
    /** Anthropic SDK client — injected so tests can stub. */
    client: Anthropic;
    /** Model id (default: claude-opus-4-7). */
    model?: string;
    /** Max tokens per response. Default 16_000. */
    maxTokens?: number;
    /** Per-worker permissions — pinned at boot from JWT scopes. */
    permissions: SdkPermissions;
    /** Tool registry, filtered at dispatch through `permissions`. */
    tools: SdkToolRegistry;
    /** Optional HITL channel. Dangerous tools deny-closed when absent. */
    approvalChannel?: ApprovalChannel;
    /** Hard step ceiling; loop aborts with stopReason:"budget_exhausted". */
    maxSteps?: number;
    /** HITL poll interval (ms). Default 500. */
    approvalPollIntervalMs?: number;
    /** HITL default timeout (ms). Default 60_000. */
    approvalTimeoutMs?: number;
    /** Inject a tracer for tests. Defaults to the OTel singleton. */
    tracer?: Tracer;
    /**
     * Optional Biscuit capability gate. When provided, every tool call is
     * checked BEFORE dispatch — additionally to the pinned `cc:*` scope
     * filter. The result is the INTERSECTION: a call must pass both the
     * static permission projection and the dynamic Biscuit verdict.
     */
    capabilityGate?: CapabilityGate;
    /** Hook fired when the gate denies. Best-effort. */
    onToolDenied?: (event: {
        toolName: string;
        reason: string;
        budgetUsed: number;
    }) => void;
    /** Per-call cost (USD); accumulates across the loop for the gate. */
    costPerToolCallUsd?: number;
    /**
     * Optional auto-renewal manager. Loop calls `maybeRenew()` once per
     * LLM iteration before dispatching tools.
     */
    renewalManager?: RenewalManager;
}
export interface SdkAgentLoopRunResult {
    finalMessage: string;
    stopReason: "complete" | "budget_exhausted" | "tool_denied" | "user_cancelled" | "max_tokens" | "error";
    usage: {
        inputTokens: number;
        outputTokens: number;
    };
    traceId: string;
}
declare class SdkAgentLoopImpl {
    private readonly config;
    constructor(config: SdkAgentLoopConfig);
    /** Expose the pinned permissions for introspection / logging. */
    get permissions(): SdkPermissions;
    run(userMessage: string): Promise<SdkAgentLoopRunResult>;
    private authoriseCall;
    private awaitApproval;
    private buildToolsParam;
}
export { SdkAgentLoopImpl as SdkAgentLoop };
//# sourceMappingURL=sdk-loop.d.ts.map