/**
 * `Channel` — a cursor-based mailbox over the swarm kernel.
 *
 * Every message sent on a channel is appended to a *single* shared
 * {@link JsonlLog} of envelopes. There is deliberately **no file-per-recipient**
 * fan-out: a channel is one ordered stream, and each reader keeps a private
 * **cursor** — a persisted count of how many log entries it has already
 * consumed. Polling reads everything past the cursor, hands back the new
 * envelopes addressed to that reader, and advances the cursor. This makes reads
 * incremental (O(new lines), not O(whole mailbox)) and makes "have I seen this?"
 * a per-reader offset rather than a delete-on-read mutation of shared state.
 *
 * The class is a thin wrapper over two kernel primitives, exactly as the kernel
 * mandates:
 *
 *   - the **transcript** is a {@link JsonlLog}<{@link Envelope}> — append-only,
 *     schema-validated, concurrent-append-safe. `send` is one `append`.
 *   - each reader's **cursor** is a {@link JsonCell} holding a small offset
 *     record. Advancing it goes through `JsonCell.mutate`, so two pollers for
 *     the same reader serialize through the cell's lock and can never skip or
 *     double-count entries.
 *
 * The channel never touches `node:fs` locking, temp renames, or coercion
 * directly — all of that lives in the kernel.
 *
 * Three read surfaces:
 *
 *   - {@link Channel.send}  — validate + append an envelope to the transcript.
 *   - {@link Channel.poll}  — return new-since-cursor envelopes for a reader and
 *     advance that reader's cursor past them.
 *   - {@link Channel.peek}  — return new-since-cursor envelopes *without*
 *     advancing the cursor (a non-destructive look-ahead).
 */
import { type GuardOptions } from "../kernel";
import { type Envelope } from "./codecs";
/**
 * A cursor-based mailbox shared by every teammate that opens the same `root`.
 *
 * Construct with {@link Channel.open}; the factory is async because it opens the
 * underlying {@link JsonlLog} (which ensures the directory exists).
 */
export declare class Channel {
    /** Absolute root directory backing this channel. */
    readonly root: string;
    private readonly transcript;
    private readonly guard?;
    private constructor();
    /**
     * Open (or adopt) the channel rooted at `root`.
     *
     * Opens the shared transcript log; per-reader cursor cells are opened lazily
     * on first {@link poll}/{@link peek} for that reader. `guard` tunes the lock
     * acquisition used when advancing a cursor.
     */
    static open(root: string, guard?: GuardOptions): Promise<Channel>;
    /**
     * Validate `env` and append it to the shared transcript.
     *
     * One `JsonlLog.append`: the envelope is schema-checked on the way in (a bad
     * envelope raises a `validation` fault before disk is touched) and appended as
     * a single line. Returns the normalized envelope. Sending does not touch any
     * cursor — delivery is a pull, driven by each reader's `poll`.
     */
    send(env: Envelope): Promise<Envelope>;
    /**
     * Return the envelopes addressed to `readerId` that it has not yet consumed,
     * then advance its cursor past *everything scanned* so they are not returned
     * again.
     *
     * The cursor advances to the end of the transcript-as-of-this-read, not just
     * past the matched envelopes: messages addressed to other readers are skipped
     * permanently for this reader, which is what keeps polling incremental. The
     * advance is a single {@link JsonCell.mutate}, so concurrent polls for the
     * same reader serialize and never double-deliver.
     */
    poll(readerId: string): Promise<Envelope[]>;
    /**
     * Return the envelopes addressed to `readerId` that it has not yet consumed,
     * **without** advancing its cursor.
     *
     * A non-destructive look-ahead: a subsequent {@link peek} or {@link poll}
     * sees the same envelopes. Useful for inspecting an inbox without committing
     * to having processed it.
     */
    peek(readerId: string): Promise<Envelope[]>;
    /** Open the cursor cell for a reader (offset starts at 0 when absent). */
    private cursorCell;
}
