UNPKG

framework

Version:

The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.

33 lines 2.13 kB
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 agent's events, plus the wire-only end-of-replay marker. */ export type LiveFeedEvent = FrameworkEvent | StreamSync; /** * Follow one agent's events: `send` is called per event until the returned stop function runs. * Returns undefined when there is nothing to stream (an unknown project), which the mount ends as * a clean close — mirroring the read model's empty results rather than throwing at the client. * * Pass the `agentId` to follow that agent's own log (#749). A project has several concurrent agents * since #736, each writing inside its worktree, so the agent id is what makes the feed that agent's * rather than a mix — and without it the feed for a worktree agent is empty. Omitting it keeps the * pre-#736 behavior of tailing the project root. * * Two sources, chosen by what is wired. An in-memory stream wins: an agent the daemon is relaying * from a device (#1067). Otherwise the on-disk log. The daemon's source answers only for relayed * runs, so an ordinary local agent falls through to tailing the log. * * 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 streamAgentEvents(projectId: string, agentId: string | undefined, send: (value: LiveFeedEvent) => void, onDone?: () => void): Promise<(() => void) | undefined>; //# sourceMappingURL=events.d.ts.map