Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixes/12063-compression-profile-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- fix(dashboard): make the compression "Effective pipeline" preview honor the active profile and warn when the master switch is off (#12063)
33 changes: 33 additions & 0 deletions open-sse/services/compression/deriveEffectivePreviewPlan.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { CompressionConfig, CompressionPipelineStep } from "./types.ts";
import { deriveDefaultPlan, type DerivedPlan } from "./deriveDefaultPlan.ts";

/** Named-combo map: combo id -> its stacked pipeline (operator-defined profiles). */
export type NamedCombos = Record<string, CompressionPipelineStep[]>;

/**
* Derives the plan a live request would actually run, for STATIC preview surfaces (the
* Settings-page "Effective pipeline" text — issue #12063). Mirrors resolveBasePlan's
* precedence for the two layers that apply to an at-rest preview — the master switch, then an
* explicit active profile — but skips the request-scoped layers that don't apply outside a
* live call (request header, routing-combo override, auto-trigger): those need per-request
* context this static preview does not have.
*
* Precedence (mirrors strategySelector.ts's resolveBasePlan):
* 1. masterEnabled=false -> off
* 2. activeComboId resolves in combos -> that profile's stacked pipeline (an explicit
* operator choice, which resolveBasePlan gives precedence over the plain engines-derived
* default)
* 3. otherwise -> deriveDefaultPlan(engines, enabled)
*/
export function deriveEffectivePreviewPlan(
config: Pick<CompressionConfig, "engines" | "enabled" | "activeComboId">,
combos: NamedCombos = {}
): DerivedPlan {
if (!config.enabled) return { mode: "off", stackedPipeline: [] };

if (config.activeComboId && combos[config.activeComboId]) {
return { mode: "stacked", stackedPipeline: combos[config.activeComboId] };
}

return deriveDefaultPlan(config.engines, config.enabled);
}
38 changes: 38 additions & 0 deletions scripts/ad-hoc/add-12063-i18n-keys.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env node
// One-off, scoped i18n key insertion for issue #12063 — adds exactly the two new
// contextCombos keys (activeProfileMasterSwitchOffWarning / ...Cta) as __MISSING__
// placeholders to every non-English locale, WITHOUT touching any other pre-existing
// missing-key drift (running the full `i18n:sync-ui` would also backfill unrelated
// drift across ~1000 keys, well outside this issue's scope).
import { readFileSync, writeFileSync, readdirSync } from "node:fs";
import { join } from "node:path";

const MESSAGES_DIR = join(process.cwd(), "src/i18n/messages");
const EN = JSON.parse(readFileSync(join(MESSAGES_DIR, "en.json"), "utf8"));

const NEW_KEYS = ["activeProfileMasterSwitchOffWarning", "activeProfileMasterSwitchOffCta"];
const NAMESPACE = "contextCombos";

const enValues = Object.fromEntries(NEW_KEYS.map((k) => [k, EN[NAMESPACE][k]]));

const files = readdirSync(MESSAGES_DIR).filter((f) => f.endsWith(".json") && f !== "en.json");

let changed = 0;
for (const file of files) {
const path = join(MESSAGES_DIR, file);
const data = JSON.parse(readFileSync(path, "utf8"));
if (!data[NAMESPACE]) continue;
let touched = false;
for (const key of NEW_KEYS) {
if (!(key in data[NAMESPACE])) {
data[NAMESPACE][key] = `__MISSING__:${enValues[key]}`;
touched = true;
}
}
if (touched) {
writeFileSync(path, JSON.stringify(data, null, 2) + "\n", "utf8");
changed++;
}
}

console.log(`[add-12063-i18n-keys] updated ${changed} locale file(s)`);
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Combos screen = Compression Hub (top) + named-combos manager (below).
//
import { useEffect, useState } from "react";
import Link from "next/link";
import { useTranslations } from "next-intl";
import { STACKED_PIPELINE_ENGINE_INTENSITIES } from "@/shared/validation/compressionConfigSchemas";
import { CompressionPipelineEditor } from "@/shared/components/compression/CompressionPipelineEditor";
Expand Down Expand Up @@ -186,6 +187,22 @@ function NamedCombosManager() {
<p className="text-sm text-text-muted">{t("namedCombosDescription")}</p>
</div>

{/* #12063: the master "Prompt Compression" switch (Settings page) is a hard kill that
runs BEFORE an active profile is even considered (strategySelector.ts resolveBasePlan).
Surface that dependency here so a selected profile is never silently inert. */}
{!compressionEnabled && activeComboId && (
<div
role="alert"
data-testid="compression-master-switch-warning"
className="rounded-lg border border-amber-500/40 bg-amber-500/10 p-3 text-sm text-amber-600 dark:text-amber-400"
>
{t("activeProfileMasterSwitchOffWarning")}{" "}
<Link href="/dashboard/context/settings" className="font-medium underline">
{t("activeProfileMasterSwitchOffCta")}
</Link>
</div>
)}

<section className="rounded-lg border border-border bg-surface p-4">
<div className="grid grid-cols-1 gap-3 md:grid-cols-2">
<input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import {
OUTPUT_STYLE_IDS,
outputStyleMeta,
} from "../../../../../../open-sse/services/compression/outputStyles/catalog.ts";
import { deriveDefaultPlan } from "../../../../../../open-sse/services/compression/deriveDefaultPlan.ts";
import {
deriveEffectivePreviewPlan,
type NamedCombos,
} from "../../../../../../open-sse/services/compression/deriveEffectivePreviewPlan.ts";
import EngineGuidanceDetail from "./EngineGuidanceDetail";
import {
DEFAULT_CONTEXT_BUDGET,
Expand Down Expand Up @@ -208,6 +211,9 @@ export default function CompressionPanel() {
const uiLang = (useLocale() || "en").split("-")[0];
const [config, setConfig] = useState<CompressionConfig>(DEFAULT_CONFIG);
const [mcpAccessibility, setMcpAccessibility] = useState(true);
// Named-combo pipelines (id -> steps), so the "Effective pipeline" preview below can match
// what a live request actually runs when an active profile is selected (#12063).
const [namedCombos, setNamedCombos] = useState<NamedCombos>({});
// #7530 — per-engine expandable guidance (tradeoffs/lossy/cache-impact); collapsed by
// default so the grid stays scannable.
const [expandedGuidance, setExpandedGuidance] = useState<Record<string, boolean>>({});
Expand Down Expand Up @@ -248,6 +254,16 @@ export default function CompressionPanel() {
if (data && typeof data.enabled === "boolean") setMcpAccessibility(data.enabled);
})
.catch(() => {});

fetch("/api/context/combos")
.then((r) => (r.ok ? r.json() : null))
.then((data: { combos?: Array<{ id: string; pipeline: NamedCombos[string] }> } | null) => {
const combos = Array.isArray(data?.combos) ? data.combos : [];
const map: NamedCombos = {};
for (const combo of combos) map[combo.id] = combo.pipeline;
setNamedCombos(map);
})
.catch(() => {});
}, []);

// Persist a merge-patch. The DB persists `engines` as one whole row, so callers that
Expand Down Expand Up @@ -356,7 +372,7 @@ export default function CompressionPanel() {
}
};

const derived = deriveDefaultPlan(config.engines, config.enabled);
const derived = deriveEffectivePreviewPlan(config, namedCombos);
const derivedText =
derived.mode === "off"
? t("compressionDerivedOff")
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "حزم اللغات: {packs}",
"dragToReorder": "اسحب لإعادة ترتيب الخطوة",
"engine": "المحرك",
"intensity": "الشدة"
"intensity": "الشدة",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "لا يوجد تشغيل ضغط متاح.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "Dil paketləri: {packs}",
"dragToReorder": "Addımın sırasını dəyişmək üçün sürükləyin",
"engine": "Mühərrik",
"intensity": "İntensivlik"
"intensity": "İntensivlik",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Heç bir sıxılma icrası mövcud deyil.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "Езикови пакети: {packs}",
"dragToReorder": "Плъзнете, за да пренаредите стъпката",
"engine": "Двигател",
"intensity": "Интензивност"
"intensity": "Интензивност",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Няма налично изпълнение на компресиране.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "ভাষা প্যাক: {packs}",
"dragToReorder": "ধাপের ক্রম পরিবর্তন করতে টেনে আনুন",
"engine": "ইঞ্জিন",
"intensity": "তীব্রতা"
"intensity": "তীব্রতা",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "কোনো কম্প্রেশন রান উপলব্ধ নেই।",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "Jazykové balíčky: {packs}",
"dragToReorder": "Přetažením změňte pořadí kroku",
"engine": "Modul",
"intensity": "Intenzita"
"intensity": "Intenzita",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Není k dispozici žádný běh komprese.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "Sprogpakker: {packs}",
"dragToReorder": "Træk for at omarrangere trin",
"engine": "Motor",
"intensity": "Intensitet"
"intensity": "Intensitet",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Ingen komprimeringskørsel tilgængelig.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "Sprachpakete: {packs}",
"dragToReorder": "Ziehen, um Schritt neu anzuordnen",
"engine": "Engine",
"intensity": "Intensität"
"intensity": "Intensität",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Kein Komprimierungsdurchlauf verfügbar.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -8642,7 +8642,9 @@
"languagePacksList": "Πακέτα γλώσσας: {packs}",
"dragToReorder": "Σύρετε για αναδιάταξη βήματος",
"engine": "Μηχανή",
"intensity": "Ένταση"
"intensity": "Ένταση",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Δεν υπάρχει διαθέσιμη εκτέλεση συμπίεσης.",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8657,6 +8657,8 @@
"contextEditingNote": "Currently available for Claude (Anthropic) only. It is a delegated mode: the provider clears old tool-use blocks server-side — we do not rewrite the message. It does not affect other providers.",
"namedCombos": "Named combos",
"namedCombosDescription": "Save different pipelines and assign them to specific routing combos.",
"activeProfileMasterSwitchOffWarning": "The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "Turn it on in Settings",
"comboNamePlaceholder": "Combo name",
"descriptionPlaceholder": "Description",
"nameRequired": "Enter a combo name before saving.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "Language packs: {packs}",
"dragToReorder": "Drag to reorder step",
"engine": "Engine",
"intensity": "Intensity"
"intensity": "Intensity",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "No compression run available.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/et.json
Original file line number Diff line number Diff line change
Expand Up @@ -8642,7 +8642,9 @@
"languagePacksList": "Keelepaketid: {packs}",
"dragToReorder": "Lohistage etapi järjekorra muutmiseks",
"engine": "Mootor",
"intensity": "Intensiivsus"
"intensity": "Intensiivsus",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Ühtegi tihenduskäivitust pole saadaval.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "بسته‌های زبان: {packs}",
"dragToReorder": "برای تغییر ترتیب مرحله بکشید",
"engine": "موتور",
"intensity": "شدت"
"intensity": "شدت",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "هیچ اجرای فشرده‌سازی موجود نیست.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "Kielipaketit: {packs}",
"dragToReorder": "Vedä järjestääksesi vaiheen uudelleen",
"engine": "Moottori",
"intensity": "Voimakkuus"
"intensity": "Voimakkuus",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Pakkausajoa ei ole saatavilla.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "Packs de langue : {packs}",
"dragToReorder": "Faites glisser pour réorganiser l'étape",
"engine": "Moteur",
"intensity": "Intensité"
"intensity": "Intensité",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Aucune exécution de compression disponible.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/ga.json
Original file line number Diff line number Diff line change
Expand Up @@ -8642,7 +8642,9 @@
"languagePacksList": "Pacáistí teanga: {packs}",
"dragToReorder": "Tarraing chun céim a atheagrú",
"engine": "Inneall",
"intensity": "Déine"
"intensity": "Déine",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Níl aon rith comhbhrú ar fáil.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/gu.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "ભાષા પેક: {packs}",
"dragToReorder": "પગલાંનો ક્રમ બદલવા માટે ખેંચો",
"engine": "એન્જિન",
"intensity": "તીવ્રતા"
"intensity": "તીવ્રતા",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "કોઈ કમ્પ્રેશન રન ઉપલબ્ધ નથી.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "חבילות שפה: {packs}",
"dragToReorder": "גרור כדי לשנות את סדר השלבים",
"engine": "מנוע",
"intensity": "עוצמה"
"intensity": "עוצמה",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "אין הרצת דחיסה זמינה.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "भाषा पैक: {packs}",
"dragToReorder": "चरण का क्रम बदलने के लिए खींचें",
"engine": "इंजन",
"intensity": "तीव्रता"
"intensity": "तीव्रता",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "कोई कंप्रेशन रन उपलब्ध नहीं है।",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -8642,7 +8642,9 @@
"languagePacksList": "Jezični paketi: {packs}",
"dragToReorder": "Povucite za promjenu redoslijeda koraka",
"engine": "Motor",
"intensity": "Intenzitet"
"intensity": "Intenzitet",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Nije dostupno nijedno pokretanje kompresije.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "Nyelvi csomagok: {packs}",
"dragToReorder": "Húzza a lépés átrendezéséhez",
"engine": "Motor",
"intensity": "Intenzitás"
"intensity": "Intenzitás",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Nem áll rendelkezésre tömörítési futtatás.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "Paket bahasa: {packs}",
"dragToReorder": "Seret untuk menyusun ulang langkah",
"engine": "Mesin",
"intensity": "Intensitas"
"intensity": "Intensitas",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Tidak ada proses kompresi yang tersedia.",
Expand Down
4 changes: 3 additions & 1 deletion src/i18n/messages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,9 @@
"languagePacksList": "Pacchetti lingua: {packs}",
"dragToReorder": "Trascina per riordinare il passaggio",
"engine": "Motore",
"intensity": "Intensità"
"intensity": "Intensità",
"activeProfileMasterSwitchOffWarning": "__MISSING__:The active profile below will not run until the master \"Prompt Compression\" switch is turned on.",
"activeProfileMasterSwitchOffCta": "__MISSING__:Turn it on in Settings"
},
"compressionStudio": {
"noRun": "Nessuna esecuzione di compressione disponibile.",
Expand Down
Loading
Loading