export interface SharedChannelEntry { readonly version: 1; readonly at: string; readonly from: string; readonly key: string; readonly value: Readonly>; readonly valueSize: number; } export interface SharedChannel { readonly batchId: string; readonly createdAt: string; readonly updatedAt: string; readonly entries: Readonly>; } export declare const SHARED_CHANNEL_MAX_VALUE_BYTES: number; export declare const SHARED_CHANNEL_SOFT_VALUE_WARN = 1024; export declare const SHARED_CHANNEL_MAX_FILE_BYTES: number; export declare const SHARED_CHANNEL_TTL_DAYS = 30; export type WriteSharedEntryResult = { readonly ok: true; readonly entry: SharedChannelEntry; readonly channelSize: number; readonly lastWriteWins: boolean; readonly softWarning: boolean; } | { readonly ok: false; readonly code: 'VALUE_TOO_LARGE' | 'INVALID_BATCH_ID' | 'WRITE_ERROR'; readonly message: string; }; /** * Write a shared entry to the per-batch channel file. Atomic-write * (tmp + rename). Returns the new entry + channel size + last-write-wins * flag (true if the key already existed; the new value overwrites). * * RL-25 size limit: `value ≥ 64KB` is hard-rejected with `VALUE_TOO_LARGE`. * `value > 1KB and < 64KB` is a soft warning (returned in the result). */ export declare function writeSharedEntry(opts: { projectRoot: string; sid: string; rid: string; batchId: string; key: string; from: string; value: Record; }): WriteSharedEntryResult; /** * Read the shared channel for a batch. Returns the channel with all * matching entries. Filters: `--since` (ISO8601) and `--key` (glob * pattern; simple `*` wildcard, no regex). * * If the channel file does not exist, returns an empty channel * (this is the dispatcher's "fresh batch" view). */ export declare function readSharedChannel(opts: { projectRoot: string; sid: string; rid: string; batchId: string; since?: string; keyPattern?: string; }): SharedChannel; /** * Garbage-collect a single channel. Returns true if the file was * deleted, false if it did not exist. */ export declare function gcChannel(opts: { projectRoot: string; sid: string; rid: string; batchId: string; }): boolean; /** * Check if a channel file is older than `SHARED_CHANNEL_TTL_DAYS` days * and should be GC'd as an orphan. Returns true if file is missing * (already GC'd) or older than TTL. */ export declare function isOrphanChannel(opts: { projectRoot: string; sid: string; rid: string; batchId: string; now?: Date; }): boolean; /** * Compile a simple key pattern with `*` wildcards to a matcher. Only * `*` is special; everything else is a literal. `*` matches zero or * more characters. Examples: * "rd.*" matches "rd.completed", "rd.found-blocker" * "*.completed" matches "rd.completed", "qa.completed" * "*" matches everything */ export declare function compileKeyPattern(pattern: string): (key: string) => boolean;