// Companion SDK — public entry. Embed the Pouchy companion in a third-party // surface (web / app / game / hardware) over the REST/SSE plane (with an // optional WebSocket transport that degrades to SSE). // // import { createCompanion } from '$lib/companion-sdk'; // const c = createCompanion({ baseUrl: 'https://pouchy.ai', token: PAT }); // await c.connect(); // c.onMessage((text) => console.log(text)); // c.start(); // c.sendWorldState({ type: 'game.scene', data: 'tavern', retained: true }); // await c.sendText('what should I do?'); import { CompanionClient, type CompanionClientOptions } from './client'; export { CompanionClient, CompanionError, pouchyBrandIconUrl, OUTBOX_AMBIGUOUS_MAX_AGE_MS, OUTBOX_MAX_REPLAY_ATTEMPTS } from './client'; export type { CompanionDebugEvent } from './client'; export type { CompanionErrorCodeValue, ControlErrorCodeValue } from './errors'; export type { CompanionClientOptions, CompanionStreamState, HelloAck, RecalledMemory, CompanionTurn, CallCredentials, CallRecordingUnavailable, CallRecordingResult, CallVideo, CallVideoModel, CallVideoUnavailable, PairRequestInfo, PairVisitorResult, CallWorldBrief, CallPrivateStory, CallTrimmed, CompanionToolDecl, ToolCallEvent, WorldStateInput, CompanionAvatar, CompanionWallet, WalletBalance, BrandIconSize, EndSessionError, DroppedToolDecl, EndSessionResult, SendTextReply, TurnUsage, QueuedSend, OutboxStore, ConfirmActionResult, MandateDocument, ConfirmOutcomeClass, RememberDedup } from './client'; export { openCompanionCall, HOST_CONTROL_TOOLS, HOST_CONTROL_TOOL_NAMES, AVATAR_VISUAL_TOOLS, AVATAR_VISUAL_TOOL_NAMES, stripAudioTags, extractAudioTags } from './call'; export type { CallEnd, CompanionCall, CompanionCallOptions, VoiceToolBridge } from './call'; // Exported because a self-plumbed integration (one that calls startCall and // opens the EL session itself) has to name this variable exactly; a literal // typed at their end is the silent-failure path this constant exists to close. export { VOICE_TOOL_VARIABLE, VOICE_TOOL_VARIABLE_PLAIN, VOICE_TOOL_HEADER_PLAIN } from './voice-tool'; export { COMPANION_SCOPES, COMPANION_MODALITIES, SENSITIVE_SCOPES, REPRESENT_SCOPES, DEFAULT_SCOPES, DEFAULT_MODALITIES, isSensitiveScope, isRepresentScope, hasScope, grantsScope } from './scopes'; export type { CompanionScope, CompanionModality } from './scopes'; export type { CompanionEnvelope, OutboundType, InboundType, WorldStateEvent, RenderInterfacePayload, InterfaceUpdatePayload, SocialMessagePayload, DataActivityPayload, SkillCardPayload, ConfirmRequestPayload, PendingConfirm, PendingToolCall, ToolCallPayload, AudioClipPayload, ExpressionPayload, TypingPayload, VoiceInjectPayload, UsagePayload, MessagePayload, MessageAttachment, ControlErrorPayload, HelloAckPayload, CallReadyPayload, OutboundPayloadMap } from './protocol'; // Runtime protocol constants — so a host can assert PROTOCOL_VERSION or // enumerate/validate the event vocabulary without hard-coding the strings. // CONTROL_ERROR_CODES (0.30.0) is the stream-plane control.error vocabulary — // a separate, smaller list than the HTTP COMPANION_ERROR_CODES. export { PROTOCOL_VERSION, INBOUND_TYPES, OUTBOUND_TYPES, COMPANION_ERROR_CODES, CONTROL_ERROR_CODES } from './protocol'; export type { CompanionErrorCode, ControlErrorCode } from './protocol'; // Instant UI ⇄ Google A2UI v0.9 projection (0.42.0) — put `toA2UI` in front of // any renderer built against the A2UI catalog and it draws Pouchy panels; // `fromA2UI` ingests an A2UI surface back into the Instant UI panel shape. // The node-type catalog rides along as data for renderer capability checks. export { toA2UI, fromA2UI, INSTANT_UI_NODE_TYPES } from './a2ui'; export type { A2UISurface, A2UIComponent, A2UIValue, InstantUIInput, DynamicInterface, GenuiNode, EmbeddedAction } from './a2ui'; // The framework-agnostic view controller behind the /svelte and /vue subpath // adapters (and the separate `@pouchy_ai/react` package) — exported from the // root too, so a host on any OTHER framework (or none) can reuse the same // tested snapshot bookkeeping. export { createCompanionView } from './adapter-core'; export type { CompanionView, CompanionViewOptions, CompanionViewSnapshot, CompanionTranscriptEntry } from './adapter-core'; /** Create a companion client. */ export function createCompanion(opts: CompanionClientOptions): CompanionClient { return new CompanionClient(opts); }