import { Channel } from '@struktoai/mirage-core/shell/console/index'; import type { ConsoleChunk, ConsoleStore, ReadResult } from '@struktoai/mirage-core/shell/console/index'; export interface RedisConsoleStoreOptions { url?: string; keyPrefix?: string; /** Expire the keys this long after the last append; absent keeps them. */ ttlSeconds?: number; } /** * Console storage on a Redis stream, for readers in other processes. * * One stream per job: chunk seq maps to stream id `(seq+1)-0`, with the * channel, payload and timestamp as entry fields (`c`/`d`/`t`). The * job's process appends through its store instance; a reader anywhere * else attaches its own instance on the same keyPrefix and follows * live, which is what RAM cannot offer. The schema matches the Python * RedisConsoleStore byte for byte, so the reader does not have to be * the writer's language. * * The job owns its keys: a factory must hand every job a prefix nothing * else has written, because a reused stream replays the previous job's * chunks, ending chunk included. `keyPrefix` stays public because it is * the console's address: an embedder reads it off a job's store and * hands it to the process that should attach. * * The ending chunk is terminal in the store itself, not only in this * process: the append script refuses any append once a CONTROL chunk * landed, so an emit that raced a kill past `JobConsole`'s local guard * is dropped server-side instead of landing after the ending. * * `wait` polls the seq counter rather than blocking server-side the way * Python's XREAD BLOCK does: node-redis serializes commands on one * connection, so a blocking read would wedge the job's own appends * behind it, and a second connection costs more than a short poll. * There is no retention trim, so readFrom never reports a truncated * cursor; retention is bounded by `ttlSeconds` instead, refreshed on * every append, so a console expires that long after its job's last * write. */ export declare class RedisConsoleStore implements ConsoleStore { readonly url: string; readonly keyPrefix: string; private readonly streamKey; private readonly counterKey; private readonly endedKey; private readonly ttlSeconds; private clientPromise; private isClosed; constructor(options?: RedisConsoleStoreOptions); get closed(): boolean; private client; /** * Append one chunk, atomically against the console's ending. * * A dropped append (the console already ended) reports the last real * chunk's seq; `JobConsole.emit` ignores the return and the drop is * exactly its documented after-the-ending semantics. */ append(channel: Channel, data: Uint8Array): Promise; readFrom(seq: number, limit?: number): Promise; wait(seq: number): Promise; close(): Promise; /** Delete the console's keys (test and integ teardown only). */ clear(): Promise; private chunk; } //# sourceMappingURL=store.d.ts.map