agents
Version:
A home for your AI agents
56 lines (54 loc) • 1.84 kB
TypeScript
import { l as Json } from "../../../protocol-CukuI73M.js";
import { WebChannelClient } from "./client.js";
import { ChatTransport, UIMessage, UIMessageChunk } from "ai";
//#region src/experimental/channels/web/ai-sdk.d.ts
type WebChannelChatTransportOptions = {
/**
* Client tools the transport runs itself when the agent gives this
* participant a call. Without them, answer calls with `addToolOutput`.
*/
tools?: Record<string, (input: Json) => Json | Promise<Json>>;
};
/**
* What the transport reads from `sendMessages`. Kept structural so the
* transport also fits the `ChatTransport` of a newer `ai` release, such as
* the one `@ai-sdk/tui` brings.
*/
type WebChannelSendOptions = {
trigger: "submit-message" | "regenerate-message";
messages: readonly {
id: string;
role: UIMessage["role"];
parts: readonly object[];
}[];
abortSignal?: AbortSignal;
};
/**
* An AI SDK `ChatTransport` over a Web Channel connection, for `useChat`
* and `@ai-sdk/tui`. Each call streams one turn until it settles, or until
* it waits for input the transport cannot give.
*
* The agent owns the transcript, so only the newest user message or the
* newest answers to pending tool calls are sent; the rest of `messages` is
* ignored. Regenerating a message is not supported.
*/
declare class WebChannelChatTransport implements ChatTransport<UIMessage> {
#private;
constructor(
client: WebChannelClient,
options?: WebChannelChatTransportOptions
);
sendMessages({
trigger,
messages,
abortSignal
}: WebChannelSendOptions): Promise<ReadableStream<UIMessageChunk>>;
reconnectToStream(): Promise<ReadableStream<UIMessageChunk> | null>;
}
//#endregion
export {
WebChannelChatTransport,
WebChannelChatTransportOptions,
WebChannelSendOptions
};
//# sourceMappingURL=ai-sdk.d.ts.map