@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
49 lines • 2.45 kB
TypeScript
import type { KeyHold } from '../../cache/lock.ts';
import type { ByteSource, OpReport } from '../../io/types.ts';
/**
* Stamp the caller's report: memory answered, no backend ran.
*
* Fires at the moment a warm file-cache hit or a synthetic namespace
* answer is in hand, before the post gate and any output cap, so
* whatever those throw cannot erase the fact. The value is
* `VFSName.RAM`, which is how a record says "this never crossed
* the network": `OpRecord.isCache` is defined as that string, and
* every network/cache total derives from it.
*/
export declare function memoryAnswered(report: OpReport | undefined, moved?: number | null): void;
/**
* Stamp the caller's report: the owning mount answered. A report memory
* already stamped (a namespace answer for a missing path) keeps that.
* Mirrors Python's `_served`.
*/
export declare function served(report: OpReport | undefined, result: unknown, moved?: number | null): void;
/**
* Pull a stream's first chunk now and answer the stream from there, so a read
* that fails at its start fails at the call, where the dispatcher handles it, rather
* than in the hands of whoever pulls it later. A live pipe's first byte may wait
* on the very reader about to ask for it, so its read is framed unpulled
* (`pull` false). Mirrors Python's `_primed`.
*/
export declare function primed(stream: AsyncIterable<Uint8Array>, report: OpReport | undefined, pull?: boolean): Promise<AsyncIterable<Uint8Array>>;
/**
* A streamed write's bytes, pulled with its names let go. The producer may
* wait on another writer of the same name (`tee -a f | tee -a f`, a loop
* appending to the file it pipes into), so the write holds the name only
* while the store takes a chunk, and writers interleave between chunks as
* two descriptors of one file do: a replacement landing there leaves the
* stream's later chunks at its own offset, as Linux does. What the store
* took is kept while it fits the cache's drain budget, so the next read is
* served what was written, as a whole write's is. Mirrors Python's
* `_LentPayload`.
*/
export declare class LentPayload {
private readonly source;
private readonly holds;
private readonly budget;
moved: number;
private kept;
constructor(source: ByteSource, holds: readonly KeyHold[], budget: number);
whole(): Uint8Array | null;
chunks(): AsyncGenerator<Uint8Array>;
}
//# sourceMappingURL=stream.d.ts.map