@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
43 lines • 1.76 kB
TypeScript
import { Channel, type ConsoleChunk, type ReadResult } from './types.ts';
import type { ConsoleStore } from './store.ts';
/**
* In-memory console storage, the default in every topology.
*
* Simpler than its Python counterpart for one reason: JavaScript runs
* this on a single event loop, so a waiter is just a pending promise
* resolver. Python has to park futures per loop and wake them through
* call_soon_threadsafe, because its callers arrive on pool threads with
* their own loops.
*
* The ending chunk is terminal here as it is in Redis: an append after a
* CONTROL chunk is dropped, so a runner that outlived an ending written
* through another handle on this store (a kill from another workspace
* sharing it) cannot append past it.
*/
export declare class RAMConsoleStore implements ConsoleStore {
private chunks;
private baseSeq;
private nextSeq;
private bytes;
private ended;
private readonly maxBytes;
private waiters;
private isClosed;
get closed(): boolean;
/**
* @param maxBytes retention budget. When set, the oldest chunks are
* dropped once the total exceeds it, and a reader whose cursor was
* dropped is told rather than shorted.
* @param chunks pre-existing chunks, used to rebuild a finished job's
* console from a snapshot.
*/
constructor(maxBytes?: number | null, chunks?: ConsoleChunk[] | null);
append(channel: Channel, data: Uint8Array): Promise<ConsoleChunk>;
readFrom(seq: number, limit?: number): Promise<ReadResult>;
wait(seq: number, signal?: AbortSignal): Promise<void>;
waitEnded(signal?: AbortSignal): Promise<void>;
close(): Promise<void>;
private trim;
private wake;
}
//# sourceMappingURL=ram.d.ts.map