eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
43 lines (42 loc) • 1.43 kB
TypeScript
import type { HandleMessageStreamEvent } from "#protocol/message.js";
import type { MessageResult } from "#client/types.js";
/**
* Internal configuration passed to construct a {@link MessageResponse}.
*/
interface MessageResponseInput {
readonly continuationToken?: string;
readonly createStream: () => AsyncGenerator<HandleMessageStreamEvent>;
readonly sessionId: string;
}
/**
* The response from {@link ClientSession.send}.
*
* Like `fetch()`, the response exposes metadata (session ID, continuation
* token) as soon as the POST completes. Collect the event stream via
* {@link result} or iterate it with `for await...of`.
*/
export declare class MessageResponse<TOutput = unknown> implements AsyncIterable<HandleMessageStreamEvent> {
#private;
/**
* Continuation token returned by the server for follow-up messages.
*/
readonly continuationToken: string | undefined;
/**
* Session ID assigned by the server.
*/
readonly sessionId: string;
/** @internal */
constructor(input: MessageResponseInput);
/**
* Consumes the full event stream and returns the aggregated
* {@link MessageResult}.
*/
result(): Promise<MessageResult<TOutput>>;
/**
* Yields stream events one at a time.
*
* Each response can only be consumed once.
*/
[Symbol.asyncIterator](): AsyncIterator<HandleMessageStreamEvent>;
}
export {};