import { type CompactionOutcome } from "@oh-my-pi/pi-agent-core/compaction"; import { type Model, type ProviderDetails, type UsageReport } from "@oh-my-pi/pi-ai"; import { type Component } from "@oh-my-pi/pi-tui"; import { getActiveProfile } from "@oh-my-pi/pi-utils/dirs"; import { classifyTerminalMultiplexer } from "@oh-my-pi/pi-tui/terminal-multiplexer"; import type { CompactOptions } from "../../extensibility/extensions/types.js"; import { type Theme } from "@oh-my-pi/pi-tui/theme"; import type { InteractiveModeContext } from "../../modes/types.js"; import type { TspText } from "@oh-my-pi/pi-wire"; import type { OAuthAccountIdentity } from "../../session/auth-storage.js"; import type { CompactMode } from "../../session/compact-modes.js"; import { type SessionWorktree } from "../../session/session-worktree.js"; import { type ShakeMode } from "../../session/shake-types.js"; import type { UnavailableUsageAccount } from "@oh-my-pi/pi-tui/overlays/usage-dashboard"; import { type TerminalLaunchRequest, type TerminalLaunchResult } from "../../subprocess/terminal-launch.js"; import { resolveCliEntryCmd } from "../../subprocess/worker-client.js"; interface ForkTerminalDependencies { classifyTerminalMultiplexer: typeof classifyTerminalMultiplexer; environment: () => NodeJS.ProcessEnv; launchTerminal: (request: TerminalLaunchRequest) => Promise; resolveCliEntryCmd: typeof resolveCliEntryCmd; getActiveProfile: typeof getActiveProfile; argv: () => string[]; } export declare class CommandController { #private; private readonly ctx; constructor(ctx: InteractiveModeContext, forkTerminalDependencies?: Partial); /** Esc: take away the report shown above the editor (text mode); false when none is shown. */ dismissCommandReport(): boolean; /** * Drop any report — the one above the editor, or a focused sheet/page — * because the transcript or session under it was reset, and its contents * describe what is gone. */ clearCommandReport(): void; /** * Show a read-only report, replacing the previous one. In text mode one that * fits the rows above the editor shows there like `/btw`: the editor keeps * focus and its Esc takes the report away. A taller one opens as a * full-screen page on the terminal's alternate screen, scrolled with the * arrow/page keys and the wheel, so the main screen is never touched and * Esc returns to it as it was. Natively it is a focused sheet like * `/usage`, its body scrolled by the terminal once it is long, closed by * Esc or Close. */ showCommandReport(options: { title: string; head?: TspText; body: Component; }): void; openInBrowser(urlOrPath: string): void; handleExportCommand(text: string): Promise; handleTraceCommand(): Promise; handleDumpCommand(): Promise; handleDumpAllCommand(): Promise; handleDumpAnonCommand(): Promise; handleAdvisorDumpCommand(isRaw?: boolean): void; handleDebugTranscriptCommand(): Promise; handleShareCommand(): Promise; handleSessionCommand(): Promise; handleAdvisorStatusCommand(): Promise; /** * `/jobs`: natively the live jobs sheet the jobs pill opens (inspect and * cancel included); `/jobs full`, and text mode, a report of the running * and recent jobs (see {@link showCommandReport}). Both list the viewed * session's jobs and its subagents' as a tree (see {@link buildJobTree}). */ handleJobsCommand(options?: { full?: boolean; }): Promise; handleUsageCommand(reports?: UsageReport[] | null): Promise; handleChangelogCommand(args?: string): Promise; handleHotkeysCommand(): void; handleToolsCommand(): void; handleContextCommand(): void; handleMemoryCommand(text: string): Promise; handleClearCommand(): Promise; handleFreshCommand(): Promise; handleResetContextCommand(): Promise; handleDeleteCommand(): Promise; handleForkCommand(placement?: "pane" | "window"): Promise; /** * `/move` — relocate the current session to a different directory. * * With no `targetPath` (TUI only), opens an autocomplete overlay so the user * can pick or type a directory. With a `targetPath`, resolves it directly. * If the target directory does not exist, the user is asked whether to create * it. The active session file and artifacts are moved into the target * directory's session bucket so `/resume` from that directory can find it. */ handleMoveCommand(targetPath?: string): Promise; /** * `/wt []` — fork the checkout into a new linked git worktree on * `branch` (default `wt/`), carrying uncommitted changes along * unless `keepChanges` is false, then relocate the session there like `/move`. * Returns the worktree only when the session now lives in it. */ handleWorktreeCommand(branch?: string, options?: { keepChanges?: boolean; }): Promise; handleRenameCommand(title: string): Promise; handleBashCommand(command: string, excludeFromContext?: boolean): Promise; handlePythonCommand(code: string, excludeFromContext?: boolean): Promise; handleCompactCommand(customInstructions?: string, mode?: CompactMode, beforeFlush?: (outcome: CompactionOutcome) => void | Promise, options?: Pick): Promise; /** * Run the `/compact` queued for the next yield once the session goes quiet. One watcher serves the * request from the moment it is queued, so no single event (an `agent_end` that a stale-settle guard * skips, a setup that bails without one) can strand it; later calls join the running watcher. * Follow-ups queued behind the request wait in `compactionQueuedMessages` and flush once it ends. */ runYieldCompaction(): Promise; /** * TUI handler for `/shake`. `elide` drops heavy structural content, * `images` strips image blocks, and `thinking` drops the thinking blocks the * request rebuilds from them, keeping the turns it replays natively (they * are reported as kept and the transcript is left alone). Rebuilds the chat * and reports counts. */ handleShakeCommand(mode: ShakeMode): Promise; executeCompaction(customInstructionsOrOptions?: string | CompactOptions, isAuto?: boolean, beforeFlush?: (outcome: CompactionOutcome) => void | Promise, mode?: CompactMode, readerModel?: Model): Promise; handleHandoffCommand(customInstructions?: string): Promise; } export declare function renderProviderSection(details: ProviderDetails, uiTheme: Pick): string; export declare function renderUsageReports(reports: UsageReport[], uiTheme: Theme, nowMs: number, availableWidth: number, resolveActiveAccount?: (provider: string) => OAuthAccountIdentity | undefined, usageModelSelectors?: readonly string[], unavailableAccounts?: readonly UnavailableUsageAccount[]): string; export {};