@nemphi/sdk 0.2.4853 → 0.2.4941

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -575,8 +575,9 @@ export interface Notification {
575
575
  seq?: number;
576
576
  }
577
577
  /**
578
- * One event on the workspace's realtime hub (`GET /v1/events/socket`, and
579
- * the `typing` / `presence` / `marketing` frames of `GET /v1/events/stream`).
578
+ * One realtime event of the workspace (`openRealtimeSocket`, which polls
579
+ * `GET /v1/events/poll`; the frames of `GET /v1/events/stream` and
580
+ * `GET /v1/events/socket`).
580
581
  * `action` and `notification` are wakeups — re-read the surface, the row
581
582
  * itself comes by cursor; the rest is state that only matters while
582
583
  * someone is watching.
@@ -654,19 +655,22 @@ export type RealtimeEvent = {
654
655
  export type TypingScope = Extract<RealtimeEvent, {
655
656
  type: "typing";
656
657
  }>["scope"];
657
- /** An open realtime socket; `close()` stops it and its reconnects. */
658
+ /** An open realtime subscription; `close()` stops it and its retries. */
658
659
  export interface RealtimeSocket {
659
660
  close(): void;
660
661
  }
661
662
  export interface RealtimeSocketOptions {
662
663
  onEvent: (event: RealtimeEvent) => void;
663
- /** Called when the socket connects (and reconnects); a screen re-reads what it shows here. */
664
+ /**
665
+ * Called when the first poll answers, and again when one answers after
666
+ * polls failed; a screen re-reads what it shows here.
667
+ */
664
668
  onOpen?: () => void;
669
+ /** Called when a poll fails after one answered. */
665
670
  onClose?: () => void;
666
671
  /**
667
- * How to open a WebSocket with headers. React Native's `WebSocket`
668
- * takes them as a third argument, which the default uses; a browser
669
- * cannot set them and should use the app's own stream route instead.
672
+ * Ignored: the subscription polls `GET /v1/events/poll` over `fetch`
673
+ * rather than holding a WebSocket. Kept so existing callers compile.
670
674
  */
671
675
  webSocket?: (url: string, headers: Record<string, string>) => WebSocket;
672
676
  }
@@ -5056,6 +5060,19 @@ export interface PublicCallCenterCall {
5056
5060
  status: MarketingCallStatus;
5057
5061
  key?: string;
5058
5062
  join_token?: string | null;
5063
+ /** Present while the queue's voice agent holds the call: the page sends it the caller's audio too. */
5064
+ voice_agent?: boolean;
5065
+ }
5066
+ /** The caller's microphone pushed to the voice agent's media app. */
5067
+ export interface PublicCallCenterAgentPush {
5068
+ session_id: string;
5069
+ /** The SDP answer to the browser's offer. */
5070
+ sdp: string;
5071
+ }
5072
+ /** The agent's voice pulled into the caller's session: an SDP offer to answer when `renegotiate`. */
5073
+ export interface PublicCallCenterAgentPull {
5074
+ sdp: string;
5075
+ renegotiate: boolean;
5059
5076
  }
5060
5077
  /** One person's call-center desk (`callcenter.desk`). */
5061
5078
  export interface CallCenterDesk {
@@ -8451,10 +8468,12 @@ export interface NemphiClient {
8451
8468
  signal?: AbortSignal;
8452
8469
  }): AsyncGenerator<Action, void, void>;
8453
8470
  /**
8454
- * The realtime hub over a WebSocket (`GET /v1/events/socket`) for a
8455
- * runtime without `EventSource`: every hub event as it happens, with
8456
- * reconnects until `close()`. The web app reads the same events through
8457
- * its own stream route instead.
8471
+ * The workspace's realtime events, polled from `GET /v1/events/poll`
8472
+ * every two seconds (at once while the server has more), with retries
8473
+ * until `close()`: the ledger and the caller's notifications as
8474
+ * wake-ups, the workspace's frames as they are, and who is online when
8475
+ * that changed. Each poll keeps the caller online. The web app polls the
8476
+ * same route through its own server route.
8458
8477
  */
8459
8478
  openRealtimeSocket(options: RealtimeSocketOptions): RealtimeSocket;
8460
8479
  /** Say the caller is writing in a thread or an inbox conversation (`POST /v1/events/typing`); nothing is stored. */
@@ -9329,6 +9348,16 @@ export interface NemphiClient {
9329
9348
  getPublicCallCenterCall(key: string, callId: string, callerKey: string): Promise<PublicCallCenterCall>;
9330
9349
  /** Hangs up a web call that is still ringing. */
9331
9350
  hangUpPublicCallCenterCall(key: string, callId: string, callerKey: string): Promise<PublicCallCenterCall>;
9351
+ /**
9352
+ * While the queue's voice agent holds a web call (`voice_agent`), pushes
9353
+ * the caller's microphone to the agent's media app: the browser's SDP
9354
+ * offer for transceiver `mid` in, the session and the SDP answer out.
9355
+ */
9356
+ pushPublicCallCenterAgent(key: string, callId: string, callerKey: string, sdp: string, mid: string): Promise<PublicCallCenterAgentPush>;
9357
+ /** Pulls the agent's voice into the caller's session; 409 `agent_not_ready` until it is seated. */
9358
+ pullPublicCallCenterAgent(key: string, callId: string, callerKey: string, sessionId: string): Promise<PublicCallCenterAgentPull>;
9359
+ /** Hands the browser's SDP answer to a pull's offer back. */
9360
+ answerPublicCallCenterAgent(key: string, callId: string, callerKey: string, sessionId: string, sdp: string): Promise<void>;
9332
9361
  /** Claims a guest seat on a call link; poll `getPublicCallParticipant` with the result. */
9333
9362
  joinPublicCall(token: string, name: string): Promise<PublicCallJoin>;
9334
9363
  /** Polls a guest seat for its media token. Unauthenticated. */