• Executes a provided function within a managed scope, handling session creation, validation, and cleanup.

    Type Parameters

    • T = any

      Type of the result returned by the run function.

    Parameters

    • runFn: (clientId: string, agentName: string) => Promise<void | T>

      The function to execute, receiving clientId and agentName as arguments.

    • options: IScopeOptions

      Configuration options for the scope operation.

    Returns Promise<T>

    The result of the run function or void if no result is returned.

    If a session already exists for the clientId.