@inworld/web-core
Version:
49 lines (48 loc) • 2.54 kB
TypeScript
import { CancelResponses } from '../../proto/ai/inworld/packets/packets.pb.js';
import { Awaitable, Client, ClientConfiguration, GenerateSessionTokenFn, OnPhomeneFn, User } from '../common/data_structures/index.js';
import { Extension } from '../common/data_structures/extension.js';
import { HistoryChangedProps, HistoryItem } from '../common/data_structures/history.js';
import { SessionContinuationProps } from '../entities/continuation/session_continuation.entity.js';
import { InworldError } from '../entities/error.entity.js';
import { InworldPacket } from '../entities/packets/inworld_packet.entity.js';
import { InworldConnectionService } from '../services/inworld_connection.service.js';
export declare class InworldClient<InworldPacketT extends InworldPacket = InworldPacket, HistoryItemT extends HistoryItem = HistoryItem> {
private user;
private scene;
private client;
private config;
private sessionContinuation;
private generateSessionToken;
private onDisconnect;
private onError;
private onWarning;
private onMessage;
private onReady;
private onHistoryChange;
private onInterruption;
private onPhoneme;
private onAfterPlaying;
private onBeforePlaying;
private onStopPlaying;
private extension;
setUser(user: User): this;
setClient(client: Client): this;
setGenerateSessionToken(generateSessionToken: GenerateSessionTokenFn): this;
setConfiguration(config: ClientConfiguration): this;
setScene(name: string): this;
setOnDisconnect(fn?: () => Awaitable<void>): this;
setOnError(fn?: (err: InworldError) => Awaitable<void>): this;
setOnWarning(fn: (message: InworldPacketT) => Awaitable<void>): this;
setOnMessage(fn?: (message: InworldPacketT) => Awaitable<void>): this;
setOnReady(fn?: () => Awaitable<void>): this;
setOnHistoryChange(fn?: (history: HistoryItemT[], props: HistoryChangedProps<HistoryItemT>) => Awaitable<void>): this;
setOnInterruption(fn?: (props: CancelResponses) => Awaitable<void>): this;
setOnPhoneme(fn?: OnPhomeneFn): this;
setOnAfterPlaying(fn?: (message: InworldPacketT) => Awaitable<void>): this;
setOnBeforePlaying(fn?: (message: InworldPacketT) => Awaitable<void>): this;
setOnStopPlaying(fn?: () => Awaitable<void>): this;
setExtension(extension: Extension<InworldPacketT, HistoryItemT>): this;
setSessionContinuation(sessionContinuation: SessionContinuationProps): this;
build(): InworldConnectionService<InworldPacketT>;
private validate;
}