diff --git a/.changeset/add-participant-kind-details.md b/.changeset/add-participant-kind-details.md new file mode 100644 index 00000000..3f66feb9 --- /dev/null +++ b/.changeset/add-participant-kind-details.md @@ -0,0 +1,5 @@ +--- +'@livekit/rtc-node': patch +--- + +Expose `kindDetails` on `Participant` and re-export the `ParticipantKindDetail` enum diff --git a/.changeset/agent-dispatch-connector-protocol-bump.md b/.changeset/agent-dispatch-connector-protocol-bump.md new file mode 100644 index 00000000..b9143bdc --- /dev/null +++ b/.changeset/agent-dispatch-connector-protocol-bump.md @@ -0,0 +1,10 @@ +--- +'livekit-server-sdk': patch +--- + +Bump `@livekit/protocol` to `1.45.6` and surface new fields on the agent dispatch and connector clients: + +- `AgentDispatchClient.createDispatch`: new `restartPolicy` option (cloud only) +- `ConnectorClient.dialWhatsAppCall` / `acceptWhatsAppCall`: new `ringingTimeout` option (and `waitUntilAnswered` on accept) +- `ConnectorClient.disconnectWhatsAppCall`: new optional `disconnectReason` parameter +- Re-export `JobRestartPolicy` and `DisconnectWhatsAppCallRequest_DisconnectReason` diff --git a/examples/agent-dispatch/package.json b/examples/agent-dispatch/package.json index 30264f0b..efc6a114 100644 --- a/examples/agent-dispatch/package.json +++ b/examples/agent-dispatch/package.json @@ -14,7 +14,7 @@ "dependencies": { "dotenv": "^16.4.5", "livekit-server-sdk": "workspace:*", - "@livekit/protocol": "^1.43.4" + "@livekit/protocol": "^1.45.6" }, "devDependencies": { "@types/node": "^20.10.4", diff --git a/packages/livekit-rtc/package.json b/packages/livekit-rtc/package.json index 7d01872d..e9501da1 100644 --- a/packages/livekit-rtc/package.json +++ b/packages/livekit-rtc/package.json @@ -33,7 +33,7 @@ "@datastructures-js/deque": "1.0.8", "@livekit/mutex": "^1.0.0", "@livekit/typed-emitter": "^3.0.0", - "@livekit/rtc-ffi-bindings": "0.12.52-patch.0", + "@livekit/rtc-ffi-bindings": "0.12.53", "pino": "^9.0.0", "pino-pretty": "^13.0.0" }, diff --git a/packages/livekit-rtc/src/index.ts b/packages/livekit-rtc/src/index.ts index 6cc9652f..adfa0227 100644 --- a/packages/livekit-rtc/src/index.ts +++ b/packages/livekit-rtc/src/index.ts @@ -15,7 +15,11 @@ export type { E2EEOptions, KeyProviderOptions } from './e2ee.js'; export { dispose } from './ffi_client.js'; export { LocalParticipant, Participant, RemoteParticipant } from './participant.js'; export { EncryptionState, EncryptionType } from '@livekit/rtc-ffi-bindings'; -export { DisconnectReason, ParticipantKind } from '@livekit/rtc-ffi-bindings'; +export { + DisconnectReason, + ParticipantKind, + ParticipantKindDetail, +} from '@livekit/rtc-ffi-bindings'; export { ConnectionQuality, ConnectionState, diff --git a/packages/livekit-rtc/src/participant.ts b/packages/livekit-rtc/src/participant.ts index 5abdc2ea..d57a2f19 100644 --- a/packages/livekit-rtc/src/participant.ts +++ b/packages/livekit-rtc/src/participant.ts @@ -7,6 +7,7 @@ import { type OwnedParticipant, type ParticipantInfo, ParticipantKind, + type ParticipantKindDetail, } from '@livekit/rtc-ffi-bindings'; import { ChatMessage as ChatMessageModel, @@ -128,6 +129,10 @@ export abstract class Participant { return this.info.kind ?? ParticipantKind.STANDARD; } + get kindDetails(): ParticipantKindDetail[] { + return this.info.kindDetails ?? []; + } + get disconnectReason(): DisconnectReason | undefined { if (this.info.disconnectReason === DisconnectReason.UNKNOWN_REASON) { return undefined; diff --git a/packages/livekit-server-sdk/package.json b/packages/livekit-server-sdk/package.json index 4ebc9d1a..c78fbb20 100644 --- a/packages/livekit-server-sdk/package.json +++ b/packages/livekit-server-sdk/package.json @@ -44,7 +44,7 @@ }, "dependencies": { "@bufbuild/protobuf": "^1.10.1", - "@livekit/protocol": "^1.43.1", + "@livekit/protocol": "^1.45.6", "camelcase-keys": "^9.0.0", "jose": "^5.1.2" }, diff --git a/packages/livekit-server-sdk/src/AgentDispatchClient.ts b/packages/livekit-server-sdk/src/AgentDispatchClient.ts index 91dbabb5..5fc0698f 100644 --- a/packages/livekit-server-sdk/src/AgentDispatchClient.ts +++ b/packages/livekit-server-sdk/src/AgentDispatchClient.ts @@ -5,6 +5,7 @@ import { AgentDispatch, CreateAgentDispatchRequest, DeleteAgentDispatchRequest, + type JobRestartPolicy, ListAgentDispatchRequest, ListAgentDispatchResponse, } from '@livekit/protocol'; @@ -16,6 +17,8 @@ interface CreateDispatchOptions { // any custom data to send along with the job. // note: this is different from room and participant metadata metadata?: string; + // controls whether the job should be restarted when it fails (cloud only) + restartPolicy?: JobRestartPolicy; } const svc = 'AgentDispatchService'; @@ -57,6 +60,7 @@ export class AgentDispatchClient extends ServiceBase { room: roomName, agentName, metadata: options?.metadata, + restartPolicy: options?.restartPolicy, }).toJson(); const data = await this.rpc.request( svc, diff --git a/packages/livekit-server-sdk/src/ConnectorClient.ts b/packages/livekit-server-sdk/src/ConnectorClient.ts index 0500aab4..8cf055e9 100644 --- a/packages/livekit-server-sdk/src/ConnectorClient.ts +++ b/packages/livekit-server-sdk/src/ConnectorClient.ts @@ -1,8 +1,10 @@ // SPDX-FileCopyrightText: 2025 LiveKit, Inc. // // SPDX-License-Identifier: Apache-2.0 +import { Duration } from '@bufbuild/protobuf'; import type { ConnectTwilioCallRequest_TwilioCallDirection, + DisconnectWhatsAppCallRequest_DisconnectReason, RoomAgentDispatch, SessionDescription, } from '@livekit/protocol'; @@ -50,6 +52,8 @@ export interface DialWhatsAppCallOptions { participantAttributes?: { [key: string]: string }; /** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */ destinationCountry?: string; + /** Optional - Max time in seconds for the callee to answer the call */ + ringingTimeout?: number; } export interface AcceptWhatsAppCallOptions { @@ -79,6 +83,10 @@ export interface AcceptWhatsAppCallOptions { participantAttributes?: { [key: string]: string }; /** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */ destinationCountry?: string; + /** Optional - Max time in seconds for the callee to answer the call */ + ringingTimeout?: number; + /** Optional - Wait for the call to be answered before returning */ + waitUntilAnswered?: boolean; } // Twilio types @@ -148,6 +156,9 @@ export class ConnectorClient extends ServiceBase { participantMetadata, participantAttributes: options.participantAttributes, destinationCountry, + ringingTimeout: options.ringingTimeout + ? new Duration({ seconds: BigInt(options.ringingTimeout) }) + : undefined, }).toJson(); const data = await this.rpc.request( @@ -189,6 +200,10 @@ export class ConnectorClient extends ServiceBase { participantMetadata, participantAttributes: options.participantAttributes, destinationCountry, + ringingTimeout: options.ringingTimeout + ? new Duration({ seconds: BigInt(options.ringingTimeout) }) + : undefined, + waitUntilAnswered: options.waitUntilAnswered, }).toJson(); const data = await this.rpc.request( @@ -228,15 +243,19 @@ export class ConnectorClient extends ServiceBase { * Disconnect an active WhatsApp call * * @param whatsappCallId - Call ID sent by Meta - * @param whatsappApiKey - The API key of the business that is disconnecting the call + * @param whatsappApiKey - The API key of the business that is disconnecting the call. + * Required when `disconnectReason` is BUSINESS_INITIATED, optional for USER_INITIATED. + * @param disconnectReason - Optional reason for disconnecting the call. Defaults to BUSINESS_INITIATED. */ async disconnectWhatsAppCall( whatsappCallId: string, whatsappApiKey: string, + disconnectReason?: DisconnectWhatsAppCallRequest_DisconnectReason, ): Promise { const req = new DisconnectWhatsAppCallRequest({ whatsappCallId, whatsappApiKey, + disconnectReason, }).toJson(); const data = await this.rpc.request( diff --git a/packages/livekit-server-sdk/src/index.ts b/packages/livekit-server-sdk/src/index.ts index 3fdf1c1d..c13abf71 100644 --- a/packages/livekit-server-sdk/src/index.ts +++ b/packages/livekit-server-sdk/src/index.ts @@ -16,6 +16,7 @@ export { DataPacket_Kind, DialWhatsAppCallResponse, DirectFileOutput, + DisconnectWhatsAppCallRequest_DisconnectReason, DisconnectWhatsAppCallResponse, EgressInfo, EgressStatus, @@ -36,6 +37,7 @@ export { IngressVideoEncodingOptions, IngressVideoEncodingPreset, IngressVideoOptions, + JobRestartPolicy, ParticipantEgressRequest, ParticipantInfo, ParticipantInfo_State, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0265559a..61fd68f1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -75,8 +75,8 @@ importers: examples/agent-dispatch: dependencies: '@livekit/protocol': - specifier: ^1.43.4 - version: 1.45.2 + specifier: ^1.45.6 + version: 1.45.6 dotenv: specifier: ^16.4.5 version: 16.4.5 @@ -210,8 +210,8 @@ importers: specifier: ^1.0.0 version: 1.1.1 '@livekit/rtc-ffi-bindings': - specifier: 0.12.52-patch.0 - version: 0.12.52-patch.0 + specifier: 0.12.53 + version: 0.12.53 '@livekit/typed-emitter': specifier: ^3.0.0 version: 3.0.0 @@ -250,8 +250,8 @@ importers: specifier: ^1.10.1 version: 1.10.1 '@livekit/protocol': - specifier: ^1.43.1 - version: 1.45.2 + specifier: ^1.45.6 + version: 1.45.6 camelcase-keys: specifier: ^9.0.0 version: 9.1.3 @@ -962,43 +962,43 @@ packages: '@livekit/mutex@1.1.1': resolution: {integrity: sha512-EsshAucklmpuUAfkABPxJNhzj9v2sG7JuzFDL4ML1oJQSV14sqrpTYnsaOudMAw9yOaW53NU3QQTlUQoRs4czw==} - '@livekit/protocol@1.45.2': - resolution: {integrity: sha512-nCyJEM5a7tVYCgzGjHiGI/f9cbsjsj3GZt33XRLzZNQ3ddq16aj1XPtTKz+5bgn9AflSRcCO42Jr+vOUrBHahw==} + '@livekit/protocol@1.45.6': + resolution: {integrity: sha512-YPDmrUiVe1EY/q/2bD+Fp+69DWq6LZgeH+G/KEbz07OIVf8hgAYzfb1FgiOdWLRpSj06+SuTmrOY604fWNuD3w==} - '@livekit/rtc-ffi-bindings-darwin-arm64@0.12.52-patch.0': - resolution: {integrity: sha512-IKUir6goV8yVRR7E2qrAP0JtH7gUyMkO0TG8G+dopO/fkXAsPpSealgI9fLcBJl0zhKK+eGCr741r6xR+xxsVw==} + '@livekit/rtc-ffi-bindings-darwin-arm64@0.12.53': + resolution: {integrity: sha512-3feHNEK9vcMpE5X24JLm85hxNplhAnREv5HVOwsu3vTgUXR0P4ZtKO4je9vdM0DdE2vmSYBO95oMMKyt3yGr6g==} engines: {node: '>= 18'} cpu: [arm64] os: [darwin] - '@livekit/rtc-ffi-bindings-darwin-x64@0.12.52-patch.0': - resolution: {integrity: sha512-h2oKdGvK4E4nYxHc+hsHkYu+oJIhKKqrC96v1XSGa5fgIEcq4Bve6tNEwUCBTkvuGh/I2tOI83udgcF4P4+mhQ==} + '@livekit/rtc-ffi-bindings-darwin-x64@0.12.53': + resolution: {integrity: sha512-g3AOfaG4uUxAQklv6mrD/1ABMF/rJysXcaUOqemjaVDJ//ItyXr5pCou8Z3L8lxRwBW7kYKVuimMeaEMnJAbgw==} engines: {node: '>= 18'} cpu: [x64] os: [darwin] - '@livekit/rtc-ffi-bindings-linux-arm64-gnu@0.12.52-patch.0': - resolution: {integrity: sha512-bWtJ3r+wQ1Fd8s8jiM7GnBMfaKepSYk5c4bgimMIC4mkz+puChpfaj9avz1M271FUgxnIAKCTz6fPN2ygIAFnw==} + '@livekit/rtc-ffi-bindings-linux-arm64-gnu@0.12.53': + resolution: {integrity: sha512-TSaavEfqnlbqJ47gsjWMABc7payG7eAZRMW6GmsmwML7gHzIYCZrBdNfgAIR2dE4bMPd6LySjbY19SX2N0vhYw==} engines: {node: '>= 18'} cpu: [arm64] os: [linux] libc: [glibc] - '@livekit/rtc-ffi-bindings-linux-x64-gnu@0.12.52-patch.0': - resolution: {integrity: sha512-y1j4ciiCMaUrii0/XYwLFyRBRHDvx4202YCK5ePF3xB+9tW3Fuwexd/z4GuupCpP9eadGkpALCQt60wnLnFDnw==} + '@livekit/rtc-ffi-bindings-linux-x64-gnu@0.12.53': + resolution: {integrity: sha512-8cV1XXCT22uj4LMk7gVKgmETk0RXhD/UoZoZC8dpUTkUlhgRIp4JQ0jYMkWMLiWvyUsdf0PHIaX9GoNxeix4Hw==} engines: {node: '>= 18'} cpu: [x64] os: [linux] libc: [glibc] - '@livekit/rtc-ffi-bindings-win32-x64-msvc@0.12.52-patch.0': - resolution: {integrity: sha512-a7eoTor7KgN4JDPqZjyBQjgkVIZcxkyP5Iau3O/1qDaYKboLMqSYHfSAk84Un4r0SsSFvxUXXDY3boMLJ7QYow==} + '@livekit/rtc-ffi-bindings-win32-x64-msvc@0.12.53': + resolution: {integrity: sha512-MTIO0OtwRF1qSq/3HkIr5FDmF25/kWPAPLycovGgjr4m+SHQs+7NezwVc07IklmfON0Qkh8bWQL56tHd+s1Qjw==} engines: {node: '>= 18'} cpu: [x64] os: [win32] - '@livekit/rtc-ffi-bindings@0.12.52-patch.0': - resolution: {integrity: sha512-e01PH3AAS0/oN93LzgLDycDWzLGCpHqvZ35qzSuBWrG7V9mmQpdW/bOc6r9UFGZx/BcUXov4OTtao4OyDVVyHw==} + '@livekit/rtc-ffi-bindings@0.12.53': + resolution: {integrity: sha512-zHf1Bxrcm7/k1kOwKQvoTuexydGVWTqYUhUDGSYamuWuEQKKnuUw8UV5uA8xfk/F3aXUOyzWF01JIgjLhlQUKw==} engines: {node: '>= 18'} '@livekit/typed-emitter@3.0.0': @@ -4620,34 +4620,34 @@ snapshots: '@livekit/mutex@1.1.1': {} - '@livekit/protocol@1.45.2': + '@livekit/protocol@1.45.6': dependencies: '@bufbuild/protobuf': 1.10.1 - '@livekit/rtc-ffi-bindings-darwin-arm64@0.12.52-patch.0': + '@livekit/rtc-ffi-bindings-darwin-arm64@0.12.53': optional: true - '@livekit/rtc-ffi-bindings-darwin-x64@0.12.52-patch.0': + '@livekit/rtc-ffi-bindings-darwin-x64@0.12.53': optional: true - '@livekit/rtc-ffi-bindings-linux-arm64-gnu@0.12.52-patch.0': + '@livekit/rtc-ffi-bindings-linux-arm64-gnu@0.12.53': optional: true - '@livekit/rtc-ffi-bindings-linux-x64-gnu@0.12.52-patch.0': + '@livekit/rtc-ffi-bindings-linux-x64-gnu@0.12.53': optional: true - '@livekit/rtc-ffi-bindings-win32-x64-msvc@0.12.52-patch.0': + '@livekit/rtc-ffi-bindings-win32-x64-msvc@0.12.53': optional: true - '@livekit/rtc-ffi-bindings@0.12.52-patch.0': + '@livekit/rtc-ffi-bindings@0.12.53': dependencies: '@bufbuild/protobuf': 1.10.1 optionalDependencies: - '@livekit/rtc-ffi-bindings-darwin-arm64': 0.12.52-patch.0 - '@livekit/rtc-ffi-bindings-darwin-x64': 0.12.52-patch.0 - '@livekit/rtc-ffi-bindings-linux-arm64-gnu': 0.12.52-patch.0 - '@livekit/rtc-ffi-bindings-linux-x64-gnu': 0.12.52-patch.0 - '@livekit/rtc-ffi-bindings-win32-x64-msvc': 0.12.52-patch.0 + '@livekit/rtc-ffi-bindings-darwin-arm64': 0.12.53 + '@livekit/rtc-ffi-bindings-darwin-x64': 0.12.53 + '@livekit/rtc-ffi-bindings-linux-arm64-gnu': 0.12.53 + '@livekit/rtc-ffi-bindings-linux-x64-gnu': 0.12.53 + '@livekit/rtc-ffi-bindings-win32-x64-msvc': 0.12.53 '@livekit/typed-emitter@3.0.0': {}