fix(shared-llm): sort candidate tiers privacy-first (browser before server)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-10 17:23:28 +02:00
parent 64b8ab30ad
commit 716466e757

View file

@ -227,8 +227,12 @@ export class LlmOrchestrator {
* - Rule 2: sensitive content excludes mana-server + cloud * - Rule 2: sensitive content excludes mana-server + cloud
* Also always includes 'none' at the end if the task has runRules. */ * Also always includes 'none' at the end if the task has runRules. */
private candidateTiers<TIn, TOut>(task: LlmTask<TIn, TOut>): LlmTier[] { private candidateTiers<TIn, TOut>(task: LlmTask<TIn, TOut>): LlmTier[] {
// Start from the user's allowed tiers, in their preference order // Sort by privacy gradient (most private first) so the browser tier
let tiers = this.settings.allowedTiers.filter((t) => TIER_RANK[t] >= TIER_RANK[task.minTier]); // always wins over mana-server when both are enabled, regardless of
// the order the user toggled them in settings.
let tiers = this.settings.allowedTiers
.filter((t) => TIER_RANK[t] >= TIER_RANK[task.minTier])
.sort((a, b) => TIER_RANK[a] - TIER_RANK[b]);
// Rule 2: sensitive content backstop // Rule 2: sensitive content backstop
if (task.contentClass === 'sensitive') { if (task.contentClass === 'sensitive') {