import { ElementContext } from '@rivet/core';
import type { TokenResponse } from '../../types/token-types';
import type { TelemetryService } from '../TelemetryService';
import { AgentProgressEvent } from './AgentCore';
export type { AgentProgressEvent };
export type AgentStep = AgentProgressEvent['step'];
export type AgenticProgressEvent = {
    type: 'step' | 'complete' | 'error';
    step?: AgentStep;
    result?: AgenticResult;
    error?: string;
};
export type AgenticResult = {
    success: boolean;
    filesModified: string[];
    reasoning: string[];
    changes: string;
    sessionId?: string;
    model?: string;
    ttfmMs?: number;
    ttfwMs?: number;
    traceId?: string;
    agentRunId?: string;
    toolSummary?: {
        toolCallCounts: Record<string, number>;
        readTargets: string[];
        editTargets: string[];
        writeTargets: string[];
    };
};
/**
 * Classify raw agent errors into user-facing messages.
 * Spend-limit errors arrive already prefixed with SPEND_LIMIT_EXCEEDED from the
 * gateway auth layer and are passed through so the frontend can detect them.
 */
export declare const classifyAgentError: (rawMessage: string) => string;
/**
 * Service for agentic code modifications using Claude Agent SDK.
 * Agent autonomously searches for files, reads context, and makes modifications.
 * Uses AgentCore for shared infrastructure.
 */
export declare class AgentModService {
    private core;
    private projectPath;
    constructor(projectPath: string, gatewayUrl?: string);
    /**
     * Execute an agentic modification workflow.
     * The agent autonomously uses Grep/Glob/Read to find files and Edit to modify them.
     *
     * @effect Streams progress events via onProgress callback
     * @param instruction User's modification instruction
     * @param initialElements Selected elements from UI with candidate file paths
     * @param onProgress Callback for streaming progress updates
     * @param designTokens Optional design system tokens
     * @param images Optional reference images
     * @param sessionId Optional session ID to resume a prior agent conversation
     * @param model Optional model ID to use (defaults to claude-opus-4-7)
     */
    executeAgenticModification(instruction: string, initialElements: ElementContext[], onProgress: (event: AgenticProgressEvent) => void, designTokens?: TokenResponse, images?: string[], sessionId?: string, model?: string, correlation?: {
        traceId: string;
        agentRunId: string;
        posthogSessionId?: string;
    }, telemetry?: TelemetryService): Promise<AgenticResult>;
    /**
     * Generate system prompt for the given pass mode.
     * 'strict'   — no Task tool, no subagent restriction (used for the direct-edit pass)
     * 'fallback' — Task tool available for parallel multi-file work
     * 'subagent' — no Task, restricted to provided context only
     */
    private generateSystemPrompt;
    /**
     * Build the initial agent prompt with context
     */
    private buildAgentPrompt;
    /**
     * Save a base64 data URL image to a temp file for agent access
     *
     * @effect Writes image to OS temp directory
     * @returns Absolute path to the saved temp file
     */
    private saveReferenceImage;
    /**
     * Format a compact single-line summary of a token category.
     * E.g. `border-radius: lg=0.5rem, md=calc(0.5rem - 2px)`
     */
    private static formatTokenCategory;
    /**
     * Build lightweight initial context — file paths + tokens only.
     * The agent reads file content itself via the Read tool, so we don't
     * pre-include it. This minimises input tokens and latency.
     */
    private buildInitialContext;
    /**
     * Summarize changes for user display
     */
    private summarizeChanges;
}
//# sourceMappingURL=AgentModService.d.ts.map