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

    Interface CompanionView

    interface CompanionView {
        client: CompanionClient;
        confirmAction(
            confirmId: string,
            approve: boolean,
            opts?: { signal?: AbortSignal },
        ): Promise<
            {
                ok: boolean;
                outcome?: string;
                retryable?: boolean;
                status: "approved"
                | "denied"
                | "exec_failed";
            },
        >;
        dispose(): void;
        getSnapshot(): CompanionViewSnapshot;
        sendText(
            text: string,
            opts?: {
                awaitReply?: boolean;
                images?: string[];
                replyTimeoutMs?: number;
                signal?: AbortSignal;
                stream?: boolean;
            },
        ): Promise<{ queued?: boolean; seq: number | null; turnId?: string }>;
        subscribe(listener: () => void): () => void;
    }
    Index

    The underlying client, for everything the view doesn't wrap.

    • confirmAction that also removes the confirm from pendingConfirms (on approve AND deny — both resolve the card server-side).

      Parameters

      • confirmId: string
      • approve: boolean
      • Optionalopts: { signal?: AbortSignal }

      Returns Promise<
          {
              ok: boolean;
              outcome?: string;
              retryable?: boolean;
              status: "approved"
              | "denied"
              | "exec_failed";
          },
      >

    • Detach every client subscription. The view goes inert (snapshot frozen, listeners dropped); the client itself is NOT closed — it belongs to the host. Idempotent.

      Returns void

    • sendText that also appends the user turn to the transcript.

      Parameters

      • text: string
      • Optionalopts: {
            awaitReply?: boolean;
            images?: string[];
            replyTimeoutMs?: number;
            signal?: AbortSignal;
            stream?: boolean;
        }

      Returns Promise<{ queued?: boolean; seq: number | null; turnId?: string }>

    • Subscribe to snapshot changes. Returns unsubscribe.

      Parameters

      • listener: () => void

      Returns () => void