/** Return the latest user-message id in the active conversation, if one exists. */
export function getActiveUserMessageId(messages) {
    for (let i = messages.length - 1; i >= 0; i--) {
        const message = messages[i];
        if (message.role === 'user') {
            return typeof message.id === 'string' && message.id.length > 0 ? message.id : undefined;
        }
    }
    return undefined;
}
//# sourceMappingURL=user-message-id.js.map