@inworld/web-core
Version:
73 lines (72 loc) • 3.2 kB
TypeScript
import { DataChunkDataType, InworldPacket as ProtoPacket, Routing } from '../../proto/ai/inworld/packets/packets.pb.js';
import { ItemsInEntitiesOperationType, PerceivedLatencyReportProps, SendAudioSessionStartPacketParams, SendCustomPacketParams, SendPacketParams, SessionControlProps } from '../common/data_structures/index.js';
import { Character } from '../entities/character.entity.js';
import { EntityItem } from '../entities/entities/entity_item.js';
import { InworldPacket } from '../entities/packets/inworld_packet.entity.js';
import { PacketId } from '../entities/packets/packet_id.entity.js';
export interface SendCancelResponsePacketParams {
interactionId?: string;
utteranceId?: string[];
}
export declare class EventFactory {
private validateData;
private character;
private characters;
constructor({ validateData }?: {
validateData?: boolean;
});
getCurrentCharacter(): Character;
setCurrentCharacter(character: Character): void;
setCharacters(characters: Character[]): void;
getCharacters(): Character[];
dataChunk(chunk: string, type: DataChunkDataType, params: SendPacketParams): ProtoPacket;
audioSessionStart(params: SendAudioSessionStartPacketParams): ProtoPacket;
audioSessionEnd(params: SendPacketParams): ProtoPacket;
pong(packetId: PacketId, pingTimestamp: string): ProtoPacket;
perceivedLatencyWithTypeDetection({ sent, received, }: {
sent: InworldPacket;
received: InworldPacket;
}): ProtoPacket;
perceivedLatency({ precision, interactionId, startDate, endDate, }: PerceivedLatencyReportProps): ProtoPacket;
mutePlayback(isMuted: boolean, params: SendPacketParams): ProtoPacket;
text(text: string, params: SendPacketParams): ProtoPacket;
trigger(name: string, params: SendCustomPacketParams): ProtoPacket;
cancelResponse(params: SendCancelResponsePacketParams): ProtoPacket;
narratedAction(content: string, params: SendPacketParams): ProtoPacket;
conversation(participants: string[], params: SendPacketParams): ProtoPacket;
sessionControl(props: SessionControlProps): ProtoPacket;
loadScene(name: string): ProtoPacket;
loadCharacters(names: string[]): ProtoPacket;
unloadCharacters(ids: string[]): ProtoPacket;
baseProtoPacket({ utteranceId, interactionId, correlationId, conversationId, }?: {
utteranceId?: boolean;
interactionId?: boolean;
correlationId?: boolean;
conversationId?: string;
}): {
packetId: {
conversationId: string;
correlationId: string;
interactionId: string;
utteranceId: string;
packetId: string;
};
timestamp: string;
routing: Routing;
};
private audioSession;
private customEvent;
private routing;
private static worldRouting;
private validate;
createOrUpdateItems(props: {
items: EntityItem[];
addToEntities: string[];
}): ProtoPacket;
removeItems(ids: string[]): ProtoPacket;
itemsInEntities(props: {
type: ItemsInEntitiesOperationType;
itemIds: string[];
entityNames: string[];
}): ProtoPacket;
}