import type { AgentMessage } from "@gajae-code/agent-core"; import type { AssistantMessage, Message } from "@gajae-code/ai/core"; import { type Component, type TUI } from "@gajae-code/tui"; import { type ComposerSubmissionOptions, type InteractiveModeContext, type IrcArrivalSnapshot, type TranscriptRebuildPolicy } from "../../modes/types"; import { type SessionContext } from "../../session/session-manager"; import { type ParsedIrcMessage } from "./irc-message"; export type { TranscriptRebuildPolicy } from "../../modes/types"; export declare function prepareTranscriptRebuild(ui: TUI, policy: TranscriptRebuildPolicy): void; export declare const RESUME_PROGRESS_COMMIT_TIMEOUT_MS = 250; export interface ResumeProgressLease { readonly committed: Promise; clear(): void; } /** * Mount a resume loader on the live status rail and wait for its render generation * to commit before session I/O begins. The commit is advisory: a stopped or * unavailable terminal resolves false and callers continue without blocking. * * Fail open (no-op lease, committed=false) when the status rail or UI lacks the * child-mutation/render-commit surface required to mount progress. Headless and * minimal controller contexts keep resume/migration semantics; full interactive * TUI containers retain progress-before-switch. */ export declare function acquireResumeProgressLease(ctx: Pick): ResumeProgressLease; interface RenderInitialMessagesOptions { preserveExistingChat?: boolean; } export declare function argsWithPartialJson(args: unknown, partialJson: unknown): unknown; export declare class CollapsedChatHistoryComponent implements Component { readonly isCollapsedChatHistory = true; count: number; startTime: number; endTime: number; constructor(count: number, startTime: number, endTime: number); merge(count: number, startTime: number, endTime: number): void; render(_width: number): string[]; invalidate(): void; } export declare function addChatChild(ctx: InteractiveModeContext, component: Component): void; /** * Parked `!`/`$` execution components are listed in `pendingBashComponents` / * `pendingPythonComponents`, but `pendingMessagesContainer` is the only * authority on parentage: `/clear`, `/context-clear`, extension redraws and the * selector all call `pendingMessagesContainer.clear()`, which disposes and * evicts parked components without touching those arrays. Drop every entry the * container no longer holds so nothing downstream can move a dead component. */ export declare function syncPendingExecutionComponents(ctx: InteractiveModeContext): void; export declare function trimChatChildren(ctx: InteractiveModeContext): void; export declare class UiHelpers { #private; private ctx; constructor(ctx: InteractiveModeContext); assistantViewportAnchorId(message: AssistantMessage): string; getRenderedIrcInlineComponents(): Map; removeRenderedIrcInlineComponents(observationId: string): readonly Component[] | undefined; resetRenderedIrcInlineComponents(): readonly (readonly Component[])[]; addLiveIrcObservationToChat(message: ParsedIrcMessage, arrival: IrcArrivalSnapshot): Component[]; addRebuiltIrcObservationToChat(message: ParsedIrcMessage): Component[]; resetIrcSidebarHint(): void; /** Extract text content from a user message */ getUserMessageText(message: Message): string; /** * Show a status message in the chat. * * If multiple status messages are emitted back-to-back (without anything else being added to the chat), * we update the previous status line instead of appending new ones to avoid log spam. */ showStatus(message: string, options?: { dim?: boolean; }): void; addMessageToChat(message: AgentMessage, options?: { populateHistory?: boolean; }): Component[]; /** * Render session context to chat. Used for initial load and rebuild after compaction. * @param sessionContext Session context to render * @param options.updateFooter Update footer state * @param options.populateHistory Add user messages to editor history */ renderSessionContext(sessionContext: SessionContext, options?: { updateFooter?: boolean; populateHistory?: boolean; }): void; renderInitialMessages(prebuiltContext?: SessionContext, options?: RenderInitialMessagesOptions): void; clearEditor(): void; showError(errorMessage: string): void; showWarning(warningMessage: string): void; showNewVersionNotification(newVersion: string): void; updatePendingMessagesDisplay(): void; queueCompactionMessage(text: string, mode: "steer" | "followUp", options?: ComposerSubmissionOptions): void; isKnownSlashCommand(text: string): boolean; flushCompactionQueue(options?: { willRetry?: boolean; }): Promise; /** Move pending bash/python components from the pending area to chat */ flushPendingBashComponents(): void; findLastAssistantMessage(): AssistantMessage | undefined; extractAssistantText(message: AssistantMessage): string; }