@relaymessenger/livekit 0.1.0-staging.2 → 0.1.0-staging.21

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/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # `@relaymessenger/livekit`
2
2
 
3
3
  `@relaymessenger/livekit` connects Relay Calls to TypeScript LiveKit Agents.
4
- Relay stays responsible for the Call resource and signaling; the package owns
5
- the Node WebRTC peer and translates audio between Relay and LiveKit `AudioFrame`
6
- objects. Application code does not handle Cloudflare, SDP, ICE, or SFU
7
- credentials.
4
+ It translates audio between the Relay SDK's call transport
5
+ (`RelayCallTransport` from `@relaymessenger/sdk/calls`) and LiveKit
6
+ `AudioFrame` objects. The transport owns the Node WebRTC peer, so application
7
+ code does not handle Cloudflare, SDP, ICE, or SFU credentials.
8
8
 
9
9
  Install it next to the Relay SDK and the LiveKit Agents runtime:
10
10
 
@@ -39,94 +39,30 @@ async function answerCall(callId: string, session: AgentSession) {
39
39
  ```
40
40
 
41
41
  `RelayLiveKitCall.connect()` does not resolve until the WebRTC media peer has
42
- reached `connected`. `RelayAudioInput` converts the remote participant's PCM16
43
- audio to LiveKit frames. `RelayAudioOutput` publishes LiveKit TTS frames to
44
- Relay, pacing larger frames into 10 ms WebRTC source slices. `clearBuffer()`
45
- drops queued outbound audio that has not yet reached WebRTC.
42
+ reached `connected`. `RelayAudioInput` hands the AgentSession the remote
43
+ participant's audio as 24 kHz mono PCM16 frames, the format of LiveKit's own
44
+ room input; the Opus decoder produces that format directly.
45
+
46
+ `RelayAudioOutput` has the shape of LiveKit's own `ParticipantAudioOutput`.
47
+ Like LiveKit's, it waits until the person is receiving the agent's audio: the
48
+ transport holds each frame until then, so a greeting that starts early is not
49
+ cut, sends silence meanwhile, and skips nothing. Then `captureFrame()` hands each
50
+ frame to the transport and returns at once, so the
51
+ AgentSession may push a whole reply faster than real time; the engine's 20 ms
52
+ pump paces the wire. `flush()` closes the segment and reports
53
+ `playbackFinished` only after the transport has drained. `clearBuffer()` drops
54
+ audio that has not reached the wire and reports the segment as interrupted at
55
+ the position that actually played.
46
56
 
47
57
  Use `setMuted(true)` to publish participant mute state, `end()` to end the Relay
48
58
  Call, and `close()` for local cleanup. If the signaling connection is replaced,
49
59
  `call.transport.reconnect()` keeps the existing media peer and replays the same
50
60
  audio publication so Relay can return its cached answer.
51
61
 
52
- ## Provider-neutral transport
53
-
54
- The WebRTC/PCM layer is a separate public entry point for future adapters that
55
- do not use LiveKit Agents:
56
-
57
- ```ts
58
- import { RelayCallTransport } from "@relaymessenger/livekit/transport";
59
-
60
- const room = relay.calls.room(callId);
61
- const transport = new RelayCallTransport({ room });
62
-
63
- transport.on("audio", ({ samples, sampleRate, channelCount }) => {
64
- // Interleaved signed PCM16 from the remote Relay participant.
65
- });
66
-
67
- await transport.connect();
68
- await transport.writeAudio({
69
- samples,
70
- sampleRate: 48_000,
71
- channelCount: 1,
72
- });
73
- ```
74
-
75
- ## ICE servers, TURN, and diagnostics
76
-
77
- By default the peer gathers host candidates only and Cloudflare's SFU supplies
78
- its own candidates in the answer. Inside a container or behind a firewall that
79
- blocks outbound UDP, pass TURN servers in the standard `RTCIceServer` shape and,
80
- if every path must go through TURN, `iceTransportPolicy: "relay"`. Both options
81
- are accepted by `RelayLiveKitCall.connect()` and `RelayCallTransport`.
82
-
83
- ```ts
84
- const call = await RelayLiveKitCall.connect({
85
- relay,
86
- callId,
87
- iceServers: [
88
- {
89
- urls: [
90
- "turn:turn.cloudflare.com:3478?transport=udp",
91
- "turn:turn.cloudflare.com:3478?transport=tcp",
92
- "turns:turn.cloudflare.com:5349?transport=tcp",
93
- ],
94
- username: process.env.TURN_USERNAME!,
95
- credential: process.env.TURN_CREDENTIAL!,
96
- },
97
- ],
98
- iceTransportPolicy: "all",
99
- mediaConnectTimeoutMs: 15_000,
100
- });
101
- ```
102
-
103
- `mediaConnectTimeoutMs` bounds the wait for the media peer to reach
104
- `connected` (15 seconds by default). When that wait expires, the error message
105
- carries what ICE saw, for example
106
- `Timed out connecting Relay WebRTC media (local: host 2, srflx 0, relay 0; remote: udp 1473; states: new→complete 0.2s, connecting 0.3s, no connected)`.
107
- The same facts are available at any time from `call.diagnostics()` or
108
- `transport.diagnostics()`: local candidate counts by type, the remote
109
- candidates' transport and port (never their address), the ICE gathering, ICE
110
- connection and peer connection state changes with their offsets from
111
- `connect()`, packet counts in both directions (`inbound`: RTP received, Opus
112
- decode failures, PCM frames delivered, first and last packet offsets, packets
113
- in the last 5 s; `outbound`: PCM frames accepted, Opus packets, RTP written,
114
- first and last packet offsets, packets in the last 5 s, paced queue size,
115
- pacer state), the room frames seen (`roomState` count, pull `offer` count,
116
- `ended` reason, `error` messages), and the one-line `summary`, for example
117
- `…; in: 1234 rtp, 0 bad, 1234 frames, first 0.9s last 41.2s, 250/5s; out: 2050 frames, 2050 opus, 2050 rtp, first 1.1s last 41.0s, 250/5s, queue 0, pacer alive; room: 3 roomState, 1 offer`.
118
- Packet counts come from the `werift` engine; `wrtc` reports zero packets and
119
- `pacer n/a`.
120
-
121
- `onWarning` is called once per call, with the summary, when outbound audio is
122
- queued but no RTP packet has been written for 2 s while media is connected.
123
- Nothing is restarted; the callback exists so the failing direction is named in
124
- the agent's logs.
125
-
126
- `RelayCallTransport` consumes the SDK's `CallRoom`; it does not duplicate the
127
- room protocol. The default engine is `werift` (pure TypeScript WebRTC) with
128
- `@evan/opus` (prebuilt Opus, WASM fallback), so no native WebRTC binding is
129
- loaded. Pass `engine: "wrtc"` to use the optional `@roamhq/wrtc` binding
130
- instead. The transport boundary remains provider-neutral for additional adapters. `@livekit/agents`
131
- and `@livekit/rtc-node` are peer dependencies so the host agent process owns
132
- those runtimes.
62
+ `RelayLiveKitCall.connect()` accepts the transport's `iceServers`,
63
+ `iceTransportPolicy` and `sessionConnectTimeoutMs`; `call.waitForPeerAudio()`
64
+ and `call.diagnostics()` read the transport. Video, ICE servers, restarts and
65
+ diagnostics are documented with the transport in the
66
+ [`@relaymessenger/sdk` README](https://github.com/RelayMessenger/Relay-SDK/tree/main/packages/sdk#join-a-call-as-the-agent).
67
+ `@livekit/agents` and `@livekit/rtc-node` are peer dependencies so the host
68
+ agent process owns those runtimes.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,2 @@
1
- export { RelayAudioInput, RelayAudioOutput, RelayLiveKitCall, createRelayLiveKitAudio, type RelayLiveKitAudio, type RelayLiveKitAudioOptions, type RelayLiveKitConnectOptions, } from "./livekit.js";
2
- export { RelayCallTransport, RelayCallTransportError, type RelayAudioFrame, type RelayCallEngine, type RelayCallIceDiagnostics, type RelayCallInboundDiagnostics, type RelayCallOutboundDiagnostics, type RelayCallRoomDiagnostics, type RelayCallTransportCloseEvent, type RelayCallTransportOptions, type RelayIceServer, type RelayIceTransportPolicy, } from "./transport.js";
3
- export { createWeriftWebRTCFactory } from "./engine-werift.js";
1
+ export { RelayAudioInput, RelayAudioOutput, LIVEKIT_ROOM_INPUT_AUDIO, RelayLiveKitCall, createRelayLiveKitAudio, type RelayLiveKitAudio, type RelayLiveKitAudioOptions, type RelayLiveKitConnectOptions, } from "./livekit.js";
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,GAChC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,KAAK,uBAAuB,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,GAChC,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,2 @@
1
- export { RelayAudioInput, RelayAudioOutput, RelayLiveKitCall, createRelayLiveKitAudio, } from "./livekit.js";
2
- export { RelayCallTransport, RelayCallTransportError, } from "./transport.js";
3
- export { createWeriftWebRTCFactory } from "./engine-werift.js";
1
+ export { RelayAudioInput, RelayAudioOutput, LIVEKIT_ROOM_INPUT_AUDIO, RelayLiveKitCall, createRelayLiveKitAudio, } from "./livekit.js";
4
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,GAIxB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,GAWxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,GAIxB,MAAM,cAAc,CAAC"}
package/dist/livekit.d.ts CHANGED
@@ -2,7 +2,18 @@ import { AudioInput, AudioOutput, type AgentSession } from "@livekit/agents";
2
2
  import { AudioFrame } from "@livekit/rtc-node";
3
3
  import type Relay from "@relaymessenger/sdk";
4
4
  import type { CallRoomOptions } from "@relaymessenger/sdk";
5
- import { RelayCallTransport, type RelayCallIceDiagnostics, type RelayIceServer, type RelayIceTransportPolicy } from "./transport.js";
5
+ import { RelayCallTransport, type RelayCallIceDiagnostics, type RelayIceServer, type RelayIceServersProvider, type RelayInboundAudioFormat, type RelayIceTransportPolicy } from "@relaymessenger/sdk/calls";
6
+ /**
7
+ * The format LiveKit's own room input hands an AgentSession:
8
+ * `@livekit/agents` dist/voice/room_io/room_io.js:46-48
9
+ * `DEFAULT_ROOM_INPUT_OPTIONS = { audioSampleRate: 24e3, audioNumChannels: 1 }`,
10
+ * passed to the participant `AudioStream` (room_io.js:373-374). Plugins
11
+ * resample assuming the channel count they construct with
12
+ * (`@livekit/agents-plugin-google` 1.9.0 realtime_api.js:1307-1329
13
+ * `new AudioResampler(frame.sampleRate, 16000, 1)`; rtc-node's resampler reads
14
+ * raw bytes and ignores `frame.channels`), so the session must receive mono.
15
+ */
16
+ export declare const LIVEKIT_ROOM_INPUT_AUDIO: Readonly<RelayInboundAudioFormat>;
6
17
  /** LiveKit Agents input backed by the remote Relay participant's WebRTC audio. */
7
18
  export declare class RelayAudioInput extends AudioInput {
8
19
  #private;
@@ -10,11 +21,27 @@ export declare class RelayAudioInput extends AudioInput {
10
21
  setAttached(attached: boolean): void;
11
22
  close(): Promise<void>;
12
23
  }
13
- /** LiveKit Agents output that publishes TTS PCM to the Relay participant. */
24
+ /**
25
+ * LiveKit Agents output that publishes TTS PCM to the Relay participant.
26
+ *
27
+ * Shape copied from `@livekit/agents` `ParticipantAudioOutput`
28
+ * (dist/voice/room_io/_output.js): `captureFrame` hands the frame to the
29
+ * transport and returns without waiting for playout, `flush()` starts a playout
30
+ * task that reports `onPlaybackFinished` only once the transport has drained,
31
+ * and `clearBuffer()` resolves the interruption future so that task reports
32
+ * `interrupted: true` with the position actually played.
33
+ */
14
34
  export declare class RelayAudioOutput extends AudioOutput {
15
35
  #private;
16
36
  constructor(transport: RelayCallTransport, sampleRate?: number);
37
+ /**
38
+ * Hands the frame to the transport, which holds it until the person receives
39
+ * the agent's audio (PROTOCOL.md section 6b) and resolves once it is queued,
40
+ * so this waits as LiveKit's room audio output waits for the track's
41
+ * subscription. A frame dropped by `clearBuffer()` meanwhile is not counted.
42
+ */
17
43
  captureFrame(frame: AudioFrame): Promise<void>;
44
+ /** Mark the segment complete; `onPlaybackFinished` fires once the transport has drained. */
18
45
  flush(): void;
19
46
  clearBuffer(): void;
20
47
  close(): void;
@@ -32,14 +59,25 @@ export interface RelayLiveKitConnectOptions extends RelayLiveKitAudioOptions {
32
59
  relay: Relay;
33
60
  callId: string;
34
61
  room?: CallRoomOptions;
35
- /** STUN and TURN servers for the agent's WebRTC peer. Defaults to none. */
36
- iceServers?: RelayIceServer[];
62
+ /**
63
+ * STUN and TURN servers for the agent's WebRTC peer. Defaults to the servers
64
+ * the Call room sends (Cloudflare STUN plus TURN credentials Relay mints). A
65
+ * function is called again before every restart, to mint fresh TURN credentials.
66
+ */
67
+ iceServers?: RelayIceServer[] | RelayIceServersProvider;
37
68
  /** `"relay"` forces TURN. Defaults to `"all"`. */
38
69
  iceTransportPolicy?: RelayIceTransportPolicy;
39
- /** Maximum wait for WebRTC media to connect. Defaults to 15 seconds. */
70
+ /**
71
+ * How long one SFU session has to connect before the transport restarts onto
72
+ * a new one. Defaults to 5 seconds. `connect()` has no overall deadline.
73
+ */
74
+ sessionConnectTimeoutMs?: number;
75
+ /** @deprecated Use `sessionConnectTimeoutMs`; now the per-session wait, not a `connect()` deadline. */
40
76
  mediaConnectTimeoutMs?: number;
41
- /** @deprecated Use `mediaConnectTimeoutMs`. */
77
+ /** @deprecated Use `sessionConnectTimeoutMs`. */
42
78
  connectionTimeoutMs?: number;
79
+ /** Aborting stops `connect()` and closes the transport; the Call itself is not ended. */
80
+ signal?: AbortSignal;
43
81
  }
44
82
  type AgentSessionAudioTarget = Pick<AgentSession, "input" | "output">;
45
83
  /**
@@ -56,6 +94,12 @@ export declare class RelayLiveKitCall {
56
94
  static connect(options: RelayLiveKitConnectOptions): Promise<RelayLiveKitCall>;
57
95
  attach(session: AgentSessionAudioTarget): void;
58
96
  detach(): void;
97
+ /**
98
+ * Resolves once the person's audio has arrived and the room shows them
99
+ * connected (the transport's `peerAudio`). Await it before starting the
100
+ * AgentSession so the greeting is heard.
101
+ */
102
+ waitForPeerAudio(timeoutMs: number): Promise<void>;
59
103
  /** ICE candidates and state transitions for this call, with a one-line summary for logs. */
60
104
  diagnostics(): RelayCallIceDiagnostics;
61
105
  setMuted(muted: boolean): void;
@@ -1 +1 @@
1
- {"version":3,"file":"livekit.d.ts","sourceRoot":"","sources":["../src/livekit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EACL,kBAAkB,EAElB,KAAK,uBAAuB,EAE5B,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAE7B,MAAM,gBAAgB,CAAC;AAExB,kFAAkF;AAClF,qBAAa,eAAgB,SAAQ,UAAU;;gBAOjC,SAAS,EAAE,kBAAkB;IAmBhC,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAI9B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAOtC;AAED,6EAA6E;AAC7E,qBAAa,gBAAiB,SAAQ,WAAW;;gBAOnC,SAAS,EAAE,kBAAkB,EAAE,UAAU,SAAS;IAK/C,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBpD,KAAK,IAAI,IAAI;IAUb,WAAW,IAAI,IAAI;IAa5B,KAAK,IAAI,IAAI;CAWd;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,e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put, AudioOutput, Future } from "@livekit/agents";
2
2
  import { AudioFrame } from "@livekit/rtc-node";
3
3
  import { TransformStream } from "node:stream/web";
4
- import { RelayCallTransport, } from "./transport.js";
4
+ import { RelayCallTransport, } from "@relaymessenger/sdk/calls";
5
+ /**
6
+ * The format LiveKit's own room input hands an AgentSession:
7
+ * `@livekit/agents` dist/voice/room_io/room_io.js:46-48
8
+ * `DEFAULT_ROOM_INPUT_OPTIONS = { audioSampleRate: 24e3, audioNumChannels: 1 }`,
9
+ * passed to the participant `AudioStream` (room_io.js:373-374). Plugins
10
+ * resample assuming the channel count they construct with
11
+ * (`@livekit/agents-plugin-google` 1.9.0 realtime_api.js:1307-1329
12
+ * `new AudioResampler(frame.sampleRate, 16000, 1)`; rtc-node's resampler reads
13
+ * raw bytes and ignores `frame.channels`), so the session must receive mono.
14
+ */
15
+ export const LIVEKIT_ROOM_INPUT_AUDIO = Object.freeze({
16
+ sampleRate: 24_000,
17
+ channelCount: 1,
18
+ });
5
19
  /** LiveKit Agents input backed by the remote Relay participant's WebRTC audio. */
6
20
  export class RelayAudioInput extends AudioInput {
7
21
  #transport;
8
22
  #writer;
9
23
  #onAudio;
24
+ /** Serial write chain: each frame waits for the writer, as `pipeTo` does in LiveKit's input. */
25
+ #writes = Promise.resolve();
10
26
  #attached = false;
11
27
  #closed = false;
12
28
  constructor(transport) {
@@ -19,7 +35,16 @@ export class RelayAudioInput extends AudioInput {
19
35
  if (this.#closed || !this.#attached)
20
36
  return;
21
37
  const audio = new AudioFrame(frame.samples, frame.sampleRate, frame.channelCount, frame.samples.length / frame.channelCount);
22
- void this.#writer.write(audio).catch(() => undefined);
38
+ // LiveKit's ParticipantAudioInputStream pipes its AudioStream into the
39
+ // session with `pipeTo(output.writable)` (room_io/_input.js:161-162),
40
+ // which awaits the writer before each chunk. The transport pushes and
41
+ // cannot be paused, so the frames wait here in order instead.
42
+ this.#writes = this.#writes
43
+ .then(async () => {
44
+ await this.#writer.ready;
45
+ await this.#writer.write(audio);
46
+ })
47
+ .catch(() => undefined);
23
48
  };
24
49
  this.#transport.on("audio", this.#onAudio);
25
50
  }
@@ -31,56 +56,91 @@ export class RelayAudioInput extends AudioInput {
31
56
  return;
32
57
  this.#closed = true;
33
58
  this.#transport.off("audio", this.#onAudio);
59
+ await this.#writes;
34
60
  await this.#writer.close().catch(() => undefined);
35
61
  await super.close();
36
62
  }
37
63
  }
38
- /** LiveKit Agents output that publishes TTS PCM to the Relay participant. */
64
+ /**
65
+ * LiveKit Agents output that publishes TTS PCM to the Relay participant.
66
+ *
67
+ * Shape copied from `@livekit/agents` `ParticipantAudioOutput`
68
+ * (dist/voice/room_io/_output.js): `captureFrame` hands the frame to the
69
+ * transport and returns without waiting for playout, `flush()` starts a playout
70
+ * task that reports `onPlaybackFinished` only once the transport has drained,
71
+ * and `clearBuffer()` resolves the interruption future so that task reports
72
+ * `interrupted: true` with the position actually played.
73
+ */
39
74
  export class RelayAudioOutput extends AudioOutput {
40
75
  #transport;
41
- #segmentDuration = 0;
42
- #segmentStarted = false;
43
- #segmentStartedAt = 0;
76
+ /** Seconds pushed to the transport in the open segment. */
77
+ #pushedDuration = 0;
78
+ #firstFrameEmitted = false;
79
+ #flushTask;
80
+ #flushDone = true;
81
+ /** Resolved by `clearBuffer()` with the milliseconds still queued at that moment. */
82
+ #interruptedFuture = new Future();
83
+ /** Bumped by `clearBuffer()`; a frame the transport dropped across it is not counted (agents-js `interruptionGeneration`). */
84
+ #interruptionGeneration = 0;
44
85
  #closed = false;
45
86
  constructor(transport, sampleRate = 48_000) {
46
87
  super(sampleRate, undefined, { pause: false });
47
88
  this.#transport = transport;
48
89
  }
90
+ /**
91
+ * Hands the frame to the transport, which holds it until the person receives
92
+ * the agent's audio (PROTOCOL.md section 6b) and resolves once it is queued,
93
+ * so this waits as LiveKit's room audio output waits for the track's
94
+ * subscription. A frame dropped by `clearBuffer()` meanwhile is not counted.
95
+ */
49
96
  async captureFrame(frame) {
50
97
  if (this.#closed)
51
98
  throw new Error("Relay LiveKit audio output is closed.");
52
- await super.captureFrame(frame);
53
- if (!this.#segmentStarted) {
54
- this.#segmentStarted = true;
55
- this.#segmentStartedAt = Date.now();
56
- this.onPlaybackStarted(this.#segmentStartedAt);
99
+ if (this.#flushTask && !this.#flushDone) {
100
+ this.logger.error("captureFrame called while flush is in progress");
101
+ await this.#flushTask;
57
102
  }
58
- this.#segmentDuration += frame.samplesPerChannel / frame.sampleRate;
103
+ const interruptionGeneration = this.#interruptionGeneration;
104
+ // Resolves once the slices are queued; the engine's pump paces the wire.
59
105
  await this.#transport.writeAudio({
60
106
  samples: frame.data,
61
107
  sampleRate: frame.sampleRate,
62
108
  channelCount: frame.channels,
63
109
  });
110
+ if (interruptionGeneration !== this.#interruptionGeneration)
111
+ return;
112
+ await super.captureFrame(frame);
113
+ if (!this.#firstFrameEmitted) {
114
+ this.#firstFrameEmitted = true;
115
+ this.onPlaybackStarted(Date.now());
116
+ }
117
+ this.#pushedDuration += frame.samplesPerChannel / frame.sampleRate;
64
118
  }
119
+ /** Mark the segment complete; `onPlaybackFinished` fires once the transport has drained. */
65
120
  flush() {
66
121
  super.flush();
67
- if (!this.#segmentStarted)
122
+ if (!this.#pushedDuration)
123
+ return;
124
+ if (this.#flushTask && !this.#flushDone)
68
125
  return;
69
- this.onPlaybackFinished({
70
- playbackPosition: this.#segmentDuration,
71
- interrupted: false,
126
+ this.#flushDone = false;
127
+ this.#flushTask = this.#waitForPlayoutTask().finally(() => {
128
+ this.#flushDone = true;
72
129
  });
73
- this.#resetSegment();
130
+ void this.#flushTask.catch(() => undefined);
74
131
  }
75
132
  clearBuffer() {
133
+ this.#interruptionGeneration += 1;
134
+ const queuedMs = this.#transport.queuedAudioMs();
76
135
  this.#transport.clearAudio();
77
- if (!this.#segmentStarted)
136
+ if (this.#interruptedFuture.done)
78
137
  return;
79
- this.onPlaybackFinished({
80
- playbackPosition: Math.min(this.#segmentDuration, Math.max(0, (Date.now() - this.#segmentStartedAt) / 1_000)),
81
- interrupted: true,
82
- });
83
- this.#resetSegment();
138
+ if (this.#pushedDuration === 0 && this.pendingPlayoutSegments === 0)
139
+ return;
140
+ if (!this.#flushTask || this.#flushDone)
141
+ this.flush();
142
+ if (!this.#interruptedFuture.done)
143
+ this.#interruptedFuture.resolve(queuedMs);
84
144
  }
85
145
  close() {
86
146
  if (this.#closed)
@@ -88,10 +148,19 @@ export class RelayAudioOutput extends AudioOutput {
88
148
  this.#closed = true;
89
149
  this.clearBuffer();
90
150
  }
91
- #resetSegment() {
92
- this.#segmentDuration = 0;
93
- this.#segmentStarted = false;
94
- this.#segmentStartedAt = 0;
151
+ async #waitForPlayoutTask() {
152
+ const interruptedFuture = this.#interruptedFuture;
153
+ await Promise.race([this.#transport.waitForPlayout(), interruptedFuture.await]);
154
+ const interrupted = interruptedFuture.done;
155
+ let playbackPosition = this.#pushedDuration;
156
+ if (interrupted) {
157
+ playbackPosition = Math.max(0, playbackPosition - interruptedFuture.result / 1_000);
158
+ }
159
+ this.#pushedDuration = 0;
160
+ this.#firstFrameEmitted = false;
161
+ if (this.#interruptedFuture === interruptedFuture)
162
+ this.#interruptedFuture = new Future();
163
+ this.onPlaybackFinished({ playbackPosition, interrupted });
95
164
  }
96
165
  }
97
166
  /** Build LiveKit Agents audio IO around an already-connected Relay transport. */
@@ -119,6 +188,7 @@ export class RelayLiveKitCall {
119
188
  const transportOptions = {
120
189
  relay: options.relay,
121
190
  callId: options.callId,
191
+ inboundAudio: LIVEKIT_ROOM_INPUT_AUDIO,
122
192
  ...(options.room ? { room: options.room } : {}),
123
193
  ...(options.roomClient ? { roomClient: options.roomClient } : {}),
124
194
  ...(options.webRTC ? { webRTC: options.webRTC } : {}),
@@ -127,6 +197,9 @@ export class RelayLiveKitCall {
127
197
  ...(options.iceGatheringTimeoutMs === undefined
128
198
  ? {}
129
199
  : { iceGatheringTimeoutMs: options.iceGatheringTimeoutMs }),
200
+ ...(options.sessionConnectTimeoutMs === undefined
201
+ ? {}
202
+ : { sessionConnectTimeoutMs: options.sessionConnectTimeoutMs }),
130
203
  ...(options.mediaConnectTimeoutMs === undefined
131
204
  ? {}
132
205
  : { mediaConnectTimeoutMs: options.mediaConnectTimeoutMs }),
@@ -135,7 +208,7 @@ export class RelayLiveKitCall {
135
208
  : { connectionTimeoutMs: options.connectionTimeoutMs }),
136
209
  };
137
210
  const transport = new RelayCallTransport(transportOptions);
138
- await transport.connect();
211
+ await transport.connect(options.signal ? { signal: options.signal } : {});
139
212
  return new RelayLiveKitCall(transport, createRelayLiveKitAudio(transport, options));
140
213
  }
141
214
  attach(session) {
@@ -156,6 +229,14 @@ export class RelayLiveKitCall {
156
229
  this.#session.output.audio = null;
157
230
  this.#session = undefined;
158
231
  }
232
+ /**
233
+ * Resolves once the person's audio has arrived and the room shows them
234
+ * connected (the transport's `peerAudio`). Await it before starting the
235
+ * AgentSession so the greeting is heard.
236
+ */
237
+ waitForPeerAudio(timeoutMs) {
238
+ return this.transport.waitForPeerAudio(timeoutMs);
239
+ }
159
240
  /** ICE candidates and state transitions for this call, with a one-line summary for logs. */
160
241
  diagnostics() {
161
242
  return this.transport.diagnostics();
@@ -1 +1 @@
1
- {"version":3,"file":"livekit.js","sourceRoot":"","sources":["../src/livekit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAqB,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAoC,MAAM,iBAAiB,CAAC;AAGpF,OAAO,EACL,kBAAkB,GAOnB,MAAM,gBAAgB,CAAC;AAExB,kFAAkF;AAClF,MAAM,OAAO,eAAgB,SAAQ,UAAU;IACpC,UAAU,CAAqB;IAC/B,OAAO,CAA0C;IACjD,QAAQ,CAAmC;IACpD,SAAS,GAAG,KAAK,CAAC;IAClB,OAAO,GAAG,KAAK,CAAC;IAEhB,YAAY,SAA6B;QACvC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,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CAAC,KAAK,EAAE,CAAC;QACpB,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@relaymessenger/livekit",
3
- "version": "0.1.0-staging.2",
4
- "description": "Relay WebRTC audio transport and LiveKit Agents integration for Node.js.",
3
+ "version": "0.1.0-staging.21",
4
+ "description": "LiveKit Agents audio input and output for Relay Calls, over @relaymessenger/sdk/calls.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.js",
@@ -12,11 +12,6 @@
12
12
  "import": "./dist/index.js",
13
13
  "default": "./dist/index.js"
14
14
  },
15
- "./transport": {
16
- "types": "./dist/transport.d.ts",
17
- "import": "./dist/transport.js",
18
- "default": "./dist/transport.js"
19
- },
20
15
  "./package.json": "./package.json"
21
16
  },
22
17
  "files": [
@@ -38,11 +33,13 @@
38
33
  "license": "MIT",
39
34
  "dependencies": {
40
35
  "@evan/opus": "1.0.3",
41
- "@relaymessenger/sdk": "0.3.6-staging.14",
36
+ "@relaymessenger/sdk": "0.3.6-staging.28",
37
+ "rtp-packet": "0.4.2",
42
38
  "werift": "0.24.4"
43
39
  },
44
40
  "optionalDependencies": {
45
- "@roamhq/wrtc": "^0.10.0"
41
+ "@roamhq/wrtc": "^0.10.0",
42
+ "node-webcodecs": "1.3.0"
46
43
  },
47
44
  "peerDependencies": {
48
45
  "@livekit/agents": "^1.9.0",
@@ -72,6 +69,7 @@
72
69
  "livekit",
73
70
  "webrtc",
74
71
  "voice",
72
+ "video",
75
73
  "agents"
76
74
  ]
77
75
  }
@@ -1,19 +0,0 @@
1
- import { RTCPeerConnection } from "werift";
2
- import type { RelayAudioSourceLike, RelayPeerConnectionConfig, RelayWebRTCFactory } from "./transport.js";
3
- /** Opus on the wire is always 48 kHz; Relay sends stereo so callers may pass either channel count. */
4
- export declare const WERIFT_SAMPLE_RATE = 48000;
5
- export declare const WERIFT_CHANNEL_COUNT = 2;
6
- /** One RTP packet carries 20 ms: 960 frames at 48 kHz, timestamp advances by 960. */
7
- export declare const WERIFT_PACKET_MS = 20;
8
- export type WeriftAudioSourceData = Parameters<RelayAudioSourceLike["onData"]>[0];
9
- /** Packets counted for `diagnostics()`; the recent window is the last 5 s. */
10
- export declare const STATS_WINDOW_MS = 5000;
11
- /** Convert any PCM16 frame to interleaved 48 kHz stereo by linear interpolation. */
12
- export declare const toWireFormat: (data: {
13
- samples: Int16Array;
14
- sampleRate: number;
15
- channelCount: number;
16
- }) => Int16Array;
17
- export declare const createWeriftPeerConnection: (config?: RelayPeerConnectionConfig) => RTCPeerConnection;
18
- export declare const createWeriftWebRTCFactory: () => RelayWebRTCFactory;
19
- //# sourceMappingURL=engine-werift.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine-werift.d.ts","sourceRoot":"","sources":["../src/engine-werift.ts"],"names":[],"mappings":"AAiCA,OAAO,EAGL,iBAAiB,EAIlB,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAGV,oBAAoB,EAGpB,yBAAyB,EAEzB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,sGAAsG;AACtG,eAAO,MAAM,kBAAkB,QAAS,CAAC;AACzC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,qFAAqF;AACrF,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAMnC,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAElF,8EAA8E;AAC9E,eAAO,MAAM,eAAe,OAAQ,CAAC;AA8BrC,oFAAoF;AACpF,eAAO,MAAM,YAAY,GAAI,MAAM;IACjC,OAAO,EAAE,UAAU,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,KAAG,UAwBH,CAAC;AAuJF,eAAO,MAAM,0BAA0B,GACrC,SAAQ,yBAAyE,KAChF,iBAcC,CAAC;AAEL,eAAO,MAAM,yBAAyB,QAAO,kBAI3C,CAAC"}