/** * Yeaft CLI process driver for AgentLink. * * MVP integration: * - Each conversation owns one `yeaft --input-format stream-json --output-format stream-json` process * - User turns are written to stdin as JSONL prompt messages * - Yeaft session ids are generated with the required `session_...` shape * - JSONL stdout is translated into backend_event messages * - Session history is read best-effort from ~/.yeaft/sessions and /.yeaft/sessions */ import { type ChildProcess } from 'child_process'; import type { SendFn } from './claude.js'; import type { GlobalSessionInfo, SessionInfo } from './history.js'; import type { HistoryMessage } from './history-message-transform.js'; import { yeaftCapabilities, type UsageInfo } from './backends/types.js'; export interface YeaftConversationState { conversationId: string; child: ChildProcess | null; abortController: AbortController | null; yeaftSessionId: string | null; lastYeaftSessionId: string | null; workDir: string; turnActive: boolean; providerId: string; model: string | null; effort: string | null; vps: string[]; defaultVpId: string | null; turnId: string | null; stateVersion: number; heartbeatTimer: ReturnType | null; sessionNotified: boolean; startedToolIds: Set; pendingToolInputs: Map; lastUsage: UsageInfo | null; stderrBuf: string; } export interface YeaftRunOptions { model?: string; effort?: string; vps?: string[]; vp?: { id?: string; }; } interface YeaftChatFile { name: string; mimeType: string; data: string; } interface YeaftSessionPage { sessions: SessionInfo[]; hasMore: boolean; nextCursor?: string; } interface YeaftGlobalSessionPage { sessions: GlobalSessionInfo[]; hasMore: boolean; nextCursor?: string; indexState: 'ready'; } export declare function addYeaftSendFn(fn: SendFn): () => void; export declare function _resetResolvedYeaftPathForTests(): void; export declare function getYeaftConversation(conversationId: string): YeaftConversationState | undefined; export declare function getYeaftConversations(): Map; export declare function rebindYeaftConversation(yeaftSessionId: string, newConvId: string): boolean; export declare function createYeaftPlaceholder(conversationId: string, opts?: { providerId?: string; }): void; export declare function restartYeaftConversation(conversationId: string, opts?: { providerId?: string; model?: string; effort?: string; vps?: string[]; }): { wasTurnActive: boolean; yeaftSessionId: string | null; }; export interface YeaftChatOptions { resumeSessionId?: string; providerId?: string; yeaftOptions?: YeaftRunOptions; } export declare function handleYeaftChat(conversationId: string, text: string, workDir: string, options?: YeaftChatOptions, files?: YeaftChatFile[]): void; export declare function handleYeaftUserAnswer(requestId: string, answers: Record, opts?: { conversationId?: string; }): void; export declare function cancelYeaftExecution(conversationId: string): void; export declare function cleanupAllYeaftConversations(): void; export declare function evictByYeaftSessionId(yeaftSessionId: string): boolean; export declare function listYeaftSessions(workDir: string): SessionInfo[]; export declare function listYeaftSessionsPage(workDir: string, options?: { limit?: number; cursor?: string; }): YeaftSessionPage; export declare function listAllYeaftSessionsPage(options?: { limit?: number; cursor?: string; }): YeaftGlobalSessionPage; export declare function listAllYeaftSessions(): GlobalSessionInfo[]; export declare function readYeaftSessionMessages(workDir: string, sessionId: string): HistoryMessage[]; export declare function renameYeaftSession(workDir: string, sessionId: string, newTitle: string): boolean; export declare function deleteYeaftSession(workDir: string, sessionId: string): boolean; export declare function moveYeaftSession(fromWorkDir: string, toWorkDir: string, sessionId: string): boolean; export { yeaftCapabilities };