import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
import type { AgentMessage } from "@earendil-works/pi-agent-core";
import type { CodexDeveloperMessageDetails } from "../developer-messages.ts";
export declare const CODEX_CONTEXT_WINDOW_MESSAGE_TYPE = "codex-context-window";
export declare const CONTEXT_WINDOW_COMPACTION_SUMMARY = "[Pi Codex context-window boundary; no conversation summary was generated.]";
export declare const CONTEXT_WINDOW_COMPACTION_STRATEGY = "codex-context-window";
export declare const CONTEXT_WINDOW_REMINDER_THRESHOLD = 6144;
export declare const CONTEXT_WINDOW_FALLBACK_BUFFER = 16384;
export type ContextManagementMessageKind = "window" | "reminder" | "fallback";
export interface ContextWindowIdentity {
firstWindowId: string;
currentWindowId: string;
previousWindowId?: string | undefined;
windowNumber: number;
}
export interface CodexContextManagementMessageDetails extends CodexDeveloperMessageDetails {
contextManagement: {
protocol: 1;
kind: ContextManagementMessageKind;
firstWindowId: string;
currentWindowId: string;
previousWindowId?: string | undefined;
trimPreviousWindow?: true | undefined;
windowNumber: number;
};
}
export interface ContextWindowCompactionDetails {
protocol: 1;
strategy: typeof CONTEXT_WINDOW_COMPACTION_STRATEGY;
windowId?: string | undefined;
}
export declare function renderContextWindowMessage(identity: ContextWindowIdentity, threadHint?: string): string;
export declare function renderContextWindowReminder(remainingTokens: number): string;
export declare const CONTEXT_WINDOW_FALLBACK_MESSAGE = "\nContext exhausted. Do not continue or answer. Make exactly one notes write or append call that checkpoints the active request, state and known history IDs, then call new_context. Use no other tools before rollover.\n";
export declare function isCodexContextManagementMessageDetails(value: unknown): value is CodexContextManagementMessageDetails;
export declare function isContextWindowBoundary(message: AgentMessage): message is Extract & {
details: CodexContextManagementMessageDetails;
};
export declare function isContextWindowCompactionDetails(value: unknown): value is ContextWindowCompactionDetails;
export declare function sendContextWindowMessage(pi: ExtensionAPI, content: string, kind: ContextManagementMessageKind, identity: ContextWindowIdentity, options: {
triggerTurn: boolean;
}, trimPreviousWindow?: boolean): void;