There is nothing vague︀ here. As a matter of fact, the specific activity of a person can turn foreign-sourced︁ income into local-sourced income.
This fact is not Thailand specific. It applies to almost all︂ countries with territorial taxation.
In most cases only truly passive income like interest from a︃ foreign bank account or dividends from a listed company which is not majority owned by︄ you has a chance to be classified as foreign-sourced.
Some countries are a bit more︅ generous and classify foreign capital gains as foreign-sourced income but that is already borderline and︆ needs to be checked twice: A daytrader with significant turnover who permanently trades foreign shares︇ on a foreign stock exchange while executing his trades with tax residency in a country︈ that has territorial taxation cannot claim that his capital gains are foreign sourced. His capital︉ gains turn automatically into local-sourced income due to the fact that he is a "professional"︊ (PE) and his income is not "passive".