import type { LLMMessage } from '../core/llm/llm-provider.js'; import type { SessionStore } from '../core/session/session.js'; /** A single `sessions search` match: enough to locate and resume the session. */ export interface SessionSearchHit { key: string; messageCount: number; updatedAt: number; snippet: string; } /** * Normalize a session title for the `sessions list` TITLE column: trim, * collapse whitespace, and truncate with an ellipsis. Returns an empty * placeholder when no title was recorded (e.g. the session has no first * user message). Exported for unit testing. */ export declare function formatSessionTitle(title: string | undefined): string; /** * Render a session's messages as Markdown for `moss sessions export`. * User/assistant text is preserved verbatim; tool_use becomes a ```json block * (name + input); tool_result becomes a ``` block (truncated to keep the * export readable); thinking is folded into a
element. Exported * for unit testing. */ export declare function renderSessionMarkdown(sessionKey: string, messages: LLMMessage[]): string; /** * Scan all sessions in `store` (most recent first) for messages containing * `query` (case-insensitive substring). Returns one hit per matching session * (the first matching snippet), capped at SESSION_SEARCH_MAX_HITS. Exported * for unit testing. */ export declare function searchSessions(store: SessionStore, query: string): Promise; export declare enum CliPhase { None = "none", ConfigOnly = "configOnly", WorkspaceReady = "workspaceReady", AgentReady = "agentReady" } export interface CommandConfig { name: string; phase: CliPhase; handler: (ctx: CommandContext) => Promise; description?: string; } /** * Minimal context passed to a command handler. * Populated based on the command's declared CliPhase. */ export interface CommandContext { argv: string[]; commandArgs: string[]; configOverrides: any; fallbackStartDir?: string; loadedConfig?: unknown; resolvedConfig?: unknown; workspace?: string; workspaceStat?: unknown; workspacePathMigration?: unknown; agent?: unknown; sessionStore?: unknown; sessionKey?: string; liveRuntime?: unknown; [key: string]: unknown; } /** * Command routing table. * Maps command name to CommandConfig. * Replaces the big if-else tree in main(). */ export declare const COMMANDS: Record; /** * Returns the CliPhase needed to dispatch the given command. * Returns CliPhase.AgentReady if the command is not in the table * (means it's a chat/interactive command). */ export declare function getPhaseForCommand(commandName: string | undefined): CliPhase; /** * Returns the CommandConfig if the command is in the table. * Returns undefined if the command should fall through to AgentReady. */ export declare function getCommandConfig(commandName: string | undefined): CommandConfig | undefined; //# sourceMappingURL=command-dispatcher.d.ts.map