/**
 * Session-scoped artifact store for token-efficient skill result references.
 * Instead of returning full displayResults to Claude (~3000 tokens/skill),
 * stores them as artifacts and returns compact references (~440 tokens).
 *
 * The full data still flows to the frontend via DataEnvelope — artifacts
 * only compress what Claude sees in its context window.
 *
 * Supports 3 detail levels via fetch_artifact:
 * - summary: row count + column names + first row sample + diagnostics count
 * - rows: paginated rows (offset/limit) with totalRows + hasMore metadata
 * - full: complete original data structure
 */
import type { IdentityResolutionV1 } from '../types/identityContract';
export interface StoredArtifact {
    id: string;
    skillId: string;
    stepId?: string;
    layer?: string;
    title?: string;
    data: any;
    diagnostics?: any;
    storedAt: number;
    lastAccessedAt: number;
    /** Analysis plan phase that originally produced this artifact. */
    planPhaseId?: string;
    planPhaseTitle?: string;
    planPhaseGoal?: string;
    sourceToolCallId?: string;
    paramsHash?: string;
    /** Process/thread identity sidecar produced with this artifact's source Skill. */
    identityResolution?: IdentityResolutionV1;
    /** In comparison mode, which trace this artifact came from (provenance tracking) */
    sourceTrace?: import('./types').TraceSource;
}
export interface ArtifactSummary {
    id: string;
    skillId: string;
    stepId?: string;
    layer?: string;
    title?: string;
    rowCount: number;
    columns: string[];
    sampleRow?: any[];
    diagnosticCount: number;
    planPhaseId?: string;
    planPhaseTitle?: string;
    planPhaseGoal?: string;
    sourceToolCallId?: string;
    identityResolution?: IdentityResolutionV1;
}
/**
 * Compact artifact summary optimized for Claude's context window.
 * Removes redundant fields (skillId already in parent, layer unused for fetch decisions)
 * and merges columns+sampleRow into a self-describing preview object.
 */
export interface CompactArtifactSummary {
    id: string;
    stepId?: string;
    title?: string;
    rowCount: number;
    /** First row as {column: value} object — self-describing, no separate columns array needed. */
    preview?: Record<string, any>;
    /** Only present when diagnostics exist (> 0). */
    diagnosticCount?: number;
    /** Origin phase for explaining why this artifact/table exists. */
    planPhaseId?: string;
    planPhaseTitle?: string;
}
export declare class ArtifactStore {
    private artifacts;
    private counter;
    /** Maximum number of artifacts before LRU eviction. */
    private readonly maxArtifacts;
    constructor(maxArtifacts?: number);
    /**
     * Store a skill result artifact and return its reference ID.
     * Evicts least-recently-accessed artifacts when exceeding capacity.
     */
    store(entry: {
        skillId: string;
        stepId?: string;
        layer?: string;
        title?: string;
        data: any;
        diagnostics?: any;
        planPhaseId?: string;
        planPhaseTitle?: string;
        planPhaseGoal?: string;
        sourceToolCallId?: string;
        paramsHash?: string;
        identityResolution?: IdentityResolutionV1;
    }): string;
    /**
     * Get a stored artifact by ID. Updates access time for LRU tracking.
     */
    get(id: string): StoredArtifact | undefined;
    /**
     * Generate a compact summary for an artifact (for Claude's context).
     */
    generateSummary(id: string): ArtifactSummary | undefined;
    /**
     * Generate a compact summary optimized for Claude's context window.
     * Delegates to generateSummary(), then reshapes:
     * - skillId/layer: omitted (already in parent invoke_skill result)
     * - diagnosticCount: only included when > 0
     * - columns + sampleRow → preview: { column: value } (self-describing)
     */
    generateCompactSummary(id: string): CompactArtifactSummary | undefined;
    /**
     * Fetch artifact data at the requested detail level.
     * For 'rows' detail, supports pagination via offset/limit to prevent token overflow.
     * Returns totalRows and hasMore so the caller knows whether to fetch more.
     */
    fetch(id: string, detail: 'summary' | 'rows' | 'full', offset?: number, limit?: number): any | undefined;
    /** Default page size for 'rows' fetch — balances completeness vs token budget. */
    static readonly DEFAULT_PAGE_SIZE = 50;
    /** Hard cap for 'full' fetch — prevents context overflow on large artifacts. */
    static readonly MAX_FULL_ROWS = 500;
    /** Get total artifact count. */
    get size(): number;
    /**
     * Serialize all artifacts for snapshot persistence.
     * Returns a shallow copy of all stored artifacts.
     */
    serialize(): StoredArtifact[];
    /**
     * Restore an ArtifactStore from a persisted snapshot.
     * Reconstructs the internal counter from the highest artifact ID
     * so new artifacts get IDs that don't collide with restored ones.
     */
    static fromSnapshot(artifacts: StoredArtifact[]): ArtifactStore;
    /** Clear all artifacts (e.g., on session reset). */
    clear(): void;
}
//# sourceMappingURL=artifactStore.d.ts.map