import type { ClientChannel } from 'telefunc';
import type { FrameworkEvent } from '../events.js';
/**
 * The end-of-replay marker (#1383). A subscribe replays the whole log before following live,
 * and without a boundary a reconnecting client cannot tell "replay still streaming" from "the
 * log is genuinely this short" — so it blanked a populated feed and refilled it line by line.
 * Sent once per subscription, after the on-disk replay is delivered. Wire-only: it is not a
 * {@link FrameworkEvent}, is never written to any journal, and the client swallows it.
 */
export type StreamSync = {
    kind: 'stream-sync';
};
/** What `onEvents` streams: the run's events, plus the wire-only end-of-replay marker. */
export type LiveFeedEvent = FrameworkEvent | StreamSync;
/**
 * `onEvents(projectId, runId?)` returns a Channel that streams one live run: the client
 * `.listen()`s for `FrameworkEvent`s and `.close()`s to unsubscribe, which stops the tail.
 * An unknown project yields a channel that closes immediately (mirrors the read model's
 * empty results rather than throwing at the client).
 *
 * Pass the `runId` to follow that run's own log (#749). A project has several concurrent
 * runs since #736, each writing inside its worktree, so the run id is what makes the feed
 * that run's rather than a mix — and without it the feed for a worktree run is empty.
 * Omitting it keeps the pre-#736 behavior of tailing the project root.
 *
 * Two sources, chosen by the mount. An in-memory stream on the context wins: the relay's own run
 * (#426), or a run the daemon is relaying from a device (#1067). Otherwise the on-disk log. The
 * daemon sets a source that answers only for relayed runs, so an ordinary local run yields undefined
 * here and falls through to tailing the log, exactly as before.
 *
 * Only the on-disk tail sends the {@link StreamSync} marker: the in-memory sources have no
 * replay boundary to report, so a reconnecting client falls back to a grace deadline before
 * swapping its feed (see use-live-events in the dashboard).
 */
export declare function onEvents(projectId: string, runId?: string): Promise<ClientChannel<never, LiveFeedEvent>>;
//# sourceMappingURL=events.telefunc.d.ts.map