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

    Interface CompanionViewSnapshot

    Immutable view snapshot. A new object per change — safe to hand to useSyncExternalStore / $state / shallowRef without defensive copies.

    interface CompanionViewSnapshot {
        draft: string;
        outbox: number;
        pendingConfirms: readonly ConfirmRequestPayload[];
        restoreError?: { code: string; message: string };
        streamState: CompanionStreamState;
        transcript: readonly CompanionTranscriptEntry[];
        typing: boolean;
    }
    Index
    draft: string

    The in-flight streamed reply (token deltas), '' when none.

    outbox: number

    Sends queued while offline (0.34.0 — the client's queueOffline option): client.pendingOutbox().length, live-updated. Always 0 on a client from an older SDK bundle without the offline queue.

    pendingConfirms: readonly ConfirmRequestPayload[]

    Confirm requests that arrived on the stream and haven't been resolved through this view yet. Rebuild after a reload via client.pendingConfirms() — confirm_request events are not replayed.

    restoreError?: { code: string; message: string }

    Set when the restore history load REJECTED (CR-784). A brand-new session resolves with no turns and leaves this unset — so a value here is always a real failure: not_connected (restore ran before connect()), missing_scope (the token lacks chat), a 429 or a 5xx. code is the CompanionError code, or 'unknown' for an uncoded rejection.

    transcript: readonly CompanionTranscriptEntry[]

    Rolling transcript, oldest first, capped at transcriptCap.

    typing: boolean