feat(hermes): memory enable switch + clearer migration warning copy

Replaces the greyed-out "Memory is disabled" banner with a real Switch
at the top of each memory tab. Users can now toggle Hermes' memory/user
blobs without leaving CC Switch; the underlying write goes through the
merge-aware `set_memory_enabled`, so budgets and external-provider
settings survive toggle operations. The new `useToggleHermesMemoryEnabled`
mutation invalidates the limits query so the Switch state and the
amber disabled-hint update in lockstep.

Reworks the `schema_migrated_v12` health banner copy to match the
simplified "CC Switch only manages custom_providers" posture — it now
tells users to reconcile migrated dict entries via Hermes Web UI,
instead of the earlier (and now inaccurate) "CC Switch reads both".
This commit is contained in:
Jason
2026-04-20 09:49:23 +08:00
parent b8a3534cb5
commit 185ac2be9b
4 changed files with 104 additions and 4 deletions
+28
View File
@@ -125,6 +125,34 @@ export function useSaveHermesMemory() {
});
}
/**
* Toggle one memory blob's on/off flag in Hermes' `config.yaml`. Invalidates
* the limits query so the switch UI and disabled banner update immediately.
*/
export function useToggleHermesMemoryEnabled() {
const queryClient = useQueryClient();
const { t } = useTranslation();
return useMutation({
mutationFn: ({
kind,
enabled,
}: {
kind: HermesMemoryKind;
enabled: boolean;
}) => hermesApi.setMemoryEnabled(kind, enabled),
onSuccess: async () => {
await queryClient.invalidateQueries({
queryKey: hermesKeys.memoryLimits,
});
},
onError: (error) => {
toast.error(t("hermes.memory.toggleFailed"), {
description: extractErrorMessage(error) || undefined,
});
},
});
}
/**
* Returns a handler that probes the local Hermes Web UI, opens it in the
* system browser, and surfaces a localized toast on failure. Callers only