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.
23 lines • 1.61 kB
TypeScript
import { type ClientChannel } from 'telefunc';
/**
* Wrap a live source in a Telefunc Channel (#405/#426): open the channel, hand `start` a
* `send` sink, and let it wire the source and hand back a stop function. When `start`
* returns undefined — an unknown project with nothing to stream — the channel closes
* immediately, mirroring the read model's empty results rather than throwing at the client;
* otherwise the stop runs on `.close()`. This owns the whole Channel lifecycle so the
* callers (events.telefunc.ts) read as "stream from this source" with no channel plumbing.
*/
export declare function streamChannel<T>(start: (send: (value: T) => void) => (() => void) | undefined): ClientChannel<never, T>;
/**
* Forward an async-iterable of events to a `send` sink until the source is exhausted or
* the returned stop function is called (#426). This is the bridge behind the relay's
* `onEvents`: the relay's in-memory run is an `AsyncIterable` that replays its buffered
* history then follows live (exactly what `serveSSE` consumes), and each value becomes a
* `channel.send(event)`. Kept transport-agnostic (a plain `send` callback, not a Channel)
* so the pump can be driven and tested on its own; {@link streamChannel} wires the Channel.
*
* Returns a stop function that halts forwarding and cancels the iterator, releasing the
* follower waiting on the next event. Idempotent. An absent source is a no-op.
*/
export declare function forwardStream<T>(iterable: AsyncIterable<T> | undefined, send: (value: T) => void): () => void;
//# sourceMappingURL=stream-channel.d.ts.map