Skip to content

Commit 8d6c54f

Browse files
authored
improve(ui): remove the Context Profile presets card from Quick Settings (#102748)
* fix(control-ui): remove the Context Profile presets card from Quick Settings * fix(control-ui): regenerate i18n raw-copy baseline after Gateway Host card rebase
1 parent 1fdb0e7 commit 8d6c54f

9 files changed

Lines changed: 117 additions & 745 deletions

File tree

‎ui/src/i18n/.i18n/raw-copy-baseline.json‎

Lines changed: 27 additions & 90 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ui/src/lib/config/index.test.ts‎

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
resetConfigPendingChanges,
1111
saveConfig,
1212
stageDefaultAgentConfigEntry,
13-
stageConfigPreset,
1413
updateMcpServerEnabled,
1514
updateConfigFormValue,
1615
updateConfigRawValue,
@@ -514,97 +513,6 @@ describe("updateMcpServerEnabled", () => {
514513
});
515514
});
516515

517-
describe("stageConfigPreset", () => {
518-
it("ignores preset staging before a config snapshot is ready", () => {
519-
const state = createState();
520-
521-
stageConfigPreset(state, {
522-
agents: {
523-
defaults: {
524-
bootstrapMaxChars: 50_000,
525-
bootstrapTotalMaxChars: 300_000,
526-
contextInjection: "always",
527-
},
528-
},
529-
});
530-
531-
expect(state.configForm).toBeNull();
532-
expect(state.configRaw).toBe("");
533-
expect(state.configFormDirty).toBe(false);
534-
});
535-
536-
it("stages preset changes without dropping unrelated config", () => {
537-
const state = createState();
538-
applyConfigSnapshot(state, {
539-
config: {
540-
agents: {
541-
defaults: {
542-
bootstrapMaxChars: 12_000,
543-
bootstrapTotalMaxChars: 60_000,
544-
contextInjection: "always",
545-
},
546-
},
547-
gateway: { mode: "local" },
548-
},
549-
valid: true,
550-
issues: [],
551-
raw: '{\n "agents": {\n "defaults": {\n "bootstrapMaxChars": 12000,\n "bootstrapTotalMaxChars": 60000,\n "contextInjection": "always"\n }\n },\n "gateway": {\n "mode": "local"\n }\n}\n',
552-
});
553-
554-
stageConfigPreset(state, {
555-
agents: {
556-
defaults: {
557-
bootstrapMaxChars: 50_000,
558-
bootstrapTotalMaxChars: 300_000,
559-
contextInjection: "always",
560-
},
561-
},
562-
});
563-
564-
expect(state.configFormDirty).toBe(true);
565-
expect(state.configForm).toEqual({
566-
agents: {
567-
defaults: {
568-
bootstrapMaxChars: 50_000,
569-
bootstrapTotalMaxChars: 300_000,
570-
contextInjection: "always",
571-
},
572-
},
573-
gateway: { mode: "local" },
574-
});
575-
});
576-
577-
it("stays clean when the staged preset already matches the saved config", () => {
578-
const state = createState();
579-
applyConfigSnapshot(state, {
580-
config: {
581-
agents: {
582-
defaults: {
583-
bootstrapMaxChars: 20_000,
584-
bootstrapTotalMaxChars: 150_000,
585-
contextInjection: "always",
586-
},
587-
},
588-
},
589-
valid: true,
590-
issues: [],
591-
raw: '{\n "agents": {\n "defaults": {\n "bootstrapMaxChars": 20000,\n "bootstrapTotalMaxChars": 150000,\n "contextInjection": "always"\n }\n }\n}\n',
592-
});
593-
594-
stageConfigPreset(state, {
595-
agents: {
596-
defaults: {
597-
bootstrapMaxChars: 20_000,
598-
bootstrapTotalMaxChars: 150_000,
599-
contextInjection: "always",
600-
},
601-
},
602-
});
603-
604-
expect(state.configFormDirty).toBe(false);
605-
});
606-
});
607-
608516
describe("resetConfigPendingChanges", () => {
609517
it("restores the original form and raw config snapshot", () => {
610518
const state = createState();

‎ui/src/lib/config/index.ts‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// Control UI runtime config capability and shared config-domain mutations.
2-
import { applyMergePatch } from "../../../../src/config/merge-patch.ts";
32
import type { GatewayBrowserClient } from "../../api/gateway.ts";
43
import type { ConfigSchemaResponse, ConfigSnapshot, ConfigUiHints } from "../../api/types.ts";
54
import { schemaType, type JsonSchema } from "../../components/config-form.shared.ts";
@@ -63,7 +62,6 @@ export type RuntimeConfigCapability = {
6362
removeFormValue: (path: Array<string | number>) => void;
6463
setRaw: (value: string) => void;
6564
resetDraft: () => void;
66-
stagePreset: (patch: Record<string, unknown>) => void;
6765
save: () => Promise<boolean>;
6866
apply: () => Promise<boolean>;
6967
openFile: () => Promise<void>;
@@ -634,20 +632,6 @@ export function updateConfigRawValue(state: ConfigState, value: string) {
634632
}
635633
}
636634

637-
export function stageConfigPreset(state: ConfigState, patch: Record<string, unknown>) {
638-
const snapshotConfig = resolveEditableSnapshotConfig(state.configSnapshot);
639-
const baseSource = state.configForm ?? snapshotConfig;
640-
if (!baseSource || (!state.configForm && !state.configSnapshot?.hash)) {
641-
return;
642-
}
643-
const base = cloneConfigObject(baseSource);
644-
const merged = applyMergePatch(base, patch);
645-
if (!merged || typeof merged !== "object" || Array.isArray(merged)) {
646-
return;
647-
}
648-
syncConfigDraft(state, cloneConfigObject(merged as Record<string, unknown>));
649-
}
650-
651635
export function resetConfigPendingChanges(state: ConfigState) {
652636
const editableConfig = resolveEditableSnapshotConfig(state.configSnapshot);
653637
state.configForm = cloneConfigObject(state.configFormOriginal ?? editableConfig ?? {});
@@ -872,7 +856,6 @@ export function createRuntimeConfigCapability(
872856
removeFormValue: (path) => mutate(() => removeConfigFormValue(state, path)),
873857
setRaw: (value) => mutate(() => updateConfigRawValue(state, value)),
874858
resetDraft: () => mutate(() => resetConfigPendingChanges(state)),
875-
stagePreset: (patch) => mutate(() => stageConfigPreset(state, patch)),
876859
save: () => run(() => saveConfig(state)),
877860
apply: () => run(() => applyConfig(state)),
878861
openFile: () => run(() => openConfigFile(state)),

‎ui/src/pages/config/config-page.ts‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { renderSettingsWorkspace } from "../../components/settings-workspace.ts"
2424
import { t } from "../../i18n/index.ts";
2525
import { isMissingOperatorReadScopeError } from "../../lib/gateway-errors.ts";
2626
import { renderMcp } from "./mcp.ts";
27-
import { getPresetById } from "./presets.ts";
2827
import {
2928
renderQuickSettings,
3029
type QuickSettingsChannel,
@@ -799,21 +798,10 @@ export class ConfigPage extends LitElement {
799798
assistantName: appConfig.assistantIdentity.name,
800799
version:
801800
appConfig.serverVersion ?? this.context.gateway.snapshot.hello?.server?.version ?? "",
802-
configObject,
803-
savedConfigObject:
804-
asConfigRecord(
805-
runtimeConfig.state.configFormOriginal ?? runtimeConfig.state.configSnapshot?.config,
806-
) ?? {},
807801
configDirty: runtimeConfig.state.configFormDirty,
808802
configSaving: runtimeConfig.state.configSaving,
809803
configApplying: runtimeConfig.state.configApplying,
810804
configReady: Boolean(runtimeConfig.state.configSnapshot?.hash),
811-
onSelectPreset: (id) => {
812-
const preset = getPresetById(id);
813-
if (preset) {
814-
runtimeConfig.stagePreset(preset.patch);
815-
}
816-
},
817805
onResetConfig: () => runtimeConfig.resetDraft(),
818806
onSaveConfig: () => void runtimeConfig.save(),
819807
onApplyConfig: () => void runtimeConfig.apply(),

0 commit comments

Comments
 (0)