@pouchy_ai/companion-sdk - v0.78.1
    Preparing search index...

    Interface CompanionCall

    interface CompanionCall {
        callGen?: string;
        canMute: boolean;
        close: () => void;
        injectEvent: (text: string, speak?: boolean) => void;
        interrupt: () => void;
        isMuted: () => boolean;
        privateStory?: CallPrivateStory;
        provider: "elevenlabs-convai" | "openai-realtime";
        recording?: boolean;
        recordingUnavailable?: CallRecordingUnavailable;
        sendText: (text: string) => boolean;
        setMuted: (muted: boolean) => void;
        trimmed?: CallTrimmed;
        video?: CallVideo;
        videoUnavailable?: CallVideoUnavailable;
        worldBrief?: CallWorldBrief;
    }
    Index
    callGen?: string

    The call's generation handle (0.65.0, set by connectCall) — the key getCallRecording / deleteCallRecording take.

    canMute: boolean

    Whether setMuted actually controls the microphone on this call (0.69.0). true on openai-realtime; on elevenlabs-convai it is true when the installed @elevenlabs/client exposes setMicMuted (every version the peer range allows does). When false, setMuted only records the state: do not show a mute control.

    close: () => void

    Hang up. Idempotent.

    injectEvent: (text: string, speak?: boolean) => void

    Inject an out-of-band context line. speak: true makes the companion react now; false stages it for the next turn.

    NOT the reader's words: the line does not reach onTranscript or the memory /end consolidates, and connectCall uses this same lever for server-pushed world moments. For something the reader TYPED, use sendText.

    interrupt: () => void

    SILENT CUT (0.36.0): stop the utterance currently being spoken WITHOUT generating any new speech — the "stale commentary at a beat boundary" case (field request: fast-paced game, last hand's commentary still playing when the next hand starts). Idempotent: a no-op when nothing is playing, after close(), and mid-connect.

    Provider tiers (check provider):

    • openai-realtime — GUARANTEED: cancels the active response and clears the WebRTC output buffer (response.cancel + output_audio_buffer.clear); playback stops within ~an audio frame. The session continues normally.
    • elevenlabs-convai — BEST-EFFORT: the EL client exposes no public "stop playback" API; we signal user_activity (halts the agent's stream when the agent's interruption handling allows) and attempt the client's internal output-buffer cut when the installed build exposes it. Verify on your rig; worst case it degrades to a no-op — for a guaranteed preemption on EL, injectEvent(text, true) (which DOES speak new content) remains the reliable lever.
    isMuted: () => boolean

    The reader's mute as last set (0.69.0) — the setMuted / muted state, not whether the half-duplex mute is momentarily engaged. A method, not a field, so it stays live on a spread copy of the handle.

    privateStory?: CallPrivateStory

    Pouchy World role sessions (0.68.0): whether the role can reach its private layer on this call. See CallPrivateStory.

    provider: "elevenlabs-convai" | "openai-realtime"
    recording?: boolean

    Whether this call is recorded (0.65.0) — present when it asked (connectCall({ record: true })).

    recordingUnavailable?: CallRecordingUnavailable

    Why a call that asked is not recorded (0.65.0).

    sendText: (text: string) => boolean

    Send a line the READER typed, as their turn in the call (0.69.0). The companion answers it as something the reader said; it is reported to onTranscript as role: 'user' (once, by the SDK, the moment it is sent) and so reaches the memory connectCall hands to /end at hang-up, in order with the spoken lines.

    It takes the floor the way speech does: an utterance the companion is in the middle of is cut, then it replies to this line.

    Nothing is sent before this call — the provider sees the text only when you pass it here, so a check you run first runs before anyone reads it. Returns false (and sends nothing) for blank text, after close(), or when the call's channel is not open; true once it was handed to the provider. Same behaviour on both providers.

    setMuted: (muted: boolean) => void

    The reader's own mute (0.69.0). true stops the microphone sending audio until setMuted(false). Distinct from the SDK's half-duplex mute (the mic is muted while the companion speaks, unless bargeIn): a reader who muted stays muted when the companion finishes a line. A no-op after close(). Check canMute before showing a mute control.

    trimmed?: CallTrimmed

    What the server cut to fit the realtime cap (0.68.0). See CallTrimmed.

    video?: CallVideo

    The video avatar's Simli session (0.75.0), when connectCall({ avatar }) got one.

    videoUnavailable?: CallVideoUnavailable

    Why a call that asked for an avatar has none (0.75.0).

    worldBrief?: CallWorldBrief

    Pouchy World role sessions (0.67.0): whether the call carries the story's current state. See CallWorldBrief.