type ExitFn = (code: number) => never; export interface ListingWorkerInfo { name: string; runtime?: string; cli?: string; model?: string; team?: string; pid?: number; last_activity_at?: string; context_budget_pct?: number | null; current_state?: 'working' | 'idle' | 'blocked_on_send'; } /** Real per-agent metrics as served by the broker `/api/metrics` endpoint. */ export interface ListingAgentMetrics { name: string; pid?: number; memory_bytes?: number; uptime_secs?: number; } export interface ListingClient { listAgents: () => Promise; /** * Optional: fetch real broker metrics (pid / memory / uptime) so `who` * can report machine-readable lifecycle data instead of fabricated * "ONLINE / just now" placeholders. */ getMetrics?: (agentName?: string) => Promise; shutdown: () => Promise; } export interface AgentManagementListingDependencies { getProjectRoot: () => string; getDataDir: () => string; createClient: (cwd: string) => ListingClient | Promise; fileExists: (filePath: string) => boolean; readFile: (filePath: string, encoding?: BufferEncoding) => string; readFileTail?: (filePath: string, maxBytes: number, encoding?: BufferEncoding) => { text: string; size: number; }; readFileBuffer?: (filePath: string) => Buffer; readFileTailBuffer?: (filePath: string, maxBytes: number) => { buffer: Buffer; size: number; }; readFileFrom?: (filePath: string, offset: number, maxBytes: number, encoding?: BufferEncoding) => { text: string; size: number; }; readFileFromBuffer?: (filePath: string, offset: number, maxBytes: number) => { buffer: Buffer; size: number; }; fetch: (url: string, init?: RequestInit) => Promise; nowIso: () => string; writeChunk: (chunk: string | Uint8Array) => void; log: (...args: unknown[]) => void; error: (...args: unknown[]) => void; exit: ExitFn; } export declare function runAgentsCommand(options: { all?: boolean; remote?: boolean; json?: boolean; }, deps: AgentManagementListingDependencies): Promise; export declare function runWhoCommand(options: { all?: boolean; json?: boolean; }, deps: AgentManagementListingDependencies): Promise; export declare class PtyLogCooker { private readonly rows; private readonly emitted; private readonly decoder; private pending; private row; private col; private previousEmitted; push(raw: string | Uint8Array): string[]; finish(): string[]; lines(): string[]; private decode; private replayCompleteText; private replay; private skipEscape; private readCsi; private skipOsc; private applyCsi; private currentRow; private writeChar; private clearLine; private clearScreen; private flushScreenRows; private emitRow; } /** * Convert a raw PTY/TTY log capture into greppable, line-oriented plain text by * replaying the small ANSI/VT subset used for redraws, then emitting rendered * rows with consecutive duplicates collapsed. */ export declare function toPlainLogLines(raw: string): string[]; export declare function runAgentsLogsCommand(name: string, options: { lines?: string; follow?: boolean; plain?: boolean; raw?: boolean; json?: boolean; }, deps: AgentManagementListingDependencies): Promise; export {}; //# sourceMappingURL=agent-management-listing.d.ts.map