import type { AgentTool } from "@earendil-works/pi-agent-core";
import { Type } from "typebox";
import type { ContextCompactionStats, ContextDeletionTarget } from "../session-manager.ts";
import type { ContextDeletionRequest, ValidatedContextDeletionResult } from "./context-compaction-types.ts";
export declare const CONTEXT_DELETE_TOOL_NAME = "context_delete";
export declare const CONTEXT_GREP_DELETE_TOOL_NAME = "context_grep_delete";
export declare const CONTEXT_SEARCH_TRANSCRIPT_TOOL_NAME = "context_search_transcript";
export declare const CONTEXT_READ_ENTRY_TOOL_NAME = "context_read_entry";
export declare const CONTEXT_COMPACTION_BUDGET_TOOL_NAME = "context_compaction_budget";
export declare const CONTEXT_GREP_DELETE_DEFAULT_MAX_MATCHES = 50;
export declare const CONTEXT_GREP_DELETE_MAX_REGEX_PATTERN_CHARS = 512;
export declare const CONTEXT_GREP_DELETE_MAX_REGEX_SCAN_CHARS = 250000;
export declare const CONTEXT_READ_ENTRY_DEFAULT_MAX_CHARS = 4000;
export declare const CONTEXT_READ_ENTRY_MAX_CHARS = 12000;
export declare const CONTEXT_SEARCH_DEFAULT_MAX_MATCHES = 20;
export declare const CONTEXT_SEARCH_MAX_MATCHES = 100;
export declare const CONTEXT_SEARCH_DEFAULT_CONTEXT_CHARS = 160;
export declare const CONTEXT_SEARCH_MAX_CONTEXT_CHARS = 500;
export declare const ContextDeleteToolParameters: Type.TObject<{
    deletions: Type.TArray<Type.TObject<{
        kind: Type.TUnsafe<"content_block" | "entry">;
        entryId: Type.TString;
        blockIndex: Type.TOptional<Type.TInteger>;
    }>>;
}>;
export declare const ContextGrepDeleteToolParameters: Type.TObject<{
    pattern: Type.TString;
    regex: Type.TOptional<Type.TBoolean>;
    caseSensitive: Type.TOptional<Type.TBoolean>;
    target: Type.TOptional<Type.TUnsafe<"content_block" | "entry">>;
    maxMatches: Type.TOptional<Type.TInteger>;
    expectedMatchCount: Type.TOptional<Type.TInteger>;
}>;
export declare const ContextSearchTranscriptToolParameters: Type.TObject<{
    pattern: Type.TString;
    regex: Type.TOptional<Type.TBoolean>;
    caseSensitive: Type.TOptional<Type.TBoolean>;
    target: Type.TOptional<Type.TUnsafe<"content_block" | "entry">>;
    maxMatches: Type.TOptional<Type.TInteger>;
    contextChars: Type.TOptional<Type.TInteger>;
}>;
export declare const ContextReadEntryToolParameters: Type.TObject<{
    entryId: Type.TString;
    blockIndex: Type.TOptional<Type.TInteger>;
    offset: Type.TOptional<Type.TInteger>;
    maxChars: Type.TOptional<Type.TInteger>;
}>;
export declare const ContextCompactionBudgetToolParameters: Type.TObject<{}>;
export declare const CONTEXT_DELETE_TOOL: {
    readonly name: "context_delete";
    readonly description: "Record context compaction deletion targets directly against the transcript.";
    readonly parameters: Type.TObject<{
        deletions: Type.TArray<Type.TObject<{
            kind: Type.TUnsafe<"content_block" | "entry">;
            entryId: Type.TString;
            blockIndex: Type.TOptional<Type.TInteger>;
        }>>;
    }>;
};
export declare const CONTEXT_GREP_DELETE_TOOL: {
    readonly name: "context_grep_delete";
    readonly description: "Bulk-delete transcript entries or content blocks matching a guarded grep/regex query.";
    readonly parameters: Type.TObject<{
        pattern: Type.TString;
        regex: Type.TOptional<Type.TBoolean>;
        caseSensitive: Type.TOptional<Type.TBoolean>;
        target: Type.TOptional<Type.TUnsafe<"content_block" | "entry">>;
        maxMatches: Type.TOptional<Type.TInteger>;
        expectedMatchCount: Type.TOptional<Type.TInteger>;
    }>;
};
export declare const CONTEXT_SEARCH_TRANSCRIPT_TOOL: {
    readonly name: "context_search_transcript";
    readonly description: "Search the full transcript working copy and return small snippets without mutating deletion state.";
    readonly parameters: Type.TObject<{
        pattern: Type.TString;
        regex: Type.TOptional<Type.TBoolean>;
        caseSensitive: Type.TOptional<Type.TBoolean>;
        target: Type.TOptional<Type.TUnsafe<"content_block" | "entry">>;
        maxMatches: Type.TOptional<Type.TInteger>;
        contextChars: Type.TOptional<Type.TInteger>;
    }>;
};
export declare const CONTEXT_READ_ENTRY_TOOL: {
    readonly name: "context_read_entry";
    readonly description: "Read a small slice of one transcript entry or content block from the full transcript working copy.";
    readonly parameters: Type.TObject<{
        entryId: Type.TString;
        blockIndex: Type.TOptional<Type.TInteger>;
        offset: Type.TOptional<Type.TInteger>;
        maxChars: Type.TOptional<Type.TInteger>;
    }>;
};
export declare const CONTEXT_COMPACTION_BUDGET_TOOL: {
    readonly name: "context_compaction_budget";
    readonly description: "Report current context-window fullness and reduction progress for the selected deletion targets without mutating deletion state.";
    readonly parameters: Type.TObject<{}>;
};
export interface ContextDeletionToolDetails {
    deletions: ContextDeletionRequest["deletions"];
    deletedTargets: ContextDeletionTarget[];
    stats: ContextCompactionStats;
    callCount: number;
    error?: string;
}
export interface ContextGrepDeletionMatch {
    entryId: string;
    target: "entry" | "content_block";
    blockIndex?: number;
    text: string;
}
export interface ContextGrepDeletionSkipped {
    entryId?: string;
    target?: "entry" | "content_block";
    blockIndex?: number;
    reason: "protected_entry" | "protected_block" | "assistant_thinking_entry" | "assistant_thinking_block" | "already_deleted" | "max_matches_exceeded" | "expected_match_count_mismatch";
    text?: string;
}
export interface ContextGrepDeletionToolDetails {
    pattern: string;
    regex: boolean;
    caseSensitive: boolean;
    target: "entry" | "content_block";
    matches: ContextGrepDeletionMatch[];
    skipped: ContextGrepDeletionSkipped[];
    deletedTargets: ContextDeletionTarget[];
    stats: ContextCompactionStats;
    callCount: number;
    error?: string;
}
export interface ContextTranscriptSearchMatch {
    entryId: string;
    target: "entry" | "content_block";
    blockIndex?: number;
    matchIndex: number;
    snippet: string;
    protected: boolean;
}
export interface ContextTranscriptSearchToolDetails {
    pattern: string;
    regex: boolean;
    caseSensitive: boolean;
    target: "entry" | "content_block";
    matches: ContextTranscriptSearchMatch[];
    truncated: boolean;
    callCount: number;
    error?: string;
}
export interface ContextReadEntryToolDetails {
    entryId: string;
    blockIndex?: number;
    offset: number;
    maxChars: number;
    totalChars: number;
    text: string;
    truncatedBefore: boolean;
    truncatedAfter: boolean;
    callCount: number;
    error?: string;
}
export interface ContextCompactionBudgetToolDetails {
    contextWindow?: number;
    compression_ratio: number;
    tokensBefore: number;
    currentTokensAfter: number;
    deletedTokens: number;
    currentReductionPercent: number;
    targetReductionPercent: number;
    targetTokensAfter: number;
    tokensToDeleteForTarget: number;
    contextWindowBeforePercent?: number;
    contextWindowAfterPercent?: number;
    /** Total estimated tokens consumed by image content blocks still remaining after selected deletions. */
    remainingImageTokens: number;
    /** Number of image content blocks still remaining after selected deletions. */
    imageBlockCount: number;
    /** Image tokens as a percentage of the remaining context (post-deletion token total). */
    imageTokenPercent: number;
    callCount: number;
}
export interface ContextDeletionToolController {
    tool: AgentTool<typeof ContextDeleteToolParameters, ContextDeletionToolDetails>;
    grepTool: AgentTool<typeof ContextGrepDeleteToolParameters, ContextGrepDeletionToolDetails>;
    searchTool: AgentTool<typeof ContextSearchTranscriptToolParameters, ContextTranscriptSearchToolDetails>;
    readEntryTool: AgentTool<typeof ContextReadEntryToolParameters, ContextReadEntryToolDetails>;
    budgetTool: AgentTool<typeof ContextCompactionBudgetToolParameters, ContextCompactionBudgetToolDetails>;
    tools: AgentTool[];
    getDeletionRequest(): ContextDeletionRequest;
    getValidatedResult(): ValidatedContextDeletionResult | undefined;
    getLastError(): string | undefined;
    getCallCount(): number;
}
//# sourceMappingURL=context-deletion-tool-definitions.d.ts.map