import type { AgentSession, AgentSessionEvent, AgentSessionRuntime, ExtensionCommandContextActions, ExtensionError } from "@earendil-works/pi-coding-agent"; import type { InputEditor } from "../../input-editor.js"; import type { AppOptions, Entry, PixExtensionUIContext, SessionActivity } from "../types.js"; export type AppSessionLifecycleHost = { options: AppOptions; prepareStartupRuntime?(): Promise<{ sessionPath?: string; } | null>; createRuntime(options?: { sessionPath?: string; }): Promise; entries: Entry[]; runtime(): AgentSessionRuntime | undefined; setRuntime(runtime: AgentSessionRuntime | undefined): void; isRunning(): boolean; setRunning(running: boolean): void; inputText(): string; setInput(value: string): void; inputEditor(): InputEditor; enableTerminal(): void; disposeRuntimeForQuit(runtime: AgentSessionRuntime): Promise; loadStartupConfig(): Promise; loadRequestHistory(): Promise; startSubagentsPolling(): void; closeSdkMenuForBind(): void; clearExtensionWidgets(scopeKey?: string, options?: { cancelCustomUi?: boolean; }): void; createExtensionUIContext(scopeKey?: string): PixExtensionUIContext; extensionShutdownHandler(): () => void; createExtensionCommandContextActions(runtime: AgentSessionRuntime): ExtensionCommandContextActions; handleExtensionError(error: ExtensionError): void; handleSessionEvent(event: AgentSessionEvent): void; bindAgentPause(session: AgentSession): void; contextInventoryText?(runtime: AgentSessionRuntime, heading: string): string; addEntry(entry: Entry): void; setStatus(status: string): void; showToast(message: string, kind: "success" | "error" | "warning" | "info"): void; setSessionStatus(session: AgentSession | undefined): void; setSessionActivity(activity: SessionActivity): void; sessionEventsReset(): void; resetSubagentsWidget(): void; resetTodoWidget(): void; conversationViewportClear(): void; queuedMessagesReset(): void; resetConversationMenuState(): void; clearMouseRenderState(): void; scrollReset(): void; loadSessionHistoryEntries(): void; loadSessionHistoryEntriesAsync(options: { isCancelled: () => boolean; render: () => void; lazyOlderHistory?: boolean; }): Promise; syncUserSessionEntryMetadata(): void; restoreTabsAfterStartup(): Promise; render(): void; }; export type BindCurrentSessionOptions = { awaitExtensions?: boolean; }; export declare class AppSessionLifecycleController { private readonly host; private unsubscribe; private ownershipRuntime; private ownershipSession; private ownershipGeneration; private subscriptionGeneration; private replacementHistoryGeneration; private extensionBindPromise; private extensionBindRuntime; private extensionBindSession; private extensionBindOwnershipGeneration; constructor(host: AppSessionLifecycleHost); start(): Promise; bindCurrentSession(options?: BindCurrentSessionOptions): Promise; awaitCurrentSessionExtensions(runtime?: AgentSessionRuntime | undefined): Promise; unsubscribeSession(): void; afterSessionReplacement(message?: string): void; private loadReplacementHistory; resetSessionView(): void; loadSessionHistory(): void; requireRuntime(): AgentSessionRuntime; private bindSessionExtensions; private collectAvailabilityIssues; private advanceOwnership; private isCurrentRuntimeSession; private extensionUiScope; }