mcp-subagents
Version:
Multi-Agent AI Orchestration via Model Context Protocol - Access specialized CLI AI agents (Aider, Qwen, Gemini, Goose, etc.) with intelligent fallback and configuration
107 lines • 2.67 kB
TypeScript
/**
* Chunked Output Manager
*
* Manages task output in chunks for memory efficiency.
* Instead of storing every line individually, output is stored in chunks
* with a circular buffer to prevent unbounded memory growth.
*/
export interface OutputChunk {
id: number;
timestamp: number;
lines: string[];
startLineNumber: number;
endLineNumber: number;
}
export interface OutputOptions {
offset?: number;
limit?: number;
fromEnd?: boolean;
maxChars?: number;
search?: string;
context?: number;
outputMode?: 'content' | 'matches_only' | 'count';
ignoreCase?: boolean;
matchNumbers?: boolean;
}
export interface StreamingOptions {
lastSeenLine?: number;
waitForNew?: boolean;
maxWaitTime?: number;
includeLineNumbers?: boolean;
}
export declare class ChunkedOutput {
private chunks;
private nextChunkId;
private totalLines;
private maxChunks;
private chunkSize;
private currentChunk;
private lastUpdateTime;
private newLineCallbacks;
constructor(options?: {
maxChunks?: number;
chunkSize?: number;
});
/**
* Add new output lines
*/
addLines(lines: string[]): void;
/**
* Get output lines with pagination and search
*/
getLines(options?: OutputOptions): {
lines: string[];
totalLines: number;
hasMore: boolean;
searchMatches?: number;
};
/**
* Get total number of output lines
*/
getTotalLines(): number;
/**
* Get memory usage statistics
*/
getStats(): {
totalLines: number;
totalChunks: number;
memoryEstimate: string;
oldestChunk?: number;
newestChunk?: number;
};
/**
* Get lines with streaming support - can wait for new output
*/
getLinesStreaming(options?: OutputOptions & StreamingOptions): Promise<{
lines: Array<{
lineNumber: number;
content: string;
timestamp?: number;
}>;
totalLines: number;
hasMore: boolean;
lastSeenLine: number;
newLinesCount: number;
}>;
/**
* Get the last update timestamp
*/
getLastUpdateTime(): number;
/**
* Create a new chunk and manage circular buffer
*/
private createNewChunk;
/**
* Convert all chunks to flat array of lines
*/
private getAllLines;
/**
* Search through lines with context and formatting options
*/
private searchLines;
/**
* Format bytes as human-readable string
*/
private formatBytes;
}
//# sourceMappingURL=chunked-output.d.ts.map