From 6295e951abd909e31dc8f9db956f7ef04c7f5c68 Mon Sep 17 00:00:00 2001 From: Dhananjay Suresh Date: Wed, 1 Apr 2026 15:58:15 -0400 Subject: [PATCH] feat(conversations): expose disconnect method for clean process exit The SessionManager already has a disconnect() method but it was not exposed through the public ConversationService API. CLI consumers that use startSession/endSession had no way to close the underlying WebSocket, causing the process to hang indefinitely due to socket.io reconnection timers keeping the event loop alive. Co-Authored-By: Claude Opus 4.6 (1M context) --- package.json | 2 +- .../conversations/conversations.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 4afa6dcfe..64cb9220a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@uipath/uipath-typescript", - "version": "1.2.1", + "version": "1.3.0", "description": "UiPath TypeScript SDK", "license": "MIT", "keywords": [ diff --git a/src/services/conversational-agent/conversations/conversations.ts b/src/services/conversational-agent/conversations/conversations.ts index 03ffae629..5b42a0519 100644 --- a/src/services/conversational-agent/conversations/conversations.ts +++ b/src/services/conversational-agent/conversations/conversations.ts @@ -467,6 +467,22 @@ export class ConversationService extends BaseService implements ConversationServ return this._sessionManager.onConnectionStatusChanged(handler); } + /** + * Disconnects the WebSocket and releases all session resources. + * + * Immediately closes the WebSocket connection and clears all per-conversation + * socket tracking. Call this after ending all sessions to allow the process to exit. + * + * @example + * ```typescript + * conversationalAgent.conversations.endSession(conversationId); + * conversationalAgent.conversations.disconnect(); + * ``` + */ + disconnect(): void { + this._sessionManager.disconnect(); + } + // ==================== Private Methods ==================== private _getEvents(): ConversationEventHelperManager {